SQL Practice Questions
SQL Practice Questions
STORE
The attributes of STORE are as follows:
ItemNo numeric, ItemName - character of size 20, Scode numeric,
-
Quantity numeric
-
[d) Abhay want to remove the table STORE from the database MyStore. Which command will he use
from the following:
a) DELETE FROM store; b) DROP TABLE store;
c) DROP DATABASE mystore; d) DELETE store FROM mystore;
(e) Now Abhay wants to display the structure of the table STORE, i.e, name of the attributes and their
respective data types that he has used in the table. Write the query to display the same.
8 What do you understand by Candidate Keys in a table? Give a suitable example of Candidate Keys 2
from a table containing some meaningful data.
9 Differentiate between fetchone() and fetchal) methods with suitable examples for each. 2
10 Write the full forms of DDL and DML. Write any two commands of DML in SQL. 2
11 Write the outputs of the queries (i) to (ii) based on the relations Teacher and Posting given below: 3
Table Teache Table: Posting
T_ID Name Age Department Date_o join | Salary Gender
ID Department Place
1 Jugal 34 Computer Sc 10/01/2017 | 12000 M
1 History Agra
2 Sharmila 31 History 24/03/2008 20000F Mathematics Raipur
3 Sandeep 32 Mathematics 12/12/2016| 30000 M
Computer Science Delhi
4 Sangeeta 35 History 01/07/2015 40000F
5| Rakesh 42 Mathematics 05/09/2007 25000 M
sQL commands for the following queries () to (v) based on the relations Teacher and Posting 5
12 Write
given below:
7 Shiv Om 44
Computer
25/02/2017 21000 M
Sc
Shalakha 33 Mathematics 31/07/2018 20000 F