Alvaro
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # **BASDAT A3** ```sql CREATE SCHEMA SIREST; SET search_path to SIREST; CREATE TABLE USER_ACC( Email VARCHAR(50) PRIMARY KEY, Password VARCHAR(50) NOT NULL, PhoneNum VARCHAR(20) NOT NULL, FName VARCHAR(15) NOT NULL, LName VARCHAR(15) NOT NULL ); CREATE TABLE ADMIN( Email VARCHAR(50) REFERENCES USER_ACC(Email), PRIMARY KEY (Email) ); CREATE TABLE TRANSACTION_ACTOR( Email VARCHAR(50) REFERENCES USER_ACC(Email), NIK VARCHAR(20) NOT NULL, BankName VARCHAR(20) NOT NULL, AccountNo VARCHAR(20) NOT NULL, RestoPay BIGINT DEFAULT 0 NOT NULL, AdminId VARCHAR(50) REFERENCES ADMIN(Email), PRIMARY KEY (Email) ); CREATE TABLE COURIER( Email VARCHAR(50) REFERENCES TRANSACTION_ACTOR(Email), PlateNum VARCHAR(10) NOT NULL, DrivingLicenseNum VARCHAR(20) NOT NULL, VehicleType VARCHAR(15) NOT NULL, VehicleBrand VARCHAR(15) NOT NULL, PRIMARY KEY (Email) ); CREATE TABLE CUSTOMER( Email VARCHAR(50) REFERENCES TRANSACTION_ACTOR(Email), Birthdate DATE NOT NULL, Sex CHAR(1) NOT NULL, PRIMARY KEY (Email) ); INSERT INTO USER_ACC VALUES ('ccommin0@dailymotion.com','PnIjGr2',7252373517,'Carolan','Commin'), ('vkillingworth1@spotify.com','YNvwyC4',2822956382,'Vally','Killingworth'), ('ddowyer2@epa.gov','6LwV4A7F',5848179795,'Drucy','Dowyer'), ('aalderman3@xrea.com','tJoESlG',5899131370,'Arlen','Alderman'), ('ifarish4@chronoengine.com','OjvA3EJ',6253423791,'Iggy','Farish'), ('sboise5@woothemes.com','GdsNxPD6Ye',6643880722,'Sampson','Boise'), ('ahillock6@taobao.com','bknGQgc0',4091099556,'Antonie','Hillock'), ('gserrell7@weather.com','HIgMT7e',8622326389,'Gusty','Serrell'), ('twimms8@studiopress.com','K91RaM',9993625926,'Tawsha','Wimms'), ('nsugden9@mlb.com','zPEU3v',4514163666,'Nestor','Sugden'), ('hcancotta@github.com','vgz1WY5ZQa',1382294583,'Harley','Cancott'), ('bsoaresb@lulu.com','sTo5GNbYDQTH',9353070170,'Bev','Soares'), ('msmalcombec@pcworld.com','NIg9u0v',7845663986,'Munroe','Smalcombe'), ('mworttd@reuters.com','x9C3e2SP5h',6774713862,'Malia','Wortt'), ('awelsbye@hud.gov','QTaDI2Cq2wn6',8334672330,'Alma','Welsby'), ('jlawlancef@dot.gov','1NJqpAEEVai',8313033693,'Jobey','Lawlance'), ('tbosmag@dailymotion.com','exJkXgqYN0N8',9642732614,'Thea','Bosma'), ('ijojich@seattletimes.com','1deEYJp8JE3',9121420420,'Ingaberg','Jojic'), ('csinesi@seattletimes.com','w05BNZR0F92',1077801203,'Codi','Sines'), ('agawkrogej@cargocollective.com','velXQxJZ7FsV',5773347994,'Alikee','Gawkroge'), ('idanzigk@chicagotribune.com','0gWR89TEvWe8',4611049321,'Ilise','Danzig'), ('apettisl@de.vu','4hGlPUzBe',2592436430,'Ashli','Pettis'), ('jpennim@un.org','wZalJtZ',7354207971,'Joannes','Penni'), ('bsimoncellon@a8.net','TOBOHo',8266957027,'Britt','Simoncello'), ('ipayno@squarespace.com','qAR2qw',7006241626,'Ilse','Payn'), ('anewberryp@feedburner.com','uJTatRP',9824375659,'Athene','Newberry'), ('szorzinq@ucla.edu','HYGjnh',2797801488,'Sigmund','Zorzin'), ('rgerlerr@amazon.co.jp','GQHSp2c9Zeh',5246029290,'Ruddie','Gerler'), ('emckelveys@statcounter.com','tRBAA791M92b',3671650070,'Elladine','McKelvey'), ('ocorbiet@senate.gov','oR36hM',1147978459,'Omar','Corbie'), ('xkettonu@joomla.org','iwSwXaEw',4904591607,'Ximenes','Ketton'), ('ddelvesv@bigcartel.com','sPpkWMe',2885370832,'Dexter','Delves'), ('nshaylorw@deviantart.com','u9PRtQ7a',5937632318,'Noelle','Shaylor'), ('ebarnewallx@alexa.com','M3hKQuhvyoh',7823603516,'Enrika','Barnewall'), ('tcamilleriy@tripadvisor.com','8NfSqvv6',5489790115,'Tallie','Camilleri'), ('ashadwickz@tmall.com','Mc9kBNkZ4fG',6145321730,'Alla','Shadwick'), ('ecolyer10@smugmug.com','RFOwIFH1',7266768175,'Elie','Colyer'), ('ggilliland11@jugem.jp','Ay32GEQY8FoK',5623323023,'Gram','Gilliland'), ('bmasurel12@apple.com','bicVN3',3963724428,'Briana','Masurel'), ('nedgeon13@reuters.com','2XOfP4tBl',2863276129,'Nicolais','Edgeon'), ('rbroggetti14@ed.gov','Y64dsR',4229509317,'Rosanna','Broggetti'), ('dmallia15@disqus.com','GAukg566',8784904082,'Darlleen','Mallia'), ('nbradbury16@desdev.cn','H7KjNMiAxIA0',8171742961,'Nada','Bradbury'), ('hearl17@google.ca','TkqEnE',4943551253,'Hillery','Earl'), ('apilkinton18@symantec.com','X4KmIDu55qhp',4603113055,'Anita','Pilkinton'), ('cdrees19@discovery.com','VJpTk5URo',5363850232,'Caryn','Drees'), ('lbott1a@rakuten.co.jp','e9HrSzmlh1Tc',1398250323,'Layla','Bott'), ('etupman1b@tmall.com','rPcCMBaFEB',6262486794,'Ethelred','Tupman'), ('dgrassick1c@ucoz.com','XPQlRz',8091105224,'Dionne','Grassick'), ('ntuminini1d@tinyurl.com','OHMVctO',4258065728,'Natassia','Tuminini'), ('tbass1e@ed.gov','JBk2owk',6045214667,'Tiff','Bass'), ('eambroisin1f@nationalgeographic.com','i57XtyvsISL',3961787896,'Eyde','Ambroisin'), ('krhead1g@e-recht24.de','SaAwxMJ2u5',5265915412,'Keslie','Rhead'), ('dgiametti1h@freewebs.com','CXIRwEDvO2f',3713109898,'Davita','Giametti'), ('ogarroway1i@usgs.gov','iYoCJYy',2508919303,'Ollie','Garroway'), ('jcoventry1j@ft.com','fZvK5cVb',4369440579,'Jada','Coventry'), ('srisely1k@furl.net','Mc4bolBbZHWs',3032087062,'Sarge','Risely'), ('mdearness1l@wisc.edu','IPjg6N',5902563456,'Melanie','Dearness'), ('mdumsday1m@unicef.org','TTS9scFHx8kP',4165157024,'Matthus','Dumsday'), ('cfishe1n@ibm.com','oV2WOu2o',1237592323,'Caresse','Fishe'), ('mandrichuk1o@weibo.com','J1wIFWME',2956238099,'Marybeth','Andrichuk'), ('jspurett1p@merriam-webster.com','5CsLayayg',9405668933,'Jeno','Spurett'), ('cmcshane1q@naver.com','RrSTv4oujED',3898825383,'Cortney','McShane'), ('kelson1r@dmoz.org','fLLrFJtr',6898233040,'Kaspar','Elson'), ('pebbers1s@etsy.com','EjJHRB',4456749301,'Pinchas','Ebbers'), ('hdurgan1t@de.vu','xkkln9e',6111523440,'Hort','Durgan'), ('bgooding1u@ow.ly','TEu4tViLqJ',2353706254,'Barbey','Gooding'), ('jleitche1v@thetimes.co.uk','vt7AeGWijPn',6143131659,'Julissa','Leitche'), ('smechell1w@hatena.ne.jp','tNPrdzeD',5071230419,'Stevana','Mechell'), ('ewoodburn1x@godaddy.com','wf39mC',9355158460,'Ephrem','Woodburn'); INSERT INTO ADMIN VALUES ('ccommin0@dailymotion.com'), ('vkillingworth1@spotify.com'), ('ddowyer2@epa.gov'), ('aalderman3@xrea.com'), ('ifarish4@chronoengine.com'); INSERT INTO TRANSACTION_ACTOR VALUES ('sboise5@woothemes.com',9164413697322620,'Bank Permata',6389806046,2469981.0,'ddowyer2@epa.gov'), ('ahillock6@taobao.com',2815931594803700,'Bank Danamon',5537079862,7254826.0,'ccommin0@dailymotion.com'), ('gserrell7@weather.com',8576697993385840,'Bank HSBC',1696727639,7440056.0,'vkillingworth1@spotify.com'), ('twimms8@studiopress.com',7879106088892740,'Bank HSBC',2957277642,3672239.0,'aalderman3@xrea.com'), ('nsugden9@mlb.com',4253525301610550,'Bank Mayapada',9556639450,1944784.0,'ddowyer2@epa.gov'), ('hcancotta@github.com',6901577164116390,'Bank Permata',7106444186,8044634.0,'aalderman3@xrea.com'), ('bsoaresb@lulu.com',5105615315890840,'BRI',5285516429,4533710.0,'ccommin0@dailymotion.com'), ('msmalcombec@pcworld.com',9805812992311830,'Bank CIMB Niaga',2745914179,8279734.0,'ddowyer2@epa.gov'), ('mworttd@reuters.com',8986185613849270,'BTN',8163128366,4806121.0,'ifarish4@chronoengine.com'), ('awelsbye@hud.gov',9899726032561300,'Bank Danamon',7978331961,3037870.0,'vkillingworth1@spotify.com'), ('jlawlancef@dot.gov',4085457756024570,'Bank Danamon',3827329002,2138990.0,'ddowyer2@epa.gov'), ('tbosmag@dailymotion.com',1912628909027530,'Bank HSBC',8839477156,3510844.0,'ccommin0@dailymotion.com'), ('ijojich@seattletimes.com',1060429331786960,'Bank Mayapada',3912043331,2322529.0,'ccommin0@dailymotion.com'), ('csinesi@seattletimes.com',5046410528448830,'Bank HSBC',2515950647,4596719.0,'ddowyer2@epa.gov'), ('agawkrogej@cargocollective.com',4420707930028000,'Bank Mega',2225256434,7900775.0,'vkillingworth1@spotify.com'), ('idanzigk@chicagotribune.com',8109165274708910,'Bank ICBC',4863751076,7936445.0,'ddowyer2@epa.gov'), ('apettisl@de.vu',2061001005793620,'Bank Danamon',2706157368,8863380.0,'ddowyer2@epa.gov'), ('jpennim@un.org',3256918816067330,'Bank Panin',9137650176,371900.0,'ddowyer2@epa.gov'), ('bsimoncellon@a8.net',7960667016406940,'Bank Mayapada',4898334455,8788138.0,'ifarish4@chronoengine.com'), ('ipayno@squarespace.com',2573667293365300,'BNI',4184118775,5909168.0,'ccommin0@dailymotion.com'), ('anewberryp@feedburner.com',1381119820929720,'Bank Panin',9287449282,3771021.0,'ccommin0@dailymotion.com'), ('szorzinq@ucla.edu',7923550906871520,'Bank CIMB Niaga',1628842755,2323708.0,'vkillingworth1@spotify.com'), ('rgerlerr@amazon.co.jp',5550439324774520,'Bank HSBC',6763635430,9067109.0,'ccommin0@dailymotion.com'), ('emckelveys@statcounter.com',3774332612731990,'Bank CIMB Niaga',3238976197,2042999.0,'ifarish4@chronoengine.com'), ('ocorbiet@senate.gov',7825461922140500,'BNI',9992482545,6481520.0,'ifarish4@chronoengine.com'), ('xkettonu@joomla.org',4629079055677010,'BRI',2917109006,2308583.0,'ifarish4@chronoengine.com'), ('ddelvesv@bigcartel.com',5767114211230760,'Bank Danamon',5649020053,6582831.0,'vkillingworth1@spotify.com'), ('nshaylorw@deviantart.com',5660111538717330,'Bank Mega',9988797760,164561.0,'ddowyer2@epa.gov'), ('ebarnewallx@alexa.com',5095549621537190,'Bank ICBC',8579677388,6631715.0,'ddowyer2@epa.gov'), ('tcamilleriy@tripadvisor.com',7440258860830600,'BRI',1414065837,8427707.0,'vkillingworth1@spotify.com'), ('ashadwickz@tmall.com',2209214634143880,'Bank Mega',3124083226,7031078.0,'aalderman3@xrea.com'), ('ecolyer10@smugmug.com',3652694553545660,'BNI',3483041494,7732001.0,'vkillingworth1@spotify.com'), ('ggilliland11@jugem.jp',5520692787950610,'Bank Mayapada',2353762807,9384573.0,'ddowyer2@epa.gov'), ('bmasurel12@apple.com',1326154094167820,'Bank Panin',8702358876,418101.0,'vkillingworth1@spotify.com'), ('nedgeon13@reuters.com',1833491965457300,'BTN',3397735725,7350000.0,'ddowyer2@epa.gov'), ('rbroggetti14@ed.gov',2499513119712590,'Bank Permata',2761021229,1435921.0,'ccommin0@dailymotion.com'), ('dmallia15@disqus.com',4830603086928050,'BTN',2554997370,5754435.0,'ddowyer2@epa.gov'), ('nbradbury16@desdev.cn',5535046005647860,'BCA',6069200237,2885377.0,'vkillingworth1@spotify.com'), ('hearl17@google.ca',3734852434827080,'Bank HSBC',8976384634,9329402.0,'ddowyer2@epa.gov'), ('apilkinton18@symantec.com',5973637071016740,'Bank Danamon',7257698257,5225235.0,'aalderman3@xrea.com'), ('cdrees19@discovery.com',6110895428110420,'Bank Danamon',3523042809,1849776.0,'ccommin0@dailymotion.com'), ('lbott1a@rakuten.co.jp',8565777321600340,'BRI',4933925843,4926192.0,'ccommin0@dailymotion.com'), ('etupman1b@tmall.com',6257532339947830,'BCA',8259936839,3791067.0,'vkillingworth1@spotify.com'), ('dgrassick1c@ucoz.com',2465323717981930,'BTN',8234285991,5745907.0,'ifarish4@chronoengine.com'), ('ntuminini1d@tinyurl.com',9533452201258270,'Bank Mega',1981021387,3518270.0,'aalderman3@xrea.com'), ('tbass1e@ed.gov',2303622259830570,'Bank ICBC',4335284345,4666311.0,'ccommin0@dailymotion.com'), ('eambroisin1f@nationalgeographic.com',4350849333877600,'Bank Panin',3333651206,9249248.0,'vkillingworth1@spotify.com'), ('krhead1g@e-recht24.de',5065845630626570,'BRI',5733534994,494257.0,'ccommin0@dailymotion.com'), ('dgiametti1h@freewebs.com',7747243191868960,'BRI',5467402212,4601352.0,'aalderman3@xrea.com'), ('ogarroway1i@usgs.gov',7565508185711660,'Bank Mayapada',7557850213,4591972.0,'ddowyer2@epa.gov'), ('jcoventry1j@ft.com',7005013432126180,'BTN',8181435217,9454048.0,'aalderman3@xrea.com'), ('srisely1k@furl.net',2847942039593120,'Bank ICBC',4663867716,1722255.0,'ifarish4@chronoengine.com'), ('mdearness1l@wisc.edu',4836700829465540,'Bank Panin',2968216414,5762160.0,'ccommin0@dailymotion.com'), ('mdumsday1m@unicef.org',5123134672084460,'Bank ICBC',7506196292,4438308.0,'ddowyer2@epa.gov'), ('cfishe1n@ibm.com',8593086594260020,'Bank Mega',1207335665,4311220.0,'ifarish4@chronoengine.com'), ('mandrichuk1o@weibo.com',9992111204985240,'Bank Permata',2618703451,5283868.0,'aalderman3@xrea.com'), ('jspurett1p@merriam-webster.com',6698758005127070,'Bank Permata',4996549031,5174394.0,'ccommin0@dailymotion.com'), ('cmcshane1q@naver.com',2954126656457130,'Bank Danamon',8218683747,2023659.0,'ifarish4@chronoengine.com'), ('kelson1r@dmoz.org',4887753050020810,'BTN',8709357213,900848.0,'ddowyer2@epa.gov'), ('pebbers1s@etsy.com',5711143589469130,'BNI',5916655489,9873521.0,'ddowyer2@epa.gov'), ('hdurgan1t@de.vu',4289530270949650,'Bank Mayapada',5099314979,1810305.0,'vkillingworth1@spotify.com'), ('bgooding1u@ow.ly',6701235635968360,'Bank ICBC',8373717072,8586850.0,'ccommin0@dailymotion.com'), ('jleitche1v@thetimes.co.uk',8857734949843280,'Bank Mayapada',8841203171,523891.0,'aalderman3@xrea.com'), ('smechell1w@hatena.ne.jp',7884626786918990,'BCA',9607456812,2414378.0,'ccommin0@dailymotion.com'), ('ewoodburn1x@godaddy.com',3919466719183380,'Bank Mega',4545305416,148954.0,'aalderman3@xrea.com'); INSERT INTO COURIER VALUES ('sboise5@woothemes.com','B1412KK',93120302378098,'Car','Honda Mobilio'), ('ahillock6@taobao.com','B9231AA',14345072851615,'Motorcycle','Honda Scoopy'), ('gserrell7@weather.com','B782JK',21496531179484,'Motorcycle','Yamaha NMAX'), ('twimms8@studiopress.com','B994AC',83199759116181,'Car','Honda Brio'), ('nsugden9@mlb.com','B8343IO',18233228551445,'Car','Daihatsu Xenia'), ('hcancotta@github.com','B431KA',92035619872031.0,'Motorcycle','Suzuki Nex'), ('bsoaresb@lulu.com','B7821JS',84017263926197.0,'Car','Honda Jazz'), ('msmalcombec@pcworld.com','B726AL',72630917365209.0,'Motorcycle','Honda Supra'), ('mworttd@reuters.com','B7211EG',67253410925392.0,'Car','Suzuki Ertiga'), ('awelsbye@hud.gov','B323GA',72654109253754.0,'Motorcycle','Honda Scoopy'); INSERT INTO CUSTOMER VALUES ('jlawlancef@dot.gov','1983-07-11 00:00:00','M'), ('tbosmag@dailymotion.com','1998-10-07 00:00:00','M'), ('ijojich@seattletimes.com','1973-02-19 00:00:00','F'), ('csinesi@seattletimes.com','1990-02-15 00:00:00','F'), ('agawkrogej@cargocollective.com','1983-12-28 00:00:00','M'), ('idanzigk@chicagotribune.com','1996-04-25 00:00:00','M'), ('apettisl@de.vu','1968-05-13 00:00:00','F'), ('jpennim@un.org','1968-04-10 00:00:00','M'), ('bsimoncellon@a8.net','1967-04-14 00:00:00','F'), ('ipayno@squarespace.com','1963-09-21 00:00:00','F'), ('anewberryp@feedburner.com','1984-08-04 00:00:00','M'), ('szorzinq@ucla.edu','1968-05-11 00:00:00','M'), ('rgerlerr@amazon.co.jp','1984-11-12 00:00:00','M'), ('emckelveys@statcounter.com','1975-10-13 00:00:00','M'), ('ocorbiet@senate.gov','1964-01-09 00:00:00','M'), ('xkettonu@joomla.org','1987-06-01 00:00:00','M'), ('ddelvesv@bigcartel.com','1979-10-27 00:00:00','M'), ('nshaylorw@deviantart.com','1990-01-09 00:00:00','M'), ('ebarnewallx@alexa.com','1964-06-21 00:00:00','M'), ('tcamilleriy@tripadvisor.com','1968-02-03 00:00:00','M'); ``` ```sql CREATE TABLE RESTAURANT_CATEGORY( id VARCHAR(20) PRIMARY KEY, Name VARCHAR(50) NOT NULL ); CREATE TABLE RESTAURANT( RName VARCHAR(25), RBranch VARCHAR(25), Email VARCHAR(50), RPhoneNum VARCHAR(18) NOT NULL, Street VARCHAR(30) NOT NULL, District VARCHAR(20) NOT NULL, City VARCHAR(20) NOT NULL, Province VARCHAR(20) NOT NULL, Rating INT CHECK (Rating >= 0 AND Rating <= 10) DEFAULT 0, RCategory VARCHAR(20), PRIMARY KEY (RName, RBranch), FOREIGN KEY (Email) REFERENCES TRANSACTION_ACTOR(Email), FOREIGN KEY (RCategory) REFERENCES RESTAURANT_CATEGORY(id) ); CREATE TABLE RESTAURANT_OPERATING_HOURS( Name VARCHAR(25), Branch VARCHAR(25), Day VARCHAR(10), StartHours TIME NOT NULL, EndHours TIME NOT NULL, PRIMARY KEY (Name, Branch, Day), FOREIGN KEY (Name, Branch) REFERENCES RESTAURANT(RName, RBranch) ); CREATE TABLE FOOD_CATEGORY( id VARCHAR(20) PRIMARY KEY, Name VARCHAR(50) NOT NULL ); CREATE TABLE FOOD( RName VARCHAR(25), RBranch VARCHAR(25), FoodName VARCHAR(50), Description TEXT, Stock INT NOT NULL, Price BIGINT NOT NULL, FCategory VARCHAR(20) NOT NULL, PRIMARY KEY (RName, RBranch, FoodName), FOREIGN KEY (RName, RBranch) REFERENCES RESTAURANT(RName, RBranch), FOREIGN KEY (FCategory) REFERENCES FOOD_CATEGORY(id) ); CREATE TABLE INGREDIENT( Id VARCHAR(25) PRIMARY KEY, Name VARCHAR(25) NOT NULL ); CREATE TABLE FOOD_INGREDIENT( RName VARCHAR(25), RBranch VARCHAR(25), FoodName VARCHAR(50), Ingredient VARCHAR(25), PRIMARY KEY (RName, RBranch, FoodName, Ingredient), FOREIGN KEY (RName, RBranch, FoodName) REFERENCES FOOD(RName, RBranch, FoodName), FOREIGN KEY (Ingredient) REFERENCES INGREDIENT(Id) ); INSERT INTO RESTAURANT_CATEGORY VALUES ('F','French'), ('I','Indonesian'), ('J','Japanese'), ('C','Chinese'), ('A','American'); INSERT INTO RESTAURANT VALUES ('Dabvine','Cariamanga','ashadwickz@tmall.com',8876222381.0,'Homewood','Lower Shion','Amman','Azad Kashmir',3.0,'A'), ('Shufflester','Bayanbulag','ecolyer10@smugmug.com',4187088813.0,'East','North Hos','Haugesund','Vestfold og Telemark',6.0,'F'), ('Riffpath','Hedong','ggilliland11@jugem.jp',5829518425.0,'Hudson','East Deshob','La Molina','An Giang',4.0,'I'), ('Zoomcast','Wetzlar','bmasurel12@apple.com',4691430071.0,'Fordem','Smedwin Acre','Dolinsk','South Island',1.0,'F'), ('Trupe','Donggaocun','nedgeon13@reuters.com',2546392900.0,'Armistice','Schutted Acre','Tapiramutá','Sicilia',8.0,'J'), ('Tagcat','Lianyun','rbroggetti14@ed.gov',5946436821.0,'Troy','Smusurd Vale','Barreiro','Missouri',9.0,'A'), ('Jaxspan','Hetai','dmallia15@disqus.com',1565879463.0,'Garrison','Waterside Scarruft','Mozdok','Møre og Romsdal',5.0,'F'), ('Flipstorm','Ngurore','nbradbury16@desdev.cn',2034433697.0,'Russell','Schehusk Bazaar','Jietou','Sląskie',6.0,'F'), ('Skinte','Hadakewa','hearl17@google.ca',8028934042.0,'Crest Line','Stremmiarnilt Avenue','Calinaoan Malasin','Schleswig-Holstein',6.0,'F'), ('Skynoodle','Xiwanzi','apilkinton18@symantec.com',7219319434.0,'Mitchell','Snetenlic Avenue','Oslo','Kahramanmaraş',2.0,'J'), ('Quire','Longcheng','cdrees19@discovery.com',4007167437.0,'Delladonna','Midtown Plab','Kebonagung','North Island',8.0,'F'), ('Mynte','Lanús','lbott1a@rakuten.co.jp',8597295916.0,'International','Wem Hill','Bilaran','Florida',2.0,'F'), ('Yabox','Bandar Abbās','etupman1b@tmall.com',9292997936.0,'Crest Line','Rekram Market','Kępno','North Jeolla',9.0,'I'), ('Twitterbridge','Ciherang','dgrassick1c@ucoz.com',8336448313.0,'Badeau','Upper South Qodin','Sława','Connecticut',9.0,'J'), ('Edgetag','Victoria','ntuminini1d@tinyurl.com',6941774669.0,'Grasskamp','Twiammaist Town','Farriar','East Region',10.0,'J'), ('Jaxworks','Tiznit','tbass1e@ed.gov',9356679835.0,'Mallory','Yocek Avenue','Sao Hai','Utrecht',4.0,'F'), ('Aimbo','Kovel','eambroisin1f@nationalgeographic.com',7723814914.0,'Aberg','East Skoaput','Guyang','New Brunswick',10.0,'A'), ('Voomm','Tromsø','krhead1g@e-recht24.de',3259767802.0,'Meadow Ridge','Soseod Street','Marhanets','Valle d''Aosta',4.0,'A'), ('Wordify','Kurashiki','dgiametti1h@freewebs.com',6232400401.0,'Carberry','Vasiclosk Cross','Ruyigi','Bangsamoro',8.0,'C'), ('Zooxo','Keleleng','ogarroway1i@usgs.gov',3007305857.0,'Sycamore','Girulweg Point','Puerto Barrios','Tabasco',3.0,'A'), ('Oodoo','Siikajoki','jcoventry1j@ft.com',3161084108.0,'Badeau','Dreeld Heights','Nong Khai','Huádōng',0.0,'C'), ('Rhyzio','Żernica','srisely1k@furl.net',6573008602.0,'Ridgeway','Waterside Shreok','Hrib-Loški Potok','South Island',6.0,'A'), ('Demimbu','Yinla','mdearness1l@wisc.edu',5189451189.0,'Morningstar','North Strilgiok','Huayuan','Hatay',2.0,'A'), ('Rhyloo','San Pablo','mdumsday1m@unicef.org',8354605795.0,'Mendota','Grovil Bazaar','Gudong','Cajamarca',1.0,'F'), ('Janyx','Almalaguês','cfishe1n@ibm.com',4848140484.0,'Katie','South Geppoold','Būrkah','Western Cape',5.0,'A'), ('Snaptags','Ludgeřovice','mandrichuk1o@weibo.com',4132223312.0,'Nobel','South Blagig','Aqsū','Hải Phòng',8.0,'C'), ('Zoovu','Panggung','jspurett1p@merriam-webster.com',1135587233.0,'Shoshone','Little Thripund','Ansongo','Sucre',9.0,'F'), ('Livefish','Binjiang','cmcshane1q@naver.com',4822858568.0,'Pepper Wood','Midtown Shannipt','Karlovo','Nunavut',10.0,'J'), ('Brainverse','Uppsala','kelson1r@dmoz.org',9576575801.0,'Pond','Dressiovump Place','Karangpeton','Canarias',5.0,'C'), ('Wordify','Groznyy','pebbers1s@etsy.com',6092818956.0,'New Castle','Heaweolgiolt Wood','Banjar Bali','Xīnán',2.0,'J'), ('Dynabox','Kirovohrad','hdurgan1t@de.vu',3851945118.0,'Jackson','North Lect','Shishi','Guerrero',9.0,'C'), ('Topiczoom','Mandaon','bgooding1u@ow.ly',1796175106.0,'Crest Line','East Stris','Hammarö','South Jeolla',3.0,'A'), ('Kanoodle','Marabá','jleitche1v@thetimes.co.uk',9326714974.0,'Twin Pines','Lullark Town','Estreito','Benue',3.0,'F'), ('Gabspot','Pantalowice','smechell1w@hatena.ne.jp',7625041092.0,'Bellgrove','Dahod Garden','Al Hāshimīyah','Providencia',2.0,'J'), ('Roodel','Chenjiatan','ewoodburn1x@godaddy.com',2723121860.0,'Cascade','Shreonool Hill','Bolnisi','Soccsksargen',5.0,'A'); INSERT INTO RESTAURANT_OPERATING_HOURS VALUES ('Dabvine','Cariamanga','Monday','08:49:51','21:18:10'), ('Dabvine','Cariamanga','Wednesday','08:21:34','16:33:21'), ('Dabvine','Cariamanga','Friday','08:27:38','19:09:59'), ('Riffpath','Hedong','Tuesday','07:43:59','19:07:06'), ('Riffpath','Hedong','Wednesday','05:29:10','16:06:46'), ('Riffpath','Hedong','Thursday','09:52:12','16:16:15'), ('Riffpath','Hedong','Friday','05:25:45','19:35:09'), ('Tagcat','Lianyun','Friday','07:34:39','21:54:20'), ('Jaxspan','Hetai','Sunday','08:02:56','18:30:30'), ('Flipstorm','Ngurore','Wednesday','06:35:44','17:38:03'), ('Flipstorm','Ngurore','Friday','06:00:16','16:06:40'), ('Skynoodle','Xiwanzi','Monday','07:06:45','16:07:11'), ('Skynoodle','Xiwanzi','Wednesday','07:09:02','20:27:24'), ('Skynoodle','Xiwanzi','Friday','08:26:59','21:10:39'), ('Skynoodle','Xiwanzi','Saturday','08:32:32','18:57:12'), ('Twitterbridge','Ciherang','Friday','07:20:59','17:51:48'), ('Twitterbridge','Ciherang','Sunday','07:45:51','20:32:34'), ('Jaxworks','Tiznit','Wednesday','09:38:00','16:13:06'), ('Voomm','Tromsø','Wednesday','05:03:07','18:11:52'), ('Voomm','Tromsø','Friday','04:08:05','18:34:34'), ('Wordify','Kurashiki','Saturday','06:45:04','20:10:04'), ('Zooxo','Keleleng','Monday','09:08:51','17:29:30'), ('Zooxo','Keleleng','Tuesday','08:15:33','19:40:22'), ('Zooxo','Keleleng','Wednesday','09:22:50','20:50:57'), ('Zooxo','Keleleng','Thursday','09:33:04','20:09:15'), ('Zooxo','Keleleng','Friday','04:33:48','20:57:17'), ('Janyx','Almalaguês','Monday','05:15:11','20:19:22'), ('Snaptags','Ludgeřovice','Friday','06:03:19','21:28:45'), ('Snaptags','Ludgeřovice','Saturday','08:29:20','18:47:17'), ('Livefish','Binjiang','Monday','08:32:30','16:40:08'); INSERT INTO FOOD_CATEGORY VALUES ('M','Meat'), ('C','Confections'), ('F','Fruits'), ('V','Vegetables'), ('D','Drinks'); INSERT INTO FOOD VALUES ('Zoomcast','Wetzlar','Currant and tarragon salad','Fresh currant and dried tarragon served on a bed of lettuce',238.0,192000.0,'D'), ('Zoomcast','Wetzlar','Pancetta and chickpea pasta','Fresh egg pasta in a sauce made from smoked pancetta and fresh chickpea',70.0,147000.0,'C'), ('Zoomcast','Wetzlar','Apricot ice cream with butter sauce','Creamy, apricot ice cream served with a rich butter sauce',333.0,205000.0,'D'), ('Jaxspan','Hetai','Bacon and pesto spaghetti','Spaghetti topped with a blend of lea bacon and red pesto',51.0,223000.0,'D'), ('Jaxspan','Hetai','Samphire and sweetcorn salad','Samphire and creamed sweetcorn served on a bed of lettuce',17.0,121000.0,'D'), ('Skinte','Hadakewa','Hazelnut and bacon biscuits','Crumbly biscuits made with hazelnut and back bacon',372.0,222000.0,'D'), ('Skinte','Hadakewa','Bulgur wheat and sultana salad','Bulgur wheat and sultana served on a bed of lettuce',421.0,58000.0,'M'), ('Skinte','Hadakewa','Tomato and courgette salad','A crisp salad featuring cherry tomatoes and baby courgette',495.0,115000.0,'C'), ('Skinte','Hadakewa','Garlic and lime soup','Fresh garlic and tangy lime combined into creamy soup',159.0,189000.0,'F'), ('Yabox','Bandar Abbās','Egg and crab korma','Creamy korma made with free range eggs and crab',122.0,80000.0,'C'), ('Twitterbridge','Ciherang','Coriander and spinach stir fry','Crunchy stir fry featuring fresh coriander and baby spinach',0.0,183000.0,'F'), ('Edgetag','Victoria','Nutmeg and italian seasoning salad','A crunchy salad featuring nutmeg and italian seasoning',350.0,233000.0,'D'), ('Edgetag','Victoria','Mushroom and lettuce toastie','Crisp slices of bread filled with portobello mushroom and romaine lettuce',18.0,183000.0,'V'), ('Aimbo','Kovel','Lime and chilli skewers','Bamboo skewers loaded with fresh lime and chilli',246.0,33000.0,'C'), ('Aimbo','Kovel','Rhubarb and elderflower pie','A flaky pasty case filled with fresh rhubarb and elderflower',388.0,253000.0,'V'), ('Aimbo','Kovel','Lemon and cheese cheesecake','A luxurious cheesecake layered with fresh lemon and cheese',291.0,284000.0,'M'), ('Zooxo','Keleleng','Tumeric and chickpea vindaloo','Hot vindaloo made with tumeric and fresh chickpea',264.0,163000.0,'D'), ('Zooxo','Keleleng','Chickpea and crab wontons','Thin wonton cases stuffed with fresh chickpea and crab',465.0,234000.0,'M'), ('Zooxo','Keleleng','Sorrel and chestnut soup','Sorrel and roasted chestnut combined into chunky soup',72.0,296000.0,'V'), ('Demimbu','Yinla','Thyme and date cake','Moist cake made with fresh thyme and moist date',445.0,158000.0,'F'), ('Demimbu','Yinla','Quinoa and rosemary stir fry','Crunchy stir fry featuring fresh quinoa and rosemary',228.0,167000.0,'C'), ('Janyx','Almalaguês','Chicken and cardamom mousse','A silky mousse made with free range chicken and black cardamom',0.0,199000.0,'C'), ('Snaptags','Ludgeřovice','Turkey and mozzarella skewers','Bamboo skewers loaded with free-range turkey and fresh mozzarella',322.0,265000.0,'C'), ('Snaptags','Ludgeřovice','Beef and scallop pie','A shortcrust pasty case filled with beef and scallop',425.0,247000.0,'M'), ('Snaptags','Ludgeřovice','Black pepper and turkey ciabatta','Warm ciabatta filled with hot black pepper and free-range turkey',125.0,233000.0,'V'), ('Snaptags','Ludgeřovice','Horseradish and sage salad','Fresh horseradish and sage served on a bed of lettuce',0.0,6000.0,'V'), ('Snaptags','Ludgeřovice','Fennel and tamarind soup','Fresh fennel and tamarind combined into smooth soup',91.0,25000.0,'F'), ('Dynabox','Kirovohrad','Parmesan and champ salad','A crisp salad featuring parmesan and champ',332.0,27000.0,'M'), ('Dynabox','Kirovohrad','Parsnip and celery casserole','Fresh parsnips and celery stewed',449.0,147000.0,'F'), ('Dynabox','Kirovohrad','Sweetcorn and scallop wontons','Thin wonton cases stuffed with creamed sweetcorn and scallop',250.0,89000.0,'V'); INSERT INTO INGREDIENT VALUES ('LT','Lettuce'), ('CR','Currant'), ('TA','Tarragon'), ('TO','Tomato'), ('ON','Onion'), ('GA','Garlic'), ('PA','Pasta'), ('OR','Oregano'), ('PC','Pancetta'), ('PS','Passata'), ('SP','Spaghetti'), ('BL','Black Pepper'), ('FL','Flour'), ('BU','Butter'), ('EG','Egg'), ('SU','Sugar'), ('HA','Hazelnut'), ('SL','Sultana'), ('CO','Courgette'), ('LI','Lime'); INSERT INTO FOOD_INGREDIENT VALUES ('Zoomcast','Wetzlar','Currant and tarragon salad','ON'), ('Zoomcast','Wetzlar','Currant and tarragon salad','BL'), ('Zoomcast','Wetzlar','Pancetta and chickpea pasta','SU'), ('Zoomcast','Wetzlar','Pancetta and chickpea pasta','TA'), ('Jaxspan','Hetai','Samphire and sweetcorn salad','TA'), ('Skinte','Hadakewa','Hazelnut and bacon biscuits','FL'), ('Skinte','Hadakewa','Hazelnut and bacon biscuits','LI'), ('Skinte','Hadakewa','Hazelnut and bacon biscuits','CR'), ('Skinte','Hadakewa','Garlic and lime soup','SL'), ('Skinte','Hadakewa','Garlic and lime soup','OR'), ('Twitterbridge','Ciherang','Coriander and spinach stir fry','TA'), ('Edgetag','Victoria','Nutmeg and italian seasoning salad','OR'), ('Edgetag','Victoria','Nutmeg and italian seasoning salad','SP'), ('Edgetag','Victoria','Nutmeg and italian seasoning salad','PA'), ('Edgetag','Victoria','Nutmeg and italian seasoning salad','SU'), ('Aimbo','Kovel','Lemon and cheese cheesecake','BL'), ('Aimbo','Kovel','Lemon and cheese cheesecake','GA'), ('Zooxo','Keleleng','Chickpea and crab wontons','BU'), ('Zooxo','Keleleng','Chickpea and crab wontons','LI'), ('Zooxo','Keleleng','Chickpea and crab wontons','EG'), ('Demimbu','Yinla','Quinoa and rosemary stir fry','PA'), ('Janyx','Almalaguês','Chicken and cardamom mousse','FL'), ('Janyx','Almalaguês','Chicken and cardamom mousse','PC'), ('Janyx','Almalaguês','Chicken and cardamom mousse','PS'), ('Snaptags','Ludgeřovice','Black pepper and turkey ciabatta','FL'), ('Snaptags','Ludgeřovice','Black pepper and turkey ciabatta','TO'), ('Snaptags','Ludgeřovice','Fennel and tamarind soup','LT'), ('Snaptags','Ludgeřovice','Fennel and tamarind soup','HA'), ('Dynabox','Kirovohrad','Parsnip and celery casserole','PS'), ('Dynabox','Kirovohrad','Parsnip and celery casserole','LI'); ``` ```sql CREATE TABLE TRANSACTION( Email VARCHAR(50), Datetime TIMESTAMP, Street VARCHAR(30) Not Null, District VARCHAR(30) Not Null, City VARCHAR(25) Not Null, Province VARCHAR(25) Not Null, TotalFood INT Not Null, TotalDiscount Float Not Null, DeliveryFee Float Not Null, TotalPrice Float Not Null, Rating INT Not Null, PMId VARCHAR(25) Not Null, PSId VARCHAR(25) Not Null, DFId VARCHAR(20) Not Null, CourierId VARCHAR(50) Not Null, PRIMARY KEY (Email, Datetime), FOREIGN KEY (Email) REFERENCES CUSTOMER(Email), FOREIGN KEY (PMId) REFERENCES PAYMENT_METHOD(Id), FOREIGN KEY (PSId) REFERENCES PAYMENT_STATUS(Id), FOREIGN KEY (DFId) REFERENCES DELIVERY_FEE_PER_KM(Id), FOREIGN KEY (CourierId) REFERENCES COURIER(Email) ); CREATE TABLE DELIVERY_FEE_PER_KM( Id VARCHAR(20) PRIMARY KEY, Province VARCHAR(25) Not Null, MotorFee INT Not Null, CarFee INT Not Null ); CREATE TABLE PAYMENT_METHOD( Id VARCHAR(25) Primary Key, Name VARCHAR(25) Not Null ); INSERT INTO TRANSACTION VALUES ('ijojich@seattletimes.com','2022-10-02 08:10:00', 'East','Stremmiarnilt Avenue','Ruyigi','South Island',2,0.0,15.444,397.000,8,'4','2','2','gserrell7@weather.com'), ('tbosmag@dailymotion.com','2022-10-02 11:24:00','Delladonna','Upper South Qodin','Sao Hai','Schleswig-Holstein',3,0.0,11.925,395.000,5,'4','3','7','ahillock6@taobao.com'), ('jpennim@un.org','2022-10-04 05:07:00','Nobel','Waterside Shreok','Mozdok','New Brunswick',2,0.0,18.425,317.000,9,'1','2','4','sboise5@woothemes.com'), ('ipayno@squarespace.com','2022-10-05 16:26:00','Ridgeway','Waterside Scarruft','Sao Hai','Schleswig-Holstein',2,0.0,21.465,173.000,7,'5','1','7','ahillock6@taobao.com'), ('emckelveys@statcounter.com','2022-10-07 07:13:00','New Castle','Wem Hill','Barreiro','Hải Phòng',4,0.0,57.600,511.000,3,'2','1','10','nsugden9@mlb.com'), ('bsimoncellon@a8.net','2022-10-07 13:49:00','Crest Line','South Geppoold','Sao Hai','Schleswig-Holstein',1,0.0,8.480,247.000,10,'3','3','7','ahillock6@taobao.com'), ('xkettonu@joomla.org','2022-10-10 22:22:00','Dakota','Dressiovump Place','Al Hāshimīyah','Hatay',1,0.0,34.400,167.000,10,'2','2','6','twimms8@studiopress.com'), ('ocorbiet@senate.gov','2022-10-12 19:58:00','Fordem','Lower Shion','Al Hāshimīyah','Hatay',1,0.0,32.800,158.000,9,'4','2','6','twimms8@studiopress.com'), ('jlawlancef@dot.gov','2022-10-13 20:28:00','Aberg','East Skoaput','Mozdok','South Island',3,0.0,21.060,544.000,6,'4','2','2','gserrell7@weather.com'), ('anewberryp@feedburner.com','2022-10-15 16:48:00','Loftsgordon','Schiloaggark Hills','Farriar','Hải Phòng',2,0.0,54.400,498.000,1,'2','3','10','nsugden9@mlb.com'); INSERT INTO DELIVERY_FEE_PER_KM VALUES ('1','East Region',2800,9000), ('2','South Island',2700,8000), ('3','Azad Kashmir',2650,7500), ('4','New Brunswick',2750,8500), ('5','Guerrero',2650,7500), ('6','Hatay',2750,8000), ('7','Schleswig-Holstein',2650,7500), ('8','Connacht',2700,7750), ('9','Soccsksargen',2600,7500), ('10','Hải Phòng',2700,8000), ('11','Benue',2550,7250); INSERT INTO PAYMENT_METHOD VALUES ('1','ATM'), ('2','M-banking'), ('3','Indomaret/Alfamart'), ('4','RestoPay'), ('5','E-wallet lainnya'); ``` ```sql CREATE TABLE PAYMENT_STATUS( Id VARCHAR(25) PRIMARY KEY, Name VARCHAR(25) NOT NULL ); CREATE TABLE TRANSACTION_STATUS( Id VARCHAR(25) PRIMARY KEY, Name VARCHAR(25) NOT NULL ); CREATE TABLE TRANSACTION_FOOD( Email VARCHAR(50) NOT NULL, Datetime TIMESTAMP NOT NULL, RName VARCHAR(25) NOT NULL, RBranch VARCHAR(25) NOT NULL, FoodName VARCHAR(50) NOT NULL, Amount INT NOT NULL, Note VARCHAR(255), PRIMARY KEY (Email, Datetime, RName, Rbranch, FoodName), FOREIGN KEY (Email, Datetime) REFERENCES TRANSACTION(Email, Datetime), FOREIGN KEY (RName, RBranch, FoodName) REFERENCES FOOD(RName, RBranch, FoodName) ); CREATE TABLE TRANSACTION_HISTORY( Email VARCHAR(50) NOT NULL, Datetime TIMESTAMP NOT NULL, TSId VARCHAR(25) NOT NULL, DatetimeStatus TIMESTAMP NOT NULL, PRIMARY KEY (Email, Datetime, TSId), FOREIGN KEY (Email, Datetime) REFERENCES TRANSACTION(Email, Datetime), FOREIGN KEY (TSId) REFERENCES TRANSACTION_STATUS(Id) ); INSERT INTO PAYMENT_STATUS VALUES (1,'Menunggu Pembayaran'), (2,'Berhasil'), (3,'Gagal'); INSERT INTO TRANSACTION_STATUS VALUES (1,'Konfirmasi Restoran'), (2,'Pesanan Dibuat'), (3,'Pesanan Diantar'), (4,'Pesanan Selesai'), (5,'Pesanan Dibatalkan'); INSERT INTO TRANSACTION_FOOD VALUES ('ijojich@seattletimes.com','2022-10-02 08:10:00','Zoomcast','Wetzlar','Currant and tarragon salad',2,'Jangan pedas'), ('tbosmag@dailymotion.com','2022-10-02 11:24:00','Jaxspan','Hetai','Samphire and sweetcorn salad',1,'Tidak terlalu manis'), ('jpennim@un.org','2022-10-04 05:07:00','Skinte','Hadakewa','Bulgur wheat and sultana salad',3,'Tidak pakai saos'), ('ipayno@squarespace.com','2022-10-05 16:26:00','Twitterbridge','Ciherang','Coriander and spinach stir fry',5,NULL), ('emckelveys@statcounter.com','2022-10-07 07:13:00','Edgetag','Victoria','Mushroom and lettuce toastie',2,NULL), ('bsimoncellon@a8.net','2022-10-07 13:49:00','Zooxo','Keleleng','Chickpea and crab wontons',1,NULL), ('xkettonu@joomla.org','2022-10-10 22:22:00','Demimbu','Yinla','Quinoa and rosemary stir fry',1,'Jangan terlalu kering'), ('ocorbiet@senate.gov','2022-10-12 19:58:00','Dynabox','Kirovohrad','Parmesan and champ salad',5,NULL), ('jlawlancef@dot.gov','2022-10-13 20:28:00','Dynabox','Kirovohrad','Sweetcorn and scallop wontons',4,NULL), ('anewberryp@feedburner.com','2022-10-15 16:48:00','Zoomcast','Wetzlar','Pancetta and chickpea pasta',2,'Saos diperbanyak'); INSERT INTO TRANSACTION_HISTORY VALUES ('ijojich@seattletimes.com','2022-10-02 08:10:00',2,'2022-10-02 08:09:00'), ('tbosmag@dailymotion.com','2022-10-02 11:24:00',3,'2022-10-02 11:24:00'), ('jpennim@un.org','2022-10-04 05:07:00',4,'2022-10-04 05:06:00'), ('ipayno@squarespace.com','2022-10-05 16:26:00',5,'2022-10-05 16:26:00'), ('emckelveys@statcounter.com','2022-10-07 07:13:00',1,'2022-10-07 07:13:00'), ('bsimoncellon@a8.net','2022-10-07 13:49:00',4,'2022-10-07 13:44:00'), ('xkettonu@joomla.org','2022-10-10 22:22:00',2,'2022-10-10 22:21:00'), ('ocorbiet@senate.gov','2022-10-12 19:58:00',3,'2022-10-12 19:57:00'), ('jlawlancef@dot.gov','2022-10-13 20:28:00',2,'2022-10-13 20:28:00'), ('anewberryp@feedburner.com','2022-10-15 16:48:00',4,'2022-10-15 16:45:00'); ``` ```sql CREATE TABLE PROMO ( Id VARCHAR(25) PRIMARY KEY, PromoName VARCHAR(25) NOT NULL, Discount INT CHECK (Discount > 0 AND Discount <= 100) ); CREATE TABLE MIN_TRANSACTION_PROMO ( Id VARCHAR(25) PRIMARY KEY, MinimumTransactionNum INT NOT NULL, FOREIGN KEY(Id) REFERENCES PROMO(Id) ); CREATE TABLE SPECIAL_DAY_PROMO ( Id VARCHAR(25) PRIMARY KEY, Datetime DATE NOT NULL, FOREIGN KEY(Id) REFERENCES PROMO(Id) ); CREATE TABLE RESTAURANT_PROMO ( RName VARCHAR(25) NOT NULL, RBranch VARCHAR(25) NOT NULL, FoodName VARCHAR(50) NOT NULL, PId VARCHAR(25) NOT NULL, StartTime TIMESTAMP NOT NULL, EndTime TIMESTAMP NOT NULL, PRIMARY KEY (RName, RBranch, FoodName, PId), FOREIGN KEY (RName, RBranch, FoodName) REFERENCES FOOD(RName, RBranch, FoodName), FOREIGN KEY (PId) REFERENCES PROMO(Id) ); INSERT INTO PROMO VALUES ('TR03','Diskon untuk 3 transaksi',20), ('TR02','Diskon untuk 2 transaksi',10), ('TR05','Diskon untuk 5 transaksi',30), ('TR06','Diskon untuk 6 transaksi',35), ('TR04','Diskon untuk 4 transaksi',25), ('TR11','Diskon untuk 11 transaksi',60), ('TR01','Diskon untuk 1 transaksi',5), ('TR09','Diskon untuk 9 transaksi',45), ('TR10','Diskon untuk 10 transaksi',50), ('TR07','Diskon untuk 7 transaksi',40), ('SP09SEPT','Diskon hari cantik 9 Sept',20), ('SP17AGT','Diskon hari kemerdekaan',20), ('SP10OCT','Diskon hari cantik 10 Okt',10), ('SP11NOV','Diskon hari cantik 11 Nov',5), ('SP12DEC','Diskon hari cantik 12 Dec',25), ('SP25DEC','Diskon hari natal',40), ('SP10NOV','Diskon hari pahlawan ',25), ('SP21APR','Diskon hari kartini ',25), ('SP08OCT','Diskon maulid nabi',30), ('SP01JUN','Diskon lahirnya pancasila',35); INSERT INTO MIN_TRANSACTION_PROMO VALUES ('TR03',3), ('TR02',2), ('TR05',5), ('TR06',6), ('TR04',4), ('TR11',11), ('TR01',1), ('TR09',9), ('TR10',10), ('TR07',7); INSERT INTO SPECIAL_DAY_PROMO VALUES ('SP09SEPT','2022-09-09'), ('SP17AGT','2022-09-17'), ('SP10OCT','2022-10-10'), ('SP11NOV','2022-11-11'), ('SP12DEC','2022-12-12'), ('SP25DEC','2022-12-25'), ('SP10NOV','2022-11-10'), ('SP21APR','2022-04-21'), ('SP08OCT','2022-10-08'), ('SP01JUN','2022-06-01'); INSERT INTO RESTAURANT_PROMO VALUES ('Zoomcast','Wetzlar','Pancetta and chickpea pasta','TR06','2022-10-21 12:01:02','2022-10-28 23:59:00'), ('Zoomcast','Wetzlar','Apricot ice cream with butter sauce','SP25DEC','2022-12-25 00:00:00','2022-12-30 23:59:00'), ('Jaxspan','Hetai','Bacon and pesto spaghetti','TR03','2022-10-25 00:00:00','2022-10-27 23:59:00'), ('Zooxo','Keleleng','Tumeric and chickpea vindaloo','TR09','2022-11-11 07:00:00','2022-11-12 18:00:01'), ('Zooxo','Keleleng','Chickpea and crab wontons','SP25DEC','2022-12-25 05:00:00','2022-12-30 17:00:59'), ('Zooxo','Keleleng','Sorrel and chestnut soup','TR01','2022-10-21 01:02:03','2022-10-22 23:55:01'), ('Skinte','Hadakewa','Hazelnut and bacon biscuits','SP09SEPT','2022-09-09 19:00:01','2022-09-10 10:01:20'), ('Skinte','Hadakewa','Bulgur wheat and sultana salad','SP10OCT','2022-10-10 00:12:34','2022-10-11 12:34:56'), ('Aimbo','Kovel','Lime and chilli skewers','TR11','2022-12-01 11:11:11','2022-12-02 17:18:19'), ('Aimbo','Kovel','Rhubarb and elderflower pie','TR03','2022-12-05 03:03:03','2022-12-12 22:20:02'); ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully