G12 sql 1
G12 sql 1
1. Rashmi has forgotten the names of the databases, tables and the
structure of the tables that she had created in Relational Database
Management System (RDBMS) on her computer.
(a) Write the SQL statement to display the names of all the
databases present in RDBMS application on her
computer.
(b) Write the statement which she should execute to open
the database named "STOCK".
(c) Write the statement which she should execute to
display the structure of the table "ITEMS" existing in the
above opened database "STOCK".
2. Consider the table HOTEL given below and write any four SQL
commands :
Table : HOTEL
(i) SELECT
DISTINCT TID FROM TECH_COURSE;
(ii) SELECT TID, COUNT(*), MIN(FEES) FROM
TECH_COURSE GROUP BY TID HAVING
COUNT(TID)>1;
(iii) SELECT CNAME FROM TECH_COURSE WHERE
FEES>15000 ORDER BY CNAME;
(iv) SELECT AVG(FEES) FROM TECH_COURSE WHERE
FEES BETWEEN 15000 AND 17000;
7. Write the outputs of the SQL queries (i) to (iv) based on the
relations Teacher and Placement given below:
11. Write the output of SQL queries (a) and (b) based on the follwing
two tables DOCTOR and PATIENT belonging to the same
database:
13. Consider the following tables FACULTY and STUDENT. Write the
output for the MYSQL statement given below and state what type
of join is implemented.
SELECT * FROM FACULTY,STUDENT
(a) Write a query to change the fare to 6000 of the flight whose
FNO is F104.
(b) Write a query to display the total number of MALE and
FEMALE passengers.
(c) Write a query to display the NAME, corresponding FARE and
F_DATE of all passengers who have to START from DELHI.
(d) Write a query to delete the records of flights which end at end
MUMBAI.
**********************************************************