DDL Flashcards
(19 cards)
ALTER Syntax to Add Column
ALTER TABLE table_1
ADD COLUMN column_1 INT
ALTER Syntax to Drop column
ALTER TABLE table_1
DROP COLUMN column_1
SAFE UPDATES
SET SQL_SAFE_UPDATES = 0;
Steps to Alter
- Alter table
2. Update table
ALTER command
Add and Remove table Columns
CHANGE command
Modify table columns
CHANGE Syntax
ALTER TABLE table_1
CHANGE COLUMN old_column_name New_column_name INT;
CHANGE syntax structure
- Old Column name
- New Column name
- New Data Type
ALTER and Change
- Alter table
2. Change column
FLOAT vs INT
Float includes decimals. Useful for Cost/Price.
CREATE Command
Generate New tables
DROP command
removes table from a database
CREATE TABLE syntax
CREATE TABLE table_name_( column_1 data_type, column_2 data_type, column_3 data_type );
CHAR vs VARCHAR
- Char=fixed length string(can contain letters, numbers, and special characters)
- VARCHAR=variable length string (can contain letters, numbers, and special characters)
CREATE DATABASE Syntax
CREATE DATABASE database_name;
DROP Statement
Used to delete databases, tables, and columns.
DROP Syntax
DROP TABLE table_1;
DROP DATABASE database_name;
TRUNCATE command
remove all data from a table
To convert a column to a new data type, you only need to list the new data type, not the old one.
True