SQL-Commands DDL Flashcards

1
Q

DDL - Data Definition Language

A

statements are defining database schema

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

Create

A

Create objects in the database

CREATE TABLE table_name
(column_name data_type,
column_name data_type)

CREATE TABLE table 1
( ID int,
Last_name varchar(25)
)

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

Alter

A

Alter columns in an existing table

Add
ALTER TABLE table_name
ADD column_name data_type

Delete
ALTER TABLE table_name
DROP COLUMN column_name

Modify
ALTER TABLE table_name
MODIFY column_name data_type

ALTER TABLE table_name
RENAME COLUMN column_name 1 to column name 2

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

Drop

A

Delete a table

DROP TABLE table_name

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

Truncate

A

Delete data in the table, but not table itself (架空table)

TRUNCATE TABLE table_name

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

Rename

A

Rename an object

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