12.6 Practical Exercises
These exercises are designed to reinforce your understanding of SQL syntax and concepts. It is highly recommended that you use an SQL database software or an online SQL platform to perform these exercises.
Exercise 1
Create a table called "Students" with the following columns: StudentID (integer, primary key), FirstName (varchar), LastName (varchar), Age (integer), Major (varchar).
Exercise 2
Insert 5 records into the "Students" table with values of your choice.
Exercise 3
Write a query to select all students who are majoring in "Computer Science".
Exercise 4
Update the major of the student with StudentID = 1 to "Data Science".
Exercise 5
Delete the record of the student with StudentID = 1.
Exercise 6
Write a query to select all students, ordered by their age in descending order.
Exercise 7
Write a query to count the number of students for each major.
Take your time with these exercises and...