1. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
2. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
3. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
4. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
5. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
6. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
7. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
8. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
9. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
10. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;
11. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
12. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
13. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
14. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
15. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
16. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
17. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
18. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
19. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
20. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;
21. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
22. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
23. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
24. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
25. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
26. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
27. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
28. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
29. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
30. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;
31. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
32. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
33. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
34. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
35. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
36. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
37. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
38. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
39. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
40. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;
41. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
42. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
43. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
44. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
45. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
46. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
47. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
48. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
49. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
50. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;
51. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
52. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
53. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
54. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
55. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
56. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
57. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
58. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
59. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
60. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;
61. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
62. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
63. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
64. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
65. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
66. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
67. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
68. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
69. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
70. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;
71. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
72. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
73. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
74. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
75. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
76. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
77. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
78. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
79. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
80. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;
81. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
82. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
83. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
84. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
85. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
86. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
87. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
88. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
89. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
90. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;
91. What is SQL?
SQL (Structured Query Language) is used to communicate with and manage data in a relational database.
Example:
SELECT * FROM Employees;
92. What is the difference between SQL and MySQL?
SQL is a query language, while MySQL is a relational database management system (RDBMS) that uses
SQL.
No specific code example; conceptual question.
93. What are the different types of SQL statements?
They include DDL (CREATE, ALTER), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), and
TCL (COMMIT, ROLLBACK).
Example:
CREATE TABLE Students (ID INT, Name VARCHAR(50));
94. What is a primary key?
A primary key uniquely identifies each record in a table.
Example:
CREATE TABLE Students (ID INT PRIMARY KEY, Name VARCHAR(50));
95. What is a foreign key?
A foreign key is a field in one table that links to the primary key in another table.
Example:
CREATE TABLE Orders (OrderID INT, StudentID INT, FOREIGN KEY (StudentID) REFERENCES
Students(ID));
96. What is a JOIN? Explain its types.
JOIN is used to combine rows from two or more tables based on related columns.
Example:
SELECT Students.Name, Orders.OrderID FROM Students JOIN Orders ON Students.ID =
Orders.StudentID;
97. What is the difference between WHERE and HAVING clause?
WHERE filters rows before grouping, HAVING filters after.
Example:
SELECT COUNT(*), City FROM Customers GROUP BY City HAVING COUNT(*) > 1;
98. How do you retrieve unique records from a table?
Use the DISTINCT keyword to get unique records.
Example:
SELECT DISTINCT City FROM Customers;
99. What is a subquery?
A subquery is a query inside another SQL query.
Example:
SELECT Name FROM Students WHERE ID IN (SELECT StudentID FROM Orders);
100. What is the difference between DELETE and TRUNCATE?
DELETE removes rows one at a time with rollback option, TRUNCATE removes all rows quickly without
rollback.
Example:
DELETE FROM Students WHERE ID = 1;
TRUNCATE TABLE Students;