Work Sheet On DBMS and SQL
Work Sheet On DBMS and SQL
1. Which of the following commands will change row(s) of the table from MySQL database? (1)
(a) REPLACE TABLE (b) CHANGE TABLE (c) UPDATE (d) ALTER TABLE
3. Which of the following function can work with NULL values in a database? (1)
(a) avg() (b) sum() (c) count(*) (d) total(*)
4. Which command is used for counting the number of rows in a database? (1)
(a) row (b) rowcount (c) count() (d) row_count
5. What is the difference between ‘Primary Key’ and ‘Foreign Key’? Can a table have multiple Primary
keys or Foreign keys?
8.
(i) SELECT Dcode, MAX(UnitPrice) FROM STOCK GROUP BY Dcode;
(ii) SELECT COUNT(DISTINCT Dcode) FROM STOCK;
(iii) SELECT Qty*UnitPrice FROM STOCK WHERE ItemNo=5006;
(iv) SELECT MIN(StockDate) FROM STOCK;
9.