Documents

advanced study

Description
Description:
Categories
Published
of 9
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Share
Transcript
  Insert Command Insert command is part of DML  (Data Manipulation Language). Insert Statement is used to add new rows of data to an existing database table. +  To insert data, table should be first available in the database and below are the ways to insert data into a table: VALUE METHOD Note : For better demonstration let’s assume EMP table is empty.   Example : +   [sql]INSERT INTO EMP VALUES (7369,’SMITH’,’CLERK’,7902,’10 -JUN- 1980′,800,NULL,20);[/sql] +   After successfully executing the above statements then we will receive a message saying +   ‘1 row inserted’ +  Now lets check the EMP table +  [sql]Select * from emp;[/sql] To insert another record we have to type the entire insert statement, if there are lot of records to be inserted then it will become difficult. To avoid this we can use address method. +     ADDRESS METHOD Example: +  [sql]INSERT INTO EMP VALUES (&empno,’&ename’,’&job’,&mgr_id,’&hire_date’,&sal,&comm,&deptno);[/sql] +   —  After successfully executing the above statement we will see a message saying System will prompt us to enter data for these variables +   (&empno,’&ename’,’&job’,&mgr_id,’&hire_date’,&sal,&comm,&deptno). +   After entering all the values, system will insert records into table    INSERTING DATA INTO SPECIFIED COLUMNS USING VALUE METHOD Using this process we can insert the data into the table for specific columns. Example:- +   [sql]INSERT INTO emp (empno, ename, job ) VALUES (1024, ‘SCOTT’, ‘Manager’);[/sql] +   —  After entering the values. lets checkout the emp table +  [sql]SELECT * FROM emp;[/sql]    INSERT USING SELECT STATEMENT Using this process we can insert existing table data to another table in a single statement. But the table structure should be same. Example:- +   —   Let’s assume there is a empty table named ‘emp1’ is available in  database. +  [sql] SQL> INSERT INTO emp1 SELECT * FROM emp;[/sql] +   —  Now check emp1 table data +  [sql]SQL> SELECT * FROM emp1;[/sql]
Search
Similar documents
View more...
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x