Topic Name : SQL Basics Test Date:- 10-04-2025
SQL Coding Questions
1. Create a Database
Write an SQL query to create a database named learnsql.
2. Create a Table
Write the SQL command to create a table called Students with the following columns:
o id (integer)
o student_name (varchar(20))
o address (varchar(20))
3. Add a Column to Table
Write an SQL query to add a column named last_name of type varchar(20) to the
Students table.
4. Add Another Column
Write an SQL statement to add a column named roll_no of type int to the Students
table.
5. Drop a Column
Write the SQL command to drop the id column from the Students table.
6. Drop Another Column
Write the SQL query to drop the column address from the Students table.
7. Rename a Column
Write an SQL command to rename the column rno to rollno with datatype INT in the
Students table.
8. Drop a Table
Write an SQL command to delete (drop) the Students table from the database.
9. Truncate Table
Write an SQL command to remove all records from the Students table without
deleting the structure of the table.
10. Use a Database
Write the SQL command to use the learnsql database.
11. Show All Tables
Write an SQL command to display all tables in the currently selected database.
12. Describe Table Structure
Write an SQL query to describe the structure of the Students table.
13. Insert Data
Assume the table Students has the structure (id INT, student_name VARCHAR(20),
address VARCHAR(20)). Write a query to insert the values (101, 'Saurabh',
'Bhusawal') into the table.
14. Update Data
Write an SQL query to update the address of student with id = 101 to 'Pune'.
15. Delete Data
Write an SQL query to delete the record of the student whose student_name is
'Saurabh'.