Lesson 5: Designing SQL Data Tables Flashcards

1
Q

CREATE TABLE

A

CREATE TABLE is a SQL statement that is used to create a new table in a database.

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

ALTER TABLE

A

ALTER TABLE is the SQL statement that is used to alter or change the structure of an existing database table. This statement can be used to add constraints

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

Constraint

A

A SQL constraint is a rule for data in the database.

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

PRIMARY KEY (PK)

A

A PRIMARY KEY is a SQL constraint. It is the column that uniquely identifies each row in the table. A PK cannot be NULL, and there can only be one PK in each table.

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

FOREIGN KEY (FK)

A

A FOREIGN KEY is a key used to relate or link two tables together. The PK is a column in one table that refers to the FK in another table.

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

Data Types

A

The data type of a column defines what value the column can store

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

nvarchar

A

A data type that can hold string data. Also, a variable width that also holds unicode data or multilingual data
“Unicode Character Strings data type that can store variable-size string data. Unicode data types can store character data and so work well if there are international words or data that will be stored.”

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

int

A

A data type that holds whole numbers. There are different int data types each determines how big the whole number can be

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

decimal (p, s)

A

A data type that holds numbers with decimals. The default size is 18 numbers (precision) and 0 decimals (scale). You will define how many digits (the precision) the decimal can have and how many decimal places (the scale) it can have. Default is 18 digits with no decimal places

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

date

A

A data type that stores dates only Format YYYY-MM-DD

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

NULL

A

A constraint that indicates the data can hold null values or that the column can be empty of data.

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

NOT NULL

A

NOT NULL is a constraint rule that ensures there is always data entered in a column. A new row cannot be added without data in the column that is defined as NOT NULL

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

DROP TABLE

A

DROP TABLE is a SQL statement to remove a table and all its data rows from the database “DROP TABLE is a SQL statement that needs to be carefully considered before executing it in a live database. The table and all its data will be lost if the DROP TABLE SQL statement is executed.”

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

Debugging

A

Making corrections to remove bugs or errors in the code.

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