Oracle – Create Table by Select Statement
–WITH data –without data — For example, create a table named EMPLOYEE3 that includes all — of the column definitions from EMPLOYEE where the DEPTNO = D11.
–WITH data –without data — For example, create a table named EMPLOYEE3 that includes all — of the column definitions from EMPLOYEE where the DEPTNO = D11.
Sample: Results: OR
This article shows about how to configure the environment variable when SqlPlus – SqlPlus Command start up in order to have always a good behavior in the formatting of the result. You have to setup the Windows – Environment Variable (SQL Plus|SQL Developer)- SQLPATH with a directory. Copy then the file login.sql described below in it. This file is execute each time that you connect to a database with SQLPlus. SQLPATH in Windows environment (Windows Oracle server): HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0\ SQLPATH in…
Here is a sample script: WITH data CREATE TABLE test3 AS SELECT table_name, tablespace_name FROM all_tables; ——————————— Without data CREATE TABLE ctas AS SELECT table_name, tablespace_name FROM all_tables WHERE 1=2; — For example, create a table named EMPLOYEE3 that includes all — of the column definitions from EMPLOYEE where the DEPTNO = D11. CREATE TABLE EMPLOYEE3 AS (SELECT PROJNO, PROJNAME, DEPTNO FROM EMPLOYEE WHERE DEPTNO = ‘D11’) WITH NO DATA —
SQL CHECK Constraint The CHECK constraint is used to limit the value range that can be placed in a column. If you define a CHECK constraint on a single column it allows only certain values for this column. If you define a CHECK constraint on a table it can limit the values in certain columns based on values in other columns in the row. SQL CHECK Constraint on CREATE TABLE The following SQL creates a CHECK constraint on the…
Restoring a SQL Database Backup Using SQL Server Management Studio
How to Replace Default Date Value if Date Field is NULL with PL/SQL