SQL Query Assignement
SQL Query Assignement
Create the customer table having following entities make cust_id field as
a primary key.
cust_id Name Address Doj
View all the data of customer table whose address is not Sirsa
View cust_id and name from customer table whose doj is ’30-may-88’
View all the data of customer table whose doj is greater then ‘30-may-87’
View all the records of customer table whose address is rohtak and
cust_id=2
View all the records of customer table whose name is rohan or doj is ‘30-
may-87’
View all the data of customer table whose doj is between '30-may-85' and
'17-nov-86';
View all the data of customer table whose doj is not between '30-may-85'
and '17-nov-86';
View all the records of customer table where the address can be delhi,
gujrat, sirsa.
Update the address of customer table whose cust_id=4 with new address
‘sirsa’
Update the name & address of customer table whose cust_id=2 with new
name & address.
View all the records of customer whose name starting with char ‘r’.
View all the records of customer whose name starting with Any letter but
second and third letter is ‘am’.
View all the records of customer whose name starting and ending letter is
anything but this two letter ‘am’ should be in between the name.
View all the data of customer table & their address should be in ascending
order.
View all the data of customer table thier address should be in descending
Order
ORACLE ASSIGNMENT -2
Create table emp(id numeric(10), salary numeric(10), name varchar(60));
Add the column of address in the emp table using alter command
Retrieve the data from two different tables with help of union command.
(NOTE: FOR THIS COMMAND BOTH THE TABLE MUST HAVE SAME
NUMBER OF FIELDS AND MUST HAVE SAME DATATYPE)
Show the name field records with any other alias name
Delete all the data from student table using truncate command
ORACLE ASSIGNMENT -3
Create the table name PO having fild id, name, score. In this table id
should be greater then 0. (Use check command)
Create the table name RI having fild id, name. In this table name should
be ram. (Use Check Command)
Use the table’s supplier & customer from the assignment no 2 and show
the working of inner join.
Use the table’s supplier & customer from the assignment no 2 and show
the working of left join.
Use the table’s supplier & customer from the assignment no 2 and show
the working of right join.
Use the table’s supplier & customer from the assignment no 2 and show
the working of full outer join.
Use the table’s supplier & customer from the assignment no 2 and show
the working of self join.
Create the table of name math having field name & salary.
Insert into math values('rakesh',5000);
Insert into math values('rakesh',3000);
Insert into math values('saurav',4000);
Insert into math values('saurav',7000);
From the above data find the total salary of rakesh & saurav using group
by command
Retrieve the data from the math table where name of person is ‘raju’
using having command.
Retrieve the data from the math table where the total salary of
any person is greater then 10000 using having command.
(Note: The WHERE clause places conditions on the selected columns, whereas
the HAVING clause places conditions on groups created by the GROUP BY
clause. The HAVING clause must follow the GROUP BY clause in a query and
must also precede the ORDER BY clause if used. )
Select all the data from math table where name having null values.
Select all the data from math table where name having not null values.
Select the value from both student & s_id table using Union Command.
Use the minus command in the above tables student & S_id & Show the
result.
Use the Interect command in the above tables student & S_id & Show the
result.