0% found this document useful (0 votes)
8 views

Lab 3 V 2

1. The document describes creating and populating tables in a database. It instructs to create tables for faculty, programs, courses, and course enrollment data. 2. Data is inserted into the tables, including 3 faculty, 3 courses, 5 programs, and updates student records with program codes. 3. Commands are provided to view the data in each table after records are added.

Uploaded by

Shafrinaa Jeffri
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)
8 views

Lab 3 V 2

1. The document describes creating and populating tables in a database. It instructs to create tables for faculty, programs, courses, and course enrollment data. 2. Data is inserted into the tables, including 3 faculty, 3 courses, 5 programs, and updates student records with program codes. 3. Commands are provided to view the data in each table after records are added.

Uploaded by

Shafrinaa Jeffri
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/ 2

Lab3

Open your previous Database (PendaftaranKursusDB)

1.1 Create the following table : PENSYARAHKURSUS

Attribute DataType Length Remarks


NoStaf VARCHAR 10 PrimaryKey and ForeignKey from
Table PENSYARAH
KodKursus VARCHAR 10 Primary Key and ForeignKey from
Table KURSUS
IdSemester VARCHAR 10 Primary Key and ForeignKey from
Table Semester

1.2 INSERT 3 (THREE) PensyarahKursus information in the table PENSYARAHKURSUS (use INSERT
command)

1.3 DISPLAY ALL the records in table PENSYARAHKURSUS (use SELECT command)

-------------------------------------------------

2.1 Create the following table : FAKULTI (use CREATE TABLE command)

Attribute DataType Length Remarks


KodFakulti VARCHAR 10 Primary Key
NamaFakulti VARCHAR 100 NOT NULL
NoTelephone VARCHAR 14
Kampus VARCHAR 100

2.2 INSERT 3 (THREE) Fakulti in the table FAKULTI (use INSERT command), ie FIK for Fakulti
Informatik dan Komputeran

2.3 DISPLAY ALL the records in table FAKULTI (use SELECT command)

-------------------------------------------------

3.1 Create the following table : PROGRAM (use CREATE TABLE command)

Attribute DataType Length Remarks


KodProgam VARCHAR 10 Primary Key
NamaProgram VARCHAR 100 NOT NULL
KodFakulti VARCHAR 10 ForeignKey from Table
FAKLUTI

3.2 INSERT 5 (FIVE) Program in the table PROGRAM (use INSERT command), ie SMSK(PP)

3.3 DISPLAY ALL the records in table PROGRAM (use SELECT command)
-------------------------------------------------

4.1 Add a new column/attribute in table PELAJAR which is the KodProgram. Write the following code
in SQL:

ALTER TABLE PELAJAR ADD COLUMN KodProgram VARCHAR(10);

4.2 Set the KodProgram as the Foreign Key from table Program, write the following code

ALTER TABLE PELAJAR ADD FOREIGN KEY(KodProgram) REFERENCES


PROGRAM(KodProgram);

4.3 Update the value of KodProgram with SMSKPP, write the following code

UPDATE PELAJAR SET KodProgram = ‘SMSKPP’;

4.4 DISPLAY ALL the records in table PELAJAR (use SELECT command)

You might also like