You are on page 1of 34

FACULTY OF ENGINEERING

SCHOOL OF COMPUTING

SESSION 2022/2023

SEMESTER 2

SECD2523 DATABASE

DOCUMENT ISO SYSTEM MANAGEMENT – SQL STATEMENT

BY:

AISYAH UMAIRAH BINTI AZMIR (SX222133ECJHF03)

LECTURER: ASSOC. PROF. DR. HAZA NUZLY BIN ABDULL HAMED

1
Table of Contents

Data Definition Language (DDL) ........................................................................................... 3


Create Database ............................................................................................................... 3
Drop Database .................................................................................................................. 4
Backup Database .............................................................................................................. 5
Create Table...................................................................................................................... 6
Drop Table ...................................................................................................................... 11
Alter Table ....................................................................................................................... 12
SQL Constraints .............................................................................................................. 15
Check .............................................................................................................................. 16
Index ............................................................................................................................... 17
SQL Injection ................................................................................................................... 18
Data Manipulation Language (DML).................................................................................... 19
Retrieve Data .................................................................................................................. 19
Insert Data....................................................................................................................... 22
Update data..................................................................................................................... 32
Delete Data ..................................................................................................................... 33
ERD .................................................................................................................................... 34

2
Data Definition Language (DDL)

Create Database

SQL Server Management Studio

MySQL

3
Drop Database

SQL Server Management Studio

MySQL

4
Backup Database

SQL Server Management Studio

5
Create Table

SQL Server Management Studio

a) Table department:

b) Table Jawatan:

6
c) Table Staff:

d) Table Perkhidmatan:

e) Table Kategori:

f) Table Pecahan:

7
g) Table Document

8
MySQL

a) Table department

b) Table jawatan

c) Table staff

9
d) Table Perkhidmatan

e) Table Kategori

f) Table Pecahan

g) Table Document

10
Drop Table

SQL Server Management Studio

MySQL

11
Alter Table

a) Add column named as ‘s_dept’ on tb_staff

SQL Server

MySQL
- Add constraints foreign key on column ‘s_dept’

12
b) Change data type “pecahan_code” on tb_pecahan from varchar into char

SQL Server

MySQL
- Change data type “pecahan_code” on tb_pecahan from varchar into char

13
c) Drop column pecahan_code on tb_pecahan

SQL Server

MySQL
- Drop column pecahan_code on tb_pecahan

14
SQL Constraints

1. NOT NULL, PRIMARY KEY, FOREIGN KEY

2. UNIQUE

3. AUTO INCREMENT

15
Check

16
Index

Create Index

Drop Index

17
SQL Injection

18
Data Manipulation Language (DML)

Retrieve Data

Select Distinct

Where clause

SQL AND

19
SQL OR

SQL NOT

SQL ORDER BY

SQL Null Values

20
SQL Not Null

21
Insert Data

a) Table Staff:

22
b) Table jawatan:

SQL Server

23
24
MySQL

25
c) Table department:

26
d) Table Kategori:

27
e) Table Perkhidmatan:

28
f) Table Pecahan Perkhidmatan:

29
30
g) Table Document:

31
Update data

32
Delete Data

33
ERD

MySQL

SQL Server

34

You might also like