Database SQL / Scripts for '#Not in' - 3 Query/Script(s) found |
|
Sample 1. Cursor to get Ids from one table and then insert records into another ( Get Employee Ids from EMPLOYEE Table and insert records within EMPLOYEE_SALARY with default salary of 1000 ) | |
|
DECLARE
cursor employeeIds IS
select * from EMPLOYEE;
BEGIN
FOR rec IN employeeIds LOOP
INSERT INTO EMPLOYEE_SALARY(ID, SALARY) VALUES(rec.ID, 1000);
END LOOP;
END;
|
|
Like Feedback cursor |
|
|
Sample 2. Oracle - Create Table with Primary Key, Not Null and Foreign Key Constraints | |
|
CREATE TABLE TABLE_NAME (
ID NUMBER CONSTRAINT ID_KEY PRIMARY KEY,
NAME VARCHAR(50) CONSTRAINT NAME_NOT_NULL NOT NULL,
CONSTRAINT NAME_FK FOREIGN KEY (NAME) REFERENCES OTHER_TABLE_NAME (NAME)
);
|
|
Like Feedback create table create table with foreign key |
|
|
Sample 3. Get all Departments having no employees, Usage of not in | |
|
Select DEPT_NAME from DEPT where DEPT_ID not in ( Select distinct DEPT_ID from EMPLOYEE )
|
|
Like Feedback Not in Select |
|
|