- Data Operation SELECT - Retrieves Dark Data from Database Tables Add New Data Rows to Database Tables - Remove Data Row Update from Database Table - Update Database Table
- Data Definition CREATE TABLE - Create a database table DROP TABLE - Remove Table from the Database - Modify Database Table Structure CREATE VIEW - Create a View Drop View - Remove View from the Database Crete Index - Database Table Create a Index DROP INDEX - Remove Index Create Procedure from the Database - Create a Stored Procedure Drop Procedure - Remove Storage Procedure from the Database Create Trigger - Create a trigger DROP TRIGGER - Remove the trigger from the database Create Schema - Add a new mode to the database Drop Schema - Remove a mode from the database Create Domain - Create a Data Value ALTER DOMAIN - Change the Domain Definition DOMAIN - Delete a domain from the database
- Data Control GRANT - Grant User Access Permissions Deny - Reject User Access REVOKE - Release User Access Permissions
- Transaction Control CommT - End Current Services Rollback - Abort current transaction SET Transaction - Defines current transaction data access characteristics
- Documentation SQL Declare - Setting Cursor for Query - To Query Description Data Access Plan Open - Retrieval Query Result Open a Camper Fetch - Retrieve a line Query Results CLOSE - Close the Cursor prepare - Prepare for Dynamic Execution SQL statement execute - Dynamically performs SQL statement Describe - Description Prepared query
--- Local variable declare @id char (10) --set @ID = '10010001' SELECT @ID = '10010001'
--- Global variable - must start with @@
- IF Else Declare @x int @y int @z int search @X = 1 @Y = 2 @ z = 3 if @x> @yprint 'x> y' - Print string 'x> y' ELSE IF @Y> @Z print 'y> Z' Else Print 'Z> Y' --case Use Pangu Update Employee Set E_WAGE = CASE WHEN JOB_LAVEL = '1' TEN E_WAGE * 1.08 When Job_LAGE * 1.08 When Job_LEVEL = '2' TEN E_WAGE * 1.07 When Job_level = '3' TEN E_WAGE * 1.06 Else E_WAGE * 1.05 END
--While Continue break declare @X int @x = 1 @ y = 1 while @X <3 begin print @x - Print Variable x whi @Y <3 begin select @c = 100 * @ x @yprint @c - Value of the Cable CV Select @y = @Y 1 End Select @X = @X 1 SELECT @Y = 1 End - Waitfor - Waiting for 1 hour 2 After 3 seconds, the SELECT statement Waitfor delay '01: 02: 03 'SELECT * from Employee - Example to do the SELECT statement WAITFOR TIME '23: 08:00' SELECT * FROM EMPLOYEE