0% found this document useful (0 votes)
9 views

SQL paper

The document outlines an SQL examination consisting of multiple-choice questions, descriptive questions, and practical SQL queries. It covers topics such as SQL constraints, normalization, joins, and database interactions with Python. The examination is structured into three sections: MCQs, descriptive questions, and practical SQL tasks based on a given database schema.

Uploaded by

nishita6978
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

SQL paper

The document outlines an SQL examination consisting of multiple-choice questions, descriptive questions, and practical SQL queries. It covers topics such as SQL constraints, normalization, joins, and database interactions with Python. The examination is structured into three sections: MCQs, descriptive questions, and practical SQL tasks based on a given database schema.

Uploaded by

nishita6978
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

BIGNALYTICS IT SOLUTIONS

SQL EXAMINATION

Time : 2 Hrs MM : 50

SECTION - A
MCQ:- (5x 1)
Q1. Which of the following is not Constraint in SQL?
A. Primary Key
B. Not Null
C. Check
D. Union

Q2. Which operator is used to compare a value to a specified list of values?


A. ANY
B. BETWEEN
C. ALL
D. IN

Q3. 26) Which command is used to change the definition of a table in SQL?
A. CREATE
B. UPDATE
C. ALTER
D. SELECT

Q4. What is the difference between a PRIMARY KEY and a UNIQUE KEY?
A. Primary key can store null value, whereas a unique key cannot store null value.
B. We can have only one primary key in a table while we can have multiple unique keys
C. Primary key cannot be a date variable whereas unique key can be
D. None of these

Q5. What operator tests column for absence of data


A. NOT Operator
B. Exists Operator
C. IS NULL Operator
D. None of the above

SECTION – B
Discriptive questions:- ( 5 X 3)
Q1. What is normalization? Explain the different types of normalization?
Q2. What is join? Explain the different types?
Q3. What is the difference between order and group by with example?
Q4. Scenario:
You're tasked with analyzing the sales data of an e-commerce platform. You have two tables:
Orders and OrderDetails. The Orders table contains information about each order placed,
including the OrderID, CustomerID, OrderDate, and TotalAmount. The OrderDetails table contains
details about each product in an order, including the OrderID, ProductID, Quantity, and UnitPrice.
Your task is to find the total revenue generated in each month for the past year, along with the
number of orders placed in each month.

Question:
Write a SQL query to calculate the total revenue generated and the number of orders placed in
each month for the past year.?

Q5. Scenario:
You're developing a Python application that needs to interact with a MySQL database to manage
employee information for a company. Your task is to outline the steps to connect the Python
application to the MySQL database and provide a detailed explanation of each step.

Question:
Please describe the steps involved in connecting a Python application to a MySQL database in a
descriptive manner. Assume you have a MySQL server running locally on your machine, and you
want to establish a connection to it using Python. Your explanation should cover the necessary
code snippets, library imports, and any required setup or configuration.?

SECTION – C
Practical questions :- ( 6 X 5)
Database Schema
1) Customers table with column : customer_id, name, email, city.
2) Order table with column : order_id, customer_id, order_date, total_amount.
3) Order items table with column : order_item_id, order_id, product_id, quantity, unit_price
4) Products table with column : product_id, product_name,category

Q1. Write a sql query to find the customers who have placed orders for products in more than one
category?
Q2. Write a sql query to calculate the total revenue generated from orders placed in each city?
Q3. Write a sql query to list the top 3 customers who spent the most on orders?
Q4. Write a sql query to find the customers who have placed orders for products with a price higher
than the average price of all products?
Q5 write a sql query to calculate the total revenue generated from orders placed by each customer
Q6. Write a sql query to find the total number of products sold in each category?

You might also like