0% found this document useful (1 vote)
5K views

SQL Practical Questions and Answers

The document provides 33 questions asking to write SQL commands to perform various operations on a sample Doctor table, including creating the table, inserting records, selecting records based on different criteria like gender, department, experience, and ordering results. The questions cover SQL commands for selection, insertion, updating, deletion and aggregation operations on the table.

Uploaded by

Neelima Vobugari
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
5K views

SQL Practical Questions and Answers

The document provides 33 questions asking to write SQL commands to perform various operations on a sample Doctor table, including creating the table, inserting records, selecting records based on different criteria like gender, department, experience, and ordering results. The questions cover SQL commands for selection, insertion, updating, deletion and aggregation operations on the table.

Uploaded by

Neelima Vobugari
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

COMPUTER SCIENCE

Practical
Name :Tarini
1. Write the SQL statement to create the following
table: (2)
Table Name: Doctor
DocID DNAME DEPT GENDE EXP
R
1 John Cardiology M 4
2 Swati ENT F 16
3 George Skin M 9
4 Avantika General F 8
5 Gina ENT F 12
Screenshot of the command to create the table
Screenshot of the command to insert the record
2. Identify the Primary Key, Candidate Key and the Alternate key.

Ans:

3. What is the degree and Cardinality of the


table?

Ans:
4. Write the SQL command to display all the details
from the table.

5. Write the SQL command to Doctor Name and


Dept from the table.
6. Write the SQL command to display all the Female
doctors

7. Write the SQL command to display all the details


according to the ascending order of doctor name.
8. Write the SQL command to display all the Male
Cardiologist.

9. Write the SQL command to display all the details


according to the descending order of experience
10. Write the SQL command to display all the
doctors in ENT dept

11. Write the SQL command to display the Female


doctor Name who have more than 10 years of experience
12. Write the SQL command to display all the
doctors who are not in ENT Dept

13. Write the SQL command to display the female doctor


according to the ascending order of their experience.
14. Write the SQL command to display the max
experience of the doctor

15. Write the SQL command to display the min


experience of the female Doctor.
16. Write the SQL command to display the unique
Dept from the table

17. Write the SQL command to the number of male


doctors from the table
18. Write the SQL command to display the doctor
name starting with letter ‘G’

19. . Write the SQL command to display the doctor name


ends with letter ‘a’
20. Write the SQL command to display average
experience of ENT doctors.

21. Write the SQL command to display the total


experience as OVERALL.
24. Write the command change the Dept of John to
ENT

25. Write the command to increase the experience of all


the female doctors
26. Write the command count the number of doctors
in each department

27. Write the command find the max experience of


doctors in each department
28. Write the command count number of female and
male doctor

29. Write the command to add a new column called


salary
30. Write the command to delete a record whose
DocId is 4.

31. Write the command to delete the column salary.


30. Write the command to delete a record whose
DocId is 4.

31. Write the command to delete the column salary.


32. Write the command to display the structure of
the table Doctor.

33. Write the command to delete the table.

You might also like