WEEK 5 Flashcards

(7 cards)

1
Q

Question: What is the CREATE TABLE command used for in SQL?

A

Answer: The CREATE TABLE command is used to create a table in SQL. It requires a table name, names for all columns, data type for each column, and applicable constraints.

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

Question: What are some data types used in SQL?

A

Answer: Some data types used in SQL are:

Numeric: INT, DECIMAL(L,D)
Character/String: CHAR(L), VARCHAR(L)
Date/Time
Boolean (Yes/No)
GUID

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

Question: What is a constraint in SQL?

A

Answer: In SQL, a constraint is a restriction on a column to ensure data integrity. Examples of constraints are PRIMARY KEY, UNIQUE, NOT NULL, CHECK, and FOREIGN KEY.

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

Question: What is the purpose of the NOT NULL constraint in SQL?

A

Answer: The NOT NULL constraint in SQL ensures that a column does not accept null values.

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

Question: What does the UNIQUE constraint do?

A

Answer: The UNIQUE constraint assigns a value to an attribute when a new row is added to a table.

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

Question: What is the purpose of the DEFAULT constraint?

A

Answer: The DEFAULT constraint validates data when an attribute value is entered.

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

Question: What is the purpose of the CHECK constraint?

A

Answer: The CHECK constraint validates data when an attribute value is entered.

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