My Addition Flashcards

1
Q

In refernce of ALTER TABLE statements

What is the syntax for ADD

A
ALTER TABLE TableName 
ADD ColumnName DataType;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In refernce of ALTER TABLE statements

What is the syntax for CHANGE

A
ALTER TABLE TableName 
CHANGE CurrentColumnName NewColumnName NewDataType;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In refernce of ALTER TABLE statements

What is the syntax for DROP

A
ALTER TABLE TableName 
DROP ColumnName;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the definition of tables in relational databases?

A

Tables are the core structure in relational databases containing a fixed sequence of columns and a varying set of rows.

Each column has a name and a specific data type, while each row consists of values that correspond to the column’s data types.

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

What are the components of a table?

A

A table must have at least one column and can have multiple rows, but it can also be empty (having no rows).

Each column has a name and a specific data type.

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

How do databases handle duplicate rows?

A

Some databases may allow duplicate rows temporarily, particularly when loading external data into a temporary table.

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

What SQL statement is used to define a new table?

A

CREATE TABLE

This statement specifies table names and data types.

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

What does the DROP TABLE statement do?

A

Deletes a table and all its data.

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

What is the purpose of the ALTER TABLE statement?

A

Used to modify an existing table by adding, changing, or deleting columns.

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

List common data types used in tables.

A
  • integers (INT)
  • values with 0 to N characters (VARCHAR(N))
  • dates (DATE)
  • decimals (DECIMAL)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What rule governs the values in a cell of a table?

A

Exactly one value per cell.

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

Are duplicate column names allowed in a table?

A

No duplicate column names are allowed within the same table but are allowed in different tables.

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

What principle allows for optimization of storage in tables?

A

No significant row order, supporting the principle of data independence.

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

What does it mean that there can be no duplicate rows in a table?

A

No two rows in a table may have identical values across all columns.

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

What is a NULL value in a table?

A

Represents the absence of data in a cell.

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

What is the SQL syntax for creating a table?

A

CREATE TABLE TableName (Column1 DATA_TYPE, Column2 DATA_TYPE, …, ColumnN DATA_TYPE);

17
Q

Fill in the blank: The ID column is of data type _______.

A

Integer (INT)

18
Q

What data type is used for the Name column?

A

Variable-length string with maximum 40 characters (VARCHAR(40)).

19
Q

What is the appropriate data type for the ProductType column?

A

Variable-length string with maximum 3 characters (VARCHAR(3)).

20
Q

What data type is used to store dates in a table?

A

Date.

21
Q

What is the format for the Weight column data type?

A

Decimal number with six significant digits and one digit after the decimal point (DECIMAL(6,1)).

22
Q

True or False: A table can have multiple rows with identical data.

A

False.

23
Q

Why are integers commonly used for IDs in databases?

A

They allow for efficient storage and quick retrieval when querying for specific products.

24
Q

What is the advantage of using VARCHAR for the Name column?

A

It allows for variable-length strings, using only the necessary space for each entry.

25
Q

Explain the data type DECIMAL(6,1).

A

It can accurately represent decimal numbers with up to 6 total digits, of which 1 digit is after the decimal point.