You are on page 1of 3

SQL:- Structure Query Language syntax and data type:syntax:- select * from <table name> where <condition> group

by < column name> having < condition> order by <asc> <dsc> DDL:create :- used to create object in database alter :- to modify the database object in schema truncate :- it will delete all the rows of data from a table ,no rollback is performed ,no undo but table structure will be intact. Drop :- it will remove the table structure from database schema , all the index and privileges will be removed. Comment :- to comment data dictionary object rename:- to change the name of objects
Data Manipulation Language (DML) statements are used for managing data within schema objects. Some examples: SELECT - retrieve data from the a database INSERT - insert data into a table UPDATE - updates existing data within a table DELETE - deletes all records from a table, the space for the records remain MERGE - UPSERT operation (insert or update) CALL - call a PL/SQL or Java subprogram EXPLAIN PLAN - explain access path to data LOCK TABLE - control concurrency

DCL
Data Control Language (DCL) statements. Some examples: GRANT - gives user's access privileges to database REVOKE - withdraw access privileges given with the GRANT command

TCL
Transaction Control (TCL) statements are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions. COMMIT - save work done SAVEPOINT - identify a point in a transaction to which you can later roll back ROLLBACK - restore database to original since the last COMMIT SET TRANSACTION - Change transaction options like isolation level and what rollback segment to use

Create :table ,index, sequence ,synonym ,view create table :- data type (char, varchar2, date ,number ,long ,blob ,clob) ex :- create table sample ( id number, name varchar2(40), subject varchar2(40)); Need of constraint:Type of constraint:primary key:unique key:default:check :not null:Constraint syntax:create table emp ( emp_id number primary key, emp_name constraint emp_unique unique (In -Line specification) // constraint emp_unique unique (emp_name) --- (Out Line specification) emp_ salary number check (emp_salary >0) ); create table sample select * from student; Alter command:alter table <table name> rename to <new_table_name> alter table < table -name > add column <column name> <data type> <constraint> alter table <table name > add {-----------------} // Add one or more columns alter table <table name > modify <column -name> < column- type> <constraint> alter table <table-name> drop column <column-name> alter table <table-name> rename column <old > to <new>; DML:select 1+1 from dual ( Dual a table having only one row and one column contains the size of one char) select all ,distinct (emp_name) from <table_name> numeric function:sum ,avg .count ,max ,min string function:contact ,UPPER, LOWER

Types of operator :-

Order

Operator

1 2 3 4 5

=, !=, <, >, <=, >=, !=, <>, ^=, ~= IS [NOT] NULL, LIKE, [NOT] BETWEEN, [NOT] IN, EXISTS, IS OF TYPE NOT AND OR

*** Alias are used to give another name to column for better understanding. #####Ex ###############

CREATE TABLE t AS SELECT object_name FROM all_objects WHERE SUBSTR(object_name,1,1) BETWEEN 'A' AND 'W'; -> Usage of like keyword #####Ex ############### SELECT object_type, COUNT(*) FROM all_objects WHERE SUBSTR(object_name,1,1) BETWEEN 'A' AND 'W' GROUP BY object_type HAVING COUNT(*) > 5; Syantax Check:Select <one or more things > from < from one or places > where <one or more condition> Ex:WITH q AS (SELECT dummy FROM DUAL) SELECT dummy FROM q; Joins:more

You might also like