FOR FREE YEAR SOLVED

SQL ASSINGMENT 10 WITH SOLUTION

Back to Programming

Description

Create the following table dept.


a)     List the department numbers and dname from dept table.

b)     Change Dname attribute to Dept_name.

c)     Display the department name located in Boston and Chicago.

d)     Count total number of departments located at New York.

e)     Change location of sales branch to New Jersey.


CREATE TABLE DEPT:

Create table DEPT (

Deptno varchar2(7) Primary key CHECK (Deptno IN(‘D’)),

Dname VARCHAR2(25) NOT NULL,Loc VARCHAR2(20) NOT NULL);



Table DEPT is created.



Insert the values in the table "DEPT":

INSERT INTO DEPT VALUES(‘D101’, 'OPERATION', ‘BOSTON’)

INSERT INTO DEPT VALUES(‘D104’, 'SALES', ‘CHICAGO’)

INSERT INTO DEPT VALUES(‘D102’, 'OPERATION', ‘LONDON’)

INSERT INTO DEPT VALUES(‘D103’, 'SALES', NEWYORK’);


Output:

4 rows created


Code