SQL-2 DDL & DML
SQL-2 DDL & DML
database:
drop database databasename;
Ex:Drop database demo1;
Truncate Command:
it removes Entire Table Datas.
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 |
+------+----------+------+--------+
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 |
+------+----------+-------+--------+
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;