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

SQL-3 DML & Practice Questions

The document outlines the basics of Data Manipulation Language (DML) including commands for inserting, updating, deleting, and selecting records in a database. It explains the use of the WHERE clause for filtering records and provides syntax examples for each command. Additionally, it includes practice questions related to creating and modifying database tables.

Uploaded by

shanthiraaja143
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL-3 DML & Practice Questions

The document outlines the basics of Data Manipulation Language (DML) including commands for inserting, updating, deleting, and selecting records in a database. It explains the use of the WHERE clause for filtering records and provides syntax examples for each command. Additionally, it includes practice questions related to creating and modifying database tables.

Uploaded by

shanthiraaja143
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

DML - Data Manipulation Language :

-insert
-update
-delete
-select

Where Clause:
It is used to Filter the Records.
it is used those records that specified Conditions.

Syntax:
select * from tablename where condition;
Ex:select * from sounder where age<25;
ex: select * from sounder where age<25 and id!=122;
+------+----------+------+--------+
| id | name | age | salary |
+------+----------+------+--------+
| 234 | sounder | 24 | 50000 |
| 355 | sounder6 | 21 | 50000 |
+------+----------+------+--------+

Ex: select * from sounder where age<25 and id=122;


+------+----------+------+--------+
| id | name | age | salary |
+------+----------+------+--------+
| 122 | sounder3 | 22 | 23000 |
+------+----------+------+--------+

Select Command:
It fetches the datas from the one or more tables.

Syntax:
Select * from Tablename;
select * from sounder;
+------+----------+-------+--------+
| id | name | age | salary |
+------+----------+-------+--------+
| 234 | sounder | 24 | 50000 |
| 123 | sounder1 | 25 | 50000 |
| 344 | sounder2 | 27 | 50000 |
| 122 | sounder3 | 22 | 23000 |
| 233 | sounder4 | 28 | 15000 |
| 355 | sounder6 | 21 | 50000 |
| 111 | sounder7 | 21000 | NULL |
| 222 | sounder8 | 27000 | NULL |
| 333 | sounder9 | 43000 | NULL |
+------+----------+-------+--------+

-Select Column1,column2,..from table name;

select id,name,salary from sounder;


+------+----------+--------+
| id | name | salary |
+------+----------+--------+
| 234 | sounder | 50000 |
| 123 | sounder1 | 50000 |
| 344 | sounder2 | 50000 |
| 122 | sounder3 | 23000 |
| 233 | sounder4 | 15000 |
| 355 | sounder6 | 50000 |
| 111 | sounder7 | NULL |
| 222 | sounder8 | NULL |
| 333 | sounder9 | NULL |
+------+----------+--------+

Insert Command:
-inserting Records into a table.

Syntax:
insert into tablename values(value1,value2,....);
Ex: insert into student_details values('101a','Raj',25);
- insert into student_details values('102b','raj1',21),('103c','raj2',23);
- insert into student_details(stu_name) values('Raj3');

Update Command:
-updating the Records

Syntax:
update tablename set columnname=value
update tablename set columnname=value where condition;
Ex:update employee set id=12 where name="Madhumitha";

Delete Command:
Deleting The Records.
Syntax:
delete from tablename; ->it Deletes the entire Records in the Table.
Ex: delete from student;

delete from tablename where Condition; ->it Deletes the particular


Records.
EX: delete from employee where name="Raj";

Practice Questions:

1.Creating database name Shop.Create tablename customers with 3 columns-


Cus_id,cus_name,purchase_amount.
2.change the datatype for cus_id.
3.add one more column in customers table.columnname is cus_age.
4.rename the columnname Cus_name to name.
5.update any one row value.
6.Display the customer details,who purchasing amount grater than 2000;

You might also like