Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
1.8 kB
12
Indexable
Never
09/02/2024
________________________________________________________________________________________________________________________

Update:
use second;
select * from employee;
update employee set salary=40000 ,age=20 where emp_id in (1,2);
select * from employee;

_____________________________________________________________________________________________________________________________

diffrence between update and alter:

alter:1. alter command is data defination lang(DDL)
      2.alter command will perform structure level.
      3.syntax:- alter table tablename (modify/add/rename) Drop column column_name
      4. this command make changes with the table structure.
      5. alter command works on attributes(columns) 


update:1. update command is data manipulation lang(DML)
       2.update command will perform on data level.
       3 syntax :-update table_name set column_name=values
       4. this command make changes the data inside table.
        5. update cammand works on perticular tuples(rows) in the table
___________________________________________________________________________________________________________________

Limit:-
========

the limit clause is used for return specific number of records.
syntax:
select columns from tablename limit number;
exa:
select * from employeeinfo limit 5;
select * from employeeinfo where salary=30000 limit 3;
select * from employeeinfo order by name desc limit 4;
select * from employeeinfo order by id desc limit 4;

-----------------------------------
limit with offset:
syntax:-select * from table_name limit offset_value, rowlimit
select * from employeeinfo limit 4,3;

syntax: select * from table_name limit limit_value offset offset_value, 
select * from employeeinfo limit 3 offset 4;

Leave a Comment