0% found this document useful (0 votes)
3 views2 pages

SQL DDL, DML, and DQL Operations Guide

The document outlines a series of database operations including creating a Products table with specific constraints, altering the Customers table by adding and removing columns, inserting and updating records in the Orders table, deleting customers from a specific country, and querying customer data with filtering and sorting. Each problem specifies the required SQL commands to achieve the desired results. The tasks cover various aspects of Data Definition Language (DDL), Data Manipulation Language (DML), and Data Query Language (DQL).

Uploaded by

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

SQL DDL, DML, and DQL Operations Guide

The document outlines a series of database operations including creating a Products table with specific constraints, altering the Customers table by adding and removing columns, inserting and updating records in the Orders table, deleting customers from a specific country, and querying customer data with filtering and sorting. Each problem specifies the required SQL commands to achieve the desired results. The tasks cover various aspects of Data Definition Language (DDL), Data Manipulation Language (DML), and Data Query Language (DQL).

Uploaded by

inpramit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Problem 1 — DDL (CREATE + CONSTRAINTS)

Create a table named Products with the following structure:

 product_id – integer, primary key

 product_name – varchar(50), cannot be null

 price – integer, must be greater than 0

 stock – integer, default value 0

Problem 2 — DDL (ALTER + DROP)

Perform the following operations on the Customers table:

1. Add a new column email of type varchar(100)

2. Remove the column age from the table

Problem 3 — DML (INSERT + UPDATE)

Using the Orders table:

1. Insert a new order with:

o order_id = 6

o item = 'Webcam'

o amount = 1500

o customer_id = 2

2. Increase the amount of all orders by 10% where the item is


'Keyboard'.

Problem 4 — DML (DELETE + TRUNCATE)

Perform the following operations:

1. Delete all customers who belong to the country 'UAE'.

2. Remove all records from the Shippings table without deleting its
structure.

Problem 5 — DQL (SELECT with filtering & sorting)

Write a query to display:

 first_name, country, and age

 Only customers whose age is greater than 23


 Sort the result in descending order of age

You might also like