SQL Nov 2004 Solved
SQL Nov 2004 Solved
SQL Nov 2004 Solved
ii) Display the order number, order date , customer name and order
amount for orders having value of 500 Rs.
select orderNo,orderDate,customer_name,amt from Sales_Header
h,Sales_Detail d where h.orderNo=d.orderNo and amt>=500
iii) Display the order detail where RIN001 soap is sold for Min of 50 Rs.
select h.* from sales_header h,sales_detail d where h.orderNo=d.orderNo
and ProductID=’RIN001’ and Rate>=50
vi) Assign the privileges to see the data from both tables to ‘Raj’
Grant select on Sales_Header,Sales_Details to Raj
Table Structure
Hi
Visit hiddencomputertricks.blogspot.com for more...
ii) Display all Credit transaction , with their payment status done in
December 2003
select * from Sales_Header where TransactionType=‘credit’ and
PaymentStatus=’paid’ and to_char(orderDate,’mon-yyyy’)=’Dec-2003’
iii) Display the details of total Cash transaction done by each sales
Executives.
select * from Sales_Header group by salesmanID having
TransactionType=’Cash’
Table Structure
Q.4. A. Explain the various types of Search Condition that can be specified in
SQL. (8)
Ans in page 110-128 of The Complete Ref. by James R. Groff.
B. i) Give name of companies located in those cities where ‘TATA’ is
located. (6)
select companyName from company where city in ( select city from
company where companyName=’TATA’)
ii) Give the name of the employees living in the same city where their
company is located .
Hi
Visit hiddencomputertricks.blogspot.com for more...
Table Structure
Emp (Empid , ename, city, CompID , salary , Joindate )
Company (CompID , CompName , City)
C. What is Outer Join and why is it used ? Give & explain its subtypes.
Ans in page 178 of The Complete Ref. by James R. Groff.
Q.5. A. What are Integrity Constraints ? Explain any four Integrity Constraints.
(8)
Primary key, foreign key, not null, unique, check
Ans in page 291 of The Complete Ref. by James R. Groff.
ii) Display how many male and female members have joined in January
2004.
Select count(ename) from emp group by gender having
to_char(joindate,’mon-yyyy’)=’jan-2004’
Table Structure
Emp ( Empid , Ename , CompID , Salary , Joindate , Gender )
Company ( CompID , CompName , City)
Q.6. A. What is View ? Give its Types . Also give its advantages & disadvantages.
(8)
Ans in page 410-421 of The Complete Ref. by James R. Groff.
B. i) Display the details of books whose price is more than the average
price of (6)
all books.
select * from book where price>(select avg(price) from book)
ii) Display the details of books written by ‘Groff’ and supplied by ‘TMGH’
Hi
Visit hiddencomputertricks.blogspot.com for more...
iii) Create a view to show Title , Author , Publisher and Distributer’s Name
& name this view as ShowDetails.
create view ShowDetails(Title, author, publisher, distributor) as
select title, author, publisher, distributor from book
Table Structure
Book (BookID , Title , Author , Publisher , Year , Price , DistID)
Distributors (DistID , Name , City)
Q.7. A. What is database locking ? Why is it used ? Explain the various types of
locks
in SQL2.
(8)
Ans in page 345-348 of The Complete Ref. by James R. Groff.
------------------------
Hi