(UPDATE, SELECT, ALTER, DROP)
(UPDATE, SELECT, ALTER, DROP)
DML stands for Data Manipulation Language and comprises of commands which are used to insert, edit, view & delete the data stored in a database object.
DDL Commands are: ALTER, DROP
DML Commands are: UPDATE, SELECT
Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.
TABLE: WATCHES
| Watchid | Watch_name | Price | Type | Qty_store |
| W001 | High time | 10000 | Unisex | 100 |
| W002 | Life time | 15000 | Ladies | 150 |
| W003 | Wave | 20000 | Gents | 200 |
| W004 | High fashion | 7000 | Unisex | 250 |
| W005 | Golden time | 25000 | Gents | 100 |
TABLE: SALE
| Watchid | Qty_Sold | Quarter |
| W001 | 10 | 1 |
| W003 | 5 | 1 |
| W002 | 20 | 2 |
| W003 | 10 | 2 |
| W001 | 15 | 3 |
| W002 | 20 | 3 |
| W005 | 10 | 3 |
| W003 | 15 | 4 |
(a) To display all the details of those watches whose name ends with ‘time’
(b) To display watch’s name andprice of those watches which have price range between 5000-15000
(c) To display total quantity in store of unisex type watches
(d) To display watch name and their quantity sold in first quarter
(e) Select max(price),min(qty_store) from watches;
(f) Select quarter, sum(qty_sold) from sale group by quarter;
(g) Select watch_name,price,type from watches w, sale s where w.watchid=s.watchid;
(h) Select watch_name, qty_store, sum(qty_sold),qty_store
(i) W.watch=s.watchid group by s.watchid;
Write SOL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii) which are based on the tables.
TABLE : CUSTOMERS
| NO | CNAME | ADDRESS |
| 101 | Richa jain | Delhi |
| 101 | Surbhi Sinha | Chennai |
| 103 | Lisa Thomas | Bangalore |
| 104 | Imran Ali | Delhi |
| 105 | Roshan Singh | Chennai |
TABLE : TRANSACTION
| TRNO | CNO | AMOUNT | TYPE | DOT |
| T001 | 101 | 1500 | Credit | 2017-11-23 |
| T002 | 103 | 2000 | Debit | 2017-05-12 |
| T003 | 102 | 3000 | Credit | 2017-06-10 |
| T004 | 103 | 12000 | Credit | 2017-09-12 |
| T004 | 101 | 1000 | Debit | 2017-09-05 |
(a) To display details of all transactions of TYPE Credit from Table TRANSACTION.
(b) To display the CNO and AMOUNT of all transactions done in the month September 2017 from the table TRANSACTION.
(c) To display the last date of transaction (DOT) from the table TRANSACTION for the customer having CNO as 103.
(d) To display all CNO,CNAME and DOT (date of transaction) of those CUSTOMERS from tables CUSTOMERS and TRANSACTION who have done transactions more than or equal to 2000.
(e) Select count(*), avg(amount) from transaction where dot>= ‘2017-06-01’;
(f) Select cno, count(*), max (amount) from transaction group by cno having count(*)> 1;
(g) Select cno, cname from customer where address not in (‘Delhi, ‘Bangalore’);
(h) Select distinct cno from transaction;
(a) Stealing away a brand new computer from a showroom.
(b) Getting in someone’s social networking account without his consent and posting pictures on his behalf to harass him.
(c) Secretly copying files from server of a call center and selling it to the other organization.
(d) Viewing sites on a internet browser.
| AccNo | Cust_name | FD_Amount | Months | Int_Rate | FD_Date |
| 1001 | Arti Gupta | 30000 | 36 | 6.00 | 2018-07-01 |
| 1002 | Dilip Lal | 50000 | 48 | 6.75 | 2018-03-22 |
| 1003 | Navin Gupta | 30000 | 36 | NULL | 2018-03-01 |
| 1004 | D.P. Yadav | 80000 | 60 | 8.25 | 2017-06-12 |
| 1005 | Jyoti Sharma | 20000 | 36 | 6.50 | 2017-01-31 |
| 1006 | Rakesh Kumar | 70000 | 60 | 8.25 | 2018-06-15 |
| 1007 | K.D. Singh | 50000 | 48 | NULL | 2018-07-05 |
| 1008 | Anjali Sharma | 60000 | 48 | 6.75 | 2017-04-02 |
| 1009 | Swati Garg | 40000 | 42 | 6.50 | 2018-06-15 |
| 1010 | Rupinder Kaur | 25000 | 36 | 6.50 | 2018-09-27 |
Write SQL commands for the statements (a) to (g) on the table BANK
(a) To create the table Bank (Primary Key: AccNo)
(b) Display the structure of the table Bank.
(c) Display the details of all the bank.
(d) Display the AccNo, Cust_Name, and FD_Amount.
(e) Display the details of all the FD’s having maturity time is less than 40 months.
(f) Display the AccNo and FD amount which started before 01-04-2018.
(g) Display details of all FD whose rate of interest are NULL.
(i) VB Script
(ii) ASP
(iii) JSP
(iv) JavaScript