Activity: Creating a Database and Tables in MySQL with Dummy Data

Check our module on how to install MySQL on Linux or Windows, or watch our previous online class for guidance.

In this activity, you will create a MySQL database named denormalized_db and define 5 tables (employeetbl, studenttbl, producttbl, ordertbl, and salestbl). You'll also insert the dummy data provided above into these tables using only the command line (no GUI).

1. employeeData

employeeIDemployeeNamedepartmentIDdepartmentNamemanagerIDmanagerNameprojectIDprojectNamesalaryaddresscitystatezipCodephoneemailhireDatejobTitlemanagerPhonemanagerEmailprojectDeadlineprojectStatus
101John SmithD001ITM001Lisa WhiteP001Alpha60000123 Elm StNew YorkNY10001555-12342020-01-15Developer555-34562022-12-01Active
102Jane DoeD002HRM002Bob BrownP002Beta65000456 Maple AveNew YorkNY10002555-56782019-11-05Designer555-87652023-01-15Completed
103Bob BrownD003SalesM003Emma BlueP003Gamma55000789 Oak DrNew YorkNY10003555-87652021-02-12Analyst555-90912022-11-20Active
104Lisa WhiteD001ITM001Lisa WhiteP001Alpha70000234 Pine StNew YorkNY10004555-34562018-09-08Manager555-34562022-12-01Active
105Tom GreenD002HRM002Bob BrownP002Beta50000567 Birch BlvdNew YorkNY10005555-65432017-03-25Developer555-87652023-01-15Completed
106Lucy BlackD001ITM001Lisa WhiteP004Delta62000123 Elm StNew YorkNY10001555-12992020-06-20Developer555-34562022-09-05Active
107Mike GreyD002HRM002Bob BrownP002Beta54000456 Maple AveNew YorkNY10002555-78012019-08-13Designer555-87652023-01-15Completed
108Emma BlueD003SalesM003Emma BlueP005Epsilon58000789 Oak DrNew YorkNY10003555-90912021-04-05Analyst555-90912023-05-01Active
109Liam RedD003SalesM003Emma BlueP003Gamma59000234 Pine StNew YorkNY10004555-78902018-10-02Manager555-90912022-11-20Active
110Noah YellowD001ITM001Lisa WhiteP004Delta61000567 Birch BlvdNew YorkNY10005555-67892017-07-18Developer555-34562022-09-05Active


2. studentData

studentIDstudentNameclassIDclassNameteacherIDteacherNamecourseIDcourseNamebirthDategradeaddresscitystatezipCodephoneemailenrollmentDateguardianNameguardianPhoneguardianEmailattendanceRateisGraduated
201Alice JohnsonC101Math 101T001Mr. ThompsonCO101Algebra2005-09-12A123 Cedar StNew YorkNY10001555-12002021-08-10Mary Johnson555-101095%No
202Bob WhiteC102History 202T002Mrs. GreenCO102World History2006-04-25B567 Cedar BlvdNew YorkNY10002555-67542020-09-15Paul White555-102092%No
203Charlie BrownC103Science 303T003Dr. SmithCO103Physics2005-11-07C789 Pine AveNew YorkNY10003555-98322019-07-05Susan Brown555-103089%No
204David GreenC104English 404T004Ms. JacksonCO104English Literature2007-06-03B+124 Oak DrNew YorkNY10004555-46212022-01-17Kate Green555-104094%No
205Emily GreyC105Art 505T005Mr. RobinsonCO105Painting2006-02-18A-455 Birch RdNew YorkNY10005555-98542021-03-13Henry Grey555-105097%Yes
206Fiona BlackC101Math 101T001Mr. ThompsonCO101Algebra2005-08-09B156 Oak DrNew YorkNY10006555-72342019-09-05Mary Johnson555-101090%No
207George BlueC103Science 303T003Dr. SmithCO103Physics2006-12-15B-786 Pine AveNew YorkNY10003555-12982020-04-20Susan Brown555-103088%No
208Hannah RedC102History 202T002Mrs. GreenCO102World History2005-05-25C+213 Birch BlvdNew YorkNY10004555-33222019-10-02Paul White555-102091%No
209Ian YellowC105Art 505T005Mr. RobinsonCO105Painting2007-03-12A412 Cedar StNew YorkNY10001555-78992021-05-18Henry Grey555-105099%Yes
210Jacob WhiteC104English 404T004Ms. JacksonCO104English Literature2006-11-20B126 Pine BlvdNew YorkNY10005555-98452020-12-04Kate Green555-104096%No


