1 / 8

Data Manipulation Language

Data Manipulation Language. DML. insert into. insert used to insert only one record at time. insert statement will rejected if it: violates constraints Insert duplicate value in unique/primary key attribute Insert a value does not has a reference (foreign key)

ryder-watts
Download Presentation

Data Manipulation Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Manipulation Language DML

  2. insert into • insert used to insert only one record at time. • insert statement will rejected if it: • violates constraints • Insert duplicate value in unique/primary key attribute • Insert a value does not has a reference (foreign key) • Insert a value does not satisfies the condition (check) • there is data mismatch • Insert char value to number attribute • What about insert number value to char?

  3. insert into insert into TABLENAME(Att1, Att2,…, Attn) values(value1,value2, … , valuen); • Explanation: • Att1, Att2,…, Attn are attributes in the table the order is not important • value1,value2, … , valuenthe values for Att1, Att2,…, Attn respectively.

  4. insert into insert into TABLENAME values(value1,value2, … , valuen); • Explanation: • value1,value2, … , valuen the values for the attributes in the order which in the table respectively.

  5. examples • INSERT INTO COLLEGE(CID,CNAME) VALUES(10,’INFORMATIONS TECHNO.’); ____________________________________________ • INSERT INTO COLLEGE VALUES(30,’Arts’); ____________________________________________ • INSERT INTO STUDENTS(SID,SNAME,CID,SAVERAGE) VALUES(12345,'ALI',10,85.23); ____________________________________________ • INSERT INTO STUDENTS(SID,SNAME,CID,SGENDER) VALUES(22345,‘MONA',30,’f’);

  6. update update TABLENAME set Att1=Newvalue, Att2=Newvalue, …Attn=Newvalue where(codition); • Explanation: • You can use update to modify the row data • The condition used to determine which row (s) will be affected by the update.

  7. example • update students set saverage=90; _____________________________________________________________ • update students set saverage=90, sgender=‘f’; ______________________________________ • Update students • set saverage=90 • where sid = 12345;

  8. delete delete TABLENAME where(condition); • Explanation: • The condition used to determine which row (s) will be affected by the delete command.

More Related