0% found this document useful (0 votes)
0 views

SQL Practical File Exp1 Exp2 Custom

The document outlines two experiments focusing on SQL commands: DDL (Data Definition Language) and DML (Data Manipulation Language). Experiment 1 demonstrates how to create, alter, and drop a table using DDL commands, while Experiment 2 covers inserting, updating, and deleting records with DML commands. Both experiments include example SQL statements and expected outputs for a 'Student' table.
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 views

SQL Practical File Exp1 Exp2 Custom

The document outlines two experiments focusing on SQL commands: DDL (Data Definition Language) and DML (Data Manipulation Language). Experiment 1 demonstrates how to create, alter, and drop a table using DDL commands, while Experiment 2 covers inserting, updating, and deleting records with DML commands. Both experiments include example SQL statements and expected outputs for a 'Student' table.
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
You are on page 1/ 3

Experiment No.

1 - DDL Commands (Create, Alter, Drop)


Objective:

To understand how to define, modify, and delete database structures using DDL commands.

Theory:

DDL includes SQL commands like CREATE, ALTER, DROP to define and manage table structures.

-- Create table

CREATE TABLE Student (

sno NUMBER(3),

sname CHAR(10),

class CHAR(5)

);

-- Alter table

ALTER TABLE Student ADD address VARCHAR(20);

-- Drop table

DROP TABLE Student;

Output:

SNO SNAME CLASS

1 Ravi BCA

2 Amit BCA
Experiment No. 2 - DML Commands (Insert, Update, Delete)
Objective:

To learn how to manipulate data in the database using DML commands.

Theory:

DML includes INSERT, UPDATE, DELETE for managing records in a table.

-- Insert data

INSERT INTO Student (sno, sname, class, address)

VALUES (1, 'Ravi', 'BCA', 'Delhi');

-- Update data

UPDATE Student SET sname = 'Amit' WHERE sno = 1;

-- Delete data

DELETE FROM Student WHERE sno = 1;

Output:

SNO SNAME CLASS ADDRESS

2 Amit BCA Delhi

3 Sita BCA Noida

You might also like