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

Practice 9 PDF

The document provides solutions to 5 questions about using SQL DDL statements to create and manage tables. It includes the SQL scripts needed to create DEPT and EMP tables, populate the DEPT table from another table, and create a new EMPLOYEES2 table based on selecting columns from an existing EMPLOYEES table. The final question solution drops the EMP table.

Uploaded by

user
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)
60 views3 pages

Practice 9 PDF

The document provides solutions to 5 questions about using SQL DDL statements to create and manage tables. It includes the SQL scripts needed to create DEPT and EMP tables, populate the DEPT table from another table, and create a new EMPLOYEES2 table based on selecting columns from an existing EMPLOYEES table. The final question solution drops the EMP table.

Uploaded by

user
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

2010

ORACLE Fundamental_ SQL 1‫حل أسئلة أوراكل‬

Moh&Ali
‫ إھداء إلى‬WWW.ARAB
/OUG/HARDWARE/TEAM2000
3/21/2010
LES 09 Using DDL Statements
to Create and Manage Tables
ae 

1. Ceate the DET table based on the following table instane hat. lae the syntax in a sipt alled
lab_0_01.sql, then exeute the statement in the sipt to eate the table. Confim that the table is
eated.

Column ame ID NAME


Key Type Primary key ‫ ھنا عاوز نعمل جدول مبنى على‬:١ ‫حل السؤال‬
ulls/Unique
.‫المعلومات التالية‬
FK Table
create table dept
FK Column
Data type NUMBER VARCHAR2 (id number(7) primary key,
Length 7 25
name varchar2(25));----------

desc dept;

2. opulate the DET table with data fom the DEARTMENTS table. Inlude only olumns that you need.

insert into dept (id,name)


.‫ عاوز يمال الجدول من جدول اإلدارات بالحقول المطلوبة‬:٢ ‫حل السؤال‬
select department_id,department_name

from departments;

3.Ceate the EM table based on the following table instane hat. lae the syntax in
a sipt alled lab_0_03.sql, and then exeute the statement in the sipt to eate the table. Confim
that the table is eated.

Column ame ID LAST_NAME FIRST_NAME DEPT_ID


Key Type
... ‫ عاوز جدول مبنى على اآلتي‬:٣ ‫حل السؤال‬
ulls/Unique
FK Table DEPT create table emp
FK Column ID
Data type NUMBER VARCHAR2 VARCHAR2 NUMBER (id number(7),last_name varchar2(25),first_name
Length 7 25 25 7
varchar2(25),

dept_id number(7) constraint emp_deptid_fk


references dept(id));

desc emp;
4. Ceate the EMLOYEES2 table based on the stutue of the EMLOYEES table. Inlude only the
EMLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY, and DEARTMENT_ID olumns. Name the olumns in
you new table ID, FIRST_NAME, LAST_NAME, SALARY , and DET_ID, espetively.

.‫ مبنى على بناء جدول الموظفين األساسى مع اخد الحقول على ھذا الترتيب بالتوالى‬٢ ‫ يريد عمل جدول للموظفين‬:٤ ‫حل السؤال‬

create table employees2

(id,first_name,last_name,salary,dept_id)

as ( select employee_id,first_name,last_name,salary,department_id

from employees);

5. Dop the EM table.

drop table emp; .‫ عاوز نعمل حذف للجدول بالكامل‬:٥ ‫حل السؤال‬

You might also like