SQL> create table student_master(Name varchar(20),Reg_no number(5),dept varchar(20),year number(4));
Table created.
SQL>desc student_master;
Name | Null? | Type |
NAME | | varchar(20) |
REG_NO | | number(5) |
DEPT | | varchar(20) |
YEAR | | number(4) |
SQL> insert into student_master values('xxx',001,'BCA', 1991);
1 row created.
SQL> insert into student_master values('yyy',002,'BCA', 1989);
1 row created.
SQL> insert into student_master values('zzz’,003,'BBA', 1990);
1 row created.
SQL> insert into student_master values('xxx’,001,'BCA', 1991);
1 row created.
SQL> select * from student_master;
NAME | REG_NO | DEPT | YEAR |
Xxx | 1 | BCA | 1991 |
Yyy | 2 | BCA | 1989 |
Zzz | 3 | BBA | 1990 |
Xxx | 1 | BCA | 1991 |
SQL> select name from student_master;
NAME |
Xxx |
Yyy |
Zzz |
Xxx |
SQL> select * distinct from student_master;
NAME | REG_NO | DEPT | YEAR |
Xxx | 1 | BCA | 1991 |
Yyy | 2 | BCA | 1989 |
Zzz | 3 | BBA | 1990 |
SQL> select * from student_master order by reg_no desc;
NAME | REG_NO | DEPT | YEAR |
Xxx | 1 | BCA | 1991 |
Xxx | 1 | BCA | 1991 |
Yyy | 2 | BCA | 1989 |
Zzz | 3 | BBA | 1990 |
SQL> select * from student_master where dept =’BCA’;
NAME | REG_NO | DEPT | YEAR |
Xxx | 1 | BCA | 1991 |
Xxx | 1 | BCA | 1991 |
Yyy | 2 | BCA | 1989 |
No comments:
Post a Comment