You are on page 1of 5

MsStudent

Student
ID

StudentName

Address

SD001

Andy Budi Pratama

Male

SD002

Aries

SD003

Arya Nata Gani Putra

SD004

Daniel Theodorus

Market Street
A/12
Pandan Street
C/21
Golden Street
SE/7
Binus Street Z/32

SD005

Darwin Simon

Male

SD006

Diana

SD007

Empoe Tibea

Syahdan Street
ZY/3
Kijang Street
DF/14
Salam Street FF/2

MsCourse
Course
ID
CD001

CourseNa
me

Price

Science
59000
0

CD002

Gend
er

Male
Male
Male

Femal
e
Male

PhoneNum
ber
0818091123
45
0818058462
12
0815721234
22
0818054223
44
0818056753
66
0812281231
29
0818091123
45

Technology

61000
0

Mathemati
c
Sosiology

45000
0

CD003

CD004

55000
0
CD005
Geographic

51000
0

MsLecturer
Lecturer
ID

LecturerNam
e

Email

Salary

LD001
LD002

Ria Ayu
Anggraini
Sally

LD003

Samuel Edwin

LD004

Sonny Salim

LD005

Stefanie
Suanita

RA@hotmail.co
m
SY@yahoo.co
m
SE@yahoo.co.i
d
SO@yahoo.co.i
d
FN@gmail.com

1000000.
00
1000000.
00
1200000.
00
1400000.
00
1500000.
00

TrHeaderSchedule
Schedul
eID

Student
ID

Lecturer
ID

ScheduleD
ate

SC001
SC002
SC003
SC004
SC005
SC006
SC007

SD007
SD001
SD001
SD002
SD004
SD009
SD003

LD005
LD004
LD003
LD002
LD004
LD001
LD005

1/4/2010
1/5/2010
1/6/2010
1/7/2010
1/8/2010
1/9/2010
1/10/2010

TrDetailSchedule

1.

Course
ID

ScheduleI
D

SC001
SC001
SC002
SC003
SC003
SC004
SC004
SC005
SC005
SC005
SC006
SC007

CD005
CD001
CD003
CD002
CD001
CD004
CD001
CD005
CD003
CD001
CD002
CD005

Qty
3
3
3
1
2
3
1
1
3
3
3
3

Tampilkan StudentId, StudentName, dan Gender yang berasal dari table


MsStudent. (select).
Jawaban :
SELECT StudentID, StudentName, Gender FROM MsStudent
Format select atau menampilkan data :
SELECT columnName1,ColumnName2,ColumnName3,dst FROM nama_table
Syntax diatas apabila soalnya disebutkan column yang mau ditampilkan
(StudentId, StudentName, dan Gender)
Apabila tidak disebutkan dan / atau jika apabila disuruh untuk menampilkan
semua column maka dapat menggunakan sintaks dibawah ini
SELECT * FROM nama_table
Tanda bintang (*) diasumsikan semua nya.

2.

Ubah price pada table MsCourse menjadi 600000 dimana CourseIDnya


CD001 atau courseName-nya Mathematic. (update).
Jawaban :
UPDATE MsCourse SET Price 600000 WHERE CourseID LIKE CD001 OR
CourseName LIKE Mathematic

Format
UPDATE
nama_table
columnName2=setToWhat,
columnName LIKE something

SET
columnName1=setToWhat,
columnName3=setToWhat,
dst
WHERE

3. Hapus MsCourse dimana Price kurang dari 50.000. (delete).


Jawaban :
DELETE FROM MsCourse WHERE PRICE < 50000
Kalian bisa menggunakan syntax seperti > (lebihbesar dari) >= (lebihbesar dan
samadengan) dan syntax serupa lainnya

4. Tambah data student (table MsStudent) dengan detail Student sebagai berikut
ID
= SD001
Nama
= Andi Muqsith Ashari
Address
= Jakarta
Gender
= Male
PhoneNumber = 087777777777
Jawaban :
INSERT INTO MsStudent (StudentID,StudentName,Addres,Gender,PhoneNumber)
VALUES (SD001,Andi Muqsith Ashari,Jakarta,Male,, 087777777777)
5. Tampilkan jadwal teacher dengan tampilan yang diinginkan adalah
- IDSchedule
- Nama Student
- Nama Lecturer
- Schedule Date
Jawaban :
SELECT MsLecturer.LecturerName, MsStudent.StudentName,
TrHeaderSchedule.IDSchedule, TrHeaderSchedule.ScheduleDate FROM
TrHeaderSchedule INNER JOIN MsLecturer ON MsLecturer.LecturerID=
TrHeaderSchedule.LecturerID INNER JOIN MsStudent ON MsStudent.StudentID=
TrHeaderSchedule.StudentID

You might also like