Tables Flashcards
Creating a Table
CREATE TABLE table_name();
Define Three Columns
column_name DATA_TYPE,
column_name DATA_TYPE,
column_name DATA_TYPE
Define a Column as an Integer
column_name INT
Define a Column as a Variable Character
column_name VARCHAR(# of chars.)
Define a Column as a Decimal
column_name DECIMAL(# of total digits, # of digits after decimal point)
Look at a Table Schema
DESCRIBE table_name;
Delete Table
DROP TABLE table_name;
Add Column to Table
ALTER TABLE table_name ADD column_name DATA_TYPE;
Remove Column from Table
ALTER TABLE table_name DROP column_name;
Set Primary Key
column_name DATA_TYPE PRIMARY KEY
or
PRIMARY KEY column_name
Look at Specific Table Columns
SELECT column_name, column_name, etc. FROM table_name
Look at All Table Columns
SELECT * FROM table_name
Add Data to Table
INSERT INTO table_name(column_name1, column_name2) VALUES(numerical_value1, ‘string_value2’);