10 SQL problem statements based on a student table, covering CREATE,
INSERT, SELECT, and SELECT with WHERE (including various conditions like
=, >, <, LIKE, BETWEEN, IN, AND, OR, NOT):
🔹 1. CREATE Table
Problem:
Write an SQL query to create a table named student with the following
fields:
student_id (INT, primary key)
name (VARCHAR(50))
age (INT)
gender (CHAR(1))
department (VARCHAR(50))
marks (INT)
🔹 2. INSERT Data
Problem:
Insert 5 sample records into the student table with varied values for
age, gender, department, and marks.
🔹 3. SELECT All Records
Problem:
Write an SQL query to display all records from the student table.
🔹 4. SELECT Specific Columns
Problem:
Write an SQL query to retrieve only the student_id, name, and department
columns from the student table.
🔹 5. SELECT with WHERE (Equality)
Problem:
Write an SQL query to retrieve all students who belong to the ‘Computer
Science’ department.
🔹 6. SELECT with WHERE (Greater Than)
Problem:
Write an SQL query to list students who have scored more than 75 marks.
🔹 7. SELECT with WHERE and BETWEEN
Problem:
Write an SQL query to display students whose age is between 18 and 22.
🔹 8. SELECT with WHERE and IN
Problem:
Write an SQL query to display students who are in either the ‘IT’, ‘ECE’,
or ‘Mechanical’ departments.
🔹 9. SELECT with WHERE and LIKE
Problem:
Write an SQL query to display students whose names start with the letter
‘A’.
🔹 10. SELECT with WHERE and Logical Operators
Problem:
Write an SQL query to find male students from the ‘Electrical’ department
who have scored more than 80 marks.