8. OpenSQL Statements : CREATE TABLE : Examples: Create Table
 
Share this page                  
Examples: Create Table
1. Create the employee table with columns eno, ename, age, job, salary, and dept.
create table employee
  (eno     smallint,
   ename   varchar(20) not null,
   age     integer,
   job     smallint,
   salary  float,
   dept    smallint
   started date);
2. Create a table listing employee numbers for employees who make more than the average salary.
create table highincome as
  select eno
  from employee
  where salary 
   (select avg (salary)
    from employee);