ISD LAB07-DataModeling
ISD LAB07-DataModeling
1. SUBMISSION GUIDELINE
You are required to push all your work to the valid GitHub repository complying
with the naming convention:
“<MSTeamName>-<StudentID>.<StudentName>”.
For this lab, you have to turn in your work twice before the following deadlines:
§ Right after class: Push all the work you have done during class time to
Github.
§ 10 PM the day after the class: Create a branch named “release/lab07” in
your GitHub repository and push the full submission for this lab, including
in-class tasks and homework assignments, to this branch.
2. IN-CLASS ASSIGNMENT
In this section, we will get familiar with the software detailed design process and
try ourselves with data modeling for the Case Study.
You are asked to work individually for this section, and then put all your file(s) and
directories to a directory, namely “DetailedDesign/DataModeling”. After that, push
your commit to your individual repository before the announced deadline.
You may need free tools such as MySQL Workbench, moqups with template1, and
draw.io, or paid apps like Astah Pro, Navicat, and DataGrip in this lab for the
purpose of data modeling.
1 https://moqups.com/templates/diagrams-flowcharts/erd/
HANDS-ON LAB GUIDELINES
© SOICT – HUST
ITSS SOFTWARE DEVELOPMENT – IT4945E
2
2 https://www.sqlite.org/index.html
HANDS-ON LAB GUIDELINES
© SOICT – HUST
ITSS SOFTWARE DEVELOPMENT – IT4945E
4
- CD
- Book
- DVD
- Card
- DeliveryInfo
- Order
1. X id Integer Yes ID
- OrderMedia
- Invoice
1. x id Integer Yes ID
- PaymentTransaction
1. x id Integer Yes ID
CONSTRAINT "fk_Book_Media1"
FOREIGN KEY("id")
REFERENCES "Media"("id")
);
CREATE TABLE "aims"."DeleveryInfo"(
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"name" VARCHAR(45),
"province" VARCHAR(45),
"instructions" VARCHAR(200),
"address" VARCHAR(100)
);
CREATE TABLE "aims"."Card"(
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"cardCode" VARCHAR(15) NOT NULL,
"owner" VARCHAR(45) NOT NULL,
"cvvCode" VARCHAR(3) NOT NULL,
"dateExpired" VARCHAR(4) NOT NULL
);
CREATE TABLE "aims"."DVD"(
"id" INTEGER PRIMARY KEY NOT NULL,
"discType" VARCHAR(45) NOT NULL,
"director" VARCHAR(45) NOT NULL,
"runtime" INTEGER NOT NULL,
"studio" VARCHAR(45) NOT NULL,
"subtitle" VARCHAR(45) NOT NULL,
"releasedDate" DATETIME,
CONSTRAINT "fk_DVD_Media1"
FOREIGN KEY("id")
REFERENCES "Media"("id")
);
CREATE TABLE "aims"."Order"(
HANDS-ON LAB GUIDELINES
© SOICT – HUST
ITSS SOFTWARE DEVELOPMENT – IT4945E
11
CONSTRAINT "fk_Invoice_Order1"
FOREIGN KEY("orderId")
REFERENCES "Order"("id")
);
CREATE INDEX "aims"."Invoice.fk_Invoice_Order1_idx" ON "Invoice"
("orderId");
CREATE TABLE "aims"."PaymentTransaction"(
"id" INTEGER NOT NULL,
"createAt" DATETIME NOT NULL,
"content" VARCHAR(45) NOT NULL,
"method" VARCHAR(45),
"cardId" INTEGER NOT NULL,
"invoiceId" INTEGER NOT NULL,
PRIMARY KEY("id","cardId","invoiceId"),
CONSTRAINT "fk_PaymentTransaction_Card1"
FOREIGN KEY("cardId")
REFERENCES "Card"("id"),
CONSTRAINT "fk_PaymentTransaction_Invoice1"
FOREIGN KEY("invoiceId")
REFERENCES "Invoice"("id")
);
CREATE INDEX "aims"."PaymentTransaction.fk_PaymentTransaction_Card1_idx" ON
"PaymentTransaction" ("cardId");
CREATE INDEX "aims"."PaymentTransaction.fk_PaymentTransaction_Invoice1_idx"
ON "PaymentTransaction" ("invoiceId");
COMMIT;