Dbms Record
Dbms Record
1
Department of Computer Application Kristu Jyoti College of Management &Technology
1)
a) Create the relation to show salesman information called as salesman_master with the
following attributes:
City Varchar 10
Pincode Number 8
State Varchar 10
NOT NULL,cannot be
Salamt Number 8
0
Description Varchar 10
Profitpercent Number 4
Unitmeasure Varchar 10
2
Department of Computer Application Kristu Jyoti College of Management &Technology
Costprice Number 8 Should not be null, cannot be
0
1 Find the names of salesmen who have a salary of 2000 to 5000 both inclusive. Order
the result
in the descending order of the names.
2 Change the city of the salesman “S003” to Mumbai.
3 Change the size of the Salesmanname column size to varchar2(25 )
4 What is Martin Jane’s address and sales amount? ( If Martin Jane’s record is not
present insert/update the record)
5 List the names of all salesmen having ‘n’ as the third letter in their names.
6 Change the size of the Salesmanname column size to varchar2(25 )
7 List all the salesmen who do not stay in “Maharashtra” or “Tamil Nadu”. ( If
Maharashtra” or “Tamil Nadu record is not present update state )
8 Find the salesmenno of those salesmen who do not sell a product.
9 Delete the details of those salesmen whose remarks is “very poor”.
10 Change the size of the selling price column in product_master relation to 10,3.
Answers
a) CREATE table salesman_master
City VARCHAR(10),
Pincode NUMBER(8),
State VARCHAR(10),
3
Department of Computer Application Kristu Jyoti College of Management &Technology
);
Table created.
Description VARCHAR(10),
Profitpercent NUMBER(4),
Unitmeasure VARCHAR(10),
);
Table created.
1 row created.
1 row created.
4
Department of Computer Application Kristu Jyoti College of Management &Technology
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
SALESMANNAME
-----------------------
Sam
Martin
John
1 row Updated.
Table Altered
5
Department of Computer Application Kristu Jyoti College of Management &Technology
4. SELECT Address1, Salesamt FROM salesman_master WHERE
Salesmanname='Martin Jane';
ADDRESS1 SALESAMT
---------------- -------------------
JaneHouse 5000
SALESMANNAME
-----------------------
Dani
Table altered
SALESMANNAME
-----------------------
Sam
Dani
John
SALESMANNO
-------------------
S004
1 row deleted.
Table Altered
6
Department of Computer Application Kristu Jyoti College of Management &Technology
2)
address1 Varchar 10
address2 Varchar 10
city Varchar 10
pincode number 8
state Varchar 10
balance_due number 10
Dest_address varchar 15
salesmanname varchar 10
deliverydate date
billpaid char 1
7
Department of Computer Application Kristu Jyoti College of Management &Technology
Insert a minimum of 4 records to the relations.
1 Retrieve the entire contents of the client_master relation in the alphabetical order of
their names.
2 List all the clients who are not located in “Maharashtra”.
3 Change the balance_due of clientno “C00001” to Rs.1000
4 Add a column called Telephone of data type number to client_master relation.
5 List all information from the sales_order Table for orders placed in the month of June,
2008.
6 List the names of all clients having ‘a’ as the second letter in their names.
7 List the clientno’s whose order delivery has been made in the month of June, 2009 but
whose bills are not yet paid.
8 Delete the client details located in Tamil Nadu.
Answers
a) CREATE Table client_master (
address1 VARCHAR(10),
address2 VARCHAR(10),
city VARCHAR(10),
pincode NUMBER(8),
state VARCHAR(10),
balance_due VARCHAR(10)
);
Table created.
8
Department of Computer Application Kristu Jyoti College of Management &Technology
Orderdate DATE NOT NULL,
Dest_address VARCHAR(15),
salesmanname VARCHAR(10),
deliverydate DATE,
billpaid CHAR(1),
);
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
9
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO sales_order VALUES('O00001','C00001','22-jun-
2009','LazzHome,Mhta','Dani','25-jun-2009','0','inprocess');
1 row created.
1 row created.
1 row created.
1 row created.
CLIENT NAME
---------- --------
C00001 Lazz
1 row updated.
10
Department of Computer Application Kristu Jyoti College of Management &Technology
Table altered
NAME
--------
Kate
Lazz
CLIENT
---------
C00001
1 rows deleted.
11
Department of Computer Application Kristu Jyoti College of Management &Technology
3. Create the following Tables:
employee
job char 10
Hiredate date
dept
dname varchar 10
location varchar 10
1 List the names of the employees who have a salary less than Rs.3000 from the
employee relation.
2 List all the employees whose name starts with the letter ‘K’.
3 List the departmentname which is located in Noida and Brooklyn from dept relation.
( If Noida and Brooklyn record is not present update location )
4 Display all the employee names in the ascending order of their date of joining and
ordered next by the employee names from employee relation.
12
Department of Computer Application Kristu Jyoti College of Management &Technology
5 List all employees who were hired during 1999.
6 Change the basic salary tors.3000 where the job is Clerk.
7 Add two columns “HOD” and “Strength” of datatype varchar and size 10 to the dept
relation.
8 Define the deptname as NOT NULL constraint in the dept relation.
Answers
CREATE Table dept
dname VARCHAR(10),
location VARCHAR(10)
);
Table created.
job CHAR(10),
hireDATE DATE,
basic_sal NUMBER(9,2),
commission NUMBER(7,2),
dept_no VARCHAR(8),
);
Table created.
13
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO dept VALUES('D001','H R','Noida');
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
ENAME
----------
Kester
ENAME
----------
Kevin
Kester
14
Department of Computer Application Kristu Jyoti College of Management &Technology
3. SELECT dname FROM dept WHERE location IN('Noida', 'Brooklyn');
DNAME
--------------
HR
MANAGER
ENAME
----------
Aby
Alvin
Kevin
Kester
ENAME
----------
Kevin
Kester
Alvin
1 row updated.
Table altered
Table altered
15
Department of Computer Application Kristu Jyoti College of Management &Technology
4. Create the following relations:
salesman_mast
Address varchar 10
City varchar 10
Pincode number 6
State varchar 10
product_mast
description varchar 10
units varchar 10
Qty_available number 6
16
Department of Computer Application Kristu Jyoti College of Management &Technology
Answer the following questions:
1 List the various products available from the product_mast relation in the descending
alphabetical order.
2 Retrieve the list of names, city and the state of the salesmen in the alphabetical Order
of city and then by names.
3 List all the salesmen who are not staying in the state Florida.
( If Florida record is not present update state )
4 Display the details of salesmen S003 AND S005.
5 List all the salesmen whose name start with ‘A’ and end with ‘D’.
6 Change the salary amount to Rs.3000 of all salesmen whose salary is less than 2500.
7 Increase the size of description field from 10 to 12 in the product_mast relation.
8 Delete the details of salesmen who live in the states Florida and New Town.
( If Florida” or “New Town record is not present update state )
Answers
CREATE Table salesman_mast
Name VARCHAR(10),
Address VARCHAR(10),
City VARCHAR(10),
Pincode NUMBER(6),
State VARCHAR(10),
Sal_amount NUMBER(8,2),
target NUMBER(5,2)
);
Table created.
17
Department of Computer Application Kristu Jyoti College of Management &Technology
(
description VARCHAR(10),
profit_percent NUMBER(5,2),
units VARCHAR(10),
Qty_available VARCHAR(6),
Sell_price NUMBER(7,2),
Cost_price NUMBER(7,2)
);
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
18
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO product_mast VALUES('PR001','S001','Pistol',12,30,25,50000,45000);
1 row created.
1 row created.
1 row created.
1 row created.
PRODUCT DESCRIPTION
----------- ----------------
PR003 SMG
PR001 Pistol
PR002 LMG
PR004 Ammo
NAME
---------
Alfread
Kate
Sam
19
Department of Computer Application Kristu Jyoti College of Management &Technology
4. SELECT * FROM salesman_mast WHERE salesman_no IN('S003', 'S005');
NAME
----------
Arnold
Alfread
1 row Updated.
Table Altered
3 rows deleted.
20
Department of Computer Application Kristu Jyoti College of Management &Technology
5.
a) Create the relation to show Employee infORmation called as Employee _Master with
the following attributes:
21
Department of Computer Application Kristu Jyoti College of Management &Technology
Show the result of the following questions:
3.
Location VARCHAR(10)
);
Table created.
Allowances NUMBER(8,2),
Deductions NUMBER(8,2)
);
Table created.
22
Department of Computer Application Kristu Jyoti College of Management &Technology
Emp_Name VARCHAR(20) NOT NULL,
Address2 VARCHAR(20),
City VARCHAR(10) ,
);
Table created.
1.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
23
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO Salary_Master VALUES('S001',5000,1000,500);
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
VALUES('E001','Arnold','Arn Villai','Arn
Street','Knta',564768,'Karnataka','D005','S003','Average');
1 row created.
1 row created.
VALUES('E003','Kate','Kate Villai','Kate
Street','Kla',565768,'Kerala','D002','S002','Excellent');
1 row created.
1 row created.
24
Department of Computer Application Kristu Jyoti College of Management &Technology
VALUES('E005','Dani','Dani Villai','Dani Street','Kla',569868,'Kerala','D003','S005','Very
PoOR');
1 row created.
2.
AS
View created.
6:
25
Department of Computer Application Kristu Jyoti College of Management &Technology
b) Create the relation Course_Master tostorethe Course information
Answers
CREATE Table Course_Master
Location VARCHAR(10)
);
26
Department of Computer Application Kristu Jyoti College of Management &Technology
Table created.
City VARCHAR(10),
);
Table created.
);
Table created.
27
Department of Computer Application Kristu Jyoti College of Management &Technology
1.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
28
Department of Computer Application Kristu Jyoti College of Management &Technology
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
2,
AS
View created.
29
Department of Computer Application Kristu Jyoti College of Management &Technology
7. Create the following Tables:
Table : STUDENT
Table : DEPARTMENT
ANSWERS
Gender varchar(2),
Contact_no number(10)
);
30
Department of Computer Application Kristu Jyoti College of Management &Technology
Table created.
Table created.
1.
1 row created
1 row created
1 row created
1 row created
1 row created
1 row created
1 row created
31
Department of Computer Application Kristu Jyoti College of Management &Technology
1 row created
1 row Updated
2.
COUNT(Dept_name)
View created
32
Department of Computer Application Kristu Jyoti College of Management &Technology
8. Create the following Tables:
CUSTOMER
Lname Varchar 25
Phone_number Numeric 15
INVOICE
Issue_DATE Date
1.
2.
3.
33
Department of Computer Application Kristu Jyoti College of Management &Technology
Answers
Number(15));
Table created
);
Table created
1.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
34
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO INVOICE VALUES(‘i1’,’101’,’24 july 2008’);
1 row created.
1 row created.
1 row created
1 row created.
1 row created.
b)
UPDATE INVOICE set issue_DATE=’15 nov 2022’ WHERE cust_id in(SELECT c.cust_id
FROM CUSTOMER c INNER JOIN INVOICE i on c.cust_id=i.cust_id WHERE
c.cust_id=’101’);
1 row Updated.
2.
Issue_Date
15 nov 2022
35
Department of Computer Application Kristu Jyoti College of Management &Technology
Arjun mohan i2
Mahesh kumar i3
Libin scaria i4
Manu martin i5
View is created.
CUSTOMER
Address Varchar(20)
City Varchar(20)
SALES
Orderdate Date __
36
Department of Computer Application Kristu Jyoti College of Management &Technology
Write SQL queries for the following
1.
2.
ANSWER
Address VARCHAR(20),
City VARCHAR(20) );
Table created.
Orderdate DATE ,
);
37
Department of Computer Application Kristu Jyoti College of Management &Technology
Table Created
1 row created
1 row created
1 row created
1 row created
1 row created
1 row created
1 row created
1 row created
1 row created
1 row created
38
Department of Computer Application Kristu Jyoti College of Management &Technology
b). UPDATE CUSTOMER SET Address=’Rose Villa’ WHERE Cname=’John’;
1 row Updated
2.
COUNT(ORDERNO)
---------------------------
ORDERNO
---------------
View created
39
Department of Computer Application Kristu Jyoti College of Management &Technology
10. Create the following Tables:
EMPLOYEE
__
salary Number(7,2)
PROJECT
Proj_Name Varchar(25)
1.
2.
b) List the employee name along with the name of the project assigned to him/her.
40
Department of Computer Application Kristu Jyoti College of Management &Technology
CREATE Table employee
salary number(7,2)
);
41
Department of Computer Application Kristu Jyoti College of Management &Technology
CREATE Table project
42
Department of Computer Application Kristu Jyoti College of Management &Technology
b). UPDATE employee set designation='manager' WHERE name='albert';
NAME PROJNAME
------------------------------ -------------------------
anu abc mngnt system
amal pqr
banty xyz
priya mno
albert qwe
43
Department of Computer Application Kristu Jyoti College of Management &Technology
3.
CREATE VIEW
employeeview as
SELECT eno,name,designation,salary
FROM employee;
EMPLOYEE
Dt_jn Date -
salary Number(7,2) -
BRANCH
1.
44
Department of Computer Application Kristu Jyoti College of Management &Technology
2.
Table created.
Grade number(2)check((Grade>0)AND(Grade<11)),
Table created.
45
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO Emply77 VALUES('E202','siddharth','b202',9,'21-nov-2019',45000);
b. SELECT e.Ename,b.Bname,e.Grade
Branch12 b on e.Bcode=b.Bcode;
Naran KOTTAYAM 5
siddharth ERANAKULAM 9
aayush PALAKKAD 8
vamikha THRISSUR 7
kripha CALICUT 10
46
Department of Computer Application Kristu Jyoti College of Management &Technology
3.CREATE VIEW emply_details AS
View created
Star Varchar(25) __
Price Number(10,2) __
b. List the title and title for all the movie that are issued
47
Department of Computer Application Kristu Jyoti College of Management &Technology
3.Create a view on the MOVIE Table
Table created
issueDATE DATE);
Table created.
48
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO INVOICE23 VALUES(22,12,'2-jan-2005');
5 rows Updated.
TITLE
-------------------------
Aram
Haram
Kadal
Kazhcha
Niram
49
Department of Computer Application Kristu Jyoti College of Management &Technology
13.Create the following Tables
Table: PERSONS
Lname Varchar(15)
Address Varchar(20)
City Varchar(10)
Table :ORDER
ORDERDATE DATE
50
Department of Computer Application Kristu Jyoti College of Management &Technology
fname varchar(15) NOT NULL,
city varchar(10));
Table created.
Table created.
51
Department of Computer Application Kristu Jyoti College of Management &Technology
OID ORDERQTY ORDERDATE ORDID
31 5 24-FEB-01 11
32 7 27-MAR-04 12
33 6 11-SEP-07 13
b. SELECT Order5.oid,Order5.Orderqty,Order5.Orderdate
WHERE person5.fname='johnson';
33 6 11-SEP-07
SELECT odid,orderqty,orderdate,
52
Department of Computer Application Kristu Jyoti College of Management &Technology
14.Create the following Tables
Table : CUSTOMER
Address Varchar(25)
Phone_No Number(10)
Table : ACCOUNT
Amount Number(10,2)
2.a.Find the CUSTOMER details who have the highest balance in account
Table created
53
Department of Computer Application Kristu Jyoti College of Management &Technology
(cust_id varchar(10) PRIMARY KEY,
Table created
1 row updated
54
Department of Computer Application Kristu Jyoti College of Management &Technology
Cust_id cust_name acc_no address phone_no
View created
55
Department of Computer Application Kristu Jyoti College of Management &Technology
15. CREATE Tables with appropriate structure to maintain infORmation about a set of books
in a library AND a possible set of CUSTOMERs.. then write needed queries fOR
Table created
due_DATE DATE);
Table created
56
Department of Computer Application Kristu Jyoti College of Management &Technology
BOOK_ID TITLE AUTHOR LANGUAGE
b101 Smruthy Perumpadam Malayalam
b102 3 Idiots Chetan Bhagath English
b105 2 States Chetan Bhagath English
57
Department of Computer Application Kristu Jyoti College of Management &Technology
16. CREATE Tables with appropriate structure to store information about a number of items
to be kept in stock in a provision store and the details about the sales on a given day. Then
write the needed queries to
Table created.
Table created.
58
Department of Computer Application Kristu Jyoti College of Management &Technology
STOCK_ CATEGORY ITEM_NAME PRICE
ITEM_NAME CATEGORY
-------------------- -------------------------
Pen Stationary
pencil Stationary
Tomato VegeTables
59
Department of Computer Application Kristu Jyoti College of Management &Technology
ladiesfinger VegeTables
Pineapple Fruits
60
Department of Computer Application Kristu Jyoti College of Management &Technology
17.Create the following Tables:
Table :BOOK
AuthOR_Name Varchar(15)
Publisher Varchar(20)
Quantity Number(3)
Table: ISSUE
Qty_Issued Number(3)
b.Display the BookId,Book Name AND Quantity issued fOR all books which are not issued
61
Department of Computer Application Kristu Jyoti College of Management &Technology
Book Name varchar(15) NOT NULL, AuthOR_Name varchar(15),
Table created
Qty_issued Number(3)) ;
62
Department of Computer Application Kristu Jyoti College of Management &Technology
SELECT * FROM Issue;
1 101 3
2 102 4
3 101 5
4 102 2
5 101 1
1 row Updated.
PUBLISHER
--------------------
Saji
Alex
Gopal
Madhav
on Book.BookID=Iss
63
Department of Computer Application Kristu Jyoti College of Management &Technology
BOOKID BOOKNAME QTY_ISSUED
105 Java 3
103 DataStructure 6
104 Software 5
SELECT Bookid,Bookname,AuthORname,
64
Department of Computer Application Kristu Jyoti College of Management &Technology
18. Create the following Tables:
Address Varchar(20)
City Varchar(20)
Orderdate DATE __
Table created.
65
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO CUSTOMER VALUES('c500','Ramkumar','Ram Nivas','kottayam');
Table created.
66
Department of Computer Application Kristu Jyoti College of Management &Technology
ORDER ORDERDATE CNO
1 row Updated.
COUNT(CITY)
-----------
b.SELECT CUSTOMER.cno,CUSTOMER.cname,
CUSTOMER.address,CUSTOMER.city,sales.Order_no FROM
67
Department of Computer Application Kristu Jyoti College of Management &Technology
CUSTOMER left join sales on CUSTOMER.cno=sales.cno
WHERE sales.Order_no='o234';
Table : STUDENT
Gender Varchar(2)
Contact_no Number(10)
Table : DEPARTMENT
68
Department of Computer Application Kristu Jyoti College of Management &Technology
2.a. Display the departments names in its alphabetical Order.
Table created.
Table created.
DEPT_ID DEPT_NAME
---------- ----------
102 mcom
103 geology
105 commerce
69
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO stud2 VALUES(1,'anu',101,'f',9570602122) ;
1 row Updated.
DEPT_NAME
----------
commerce
comp app
comp sci
electro
mcom
70
Department of Computer Application Kristu Jyoti College of Management &Technology
b. SELECT s.rollno, s.name, s.gender, s.contact_no,
COLUMNNAME DATATYPE
CONSTRAINT
salary Number(7,2) __
Proj_Name Varchar(25)
71
Department of Computer Application Kristu Jyoti College of Management &Technology
Write SQL queries for the following
b. List the employee names AND designation who is not assigned a project
Project_name VARCHAR(25),
1.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
72
Department of Computer Application Kristu Jyoti College of Management &Technology
INSERT INTO project VALUES(‘p01’,’tourism management’,’e01’);
1 row created
1 row created.
1 row created.
1 row created
4.(b)
5 rows Updated.
5.(a)
73
Department of Computer Application Kristu Jyoti College of Management &Technology
5.(b)
Name designation
Joji manager
Rose assistant
6.
CREATE VIEW employee as SELECT eno, name, designation, salary FROM employee;
View is created.
Star Varchar(25) __
Price Number(10,2) __
74
Department of Computer Application Kristu Jyoti College of Management &Technology
Table name: INVOICE
b. Display the Movie name AND type of movies that are not issued
Table created.
Table created.
75
Department of Computer Application Kristu Jyoti College of Management &Technology
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
76
Department of Computer Application Kristu Jyoti College of Management &Technology
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
77
Department of Computer Application Kristu Jyoti College of Management &Technology
SQL> INSERT INTO INVOICE67 VALUES(14,13,'14-apr-2019');
1 row created.
1 row created.
1 row Updated.
AVG(PRICE)
----------
300
215
200
TITLE TYPE
------------------------- ----------
vellinakshtram hORrOR
78
Department of Computer Application Kristu Jyoti College of Management &Technology
5.SQL>CREATE VIEW movie_details As SELECT Mvno,Title,Type,Star,Price FROM
Movie77;
View created
Dt_jn DATE -
salary Number(7,2) -
79
Department of Computer Application Kristu Jyoti College of Management &Technology
Table: BRANCH
Table created.
4.a)
1 row created.
1 row created.
1 row created.
row created.
1 row created.
BCODE BNAME
---------- ----------
B02 Kollam
B04 Alappuzha
B05 Kottayam
B06 Iduki
B13 Kannur
80
Department of Computer Application Kristu Jyoti College of Management &Technology
Table: EMPLOYEE
Table created.
4.a)
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
81
Department of Computer Application Kristu Jyoti College of Management &Technology
E304 Abhijith B04 4 17-JUN-14 65000
4. b)
1 row Updated.
5.a)
MAX(SALARY)
-----------
50000
65000
40000
35000
82
Department of Computer Application Kristu Jyoti College of Management &Technology
5.a)
MIN(SALARY)
-----------
30000
65000
40000
35000
5.b)
5 rows SELECTed.
6)
View created
83
Department of Computer Application Kristu Jyoti College of Management &Technology
23. Create the following Tables
Table : CUSTOMER
Address Varchar(25)
Phone_No Number(10)
Table : ACCOUNT
Amount Number(10,2)
2. a.Display the acc_no, name, address of CUSTOMERs whose name starts with ‘L’
b.Find the CUSTOMER details who have the lowest balance in account
84
Department of Computer Application Kristu Jyoti College of Management &Technology
● INSERT INTO CUSTOMER
VALUES(‘c101’,’Ramesh’,23456782,’kottayam’,9976453213);
1 row created
1 row created
1 row created
1 row created
1 row created
85
Department of Computer Application Kristu Jyoti College of Management &Technology
b. Change the phone number of the CUSTOMER with the name=”Anjali”.
1 row Updated
5a. Display the acc_no ,name ,address of CUSTOMER whose name starts with
‘L’.
b. find the CUSTOMER details who have the lowest balance in account.
86
Department of Computer Application Kristu Jyoti College of Management &Technology
6a. create a view on CUSTOMER Table
View created.
Table : PRODUCT
Table : SALES
Table created.
Table created.
87
Department of Computer Application Kristu Jyoti College of Management &Technology
1 row inserted
INSERT INTO product VALUES (‘P002’,’Pencil’,150,8.50);
1 row inserted
INSERT INTO product VALUES (‘P003’,’Eraser’,50,5.00);
1 row inserted
INSERT INTO product VALUES (‘P004’,’Sharpener’,100,9.00);
1 row inserted
INSERT INTO product VALUES (‘P005’,’Ruler’,200,15.00);
1 row inserted
1 row Updated.
Product_name
Pen
Pencil
Eraser
Sharpener
Ruler
88
Department of Computer Application Kristu Jyoti College of Management &Technology
Product_no Product_name Qty_Ordered
P002 Pencil 70
View created.
89
Department of Computer Application Kristu Jyoti College of Management &Technology
NoSQL -MongoDB
90
Department of Computer Application Kristu Jyoti College of Management &Technology
Create a collection movie AND Insert 3 Documents
title : Fight Club writer : Chuck Palahniuk year : 1999 actORs : [ Brad Pitt
Edward NORton
John Travolta
Uma Thurman
writer : J.R.R. Tolkein year : 2012 franchise : The Hobbit title : The Hobbit: The Desolation
of Smaug
UPDATE Documents
Delete Documents
Ans:
> db.createCollection("movie")
Output: {“ok”: 1}
Output:
91
Department of Computer Application Kristu Jyoti College of Management &Technology
WriteResult({ "nInserted" : 1 })
Output:
WriteResult({ "nInserted" : 1 })
Output:
WriteResult({ "nInserted" : 1 })
1. > db.movie.find().pretty();
Output:
"_id" : ObjectId("61a8dc81ee875b3b0a29ba18"),
"year" : "1999",
"actORs" : [
"brad pitt",
"edward NORton"
"_id" : ObjectId("61a8de3aee875b3b0a29ba19"),
"year" : "1994",
92
Department of Computer Application Kristu Jyoti College of Management &Technology
"actORs" : [
"john Travolta",
"Uma thurman"
}{
"_id" : ObjectId("61a8dfc2ee875b3b0a29ba1a"),
"writer" : "j.r.r.Tolkein",
"year" : "2012",
Output:
Output:
4. > db.movie.find().sORt({"writer":1})
Output:
93
Department of Computer Application Kristu Jyoti College of Management &Technology
UPDATE document
Output:
DeleteDocument
Output:
WriteResult({ "nRemoved" : 1 })
94
Department of Computer Application Kristu Jyoti College of Management &Technology