CC104 - Lesson 4 Part 2 Rev
CC104 - Lesson 4 Part 2 Rev
If you want to position the column you want to add or you want to place it in the first
column
use keyword AFTER / FIRST
syntax: ALTER TABLE table_name
ADD COLUMN column_name data type AFTER column_name; OR
ADD COLUMN column_name data type FIRST;
Code when you want to modify/update the column_name
syntax:
ALTER TABLE table_name
CHANGE old_column_name new_column_name data_type;
Code when you want to change the data type of the column
syntax:
ALTER TABLE table_name
MODIFY COLUMN column_name new_datatype;
Code when you want to delete column_name
syntax:
ALTER TABLE table_name
DROP COLUMN column_name;
Or
The SQL DELETE statement removes one or more rows from a database
table based on a condition specified in the WHERE clause.
The SELECT statement is used to select data The WHERE clause is used to filter
from a database. records.
The data returned is stored in a result table, It is used to extract only those
called the result-set. records that fulfill a specified
condition.
Query: List the Name of the Customers with Customer No 128
Simple
Condition in
Where clause
Query:
Identify the Customer whose credit
limit is not equal to 20000.00
Using Compound condition
Logical Operator
AND Operator When the AND operator connects simple
conditions, all the simple condition must be true in order for
the compound condition to be TRUE.
OR Operator When the OR operator connects simple
conditions, the compound condition will be TRUE whenever
anyone of the simple conditions is TRUE.
NOT Operator Reverses the truth of the original condition will
be false; if the original is false the new condition will be true.
Query: List the number and name of customer that has a balance of more than 10,000
and have credit limit of 20,000,
Query: List the name of customer does not handle by agent
code 10
Special Operators
Query: List the name of customer who handle by Sale agent 5 and 10
Query: List all customers that do have assigned sales agent