0% found this document useful (0 votes)
7 views4 pages

Ques2

The document outlines SQL table operations, including the creation of an 'employees' table with various fields. It details data manipulation commands such as inserting, selecting, updating, and deleting employee records. Additionally, it includes examples of altering the table structure by adding and dropping columns.

Uploaded by

sharmadeependu2
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)
7 views4 pages

Ques2

The document outlines SQL table operations, including the creation of an 'employees' table with various fields. It details data manipulation commands such as inserting, selecting, updating, and deleting employee records. Additionally, it includes examples of altering the table structure by adding and dropping columns.

Uploaded by

sharmadeependu2
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
You are on page 1/ 4

Ques2:- Table Operations

Create TABLE

INPUT
CREATE TABLE employees (

id INT PRIMARY KEY AUTO_INCREMENT,

name VARCHAR(100) NOT NULL,

position VARCHAR(50),

salary DECIMAL(10, 2),

hire_date DATE

);

OUTPUT

Alter Table
Add Column:
INPUT
ALTER TABLE employees ADD COLUMN email VARCHAR(100);

OUTPUT
Drop Column:
INPUT
ALTER TABLE employees DROP COLUMN email;
OUTPUT

Ques3. Data Manipulation


Insert Data
INPUT
INSERT INTO employees (id,name, position, salary, hire_date)
VALUES (1,’John Doe’, ‘Developer’, 60000, ‘2023-01-15’;),
(2, ‘david’, ‘production’, 80000, ‘2023-01-18’;),
(3, ‘betty’, ‘data analysts’, 90000, ‘2023-01-08’;)
(4, ‘robert’, ‘ba’, ‘40000’, ‘2023-01-07’;)

OUTPUT
Select Data
INPUT
SELECT * FROM employees;
OUTPUT

Update Data
INPUT
UPDATE employees
SET salary = 65000
WHERE id = 1;
OUTPUT

Delete Data
INPUT
DELETE FROM employees
WHERE id = 1;

OUTPUT

You might also like