Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

WORKSHEET - SQL QUERIES CLASS XII SUB:COMP SC NAME:________________ DATE:_________

Consider the table given below and give the answers of the questions-

1 Identify the primary keys and foreign key in the two tables.
Ans
-
2 Write command to create the customer table by selecting suitable column as primary key.
Ans
-

3 Write command to insert first row in salesman table.


Ans
-

4 Write command to insert the following data in customer table- (3010,’Josef’,100,5050) as


customer_id , cust_name, grade,salesman_id

Ans
-

5 What is the degree and cardinality of table customer.


Ans
-
6 Add a new column status of string type in table customer
Ans
-
7 Add a new column country of string type in table salesman
Ans
-
8 In customer table fill the status value as ‘permanent’ for all customers.
Ans
-
9 In salesman table fill the country column as ‘France’ whose city is Paris.
Ans
-
10 Display name and city from salesman table.
Ans
-
12 Write query to display saleaman id, name and grade .
Ans
-
13 Display the data of salesman table in ascending order of salesman id
Ans
-
14 Display the customer names which start with ‘A’ and ends with ‘R’ from customer table
Ans
-
15 Display the details of salesman whose name starts contains 5 characters and city is Paris or Rome.
Ans
-
16 Delete the column commission from customer table.
Ans
-
17 Display the number of records city wise from customer table.
Ans
-
18 Display the total of different grades available in customer table.
Ans
-
19 Display the maximum and minimum grade for each city form customer table.
Ans
-
20 Change the type of city column in salesman table to varchar(50)
Ans
-
21 Display the details of customers from customer table whose grade lies between 200 to 400.
Ans
-
22 Select * from customer where grade =NULL Correct the query.
Ans
-
23 Write command to display the structure of table customer.
Ans
-
24 Write command to display the list of all the table .
Ans
-
25 Write command to open a database named ‘Employee’.
Ans
-
26 Identify DDL and DML commands- Upadate, Alter, Drop, Delete, Insert, Create
Ans DDL-
- DML-
27 Group functions are-
Ans
-
28 Write query to find the Cartesian product of two tables.

You might also like