0% found this document useful (0 votes)
9 views3 pages

SQL Commands Introduction

Uploaded by

mksanju04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

SQL Commands Introduction

Uploaded by

mksanju04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL> connect

Enter user-name: SYSTEM


Enter password:
Connected.
SQL> create table student
2 (rno number(3),
3 sname varchar(10),
4 course varchar(5));

Table created.

SQL> desc student


Name Null? Type
----------------------------------------- -------- ----------------------------
RNO NUMBER(3)
SNAME VARCHAR2(10)
COURSE VARCHAR2(5)

SQL> insert into student values(111,'raman','bsc');

1 row created.

SQL> insert into student values(112, 'gopi','bcom');

1 row created.

SQL> insert into student values(113, 'john','bba');

1 row created.

SQL> select rno, sname,course from student;

RNO SNAME COURS


---------- ---------- -----
111 raman bsc
112 gopi bcom
113 john bba

SQL> select * from student;

RNO SNAME COURS


---------- ---------- -----
111 raman bsc
112 gopi bcom
113 john bba

SQL> update student set course = 'bsc' where rno = 113;

1 row updated.

SQL> select * from student;


RNO SNAME COURS
---------- ---------- -----
111 raman bsc
112 gopi bcom
113 john bsc

SQL> delete from student where rno = 111;

1 row deleted.

SQL> select * from student;

RNO SNAME COURS


---------- ---------- -----
112 gopi bcom
113 john bsc

SQL> alter table student


2 add (marks number(2));

Table altered.

SQL> desc student;


Name Null? Type
----------------------------------------- -------- ----------------------------
RNO NUMBER(3)
SNAME VARCHAR2(10)
COURSE VARCHAR2(5)
MARKS NUMBER(2)

SQL> select * from student;

RNO SNAME COURS MARKS


---------- ---------- ----- ----------
112 gopi bcom
113 john bsc

SQL> update student set marks=56 where rno = 112;

1 row updated.

SQL> update student set marks = 78 where rno = 113;

1 row updated.

SQL> select * from student;

RNO SNAME COURS MARKS


---------- ---------- ----- ----------
112 gopi bcom 56
113 john bsc 78

SQL> truncate table student;

Table truncated.

SQL> select * from student;

no rows selected

SQL> dest student;


SP2-0734: unknown command beginning "dest stude..." - rest of line ignored.
SQL> desc student;
Name Null? Type
----------------------------------------- -------- ----------------------------
RNO NUMBER(3)
SNAME VARCHAR2(10)
COURSE VARCHAR2(5)
MARKS NUMBER(2)

SQL> drop table student;

Table dropped.

SQL> desc student


ERROR:
ORA-04043: object student does not exist

You might also like