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

SQL Questions

Uploaded by

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

SQL Questions

Uploaded by

apar.ramaswamy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Q1 Which Command is use to add new column or attribute in a table?

Q2.Which Command is used to search for NULL values in any column?


Q3.The……. Clause of select query allow us to select any these rows in the result satisfied condition.
Q4.Which command is used to see information like name of column,data type size etc?
Q5.Which operator is used for pattern matching?
Q6.Which clause is used to see the output of query in ascending and descending order.
Q7.Which clause is used to eliminate the duplicate rows from the output.?
Q8.What is the minimum number column required to create a table?.
Q9.Which command is use to delete the table from the database?
Q10.Which command is use to delete the record or row from the table?
Q11.Which command is used to add new record or row in a table?
Q12.Which command is ysed to change the existing information or data of table?
Q13.Which command is used to change the database?
Q14.Command to remove the row from table student
Q15.What does SQL stands for?
Q16.Which constraint is used to ensure that a column cannot have NULL values?
Q17.Which command is used to create a new database?
Q18.What will be the output of the following command Select count(*) from employee;
Q19.What is the output of the following SQL statement ?
Select Ang(salary) from employee where department=’sales’;
Q22.What is the output of the following command?
Select department, count(*) from employees group by department having count(*)>5;
Q23 Which SQL aggregate function is used to count all record of a table.
Q24. Which command is used to view all tables of database?
Q25.Observe the table EMPLOYEES and DEPRTMENT and answer the question .
Table:EMPLOYEES
ENO ENAME DOJ DNO
E1 Nusrat 2001-11-21 D3
E2 Kabir 2005-10-25 D1

Table:Department
ENO DNAME
D1 ACCOUNTS
D2 HR
D3 ADMIN

1. What is the Degree of the table EMPLOYEES? What is the Cardinality of table DEPARTMENT?
2.What is primary key ? explain
3.What is selection and projection?
Q26.Write the output of the following commands on table CUSTOMERS and PURCHASES.
Table:CUSTOMERS
CNO CNAME CITIES
C1 Sanyam Delhi
C2 Shruti Delhi
C3 Mehar Mumbai
C4 Sakshi Chennai
C5 Ritish Indore
C6 Rahul Delhi
C7 Ameer Chennai
C8 Minakshi Bangalore
C9 Anshul Mumbai

Table: Purchases
Sno Qty Pur_Date Cno
S1 15 2018-12-25 C2
S2 10 2018-11-10 C1
S3 12 2018-11-10 C4
S4 7 2019-01-12 C7
S5 11 2019-02-12 C2
S6 10 2018-10-12 C6
S7 5 2019-05-09 C8
S8 20 2019-05-09 C3
S9 8 2018-05-09 C9
S10 15 2018-11-12 C5
S11 6 2018-08-04 C7
(i) Select count(distinct cities ) from customers;
(ii) Select max(Pur_Date) from Purchases;
Select CNAME,Qty ,Pur_Date from Customers,Purchases where Customers.Cno=Purchases.Cno and Qty in(10,20);
Q27 Write SQL queries which are based on the table Customers and Purchases given in question no. 26
i) To display details of all customers whose cities are neither Delhi nor Mumbai
ii) To display the CNAME and Cities of all Customers is ascending order of their CNAME.
iii) To display the numbers of Customers along with their respective cities in each of the cities .
iv) To display details of all Purchases whose Quantity is more than 15.

Q28.Table:Teachers
TID NAME AGE DEPT DOJ SAL GENDER
T118 Navin 40 Computer 2010- 12000 M
01-10
T107 Chetna 37 History 2008- 20000 F
03-24
T105 Sandeep 46 Maths 2006- 30000 M
12-12
T110 Sangeeta 35 History 2010- 25000 F
07-01
T101 Rudransh 42 Maths 2004- 40000 M
09-05
T121 Neeraj 38 Physics 2011- 28000 M
04-01
1. To show the information about the teachers of
the history department.

2. To list the names of teacher earing a salary


between 20000 and 30000

3. To count the number of male teacher.

4. Display gender wise total number of teachers.

5. To list the name , age of teachers of female teacher


in descending order of date of joining.

6. Increase the salary by 10% for maths department.

7. To delete the record the teacher Neeraj.


29.

1. To show all the information about the


patients of cardiology Department.
2. To list the names of female patients who
are either in orthopaedic or surgery
department.
3. To list the name of patients with their date of admission in ascending order.

4. To count the number of patients with age>30

5. To display various department

6. To display the number of patients in each department.

30.

1. Display the Trainer Name ,City and salary in descending order of their hire date.

2. To display the TNAME and city of trainer of joined institute in the month of December 2001.

3. To display the TNAME,HIRE DATE


,CNAME,STARTDATE from the table Trainer and course whose fees is less or equal to 10000.

4. To display number of trainer from each city.

5. select tid ,tname from trainer where city not in (‘Delhi’,’Mumbai’)

Q31.What will be the output of the following statement based on the table which are given in Q30.

1. SELECT DISTINCT TID FROM COURSE;


2. SELECT TID ,COUNT(*),MIN(FEES) FROM COURSE GROUP BY TID HAVING COUNT(*)>1;
3. SELECT COUNT(*),SUM(FEE) FROM COURSE WHERE STARTDATE<’2018-09-15’;

You might also like