0% found this document useful (0 votes)
3 views2 pages

SQL Assignment Questions

The document is an assignment consisting of SQL query practice questions focused on creating and manipulating databases in MySQL. It covers tasks such as creating databases and tables, inserting records, querying data, and performing updates and deletions. The questions also include operations involving joins and foreign keys to demonstrate relational database concepts.

Uploaded by

sreejaraosurabhi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

SQL Assignment Questions

The document is an assignment consisting of SQL query practice questions focused on creating and manipulating databases in MySQL. It covers tasks such as creating databases and tables, inserting records, querying data, and performing updates and deletions. The questions also include operations involving joins and foreign keys to demonstrate relational database concepts.

Uploaded by

sreejaraosurabhi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL Query Practice Questions (Assignment-MySQL)

1. Write an SQL query to create the database named 'studentdb'.

2. Write an SQL query to use the database 'studentdb'.

3. Write an SQL query to create the STUDENT table with the given attributes and primary key.

4. Write an SQL query to insert at least five records into the STUDENT table.

5. Write an SQL query to display all student names and their majors from the STUDENT table.

6. Write an SQL query to list the names of students who are majoring in 'Computer Science'.

7. Write an SQL query to display students with age greater than 20.

8. Write an SQL query to list all students in 'SR' (Senior) standing.

9. Write an SQL query to create the FACULTY table with appropriate attributes and primary key.

10. Write an SQL query to insert records into the FACULTY table.

11. Write an SQL query to display all faculty names and their department IDs.

12. Write an SQL query to list faculty members who belong to department 20.

13. Write an SQL query to create the CLASS table with foreign key referencing FACULTY.

14. Write an SQL query to insert data into the CLASS table.

15. Write an SQL query to display all classes taught by faculty ID 4822.

16. Write an SQL query to list all class names and meeting schedules from the CLASS table.

17. Write an SQL query to create the ENROLLED table with composite primary key and foreign keys

referencing STUDENT and CLASS.

18. Write an SQL query to insert at least five records into the ENROLLED table.
19. Write an SQL query to display all students enrolled in the class 'Database Systems'.

20. Write an SQL query to list all classes a student with SNUM 11546 is enrolled in.

21. Write an SQL query to find all students enrolled in the same class as '11938'.

22. Write an SQL query to list the number of students enrolled in each class.

23. Write an SQL query to display the faculty name and the classes they teach using a join.

24. Write an SQL query to display the names of students along with the class names they are

enrolled in using joins.

25. Write an SQL query to update the age of a specific student (for example, SNUM 11546) to 22.

26. Write an SQL query to delete a record from the ENROLLED table for student 55318 from the

'Operating System Design' class.

27. Write an SQL query to add a new column 'email' to the STUDENT table.

28. Write an SQL query to drop the column 'email' from the STUDENT table.

29. Write an SQL query to count the number of students majoring in 'Computer Engineering'.

30. Write an SQL query to display all classes that meet in room 'R15'.

You might also like