0% found this document useful (0 votes)
9 views1 page

Assignment2 Unit2

The document is an assignment for the DBMS course at Maharaja Agrasen Institute of Technology for the academic session 2024-2025. It includes five SQL-related questions that require students to write queries for retrieving sales data, employee salaries, student enrollments, creating a view for high-value customers, and managing transactions in a bank accounts table. Each question is worth 5 marks and emphasizes the need for sufficient explanations in hand-written answers.

Uploaded by

kartikchauhan190
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 views1 page

Assignment2 Unit2

The document is an assignment for the DBMS course at Maharaja Agrasen Institute of Technology for the academic session 2024-2025. It includes five SQL-related questions that require students to write queries for retrieving sales data, employee salaries, student enrollments, creating a view for high-value customers, and managing transactions in a bank accounts table. Each question is worth 5 marks and emphasizes the need for sufficient explanations in hand-written answers.

Uploaded by

kartikchauhan190
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/ 1

MAHARAJA AGRASEN INSTITUTE OF TECHNOLOGY

Department of Computer Science and Engineering


(Academic Session 2024-2025)
Assignment-2

SUBJECT NAME: DBMS (CIC-210)

Note: Assignment should be hand-written. Answers should include sufficient explanations.

Q1. Write an SQL query to retrieve the following details from a "Sales" table: (5 Marks)
• Total sales amount for each month in the year 2024.
• Display the result with the following columns: Month, Total Sales.
• Ensure the results are sorted in ascending order by month.
Sample Table Schema:
Sales (SaleID, SaleDate, Amount)
Q2. Consider the following tables: (5 Marks)
• Employees (EmpID, Name, Salary, DepartmentID)
• Departments (DepartmentID, DepartmentName)
Write an SQL query to find the names of employees who earn more than the average salary of
their respective department.
Q3. Given the tables below: (5 Marks)
• Students (StudentID, Name, CourseID)
• Courses (CourseID, CourseName)
• Enrollments (EnrollmentID, StudentID, CourseID)
Write an SQL query that retrieves the names of students who are enrolled in at least one course
but excludes those enrolled in the course titled "Data Science".
Q4. Create a view named HighValueCustomers that displays customer details from the Orders
table where the total order value exceeds ₹50,000. (5 Marks)
Orders (OrderID, CustomerID, OrderDate, OrderAmount)
Your query should:
• Display CustomerID, TotalOrders, and TotalAmount.
• Use the GROUP BY clause.
Q5. Transaction Control Commands (5 Marks)
Consider the table BankAccounts (AccountID, AccountHolder, Balance).
Write an SQL transaction that:
• Begins with a transaction block.
• Deducts ₹5,000 from AccountID 1001 and adds ₹5,000 to AccountID 1002.
• Includes appropriate COMMIT, ROLLBACK, and SAVEPOINT commands to manage
transaction control effectively.

You might also like