3. productData

productIDproductNamecategoryIDcategoryNamesupplierIDsupplierNamepricestocksupplierPhonesupplierEmailwarehouseIDwarehouseLocationreorderLevelmanufacturerIDmanufacturerNamemanufacturerPhonemanufacturerEmaildateAddedsalesAmountlastRestockedstatusSKUdescription
PR101LaptopCAT001ElectronicsSUP001TechSupply120050555-4001W001NY Warehouse10MAN001Dell555-80012022-01-01500002022-09-15In StockLAP123High-end laptop
PR102SmartphoneCAT001ElectronicsSUP002GadgetWorld800200555-4002W002LA Warehouse20MAN002Apple555-80022022-01-151600002022-10-01In StockSMRT456Latest model
PR103TabletCAT001ElectronicsSUP001TechSupply600100555-4001W003TX Warehouse15MAN001Dell555-80012022-02-10600002022-08-20In StockTBL789Lightweight tablet
PR104MonitorCAT001ElectronicsSUP003OfficeDepot25075555-4003W001NY Warehouse5MAN003Samsung555-80032022-03-05187502022-09-10In StockMON12327-inch monitor
PR105KeyboardCAT002AccessoriesSUP002GadgetWorld50150555-4002W002LA Warehouse10MAN004Logitech555-80042022-04-0175002022-08-30In StockKYBD456Mechanical keyboard
PR106MouseCAT002AccessoriesSUP003OfficeDepot25300555-4003W003TX Warehouse20MAN004Logitech555-80042022-05-1275002022-09-05In StockMSE789Wireless mouse
PR107PrinterCAT001ElectronicsSUP001TechSupply10040555-4001W001NY Warehouse5MAN003Samsung555-80032022-06-1540002022-09-20In StockPRNT123Laser printer
PR108HeadphonesCAT002AccessoriesSUP002GadgetWorld70100555-4002W002LA Warehouse15MAN004Logitech555-80042022-07-2070002022-08-25In StockHDPH456Noise-cancelling
PR109SpeakersCAT001ElectronicsSUP003OfficeDepot9060555-4003W003TX Warehouse10MAN003Samsung555-80032022-08-1054002022-09-25In StockSPKR789Bluetooth speakers
PR110Web CameraCAT001ElectronicsSUP001TechSupply4080555-4001W001NY Warehouse5MAN001Dell555-80012022-09-0132002022-09-30In StockWBCM123HD webcam


4. orderData

