SQL Commands
SQL Commands
SQL Commands
• Create
• Alter
• Drop
• Truncate
• Insert
• Update
• Delete
• Select
• Grant
• Revoke
• Commit
• Rollback
• Number
• Char
• Varchar2
• Long
• date
1.4. NULL
1.5. Operators
• Column Level
• Table
• Primary Key Constraint
• Foreign Key Constraint
• Unique Constraint
• Check Constraint
Syntax:
Implementation of Default
Add/Drop Column
Syntax:
Or
Syntax
Drop a Index
• Greatly speeds the execution of SQL statements with search conditions that refer to
the indexed column(s)
• It is most appropriate when retrieval of data from tables are more frequent than inserts
and updates
Syntax:
Or
Syntax:
DELETE TRUNCATE
Data can be recovered Data cannot be recovered.
Syntax:
Or
Or
Problem Statement:
Relational operators
Or
List all customers who have account in Capital Bank or Indus Bank.
Or
List all Accounts where the Bank_Branch begins with a ‘C’ and has ‘a’ as the second
character
List all Accounts where the Bank_Branch column has ‘a’ as the second character.
List the customers account numbers and their account balances, in the increasing
order of the balance
List the customers and their account numbers in the decreasing order of the Customer
Last Name and increasing order of account numbers.
Or
• Used when information you want to extract from a table has to do with the data in
the entire table taken as a set.
• Aggregate functions are used in place of column names in the SELECT statement
• The aggregate functions in SQL are :
Example:
Example:
Example:
Example:
Example:
Count(*) = No of rows
-----