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

SQL Assignment 1

The document outlines SQL assignments divided into two sections. Section A involves creating and modifying tables for authors, books, and members, while Section B focuses on creating an employees table and performing various insert, update, and delete operations. Key tasks include adding columns, renaming, and deleting data while maintaining table structures.

Uploaded by

Ashu Singh
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)
0 views1 page

SQL Assignment 1

The document outlines SQL assignments divided into two sections. Section A involves creating and modifying tables for authors, books, and members, while Section B focuses on creating an employees table and performing various insert, update, and delete operations. Key tasks include adding columns, renaming, and deleting data while maintaining table structures.

Uploaded by

Ashu Singh
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

SQL Classes Tue, 18-Aug-2026

@ F-113, H-14 09:30 pm

Assignment -1
Section - A

1. Create a table authors with columns: author_id (primary key), name (not null text),
country (text), birth_year (integer).
2. Create a table books with columns: book_id (primary key), title (not null text),
price (decimal), published_year (integer), stock_quantity (integer,).
3. Create a table members with columns: member_id (primary key), full_name (not null
text), email (), joined_date (date).
4. Add a new column genre (text) to the books table.
5. Modify the country column in authors so it cannot be NULL.
6. Rename the full_name column in members to member_name.
7. Delete the entire members table structure permanently.
8. Remove all rows from authors instantly while keeping the table structure (without
using DELETE).
9. Rename the books table to book_catalog.

Section - B

1. Create a new table employees (emp_id, name, department, salary, city)


2. Insert a new employee: emp_id=1, name "Rahul Sharma", department "Sales", salary
35000, city "Kanpur".
3. Insert 4 more employees of your choice with different departments and cities.
4. Insert a new employee without specifying their city value (leave it blank/NULL).
5. Update Rahul Sharma's salary to 40000.
6. Update the department of employee with emp_id=3 to "Marketing".
7. Increase every employee's salary by 2000.
8. Update the city to "Lucknow" for all employees currently in "Kanpur".
9. Set salary to 30000 for any employee whose salary is currently NULL.
10. Delete the employee with emp_id=5.
11. Delete all employees who belong to the "Sales" department.
12. Delete all employees whose salary is less than 20000.
13. Delete every row from the employees table (but keep the table itself).

You might also like