Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
13 views
11 pages
Sahil DBMS
kb
Uploaded by
kashish negi
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save sahilDBMS For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
13 views
11 pages
Sahil DBMS
kb
Uploaded by
kashish negi
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save sahilDBMS For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 11
Search
Fullscreen
PRACTICAL FILE OF BASE MANAGEMENT LAB SESSION: 2023-24 SUBMITTED TO: SUBMITTED BY: Mrs Divya SAHIL. Assistant professor 8721144 Comp. Engg. Comp. Engg. Department of Computer Engineering, State Institute of Engineering and Technology, Nilokheri (Karnal) (Affiliated to Kurukshetra University, Kurukshetra)PRACTICAL NO: 1 AIM: Write the queries for Data Definition Language (DDL) in RDBMS. THEORY: DDL is an abbreviation of Data Definition Language.The DDL Commands in Structured Query Language are used to create and modify the schema of the database and its objects. The syntax of DDL commands is predefined for describing the data. © CREATE Command © DROP Command © ALTER Command TRUNCATE Command RENAME Command CREATE Comman and other database objects. CREATE is a DDL command used to create databases, tables, triggers SYNTAX: CREATE Database Database_Name; CREATE TABLE Table_Name; EXAMPLI Berra & Lint to 1000s = | eI Q CREATE DATABASE COLLEGES USE COLLEGE; CREATE TABLE STUDENT (2D INT pRImaRY KEY, NAME VARCHAR( 30), ROLL_NO INT NOT NULL » Output CB Action Output so tme Acton Mesage 1 200855 CREATE DATABASE COLLEGE Trow6s) fected 2 200801 USECOLLEGE Orow(s) affected 3 20:08:05 CREATE TABLE STUDENT (1D INT PRIMARY KEY, NAME VARCHAR(20)... Orow() fectedDROP Command: DROP is a DDL command used to delete/remove the database objects from the SQL database. We can easily remove the entire table, view, or index from the database using this DDL command. SYNTAX: DROP DATABASE Database_Name; DROP TABLE Table_Name; EXAMPLI BF FB & [RB] umeto 1000s ~ | wei Q © CREATE DATABASE COLLEGES USE COLLEGES CREATE TABLE STUDENT (xD INT PRIMARY KEY, NAME VARCHAR(30), ROLL_NO INT NOT NULL ds DROP TABLE STUDENTS GI Action Output © Time Acton Message 1 20:08:55 CREATE DATABASE COLLEGE 1 row(s) affected 2 200901 USE COLLEGE Orow(s) affected 3 200905 CREATE TABLE STUDENT (ID INT PRIMARY KEY, NAME VARCHAR(20),R.... Orow(s) affected 4 18:09:40 DROP TABLE STUDENT Orow(s) affected ALTER Command: ALTER is a DDL command which changes or modifies the existing structure of the database, and it also changes the schema of database objects. SYNTAX:ALTER TABLE name_of_table ADD column_name column_definition; CREATE DATABASE COLLEGES USE COLLEGES CREATE TABLE STUDENT (1D INT PRIMARY KEY, NAME VARCHAR(30)5 ROLL_NO INT NOT NULL ds free TABLE stuvenT apo AGE vaRCHAR(30)5 Gl Action Output © _ 1 18:15:32 ALTER TABLE STUDENT ADD AGE VARCHAR(O) Crows) affected} TRUNCATE Command:TRUNCATE is another DDL command which deletes or removes all records from table. TRUNCATE also removes space allocated for storing the table records. SYNTAX: TRUNCATE TABLE Table] EXAMPLE: Barra & 2© USE COLLEGES 3. © CREATE TABLE STUDENT 4 © (1D INT PRIMARY KEY, NAME VARCHAR(30)5 ROLL_NO INT NOT NULL ds Jrruncare TABLE STUDENT; GI Action Outpt 2 tme Acton Message © 1: 1821:36 TRUNCATE TABLE STUDENT Orow(s) affectedRENAME Command:RENAME is a DDL command which is used to change the name of the database table. SYNTAX: RENAME TABLE Old_Table_Name TO New_Table_Name; EXAMPL mit to 1000 rows CREATE DATABASE COLLEGES USE COLLEGES CREATE TABLE STUDENT (1D INT PRIMARY KEY, NAME VARCHAR(20), ROLL_NO INT NOT NULL ds © RENAE TABLE STUDENT TO STUDENT_DETATLS; Output GI Action Outpt * Time Action Menage © 1: 18:21:36 TRUNCATE TABLE STUDENT rows) affected © 2. 18:25:02. RENAME TABLE STUDENT TO STUDENT_DETAILS Orow(s) affectedPRACTICAL NO: 2 AIM: Write the queries for Data Manipulation Language (DML) in RDBMS. THEORY:DML commands are used to modify the database. It is responsible for all form of changes in the database.The command of DML is not auto-committed that means it can't permanently save all the changes in the database. They can be rollback. @ SELECT Command INSERT Command UPDATE Command @ DELETE Command SELECT Command : SELECT is the most important data manipulation command in Structured Query Language. The SELECT command shows the records of the specified table. It also shows the particular record of a particular column by using the WHERE clause. SYNTAX: SELECT * FROM table_name; EXAMPLE: way FOB TD] Umato te | eS AH © CREATE DATABASE COLLEGES © use couece; © CREATE TABLE STUDENT (20 WT PRIMARY KEY, AE VARCHAR(30), ROLL_NO INT NOT MULL ds 8 © SELECT*FRON STUDENTS Result Gid | TB Fer Rows at: Gj BB BR epotepon: [iy Gy | wap cat coomne: TE 1D NA ROU_NO oyINSERT Command : INSERT is another most important data manipulation command in Structured Query Language, which allows users to insert data in database tables. SYNTAX: INSERT INTO TABLE_NAME ( column_Namel , column_Name2 , .... column_NameN ) VALUES (value_l, value_2, .... value_N); EXAMPLE: aerraos (© CREATE DATABASE COLLEGES Lato Ome + 18 QW) (20 avr rtnany KEY, rane vancnan( se), © INSERT THTO STUDENT (ID, NAME, ROLL_HO) ° vawes © (ASTRA S15 (24 “SAHTL 44) (34 "VATBHAV 63), (4, "URVASHE™62)5 eon Ouse © 1 183846 INSERT INTO STUDENT (D.NAMEFOLL_NO)VALUES (L"RAM"S1\@... row) elected Records: & Dupeates:0 War: 0 13 @ SELECT * FROM STUDENT; < | Result Grid | JH €} Fitter Rows: | edt: 64 E> BE NAME ROLL_NO RAM 51 SAHIL “4 VAIBHAV 63 URVASHI ro = omy omUPDATE Command : UPDATE is another most important data manipulation command in Structured Query Language, which allows users to update or modify the existing data in database tables. SYNTAX: UPDATE Table_name SET [column_namel= value_l, ...., column_nameN = value_N] WHERE CONDITION; EXAMPL! @ar#fA0die 1 © CREATE OATABASE COLLEGES © use coueces © caeaTe TABLE srvDENT (20 nr primary KEY, MARE VARCHAR(30), ROLL_MO INT NOT MULL Dy INSERT INTO STUDENT (ID, NAKE,ROLL_NO} vawues (Ls RANN" 52), (25"SAHTL" 48), (3, °VATBNAV" 63), (45 "URVASHT Ser 5al_ sare UPDATES =05 Jroste StuseNT SEY ROLL NO-S0 WERE ROLLNO-s, Breton Output JO 1184348 SET SOL_SAFE_UPDATES «0 roms) fected lo _2 184420 UPDATE STUDENT SET ROLL_NO=50 WHERE ROLL_NO=51 row) affected Fows matched: 1 Changed] SELECT * FROM STUDENTS «< Result Grid | HH] 4) Fiter Rows: edt: Gf) Bb EB | epon/import NAME —_ROLL_NO 50 4DELETE Command : DELETE is a DML command which allows SQL users to remove single or multiple existing records from the database tables This command of Data Manipulation Language does not delete the stored data permanently from the database. We use the WHERE clause with the DELETE command to select specific rows from the table SYNTAX: DELETE FROM Table_Name WHERE condition; EXAMPL Ba ryra & [BB] | umato 100010ms + | | FQ (fl) 1© CREATE DATABASE COLLEGE; 2© USE COLLEGES 3.© CREATE TABLE STUDENT 4 © (ID INT PRIMARY KEY, 5 | NAME vARCHAR(30), 6 | ROLL_NO INT NOT NULL 7 0s 8 © INSERT INTO STUDENT (ID,NANE,ROLL_NO) 9 vaWuEs 16 (1s "RAM" ,51)5(25"SAHTL™ 44) 5 (35 "VATBHAV™ 63) 5 (45 "URVASHI™ »62)5 11 © DELETE FROM STUDENT WHERE ID=15 12 CF Action Output - © 1 1851.23 DELETE FROM STUDENT WHERE ID=1 1 rom() affected SELECT * FROM STUDENTS < | Result Grid | JH 4} Fitter Rows: éd| 1D NAME ROLL_NO 2 ‘SAHIL 4 3 VAIBHAV 63 4 URVASHI 62 » = os ooPRACTICAL NO : 3 AIM: Write the queries for Data Control Language (DCL) in RDBMS. THEORY:Data control language (DCL) is used to access the stored data. It is mainly used for revoke and to grant the user the required access to a database. © Grant © Revoke GRANT Command : It is employed to grant a privilege to a user. GRANT command allows specified users to perform specified tasks SYNTAX: GRANT privilege_name on object_name to user; EXAMPLE: Gant Berra & [SB]! tmato 100009 we FQ fH) CREATE USER "A00'@"locelhost' IDENTIFIED BY “passwords 2 GRANT CREATE, ALTER, INSERT, UPDATE, DELETE, SELECT on college.* TO "AD 2531 CREATE USER ABC\@tooshow IDENTIFIED BY passwou! row) ected 2 072814 GRANT CREATE, ALTER, INSERT, UPDATE, DELETE, SELECT on cae... Orow() affectedREVOKE Command : It is employed to remove a privilege from a user. REVOKE helps the owner to cancel previously granted permissions, SYNTAX: REVOKE privilege_name on objectname from user, EXAMPLE: = warren & [R) teete 10000 - wi OH CREATE USER "286°" localhost” IDENTIFIED BY “passwords GRANT CREATE, ALTER, INSERT, UPDATE, DELETE, SELECT on college.* TO ‘ASC’@' lo REVOKE ALTER,DELETE ON college.* FROM “ABC'@'localhosts GB Acton Outoxt © 1 072631 CREATE USER ABC @tocahos IDENTIFIED BY passwod © 2.072814 GRANT CREATE, ALTER, INSERT, UPDATE, DELETE, SELECT on cole © 3 730.6 REVOKE ALTER DELETEON cologe." FROM ABC@tocahoat rom) afc Oram) acted rom) alec
You might also like
18csc303j-Dbms Lab Manual
PDF
No ratings yet
18csc303j-Dbms Lab Manual
60 pages
DBMS Unit 3 Notes - Docx 2
PDF
No ratings yet
DBMS Unit 3 Notes - Docx 2
55 pages
Wa0002 PDF
PDF
No ratings yet
Wa0002 PDF
16 pages
Shiva NG
PDF
No ratings yet
Shiva NG
7 pages
Lata PDF
PDF
No ratings yet
Lata PDF
13 pages
Vedika Vetal
PDF
No ratings yet
Vedika Vetal
19 pages
Chapter 4 - SQL Commands
PDF
No ratings yet
Chapter 4 - SQL Commands
7 pages
PCS 203-SM01
PDF
No ratings yet
PCS 203-SM01
17 pages
Lecture 06
PDF
No ratings yet
Lecture 06
23 pages
Chapter 4 Database Management-1
PDF
No ratings yet
Chapter 4 Database Management-1
125 pages
DBMS1-2 - 44 1
PDF
No ratings yet
DBMS1-2 - 44 1
13 pages
Record For New
PDF
No ratings yet
Record For New
128 pages
Ankush DBMSfile
PDF
No ratings yet
Ankush DBMSfile
11 pages
SQL Commant A1
PDF
No ratings yet
SQL Commant A1
13 pages
DBMS Presentation Vedika and Pratiksha
PDF
No ratings yet
DBMS Presentation Vedika and Pratiksha
15 pages
DBMS 4
PDF
No ratings yet
DBMS 4
30 pages
SQL Notes SQL
PDF
No ratings yet
SQL Notes SQL
57 pages
SQL Commands
PDF
No ratings yet
SQL Commands
9 pages
DDL DML Commands-Ece-A1
PDF
No ratings yet
DDL DML Commands-Ece-A1
3 pages
DDL, DML, DCL, DQL, TCL 1
PDF
No ratings yet
DDL, DML, DCL, DQL, TCL 1
13 pages
Dbms Lab
PDF
No ratings yet
Dbms Lab
57 pages
Data Definition Language
PDF
No ratings yet
Data Definition Language
19 pages
Types of SQL Command
PDF
No ratings yet
Types of SQL Command
5 pages
Exp1 1
PDF
No ratings yet
Exp1 1
57 pages
Practical 1
PDF
No ratings yet
Practical 1
12 pages
Unit 4 - Oracle Basics
PDF
No ratings yet
Unit 4 - Oracle Basics
14 pages
SQL Quries
PDF
No ratings yet
SQL Quries
8 pages
Unit 1.3 SQL
PDF
No ratings yet
Unit 1.3 SQL
13 pages
DBMSFile 1
PDF
No ratings yet
DBMSFile 1
33 pages
DBMS 1 - 11
PDF
No ratings yet
DBMS 1 - 11
11 pages
DDM Lab Manual
PDF
No ratings yet
DDM Lab Manual
55 pages
Dbmsss Notes
PDF
No ratings yet
Dbmsss Notes
28 pages
Session 7
PDF
No ratings yet
Session 7
52 pages
DDL, DML, TCL Commands
PDF
No ratings yet
DDL, DML, TCL Commands
9 pages
SQL Basics
PDF
No ratings yet
SQL Basics
34 pages
DBMS Chapter 4
PDF
No ratings yet
DBMS Chapter 4
39 pages
Unit 3
PDF
No ratings yet
Unit 3
18 pages
Module 4 DBMS
PDF
No ratings yet
Module 4 DBMS
21 pages
List of Experiments-1-2
PDF
No ratings yet
List of Experiments-1-2
10 pages
Shahid Nasim Riya - DBMS
PDF
No ratings yet
Shahid Nasim Riya - DBMS
11 pages
DBMS Unit-3 Notes
PDF
No ratings yet
DBMS Unit-3 Notes
19 pages
Dbms Procedure
PDF
No ratings yet
Dbms Procedure
38 pages
Writeups - Assignment 2
PDF
No ratings yet
Writeups - Assignment 2
7 pages
SQL Commands
PDF
No ratings yet
SQL Commands
7 pages
Apznza 1
PDF
No ratings yet
Apznza 1
32 pages
Record DBMS
PDF
No ratings yet
Record DBMS
73 pages
Unit 4 Bcomcardbms 2024
PDF
No ratings yet
Unit 4 Bcomcardbms 2024
34 pages
CH 4
PDF
No ratings yet
CH 4
87 pages
1.5. SQL Operations
PDF
No ratings yet
1.5. SQL Operations
29 pages
SQL Short Notes PDF
PDF
No ratings yet
SQL Short Notes PDF
9 pages
Mysql - unit-II (DML, DCL) Unit2
PDF
No ratings yet
Mysql - unit-II (DML, DCL) Unit2
61 pages
DBMS
PDF
No ratings yet
DBMS
7 pages
BCA Sem 5 DBMS Practical File
PDF
No ratings yet
BCA Sem 5 DBMS Practical File
32 pages
SQL Commands Cheatsheet With Examples
PDF
No ratings yet
SQL Commands Cheatsheet With Examples
6 pages
CH 2
PDF
No ratings yet
CH 2
19 pages
Dbms Unit5
PDF
No ratings yet
Dbms Unit5
74 pages
SQL v1 PDF
PDF
No ratings yet
SQL v1 PDF
42 pages
Databasequestion
PDF
No ratings yet
Databasequestion
5 pages
DBMS Lab Manual
PDF
No ratings yet
DBMS Lab Manual
35 pages