Unformatted text preview:

DML- InsertDMLThe INSERT INTO StatementSlide 4Inserting Data into TablesSlide 6Slide 7Another tuple of dataSlide 9Inserting Date and Interval ValuesDML- InsertDML•Insert •Update•Delete•selectThe INSERT INTO Statement•The INSERT INTO statement is used to insert new rows into a table.•SyntaxINSERT INTO table_name VALUES (value1, value2,....)•You can also specify the columns for which you want to insert data:•INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)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);•This "Persons" table is empty after it is created.•An insert SQL statement:INSERT INTO Persons VALUES ('Hetland', 'Camilla', 'Hagabakka 24', ‘20')LastName FirstName Address AgePettersen KariStorgt Hagabakka 24 20Another tuple of dataINSERT INTO Persons VALUES (‘Kit', ‘Johnson', ‘New York city’, ‘40')LastName FirstName Address AgePettersen KariStorgt Hagabakka 24 20Kit Johnson New York city 40Inserting 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


View Full Document

Oneonta CSCI 242 - Lecture Notes

Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?