SQL-Practical.doc-ANSWER KEY - ANSWER KEY Copy the SQL...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Copy the SQL statements to a text file and name it as id-name 1. Write an SQL statement that would display the employees’ names, salary, department numbers and department names from the emp and the dept tables. The employees’ names should be capitalized while the department names in lower case. Example : SMITH 800 10 sales SELECT UPPER (ename), sal, deptno, LOWER ( dname) FROM dept JOIN emp USING (deptno) 2. Write an SQL statement to update the dept table such that the location of CHICAGO is changed to “ RICHMOND”. UPDATE dept SET loc = 'RICHMOND WHERE loc = 'CHICAGO' 3. Create a table called final with the following fields: test_no as a number with 3 numbers data size, test_name as a varchar2 with 10 characters data size, test_date as date data type. Create a primary key for the table as test_no and a UNIQUE constraint on test_name column and a DEFAULT constraint on the test_date column as sysdate. Create table final (test_no number(3) PRIMARY KEY, test_name varchar2(10) UNIQUE, test_date date DEFAULT SYSDATE) 4. Insert into the final table the following values: 01 CIS215 21-Jan-10 02 CIS102 22-Jan-10 03 CIS310 5. Alter the above table to modify the test_no column size from 3 to 5. ALTER TABLE FINAL MODIFY (TEST_NO NUMBER (5)) Table altered . SQL> DESC FINAL
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/27/2011 for the course IT GEIT3341 taught by Professor Sara during the Spring '11 term at Prince Mohammad Bin Fahd University, Dhahran.

Page1 / 4

SQL-Practical.doc-ANSWER KEY - ANSWER KEY Copy the SQL...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online