create tables in sql

Published on November 2016 | Categories: Documents | Downloads: 44 | Comments: 0 | Views: 238
of 1
Download PDF   Embed   Report

how to create tables in sql and change various attributes and assign primary and foreign keys in the table

Comments

Content

create table suchi1
(
id number(4) constraint hr_s1_id_pk primary key,
name varchar2(20) not null,
hiredt date default '04-jan-16',
email varchar(20) constraint hr_s1_email_u unique
);
create table suchi2
(
id number(4),
salary number(6) not null,
depid number(4)
);
create table suchi3
(
ilc number(1) constraint hr_s3_ilc_c check (ilc>5 and ilc<12)
)
alter table suchi3
modify
(
ilc number(2) not null
)
alter table suchi2
add constraint test_cons foreign key(id) references suchi1(id);
desc suchi1;
desc suchi2;
desc suchi3;
select *from suchi1;
select *from suchi2;
select *from suchi3;

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close