SR.NO.
Structured data
Structured data are facts concerning objects
and events. The most important structured data
1
are numeric, character, and dates. Structured
data are stored in tabular form.
SR.NO. Char Datatype
It is used to store character string of fixed
length specified.If length of string is less than
1 set or fixed length then it is padded with extra
blank spaces.
2 Declare@ city char(09)
P U N E
SR.NO. SQL
1 It works with relational database
SR.NO. DELETE
1 The DELETE command is used to remove rows
from a table based on a WHERE condition
2 we can use a where clause with DELETE to filter
and delete specific records
3 DELETE is executed using a row lock, each row
in the table is locked for deletion
4 DELETE is a DML command
5 To use Delete you need DELETE permission on
the table
The DELETE statement removes rows one at a
6 time and records an entry in the transaction log
for each deleted row
7 DELETE can be used with indexed views
SR.NO. Primary Key
1 We can have only one Primary Key in a table
2 The Primary Key cannot have a NULL value
3 By default, a Primary Key is a Clustered Index
4 A Primary Key supports an Auto Increment
value
SR.NO. UNION OPERATOR
It allow us to retrive unique records of all table
1 eliminate duplicate record
2 Select * from Stu1 Union Select * from Stu2
SR.NO. INTERSECT OPERATOR
It allow us to retrive COMMON records of all
1 table eliminate duplicate record
2 Select * from Stu1 INTERSECT Select * from
Stu2
SR.NO. WHERE clause
WHERE clause can be used with a Select,
1
Update and Delete Statement
2 WHERE is used before the GROUP BY clause
3 A WHERE clause applies to each and every row
In the WHERE clause the data that is fetched
4
from memory depending on a condition
We can't use an aggregate function in the
5 WHERE clause unless it is in a sub-query
contained in a HAVING clause
SR.NO. Local Temporary Table
1 A Local Temporary Table is created by giving it
a prefix of
2 A Local Temporary Table cannot be shared
among multiple users
3 A Local Temporary Table is only available to the
current DB connection for the current user and
are cleared when the connection is closed
SR.NO. Clustered index
A clustered index is a special type of index that
1 reorders the way records in the table are
physically stored. Therefore table can have only
one clustered index.
The leaf nodes of a clustered index contain the
2 data pages.
SR.NO. Stored Procedure
A procedure can have both input and output
1
parameters
2 Inside a procedure we can use DML
(INSERT/UPDATE/DELETE) statements.
We can't utilize a Stored Procedure in a Select
3 statement.
We can use a Try-Catch Block in a Stored
4
Procedure
5 We can use transaction management in a
procedure
6 We can't join a Stored Procedure
Stored Procedures cannot be used in the SQL
7 statements anywhere in the
WHERE/HAVING/SELECT section
8 A procedure can return 0 or n values (max
1024).
9 A procedure can't be called from a function
SR.NO. Like Query
1 Find any values that start with"A"
2 Find any values that end with"A"
3 Find any values that have "A" in any position
Find any values that have "A" in the scound
4
position
5 Find any values that start with"A" and are at
least 2 characters in length
Find any values that start with"A" and are at
6 least 3 characters in length
7 Find any values that start with"A" end with"O"
Nested subQuery
In Nested Query,inner query runs first,and only
1 once,outer query executed with result from
inner query( Bottom up approch)
Select* from table where salary= (select
2 max(salary) from table)
SQL
Sr.No. Limit
1 Limit 1,1
2 Limit 3,1
3 Limit 4,1
Unstructured data.
Unstructured data are multimedia data such
as documents, photographs, maps, images,
sound, and video clips. Unstructured
Varchar
It is used to store character string of
veriable length. If length of string is less than
set or fixed length then it is NOT padded
with extra blank spaces.
Declare@ city varchar(09) P U N E
NOSQL
It works with non relational database
TRUNCATE
Truncate will actually remove all the rows
from a table and there will be no data in the
table after we run the truncate command
whereas we cannot use a Where clause with
TRUNCATE
whereas TRUNCATE is executed using a
table lock and the entire table is locked for
removal of all records
whereas TRUNCATE is a DDL command.
whereas to use Truncate on a table you need
at least ALTER permission on the table.
whereas TRUNCATE TABLE removes the
data by deallocating the data pages used to
store the table data and records only the
page deallocations in the transaction log.
whereas TRUNCATE cannot be used with
indexed views.
Unique Key
we can have more than one Unique Key in a
table.
Unique Key may have only one null value
whereas by default, a Unique Key is a unique
non-clustered index.
A Unique Key doesn't support an Auto
Increment value.
UNION ALL OPERATOR
It allow us to retrive all records of all table
including duplicate record
Select * from Stu1 Union all Select * from
Stu2
MINUS OPERATOR
It allow us to retrive UNCOMMON records of
i table 1 (intial table) and common records
of all table get minus and the resultant table
is table 1
Select * from Stu1 Minus Select * from Stu2
HAVING clause
HAVING clause can be used only with a
Select statement.
whereas a HAVING clause is used to impose
a condition on the GROUP Function and is
used after the GROUP BY clause in the query.
Whereas a HAVING clause applies to
summarized rows (summarized with GROUP
BY).
whereas in HAVING the completed data is
first fetched and then separated depending
on the condition
whereas we can use an aggregate function in
the HAVING clause. We can use a column
name in the HAVING clause, but the column
must be contained in the group by clause.
Global Temporary Table
whereas a Global Temporary Table is
created by giving it a prefix of ##.
whereas a Global Temporary Table can be
shared among multiple users.
whereas a Global Temporary Table is
available to any connection once created.
They are cleared when the last connection is
closed.
Non clustered index
A non clustered index is a special type of
index in which the logical order of the index
does not match the physical stored order of
the rows on disk.
The leaf node of a non clustered index does
not consist of the data pages. Instead, the
leaf nodes contain index rows.
Function
function can only have input parameters.
inside a function we can't use DML
statements.
we can use a function in a Select statement.
inside a function we can't use a Try-Catch
block.
we can't in a function.
we can join functions.
we can use a function anywhere
function can return only 1 value that is
mandatory
We can call a function from a procedure
Answer
Where Column name LIKE "A%"
Where Column name LIKE "%A"
Where Column name LIKE "%A%"
Where Column name LIKE "_A%"
Where Column name LIKE "A_%"
Where Column name LIKE "A__%"
Where Column name LIKE "A%O"
Correlated Sub query
Outer query runs first, and for every outer
query row inner query is executed.(Top
Down Approch)
Select * from employee where EXISTS
(SELECT empid from Project where
employee.emp=Project.empid)
PLSQL
Highest position
select one row after First Row i.e 2nd highest
select one row after Third Row i.e 4th highest
select one row after Forth Row i.e 5th highest
P U N E
P U N E
6194950
SD 7% 433646.5
GST 5% 309747.5
R 30000
5810550 90% 5229495
30000
7% 0
5% 0
15000
5,855,550
463646.5
5731304
Operator
SR.NO. Char Datatype
It is used to store character string
of fixed length specified.If length of
1 string is less than set or fixed
length then it is padded with extra
blank spaces.
Declare@ city char(09)
2 PU N E
Varchar
It is used to store character string of
veriable length. If length of string is less
than set or fixed length then it is NOT
padded with extra blank spaces.
Declare@ city varchar(09)
PUNE