Presentation is loading. Please wait.

Presentation is loading. Please wait.

DML- Insert. DML Insert Update Delete select The INSERT INTO Statement The INSERT INTO statement is used to insert new rows into a table. Syntax INSERT.

Similar presentations


Presentation on theme: "DML- Insert. DML Insert Update Delete select The INSERT INTO Statement The INSERT INTO statement is used to insert new rows into a table. Syntax INSERT."— Presentation transcript:

1 DML- Insert

2 DML Insert Update Delete select

3 The INSERT INTO Statement The INSERT INTO statement is used to insert new rows into a table. Syntax INSERT INTO table_name VALUES (value1, value2,....)

4 You can also specify the columns for which you want to insert data: INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)

5 Inserting Data into Tables INSERT command adds new records Field values should match column order, or be specified in command INSERT INTO employee ( fname, lname, ssn, dno ) VALUES ( "Joe", "Smith", 909, 1);

6 This "Persons" table is empty after it is created. An insert SQL statement: INSERT INTO Persons VALUES ('Hetland', 'Camilla', 'Hagabakka 24', ‘20')

7 LastNameFirstNameAddressAge PettersenKariStorgtHagabakka 2420

8 Another tuple of data INSERT INTO Persons VALUES (‘Kit', ‘Johnson', ‘New York city’, ‘40')

9 LastNameFirstNameAddressAge PettersenKariStorgtHagabakka 2420 KitJohnsonNew York city40

10 Inserting Date and Interval Values Use to_date function to convert a character string to a date –Specify date string and matching format model –TO_DATE('08/24/2004', 'MM/DD/YYYY') –TO_DATE('10:00 AM', 'HH:MI AM') Use functions to convert character strings to intervals –TO_YMINTERVAL('4-9') inserts a positive interval of 4 years, 9 months –TO_DSINTERVAL('0 01:15:00') inserts a positive interval of 4 days, 1 hour, 15 minutes, 0 seconds


Download ppt "DML- Insert. DML Insert Update Delete select The INSERT INTO Statement The INSERT INTO statement is used to insert new rows into a table. Syntax INSERT."

Similar presentations


Ads by Google