1. Basic SQL Questions
1.1 What is SQL?
SQL (Structured Query Language) is a standard language used to interact with relational databases.
1.2 What are the different types of SQL commands?
SQL commands are categorized into:
- DDL (Data Definition Language):
CREATE, ALTER, DROP, TRUNCATE
- DML (Data Manipulation Language):
INSERT, UPDATE, DELETE
- DQL (Data Query Language):
SELECT
- DCL (Data Control Language):
GRANT, REVOKE
- TCL (Transaction Control Language):
COMMIT, ROLLBACK, SAVEPOINT
1.3 What is the difference between SQL and MySQL?
- SQL is a language for managing databases.
- MySQL is a relational database management system (RDBMS) that uses SQL.
1.4 What are primary key and foreign key?
- Primary Key: A unique identifier for each row in a table. Cannot be NULL.
- Foreign Key: A column that references the primary key of another table to maintain relationships.
2. SQL Query Questions