orderIDcustomerIDcustomerNameproductIDproductNamequantityorderDateshippingDateshippingMethodshippingAddresscitystatezipCodephoneemailtotalAmountdiscountsalesRepIDsalesRepNamesalesRepPhonesalesRepEmailpaymentMethodstatustrackingNumber
1001C001Alice BrownPR101Laptop12022-10-012022-10-05UPS123 Cedar StNew YorkNY10001555-12121200100S001John White555-6789Credit CardShippedUPS123456789
1002C002Bob GreenPR102Smartphone22022-10-022022-10-06FedEx456 Maple AveNew YorkNY10002555-23231600150S002Lisa Black555-6790PayPalShippedFEDX987654321
1003C003Charlie SmithPR103Tablet32022-10-032022-10-07DHL789 Oak DrNew YorkNY10003555-34341800200S003Michael Blue555-6791Bank TransferShippedDHL123987654
1004C004David JohnsonPR104Monitor22022-10-042022-10-08UPS234 Pine StNew YorkNY10004555-454550050S001John White555-6789Credit CardProcessingUPS876543210
1005C005Emily BrownPR105Keyboard12022-10-052022-10-09FedEx567 Birch BlvdNew YorkNY10005555-56565010S002Lisa Black555-6790PayPalShippedFEDX543216789
1006C001Alice BrownPR106Mouse12022-10-062022-10-10DHL123 Cedar StNew YorkNY10001555-1212255S001John White555-6789Credit CardDeliveredDHL789456321
1007C002Bob GreenPR107Printer12022-10-072022-10-11UPS456 Maple AveNew YorkNY10002555-232310010S002Lisa Black555-6790PayPalDeliveredUPS123654789
1008C003Charlie SmithPR108Headphones22022-10-082022-10-12FedEx789 Oak DrNew YorkNY10003555-343414020S003Michael Blue555-6791Bank TransferShippedFEDX987123654
1009C004David JohnsonPR109Speakers12022-10-092022-10-13DHL234 Pine StNew YorkNY10004555-45459015S001John White555-6789Credit CardShippedDHL321654987
1010C005Emily BrownPR110Web Camera12022-10-102022-10-14UPS567 Birch BlvdNew YorkNY10005555-5656405S002Lisa Black555-6790PayPalProcessingUPS987321456

5. salesData

salesIDproductIDproductNamecustomerIDcustomerNamesalesDateamountquantityregionIDregionNamesalesRepIDsalesRepNamecommissiontaxdiscounttotalRevenuepaymentMethodinvoiceIDinvoiceDateinvoiceAmountsalesStatusregionManagerregionPhoneregionEmail
2001PR101LaptopC001Alice Brown2022-10-0112001R001NorthS001John White100100501150Credit CardINV10012022-10-021200CompletedDavid Grey555-1212
2002PR102SmartphoneC002Bob Green2022-10-0216002R002EastS002Lisa Black1501501001550PayPalINV10022022-10-031600CompletedEmma White555-2323
2003PR103TabletC003Charlie Smith2022-10-0318003R003SouthS003Michael Blue2002001501700Bank TransferINV10032022-10-041800CompletedJohn Brown555-3434
2004PR104MonitorC004David Johnson2022-10-045002R001NorthS001John White505025475Credit CardINV10042022-10-05500In ProgressDavid Grey555-1212
2005PR105KeyboardC005Emily Brown2022-10-05501R002EastS002Lisa Black1010545PayPalINV10052022-10-0650CompletedEmma White555-2323
2006PR106MouseC001Alice Brown2022-10-06251R001NorthS001John White55223Credit CardINV10062022-10-0725CompletedDavid Grey555-1212
2007PR107PrinterC002Bob Green2022-10-071001R002EastS002Lisa Black1010595PayPalINV10072022-10-08100CompletedEmma White555-2323
2008PR108HeadphonesC003Charlie Smith2022-10-081402R003SouthS003Michael Blue202010130Bank TransferINV10082022-10-09140CompletedJohn Brown555-3434
2009PR109SpeakersC004David Johnson2022-10-09901R001NorthS001John White1510585Credit CardINV10092022-10-1090In ProgressDavid Grey555-1212
2010PR110Web CameraC005Emily Brown2022-10-10401R002EastS002Lisa Black55238PayPalINV10102022-10-1140CompletedEmma White555-2323

Step 2: Documen

Create a new blog post documenting the entire process of:

    • Logging into MySQL via the command line.

      • Creating the database denormalized_db.

      • Defining the 5 tables (employeetbl, studenttbl, producttbl, ordertbl, salestbl).

      • Inserting the dummy data into each table.

  • Provide code snippets and brief explanations for each step.

  • Share the Hashnode link on the svfc portal once published.

Goal:

By completing this activity, you will have:

  • Created a MySQL database and defined 5 tables using the command line.

  • Inserted dummy data into each table.

  • Documented the process