0% found this document useful (0 votes)
22 views7 pages

UAS Basis Data: 1.a. CREATE TABLE Kategori (Id - Kategori Int NOT Null Primary Key, Nama - Kategori

The document describes creating tables, inserting data, and performing queries on tables in a database. It creates tables for categories, articles, professors, and majors with foreign keys. It then inserts sample data and performs select queries on the data.

Uploaded by

Fandi Andrianto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views7 pages

UAS Basis Data: 1.a. CREATE TABLE Kategori (Id - Kategori Int NOT Null Primary Key, Nama - Kategori

The document describes creating tables, inserting data, and performing queries on tables in a database. It creates tables for categories, articles, professors, and majors with foreign keys. It then inserts sample data and performs select queries on the data.

Uploaded by

Fandi Andrianto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Nama : Fandi Andrianto

NIM : 213140707111083
Kelas : TIK 1 C

UAS Basis Data


1.a. CREATE TABLE kategori (id_kategori int NOT null primary key, nama_kategori
varchar(20));

CREATE TABLE artikel (id_artikel int NOT null PRIMARY KEY, judul_artikel varchar(100),
id_kategori int, FOREIGN key (id_kategori) REFERENCES kategori (id_kategori));

b. CREATE table dosen (id_dosen int PRIMARY KEY, nama_dosen varchar(100));


CREATE TABLE jurusan (id_jurusan int PRIMARY KEY, nama_jurusan varchar(50), id_dosen
int, FOREIGN key (id_dosen) REFERENCES dosen (id_dosen));
ALTER TABLE dosen ADD (id_jurusan int)
ALTER TABLE dosen add CONSTRAINT mengepalai1 FOREIGN KEY (id_jurusan)
REFERENCES jurusan (id_jurusan)
2. INSERT INTO kategori VALUES ('11','HIJAU');
INSERT INTO kategori VALUES ('12','UNGU');
INSERT INTO kategori VALUES ('13','KUNING');

INSERT INTO artikel VALUES ('21','artikel_HIJAU','11');


INSERT INTO artikel VALUES ('22','artikel_UNGU','12');
INSERT INTO artikel VALUES ('23','artikel_KUNING','13');
3. SELECT first_name as nama_depan, last_name AS nama_belakang, hire_date as
awal_bekerja, job_title as posisi FROM employees ORDER BY first_name DESC
4. SELECT product_name, standard_cost FROM products WHERE standard_cost-10;

5. SELECT first_name, email, phone


FROM contacts INNER JOIN customers USING (customer_id);
6. SELECT employee_id, first_name FROM employees WHERE first_name LIKE 'B%' AND
last_name LIKE '%S';

7. SELECT product_name, standard_cost, list_price

FROM products
WHERE standard_cost < 100 ;
8. SELECT COUNT(location_id) FROM locations WHERE country_id = 'IN' ;

9.
10. SELECT product_name, list_price, category_id from products;

You might also like