SQL Tutorial : DML - INSERT
Let's learn about next topic: INSERT
INSERT:
*********
- used to insert values in the database
for eg:
- INSERT INTO DEPARTMENTS
(DEPARTMENT_ID,DEPARTMENT_NAME,MANAGER_ID,LOCATION_ID)
VALUES
(300,'HR',100,1600)
- INSERT INTO DEPARTMENTS
VALUES
(301,'PR',101,1700)
INSERTING NULL VALUES:
**************************
EXPLICIT:
- INSERT INTO DEPARTMENTS
(DEPARTMENT_ID,DEPARTMENT_NAME,MANAGER_ID,LOCATION_ID)
VALUES
(302,'TESTING',NULL,NULL)
IMPLICIT:
**********
- INSERT INTO DEPARTMENTS
(DEPARTMENT_ID,DEPARTMENT_NAME)
VALUES
(303,'PWD')
COPY VALUES FROM ONE TABLE TO ANOTHER:
**********************************************
- INSERT INTO SAMPLE (EMPLOYEE_ID,LAST_NAME,SALARY)
SELECT EMPLOYEE_ID,LAST_NAME,SALARY
FROM EMPLOYEES
WHERE DEPARTMENT_ID=30
No comments:
Post a Comment