Wednesday 24 February 2016

CERTAIN QUERIES TO DESCRIBE,ALTER,DISTINCT A TABLE AND INSERT VALUES,DISAPLY A PARTICULAR COLOUMN IN A TABLE ?

TO DESCRIBE

describe table name;

TO INSERT VALUES

to insert values in table employee

create table employee_732
(
e_name char(10),
e_id varchar(5),
e_salary number(6),
e_commission varchar(5)
);
describe employee_732;

to insert values in a table INSERT command is used.for example to insert values in above table


INSERT INTO EMPLOYEE_732 VALUES('ram','a101',15000,'45per');

if we want to insert values in some particular attributes of table employee_668  then

INSERT INTO EMPLOYEE_732(e_name) VALUES('ram');

TO DISPLAY A PARTICULAR COLOUMN

to display a table we use

SELECT*FROM TABLENAME;

to display a particular coloumn we use

SELECT COLOUMN NAME FROM TABLE NAME;


TO ALTER A PARTICULAR TABLE

ALTER TABLE TABLE NAME ADD COLOUMN NAME DATA TYPE(SIZE);

for example to add coloumn e_phnno in above created table 
ALTER TABLE EMPLOYEE_668 ADD E_PHNNO NUMBER(10);


TO GET DISTINCT VALUES

to get distinct values from a table
SELECT DISTINCT*TABLE NAME;

to get distinct values from a particular coloumn
SELECT DISTINCT COLOUMN NAME FROM TABLE NAME;

No comments:

Post a Comment