0% found this document useful (0 votes)
66 views

SQL Questions

sql

Uploaded by

cfs.hodcsnip
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

SQL Questions

sql

Uploaded by

cfs.hodcsnip
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL Questions

1. In SQL, which command will be used to add a new record in a table?

(A) UPDATE (B) ADD (C) INSERT (D) ALTER TABLE

2. Mr. Atharva is given a task to create a database, Admin. He has to create a table, users in the

database with the following columns:

User_id - int

User_name - varchar(20)

Password - varchar(10)

Help him by writing SQL queries for both tasks.

3. Ms. Rita is a database administrator at a school. She is working on the table, student containing

the columns like Stud_id, Name, Class, and Stream. She has been asked by the Principal to strike

off the record of a student named Rahul with student_id as 100 from the school records and add

another student with the following details:

Stud_id - 123

Name - Rajeev

Class - 12

Stream - Science

Help her by writing SQL queries for both tasks.

4. Consider the table Stationery and write the output of the following SQL queries:

(i) SELECT DISTRIBUTOR, SUM(QTY) FROM STATIONERY GROUP BY DISTRIBUTOR;

(ii) SELECT ITEMNO, ITEM FROM STATIONERY WHERE DISTRIBUTOR = 'Classic Plastics'

AND PRICE > 10;

(iii) SELECT ITEM, QTY * PRICE AS 'AMOUNT' FROM STATIONERY WHERE ITEMNO = 402;
5. Based on the table Rent_cab:

(i) Add a primary key to a column name Vcode.

(ii) Increase the charges of all the cabs by 10%.

(iii) Delete all the cabs whose maker name is 'Carus'.

6. Consider the tables GAMES and PLAYERS:

(i) Display the game type and average number of games played in each type.

(ii) Display prize money, name of the game, and name of the players from the tables Games and

Players.

(iii) Display the types of games without repetition.

(iv) Display the name of the game and prize money of those games whose prize money is known.

You might also like