Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

SQL Create Modify

query

Uploaded by

unknown legend
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

SQL Create Modify

query

Uploaded by

unknown legend
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

SQL> Create table student


(c_no varchar2(5) check(c_no in(‘c01’,’c02’,‘c03’,’c04’,’c05’)),
r_no number(4),
name varchar2(50),
score number(5) check(score>40 AND score<100),
gender varchar(2) check(gender in(‘M’, ‘F’)),
category varchar2(10),
class char(5) check(class in(‘FE’,’SE’,’TE’,’BE’)),
Address varchar2(15)
);

2. SQL> Create table course


(c_no varchar(5),
C_name varchar2(16)
Estdate-date,
Intake number(3),
Currentadd number(3),
HOD varchar2(10)
);

3. SQL> create staff table


( s_no varchar2(10) check in (‘T’ or ‘N’),
s_name varchar2(5),
joindate date,
salary number(5),
post vachar2(10)
);

4. SQL> Create table laboratory


(
lab_no number check (lab_no<20)’
c_no varchar2(5),
lab_name varchar (15),
Nontech incharge varchar(5) check(Nontech incharge in(‘N’)),
cost number
);

5. SQL> create table subject


(
c_no varchar2(5),
sub_no number(2) check(sub_no<6000),
title varchar(5),
sem_no number check(sem_no<9),
termwork integer(3),
total marks number(3),
theory marks number(3),
staffincharge varchar2(5) check(staff incharge in(‘T’))
);

6. SQL>create table library

(c_no varchar2(5),
book_no number(2),
title varchar2(25),
author varchar2(20),
price number(3),
publication varchar2(10),
sub_no number(8)
);

***Modifying table structure***

1. adding new columns:


SQL> Alter table student
Add(staff varchar(10), sem_no number(5));

2. modifying colm:
SQL> Alter table student
modify(r_no integer(5));

3. remove/del/drop table:
SQL>drop table student

You might also like