1SQL Paper
1SQL Paper
SQL EXAMINATION
SECTION - A
MCQ:- (5x 1)
Q2. Which SQL data type is used to store numerical values with fixed precision and scale?
A. Decimal
B. Integer
C. Date
D. varchar
SECTION – B
Discriptive questions:- (Any 5) ( 5 X 3)
Q1. What are joins? Explain self join with example?
Q2. Define:-
a. Unique key
b. Primary key
c. Foreign key
Q3. What are windows function? Explain dens rank and rank with example
Q4. What is the difference between the DELETE and TRUNCATE statements?
Q5. Explain the various SQL languages?
Q6. What is query and subquery?
SECTION – C
Practical Questions :- ( 6 X 5)
Database Schema
1) Authors table with column : author_id, author_name, email.
2) Books table with column : book_id, book_title, genre, author_id.
3) Sales table with column : sale_id, sale_date, sale_amount, book_id.
Q1. For each sale made by an author, calculate the running total of sales amounts ordered by
the sale date. Show the author's name, book title, sale date, sale amount, and running
total of sales.
Q2. List the authors who have books with sales amounts greater than the average sale amount of all
sales. Show the author's ID, name, and sale amount.?
Q3. Calculate the total sales amount for each book genre. Show the genre and total sales. Only include
genres that have sales greater than INR 50?
Q4. Retrieve the list of authors and their book sales. Show the author's name, book title, sale date,
and sale amount. Include authors who have not made any sales?
Q5 Calculate the total sales and average sales amount for each author. Show the author's name, total
sales, and average sales?
Q6 Calculate the total sales amount for each genre. Show the genre and the total sales amount?