Sei sulla pagina 1di 1

Keywords Explanation Operator Syntax Description

S E Q U E N T I A L Q U E RY
Function Description

TO_DATE It is used to convert a string to date. SELECT It is used to specify which column to query. Use * for all SELECT C1 FROM t1 Selecting column 1 for table t1 and column 2
Returns the first non NULL results, when querying with the FROM It is used to declare the table to select from UNION UNION [ALL] from table t2 and combine the rows of these
COALESCE

LANGUAGE CURRENT_TIME
STAMP
columns that contain NULL

Returns the correct time on the database server


WHERE
=
It is used to define a condition
Used to compare a value with the given input
It is a special operator used with WHERE to search for a INTERSECT
SELECT C1 FROM t2
SELECT C1 FROM t1
INTERSECT
two queries

It is used to return the intersection of two

C H E AT S H E E T LIKE queries
An aggregate function that returns the number of rows in specific pattern from a column or row SELECT C1 FROM t2
COUNT
the result set GROUP BY It is used to group identical data SELECT C1 FROM t1
It is used to subtract the second result set
An aggregate function that sums up the values in a result It is used to specify that rows with aggregate values which MINUS MINUS
SUM from the first
SQL Basics set
To compute the mean average of the values in the result
HAVING
meets the specifies condition must be returned
It is used to return all rows where key records of one table
SELECT C1 FROM t2
SELECT c1 FROM t It is used to return the query of rows using the
AVG NOT LIKE
set INNER JOIN WHERE c1 [NOT] LIKE pattern matching pattern
is same as that of the other table
SQL MIN/MAX
An aggregate function to return the largest/smallest value
It is used to return all rows from the left table with the BETWEEN
SELECT c1 FROM t It returns the rows where c1 is between MIN
among the result set LEFT JOIN WHERE c1 BETWEEN min AND max and MAX
Structured query language (SQL) is a domain specific language used for matching rows in the right table
It is used to transform values from a group of rows into a SELECT c1 FROM t
LISTAGG It is used to return all rows from right table with the NOT NULL To check if the values are NULL or NOT NULL
programming and querying a database delimited string RIGHT JOIN WHERE c1 IS [NOT] NULL
matching rows in the left table

SQL Data Types Functions FULL OUTER It is used to return rows that match either in the left or Trigger
JOIN right table
Aggregate Functions: It is a function where the values of multiple rows are It is a special type of stored procedure that automatically executes when a user tries to modify
Exact Numeric’s: Character Strings:

combined to form a single value SQL Query through a DML event
• INTEGER CHARACTER
• SMALLINT • CHARACTER VARYING (VARCHAR) UNION: A set operation can be used on the returned results called ‘UNION’ Syntax: Explanation:
• BIGINT • CHARACTER LARGE OBJECT which can append the result of one query to another • To create or modify trigger • WHEN:
• Query Language Processor Parser+Optimizer
• NUMERIC NATIONAL CHARACTER
Syntax:
CREATE OR MODIFY TRIGGER o BEFORE: Invokes before an event occurs
• DECIMAL • NATIONAL CHARACTER VARYING trigger_name o AFTER: Invokes after an event occurs
• SELECT col1, col2 FROM table1 File manager + • EVENT:
Approximate Numeric’s: NATIONAL CHARACTER LARGE WHEN EVENT
• REAL OBJECT UNION
DBMS Engine Transaction ON table_name TRIGGER_TYPE o INSERT: Invoke for Insert
manager
• DOUBLE PRECISION Date times: EXECUTE stored_procedure o UPDATE: Invoke for Update
SELECT col3, col4 FROM tabl2
• FLOAT • DATE o DELETE: Invoke for Delete
• DECFLOAT • TIME WITHOUT TIMEZONE • TRIGGER TYPE:
Binary Strings: • TIMESTAMP WITHOUT TIMEZONE INDEXES o FOR EACH ROW
Physical database
• BINARY • TIME WITH TIMEZONE o FOR EACH STATEMENT
• BINARY VARYING • TIMESTAMP WITH TIMEZONE It is used to speed up the performance of the queries by reducing the number • To delete or drop a trigger: Used to delete a specific trigger

• BINARY LARGE OBJECT Collection Types: of database pages to be visited Syntax: DROP TRIGGER trigger_name
Boolean: • ARRAY Syntax:
Intervals: • MULTISET To create an index: CREATE INDEX index_name ON t(c1, c2)
Using SQL
Unique
• INTERVAL DAY Other Types: To create an unique Index: CREATE UNIQUE INDEX index_name ON t(c3, c4) constraints
• INTERVAL YEAR • ROW To drop an index: DROP INDEX index_name Making the values in C1 and C2 as unique
Primary Key: Set c1 and c2 as primary key
• XML
Syntax: CREATE TABLE t(
Syntax: CREATE TABLE t(
c1 INT, c1 INT,
Stored Procedure c1 INT, c2 INT, c3 VARCHAR,
View PRIMARY KEY (c1,c2)
UNIQUE (c2,c3)
It is a set of SQL statements with assigned names that can be shared and );
It is a virtual table which is a result of a query. It is often used as a security );
reused by multiple programs
mechanism letting users to access the data through the views Foreign Key: Set c2 column as a foreign key
Syntax: To create Procedure
Syntax: Syntax: CREATE TABLE t1(
CREATE PROCEDURE procedure_name
CREATE VIEW view1 AS @variable AS datatype = value c1 INT PRIMARY KEY,
SELECT c1,c2 AS c2 INT,
FROM t1 -- Comments FOREIGN KEY (c2) REFERENCES t2(c2)
FURTHERMORE:
WHERE condition SELECT * FROM t GO );
SQL Certification Training Course

Potrebbero piacerti anche