Structured Query Language (SQL) Flashcards
1
Q
What are the main components of SQL?
A
DDL, DML, DCL, and embedded SQL
2
Q
What does the DECIMAL(P, S) data type mean?
A
P = total digits, S = digits after decimal (e.g., DECIMAL(5,2) → 999.99)
3
Q
What is the function of a CHECK constraint?
A
Ensures that a column’s value meets a specific condition or range
4
Q
How do you define a composite primary key?
A
List multiple columns in the PRIMARY KEY constraint separated by commas
5
Q
Which keyword is used to change an existing table?
A
ALTER TABLE
6
Q
What is the default referential integrity enforcement if not specified?
A
RESTRICTION
7
Q
Difference between CHAR and VARCHAR?
A
CHAR is fixed length (padded), VARCHAR is variable (saves space)