Vous êtes sur la page 1sur 3

1) Distinct:

The disctinct keyword can be used to return only distict(different) values in a


table
Select distinct column name from table name
i.e eleminating the duplicate values
2) Types of Operators
3) Aggregate functions: Avg, count, first, last, min, max, sum
4) Scalar functions : Ucase, Lcase, MID()
5) Types of constraints :
Not null, unique, primary key, foreign key, check, default
Primary key : Uniquely identifies a each record in a database table
Foreign key : A foreign key which will refer to a primary key of another table

6) Index : Index is used to create and retrive data from the db very quickly
Index is used for improve the table performance
create index idx_age
on customers (age, name)
7) View : View is a virtual table based on the result set of an sql statement
create view view_name as select column name from table name where condition
8) Update : update the existing record in a table
update gwuser set loginstatus = y where loginstatus = n
9) Order by:
Ther order by keyword is used to sort the result set by a specified colu
mn.
Ther order by keyword sort the records in ascending order by default
select * from customer order by name
10) what is Like Operator?
11) Types of Joins :
Inter join/simple join/equijoin
Outer Join - Left outer join, right outer join, full outer join
cross join
Self join
Join : When data from more than one table in the databse is required a join coni
dition is used
Left outer join : Matched records of the two tables + unmatched record from the
left side table
select a.iteminfo, a.accountno, b.iteminfo from merchant a lerft outer join cust
omer b on b.iteminfo = a.iteminfo
Right outer join : Matched records of the two tables + unmatched record from the
right side table

12) subquery:
subquery/inner query/nested query
Subquery is a query in a query. A sub query is usually added in the WHERE clause
of the sql statement
a. subquery executes once before the main query
b. the result of the subquery is used by the main query
types of subquery:
single row subquery
multiple row subquery
13) Group by:
The group by statement is used together with the sql aggregate functions to grou
p the retrieved data by one or more columns
select cus_name, sum(orderprice) from sales group by cus_name

Drop:
Table structure deleted - yes
Records - NA
Auto commit - Yes
Truncate:
Table structure deleted : no
records deleted : yes all records
Auto commit : yes
Delete:
Table structure deleted : no
records deleted : yes selectively
Auto commit : no

Vous aimerez peut-être aussi