Database UAS
Database UAS
Database UAS
Class: LH01
NIM: 2440075933
1.
SELECT *
FROM Participant PR
JOIN OnGoingCourse OGC
ON PR.Participant_id = OGC.Participant_id
JOIN Course CR
ON OGC.Course_ID = CR.Course_ID
WHERE Course_Name = 'SQL Server' AND [Level] = 'Advanced';
2.
SELECT *
FROM
Teacher TR
WHERE
Teacher_ID IN(
SELECT TR.Teacher_ID
FROM Teacher
JOIN Course CR
ON TR.Teacher_ID = CR.Teacher_ID
WHERE
Course_Name = 'Project Management dan Leadership'
)
3.
GO
CREATE VIEW Active_Participants_and_Courses_during_January_2022
AS
SELECT
*
FROM Participant PR
JOIN OnGoingCourse OGC
ON PR.Participant_ID = OGC.Participant_ID
JOIN Course CR
ON OGC.Course_ID = CR.Course_ID
WHERE [Status] = 'Active' AND MONTH([Start_Date]) = '1' AND MONTH(End_Date) = '1' AND
YEAR([Start_Date]) = '2022' AND YEAR(End_Date) = '2022'
4.
CREATE TRIGGER trigger_participant on Participant FOR UPDATE
as Declare @oldvalue varchar(50)
Declare @newvalue varchar(50)
2PL is a transaction follows the two-phase locking protocol if all locking operations precede the first
unlock operation in the transaction.
According to the rules of this protocol, every transaction can be divided into two phases: first a growing
phase, in which it acquires all the locks needed but cannot release any locks, and then a shrinking phase,
in which it releases its locks but cannot acquire any new locks. There is no requirement that all locks be
obtained simultaneously. Normally, the transaction acquires some locks, does some processing, and
goes on to acquire additional locks as needed. However, it never releases any lock until it has reached a
stage where no new locks are needed. The rules are:
• A transaction must acquire a lock on an item before operating on the item. The lock may be read or
write, depending on the type of access needed.
• Once the transaction releases a lock, it can never acquire any new locks. If upgrading of locks is
allowed, upgrading can take place only during the growing phase and may require that the transaction
wait until another transaction releases a shared lock on the item. Downgrading can take place only
during the shrinking phase
Source: https://storagetutorials.com/storage/2013/03/RAID-Striping.png
There is no redundancy or fault tolerance for disk striping without parity data. That is, if a drive fails, all
data on that drive will be lost. Disk stripping also known as RAID 0 is best used for storage that is
noncritical but requires fast reads and writes. Livestreaming video caching and video editing are
common uses for disk stripping. Non-redundant disk striping can be used in situations where temporary
data, memory, or a master copy of data can be easily recovered from another storage device. The main
advantage of RAID 0 and disk striping is improved performance. For instance, striping data to three hard
drives provides three times the bandwidth of one drive. If each drive is running at 200 I / O operations
per second, disk striping provides up to 600 IOPS for reading and writing data. However, low resiliency is
the disadvantage of disk striping. Disk striping. does not use data redundancy, so the failure of any
physical drive in the striped disk set results in the loss of the data on the striped unit and, consequently,
the loss of the entire data set stored across the set of striped hard disks. It should not be used for
mission-critical storage.
Disk mirroring is the replication of data to two or more disks. As the name implies, which means 'to
reflect', the principle of mirroring will copy data on another hard disk with the exact same contents in
real time.
Source: https://www.prepressure.com/images/raid-level-1-mirroring.svg
Because both drives are operational, data can be read from them simultaneously, which makes read
operations quite fast. The RAID array will operate if one drive is operational. Write operations, however,
are slower because every write operation is done twice. Disk (drive) mirroring is particularly
advantageous for disaster recovery scenarios as it provides instantaneous failover for data required by
mission-critical applications. If primary drives in the array are damaged or unable to operate, traffic is
switched to secondary or mirrored backup drives. The mirror copy is able to become operational on
failover because the operating system and application software are replicated to the mirror along with
the data used by the applications.
We can choose RAID 10 (or RAID 0 + 1) as the most suitable RAID type GoTraining database because it
combines the advantages of RAID 0 and RAID 1 in one single system. This is a nested or hybrid RAID
configuration. It provides security by mirroring all data on secondary drives while using striping across
each set of drives to speed up data transfers. In GoTraining database, it is a centralized database that is
physically located in Jakarta and can be accessed by its branches in Bandung and Surabaya. Therefore,
we need a RAID that can be read and write fast simultaneously because GoTraining branches have to
access the database that centralized physically in Jakarta. Not only that, GoTraining also need RAID that
can duplicate the database if something terrible happen. If primary drives in the array are damaged or
unable to operate, traffic is switched to secondary or mirrored backup drives. The mirror copy is able to
become operational on failover because the operating system and application software are replicated to
the mirror along with the data used by the applications.
S1: Π Participant id
, Pfirst Name , Plast Name , Phone Number , Participant email (Participant )
S2: Π Participant id
,Client id (Participant)
I choose this fragmentation because the database would be resided in several branches. I also choose
this fragmentation because it makes it easier to categorize client_Id according to the branch
Fragment S1
Participant_Id Client_Id
PP651 C10
Fragment S22
Participant_Id Client_Id
PP432 C11
Fragment S23
Participant_Id Client_Id
PP152 C12
PP514 C12
https://www.loom.com/share/768d75eb421a4c7aaa7994c988630cda