BIGNALYTICS IT SOLUTIONS
SQL EXAMINATION
Time : 2.5 Hrs MM : 50
SECTION - A
MCQ:- (5x 1)
Q1. What is the purpose of normalization in a database?
A. Increase data redundancy
B. Optimize query speed
C. Reduce data redundancy
D. Improve data security
Q2. Which SQL data type is used to store numerical values with fixed precision and scale?
A. Decimal
B. Integer
C. Date
D. varchar
Q3. In SQL, what is the purpose of the TRUNCATE command?
A. Delete specific rows from a table
B. Removes all rows from a table
C. Changes table structure
D. Creates a new table
Q4. What is the purpose of the COMMIT command in SQL?
A. To start a transaction
B. To save changes made by a transaction
C. To undo changes made by a transaction
D. To revoke user permissions
Q5. What is the primary role of a primary key in a database table?
A. To sort data
B. To identify unique records
C. To establish relationship with other tables
D. To check data integrity
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?