Structured Query Language (SQL) Flashcards

1
Q

What are the main components of SQL?

A

DDL, DML, DCL, and embedded SQL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the function of a CHECK constraint?

A

Ensures that a column’s value meets a specific condition or range

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you define a composite primary key?

A

List multiple columns in the PRIMARY KEY constraint separated by commas

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which keyword is used to change an existing table?

A

ALTER TABLE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the default referential integrity enforcement if not specified?

A

RESTRICTION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Difference between CHAR and VARCHAR?

A

CHAR is fixed length (padded), VARCHAR is variable (saves space)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly