text
stringlengths
6
9.38M
USE `shop`; LOCK TABLES `products` WRITE; /*!40000 ALTER TABLE `products` DISABLE KEYS */; INSERT INTO `products` VALUES (3683863,"Hunger Games, The","ultrices phasellus id sapien in sapien iaculis congue vivamus metus arcu adipiscing molestie hendrerit at vulputate vitae nisl aenean lectus pellentesque eget nunc donec",26.83,70), (2269042,"Ethel","pellentesque ultrices mattis odio donec vitae nisi nam ultrices libero non mattis pulvinar nulla pede ullamcorper augue a suscipit",678.2,62), (3666784,"Ghosts of Mars","sollicitudin ut suscipit a feugiat et eros vestibulum ac est lacinia nisi venenatis tristique fusce",688.16,38), (9693458,"China 9, Liberty 37 (Amore, piombo e furore)","vel pede morbi porttitor lorem id ligula suspendisse ornare consequat lectus in est risus auctor sed tristique",580.44,86), (3598047,"L!fe Happens","nulla nisl nunc nisl duis bibendum felis sed interdum venenatis turpis enim blandit mi in porttitor pede justo eu massa donec dapibus duis at velit eu est congue elementum in",712.13,100), (7575840,"Brideshead Revisited","rutrum at lorem integer tincidunt ante vel ipsum praesent blandit lacinia erat vestibulum sed magna at nunc commodo placerat",1232.45,47), (4174891,"Holy Matrimony","quis libero nullam sit amet turpis elementum ligula vehicula consequat morbi a ipsum integer a nibh in quis justo maecenas rhoncus aliquam lacus morbi quis tortor id nulla ultrices aliquet",783.43,53), (4708186,"Legacy, The","cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus vivamus vestibulum sagittis sapien cum sociis natoque penatibus et magnis dis",1354.24,42), (8553708,"High Cost of Living, The","sollicitudin vitae consectetuer eget rutrum at lorem integer tincidunt ante vel ipsum praesent blandit lacinia erat vestibulum sed magna at nunc commodo placerat",1296.59,28), (4572956,"Gold Rush, The","nulla ultrices aliquet maecenas leo odio condimentum id luctus nec molestie sed justo pellentesque viverra pede ac diam cras pellentesque volutpat dui maecenas tristique est et tempus semper est quam",699.62,57), (4046209,"Legion of the Dead","sapien sapien non mi integer ac neque duis bibendum morbi non quam nec dui luctus rutrum nulla tellus in sagittis dui vel",822.44,52), (8322961,"High on Crack Street: Lost Lives in Lowell","quis turpis sed ante vivamus tortor duis mattis egestas metus aenean fermentum donec ut mauris eget massa tempor convallis nulla neque libero convallis eget eleifend",1132.46,93), (5340464,"Django Unchained","in porttitor pede justo eu massa donec dapibus duis at velit eu est congue elementum in hac habitasse platea dictumst morbi vestibulum velit id pretium iaculis diam erat fermentum",925.07,14), (3923051,"The Time Being","augue vel accumsan tellus nisi eu orci mauris lacinia sapien quis libero nullam sit amet turpis elementum ligula vehicula consequat morbi a ipsum integer",1475.49,68), (2875410,"Guantanamera","ultrices erat tortor sollicitudin mi sit amet lobortis sapien sapien non mi integer ac neque duis bibendum morbi non quam nec dui luctus rutrum nulla tellus in sagittis dui",313.67,54), (5720780,"Night Catches Us","massa id lobortis convallis tortor risus dapibus augue vel accumsan tellus nisi eu orci mauris lacinia sapien quis libero nullam sit amet turpis elementum",731.95,14), (7961228,"Episode 3: Enjoy Poverty","duis bibendum felis sed interdum venenatis turpis enim blandit mi in porttitor pede justo eu massa donec dapibus duis at velit eu est congue elementum in hac",651.57,10), (7296847,"Camouflage","donec ut dolor morbi vel lectus in quam fringilla rhoncus mauris enim leo rhoncus sed vestibulum sit amet",349.09,17), (4507336,"High School High","tempor convallis nulla neque libero convallis eget eleifend luctus ultricies eu nibh quisque id justo sit amet",976.7,44), (7768262,"Lana Turner","interdum in ante vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae duis faucibus accumsan odio curabitur convallis duis consequat dui nec",610.06,21), (5725335,"Atomic Rulers of the World","ridiculus mus vivamus vestibulum sagittis sapien cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus etiam vel augue",1270.78,10), (4627477,"Istanbul","sollicitudin vitae consectetuer eget rutrum at lorem integer tincidunt ante vel ipsum praesent blandit lacinia erat vestibulum sed magna at nunc commodo",1002.54,32), (4391755,"Rocky","tristique in tempus sit amet sem fusce consequat nulla nisl nunc nisl duis bibendum felis sed interdum venenatis turpis enim blandit mi in porttitor pede justo eu massa donec dapibus",1234.89,35), (8106693,"Seven Sinners","cubilia curae duis faucibus accumsan odio curabitur convallis duis consequat dui nec nisi volutpat eleifend donec",386.14,23), (4249016,"Oppressed Majority","eget congue eget semper rutrum nulla nunc purus phasellus in felis donec semper sapien a libero nam dui proin leo odio porttitor id",1246.56,70), (8443031,"Terrorist","quisque id justo sit amet sapien dignissim vestibulum vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae nulla dapibus dolor vel",1075.47,92), (4301780,"Love Sick Love","nulla tempus vivamus in felis eu sapien cursus vestibulum proin eu mi nulla ac enim in tempor turpis nec euismod scelerisque quam turpis adipiscing",53.1,31), (4806823,"One Man Against the Organization","elit proin risus praesent lectus vestibulum quam sapien varius ut blandit non interdum in ante vestibulum ante",147.45,37), (3674658,"Fighting Elegy (Kenka erejii)","sapien non mi integer ac neque duis bibendum morbi non quam nec dui luctus rutrum nulla tellus in sagittis dui vel",309.87,79), (6765613,"Tess of the Storm Country","semper interdum mauris ullamcorper purus sit amet nulla quisque arcu libero rutrum ac lobortis vel",851.47,82), (7683220,"Class of 92, The","venenatis non sodales sed tincidunt eu felis fusce posuere felis sed lacus morbi sem mauris laoreet ut rhoncus aliquet pulvinar sed nisl nunc rhoncus dui vel sem sed sagittis",619.64,88), (8146450,"Zombies of Mora Tau","quis augue luctus tincidunt nulla mollis molestie lorem quisque ut erat curabitur gravida nisi at nibh in hac habitasse platea dictumst aliquam augue quam sollicitudin vitae consectetuer",1152.92,95), (8520501,"Truly Human (Et rigtigt menneske)","malesuada in imperdiet et commodo vulputate justo in blandit ultrices enim lorem ipsum dolor sit",1308.26,20), (9037181,"Men with Guns","morbi sem mauris laoreet ut rhoncus aliquet pulvinar sed nisl nunc rhoncus dui vel sem sed sagittis nam congue risus semper porta volutpat quam pede",342.18,44), (2590696,"To Begin Again (Volver a Empezar)","pulvinar sed nisl nunc rhoncus dui vel sem sed sagittis nam congue risus semper porta volutpat quam",425.46,54), (6130561,"Beyond Silence (Jenseits der Stille)","est risus auctor sed tristique in tempus sit amet sem fusce consequat nulla nisl nunc nisl duis bibendum felis sed interdum venenatis turpis enim blandit",1392.93,60), (8938204,"Stripes","lacus curabitur at ipsum ac tellus semper interdum mauris ullamcorper purus sit amet nulla quisque arcu libero rutrum",800.65,36), (5147599,"H.H. Holmes: America's First Serial Killer","est risus auctor sed tristique in tempus sit amet sem fusce consequat nulla nisl nunc nisl",1038.26,25), (4481848,"Brandon Teena Story, The","massa quis augue luctus tincidunt nulla mollis molestie lorem quisque ut erat curabitur gravida nisi at nibh in hac habitasse platea dictumst aliquam augue quam",42.21,80), (7749955,"Lake Tahoe","aenean fermentum donec ut mauris eget massa tempor convallis nulla neque libero convallis eget eleifend luctus ultricies eu nibh quisque id justo sit amet sapien dignissim vestibulum vestibulum ante",1135.22,41), (5982424,"Short Film About John Bolton, A","id sapien in sapien iaculis congue vivamus metus arcu adipiscing molestie hendrerit at vulputate vitae nisl aenean lectus pellentesque eget nunc",181.63,80), (9631154,"Every Which Way But Loose","semper est quam pharetra magna ac consequat metus sapien ut nunc vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae mauris viverra diam vitae quam suspendisse",48.89,87), (4585585,"Jönssonligan på Mallorca","molestie nibh in lectus pellentesque at nulla suspendisse potenti cras in purus eu magna vulputate luctus cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus",1036.28,74), (4887317,"Sea Gull, The","erat eros viverra eget congue eget semper rutrum nulla nunc purus phasellus in felis donec semper sapien a libero nam dui proin leo",382.33,97), (9974570,"You, Me and Dupree","lorem id ligula suspendisse ornare consequat lectus in est risus auctor sed tristique in tempus sit amet sem fusce consequat nulla nisl nunc nisl duis bibendum",1193.3,67), (5371291,"Escaflowne: The Movie (Escaflowne)","platea dictumst maecenas ut massa quis augue luctus tincidunt nulla mollis molestie lorem quisque ut erat",142.0,94), (4964160,"Vicky Cristina Barcelona","sit amet erat nulla tempus vivamus in felis eu sapien cursus vestibulum proin eu mi nulla ac enim in tempor turpis nec euismod scelerisque quam turpis",509.8,25), (2105145,"Trinity and Beyond","nulla nisl nunc nisl duis bibendum felis sed interdum venenatis turpis enim blandit mi in porttitor pede justo eu massa donec dapibus duis",693.63,44), (6351071,"Perfect Fake, A","vitae nisi nam ultrices libero non mattis pulvinar nulla pede ullamcorper augue a suscipit nulla elit ac nulla sed vel",13.03,57), (3091803,"Weight of the Nation","velit eu est congue elementum in hac habitasse platea dictumst morbi vestibulum velit id pretium iaculis diam erat fermentum justo nec condimentum neque sapien placerat ante nulla justo",496.4,47), (6054421,"Arthur Christmas","mi integer ac neque duis bibendum morbi non quam nec dui luctus rutrum nulla tellus in sagittis",451.3,17), (8153575,"Must Love Dogs","metus vitae ipsum aliquam non mauris morbi non lectus aliquam sit amet diam in magna bibendum imperdiet nullam orci pede venenatis non sodales sed tincidunt eu felis fusce",64.52,42), (4123287,"Eating Raoul","donec pharetra magna vestibulum aliquet ultrices erat tortor sollicitudin mi sit amet lobortis sapien sapien non mi integer ac",239.76,69), (4757464,"Lonely Are the Brave","molestie nibh in lectus pellentesque at nulla suspendisse potenti cras in purus eu magna vulputate luctus cum sociis natoque penatibus et magnis dis parturient montes nascetur",395.31,73), (8777310,"I Got the Hook Up","ligula in lacus curabitur at ipsum ac tellus semper interdum mauris ullamcorper purus sit amet nulla quisque arcu libero rutrum ac lobortis vel dapibus at",114.07,41), (3836683,"War of the Roses, The","phasellus sit amet erat nulla tempus vivamus in felis eu sapien cursus vestibulum proin eu mi nulla ac",1420.72,18), (9717065,"Cabin in the Woods, The","iaculis diam erat fermentum justo nec condimentum neque sapien placerat ante nulla justo aliquam quis turpis eget",1381.92,32), (4428469,"Visitors, The (Visiteurs, Les)","purus eu magna vulputate luctus cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus vivamus vestibulum",1265.27,92), (3565583,"Mandela: Long Walk to Freedom","neque aenean auctor gravida sem praesent id massa id nisl venenatis lacinia aenean sit amet justo morbi ut odio cras mi pede malesuada in imperdiet et commodo vulputate justo in",316.8,21), (6948994,"Valentin (Valentín)","congue diam id ornare imperdiet sapien urna pretium nisl ut volutpat sapien arcu sed augue aliquam erat volutpat in congue",1438.54,72), (9749749,"Head","non ligula pellentesque ultrices phasellus id sapien in sapien iaculis congue vivamus metus arcu adipiscing molestie hendrerit at vulputate vitae nisl aenean lectus pellentesque eget nunc donec quis orci",1117.68,31), (4581077,"Surfwise","tortor risus dapibus augue vel accumsan tellus nisi eu orci mauris lacinia sapien quis libero nullam sit amet turpis elementum ligula",340.94,34), (3691508,"Let the Bullets Fly","primis in faucibus orci luctus et ultrices posuere cubilia curae donec pharetra magna vestibulum aliquet ultrices",826.22,48), (5469547,"Rocket from Calabuch, The (Calabuch)","dapibus nulla suscipit ligula in lacus curabitur at ipsum ac tellus semper interdum mauris ullamcorper purus sit amet",169.06,60), (9116933,"Book of Fate, The (Kohtalon kirja)","blandit ultrices enim lorem ipsum dolor sit amet consectetuer adipiscing elit proin interdum mauris non ligula pellentesque ultrices phasellus id sapien in sapien",982.97,30), (8416596,"Trouble in Paradise","vivamus in felis eu sapien cursus vestibulum proin eu mi nulla ac enim in tempor turpis nec euismod scelerisque quam turpis",409.65,16), (6056594,"Portrait in Black","eu interdum eu tincidunt in leo maecenas pulvinar lobortis est phasellus sit amet erat nulla tempus vivamus in felis eu sapien cursus",1025.97,42), (7909909,"Butchered","lacinia nisi venenatis tristique fusce congue diam id ornare imperdiet sapien urna pretium nisl ut volutpat sapien arcu sed augue aliquam erat volutpat in congue etiam justo etiam",1002.47,63), (5697139,"Moon Zero Two","aliquam sit amet diam in magna bibendum imperdiet nullam orci pede venenatis non sodales sed tincidunt eu felis fusce posuere felis sed",171.43,42), (3887553,"The Deep Six","nulla elit ac nulla sed vel enim sit amet nunc viverra dapibus nulla suscipit ligula in lacus curabitur at ipsum ac tellus semper interdum mauris ullamcorper purus",36.83,32), (7971339,"What a Way to Go!","maecenas pulvinar lobortis est phasellus sit amet erat nulla tempus vivamus in felis eu sapien cursus vestibulum proin eu mi",1464.92,10), (4436021,"All the Fine Young Cannibals","rutrum nulla nunc purus phasellus in felis donec semper sapien a libero nam dui proin leo odio porttitor id",1454.19,31), (8187210,"Happiness Is in the Field","in eleifend quam a odio in hac habitasse platea dictumst maecenas ut massa quis augue luctus tincidunt nulla mollis molestie lorem quisque ut",1148.18,99), (3509054,"Eklavya: The Royal Guard","consectetuer adipiscing elit proin interdum mauris non ligula pellentesque ultrices phasellus id sapien in sapien",1191.34,40), (3141516,"Arabian Nights","nec nisi volutpat eleifend donec ut dolor morbi vel lectus in quam fringilla rhoncus mauris enim leo rhoncus sed vestibulum sit amet cursus id turpis integer",784.39,53), (5172415,"Fallen Sparrow, The","quam pede lobortis ligula sit amet eleifend pede libero quis orci nullam molestie nibh in lectus",207.98,75), (4217061,"Christmas Carol: The Musical","vel nisl duis ac nibh fusce lacus purus aliquet at feugiat non pretium quis lectus suspendisse potenti in eleifend quam a",397.75,75), (2983720,"River Runs Through It, A","rhoncus aliquet pulvinar sed nisl nunc rhoncus dui vel sem sed sagittis nam congue risus semper porta volutpat quam pede lobortis ligula sit amet eleifend",1331.51,19), (6744077,"Transmorphers","justo lacinia eget tincidunt eget tempus vel pede morbi porttitor lorem id ligula suspendisse ornare consequat lectus in est risus auctor sed tristique",1394.22,34), (3497810,"Yellow Sky","rhoncus mauris enim leo rhoncus sed vestibulum sit amet cursus id turpis integer aliquet massa id lobortis convallis tortor",1102.56,17), (8013909,"Demoted","sollicitudin vitae consectetuer eget rutrum at lorem integer tincidunt ante vel ipsum praesent blandit lacinia erat vestibulum sed magna at",1193.0,52), (6458478,"Dirty Shame, A","ultrices mattis odio donec vitae nisi nam ultrices libero non mattis pulvinar nulla pede ullamcorper augue a suscipit nulla elit ac",337.64,17), (9287704,"Newcastle","ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae duis faucibus accumsan odio",612.84,43), (9485069,"Day The Earth Froze, The (Sampo)","quis orci eget orci vehicula condimentum curabitur in libero ut massa volutpat convallis morbi odio odio elementum eu interdum eu tincidunt in",340.83,43), (2172403,"Diary of a Chambermaid","nibh quisque id justo sit amet sapien dignissim vestibulum vestibulum ante ipsum primis in faucibus orci",637.26,24), (5656437,"Yatterman (Yattâman)","magna vulputate luctus cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus vivamus vestibulum",684.5,14), (7612822,"South, The (Lomalla)","etiam vel augue vestibulum rutrum rutrum neque aenean auctor gravida sem praesent id massa id nisl",765.66,96), (4057711,"Karol: A Man Who Became Pope","mi sit amet lobortis sapien sapien non mi integer ac neque duis bibendum morbi non quam nec dui luctus rutrum nulla tellus in sagittis dui",257.01,95), (6753605,"Wee Willie Winkie","vel est donec odio justo sollicitudin ut suscipit a feugiat et eros vestibulum ac est lacinia nisi venenatis tristique fusce congue diam id ornare imperdiet",1004.52,31), (6963682,"Nosferatu the Vampyre","tellus nisi eu orci mauris lacinia sapien quis libero nullam sit amet turpis elementum ligula vehicula consequat morbi a ipsum integer a nibh in quis justo maecenas rhoncus aliquam",1350.41,58), (2102636,"To Each His Own Cinema","phasellus sit amet erat nulla tempus vivamus in felis eu sapien cursus vestibulum proin eu mi nulla ac enim in tempor turpis",724.99,39), (5488296,"Getting Back to Abnormal","in blandit ultrices enim lorem ipsum dolor sit amet consectetuer adipiscing elit proin interdum mauris non ligula pellentesque ultrices phasellus id sapien in sapien iaculis congue vivamus metus arcu",801.65,57), (9370981,"Carry on Screaming!","eleifend quam a odio in hac habitasse platea dictumst maecenas ut massa quis augue luctus tincidunt nulla mollis molestie lorem quisque ut erat curabitur gravida nisi at nibh in",192.78,51), (5570108,"Disney Sing Along Songs: Under the Sea","auctor sed tristique in tempus sit amet sem fusce consequat nulla nisl nunc nisl duis bibendum felis sed interdum venenatis turpis enim",1336.98,71), (9710969,"Seance (Kôrei)","proin at turpis a pede posuere nonummy integer non velit donec diam neque vestibulum eget",420.15,77), (5938080,"Raja","augue aliquam erat volutpat in congue etiam justo etiam pretium iaculis justo in hac habitasse platea dictumst etiam faucibus cursus urna",389.94,51), (2513184,"High Plains Drifter","nibh in hac habitasse platea dictumst aliquam augue quam sollicitudin vitae consectetuer eget rutrum at lorem integer tincidunt ante vel ipsum praesent",1433.45,32), (7917213,"Love Walked In","sapien dignissim vestibulum vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae nulla dapibus dolor vel est donec odio justo sollicitudin",13.04,13), (9046623,"Life and Times of Allen Ginsberg, The","cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus etiam vel augue vestibulum rutrum",52.18,95), (3892090,"P.S. I Love You","vulputate ut ultrices vel augue vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae donec pharetra magna vestibulum",295.32,28); /*!40000 ALTER TABLE `products` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `categories` WRITE; /*!40000 ALTER TABLE `categories` DISABLE KEYS */; INSERT INTO `categories` VALUES (5938080,"Netflix","Available on Netflix"), (2513184,"YouTube","Available on YouTube"), (7917213,"Disney+","Available on Disney+"), (9046623,"HBO+","Available on HBO+"), (3892090,"Amazon Prime","Available on Amazon Prime"); /*!40000 ALTER TABLE `categories` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `product_categories` WRITE; /*!40000 ALTER TABLE `product_categories` DISABLE KEYS */; -- (id_prod_cat, id_prod,id_cat) INSERT INTO `product_categories` VALUES (1166602,3683863,2513184), (1582175,2269042,5938080), (1532175,2269042,2513184), (1059422,3666784,5938080), (1039472,3666784,2513184), (1705308,9693458,9046623), (1705109,9693458,5938080), (1955940,3598047,3892090), (1064521,7575840,7917213), (1068521,7575840,3892090), (1652481,4174891,2513184), (1491152,4708186,5938080), (1431172,4708186,2513184), (1895261,8553708,9046623), (1895169,8553708,5938080), (1749182,4572956,5938080), (1739172,4572956,2513184), (1513095,4046209,2513184), (1250829,8322961,2513184), (1297089,5340464,5938080), (1237079,5340464,2513184), (1683418,3923051,2513184), (1633384,2875410,7917213), (1034384,2875410,3892090), (1006001,5720780,7917213), (1004001,5720780,3892090), (1299643,7961228,9046623), (1299149,7961228,5938080), (1191444,7296847,3892090), (1881219,4507336,5938080), (1831279,4507336,2513184), (1584693,7768262,5938080), (1534673,7768262,2513184), (1295928,5725335,2513184), (1809585,4627477,3892090), (1108647,4391755,2513184), (1043519,8106693,2513184), (1683311,4249016,5938080), (1633371,4249016,2513184), (1116958,8443031,2513184), (1172779,4301780,7917213), (1074779,4301780,3892090), (1327143,4806823,2513184), (1591866,3674658,9046623), (1591169,3674658,5938080), (1561058,6765613,2513184), (1915200,7683220,7917213), (1014200,7683220,3892090), (1898405,8146450,7917213), (1094405,8146450,3892090), (1719838,8520501,2513184), (1302411,9037181,2513184), (1902528,2590696,5938080), (1932578,2590696,2513184), (1568184,6130561,2513184), (1836590,8938204,5938080), (1836570,8938204,2513184), (1128696,5147599,2513184), (1603436,4481848,9046623), (1603139,4481848,5938080), (1638698,7749955,2513184), (1607888,5982424,5938080), (1637878,5982424,2513184), (1343185,9631154,5938080), (1333175,9631154,2513184), (1289941,4585585,2513184), (1898379,4887317,3892090), (1129906,9974570,7917213), (1024906,9974570,3892090), (1445337,5371291,2513184), (1280911,4964160,7917213), (1084911,4964160,3892090), (1851776,2105145,2513184), (1578892,6351071,2513184), (1456640,3091803,2513184), (1258519,6054421,2513184), (1680340,8153575,2513184), (1604326,4123287,3892090), (1093612,4757464,5938080), (1033672,4757464,2513184), (1613408,8777310,7917213), (1014408,8777310,3892090), (1785293,3836683,2513184), (1765310,9717065,2513184), (1357295,4428469,2513184), (1913142,3565583,2513184), (1629063,6948994,5938080), (1639073,6948994,2513184), (1523970,9749749,2513184), (1663681,4581077,3892090), (1782337,3691508,9046623), (1782139,3691508,5938080), (1910685,5469547,3892090), (1662654,9116933,2513184), (1669079,8416596,5938080), (1639079,8416596,2513184), (1368208,6056594,5938080), (1338278,6056594,2513184), (1604847,7909909,2513184), (1187048,5697139,2513184), (1532419,3887553,2513184), (1660754,7971339,2513184), (1560141,4436021,2513184), (1214732,8187210,7917213), (1014732,8187210,3892090), (1129464,3509054,5938080), (1139474,3509054,2513184), (1860814,3141516,5938080), (1830874,3141516,2513184), (1411848,5172415,2513184), (1776174,4217061,2513184), (1186153,2983720,7917213), (1084153,2983720,3892090), (1045630,6744077,3892090), (1223586,3497810,7917213), (1024586,3497810,3892090), (1806272,8013909,2513184), (1511839,6458478,9046623), (1511139,6458478,5938080), (1308618,9287704,5938080), (1338678,9287704,2513184), (1383577,9485069,2513184), (1514892,2172403,2513184), (1478019,5656437,3892090), (1770575,7612822,5938080), (1730575,7612822,2513184), (1245225,4057711,2513184), (1657182,6753605,2513184), (1426688,6963682,5938080), (1436678,6963682,2513184), (1138906,2102636,5938080), (1138976,2102636,2513184), (1000718,5488296,5938080), (1030778,5488296,2513184), (1132364,9370981,2513184), (1218150,5570108,9046623), (1218159,5570108,5938080), (1427418,9710969,2513184), (1467431,5938080,7917213), (1064431,5938080,3892090), (1643404,2513184,5938080), (1633474,2513184,2513184), (1890906,7917213,2513184), (1788309,9046623,2513184), (1445483,3892090,7917213), (1044483,3892090,3892090); /*!40000 ALTER TABLE `product_categories` ENABLE KEYS */; UNLOCK TABLES;
use quatros1_moodle; SELECT CONCAT(firstname,"", lastname) AS Nombre,mdl_quiz_grades.grade AS Nota FROM ((mdl_user RIGHT JOIN mdl_quiz_grades ON mdl_user.id=mdl_quiz_grades.userid) LEFT JOIN mdl_quiz ON mdl_quiz.id=mdl_quiz_grades.quiz) LEFT JOIN mdl_course ON mdl_course.id=mdl_quiz.course #---------- Lo siguiente es para que el resultado vaya para un CSV. INTO OUTFILE 'C:\\xampp\\htdocs\\MoodleImpulso\\D3_Graficas\\SVG_Circular\\Hola3.csv' FIELDS TERMINATED BY ',' #ENCLOSED BY '"' LINES TERMINATED BY '\n';
create OR REPLACE PROCEDURE T_OutReportStatitem_Uorder( outrepitemid_1 integer, upordown_1 integer, flag out integer, msg out varchar2, thecursor IN OUT cursor_define.weavercursor ) AS thedsporder integer; theoutrepid integer; begin select dsporder into thedsporder from T_OutReportStatitem where outrepitemid = outrepitemid_1; select outrepid into theoutrepid from T_OutReportStatitem where outrepitemid = outrepitemid_1; if upordown_1 = 1 then update T_OutReportStatitem set dsporder = dsporder+1 where outrepid = theoutrepid and dsporder = thedsporder-1; update T_OutReportStatitem set dsporder = dsporder-1 where outrepitemid = outrepitemid_1; else update T_OutReportStatitem set dsporder = dsporder-1 where outrepid = theoutrepid and dsporder = thedsporder+1; update T_OutReportStatitem set dsporder = dsporder+1 where outrepitemid = outrepitemid_1; end if; end; /
/* The order of definition is important lest we trip over referential and foreign key issues */ CREATE TABLE apikeys ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, apikey VARCHAR(45) NOT NULL, PRIMARY KEY (id), UNIQUE KEY (apikey) ); CREATE TABLE currencies ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, apikey VARCHAR(45) NOT NULL, symbol VARCHAR(45) NOT NULL, title VARCHAR(45) NOT NULL, PRIMARY KEY (id, apikey), UNIQUE KEY (symbol, apikey), FOREIGN KEY (apikey) REFERENCES apikeys (apikey) ); CREATE TABLE accounts ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, apikey VARCHAR(45) NOT NULL, currency_id INT UNSIGNED NOT NULL, title VARCHAR(45) NOT NULL, PRIMARY KEY (id, apikey), FOREIGN KEY (apikey) REFERENCES apikeys (apikey), FOREIGN KEY (currency_id, apikey) REFERENCES currencies (id, apikey) ); CREATE TABLE transactions ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, apikey VARCHAR(45) NOT NULL, notes TEXT NOT NULL, time VARCHAR(45) NOT NULL, PRIMARY KEY (id, apikey), FOREIGN KEY (apikey) REFERENCES apikeys (apikey) ); CREATE TABLE distributions ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, account_id INT UNSIGNED NOT NULL, amount BIGINT NOT NULL, amountbt VARCHAR(40) CHARACTER SET ascii NOT NULL, amount_exp TINYINT NOT NULL, apikey VARCHAR(45) NOT NULL, transaction_id INT UNSIGNED NOT NULL, PRIMARY KEY (id, apikey), FOREIGN KEY (account_id, apikey) REFERENCES accounts (id, apikey), FOREIGN KEY (transaction_id, apikey) REFERENCES transactions (id, apikey), CHECK( AMOUNTBT REGEXP '^-?[0-9]+$' ) ); CREATE TABLE categories ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INT UNSIGNED, apikey VARCHAR(45) NOT NULL, symbol VARCHAR(45) NOT NULL, title VARCHAR(45) NOT NULL, PRIMARY KEY (id, apikey), UNIQUE KEY (symbol, apikey), FOREIGN KEY (apikey) REFERENCES apikeys (apikey), FOREIGN KEY (parent_id) REFERENCES categories (id) ); CREATE TABLE accounts_categories ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, apikey VARCHAR(45) NOT NULL, account_id INT UNSIGNED NOT NULL, category_id INT UNSIGNED NOT NULL, PRIMARY KEY (id, apikey), UNIQUE KEY (account_id, category_id), FOREIGN KEY (apikey) REFERENCES apikeys (apikey), FOREIGN KEY (account_id, apikey) REFERENCES accounts (id, apikey), FOREIGN KEY (category_id, apikey) REFERENCES categories (id, apikey) ); CREATE TABLE transactions_categories ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, apikey VARCHAR(45) NOT NULL, transaction_id INT UNSIGNED NOT NULL, category_id INT UNSIGNED NOT NULL, PRIMARY KEY (id, apikey), UNIQUE KEY (transaction_id, category_id), FOREIGN KEY (apikey) REFERENCES apikeys (apikey), FOREIGN KEY (transaction_id, apikey) REFERENCES transactions (id, apikey), FOREIGN KEY (category_id, apikey) REFERENCES categories (id, apikey) );
ALTER TABLE `hubs_content` ADD `conditions` text;
--BOOKING SCRIPTS --CREATING THE BOOKING TABLE CREATE TABLE BOOKING( ID VARCHAR2(20) PRIMARY KEY, CUSTOMEREMAIL VARCHAR2(30), CABNUMBER VARCHAR2(20), VEHICLENAME VARCHAR2(30), PICKUP VARCHAR2(20), DROPOFF VARCHAR2(20), CHARGETYPE VARCHAR2(20), FARE NUMBER(6,0), TRIPDATE DATE, STATUS VARCHAR2(10), FOREIGN KEY (CUSTOMEREMAIL) REFERENCES TAXIUSER(EMAIL) ON DELETE CASCADE, FOREIGN KEY (CABNUMBER) REFERENCES TAXI(CABNUMBER) ON DELETE CASCADE, CONSTRAINT CHK_STATUS CHECK (STATUS IN ('CANCELLED', 'COMPLETED', 'SCHEDULED')), CONSTRAINT CHK_ROUTE CHECK (PICKUP != DROPOFF), CONSTRAINT CHK_PAYTYPE CHECK (CHARGETYPE IN ('METER', 'PACKAGE', 'OUTSERVICE')) ); --STORED PROCEDURE FOR ADDING BOOKING TO TABLE CREATE OR REPLACE PROCEDURE ADD_BOOKING(B_ID BOOKING.ID%TYPE, B_EMAIL BOOKING.CUSTOMEREMAIL%TYPE, B_CABNUMBER BOOKING.CABNUMBER%TYPE, B_VEHICLE BOOKING.VEHICLENAME%TYPE, B_PICKUP BOOKING.PICKUP%TYPE, B_DROPOFF BOOKING.DROPOFF%TYPE, B_TYPE BOOKING.CHARGETYPE%TYPE, B_FARE BOOKING.FARE%TYPE, B_DATE BOOKING.TRIPDATE%TYPE, B_STATUS BOOKING.STATUS%TYPE, RESULT OUT NUMERIC) IS BEGIN INSERT INTO BOOKING VALUES(B_ID, B_EMAIL, B_CABNUMBER, B_VEHICLE, B_PICKUP, B_DROPOFF, B_TYPE, B_FARE, B_DATE, B_STATUS); RESULT := SQL%ROWCOUNT; END ; --STORED PROCEDURE FOR REMOVING A BOOKING CREATE OR REPLACE PROCEDURE REMOVE_BOOKING(B_ID BOOKING.ID%TYPE, RESULT OUT NUMERIC) IS BEGIN DELETE FROM BOOKING WHERE ID = B_ID; RESULT := SQL%ROWCOUNT; END ; --STORED PROCEDURE FOR FINDING A BOOKING FROM TABLE CREATE OR REPLACE PROCEDURE FIND_BOOKING(B_ID BOOKING.ID%TYPE, RESULT OUT SYS_REFCURSOR) IS BEGIN OPEN RESULT FOR SELECT * FROM BOOKING WHERE ID = B_ID; END ; --STORED PROCEDURE FOR FIND ALL A USER'S BOOKINGS CREATE OR REPLACE PROCEDURE FIND_USER_BOOKINGS(B_EMAIL BOOKING.CUSTOMEREMAIL%TYPE, RESULT OUT SYS_REFCURSOR) IS BEGIN OPEN RESULT FOR SELECT * FROM BOOKING WHERE CUSTOMEREMAIL = B_EMAIL; END ;
-- extract iacs property details to otop_property record type and to property rec -- update rows if details have changed since last run -- 0.5 Leigh Ashton 4/10/99 First version -- 1.0 Leigh Ashton 1/12/99 Live version -- 2.0 Leigh Ashton 1/12/99 Version for new accom_corr link with property_reference_no from accom_detail -- 2.1 Leigh 15/2/00 Tune -- 2.2 Leigh 15/3/00 Tune! -- 2.3 Leigh 13/12/00 Untune. Remove hints -- 2.4 Leigh 2/7/01 Add order by to otop_prop cursor -- 2.5 Leigh 22/2/02 Add in dummy properties i.e. < 0 -- 2.6 Paul Butler 21/11/05 Add company_code -- 2.7 Leigh 19/12/05 tuned otop property cursor - removed season line -- 2.8 Paul Butler 22/12/05 Added company_code to select from iacs.property under dup_val_on_index -- 2.9 Leigh Ashton 24/2/06 Ignore unmapped rows from accom_correlation join - use accom_detail instead -- also added gateway code from agg_property in main cursor -- also added company code to otop_property set serveroutput on size 1000000 DECLARE v_logging boolean := TRUE; -- do you want performance logging? v_statement number :=1; v_property_Num dw.m_supplier.supp_no%TYPE; v_bkac_records_written number(9) := 0; v_bk_records_written number(9) := 0; v_rowtotal number(9) := 0; v_file_handle1 utl_file.file_type; v_file_handle2 utl_file.file_type; v_otop_count number(10); ls_ref_logfile varchar2(40); v_property_name iacs.property.property_name%TYPE; v_location_code iacs.property.location_code%TYPE; v_gateway_code iacs.property.gateway_code%TYPE; v_prop_upd_cnt number(10) :=0; v_secs number(30); v_file_log utl_file.file_type; v_ins_otop number := 0; CURSOR maincursor IS SELECT supp_nm property_name, supp_no property_Num, mrg.location_cd location_code, ag.gateway_code FROM dw.m_supplier m, dw.m_resort r, dw.m_resort_group mrg, agg_property ag WHERE r.resort_cd = m.resort_cd and mrg.resort_group_cd = r.resort_group_cd and ag.property_reference_no = m.supp_no UNION /* get dummy properties too */ select p.property_name, p.property_reference_no, c.location_code , ag.gateway_code from property p, contract c, agg_property ag where c.property_reference_no = p.property_reference_no and p.property_reference_no < 0 and c.location_code is not null and c.location_code <> '????' and exists (select null from iacs.location il where il.location_code = c.location_code) and ag.property_reference_no = c.property_reference_no ; /* have a seasonal order by to get most recent mapping last */ /* we are creating multiple rows per accom (one per season) with this data */ /* get list of all otop accoms that this property is mapped to in accom_correlation system */ /* group by to get the distinct values */ /* don't forget that an otop_accom may be mapped to more than one property because it is seasonal. Also remember that it an otop_accom may be unmapped in accom_correlation which means it will be mapped to a dummy property reference (usually 4932) BUT remember that when 4932 gets processed itself, it will create/update otop_property rows */ /* old query --too many rows produced by using accom_correlation whereas new query uses accom_Detail which gives much better picture (in a single row!) of the true link between an otop_Accom_code and property_reference_no OLD OLD OLD CURSOR otop_prop (in_prop_num number) IS SELECT c.season_type||substr(c.season_year,3,2) season, to_number(c.otop_accom_code) otop_accom_code, a.gateway_code gateway_code from contract m, accom_correlation c, accom_gateway a WHERE c.contract_version = m.contract_version AND c.contract_reference_no = m.contract_reference_no and m.property_reference_no = in_prop_num and a.season_year = c.season_year and a.season_type = c.season_type and a.otop_accom_code = c.otop_accom_code GROUP by c.season_type||substr(c.season_year,3,2) , to_number(c.otop_accom_code), a.gateway_code order by c.season_type||substr(c.season_year,3,2) desc ; */ /* loop through all accoms that are linked to that property - use accom details table. This tables link between otop_accom_code and property_ref is set by accom_correlation Note that this is going to give multiple rows per property and per season. There may be a number of accom_detail rows per property ref - this is valid. Only look at past 3 years data because we don't care about older seasons */ CURSOR otop_prop (in_prop_num number) IS /* to_char on season year so doesn't use pk which it shouldn't. It should use index on property num*/ SELECT c.season_type||substr(c.season_year,3,2) season, to_number(c.otop_accom_code) otop_accom_code from accom_detail c WHERE c.property_reference_no = in_prop_num AND to_char(c.season_year) > to_char(SYSDATE-(365*3),'yyyy') ; PROCEDURE f_log (v_null varchar2) IS BEGIN IF v_logging THEN SELECT hsecs into v_secs FROM v$timer; utl_file.put_line(v_file_log,'S:'||v_statement||' '||to_char(sysdate,'yy-mon-dd hh24:mi:ss')||' '||v_secs); END IF; END f_log; -- end function --------------------------------------------------------------------- BEGIN --------------------------------------------------------------------- v_statement :=10; ls_ref_logfile := '1proplog.txt'; --v_file_log := utl_file.fopen('/home/dw/DWLIVE/logs/hotelpayments',ls_ref_logfile,'w') ; v_file_log := utl_file.fopen('/data/hotelpayments/export',ls_ref_logfile,'w') ; f_log(null); v_statement :=15; f_log(null); FOR c1 IN maincursor LOOP v_property_num := c1.property_num; v_rowtotal := v_rowtotal + 1; v_statement :=45; f_log(null); BEGIN /* aded gateway code LA0206 */ INSERT INTO iacs.property (PROPERTY_NUM , COMPANY_CODE , -- 21/11/05 PROPERTY_NAME , LOCATION_CODE , AMENDED_DATE_TIME , AMENDED_USER_ID , AMENDED_PROCESS , APTOS_N_CODE, gateway_code ) VALUES (c1.property_num, 'FCHF', -- mainstream company code substr(c1.property_name,1,30), c1.location_code, sysdate, user, 'dw extract in2', null, c1.gateway_code ); v_bkac_records_Written := v_bkac_records_written + 1; EXCEPTION WHEN DUP_VAL_ON_INDEX THEN SELECT property_name, location_code, gateway_code INTO v_property_name, v_location_code, v_gateway_code FROM iacs.property WHERE property_num = c1.property_num and company_code = 'FCHF'; -- 22/12/05 company_code now part of primary key IF (v_property_name <> substr(c1.property_name,1,30)) OR ( v_location_code <> c1.location_code) OR (v_gateway_code <> c1.gateway_code ) THEN -- row has changed values, update row UPDATE iacs.property SET property_name = substr(c1.property_name,1,30), location_code = c1.location_code, amended_date_time = sysdate, amended_user_id = user, amended_process = 'dw extract up2', gateway_code = c1.gateway_code WHERE property_Num = c1.property_num AND company_code = 'FCHF'; -- 21/11/05 company_code now part of primary key v_prop_upd_cnt := v_prop_upd_cnt + 1; END IF; END; v_statement :=110; f_log(null); v_otop_count :=0; /* clear out existing otop_property rows in case they are mapped in error to this property */ DELETE FROM iacs.otop_property WHERE property_num = v_property_num and company_code = 'FCHF'; v_statement :=111; f_log(null); FOR o1 in otop_prop(v_property_num) LOOP v_statement :=113; f_log(null); v_otop_count := v_otop_count + 1; BEGIN INSERT INTO iacs.otop_property (otop_accom_code, season, property_num, company_code) VALUES (o1.otop_accom_code, o1.season, v_property_num, 'FCHF'); v_ins_otop := v_ins_otop + 1; EXCEPTION WHEN DUP_VAL_ON_INDEX THEN /* because of the delete first, this exception should never happen */ UPDATE iacs.otop_property SET property_num = v_property_Num WHERE otop_Accom_code = o1.otop_Accom_code AND season = o1.season and company_code = 'FCHF'; END; v_statement :=115; END LOOP; -- o1 loop v_statement :=118; f_log(null); IF v_otop_count = 0 THEN --dbms_output.put_line('No otop prop:'|| v_property_num); null; END IF; IF mod(v_rowtotal / 500,1) = 0 THEN COMMIT; END IF; f_log(null); END LOOP; -- maincursor loop v_statement :=130; f_log(null); dbms_output.put_line('End of extract at:'|| to_char(sysdate,'yyyy-mon-dd hh24:mi:ss')); dbms_output.put_line('Extracted records:'|| v_bkac_records_written||' out of '||v_rowtotal||' selected props'); dbms_output.put_line('Update property rows:'||v_prop_upd_cnt); dbms_output.put_line('Inserted otopprop rows:'||v_ins_otop); utl_file.put_line(v_file_log,'[EOF]'); utl_file.fclose(v_file_log) ; EXCEPTION when others then dbms_output.put_line('Error in statement:'||v_statement||',prop:'||v_property_num); dbms_output.put_line('SQLCODE:'||sqlcode||' SQLERRM:'||sqlerrm); END; -- main pl/sql block / COMMIT; EXIT;
INSERT INTO Produit1 (IdP, Nom, Prix) VALUES(1,'mango',45.45); SELECT * FROM Produit1; SELECT * FROM Formation.dbo.Produit1; DELETE Produit1 Where IdP=1; CREATE TABLE Magasin (CodeMagasin Varchar(30) PRIMARY KEY, Nom Varchar(30)); CREATE TABLE Client (CodeClient Varchar(20) PRIMARY KEY, Nom Varchar(30), ville Varchar(20), Dept Varchar(20)); Use Formation Go (aller vers une nouvelle base) If exists (SELECT * FROM Produit1 sysobjects WHERE TYPE=’U’ AND Name=’Produit1’) DROP table Produit1 CREATE TABLE VENTE (CodeMagasin varchar(30), CodeClient varchar(20), Qtite tinyint,prix decimal(7,3), Constraint FK_Mag FOREIGN KEY(CodeMagasin) REFERENCES Magasin(CodeMagasin), Constraint FK_CodClient FOREIGN KEY(CodeClient) REFERENCES Client(CodeClient) ALTER TABLE Employees ADD DateOfBirth datetime; ALTER TABLE Employees ADD title varchar(25) DEFAULT 'informaticien'; ALTER TABLE Employees ALTER COLUMN title varchar(35); ALTER TABLE VENTE NOCHECK CONSTRAINT [FK__VENTE__CodeClien__239E4DCF]; -----------supprimer contrainte ALTER TABLE VENTE DROP CONSTRAINT [FK__VENTE__CodeClien__239E4DCF]; -----------supprimer la table client DROP TABLE Client; QUESTION : 1) Modifier la structure de la table produit pour définir une séquence au niveau de la colonne id avec 1 comme valeur de départ de la séquence et 2 le pas 2) Insérer 5 lignes dans la table produit 3) Indiquer la valeur de @@identity 4) Supprimer les lignes de la table produit avec DELETE 5) Indiquer la valeur de @@identity 6) Insérer à nouveau une ligne dans la table produit 7) Indiquer la valeur de @@identity 8) Supprimer les lignes de la Table produit avec TRUNCATE puis insérer à nouveau une ligne dans la table produit et indiquer la valeur de @@identity SOLUTION : Drop table Produit Create Table Produit Dbcc checkident( Nomtable, reseed,100) ----------------serie 2 -----2) Sélectionner les commandes (Orders) ayant une date comprise entre le « 10/12/1996 « et le « 20/12/1996 » SELECT * FROM Orders WHERE OrderDate BETWEEN '10-12-1996' AND '20-12-1996' -----3)Sélectionner les clients qui ont passé au moins une commande ---.a)Utiliser une version avec IN SELECT * FROM Customers WHERE CustomerID IN (SELECT CustomerID FROM Orders) ----.b)Utiliser une version avec EXISTS SELECT * FROM Customers WHERE EXISTS (SELECT CustomerID FROM Orders WHERE Orders.CustomerID = Customers.CustomerID) ----.c) Utiliser une version avec une jointure SELECT DISTINCT * FROM Customers INNER JOIN Orders ON Customers.CustomerID =Orders.CustomerID ----4)Sélectionner le nombre total de clients SELECT COUNT(CustomerID) FROM Customers ----Clients qui ont commandées SELECT COUNT(CustomerID), COUNT(DISTINCT CustomerID) FROM Orders ----5)Sélectionner les clients qui n'ont passé au moins une commande --a)Utiliser une version avec NOT IN SELECT * FROM Customers WHERE CustomerID NOT IN (SELECT DISTINCT CustomerID FROM Orders) --b)Utiliser une version avec NOT EXISTS SELECT * FROM Customers WHERE NOT EXISTS (SELECT CustomerID FROM Orders WHERE Orders.CustomerID =Customers.CustomerID) ---c)Utiliser une version avec une jointure SELECT CustomerID FROM Customers SELECT * FROM Customers LEFT JOIN Orders ON Customers.CustomerID =Orders.CustomerID ----6)Dans la table Order Details de la base Northwind, donner la quantité totale commandée SELECT SUM(Quantity) FROM [Order Details] QUESTION : 1) Sélectionner les clients qui ont achetés des produits dont le prix unitaire est inferieur a 5 2) Sélectionner les clients qui ont achetés tous les produits dont le prix unitaire est inferieur a 5 3) Sélectionner les clients qui ont achetés exactement les mêmes produits que le client dont l’identifiant (CustomersID) est ALFKI 4) Reponse:
Create database CentralAutobus use CentralAutobus Create table Autobus ( Id_Autobus uniqueidentifier PRIMARY KEY NOT NULL, Marca_Autobus varchar (30), Modelo_Autobus varchar (30), Asientos_Autobus int, ) select * from Boleto Create table Boleto ( Id_Boleto uniqueidentifier PRIMARY KEY NOT NULL, Tipo_Boleto varchar (30), Id_Viaje uniqueidentifier, Nombre_Pasajero varchar (30), Id_Autobus uniqueidentifier, Precio_Boleto float, Num_Asiento varchar(20), ) Create table Chofer ( Id_Chofer uniqueidentifier PRIMARY KEY NOT NULL, Nom_Chofer varchar (30), Apellido_Paterno varchar(30), Apellido_Materno varchar(30), Edad_Chofer int, Id_Autobus uniqueidentifier, Id_Empleado uniqueidentifier, ) Create table Ciudades ( Id_Ciudad uniqueidentifier PRIMARY KEY NOT NULL, C_Nombre varchar(30), C_Estado varchar (30), P_Nombre varchar (30), ) Create table Destino ( Id_Ciudad uniqueidentifier, ) Create table Origen ( Id_Ciudad uniqueidentifier, ) Create table Precio ( Id_Precio uniqueidentifier PRIMARY KEY NOT NULL, Id_Viaje uniqueidentifier, ) Create table Rutas ( Id_Ruta uniqueidentifier PRIMARY KEY NOT NULL, Id_Destino uniqueidentifier, Id_Origen uniqueidentifier, ) create table Viaje ( Id_Viaje uniqueidentifier PRIMARY KEY NOT NULL, Id_Ruta uniqueidentifier, Fecha date, Hora time, Id_Autobus uniqueidentifier, Id_Chofer uniqueidentifier, ) select * from Autobus insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino',35) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-P',30) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-P',30) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-P',30) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-P',30) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-P',30) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-P',30) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-Premiere',40) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-Premiere',40) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-Premiere',40) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-Premiere',40) insert into Autobus values (NEWID(), 'Mercedes-Benz','Torino-Premiere',40) select * from Chofer insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Dario', 'Clemente', 'Torres', 35) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Oscar', 'Alvarado', 'Mendoza', 46) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Gilberto', 'Estrada', 'Felix', 52) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Dalia', 'Hernandez', 'Espinoza', 42) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Elizabeth', 'Balderas', 'Arriaga', 45) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Francisco', 'Banda', 'Jimenez', 32) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'María Fernanda', 'Diaz', 'Rodriguez', 39) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Rafael', 'Chong', 'Gutiérrez', 46) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Ignacio', 'Ezra', 'Escamilla', 26) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Alberto', 'Villarreal', 'Arias', 26) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Gabriel', 'Velez', 'Muro', 26) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Andrea', 'Zepeda', 'Duarte', 26) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Paola', 'Trujillo', 'Arias', 40) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Gustavo', 'Loera', 'Balleza', 35) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Armando', 'Esponda', 'Araiza', 40) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Cesar', 'Ruiz', 'Garcia', 50) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Victoria', 'Diaz', 'Pineda', 43) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Erick', 'Rofriguez', 'Vallejo', 31) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Saul', 'Ponce', 'Sanchez', 39) insert into Chofer (Id_Chofer, Nom_Chofer, Apellido_Paterno, Apellido_Materno, Edad_Chofer) values(NEWID(), 'Emilio', 'Sauceda', 'Cano', 53) select * from Chofer update Chofer set Edad_Chofer = 38 where Nom_Chofer = 'Rafael' update Chofer set Edad_Chofer = 37 where Nom_Chofer = 'Andrea' update Chofer set Edad_Chofer = 42 where Nom_Chofer = 'Gabriel' update Chofer set Edad_Chofer = 28 where Nom_Chofer = 'Alberto' update Chofer set Edad_Chofer = 37 where Nom_Chofer = 'Elizabeth' select * from Ciudades insert into Ciudades values(NEWID(), 'Monterrey', 'Nuevo Leon', 'Mexico') insert into Ciudades values(NEWID(), 'Aguascalientes', 'Aguascalientes', 'Mexico') insert into Ciudades values(NEWID(), 'Ciudad Juarez', 'Chihuahua', 'Mexico') insert into Ciudades values(NEWID(), 'Chihuahua', 'Chihuahua', 'Mexico') insert into Ciudades values(NEWID(), 'Cuatro Cienegas', 'Coahuila', 'Mexico') insert into Ciudades values(NEWID(), 'Monclova', 'Coahuila', 'Mexico') insert into Ciudades values(NEWID(), 'Saltillo', 'Coahuila', 'Mexico') insert into Ciudades values(NEWID(), 'Durango', 'Durango', 'Mexico') insert into Ciudades values(NEWID(), 'Guadalajara', 'Jalisco', 'Mexico') insert into Ciudades values(NEWID(), 'San Juan de los Lagos', 'Jalisco', 'Mexico') insert into Ciudades values(NEWID(), 'Tampico', 'Tamaulipas', 'Mexico') insert into Ciudades values(NEWID(), 'Matamoros', 'Tamaulipas', 'Mexico') insert into Ciudades values(NEWID(), 'Nuevo Laredo', 'Tamaulipas', 'Mexico') insert into Ciudades values(NEWID(), 'Reynosa', 'Tamaulipas', 'Mexico') insert into Ciudades values(NEWID(), 'Queretaro', 'Queretaro', 'Mexico') insert into Ciudades values(NEWID(), 'Mazatlan', 'Sinaloa', 'Mexico') insert into Ciudades values(NEWID(), 'San Luis Potosi', 'San Luis Potosi', 'Mexico') insert into Ciudades values(NEWID(), 'Zacatecas', 'Zacatecas', 'Mexico') insert into Ciudades values(NEWID(), 'Chicago', 'Illinois', 'Estados Unidos de America') insert into Ciudades values(NEWID(), 'Dallas', 'Texas', 'Estados Unidos de America') insert into Ciudades values(NEWID(), 'Austin', 'Texas', 'Estados Unidos de America') insert into Ciudades values(NEWID(), 'Houston', 'Texas', 'Estados Unidos de America') insert into Ciudades values(NEWID(), 'Laredo', 'Texas', 'Estados Unidos de America') insert into Ciudades values(NEWID(), 'San Antonio', 'Texas', 'Estados Unidos de America') select * from Precio ALTER TABLE Precio add Precio_Boleto float ALTER TABLE Precio add Tipo_Autobus varchar(30) insert into Precio (Id_Precio, Precio_Boleto, Tipo_Autobus) values (NEWID(), 180.00, 'Normal' ) insert into Precio (Id_Precio, Precio_Boleto, Tipo_Autobus) values (NEWID(), 150.00, 'Normal' ) insert into Precio (Id_Precio, Precio_Boleto, Tipo_Autobus) values (NEWID(), 100.00, 'Normal' ) insert into Precio (Id_Precio, Precio_Boleto, Tipo_Autobus) values (NEWID(), 250.00, 'Premiere' ) insert into Precio (Id_Precio, Precio_Boleto, Tipo_Autobus) values (NEWID(), 235.00, 'Premiere' ) insert into Precio (Id_Precio, Precio_Boleto, Tipo_Autobus) values (NEWID(), 200.00, 'Premiere' ) insert into Precio (Id_Precio, Precio_Boleto, Tipo_Autobus) values (NEWID(), 250.00, 'Plus' ) insert into Precio (Id_Precio, Precio_Boleto, Tipo_Autobus) values (NEWID(), 225.00, 'Plus' ) insert into Precio (Id_Precio, Precio_Boleto, Tipo_Autobus) values (NEWID(), 190.00, 'Plus' ) delete Precio where Id_Precio like '87%' delete Precio where Id_Precio like 'D9%' delete Precio where Id_Precio like '16%' delete Precio where Id_Precio like 'C4%' delete Precio where Id_Precio like '57%' delete Precio where Id_Precio like 'F3%'
/* * Script to populate tables for the ehotel application database, * for the CSI 2132 final project of the Winter term 2021. * * This script creates: * - 6 Hotel Chains * - 5 Hotels for each chain (3 in Ottawa) * - 5 Rooms for each Hotel * - 5 Employees * - 5 Customers (These can be created within the app) * * Section: A07 * Group: 27 */ -- Create Addresses for Hotels and Hotel Brands INSERT INTO ehotel.address (street_name, street_number, unit_number, postal_code, city, state, country) VALUES ('Matheson Boulevard East', '2425', '100', 'L4W5K4', 'Mississauga', 'Ontario', 'Canada'), -- Westin HQ ('Colonel By Drive', '11', NULL, 'K1N9H4', 'Ottawa', 'Ontario', 'Canada'), -- The Westin Ottawa ('Harbour Square', '1', NULL, 'M5J1A6', 'Toronto', 'Ontario', 'Canada'), -- The Westin Harbour Castle, Toronto ('Bayshore Drive', '1601', NULL, 'V6G2V4', 'Vancouver', 'British Columbia', 'Canada'), -- The Westin Bayshore, Vancouver ('Hollis Street', '1181', NULL, 'B3H2P6', 'Halifax', 'Nova Scotia', 'Canada'), -- The Westin Nova Scotian, Halifax ('Saint-Antoine Ouest', '270', NULL, 'H2Y0A3', 'Montreal', 'Quebec', 'Canada'), -- The Westin Montreal ('Wellington Street West', '155', NULL, 'M5V3H6', 'Toronto', 'Ontario', 'Canada'), -- Novotel HQ ('Nicholas Street', '33', NULL, 'K1N9M7', 'Ottawa', 'Ontario', 'Canada'), -- Novotel Ottawa ('The Esplanade', '45', NULL, 'M5E1W2', 'Toronto', 'Ontario', 'Canada'), -- Novotel Toronto ('Bass Pro Mills Drive', '200', NULL, 'L4K0B9', 'Concord', 'Ontario', 'Canada'), -- Novotel Vaughan ('Rue de la Montagne', '1180', NULL, 'H3G1Z1', 'Montreal', 'Quebec', 'Canada'), -- Novotel Montreal ('Boulevard Alfred Nobel', '2599', NULL, 'H4S2G1', 'Saint-Laurent', 'Quebec', 'Canada'), -- Novotel St. Laurent ('Wellington Street West', '155', '3300', 'M5V0C3', 'Toronto', 'Ontario', 'Canada'), -- Fairmont HQ ('Rideau Street', '1', NULL, 'K1N8S7', 'Ottawa', 'Ontario', 'Canada'), -- Fairmont Chateau Laurier ('Front Street West', '100', NULL, 'M5J1E3', 'Toronto', 'Ontario', 'Canada'), -- Fairmont Royal York ('Rue des Carrieres', '1', NULL, 'G1R4P5', 'Quebec City', 'Quebec', 'Canada'), -- Fairmont Le Chateau Frontenac ('Lake Lousie Drive', '111', NULL, 'T0L1E0', 'Lake Louise', 'Alberta', 'Canada'), -- Fairmont Chateau Lake Louise ('Chateau Boulevard', '4599', NULL, 'V8E0Z5', 'Whistler', 'British Columbia', 'Canada'), -- Fairmont Chateau Whistler ('Wellington Street West', '155', NULL, 'M5V3H6', 'Toronto', 'Ontario', 'Canada'), -- Delta HQ ('4th Avenue Southeast', '209', NULL, 'T2G0C6', 'Calgary', 'Alberta', 'Canada'), -- Delta Calgary ('West Hastings Street', '550', NULL, 'V6B1L6', 'Vancouver', 'British Columbia', 'Canada'), -- Delta Vancouver ('Lower Simcoe Street', '75', NULL, 'M5J3A6', 'Toronto', 'Ontario', 'Canada'), -- Delta Toronto ('President-Kennedy Avenue', '475', NULL, 'H3A1J7', 'Montreal', 'Quebec', 'Canada'), -- Delta Montreal ('Dundas Street', '325', NULL, 'N6B1T9', 'London', 'Ontario', 'Canada'), -- Delta Armouries London ('Campus Road', '5830', '200', 'L4V1G2', 'Mississauga', 'Ontario', 'Canada'), -- Hilton HQ ('Whistler Way', '4050', NULL, 'V8E1H9', 'Whistler', 'British Columbia', 'Canada'), -- Hilton Whistler ('Robson Street', '433', NULL, 'V6B6L9', 'Vancouver', 'British Columbia', 'Canada'), -- Hilton Vancouver ('Richmond Street West', '145', NULL, 'M5H2L2', 'Toronto', 'Ontario', 'Canada'), -- Hilton Toronto ('Rene Levesque East', '1100', NULL, 'G1R4P3', 'Quebec City', 'Quebec', 'Canada'), -- Hilton Quebec ('Boulevard du Casino', '3', NULL, 'J8Y6X4', 'Gatineau', 'Quebec', 'Canada'), -- Hilton Lac-Leamy ('Wellington Street West', '155', NULL, 'M5V3H6', 'Toronto', 'Ontario', 'Canada'), -- Sheraton HQ ('Rue Daniel-Johnson Ouest', '1315', NULL, 'J2S8S4', 'Saint-Hyacinthe', 'Quebec', 'Canada'), -- Sheraton Saint-Hyacinthe ('Falls Avenue', '5875', NULL, 'L2G3K7', 'Niagara Falls', 'Ontario', 'Canada'), -- Sheraton Fallsview Niagara ('Barclay Parade Southwest', '255', NULL, 'T2P5C2', 'Calgary', 'Alberta', 'Canada'), -- Sheraton Calgary Eau Claire ('Queen Street West', '123', NULL, 'M5H2M9', 'Toronto', 'Ontario', 'Canada'), -- Sheraton Toronto ('Burrard Street', '1000', NULL, 'V6Z2R9', 'Vancouver', 'British Columbia', 'Canada'), -- Sheraton Vancouver ('Main Street', '1', '1', 'A1A1A1', 'Ottawa', 'Ontario', 'Canada'), -- Customer 1 ('Rue Main', '2', '2', 'B1B1B1', 'Montreal', 'Quebec', 'Canada'), -- Customer 2 ('2nd Avenue', '3', '3', 'C1C1C1', 'Toronto', 'Ontario', 'Canada'), -- Customer 3 ('3rd Street', '4', '4', 'D1D1D1', 'Vancouver', 'British Columbia', 'Canada'), -- Customer 4 ('4th Street', '5', '5', 'E1E1E1', 'Halifax', 'Nova Scotia', 'Canada'), -- Customer 5 ('5th Avenue', '6', '6', 'F1F1F1', 'Ottawa', 'Ontario', 'Canada'), -- Employee 1 ('Rue Main', '7', '7', 'G1G1G1', 'Montreal', 'Quebec', 'Canada'), -- Employee 2 ('6th Street', '8', '8', 'H1H1H1', 'Toronto', 'Ontario', 'Canada'), -- Employee 3 ('7th Avenue', '9', '9', 'I1I1I1', 'Vancouver', 'British Columbia', 'Canada'), -- Employee 4 ('8th Avenue', '10', '10', 'J1J1J1', 'Halifax', 'Nova Scotia', 'Canada'); -- Employee 5 -- Create Hotel Brands INSERT INTO ehotel.hotel_brand (address_id, number_of_hotels, location, brand_name) VALUES (4 , 14, 'Mississauga', 'Westin Hotels and Resorts'), -- Westin Hotels and Resorts (Marriott) (10 , 6, 'Toronto', 'Novotel Hotels and Resorts'), -- Novotel Hotels (Accor) (16 , 14, 'Toronto', 'Fairmont Hotels and Resorts'), -- Fairmont HQ (22 , 39, 'Toronto', 'Delta Hotels'), -- Delta Hotels (28 , 14, 'Mississauga', 'Hilton'), -- Hilton Hotels (34 , 14, 'Mississauga', 'Sheraton Hotels'); -- Sheraton Hotels -- Create Hotel Brand Emails INSERT INTO ehotel.brand_email (brand_id, email_address) VALUES (1, 'westin@westinhotels.ca'), (2, 'novotel@novotelshotels.ca'), (3, 'fairmont@fairmonthotels.ca'), (4, 'delta@deltahotels.ca'), (5, 'hilton@hiltonhotels.ca'), (6, 'sheraton@sheratonhotels.ca'); -- Create Hotel Brand Phone Numbers INSERT INTO ehotel.brand_phone (brand_id, phone_number) VALUES (1, '4161111111'), (2, '4162222222'), (3, '4163333333'), (4, '4164444444'), (5, '4165555555'), (6, '4166666666'); -- Create Employee Accounts INSERT INTO ehotel.account (username, password, role) VALUES ('Employee1', 'password', 2), ('Employee2', 'password', 2), ('Employee3', 'password', 2), ('Employee4', 'password', 2), ('Employee5', 'password', 2); -- Create Employees INSERT INTO ehotel.employee (hotel_id, address_id, first_name, middle_initial, last_name, sin, salary, position, username) VALUES (1, 45, 'Employee', 'E1', 'One', 123456789, 50000, 'Manager', 'Employee1'), (6, 46, 'Employee', 'E2', 'Two', 123456789, 50000, 'Manager', 'Employee2'), (11, 47, 'Employee', 'E3', 'Three', 123456789, 50000, 'Manager', 'Employee3'), (16, 48, 'Employee', 'E4', 'Four', 123456789, 50000, 'Manager', 'Employee4'), (21, 49, 'Employee', 'E5', 'Five', 123456789, 50000, 'Manager', 'Employee5'); -- Create Employee Emails INSERT INTO ehotel.employee_email (employee_id, email_address) VALUES (1, 'employee1@westinhotels.ca'), (2, 'employee1@novotelshotels.ca'), (3, 'employee1@fairmonthotels.ca'), (4, 'employee1@deltahotels.ca'), (5, 'employee1@hiltonhotels.ca'); -- Create Employee Phone Numbers INSERT INTO ehotel.employee_phone (employee_id, phone_number) VALUES (1, '6131234567'), (2, '5141234567'), (3, '4161234567'), (4, '6041234567'), (5, '7821234567'); -- Create Hotels INSERT INTO ehotel.hotel (brand_id, manager_id, address_id, star_category, hotel_name) VALUES (1, NULL, 5, 4, 'The Westin Ottawa'), (1, NULL, 6, 4, 'The Westin Harbour Castle'), (1, NULL, 7, 4, 'The Westin Bayshore'), (1, NULL, 8, 4, 'The Westin Nova Scotian'), (1, NULL, 9, 4, 'The Westin Montreal'), (2, NULL, 11, 3, 'Novotel Ottawa'), (2, NULL, 12, 3, 'Novotel Toronto'), (2, NULL, 13, 3, 'Novotel Vaughan'), (2, NULL, 14, 3, 'Novotel Montreal'), (2, NULL, 15, 3, 'Novotel St. Laurent'), (3, NULL, 17, 5, 'Fairmont Chateau Laurier'), (3, NULL, 18, 5, 'Fairmont Royal York'), (3, NULL, 19, 5, 'Fairmont Le Chateau Frontenac'), (3, NULL, 20, 5, 'Fairmont Chateau Lake Louise'), (3, NULL, 21, 5, 'Fairmont Chateau Whistler'), (4, NULL, 23, 3, 'Delta Calgary'), (4, NULL, 24, 3, 'Delta Vancouver'), (4, NULL, 25, 4, 'Delta Toronto'), (4, NULL, 26, 3, 'Delta Montreal'), (4, NULL, 27, 3, 'Delta Armouries London'), (5, NULL, 29, 4, 'Hilton Whistler'), (5, NULL, 30, 4, 'Hilton Vancouver'), (5, NULL, 31, 3, 'Hilton Toronto'), (5, NULL, 32, 3, 'Hilton Quebec'), (5, NULL, 33, 4, 'Hilton Lac-Leamy'), (6, NULL, 35, 4, 'Sheraton Saint-Hyacinthe'), (6, NULL, 36, 4, 'Sheraton Fallsview Niagara'), (6, NULL, 37, 3, 'Sheraton Calgary Eau Claire'), (6, NULL, 38, 4, 'Sheraton Toronto'), (6, NULL, 39, 4, 'Sheraton Vancouver'); -- Create Hotel Emails INSERT INTO ehotel.hotel_email (hotel_id, email_address) VALUES (1, 'westinottawa@westinhotels.ca'), (2, 'westinharbourcastle@westinhotels.ca'), (3, 'westinbayshore@westinhotels.ca'), (4, 'westinnovascotian@westinhotels.ca'), (5, 'westinmontreal@westinhotels.ca'), (6, 'novotelottawa@novotelshotels.ca'), (7, 'novoteltoronto@novotelshotels.ca'), (8, 'novotelvaughan@novotelshotels.ca'), (9, 'novotelmontreal@novotelshotels.ca'), (10, 'novotelstlaurent@novotelshotels.ca'), (11, 'fairmontlaurier@fairmonthotels.ca'), (12, 'fairmontroyalyork@fairmonthotels.ca'), (13, 'fairmontfrontenac@fairmonthotels.ca'), (14, 'fairmontlakelouise@fairmonthotels.ca'), (15, 'fairmontwhistler@fairmonthotels.ca'), (16, 'deltacalgary@deltahotels.ca'), (17, 'deltavancouver@deltahotels.ca'), (18, 'deltatoronto@deltahotels.ca'), (19, 'deltamontreal@deltahotels.ca'), (20, 'deltalondon@deltahotels.ca'), (21, 'hiltonwhistler@hiltonhotels.ca'), (22, 'hiltonvancouver@hiltonhotels.ca'), (23, 'hiltontoronto@hiltonhotels.ca'), (24, 'hiltonquebec@hiltonhotels.ca'), (25, 'hiltonlacleamy@hiltonhotels.ca'), (26, 'sheratonsainthyacinthe@sheratonhotels.ca'), (27, 'sheratonfallsview@sheratonhotels.ca'), (28, 'sheratoncalgary@sheratonhotels.ca'), (29, 'sheratontoronto@sheratonhotels.ca'), (30, 'sheratonvancouver@sheratonhotels.ca'); -- Create Hotel Phone Numbers INSERT INTO ehotel.hotel_phone (hotel_id, phone_number) VALUES (1, '1234567891'), (2, '1234567891'), (3, '1234567891'), (4, '1234567891'), (5, '1234567891'), (6, '1234567891'), (7, '1234567891'), (8, '1234567891'), (9, '1234567891'), (10, '1234567891'), (11, '1234567891'), (12, '1234567891'), (13, '1234567891'), (14, '1234567891'), (15, '1234567891'), (16, '1234567891'), (17, '1234567891'), (18, '1234567891'), (19, '1234567891'), (20, '1234567891'), (21, '1234567891'), (22, '1234567891'), (23, '1234567891'), (24, '1234567891'), (25, '1234567891'), (26, '1234567891'), (27, '1234567891'), (28, '1234567891'), (29, '1234567891'), (30, '1234567891'); -- Create Customer Accounts INSERT INTO ehotel.account (username, password, role) VALUES ('Customer2', 'password', 3), ('Customer3', 'password', 3), ('Customer4', 'password', 3), ('Customer5', 'password', 3); -- Create Customers INSERT INTO ehotel.customer (address_id, first_name, middle_initial, last_name, sin, registration_date, username) VALUES (40, 'Customer', 'C2', 'Two', 123456789, '2021-04-02', 'Customer2'), (41, 'Customer', 'C3', 'Three', 123456789, '2021-04-02', 'Customer3'), (42, 'Customer', 'C4', 'Four', 123456789, '2021-04-02', 'Customer4'), (43, 'Customer', 'C5', 'Five', 123456789, '2021-04-02', 'Customer5'); -- Create Rooms INSERT INTO ehotel.room (hotel_id, price, capacity, is_sea_view, is_mountain_view, is_extendible, room_name) VALUES (1, 150, 2, FALSE, FALSE, TRUE, '1'), (1, 150, 2, FALSE, FALSE, TRUE, '2'), (1, 150, 2, FALSE, FALSE, TRUE, '3'), (1, 150, 2, FALSE, FALSE, TRUE, '4'), (1, 150, 2, FALSE, FALSE, TRUE, '5'), (2, 125, 2, FALSE, FALSE, TRUE, '1'), (2, 125, 2, FALSE, FALSE, TRUE, '2'), (2, 125, 2, FALSE, FALSE, TRUE, '3'), (2, 125, 2, FALSE, FALSE, TRUE, '4'), (2, 125, 2, FALSE, FALSE, TRUE, '5'), (3, 100, 2, FALSE, FALSE, TRUE, '1'), (3, 100, 2, FALSE, FALSE, TRUE, '2'), (3, 100, 2, FALSE, FALSE, TRUE, '3'), (3, 100, 2, FALSE, FALSE, TRUE, '4'), (3, 100, 2, FALSE, FALSE, TRUE, '5'), (4, 165, 2, FALSE, FALSE, TRUE, '1'), (4, 165, 2, FALSE, FALSE, TRUE, '2'), (4, 165, 2, FALSE, FALSE, TRUE, '3'), (4, 165, 2, FALSE, FALSE, TRUE, '4'), (4, 165, 2, FALSE, FALSE, TRUE, '5'), (5, 125, 2, TRUE, FALSE, TRUE, '1'), (5, 125, 2, TRUE, FALSE, TRUE, '2'), (5, 125, 2, TRUE, FALSE, TRUE, '3'), (5, 125, 2, TRUE, FALSE, TRUE, '4'), (5, 125, 2, TRUE, FALSE, TRUE, '5'), (6, 95, 2, FALSE, FALSE, TRUE, '1'), (6, 95, 2, FALSE, FALSE, TRUE, '2'), (6, 95, 2, FALSE, FALSE, TRUE, '3'), (6, 95, 2, FALSE, FALSE, TRUE, '4'), (6, 95, 2, FALSE, FALSE, TRUE, '5'), (7, 95, 2, FALSE, FALSE, TRUE, '1'), (7, 95, 2, FALSE, FALSE, TRUE, '2'), (7, 95, 2, FALSE, FALSE, TRUE, '3'), (7, 95, 2, FALSE, FALSE, TRUE, '4'), (7, 95, 2, FALSE, FALSE, TRUE, '5'), (8, 95, 2, FALSE, FALSE, TRUE, '1'), (8, 95, 2, FALSE, FALSE, TRUE, '2'), (8, 95, 2, FALSE, FALSE, TRUE, '3'), (8, 95, 2, FALSE, FALSE, TRUE, '4'), (8, 95, 2, FALSE, FALSE, TRUE, '5'), (9, 95, 2, FALSE, FALSE, TRUE, '1'), (9, 95, 2, FALSE, FALSE, TRUE, '2'), (9, 95, 2, FALSE, FALSE, TRUE, '3'), (9, 95, 2, FALSE, FALSE, TRUE, '4'), (9, 95, 2, FALSE, FALSE, TRUE, '5'), (10, 95, 2, FALSE, FALSE, TRUE, '1'), (10, 95, 2, FALSE, FALSE, TRUE, '2'), (10, 95, 2, FALSE, FALSE, TRUE, '3'), (10, 95, 2, FALSE, FALSE, TRUE, '4'), (10, 95, 2, FALSE, FALSE, TRUE, '5'), (11, 300, 2, FALSE, FALSE, TRUE, '1'), (11, 350, 2, FALSE, FALSE, TRUE, '2'), (11, 325, 2, FALSE, FALSE, TRUE, '3'), (11, 300, 2, FALSE, FALSE, TRUE, '4'), (11, 300, 2, FALSE, FALSE, TRUE, '5'), (12, 325, 2, FALSE, FALSE, TRUE, '1'), (12, 325, 2, FALSE, FALSE, TRUE, '2'), (12, 325, 2, FALSE, FALSE, TRUE, '3'), (12, 325, 2, FALSE, FALSE, TRUE, '4'), (12, 325, 2, FALSE, FALSE, TRUE, '5'), (13, 350, 2, FALSE, FALSE, TRUE, '1'), (13, 350, 2, FALSE, FALSE, TRUE, '2'), (13, 350, 2, FALSE, FALSE, TRUE, '3'), (13, 350, 2, FALSE, FALSE, TRUE, '4'), (13, 350, 2, FALSE, FALSE, TRUE, '5'), (14, 300, 2, FALSE, FALSE, TRUE, '1'), (14, 300, 2, FALSE, FALSE, TRUE, '2'), (14, 300, 2, FALSE, FALSE, TRUE, '3'), (14, 300, 2, FALSE, FALSE, TRUE, '4'), (14, 300, 2, FALSE, FALSE, TRUE, '5'), (15, 300, 2, FALSE, FALSE, TRUE, '1'), (15, 300, 2, FALSE, FALSE, TRUE, '2'), (15, 300, 2, FALSE, FALSE, TRUE, '3'), (15, 300, 2, FALSE, FALSE, TRUE, '4'), (15, 300, 2, FALSE, FALSE, TRUE, '5'), (16, 150, 2, FALSE, FALSE, TRUE, '1'), (16, 150, 2, FALSE, FALSE, TRUE, '2'), (16, 150, 2, FALSE, FALSE, TRUE, '3'), (16, 150, 2, FALSE, FALSE, TRUE, '4'), (16, 150, 2, FALSE, FALSE, TRUE, '5'), (17, 150, 2, FALSE, FALSE, TRUE, '1'), (17, 150, 2, FALSE, FALSE, TRUE, '2'), (17, 150, 2, FALSE, FALSE, TRUE, '3'), (17, 150, 2, FALSE, FALSE, TRUE, '4'), (17, 150, 2, FALSE, FALSE, TRUE, '5'), (18, 150, 2, FALSE, FALSE, TRUE, '1'), (18, 150, 2, FALSE, FALSE, TRUE, '2'), (18, 150, 2, FALSE, FALSE, TRUE, '3'), (18, 150, 2, FALSE, FALSE, TRUE, '4'), (18, 150, 2, FALSE, FALSE, TRUE, '5'), (19, 150, 2, FALSE, FALSE, TRUE, '1'), (19, 150, 2, FALSE, FALSE, TRUE, '2'), (19, 150, 2, FALSE, FALSE, TRUE, '3'), (19, 150, 2, FALSE, FALSE, TRUE, '4'), (19, 150, 2, FALSE, FALSE, TRUE, '5'), (20, 150, 2, FALSE, FALSE, TRUE, '1'), (20, 150, 2, FALSE, FALSE, TRUE, '2'), (20, 150, 2, FALSE, FALSE, TRUE, '3'), (20, 150, 2, FALSE, FALSE, TRUE, '4'), (20, 150, 2, FALSE, FALSE, TRUE, '5'), (21, 200, 2, FALSE, FALSE, TRUE, '1'), (21, 200, 2, FALSE, FALSE, TRUE, '2'), (21, 200, 2, FALSE, FALSE, TRUE, '3'), (21, 200, 2, FALSE, FALSE, TRUE, '4'), (21, 200, 2, FALSE, FALSE, TRUE, '5'), (22, 200, 2, FALSE, FALSE, TRUE, '1'), (22, 200, 2, FALSE, FALSE, TRUE, '2'), (22, 200, 2, FALSE, FALSE, TRUE, '3'), (22, 200, 2, FALSE, FALSE, TRUE, '4'), (22, 200, 2, FALSE, FALSE, TRUE, '5'), (23, 200, 2, FALSE, FALSE, TRUE, '1'), (23, 200, 2, FALSE, FALSE, TRUE, '2'), (23, 200, 2, FALSE, FALSE, TRUE, '3'), (23, 200, 2, FALSE, FALSE, TRUE, '4'), (23, 200, 2, FALSE, FALSE, TRUE, '5'), (24, 200, 2, FALSE, FALSE, TRUE, '1'), (24, 200, 2, FALSE, FALSE, TRUE, '2'), (24, 200, 2, FALSE, FALSE, TRUE, '3'), (24, 200, 2, FALSE, FALSE, TRUE, '4'), (24, 200, 2, FALSE, FALSE, TRUE, '5'), (25, 200, 2, FALSE, FALSE, TRUE, '1'), (25, 200, 2, FALSE, FALSE, TRUE, '2'), (25, 200, 2, FALSE, FALSE, TRUE, '3'), (25, 200, 2, FALSE, FALSE, TRUE, '4'), (25, 200, 2, FALSE, FALSE, TRUE, '5'), (26, 200, 2, FALSE, FALSE, TRUE, '1'), (26, 200, 2, FALSE, FALSE, TRUE, '2'), (26, 200, 2, FALSE, FALSE, TRUE, '3'), (26, 200, 2, FALSE, FALSE, TRUE, '4'), (26, 200, 2, FALSE, FALSE, TRUE, '5'), (27, 200, 2, FALSE, FALSE, TRUE, '1'), (27, 200, 2, FALSE, FALSE, TRUE, '2'), (27, 200, 2, FALSE, FALSE, TRUE, '3'), (27, 200, 2, FALSE, FALSE, TRUE, '4'), (27, 200, 2, FALSE, FALSE, TRUE, '5'), (28, 200, 2, FALSE, FALSE, TRUE, '1'), (28, 200, 2, FALSE, FALSE, TRUE, '2'), (28, 200, 2, FALSE, FALSE, TRUE, '3'), (28, 200, 2, FALSE, FALSE, TRUE, '4'), (28, 200, 2, FALSE, FALSE, TRUE, '5'), (29, 200, 2, FALSE, FALSE, TRUE, '1'), (29, 200, 2, FALSE, FALSE, TRUE, '2'), (29, 200, 2, FALSE, FALSE, TRUE, '3'), (29, 200, 2, FALSE, FALSE, TRUE, '4'), (29, 200, 2, FALSE, FALSE, TRUE, '5'), (30, 200, 2, FALSE, FALSE, TRUE, '1'), (30, 200, 2, FALSE, FALSE, TRUE, '2'), (30, 200, 2, FALSE, FALSE, TRUE, '3'), (30, 200, 2, FALSE, FALSE, TRUE, '4'), (30, 200, 2, FALSE, FALSE, TRUE, '5');
SELECT * FROM KNOWLEDGE_ITEM_VALUES WHERE ITEM_NO = ? AND KNOWLEDGE_ID = ? AND TYPE_ID = ? ;
truncate table samplingorder cascade ; truncate table customer cascade ; truncate table user_in_role cascade ; truncate table appuser cascade ; truncate table role cascade ; start TRANSACTION ; insert into appuser (id, email) values (1, 'foo@bar.com'); insert into role (id, name) values (1, 'admin'); insert into user_in_role (userid, roleid) values (1, 1); insert into customer (id, version, user_id) values (1, 1, 1); insert into samplingorder (id, note, customerid) values (1, 'asdasd', 1); commit;
/*Project 2 */ /*Question 1A*/ /*Create Customer Table*/ CREATE TABLE Customer( CustomerID INTEGER, CustomerName CHAR(100), CustomerAddress CHAR(100), CustomerCity CHAR(100), CustomerState CHAR(100), CustomerPostalCode CHAR(100), CustomerEmail CHAR(100), CustomerUsername CHAR(100), CustomerPassword CHAR(100), PRIMARY KEY (CustomerID) ); /*Create Territory Table */ CREATE TABLE Territory( TerritoryID INTEGER, TerritoryName CHAR(100), PRIMARY KEY (TerritoryID) ); /*Create Salesperson Table */ CREATE TABLE Salesperson( SalespersonID INTEGER, SalespersonName CHAR(100), SalespersonTelephone CHAR(100), SalespersonEmail CHAR(100), SalespersonUsername CHAR(100), SalespersonPassword CHAR(100), TerritoryID INTEGER, PRIMARY KEY(SalespersonID), FOREIGN KEY(TerritoryID) REFERENCES Territory(TerritoryID) ); /*Create DoesBusinessIn Table*/ CREATE TABLE DoesBusinessIn( CustomerID INTEGER, TerritoryID INTEGER, PRIMARY KEY (CustomerID, TerritoryID), FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID), FOREIGN KEY (TerritoryID) REFERENCES Territory(TerritoryID) ); /*Create Orders Table*/ CREATE TABLE Orders( OrderID INTEGER, OrderDate CHAR(15), CustomerID INTEGER, PRIMARY KEY (OrderID), FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID) ); /*Create Product Line Table*/ CREATE TABLE ProductLine( ProductLineID INTEGER, ProductLineName CHAR(100), PRIMARY KEY (ProductLineID) ); /*Create Product Table*/ CREATE TABLE Product( ProductID INTEGER, ProductName CHAR(100), ProductFinish CHAR(100), ProductStandardPrice INTEGER, ProductLineID INTEGER, Photo CHAR(100), PRIMARY KEY (ProductID), FOREIGN KEY (ProductLineID) REFERENCES ProductLine(ProductLineID) ); /*Create Orderline Table*/ CREATE TABLE OrderLine( OrderID INTEGER, ProductID INTEGER, OrderedQuantity INTEGER, PRIMARY KEY (OrderID, ProductID), FOREIGN KEY (OrderID) REFERENCES Orders(OrderID), FOREIGN KEY (ProductID) REFERENCES Product(ProductID) ); /*Create PriceUpdate Table*/ CREATE TABLE PriceUpdate( PriceUpdateID NUMBER GENERATED ALWAYS AS IDENTITY, DateChanged DATE, OldPrice DECIMAL(30,2), NewPrice DECIMAL(30,2), PRIMARY KEY (PriceUpdateID) ); /*Create View ProductLineSales*/ CREATE VIEW ProductLineSales(ProductLineName, TotalSales) AS SELECT L.ProductLineName, SUM(P.ProductStandardPrice) FROM ProductLine L, Product P WHERE L.ProductLineID = P.ProductLineID GROUP BY L.ProductLineID, L.ProductLineName ; /*Create View TotalValueForProducts*/ CREATE VIEW TotalValueForProducts(ProductName, TotalValue) AS SELECT P.ProductName, SUM(P.ProductStandardPrice * O.OrderedQuantity) FROM Product P, OrderLine O WHERE P.ProductID = O.ProductID GROUP BY P.ProductName ; /*Create DataForCustomer*/ CREATE VIEW DataForCustomer(Territory, Customer, Product, Price) AS SELECT T.TerritoryName, C.CustomerName, P.ProductName, P.ProductStandardPrice FROM Territory T, DoesBusinessIn B, Customer C, Orders O, OrderLine L, Product P WHERE T.TerritoryID = B.TerritoryID AND B.CustomerID = C.CustomerID AND C.CustomerID = O.CustomerID AND O.OrderID = L.OrderID AND L.ProductID = P.ProductID ORDER BY T.TerritoryName; /*Create CustomerByStates*/ CREATE VIEW CustomerByStates(CustomerState, COUNT) AS SELECT C.CustomerState, COUNT(*) FROM Customer C GROUP BY C.CustomerState; /*Create View PastPurchaseHistory*/ CREATE VIEW PastPurchaseHistory(Customer,OrderDate,Quantity,Price,Product) AS SELECT C.CustomerName, O.OrderDate, L.OrderedQuantity, P.ProductStandardPrice, P.ProductName FROM Customer C, Orders O, OrderLine L, Product P WHERE C.CustomerID = O.CustomerID AND O.OrderID = L.OrderID AND L.ProductID = P.ProductID; /*Project 2 Question 2*/ /*insert customer info*/ INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(1, 'Contemporary Casuals', '1355 S Hines Blvd', 'Gainesville', 'FL', '32601-2871'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(2, 'Value Furnitures', '15145 S.W. 17th St.', 'Plano', 'TX', '75094-7734'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(3, 'Home Furnishings', '1900 Allard Ave', 'Albany', 'NY', '12209-1125'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(4, 'Eastern Furniture', '1925 Beltline Rd.', 'Carteret', 'NJ', '07008-3188'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(5, 'Impressions', '5585 Westcott Ct.', 'Sacramento', 'CA', '94206-4056'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(6, 'Furniture Gallery', '325 Flatiron Dr.', 'Boulder', 'CO', '80514-4432'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(7, 'New Furniture', 'Palace Ave', 'Farmington', 'NM', ''); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(8, 'Dunkins Furniture', '7700 Main St', 'Syracuse', 'NY', '31590'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(9, 'A Carpet', '434 Abe Dr', 'Rome', 'NY', '13440'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(12, 'Flanigan Furniture', 'Snow Flake Rd', 'Ft Walton Beach', 'FL', '32548'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(13, 'Ikards', '1011 S. Main St', 'Las Cruces', 'NM', '88001'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(14, 'Wild Bills', 'Four Horse Rd', 'Oak Brook', 'Il', '60522'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(15, 'Janets Collection', 'Janet Lane', 'Virginia Beach', 'VA', '10012'); INSERT INTO Customer(CustomerID,CustomerName, CustomerAddress,CustomerCity,CustomerState,CustomerPostalCode) VALUES(16, 'ABC Furniture Co.', '152 Geramino Drive', 'Rome', 'NY', '13440'); UPDATE Customer SET CustomerEmail= 'ContemporaryCasuals@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=1; SET CustomerEmail= 'ValueFurnitures@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=2; UPDATE Customer SET CustomerEmail= 'HomeFurnishings@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=3; UPDATE Customer SET CustomerEmail= 'EasternFurniture@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=4; UPDATE Customer SET CustomerEmail= 'Impressions@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=5; UPDATE Customer SET CustomerEmail= 'FurnitureGallery@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=6; UPDATE Customer SET CustomerEmail= 'NewFurniture@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=7; UPDATE Customer SET CustomerEmail= 'DunkinsFurniture@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=8; UPDATE Customer SET CustomerEmail= 'ACarpet@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=9; UPDATE Customer SET CustomerEmail= 'FlaniganFurniture@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=12; UPDATE Customer SET CustomerEmail= 'Ikards@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=13; UPDATE Customer SET CustomerEmail= 'WildBillS@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=14; UPDATE Customer SET CustomerEmail= 'JanetsCollection@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=15; UPDATE Customer SET CustomerEmail= 'ABCFurnitureCo@gmail.com', CustomerUsername='CUSTOMER1', CustomerPassword='CUSTOMER1#' WHERE CustomerID=16; /*end of customer insert*/ /*Territory insert*/ INSERT INTO Territory(TerritoryID,TerritoryName) VALUES(1, 'SouthEast'); INSERT INTO Territory(TerritoryID,TerritoryName) VALUES(2, 'SouthWest'); INSERT INTO Territory(TerritoryID,TerritoryName) VALUES(3, 'NorthEast'); INSERT INTO Territory(TerritoryID,TerritoryName) VALUES(4, 'NorthWest'); INSERT INTO Territory(TerritoryID,TerritoryName) VALUES(5, 'Central'); /*end of insert Territory*/ /*insert sales person*/ INSERT INTO Salesperson(SalespersonID,SalespersonName,SalespersonTelephone,SalespersonEmail,SalespersonUsername,SalespersonPassword,TerritoryID) VALUES(1, 'Doug Henny', '8134445555', 'doughenry@gmail.com', 'SALESPERSON', 'SALESPERSON1',1); INSERT INTO Salesperson(SalespersonID,SalespersonName,SalespersonTelephone,SalespersonEmail,SalespersonUsername,SalespersonPassword,TerritoryID) VALUES(2, 'Robert Lewis', '8139264006', 'robertlewis@gmail.com', 'SALESPERSON', 'SALESPERSON2', 2); INSERT INTO Salesperson(SalespersonID,SalespersonName,SalespersonTelephone,SalespersonEmail,SalespersonUsername,SalespersonPassword,TerritoryID) VALUES(3, 'William Strong', '5053821212', 'williamstrong@gmail.com', 'SALESPERSON', 'SALESPERSON3', 3); INSERT INTO Salesperson(SalespersonID,SalespersonName,SalespersonTelephone,SalespersonEmail,SalespersonUsername,SalespersonPassword,TerritoryID) VALUES(4, 'Julie Dawson', '4355346677', 'juliewilson@gmail.com', 'SALESPERSON', 'SALESPERSON4', 4); INSERT INTO Salesperson(SalespersonID,SalespersonName,SalespersonTelephone,SalespersonEmail,SalespersonUsername,SalespersonPassword,TerritoryID) VALUES(5, 'Jacob Winslow', '2238973498', 'jacobwinslow@gmail.com', 'SALESPERSON', 'SALESPERSON5', 5); /*end of insert Salesperson*/ /*insert DoBusinessIn*/ INSERT INTO DoesBusinessIn(CustomerID, TerritoryID) VALUES(1, 1); INSERT INTO DoesBusinessIn(CustomerID, TerritoryID) VALUES(2, 2); INSERT INTO DoesBusinessIn(CustomerID, TerritoryID) VALUES(3, 3); INSERT INTO DoesBusinessIn(CustomerID, TerritoryID) VALUES(4, 4); INSERT INTO DoesBusinessIn(CustomerID, TerritoryID) VALUES(5, 5); INSERT INTO DoesBusinessIn(CustomerID,TerritoryID) VALUES(6,1); INSERT INTO DoesBusinessIn(CustomerID, TerritoryID) VALUES(7,2); /*end of DoBusiness*/ /*insert Orders*/ INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1001, '21/Aug/16', 1); INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1002, '21/Jul/16', 8); INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1003, '22/ Aug/16', 15); INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1004, '22/Oct/16', 5); INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1005, '24/Jul/16', 3); INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1006, '24/Oct/16', 2); INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1007, '27/ Aug/16', 5); INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1008, '30/Oct/16', 12); INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1009, '05/Nov/16', 4); INSERT INTO Orders(OrderID,OrderDate,CustomerID) VALUES(1010, '05/Nov/16', 1); /*End Orders*/ /*Insert Into ProductLine*/ INSERT INTO ProductLine(ProductLineID, ProductLineName) VALUES(1,'Cherry Tree'); INSERT INTO ProductLine(ProductLineID, ProductLineName) VALUES(2,'Scandinavia'); INSERT INTO ProductLine(ProductLineID, ProductLineName) VALUES(3,'Country Look'); /* end Insert Into ProductLine*/ /*Insert Into Product*/ INSERT INTO Product(ProductID, ProductName, ProductFinish, ProductStandardPrice, ProductLineID, Photo) VALUES(1, 'End Table', 'Cherry', 175, 1, 'table.jpg'); INSERT INTO Product(ProductID, ProductName, ProductFinish, ProductStandardPrice, ProductLineID, Photo) VALUES(2, 'Coffee Table', 'Natural Ash', 200, 2,'table.jpg'); INSERT INTO Product(ProductID, ProductName, ProductFinish, ProductStandardPrice, ProductLineID, Photo) VALUES(3, 'Computer Desk', 'Natural Ash', 375, 2,'table.jpg'); INSERT INTO Product(ProductID, ProductName, ProductFinish, ProductStandardPrice, ProductLineID, Photo) VALUES(4, 'Entertainment Center', 'Natural Maple', 650, 3,'table.jpg'); INSERT INTO Product(ProductID, ProductName, ProductFinish, ProductStandardPrice, ProductLineID, Photo) VALUES(5, 'Writers Desk', 'Cherry', 325, 1,'table.jpg'); INSERT INTO Product(ProductID, ProductName, ProductFinish, ProductStandardPrice, ProductLineID, Photo) VALUES(6, '8-Drawer Desk', 'White Ash', 750, 2,'table.jpg'); INSERT INTO Product(ProductID, ProductName, ProductFinish, ProductStandardPrice, ProductLineID, Photo) VALUES(7, 'Dining Table', 'Natural Ash', 800, 2,'table.jpg'); INSERT INTO Product(ProductID, ProductName, ProductFinish, ProductStandardPrice, ProductLineID, Photo) VALUES(8, 'Computer Desk', 'Walnut', 250, 3,'table.jpg'); /*end Insert Into Product*/ /*insert orderline*/ INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1001, 1, 2); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1001, 2, 2); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1001, 4, 1); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1002, 3, 5); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1003, 3, 3); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1004, 6, 2); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1004, 8, 2); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1005, 4, 4); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1006, 4, 1); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1006, 5, 2); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1006, 7, 2); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1007, 1, 3); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1007, 2, 2); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1008, 3, 3); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1008, 8, 3); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1009, 4, 2); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1009, 7, 3); INSERT INTO OrderLine(OrderID,ProductID,OrderedQuantity) VALUES(1010, 8, 10); /*end Orderline*/ /*Project 2 Question 3*/ /*Question 1 Which products have a standard price of less than $ 275? ProductName ProductStandardPrice End Table 175 Coffee Table 200 Computer Desk 250 */ SELECT ProductName, ProductStandardPrice FROM Product WHERE ProductStandardPrice < 275; /*Question 2 List the unit price, product name, and product ID for all products in the Product table. ProductStandardPrice ProductName ProductID 175 End Table 1 200 Coffee Table 2 375 Computer Desk 3 650 Entertainment Center 4 325 Writers Desk 5 750 8-Drawer Desk 6 800 Dining Table 7 250 Computer Desk 8 */ SELECT ProductStandardPrice, ProductName, ProductID FROM Product; /*Question 3 What is the average standard price for all products in inventory? AVG(ProductStandardPrice) 440.625 */ SELECT AVG(ProductStandardPrice) FROM Product; /*Question 4 How many different items were ordered on order number 1004? COUNT(ProductID) 2 */ SELECT COUNT(ProductID) FROM Orderline WHERE OrderID = 1004; /*Question 5 Which orders have been placed since 10/24/2010? OrderID 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 */ SELECT OrderID FROM Orders WHERE OrderDate > '10/24/2010'; /*Question 6 What furniture does COSC3380 carry that isn’t made of cherry? ProductName Coffee Table Computer Desk Entertainment Center 8-Drawer Desk Dining Table Computer Desk */ SELECT ProductName FROM Product WHERE ProductFinish != 'Cherry'; /*Question 7 List product name, finish, and standard price for all desks and all tables that cost more than $ 300 in the Product table. ProductName ProductFinish ProductStandardPrice Computer Desk Natural Ash 375 Writers Desk Cherry 325 8-Drawer Desk White Ash 750 Dining Table Natural Ash 800 */ SELECT ProductName, ProductFinish, ProductStandardPrice FROM Product WHERE ProductStandardPrice > 300 AND (P.ProductName LIKE '%Table%' OR P.ProductName LIKE '%Desk%'); /*Question 8 Which products in the Product table have a standard price between $ 200 and $ 300? ProductName Coffee Table Computer Name */ SELECT ProductName FROM Product WHERE ProductStandardPrice BETWEEN 200 AND 300; /*Question 9 List customer, city, and state for all customers in the Customer table whose address is Florida, Texas, California, or Hawaii. List the customers alphabetically by state and alphabetically by customer within each state. CustomerName CustomerCity CustomerState Impressions Sacramento CA Contemporary Casuals Gainesville FL Flanigan Furniture Ft Walton Beach FL Value Furnitures Plano TX */ SELECT CustomerName, CustomerCity, CustomerState FROM Customer WHERE CustomerState = 'FL' OR CustomerState = 'TX' OR CustomerState = 'CA' OR CustomerState = 'HI' ORDER BY CustomerState, CustomerName; /*Question 10 Count the number of customers with addresses in each state to which we ship. CustomerState COUNT(CustomerAddress) CA 1 CO 1 FL 2 IL 1 NJ 1 NM 2 NY 4 TX 1 VA 1 */ SELECT CustomerState, COUNT(CustomerAddress) FROM Customer GROUP BY CustomerState ORDER BY CustomerState; /*Question 11 Count the number of customers with addresses in each city to which we ship. List the cities by state. CustomerCity COUNT(CustomerAddress) Sacramento 1 Boulder 1 Ft Walton Beach 1 Gainesville 1 Oak Brook 1 Carteret 1 Farmington 1 Las Cruces 1 Albany 1 Rome 2 Syracuse 1 Plano 1 Virginia Beach 1 */ SELECT C.CustomerCity, COUNT(C.CustomerAddress) FROM Customer C GROUP BY C.CustomerCity, C.CustomerState ORDER BY C.CustomerState; /*Question 12 Find only states with more than one customer. CustomerState FL NM NY */ SELECT CustomerState FROM Customer GROUP BY CustomerState HAVING COUNT(CustomerState) > 1; /*Question 13 List, in alphabetical order, the product finish and the average standard price for each finish for selected finishes having an average standard price less than 750. ProductFinish AVG(P.ProductStandardPrice) Cherry 250 Natural Ash 458.333(continuous float point number) Natural Maple 650 Walnut 250 */ SELECT ProductFinish, AVG(ProductStandardPrice) FROM Product GROUP BY ProductFinish HAVING AVG(ProductStandardPrice) < 750 ORDER BY ProductFinish; /*Question 14 What is the total value of orders placed for each furniture product? ProductName SUM(ProductStandardPrice) 8-Drawer Desk 1500 End Table 875 Dining Table 4000 Entertainment Center 5200 Coffee Table 800 Writers Desk 650 Computer Desk 7875 */ SELECT P.ProductName, SUM(P.ProductStandardPrice*O.OrderedQuantity) FROM Product P, Orderline O WHERE P.ProductID = O.ProductID GROUP BY P.ProductName;
/** * @file consulta-basica.sql * @version 1.0 * @author Linea de Codigo (http://lineadecodigo.com) * @date 5-febrero-2013 * @url http://lineadecodigo.com/sql/insertar-parte-de-los-campos-en-sql/ * @description Insertar elementos con SQL */ insert into libros (isbn,titulo) values ('970-26-0518-0','Cómo Programar en Java')
-- 21/08/2019 -- BlazonRequestSodApprovalTask create table BlazonRequestSodApprovalTask ( justification varchar(1000), id bigint not null, request_id bigint, primary key (id) ) ENGINE=InnoDB; alter table BlazonRequestSodApprovalTask add constraint FK58jvihdng5v6oh44mt4k3sdl2 foreign key (request_id) references BlazonRequest (id); alter table BlazonRequestSodApprovalTask add constraint FKaxsoqba6brt377y608jyceg6v foreign key (id) references Task (id);
SELECT CAST(waterLevel AS float) AS waterLevel INTO outputpowerbi FROM inputiothub
use etldb; CREATE TABLE IF NOT EXISTS subsriber_history( CALL_ORIGINATING_NUMBER STRING ,FIRST_CALL_START_DATE STRING ,LAST_CALL_START_DATE STRING ) STORED AS ORC; insert into subsriber_history select CALL_ORIGINATING_NUMBER, min(TO_DATE(FROM_UNIXTIME(UNIX_TIMESTAMP(CALL_START_DATE, 'yyyy-MM-dd')))), max(TO_DATE(FROM_UNIXTIME(UNIX_TIMESTAMP(CALL_START_DATE, 'yyyy-MM-dd')))) from mno_cdr_data_cleansed group by CALL_ORIGINATING_NUMBER ; use etldb; CREATE TABLE IF NOT EXISTS Active_subsriber_history( CALL_ORIGINATING_NUMBER STRING ,FIRST_CALL_START_DATE STRING ,LAST_CALL_START_DATE STRING ,Active_subs STRING ) STORED AS ORC; insert into Active_subsriber_history select CALL_ORIGINATING_NUMBER,FIRST_CALL_START_DATE,LAST_CALL_START_DATE, case when LAST_CALL_START_DATE > '2018-01-31' THEN 'Y' ELSE 'N' END as active_ind from subsriber_history ; CREATE TABLE IF NOT EXISTS active_cdr( USAGE_TYPE_NAME STRING ,CALL_ORIGINATING_NUMBER STRING ,CALL_TERMINATING_NUMBER STRING ,CALL_START_DATE STRING ,CALL_START_TIME STRING ,Duration String ,LAC_ID STRING ,CELL_ID STRING) COMMENT 'active cdr' STORED AS ORC; insert into active_cdr select a.* from mno_cdr_data_cleansed a inner join Active_subsriber_history b on a.CALL_ORIGINATING_NUMBER = b.CALL_ORIGINATING_NUMBER and b.Active_subs ='Y' ;
-- this assumes the database dating_app already exists and we're running -- in a connection alreading using it. /* not finished */ INSERT INTO Users (username, email, aboutMe, firstName, lastName, age, gender, hobbies, password) values('SomeGuy1', 'someguy1@gmail.com', 'I do things', 'Some', 'Guy', 20, 'Male', 'doing stuff', 'password1234'), ('SomeGal1', 'somegal1@gmail.com', 'I do more things', 'Some', 'Gal', 22, 'Female', 'doing all stuff', 'password555'), ('SomeGal2', 'somegal2@gmail.com', 'I do all things', 'Some', 'Gal', 29, 'Female', 'doing more things', 'password111'); -- The password for yetanotherguy is a salted&encrypted 'password1234' INSERT INTO Users (username, isDeveloper, email, aboutMe, firstName, lastName, age, gender, hobbies, password) values('yetanotherguy', 1, 'yetanotherguy@gmail.com', 'blahblahblah', 'Another', 'Guy', 1234, 'Male', 'picking my bellybutton and sniffing it', '$2a$10$hu2/j4Iyyp7MTs52B3XuVO3TzujkeJFjPSy8YFklChaejUJc1YYJ6'); INSERT INTO Messages (subject, body, sendingUserId, receivingUserId) values('subject1', 'This is the first message', 'SomeGuy1', 'SomeGal1'), ('subject2', 'This is the second message', 'SomeGuy1', 'SomeGal1'), ('subject3', 'This is the third message', 'SomeGal1', 'SomeGuy1'), ('subject4', 'This is the fourth message', 'SomeGuy1', 'SomeGal1'), ('subject5', 'This is the fourth message', 'SomeGuy1', 'SomeGal2'); INSERT INTO Addresses (street, city, state, postalCode, user_id) values('111','Seattle', 'WA', '98118', 'SomeGuy1'), ('222','Seattle', 'WA', '98119', 'SomeGal1'), ('333','Everett', 'WA', '98120', 'SomeGal2'); INSERT INTO Photos (description, attachment, user_id) values('doing things', 'iAmABlob1', 'SomeGuy1'), ('doing things too', 'iAmABlob2', 'SomeGuy1'), ('Not doing stuff', 'iAmABlob3', 'SomeGuy1'), ('doing less', 'iAmABlob4', 'SomeGal1'), ('sitting', 'iAmABlob5', 'SomeGal1'), ('standing', 'iAmABlob6', 'SomeGal2');
CREATE INDEX sh_user_idx ON grape.session_history (user_id); CREATE INDEX uh_user_idx ON grape.user_history (user_id); CREATE INDEX s_user_idx ON grape.session (user_id);
/******************************************************** * Ryan Halter Assignment 6 Number 3 *********************************************************/ DELIMITER // CREATE FUNCTION discount_price (truePrice INT) RETURNS DECIMAL(10,2) DETERMINISTIC BEGIN DECLARE discountPrice DECIMAL(10,2); SELECT (item_price - discount_amount) INTO discountPrice FROM order_items WHERE item_id = truePrice; RETURN (discountPrice); END// DELIMITER ;
-- 1 Select idEmpregado, nomeEmpregado from empregado order by DataAdmissao ; -- 2 Select nomeEmpregado from empregado where comissao is null order by salario -- 3 Select idempregado, nomeEmpregado, (salario*13) as SalarioAnual, (Comissao*12) as Comissao, (Salario*13 + Comissao*12) as RendaAnual From Empregado -- 4 Select idempregado, nomeempregado, Cargo, Salario from empregado where salario*12 < 18500.00 or cargo = 'Atendente'
SELECT orders.user_id, orders.order_subtotal, orders.order_date, users.name, users.email, users.address FROM users Left JOIN orders ON orders.user_id=users.generated_user_id;
Use mansoureh Select * from spec Order by lname DESC
SELECT c.customer_id, c.first_name, c.last_name, a.actor_id, a.first_name, a.last_name FROM sakila.customer c LEFT JOIN sakila.actor a ON (c.last_name = a.last_name)
-- Customer DB -- CREATE TABLE Customer ( customer_id INT IDENTITY, e_mail VARCHAR(255) NOT NULL, pseudonym VARCHAR(255) NOT NULL, password_hash INT NOT NULL, first_name VARCHAR(255) NULL, middle_name VARCHAR(255) NULL, last_name VARCHAR(255) NULL, PRIMARY KEY (customer_id) ); -- Music DB -- CREATE TABLE Artist ( artist_id INT IDENTITY, pseudonym VARCHAR(255) NOT NULL, biography VARCHAR(4095) NULL, url VARCHAR(255) NULL, PRIMARY KEY (artist_id) ); CREATE TABLE Member ( member_id INT IDENTITY, first_name VARCHAR(255) NULL, middle_name VARCHAR(255) NULL, last_name VARCHAR(255) NULL, PRIMARY KEY (member_id) ); CREATE TABLE ArtistMember ( artist_id INT NOT NULL, member_no INT NOT NULL, member_id INT NOT NULL FOREIGN KEY REFERENCES Member (member_id), PRIMARY KEY (artist_id, member_no) ); CREATE TABLE Genre ( genre_id INT IDENTITY, name VARCHAR(255) NOT NULL, PRIMARY KEY (genre_id) ); CREATE TABLE Label ( label_id INT IDENTITY, name VARCHAR(255) NOT NULL, PRIMARY KEY (label_id) ); CREATE TABLE Provider ( provider_id INT IDENTITY, name VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL, api_url VARCHAR(255) NOT NULL, PRIMARY KEY (provider_id) ); CREATE TABLE Album ( album_id INT IDENTITY, title VARCHAR(255) NOT NULL, label_id INT FOREIGN KEY REFERENCES Label (label_id), release_year INT NULL, PRIMARY KEY (album_id) ); CREATE TABLE Disc ( disc_id INT IDENTITY, disc_no INT NOT NULL, album_id INT NOT NULL FOREIGN KEY REFERENCES Album (album_id), PRIMARY KEY (disc_id) ); CREATE TABLE Track ( track_id INT IDENTITY, number INT NOT NULL, title VARCHAR(255) NOT NULL, album_id INT NOT NULL FOREIGN KEY REFERENCES Album (album_id), duration INT NOT NULL, bpm INT NOT NULL, genre_id INT NULL FOREIGN KEY REFERENCES Genre (genre_id), provider_id INT NULL FOREIGN KEY REFERENCES Provider (provider_id), rest_param VARCHAR(255) NULL, PRIMARY KEY (track_id) ); CREATE TABLE TrackRemixer ( track_id INT NOT NULL FOREIGN KEY REFERENCES Track (track_id), remix_no INT NOT NULL, artist_id INT NOT NULL FOREIGN KEY REFERENCES Artist (artist_id), PRIMARY KEY (track_id, remix_no) ); CREATE TABLE TrackArtist ( track_id INT NOT NULL FOREIGN KEY REFERENCES Track (track_id), artist_no INT NOT NULL, artist_id INT NOT NULL FOREIGN KEY REFERENCES Artist (artist_id), PRIMARY KEY (track_id, artist_no) ); CREATE TABLE AlbumArtist ( album_id INT NOT NULL FOREIGN KEY REFERENCES Album (album_id), artist_id INT NOT NULL FOREIGN KEY REFERENCES Artist (artist_id), PRIMARY KEY (album_id, artist_id) ); -- Transition DB -- CREATE TABLE Transition ( transition_id INT IDENTITY, customer_id INT NOT NULL FOREIGN KEY REFERENCES Customer (customer_id), description VARCHAR(1023) NULL, PRIMARY KEY (transition_id) ); CREATE TABLE Transition_Part ( transition_id INT NOT NULL FOREIGN KEY REFERENCES Transition (transition_id), part_no INT NOT NULL, track_id INT NOT NULL FOREIGN KEY REFERENCES Track (track_id), start_ms INT NULL, end_ms INT NULL, PRIMARY KEY (transition_id, part_no) ); CREATE TABLE Rating ( rating_id INT IDENTITY, -- customer_id+transition_id = key? customer_id INT NOT NULL FOREIGN KEY REFERENCES Customer (customer_id), transition_id INT NOT NULL FOREIGN KEY REFERENCES Transition (transition_id), rating INT NOT NULL, note VARCHAR(1023) NULL, PRIMARY KEY (rating_id) );
/*管理员表*/ DROP TABLE if EXISTS y2_admin; CREATE TABLE if NOT EXISTS `y2_admin`( adminid int unsigned not NULL auto_increment COMMENT '主键id', adminuser VARCHAR(32) NOT NULL DEFAULT '' COMMENT '管理员账号', adminpass CHAR(32) NOT NULL DEFAULT '' COMMENT '管理员密码', adminemail VARCHAR(50) NOT NULL DEFAULT '' COMMENT '管理员邮箱', loginip BIGINT NOT NULL DEFAULT '0' COMMENT '登录ip', createtime int UNSIGNED not NULL DEFAULT '0' COMMENT '管理员创建时间', PRIMARY KEY (adminid), UNIQUE y2_admin_adminuser_adminpass(adminuser,adminpass), UNIQUE y2_admin_adminuser_adminemail(adminuser,adminemail) )engine=innodb CHARSET=utf8; INSERT INTO y2_admin (adminuser,adminpass,adminemail,createtime) VALUES ('admin',md5('123456'),'test@shop.com',unix_timestamp()); /*会员表*/ DROP TABLE if EXISTS y2_user; CREATE TABLE IF NOT EXISTS y2_user( userid BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键id', username VARCHAR(32) NOT NULL DEFAULT '' COMMENT '用户名', userpass CHAR(32) NOT NULL DEFAULT '' COMMENT '用户密码', useremail VARCHAR(100) NOT NULL DEFAULT '' COMMENT '用户邮箱', createtime INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间', PRIMARY KEY (userid), UNIQUE y2_user_username_userpass(username,userpass), UNIQUE y2_user_useremail_userpass(username,userpass) )ENGINE = innodb CHARSET = utf8; /*会员的详细信息*/ DROP TABLE IF EXISTS y2_profile; CREATE TABLE IF NOT EXISTS y2_profile( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键id', truename VARCHAR(32) NOT NULL DEFAULT '' COMMENT '真实姓名', age TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '年龄', sex TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '性别0-保密1-男2-女', birthday date NOT NULL DEFAULT '2016-1-1' COMMENT '生日', nickname VARCHAR(32) DEFAULT '' COMMENT '昵称', company VARCHAR(100) DEFAULT '' COMMENT '公司', userid BIGINT UNSIGNED NOT NULL COMMENT '用户id', createtime int UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间', PRIMARY KEY (id), UNIQUE y2_profile_userid(userid) )ENGINE = innodb DEFAULT CHARSET = utf8; /*商品分类*/ DROP TABLE IF EXISTS y2_category; CREATE TABLE if NOT EXISTS y2_category( cateid BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键id', title VARCHAR(32) NOT NULL DEFAULT '' COMMENT '商品名', parentid BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '父类id', create_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间', PRIMARY KEY (cateid), KEY y2_category_parentid(parentid) )ENGINE = innodb DEFAULT CHARSET = utf8 COMMENT='商品分类'; DROP TABLE IF EXISTS y2_product; CREATE TABLE IF NOT EXISTS y2_product( productid BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键id', cateid BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT '分类id', title VARCHAR(200) NOT NULL DEFAULT '' COMMENT '商品名册', descr TEXT, num BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT '商品库存', price DECIMAL(10,2) NOT NULL DEFAULT '00.00' COMMENT '商品价格', cover VARCHAR(200) NOT NULL DEFAULT '' COMMENT '商品封面图片', pics TEXT, issale TINYINT UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否上架0下架1上架', saleprice DECIMAL(10,2) NOT NULL DEFAULT '00.00' COMMENT '商品售价', ishot TINYINT UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否热销0非热销1热销', createtime INT UNSIGNED NOT NULL DEFAULT '0' COMMENT '商品创建时间', PRIMARY KEY (productid), KEY y2_product_cateid(cateid) )ENGINE = innodb DEFAULT CHARSET = utf8 COMMENT = '商品表';
-- Try running me! SELECT 'DataCamp <3 SQL' AS result; SELECT 'SQL' AS result; SELECT 'SQL is' AS result; SELECT 'SQL is cool!' AS result; SELECT title FROM films; SELECT release_year FROM films; SELECT name FROM people; SELECT title FROM films; SELECT title,release_year FROM films; SELECT title, release_year, country FROM films; SELECT * FROM films; SELECT DISTINCT country FROM films; SELECT DISTINCT certification FROM films; SELECT DISTINCT role FROM roles; SELECT COUNT(*) FROM reviews; SELECT COUNT(*) FROM people; SELECT COUNT(birthdate) FROM people; SELECT COUNT(DISTINCT birthdate) FROM people; SELECT COUNT(DISTINCT language) FROM films; SELECT COUNT(DISTINCT country) FROM films; SELECT * FROM films WHERE release_year = 2016; SELECT COUNT(*) FROM films WHERE release_year < 2000; SELECT title, release_year FROM films WHERE release_year > 2000; SELECT * FROM films WHERE language = 'French'; SELECT name, birthdate FROM people WHERE birthdate = '1974-11-11'; SELECT COUNT(*) FROM films WHERE language = 'Hindi'; SELECT * FROM films WHERE certification = 'R' SELECT title, release_year FROM films WHERE language ='Spanish' AND release_year < 2000; SELECT * FROM films WHERE language ='Spanish' AND release_year > 2000; SELECT * FROM films WHERE language='Spanish' AND release_year > 2000 AND release_year < 2010; SELECT title, release_year FROM films WHERE release_year >= 1990 AND release_year <2000 ; SELECT title, release_year FROM films WHERE (release_year >= 1990 AND release_year <2000) AND (language = 'French' OR language='Spanish'); SELECT title, release_year FROM films WHERE (release_year >= 1990 AND release_year <2000) AND (language = 'French' OR language='Spanish') AND gross >= 2000000; SELECT title, release_year FROM films WHERE release_year BETWEEN 1990 AND 2000; SELECT title, release_year FROM films WHERE release_year BETWEEN 1990 AND 2000 AND budget > 100000000; SELECT title, release_year FROM films WHERE release_year BETWEEN 1990 AND 2000 AND budget > 100000000 AND language='Spanish'; SELECT title, release_year FROM films WHERE release_year BETWEEN 1990 AND 2000 AND budget > 100000000 AND (language='Spanish' OR language ='French'); SELECT title, release_year FROM films WHERE (release_year=1990 OR release_year=2000) AND duration >120; SELECT title, language FROM films WHERE language IN ('English','Spanish','French'); SELECT title, certification FROM films WHERE certification IN ('NC-17','R'); SELECT name FROM people WHERE deathdate IS NULL; SELECT title FROM films WHERE budget IS NULL; SELECT COUNT (*) FROM films WHERE language IS NULL; SELECT name FROM people WHERE name LIKE 'B%' SELECT name FROM people WHERE name LIKE '_r%'; SELECT name FROM people WHERE name NOT LIKE 'A%'; SELECT SUM (DURATION) FROM FILMS; SELECT AVG (DURATION) FROM FILMS; SELECT MIN (DURATION) FROM FILMS; SELECT MAX (DURATION) FROM FILMS; SELECT SUM (GROSS) FROM FILMS; SELECT AVG (GROSS) FROM FILMS; SELECT MIN (GROSS) FROM FILMS; SELECT MAX (GROSS) FROM FILMS; SELECT SUM (GROSS) FROM FILMS WHERE RELEASE_YEAR >= 2000; SELECT AVG (GROSS) FROM FILMS WHERE TITLE LIKE 'A%' SELECT MIN (GROSS) FROM FILMS WHERE RELEASE_YEAR=1994; SELECT MAX (GROSS) FROM FILMS WHERE RELEASE_YEAR BETWEEN 2000 AND 2012; SELECT TITLE, (GROSS - BUDGET) AS NET_PROFIT FROM FILMS; SELECT TITLE, DURATION/60.0 AS DURATION_HOURS FROM FILMS; SELECT AVG(DURATION)/60.0 AS AVG_DURATION_HOURS FROM FILMS;
-- Tested on MySQL /* suspectsInvestigation A large amount of money was stolen today from the main city bank, and as the chief of police it's your duty to find the robber. You store information about your suspects in the table Suspect, which has the structure: id: unique suspect id; name: suspect first name; surname: suspect surname; height: suspect height; weight: suspect weight. You have already gathered some evidence and discovered the following clues: according to the camera records, the robber is not taller than 170cm; the robber left their signature near the crime scene: "B. Gre?n". "B" definitely stands for the first letter of robber's name, and "Gre?n" is their surname. The 4th letter of the surname is smudged by ketchup and is unreadable. To make the list of suspects smaller, you would like to filter out the suspects who can't possibly be guilty according to the information obtained from the clues. For each remaining suspect, you want to save his/her id, name and surname. Please note that the information obtained from the clue should be considered case-insensitive, so for example "bill Green", and "Bill green", and "Bill Green" should all be included in the new table. Given the table Suspect, build the resulting table as follows: the table should have columns id, name and surname and its values should be ordered by the suspects' ids in ascending order. Example For the following table Suspect id name surname height weight 1 John Doe 165 60 2 Bill Green 170 67 3 Baelfire Grehn 172 70 4 Bill Gretan 165 55 5 Brendon Grewn 150 50 6 bill Green 169 50 the output should be id name surname 2 Bill Green 5 Brendon Grewn 6 bill Green The name of the 1st suspect doesn't start with "B", the 3rd suspect is taller than 170cm, and the surname of the 4th suspect doesn't match the given pattern, meaning that these suspects are not included in the results. */ CREATE PROCEDURE suspectsInvestigation() BEGIN SELECT id, name, surname FROM Suspect WHERE name like 'b%' AND surname like 'Gre_n' AND height <= 170 ORDER BY id; END
/* Navicat MySQL Data Transfer Source Server : develop Source Server Type : MySQL Source Server Version : 80016 Source Host : 140.143.72.57:3306 Source Schema : develop Target Server Type : MySQL Target Server Version : 80016 File Encoding : 65001 Date: 18/06/2019 10:36:56 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for Student -- ---------------------------- DROP TABLE IF EXISTS `Student`; CREATE TABLE `Student` ( `sid` int(11) NOT NULL AUTO_INCREMENT, `sname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `age` int(11) NULL DEFAULT NULL, `sno` int(11) NOT NULL, PRIMARY KEY (`sid`, `sno`) USING BTREE, INDEX `fk_sno`(`sno`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of Student -- ---------------------------- SET FOREIGN_KEY_CHECKS = 1;
# crear una base de datos de una playa de estacionamiento, en el cual # se guarden los vehiculos que ingresaron y tener un registro de vehiculos, una # tabla vehiculos debe tener su id, placa, marca, año, modelo, color, tambien la # playa de estacionamiento tiene 3 lugares, uno en la calle san francisco 204, otro en # san juan de dios 132 y otro en la av eeuu 505 por lo que se debe tener una tabla # playa con su id, direccion, cantidad. La base de datos se debe llamar Playa_AQP CREATE DATABASE PLAYA_AQP; use PLAYA_AQP; create table t_vehiculo( veh_id int not null auto_increment, veh_placa varchar(6), veh_marca varchar(30), veh_anio year, veh_modelo varchar(40), veh_color varchar(20), primary key(veh_id) ); create table t_playa( playa_id int not null auto_increment primary key, playa_dir varchar(100), playa_cap int ); create table t_registro( reg_id int not null auto_increment primary key, reg_fechin datetime, reg_fechfin datetime, playa_id int, veh_id int, foreign key (playa_id) references t_playa(playa_id), foreign key (veh_id) references t_vehiculo(veh_id) ); insert into t_vehiculo ( veh_placa, veh_marca, veh_anio, veh_modelo, veh_color) values ('A3A123','VOLKSWAGEN',2010, 'JETTA', 'NEGRO'), ('A13245','VOLKSWAGEN',2010, 'AMAROK', 'PLOMO'), ('14AS','DAEWOO',2008, 'TICCO', 'AZUL'), ('AY5574','TOYOTA',2018, 'TERCEL', 'BLANCO'), ('OH2458','LIFAN',2014, 'XY456', 'AMARILLO');
/********************************************************************** * File: sqlhistory.sql * Type: SQL*Plus script * Author: Tim Gorman (Evergreen Database Technologies, Inc.) * Date: 29sep08 * * Description: * SQL*Plus script to query the "history" of a specified SQL * statement, using its "SQL ID" across all database instances * in a database, using the AWR repository. This report is useful * for obtaining an hourly perspective on SQL statements seen in * more aggregated reports. * * Modifications: * TGorman 29sep08 adapted from the earlier STATSPACK-based * "sphistory.sql" script *********************************************************************/ set echo off set feedback off timing off verify off pagesize 100 linesize 200 recsep off echo off set serveroutput on size 1000000 format wrapped trimout on trimspool on col phv heading "Plan|Hash Value" col snap_time format a12 truncate heading "Snapshot|Time" col execs format 999,990 heading "Execs" col lio_per_exec format 999,999,999,990.00 heading "Avg LIO|Per Exec" col pio_per_exec format 999,999,999,990.00 heading "Avg PIO|Per Exec" col cpu_per_exec format 999,999,999,990.00 heading "Avg|CPU (secs)|Per Exec" col ela_per_exec format 999,999,999,990.00 heading "Avg|Elapsed (secs)|Per Exec" col sql_text format a64 heading "Text of SQL statement" clear breaks computes ttitle off btitle off accept V_SQL_ID prompt "Enter the SQL_ID: " accept V_NBR_DAYS prompt "Enter number of days (backwards from this hour) to report (default: ALL): " variable v_nbr_days number spool sqlhistory_&&V_SQL_ID declare cursor get_phv(in_sql_id in varchar2, in_days in integer) is select ss.plan_hash_value, min(s.begin_interval_time) min_time, max(s.begin_interval_time) max_time, min(s.snap_id) min_snap, max(s.snap_id) max_snap, sum(ss.executions_delta) sum_execs, sum(ss.disk_reads_delta) sum_disk_reads, sum(ss.buffer_gets_delta) sum_buffer_gets, sum(ss.cpu_time_delta)/1000000 sum_cpu_time, sum(ss.elapsed_time_delta)/1000000 sum_elapsed_time from dba_hist_sqlstat ss, dba_hist_snapshot s where ss.dbid = s.dbid and ss.instance_number = s.instance_number and ss.snap_id = s.snap_id and ss.sql_id = in_sql_id /* and ss.executions_delta > 0 */ and s.begin_interval_time >= sysdate-in_days group by ss.plan_hash_value order by sum_elapsed_time desc; -- cursor get_xplan(in_sql_id in varchar2, in_phv in number) is select plan_table_output from table(dbms_xplan.display_awr(in_sql_id, in_phv, null, 'ALL -ALIAS')); -- v_prev_plan_hash_value number := -1; v_text_lines number := 0; v_errcontext varchar2(100); v_errmsg varchar2(100); v_display_sql_text boolean; -- begin -- v_errcontext := 'query NBR_DAYS from DUAL'; select decode('&&V_NBR_DAYS','',10,to_number(nvl('&&V_NBR_DAYS','10'))) into :v_nbr_days from dual; -- v_errcontext := 'open/fetch get_phv'; for phv in get_phv('&&V_SQL_ID', :v_nbr_days) loop -- if get_phv%rowcount = 1 then -- dbms_output.put_line('+'|| rpad('-',12,'-')|| rpad('-',10,'-')|| rpad('-',10,'-')|| rpad('-',12,'-')|| rpad('-',15,'-')|| rpad('-',15,'-')|| rpad('-',12,'-')|| rpad('-',12,'-')||'+'); dbms_output.put_line('|'|| rpad('Plan HV',12,' ')|| rpad('Min Snap',10,' ')|| rpad('Max Snap',10,' ')|| rpad('Execs',12,' ')|| rpad('LIO',15,' ')|| rpad('PIO',15,' ')|| rpad('CPU',12,' ')|| rpad('Elapsed',12,' ')||'|'); dbms_output.put_line('+'|| rpad('-',12,'-')|| rpad('-',10,'-')|| rpad('-',10,'-')|| rpad('-',12,'-')|| rpad('-',15,'-')|| rpad('-',15,'-')|| rpad('-',12,'-')|| rpad('-',12,'-')||'+'); -- end if; -- dbms_output.put_line('|'|| rpad(trim(to_char(phv.plan_hash_value)),12,' ')|| rpad(trim(to_char(phv.min_snap)),10,' ')|| rpad(trim(to_char(phv.max_snap)),10,' ')|| rpad(trim(to_char(phv.sum_execs,'999,999,990')),12,' ')|| rpad(trim(to_char(phv.sum_buffer_gets,'999,999,999,990')),15,' ')|| rpad(trim(to_char(phv.sum_disk_reads,'999,999,999,990')),15,' ')|| rpad(trim(to_char(phv.sum_cpu_time,'999,990.00')),12,' ')|| rpad(trim(to_char(phv.sum_elapsed_time,'999,990.00')),12,' ')||'|'); -- v_errcontext := 'fetch/close get_phv'; -- end loop; dbms_output.put_line('+'|| rpad('-',12,'-')|| rpad('-',10,'-')|| rpad('-',10,'-')|| rpad('-',12,'-')|| rpad('-',15,'-')|| rpad('-',15,'-')|| rpad('-',12,'-')|| rpad('-',12,'-')||'+'); -- v_errcontext := 'open/fetch get_phv'; for phv in get_phv('&&V_SQL_ID', :v_nbr_days) loop -- if v_prev_plan_hash_value <> phv.plan_hash_value then -- v_prev_plan_hash_value := phv.plan_hash_value; v_display_sql_text := FALSE; -- v_text_lines := 0; v_errcontext := 'open/fetch get_xplan'; for s in get_xplan('&&V_SQL_ID', phv.plan_hash_value) loop -- if v_text_lines = 0 then dbms_output.put_line('.'); dbms_output.put_line('========== PHV = ' || phv.plan_hash_value || '=========='); dbms_output.put_line('First seen from "'|| to_char(phv.min_time,'MM/DD/YY HH24:MI:SS') || '" (snap #'||phv.min_snap||')'); dbms_output.put_line('Last seen from "'|| to_char(phv.max_time,'MM/DD/YY HH24:MI:SS') || '" (snap #'||phv.max_snap||')'); dbms_output.put_line('.'); dbms_output.put_line( rpad('Execs',15,' ')|| rpad('LIO',15,' ')|| rpad('PIO',15,' ')|| rpad('CPU',15,' ')|| rpad('Elapsed',15,' ')); dbms_output.put_line( rpad('=====',15,' ')|| rpad('===',15,' ')|| rpad('===',15,' ')|| rpad('===',15,' ')|| rpad('=======',15,' ')); dbms_output.put_line( rpad(trim(to_char(phv.sum_execs,'999,999,999,990')),15,' ')|| rpad(trim(to_char(phv.sum_buffer_gets,'999,999,999,990')),15,' ')|| rpad(trim(to_char(phv.sum_disk_reads,'999,999,999,990')),15,' ')|| rpad(trim(to_char(phv.sum_cpu_time,'999,999,990.00')),15,' ')|| rpad(trim(to_char(phv.sum_elapsed_time,'999,999,990.00')),15,' ')); dbms_output.put_line('.'); end if; -- if v_display_sql_text = FALSE and s.plan_table_output like 'Plan hash value: %' then -- v_display_sql_text := TRUE; -- end if; -- if v_display_sql_text = TRUE then -- dbms_output.put_line(s.plan_table_output); -- end if; -- v_text_lines := v_text_lines + 1; -- end loop; -- end if; -- v_errcontext := 'fetch/close get_phv'; -- end loop; -- exception when others then v_errmsg := sqlerrm; raise_application_error(-20000, v_errcontext || ': ' || v_errmsg); end; / break on report compute sum of execs on report compute avg of lio_per_exec on report compute avg of pio_per_exec on report compute avg of cpu_per_exec on report compute avg of ela_per_exec on report ttitle center 'Summary Execution Statistics Over Time' select to_char(s.begin_interval_time, 'DD-MON HH24:MI') snap_time, ss.executions_delta execs, ss.buffer_gets_delta/decode(ss.executions_delta,0,1,ss.executions_delta) lio_per_exec, ss.disk_reads_delta/decode(ss.executions_delta,0,1,ss.executions_delta) pio_per_exec, (ss.cpu_time_delta/1000000)/decode(ss.executions_delta,0,1,ss.executions_delta) cpu_per_exec, (ss.elapsed_time_delta/1000000)/decode(ss.executions_delta,0,1,ss.executions_delta) ela_per_exec from dba_hist_snapshot s, dba_hist_sqlstat ss where ss.dbid = s.dbid and ss.instance_number = s.instance_number and ss.snap_id = s.snap_id and ss.sql_id = '&&V_SQL_ID' /* and ss.executions_delta > 0 */ and s.begin_interval_time >= sysdate - :v_nbr_days order by s.snap_id; clear breaks computes break on phv skip 1 on report compute sum of execs on phv compute avg of lio_per_exec on phv compute avg of pio_per_exec on phv compute avg of cpu_per_exec on phv compute avg of ela_per_exec on phv ttitle center 'Per-Plan Execution Statistics Over Time' select ss.plan_hash_value phv, to_char(s.begin_interval_time, 'DD-MON HH24:MI') snap_time, ss.executions_delta execs, ss.buffer_gets_delta/decode(ss.executions_delta,0,1,ss.executions_delta) lio_per_exec, ss.disk_reads_delta/decode(ss.executions_delta,0,1,ss.executions_delta) pio_per_exec, (ss.cpu_time_delta/1000000)/decode(ss.executions_delta,0,1,ss.executions_delta) cpu_per_exec, (ss.elapsed_time_delta/1000000)/decode(ss.executions_delta,0,1,ss.executions_delta) ela_per_exec from dba_hist_snapshot s, dba_hist_sqlstat ss where ss.dbid = s.dbid and ss.instance_number = s.instance_number and ss.snap_id = s.snap_id and ss.sql_id = '&&V_SQL_ID' /* and ss.executions_delta > 0 */ and s.begin_interval_time >= sysdate - :v_nbr_days order by ss.plan_hash_value, s.snap_id; clear breaks computes spool off set verify on echo on feedback on ttitle off
USE appdb; select * from mobile;
select cast (created_at as date) as created_at, age, sum(amount) as amount from {{ ref('orders_per_age') }} where status = 'paid' and age is not null group by created_at, age
delete from HtmlLabelIndex where id=27301 / delete from HtmlLabelInfo where indexid=27301 / INSERT INTO HtmlLabelIndex values(27301,'您的帐号') / INSERT INTO HtmlLabelInfo VALUES(27301,'您的帐号',7) / INSERT INTO HtmlLabelInfo VALUES(27301,'you count',8) / INSERT INTO HtmlLabelInfo VALUES(27301,'您的帳号',9) / delete from HtmlLabelIndex where id=27302 / delete from HtmlLabelInfo where indexid=27302 / INSERT INTO HtmlLabelIndex values(27302,'现用密码') / INSERT INTO HtmlLabelInfo VALUES(27302,'现用密码',7) / INSERT INTO HtmlLabelInfo VALUES(27302,'now password',8) / INSERT INTO HtmlLabelInfo VALUES(27302,'現用密碼',9) / delete from HtmlLabelIndex where id=27303 / delete from HtmlLabelInfo where indexid=27303 / INSERT INTO HtmlLabelIndex values(27303,'新密码') / INSERT INTO HtmlLabelInfo VALUES(27303,'新密码',7) / INSERT INTO HtmlLabelInfo VALUES(27303,'new password',8) / INSERT INTO HtmlLabelInfo VALUES(27303,'新密碼',9) / delete from HtmlLabelIndex where id=27304 / delete from HtmlLabelInfo where indexid=27304 / INSERT INTO HtmlLabelIndex values(27304,'密码强度') / INSERT INTO HtmlLabelInfo VALUES(27304,'密码强度',7) / INSERT INTO HtmlLabelInfo VALUES(27304,'Password Complexity',8) / INSERT INTO HtmlLabelInfo VALUES(27304,'密碼強度',9) / delete from HtmlLabelIndex where id=27305 / delete from HtmlLabelInfo where indexid=27305 / INSERT INTO HtmlLabelIndex values(27305,'再输入一次新密码') / INSERT INTO HtmlLabelInfo VALUES(27305,'再输入一次新密码',7) / INSERT INTO HtmlLabelInfo VALUES(27305,'Enter a new password',8) / INSERT INTO HtmlLabelInfo VALUES(27305,'再輸入一次新密碼',9) / delete from HtmlLabelIndex where id=27309 / delete from HtmlLabelInfo where indexid=27309 / INSERT INTO HtmlLabelIndex values(27309,'强') / INSERT INTO HtmlLabelInfo VALUES(27309,'强',7) / INSERT INTO HtmlLabelInfo VALUES(27309,'Strength',8) / INSERT INTO HtmlLabelInfo VALUES(27309,'強',9) / delete from HtmlLabelIndex where id=22987 / delete from HtmlLabelInfo where indexid=22987 / INSERT INTO HtmlLabelIndex values(22987,'中') / INSERT INTO HtmlLabelInfo VALUES(22987,'中',7) / INSERT INTO HtmlLabelInfo VALUES(22987,'Center',8) / INSERT INTO HtmlLabelInfo VALUES(22987,'中',9) / delete from HtmlLabelIndex where id=27310 / delete from HtmlLabelInfo where indexid=27310 / INSERT INTO HtmlLabelIndex values(27310,'弱') / INSERT INTO HtmlLabelInfo VALUES(27310,'弱',7) / INSERT INTO HtmlLabelInfo VALUES(27310,'Weak',8) / INSERT INTO HtmlLabelInfo VALUES(27310,'弱',9) / delete from HtmlLabelIndex where id=27307 / delete from HtmlLabelInfo where indexid=27307 / INSERT INTO HtmlLabelIndex values(27307,'您输入的新密码,密码强度为‘弱’,系统不允许保存!') / INSERT INTO HtmlLabelInfo VALUES(27307,'您输入的新密码,密码强度为‘弱’,系统不允许保存!',7) / INSERT INTO HtmlLabelInfo VALUES(27307,'Enter your new password, the password strength of ''weak'', the system does not allow Save!',8) / INSERT INTO HtmlLabelInfo VALUES(27307,'您輸入的新密碼,密碼強度爲‘弱’,系統不允許保存!',9) / delete from HtmlLabelIndex where id=27308 / delete from HtmlLabelInfo where indexid=27308 / INSERT INTO HtmlLabelIndex values(27308,'您输入的新密码,密码强度为‘中’,系统不允许保存!') / INSERT INTO HtmlLabelInfo VALUES(27308,'您输入的新密码,密码强度为‘中’,系统不允许保存!',7) / INSERT INTO HtmlLabelInfo VALUES(27308,'Enter your new password, the password strength ''in'', the system does not allow Save!',8) / INSERT INTO HtmlLabelInfo VALUES(27308,'您輸入的新密碼,密碼強度爲‘中’,系統不允許保存!',9) / delete from HtmlLabelIndex where id=27313 / delete from HtmlLabelInfo where indexid=27313 / INSERT INTO HtmlLabelIndex values(27313,'密码强度不足,请修改密码。') / INSERT INTO HtmlLabelInfo VALUES(27313,'密码强度不足,请修改密码。',7) / INSERT INTO HtmlLabelInfo VALUES(27313,'Password strength is insufficient, please change your password.',8) / INSERT INTO HtmlLabelInfo VALUES(27313,'密碼強度不足,請修改密碼。',9) / delete from HtmlLabelIndex where id=27314 / delete from HtmlLabelInfo where indexid=27314 / INSERT INTO HtmlLabelIndex values(27314,'密码强度不足,请重新修改密码。') / INSERT INTO HtmlLabelInfo VALUES(27314,'密码强度不足,请重新修改密码。',7) / INSERT INTO HtmlLabelInfo VALUES(27314,'Password strength is insufficient, please change the password again.',8) / INSERT INTO HtmlLabelInfo VALUES(27314,'密碼強度不足,請重新修改密碼。',9) / delete from HtmlLabelIndex where id=558 / delete from HtmlLabelInfo where indexid=558 / INSERT INTO HtmlLabelIndex values(558,'提示') / INSERT INTO HtmlLabelInfo VALUES(558,'提示',7) / INSERT INTO HtmlLabelInfo VALUES(558,'NOTE',8) / INSERT INTO HtmlLabelInfo VALUES(558,'提示',9) / delete from HtmlLabelIndex where id=27316 / delete from HtmlLabelInfo where indexid=27316 / INSERT INTO HtmlLabelIndex values(27316,'密码长度必须大于等于8位,包含“字母、数字、特殊符号”') / INSERT INTO HtmlLabelInfo VALUES(27316,'密码长度必须大于等于8位,包含“字母、数字、特殊符号”',7) / INSERT INTO HtmlLabelInfo VALUES(27316,'Password length must be greater than or equal to 8 bits, including "letters + numbers + special characters"',8) / INSERT INTO HtmlLabelInfo VALUES(27316,'密碼長度必須大于等于8位,包含“字母、數字、特殊符号”',9) /
CREATE OR REPLACE FUNCTION nb_abo(num IN INTEGER) RETURN INTEGER IS nb INTEGER ; BEGIN SELECT COUNT(NUM_AB) INTO nb FROM ABBONNE; RETURN (nb) ; END ; /
-- 1. Otorga privilegio al empleado1 para conectarse a la base de datos y crear, borrar y modificar tablas. GRANT CREATE SESSION, CREATE TABLE TO EMPLEADO1; -- 2. Consulta los privilegios de sistema del empleado1. SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE = 'EMPLEADO1'; -- 3. Otorga privilegios al empleado2 para conectarse a la base de datos -- y seleccionar cualquier tabla de la base de datos de forma que pueda conceder ese privilegio a todos los usuarios GRANT CREATE SESSION TO EMPLEADO2; GRANT SELECT ANY TABLE TO EMPLEADO2 WITH ADMIN OPTION; -- 4. Consulta los privilegios de sistema del empleado2. SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE = 'EMPLEADO2'; -- 5. Otorga privilegios al empleado3 para conectarse, crear tablas en su esquema, -- crear vistas en su esquema e insertar datos en cualquier tabla de la base de datos. GRANT CREATE SESSION TO EMPLEADO3; GRANT CREATE TABLE TO EMPLEADO3; GRANT CREATE VIEW TO EMPLEADO3; GRANT INSERT ANY TABLE TO EMPLEADO3; -- 6. Consulta los privilegios de sistema del empleado3. SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE = 'EMPLEADO3'; -- 7. Revoca al empleado3 el privilegio de crear vistas en su esquema. Comprueba que no puede. REVOKE CREATE VIEW FROM EMPLEADO3; -- 8. Consulta los privilegios de sistema del empleado3. SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE = 'EMPLEADO3'; -- 9. Conéctate como empleado2 y concede el privilegio para seleccionar cualquier tabla de la base de datos al empleado3 ¿Es posible? ¿Por qué? -- sí ha dejado, porque previamente en el apartado 3, le habíamos dado ya el privilegio al EMPLEADO2 de otorgar tal permiso a otros usuarios -- 10. Conéctate como system y consulta los privilegios de sistema del empleado3 SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE = 'EMPLEADO3'; -- 11. Revoca el permiso para seleccionar cualquier tabla de la base de datos al empleado2 ¿Se le ha revocado el permiso de también al empleado 3? ¿Por qué? REVOKE SELECT ANY TABLE FROM EMPLEADO2; -- sí se ha podido, porque al quitar el permiso de SELECT ANY TABLE al EMPLEADO2, -- a su vez, se le quita el permiso "en cascada" al resto de usuarios a los que se lo haya otorgado el EMPLEADO2 -- 12. Averigua qué usuarios de la base de datos tienen asignado el privilegio “create user” de forma directa SELECT * FROM DBA_SYS_PRIVS WHERE PRIVILEGE = 'CREATE USER'; -- 13. Conéctate como empleado2 y averigua los privilegios de sistema que tiene en esa sesión. SELECT * FROM USER_SYS_PRIVS;
connect sys/u_pick_it as sysdba whenever sqlerror continue create user BAN_SS_USER identified by u_pick_it; whenever sqlerror exit rollback grant create session to BAN_SS_USER; grant select any table to BAN_SS_USER; grant select any sequence to BAN_SS_USER; grant update any table to BAN_SS_USER; grant delete any table to BAN_SS_USER; grant insert any table to BAN_SS_USER; grant execute any procedure to BAN_SS_USER; grant lock any table to BAN_SS_USER;
-- noinspection SqlResolveForFile -- noinspection SqlNoDataSourceInspectionForFile CREATE TABLE users ( id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, username varchar(45) NOT NULL UNIQUE, firstname varchar(45) NOT NULL, lastname varchar(45) NOT NULL, email varchar(100) NOT NULL UNIQUE, password varchar(255) NOT NULL, user_status int(11) DEFAULT NULL, date_created datetime DEFAULT NULL, date_updated datetime DEFAULT NULL, user_role int(11) NOT NULL, user_created int(11) DEFAULT NULL, user_updated int(11) DEFAULT NULL);
-- CSC296 Database Systems -- Created: 15 Apr 2014 -- Remove tables in order to remove constraints correctly DROP TABLE IF EXISTS teaches; DROP TABLE IF EXISTS course_sessions; DROP TABLE IF EXISTS sessions; DROP TABLE IF EXISTS applications; DROP TABLE IF EXISTS workshops; DROP TABLE IF EXISTS courses; DROP TABLE IF EXISTS users; DROP TABLE IF EXISTS tas; DROP TABLE IF EXISTS instructors; -- Set up table Courses CREATE TABLE courses ( crn INTEGER NOT NULL PRIMARY KEY, -- natural key year YEAR NOT NULL, semester ENUM('spring','fall','summer','winter') NOT NULL, department CHAR(3) NOT NULL, course_number CHAR(4) NOT NULL, name VARCHAR(128) NOT NULL, description TEXT NULL, parent_crn INTEGER NULL, position_count SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (parent_crn) REFERENCES courses(crn) ) ENGINE=InnoDB; -- Set up table Sessions CREATE TABLE sessions ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, weekday ENUM('U','M','T','W','R','F','S') NOT NULL, start_time TIME NOT NULL, end_time TIME NOT NULL, room VARCHAR(32) NOT NULL, crn INTEGER NOT NULL, UNIQUE (crn,weekday, start_time, end_time, room), -- natural key FOREIGN KEY (crn) REFERENCES courses(crn) ) ENGINE=InnoDB; -- Set up table Person/Users (TA/Instructor/Staff/Admin) CREATE TABLE tas ( netid VARCHAR(8) NOT NULL PRIMARY KEY, -- natural key name VARCHAR(32) NOT NULL, email VARCHAR(256) NOT NULL, class_year YEAR NULL, credentials VARCHAR(256) NULL ) ENGINE=InnoDB; -- role ENUM('student','faculty','staff','admin') NOT NULL, CREATE TABLE instructors ( netid VARCHAR(8) NOT NULL PRIMARY KEY, -- natural key name VARCHAR(32) NOT NULL, email VARCHAR(256) NOT NULL, office_room VARCHAR(32) NULL, credentials VARCHAR(256) NULL ) ENGINE=InnoDB; -- Set up table CourseApplications CREATE TABLE applications ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, crn INTEGER NOT NULL, netid VARCHAR(8) NOT NULL, for_credit BOOLEAN NOT NULL, state ENUM('pending','approved','denied') NOT NULL, time_signup DATETIME NOT NULL, time_response DATETIME NULL, FOREIGN KEY (crn) REFERENCES courses (crn), FOREIGN KEY (netid) REFERENCES tas (netid), UNIQUE (crn, netid) -- natural key ) ENGINE=InnoDB; -- Set up table Teaches CREATE TABLE teaches ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, crn INTEGER NOT NULL, netid VARCHAR(8) NOT NULL, FOREIGN KEY (netid) REFERENCES instructors (netid), FOREIGN KEY (crn) REFERENCES courses (crn), UNIQUE (crn, netid) -- natural key ) ENGINE=InnoDB; -- CHECK (user_id IN (SELECT id FROM users WHERE role = 'faculty')), -- only faculty can teach courses
INSERT INTO PatientFile VALUES ('00001', 'jodoe00001', 'jodoe00001'); INSERT INTO PatientFile VALUES ('00002', 'jadoe00002', 'jadoe00002'); INSERT INTO PatientFile VALUES ('00003', 'mamil00003', 'mamil00003'); INSERT INTO PatientFile VALUES ('00004', 'bishe00004', 'bishe00004'); INSERT INTO PatientFile VALUES ('00005', 'momil00005', 'momil00005'); INSERT INTO PatientFile VALUES ('00006', 'scfie00006', 'scfie00006'); INSERT INTO PersonalInfo VALUES ('jodoe00001', '00001', 'John', 'Doe', '111', 'Maple Ave', 'Indianapolis', 'IN', '46260'); INSERT INTO PersonalInfo VALUES ('jadoe00002', '00002', 'Jane', 'Doe', '456', 'Wall Way', 'Indianapolis', 'IN', '46260'); INSERT INTO PersonalInfo VALUES ('mamil00003', '00003', 'Mary', 'Miller', '14556', 'Appleton Court', 'Indianapolis', 'IN', '46260'); INSERT INTO PersonalInfo VALUES ('bishe00004', '00004', 'Bill', 'Sheppard', '739', 'Delta Street', 'Indianapolis', 'IN', '46256'); INSERT INTO PersonalInfo VALUES ('momil00005', '00005', 'Monique', 'Miles', '300', 'South Way', 'Indianapolis', 'IN', '46231'); INSERT INTO PersonalInfo VALUES ('scfie00006', '00006', 'Scott', 'Fier', '7', 'Hullabaloo Court', 'Carmel', 'IN', '46033'); INSERT INTO ContactInfo VALUES ('00001', '317-677-0789', 'jrdoe@hotmail.com', 'Phone'); INSERT INTO ContactInfo VALUES ('00002', '317-709-1313', 'jane_d14@google.com', 'Phone'); INSERT INTO ContactInfo VALUES ('00003', '317-553-3535', 'miller_time@google.com', 'Email'); INSERT INTO ContactInfo VALUES ('00004', '812-688-5643', 'williamshep@yahoo.com', 'Phone'); INSERT INTO ContactInfo VALUES ('00005', '756-131-4456', 'mon4miles@google.com', 'Email'); INSERT INTO ContactInfo VALUES ('00006', '317-551-9812', 'fierfier@outlook.com', 'Phone'); INSERT INTO TreatmentPlan VALUES('jodoe00001', '1', 'S13.4XXA', '00001', '00001'); INSERT INTO TreatmentPlan VALUES('jadoe00002', '1', 'S23.3XXA', '00002', '00002'); INSERT INTO TreatmentPlan VALUES('mamil00003', '1', 'S33.5XXA', '00003', '00003'); INSERT INTO TreatmentPlan VALUES('bishe00004', '1', 'S29.012A', '00004', '00004'); INSERT INTO TreatmentPlan VALUES('momil00005', '2', 'S13.4XXA', '00005', '00005'); INSERT INTO TreatmentPlan VALUES('scfie00006', '2', 'S39.012A', '00006', '00006'); INSERT INTO ICD_10_Codes VALUES('S13.4XXA', 'Sprain Cervical Spine'); INSERT INTO ICD_10_Codes VALUES('S16.1XXA', 'Strain Neck Muscle'); INSERT INTO ICD_10_Codes VALUES('S23.3XXA', 'Sprain Thoracic Spine'); INSERT INTO ICD_10_Codes VALUES('S29.012A', 'Strain Thoracic Muscle'); INSERT INTO ICD_10_Codes VALUES('S33.5XXA', 'Sprain Lumbar Spine'); INSERT INTO ICD_10_Codes VALUES('S39.012A', 'Strain Lumbar Muscle'); INSERT INTO Appointment VALUES('00001', '9:15', 'AM', 'Mon', '1', 'May', '2018'); INSERT INTO Appointment VALUES('00002', '2:00', 'PM', 'Mon', '1', 'May', '2018'); INSERT INTO Appointment VALUES('00003', '5:00', 'PM', 'Mon', '1', 'May', '2018'); INSERT INTO Appointment VALUES('00004', '10:00', 'AM', 'Tue', '2', 'May', '2018'); INSERT INTO Appointment VALUES('00005', '11:00', 'AM', 'Tue', '2', 'May', '2018'); INSERT INTO Appointment VALUES('00006', '3:45', 'PM', 'Tue', '2', 'May', '2018'); INSERT INTO Chiropractor VALUES('Branden', 'Coleman'); INSERT INTO Chiropractor VALUES('Jacob', 'Roberts'); INSERT INTO Chiropractor VALUES('Bryan', 'Walters'); INSERT INTO ReqTherapies VALUES('00001', '0', '1', '1', '1', '0', '1') INSERT INTO ReqTherapies VALUES('00002', '1', '1', '1', '0', '1', '1') INSERT INTO ReqTherapies VALUES('00003', '1', '1', '1', '1', '0', '1') INSERT INTO ReqTherapies VALUES('00004', '1', '1', '1', '0', '1', '1') INSERT INTO ReqTherapies VALUES('00005', '1', '1', '1', '0', '0', '0') INSERT INTO ReqTherapies VALUES('00006', '0', '1', '1', '0', '0', '0')
CREATE PROCEDURE Proc_UpdateSupportStaff @id INT, @name VARCHAR(255), @building VARCHAR(255) AS UPDATE StaffDetails SET Name=@name WHERE Id=@id; UPDATE SupportStaffDetails SET Building=@building WHERE StaffId=@id;
# LeetCode 182: Duplicate Emails SELECT DISTINCT P1.Email FROM Person P1, Person P2 WHERE P1.Email = P2.Email AND P1.Id <> P2.Id;
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jun 18, 2020 at 02:48 PM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.3.17 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `db_store` -- -- -------------------------------------------------------- -- -- Table structure for table `tbl_admin` -- CREATE TABLE `tbl_admin` ( `adminId` int(11) NOT NULL, `adminName` varchar(200) NOT NULL, `adminUser` varchar(200) NOT NULL, `adminEmail` varchar(200) NOT NULL, `adminPass` varchar(200) NOT NULL, `level` tinyint(4) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_admin` -- INSERT INTO `tbl_admin` (`adminId`, `adminName`, `adminUser`, `adminEmail`, `adminPass`, `level`) VALUES (1, 'Gulam', 'admin', 'admin@gmail.com', '81dc9bdb52d04dc20036dbd8313ed055', 0), (2, 'Gulam', 'admin', 'gulam@gmail.com', '81dc9bdb52d04dc20036dbd8313ed055', 0); -- -------------------------------------------------------- -- -- Table structure for table `tbl_brand` -- CREATE TABLE `tbl_brand` ( `brandId` int(11) NOT NULL, `brandName` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_brand` -- INSERT INTO `tbl_brand` (`brandId`, `brandName`) VALUES (1, 'IPHONE'), (2, 'SUMSUNG'), (3, 'ACER'), (4, 'Zara'), (5, 'POLO'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_cart` -- CREATE TABLE `tbl_cart` ( `cartId` int(11) NOT NULL, `sId` varchar(255) NOT NULL, `productId` int(11) NOT NULL, `productName` varchar(255) NOT NULL, `price` float(10,2) NOT NULL, `quantity` int(10) NOT NULL, `image` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_cart` -- INSERT INTO `tbl_cart` (`cartId`, `sId`, `productId`, `productName`, `price`, `quantity`, `image`) VALUES (11, 'tgn7j0cnaieqtbpr7f3svajdf4', 4, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 570.00, 1, 'upload/ed7834a0a2.png'), (12, 'j6ivuerv6jvsd0r86oq45fnpaa', 4, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 570.00, 1, 'upload/ed7834a0a2.png'), (13, 'j6ivuerv6jvsd0r86oq45fnpaa', 5, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 2500.00, 2, 'upload/11d632d00c.jpg'), (18, 'aetp892kglle0tb8su540plnou', 6, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 2700.00, 2, 'upload/de620004a3.jpg'), (19, 'aetp892kglle0tb8su540plnou', 5, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 570.00, 1, 'upload/ed7834a0a2.png'), (20, 'aetp892kglle0tb8su540plnou', 2, 'This is I pade', 2500.00, 1, 'upload/11d632d00c.jpg'), (35, 'titktvaiqg9ffkojrfgqcrpmb3', 5, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 570.00, 1, 'upload/ed7834a0a2.png'), (36, 'titktvaiqg9ffkojrfgqcrpmb3', 2, 'This is I pade', 2500.00, 3, 'upload/11d632d00c.jpg'), (39, 'uluau637ot98j4e0vmmgihipf1', 5, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 570.00, 1, 'upload/ed7834a0a2.png'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_category` -- CREATE TABLE `tbl_category` ( `catId` int(11) NOT NULL, `catName` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_category` -- INSERT INTO `tbl_category` (`catId`, `catName`) VALUES (4, 'Software'), (5, 'Sports & Fitness'), (6, 'Jewellery'), (7, 'Footwear'), (10, 'Beauty &amp; Healthcare11'), (11, 'Toys, Kids &amp; Babies'), (12, 'Toys, Kids &amp; Babies'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_compare` -- CREATE TABLE `tbl_compare` ( `id` int(11) NOT NULL, `cmrId` int(11) NOT NULL, `productId` int(11) NOT NULL, `productName` varchar(255) NOT NULL, `price` float(10,2) NOT NULL, `image` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `tbl_copy` -- CREATE TABLE `tbl_copy` ( `id` int(11) NOT NULL, `copyright` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_copy` -- INSERT INTO `tbl_copy` (`id`, `copyright`) VALUES (1, 'gulam12 Learning project'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_customer` -- CREATE TABLE `tbl_customer` ( `id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `address` text NOT NULL, `city` varchar(255) NOT NULL, `country` varchar(255) NOT NULL, `zip` varchar(50) NOT NULL, `phone` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `pass` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_customer` -- INSERT INTO `tbl_customer` (`id`, `name`, `address`, `city`, `country`, `zip`, `phone`, `email`, `pass`) VALUES (1, 'Gulam Md ', 'VILLAGE MAHLI MLANGA DEEH POST PEHAR UTRAULA BALRAMPUR', 'Utraula', 'Nepal12', '2716044', '07703978839', 'gulammlkpg35@gmail.com', '9eeadbd311bd51616a570d525527739a'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_image` -- CREATE TABLE `tbl_image` ( `id` int(11) NOT NULL, `title` varchar(255) NOT NULL, `image` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_image` -- INSERT INTO `tbl_image` (`id`, `title`, `image`) VALUES (1, 'Title1', 'upload/1.jpg'), (2, 'Title2', 'upload/2.jpg'), (3, 'ss', 'upload/6d6485c55d.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_order` -- CREATE TABLE `tbl_order` ( `id` int(11) NOT NULL, `cmrId` int(11) NOT NULL, `productId` int(11) NOT NULL, `productName` varchar(255) NOT NULL, `quantity` int(11) NOT NULL, `price` float(10,2) NOT NULL, `image` varchar(255) NOT NULL, `date` varchar(255) NOT NULL, `status` int(11) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_order` -- INSERT INTO `tbl_order` (`id`, `cmrId`, `productId`, `productName`, `quantity`, `price`, `image`, `date`, `status`) VALUES (7, 1, 4, 'Avoid yeah, yeah phrases', 2, 300.00, 'upload/de620004a3.jpg', 'June-16-2020', 0), (8, 1, 5, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 1, 570.00, 'upload/ed7834a0a2.png', 'June-16-2020', 0), (9, 1, 5, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 1, 570.00, 'upload/ed7834a0a2.png', 'June-16-2020', 0); -- -------------------------------------------------------- -- -- Table structure for table `tbl_product` -- CREATE TABLE `tbl_product` ( `productId` int(11) NOT NULL, `productName` varchar(255) NOT NULL, `catId` int(11) NOT NULL, `brandId` int(11) NOT NULL, `body` text NOT NULL, `price` float(10,2) NOT NULL, `image` varchar(255) NOT NULL, `type` tinyint(4) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_product` -- INSERT INTO `tbl_product` (`productId`, `productName`, `catId`, `brandId`, `body`, `price`, `image`, `type`) VALUES (2, 'This is I pade', 7, 2, 'When it comes to writing your own product descriptions, start by imagining your ideal buyer. What kind of humor does he or she appreciate (if any)? What words does he use? What words does he hate? Is he okay with words like sucky and crappy? What questions does he ask that you should answer?\r\n\r\nConsider how you would speak to your ideal buyer if you were selling your product in store, face-to-face. Now try and incorporate that language into your ecommerce site so you can have a similar conversation online that resonates more deeply.', 2500.00, 'upload/11d632d00c.jpg', 0), (3, 'This is I pade', 7, 3, 'When we sell our own products, we get excited about individual product features and specifications. We live and breathe our company, our website, and our products.\r\n\r\nThe problem is our potential buyers are not as interested in mundane features and specs. They want to know what’s in it for them—how it will address their biggest pain points. That’s why you need to highlight the benefits of each feature.', 2700.00, 'upload/de620004a3.jpg', 1), (4, 'Avoid yeah, yeah phrases', 4, 4, 'hat’s a yeah, yeah phrase. As soon as a potential buyer reads excellent product quality he thinks, yeah, yeah, of course; that’s what everyone says. Ever heard someone describe their product quality as average, not-so-good, or even bad?\r\n\r\nYou become less persuasive when your potential buyer reads your product description and starts saying yeah, yeah to themselves. To avoid this reaction be as specific as possible. Zappos, for instance, doesn’t describe the quality of a pair of shoes as excellent. Instead they describe each technical detail plus its benefit.', 300.00, 'upload/de620004a3.jpg', 1), (5, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 12, 5, '<p>Lorem ipsum dolor sit amet, consectetur adipisicin...', 570.00, 'upload/ed7834a0a2.png', 0); -- -------------------------------------------------------- -- -- Table structure for table `tbl_social` -- CREATE TABLE `tbl_social` ( `id` int(11) NOT NULL, `facebook` varchar(255) NOT NULL, `twitter` varchar(255) NOT NULL, `linkedin` varchar(255) NOT NULL, `googleplus` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_social` -- INSERT INTO `tbl_social` (`id`, `facebook`, `twitter`, `linkedin`, `googleplus`) VALUES (1, 'https://www.facebook.com/ali', 'https://twitter.com/ali', 'https://www.linkedin.com/', 'https://www.youtube.com/'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_wlist` -- CREATE TABLE `tbl_wlist` ( `id` int(11) NOT NULL, `cmrId` int(11) NOT NULL, `productId` int(11) NOT NULL, `productName` varchar(255) NOT NULL, `price` float(10,2) NOT NULL, `image` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `tbl_wlist` -- INSERT INTO `tbl_wlist` (`id`, `cmrId`, `productId`, `productName`, `price`, `image`) VALUES (1, 0, 4, 'Avoid yeah, yeah phrases', 300.00, 'upload/de620004a3.jpg'), (2, 1, 4, 'Avoid yeah, yeah phrases', 300.00, 'upload/de620004a3.jpg'), (3, 1, 5, 'LOREM IPSUM IS SIMPLY DUMMY TEXT', 570.00, 'upload/ed7834a0a2.png'); -- -- Indexes for dumped tables -- -- -- Indexes for table `tbl_admin` -- ALTER TABLE `tbl_admin` ADD PRIMARY KEY (`adminId`); -- -- Indexes for table `tbl_brand` -- ALTER TABLE `tbl_brand` ADD PRIMARY KEY (`brandId`); -- -- Indexes for table `tbl_cart` -- ALTER TABLE `tbl_cart` ADD PRIMARY KEY (`cartId`); -- -- Indexes for table `tbl_category` -- ALTER TABLE `tbl_category` ADD PRIMARY KEY (`catId`); -- -- Indexes for table `tbl_compare` -- ALTER TABLE `tbl_compare` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_copy` -- ALTER TABLE `tbl_copy` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_customer` -- ALTER TABLE `tbl_customer` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_image` -- ALTER TABLE `tbl_image` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_order` -- ALTER TABLE `tbl_order` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_product` -- ALTER TABLE `tbl_product` ADD PRIMARY KEY (`productId`); -- -- Indexes for table `tbl_social` -- ALTER TABLE `tbl_social` ADD PRIMARY KEY (`id`); -- -- Indexes for table `tbl_wlist` -- ALTER TABLE `tbl_wlist` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tbl_admin` -- ALTER TABLE `tbl_admin` MODIFY `adminId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `tbl_brand` -- ALTER TABLE `tbl_brand` MODIFY `brandId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `tbl_cart` -- ALTER TABLE `tbl_cart` MODIFY `cartId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40; -- -- AUTO_INCREMENT for table `tbl_category` -- ALTER TABLE `tbl_category` MODIFY `catId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT for table `tbl_compare` -- ALTER TABLE `tbl_compare` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `tbl_copy` -- ALTER TABLE `tbl_copy` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `tbl_customer` -- ALTER TABLE `tbl_customer` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `tbl_image` -- ALTER TABLE `tbl_image` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `tbl_order` -- ALTER TABLE `tbl_order` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `tbl_product` -- ALTER TABLE `tbl_product` MODIFY `productId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `tbl_social` -- ALTER TABLE `tbl_social` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `tbl_wlist` -- ALTER TABLE `tbl_wlist` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50617 Source Host : localhost:3306 Source Database : ast3_storage Target Server Type : MYSQL Target Server Version : 50617 File Encoding : 65001 Date: 2015-04-24 14:41:12 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `directory_info` -- ---------------------------- DROP TABLE IF EXISTS `directory_info`; CREATE TABLE `directory_info` ( `directory_id` int(11) NOT NULL AUTO_INCREMENT, `directory_name` varchar(255) NOT NULL, `disk_uuid` varchar(255) NOT NULL, `disk_name` varchar(255) NOT NULL, `parent_id` int(11) NOT NULL, `directory_size` double NOT NULL, `time` datetime NOT NULL, `recent_use_time` datetime NOT NULL, `permission` int(11) NOT NULL, `accessed_time` int(11) NOT NULL, `file_number` int(11) NOT NULL, PRIMARY KEY (`directory_id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of directory_info -- ---------------------------- INSERT INTO `directory_info` VALUES ('1', '20150424', '51bb74393f2646d7bd46b4427ade5e17', 'disk_001', '0', '1000', '2015-04-24 14:39:18', '2015-04-24 14:39:21', '0', '0', '2'); INSERT INTO `directory_info` VALUES ('2', '20150423', 'c839baea5e8b4513bf5ae156085d5d2d', 'disk_002', '0', '900', '2015-04-24 14:40:26', '2015-04-24 14:40:28', '0', '0', '1'); -- ---------------------------- -- Table structure for `disk_info` -- ---------------------------- DROP TABLE IF EXISTS `disk_info`; CREATE TABLE `disk_info` ( `disk_id` int(11) NOT NULL AUTO_INCREMENT, `disk_name` varchar(255) NOT NULL, `disk_uuid` varchar(255) NOT NULL, `disk_type` varchar(255) NOT NULL, `disk_capacity` double NOT NULL, `disk_used` double NOT NULL, `recent_use_time` datetime NOT NULL, `permisssion` int(11) NOT NULL, `disk_status` int(11) NOT NULL, PRIMARY KEY (`disk_id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of disk_info -- ---------------------------- INSERT INTO `disk_info` VALUES ('1', 'disk_001', '51bb74393f2646d7bd46b4427ade5e17', 'ext3/ext4', '707.8', '500', '2015-04-24 14:37:11', '0', '0'); INSERT INTO `disk_info` VALUES ('2', 'disk_002', 'c839baea5e8b4513bf5ae156085d5d2d', 'ext3/ext4', '800', '300', '2015-04-24 14:38:24', '0', '0'); -- ---------------------------- -- Table structure for `file_info` -- ---------------------------- DROP TABLE IF EXISTS `file_info`; CREATE TABLE `file_info` ( `file_id` int(11) NOT NULL AUTO_INCREMENT, `file_name` varchar(255) NOT NULL, `disk_uuid` varchar(255) NOT NULL, `directory_id` int(11) NOT NULL, `disk_name` varchar(255) NOT NULL, `md5` varchar(255) NOT NULL, `file_size` double NOT NULL, `location` varchar(255) NOT NULL, `time` datetime NOT NULL, `recent_use_time` datetime NOT NULL, `permission` int(11) NOT NULL, `file_type` int(11) NOT NULL, `accessed_time` int(11) NOT NULL, PRIMARY KEY (`file_id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of file_info -- ---------------------------- INSERT INTO `file_info` VALUES ('1', '20150424_0001.fits', '51bb74393f2646d7bd46b4427ade5e17', '1', 'disk_001', '7F97854DC04C119D461FED14F5D8BB96', '100', '100.00,100.00', '2015-04-24 14:31:17', '2015-04-24 14:31:24', '1', '1', '0'); INSERT INTO `file_info` VALUES ('2', '20150424_0002.fits', '51bb74393f2646d7bd46b4427ade5e17', '1', 'disk_001', '7F97854DC04C119D461FED14F5D8BB96', '200', '111.00,111.00', '2015-04-24 14:33:37', '2015-04-24 14:33:40', '1', '1', '0'); INSERT INTO `file_info` VALUES ('3', '20150423_0001.fits', 'c839baea5e8b4513bf5ae156085d5d2d', '1', 'disk_002', '7F97854DC04C119D461FED14F5D8BB96', '150', '120.00,120.00', '2015-04-24 14:35:53', '2015-04-24 14:35:56', '0', '0', '0');
SELECT $%$YR_CDE$%$, $%$TRM_CDE$%$, $%$SESS_CDE$%$, nm.id_num, nm.first_name, nm.last_name, bm.gender, bm.birth_dte, addr.addr_line_1 as email, nm.mobile_phone, COALESCE(stsd.career_hrs_earned, 0) as TotalCredits, COALESCE(stsd.hrs_enrolled, 0) as EnrolledCredits, COALESCE(stsd.career_gpa, 0) as GPA, CASE WHEN c.stage IS NOT NULL AND c.stage NOT IN ('DEP', 'ENR') THEN 'false' ELSE 'true' END as eligible, CASE WHEN c.stage IN ('DEP', 'ENR', 'WDDEP') THEN 'true' ELSE 'false' END as paiddeposit, CASE WHEN c.id_num IS NOT NULL THEN 'New' ELSE 'Returning' END as residenttype, CASE WHEN ext.udef_1a_1 = 'A' THEN 'true' ELSE 'false' END as ApprovedException, am.addr_line_1 as schoolemail, am1.ADDR_LINE_1 as campusbox FROM name_master nm INNER JOIN biograph_master bm ON bm.id_num = nm.id_num INNER JOIN addr_all_email_addrs addr ON addr.id_num = nm.id_num LEFT JOIN stud_term_sum_div stsd ON stsd.id_num = nm.id_num AND stsd.yr_cde = $%$YR_CDE$%$ AND stsd.trm_cde = $%$TRM_CDE$%$ LEFT JOIN candidacy c ON c.id_num = nm.id_num AND c.yr_cde = $%$YR_CDE$%$ AND c.trm_cde = $%$TRM_CDE$%$ AND c.stage IN ('DEP', 'WDDEP', 'ENR', 'ADMIT', 'HOLD', 'WD') AND c.CUR_CANDIDACY = 'Y' LEFT JOIN stud_sess_asgn_ext ext ON ext.id_num = stsd.id_num AND ext.sess_cde = $%$SESS_CDE$%$ LEFT JOIN address_master am ON am.id_num = nm.id_num AND am.addr_cde = '*EML' LEFT JOIN address_master am1 ON am1.id_num = nm.id_num AND am1.addr_cde = 'CBOX' WHERE (c.id_num IS NOT NULL OR stsd.id_num IS NOT NULL) AND bm.birth_dte IS NOT NULL AND bm.gender IS NOT NULL
DROP TABLE IF EXISTS books; DROP TABLE IF EXISTS authors; DROP SEQUENCE IF EXISTS global_seq; CREATE SEQUENCE global_seq START 100000; CREATE TABLE authors ( id BIGINT PRIMARY KEY DEFAULT nextval('global_seq'), name VARCHAR NOT NULL, surname VARCHAR NOT NULL, patronymic VARCHAR NOT NULL, birthday DATE NOT NULL ); CREATE TABLE books ( id BIGINT PRIMARY KEY DEFAULT nextval('global_seq'), name VARCHAR NOT NULL, isbn VARCHAR NOT NULL, subject VARCHAR NOT NULL, auth_id BIGINT, FOREIGN KEY (auth_id) REFERENCES authors(id) ); DELETE FROM authors; DELETE FROM books; INSERT INTO authors (name, patronymic, surname, birthday) VALUES ('Alex', 'Serg','Pushkin', '1799-06-06'), ('Nickolay', 'Vasil','Gogol', '1809-04-01'), ('Ivab', 'Vasil','Ivanov', '1929-01-11'), ('Iv2ab', 'Vasil','Ivanov', '1929-01-11'), ('ss', 'ddl','Iffov', '1929-01-11'); INSERT INTO books (name, isbn, subject, auth_id) VALUES ('Ruslan and Ludmila', '321-TT', 'Poem', 100000), ('Dubrovsky', '311-TG', 'Povest', 100000), ('Mertvie dushi', '417-GL', 'Poem', 100001), ('Revizor', '301-GG', 'Comedy', 100001);
SELECT KNOWLEDGES.KNOWLEDGE_ID, KNOWLEDGES.TITLE AS KNOWLEDGE_TITLE, SURVEYS.TITLE AS TITLE FROM KNOWLEDGES INNER JOIN SURVEYS ON (KNOWLEDGES.KNOWLEDGE_ID = SURVEYS.KNOWLEDGE_ID) WHERE KNOWLEDGES.DELETE_FLAG = 0 AND CAST(KNOWLEDGES.KNOWLEDGE_ID AS VARCHAR(20)) LIKE ? || '%' AND ( KNOWLEDGES.PUBLIC_FLAG = 0 OR ( KNOWLEDGES.PUBLIC_FLAG = 1 AND KNOWLEDGES.INSERT_USER = ? ) OR ( KNOWLEDGES.PUBLIC_FLAG = 2 AND EXISTS ( SELECT * FROM KNOWLEDGE_USERS WHERE KNOWLEDGES.KNOWLEDGE_ID = KNOWLEDGE_USERS.KNOWLEDGE_ID AND KNOWLEDGE_USERS.USER_ID = ? ) ) OR ( KNOWLEDGES.PUBLIC_FLAG = 2 AND EXISTS ( SELECT * FROM KNOWLEDGE_GROUPS WHERE KNOWLEDGES.KNOWLEDGE_ID = KNOWLEDGE_GROUPS.KNOWLEDGE_ID AND KNOWLEDGE_GROUPS.GROUP_ID IN (%GROUPS%) ) ) ) ORDER BY KNOWLEDGES.KNOWLEDGE_ID ASC LIMIT ? OFFSET ?;
alter table ACT_HI_VARINST add column SCOPE_ID_ nvarchar(255); alter table ACT_HI_VARINST add column SUB_SCOPE_ID_ nvarchar(255); alter table ACT_HI_VARINST add column SCOPE_TYPE_ nvarchar(255); create index ACT_IDX_HI_VAR_SCOPE_ID_TYPE on ACT_HI_VARINST(SCOPE_ID_, SCOPE_TYPE_); create index ACT_IDX_HI_VAR_SUB_ID_TYPE on ACT_HI_VARINST(SUB_SCOPE_ID_, SCOPE_TYPE_);
SELECT City.Name, City.Population, Country.Population FROM City INNER JOIN Country ON City.CountryCode = Country.Code ORDER BY (1.0 * City.Population / Country.Population) DESC, City.Name DESC LIMIT 20;
-- CREATE TABLE CREATE TABLE t_base_role ( pkid VARCHAR2(64) NOT NULL, role_name VARCHAR2(512), create_by VARCHAR2(64) NOT NULL, create_date DATE NOT NULL, update_by VARCHAR2(64), update_date DATE, is_deleted VARCHAR2(1) DEFAULT 0 NOT NULL, remarks VARCHAR2(4000) ); -- ADD COMMENTS TO THE TABLE COMMENT ON TABLE t_base_role IS '角色表'; -- ADD COMMENTS TO THE COLUMNS COMMENT ON COLUMN t_base_role.pkid IS '主键'; COMMENT ON COLUMN t_base_role.role_name IS '角色名称'; COMMENT ON COLUMN t_base_role.create_by IS '创建者主键'; COMMENT ON COLUMN t_base_role.create_date IS '创建日期'; COMMENT ON COLUMN t_base_role.update_by IS '更新者主键'; COMMENT ON COLUMN t_base_role.update_date IS '更新日期'; COMMENT ON COLUMN t_base_role.is_deleted IS '是否删除,1为删除,0为未删除,默认为0'; COMMENT ON COLUMN t_base_role.remarks IS '备注(备用字段)'; ALTER TABLE t_base_role ADD CONSTRAINT rolePK PRIMARY KEY (pkid);
CREATE TABLE IF NOT EXISTS TablaComentarios( id INTEGER PRIMARY KEY AUTOINCREMENT, Usuario TEXT, Comentario TEXT ); INSERT or IGNORE INTO TablaComentarios(id, Usuario, Comentario) VALUES (1, 'Pepito', 'Esta delicioso el plantillo '); INSERT or IGNORE INTO TablaComentarios(id, Usuario, Comentario) VALUES (2, 'Juanito', 'Muy bueno el platillo');
create table if not exists book ( book_id serial, book_name varchar (500) ); create table book_price ( price_id serial, book_price double precision, price_date timestamp default current_timestamp, book_id bigint ); create sequence if not exists book_id_seq start 1; create sequence if not exists price_id_seq start 1; insert into book values(nextval('book_id_seq'),'Рассказ о пухлом'); insert into book_price values(nextval('price_id_seq'),1000,date_trunc('week', current_timestamp),1); insert into book_price values(nextval('price_id_seq'),1000,date_trunc('day', current_timestamp),1);
/* Formatted on 08/10/2013 09:09:36 a.m. (QP5 v5.163.1008.3004) */ -------------------------------------------------------------------------------- DROP TABLE HJPF01_REN; CREATE TABLE HJPF01_REN AS (SELECT * FROM HJPF01_REN@SQLDESARROLLODSN); -------------------------------------------------------------------------------- DROP TABLE HJPF02_REN; CREATE TABLE HJPF02_REN AS (SELECT * FROM HJPF02_REN@SQLDESARROLLODSN); -------------------------------------------------------------------------------- DROP TABLE HJPF03_REN; CREATE TABLE HJPF03_REN AS (SELECT * FROM HJPF03_REN@SQLDESARROLLODSN); -------------------------------------------------------------------------------- DROP TABLE HJPF05_REN; CREATE TABLE HJPF05_REN AS (SELECT * FROM HJPF05_REN@SQLDESARROLLODSN); -------------------------------------------------------------------------------- DROP TABLE REPF14_REN; CREATE TABLE REPF14_REN AS (SELECT * FROM REPF14_REN@SQLDESARROLLODSN); -------------------------------------------------------------------------------- DROP TABLE REPF15_REN; CREATE TABLE REPF15_REN AS (SELECT * FROM REPF15_REN@SQLDESARROLLODSN); -------------------------------------------------------------------------------- DROP TABLE HJPF25_REN; CREATE TABLE HJPF25_REN AS (SELECT * FROM HJPF25_REN@SQLDESARROLLODSN); DROP TABLE HJPF26_REN; CREATE TABLE HJPF26_REN AS (SELECT * FROM HJPF26_REN@SQLDESARROLLODSN); DROP TABLE HJPF27_REN; CREATE TABLE HJPF27_REN AS (SELECT * FROM HJPF27_REN@SQLDESARROLLODSN); DROP TABLE HJPF29_REN; CREATE TABLE HJPF29_REN AS (SELECT * FROM HJPF29_REN@SQLDESARROLLODSN); DROP TABLE FNPF05_REN; CREATE TABLE FNPF05_REN AS (SELECT * FROM FNPF05_REN@SQLDESARROLLODSN); DROP TABLE HJPF71_REN; CREATE TABLE HJPF71_REN AS (SELECT * FROM HJPF71_REN@SQLDESARROLLODSN); DROP TABLE HJPF75_REN; CREATE TABLE HJPF75_REN AS (SELECT * FROM HJPF75_REN@SQLDESARROLLODSN);
DROP PROCEDURE CPI.GENERATE_OR_NO; CREATE OR REPLACE PROCEDURE CPI.generate_or_no ( p_branch_cd IN GIAC_OR_PREF.branch_cd%TYPE, p_fund_cd IN GIAC_OR_PREF.fund_cd%TYPE, p_or_pref IN giac_doc_sequence.doc_pref_suf%TYPE, p_user IN GIIS_USERS.user_id%TYPE, p_or_type IN VARCHAR2, p_or_no OUT NUMBER, p_mesg OUT VARCHAR2 ) IS v_parm GIAC_PARAMETERS.param_value_v%TYPE; v_min giac_doc_sequence_user.min_seq_no%TYPE; v_max giac_doc_sequence_user.max_seq_no%TYPE; v_cashier_cd GIAC_DCB_USERS.cashier_cd%TYPE; v_doc_name VARCHAR2(20); v_flag char(1); cursor chk_spoil (v_spoil number) is SELECT or_no FROM giac_spoiled_or WHERE or_no >= v_spoil AND NVL(or_pref,'-') = NVL(p_or_pref, NVL(or_pref,'-')) AND fund_cd = p_fund_cd AND branch_cd = p_branch_cd ORDER BY or_no; BEGIN BEGIN SELECT cashier_cd INTO v_cashier_cd FROM giac_dcb_users WHERE gibr_branch_cd = p_branch_cd AND dcb_user_id = p_user; EXCEPTION WHEN NO_DATA_FOUND then v_cashier_cd := NULL; END; IF UPPER(p_or_type) = 'V' THEN v_doc_name := 'VAT OR'; ELSIF UPPER(p_or_type) = 'N' THEN v_doc_name := 'NON VAT OR'; ELSE v_doc_name := 'MISC_OR'; END IF; BEGIN SELECT param_value_v INTO v_parm FROM giac_parameters WHERE param_name = 'OR_SEQ_PER_USER'; EXCEPTION WHEN NO_DATA_FOUND THEN v_parm := 'N'; END; p_mesg := 'Y'; v_min := 1; v_max := 1; IF v_parm = 'Y' THEN BEGIN SELECT min_seq_no, max_seq_no INTO v_min, v_max FROM giac_doc_sequence_user WHERE doc_code = 'OR' AND branch_cd = p_branch_cd AND user_cd = v_cashier_cd AND doc_pref = p_or_pref AND active_tag = 'Y'; v_flag := 'Y'; EXCEPTION WHEN NO_DATA_FOUND THEN v_min := 1; v_max := 1; v_flag := 'N'; END; -- // GET OR NUMBER BEGIN SELECT nvl(max(or_no)+1,v_min) INTO p_or_no FROM giac_order_of_payts WHERE gibr_gfun_fund_cd = p_fund_cd AND gibr_branch_cd = p_branch_cd AND NVL(or_pref_suf, '-') = NVL(p_or_pref, NVL(or_pref_suf,'-')) AND or_no between v_min and v_max; IF p_or_no > v_max and v_flag = 'Y' THEN p_mesg := 'O.R. Number exceeds maximum sequence number for the booklet.'; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN p_or_no := v_min; END; -- / / / ELSE BEGIN SELECT doc_seq_no INTO p_or_no FROM giac_doc_sequence WHERE fund_cd = p_fund_cd AND branch_cd = p_branch_cd AND NVL(doc_pref_suf, '-') = NVL(p_or_pref, NVL(doc_pref_suf,'-')) AND doc_name = v_doc_name; p_or_no := p_or_no + 1; EXCEPTION WHEN NO_DATA_FOUND THEN p_or_no := 1; END; FOR i IN chk_spoil (p_or_no) LOOP IF i.or_no = p_or_no THEN p_or_no := p_or_no + 1; END IF; END LOOP; END IF; END; /
-- lastmod 9 luglio 2013 -- lastmod 11 febbraio 2012 -- lastmod 10 febbraio 2012 -- lastmod 19 gennaio 2012 update entities set procedures=null where procedures notnull; -- museo torino update entities set procedures=' def nontrovato(s) r = (/No results for sid/ =~ s) r.nil? ? false : true end def trovato(s) r = (/<div id="biblio_form_container">/ =~ s) r.nil? ? false : true end ' where id=0; -- museo torino (digitalizzati) update entities set procedures=' def nontrovato(s) r = (/404 Page Not Found/ =~ s) r.nil? ? false : true end def trovato(s) r = (/onLoad="afterLoad()"/ =~ s) if r.nil? r = (/<h1>Index of/ =~ s) end r.nil? ? false : true end ' where id=7; -- librinlinea -- update entities set procedures=' def nontrovato(s) r = (/bid inesistente:/ =~ s) r.nil? ? false : true end def trovato(s) r = (/Dove lo trovi/ =~ s) r.nil? ? false : true end def estrai_biblioteche(s,abe) doc=Nokogiri::HTML(s) a=doc.search(".paging").search(".linkmappa").to_a.collect {|x| x.text} a.uniq end ' where id=1; -- bct clavis update entities set procedures=' def nontrovato(s) r = (/<title>Pagina non trovata/ =~ s) r.nil? ? false : true end def trovato(s) doc=Nokogiri::HTML(s) size=doc.search("#details").size size==1 ? true : false end def estrai_biblioteche(s,abe) doc=Nokogiri::HTML(s) a=doc.search("#items").search("a").to_a.collect {|x| x.text.strip.split(" - ").last} a.uniq end def ricavaoid_dabid(bid) return nil if bid.blank? Net::HTTP.get("tobi.selfip.info", "/titles/clavis_mid/#{bid}") end def ricavabid_daoid(oid) return nil if oid.blank? Net::HTTP.get("tobi.selfip.info", "/titles/clavis_mid2bid/#{oid}") end ' where id=2; -- cavour.cilea.it unito update entities set procedures=' def nontrovato(s) r = (/NESSUN DOCUMENTO ESTRATTO/ =~ s) r.nil? ? false : true end def trovato(s) # criterio da migliorare r = (/unimarc/ =~ s) r.nil? ? false : true end def estrai_biblioteche(s,abe) doc=Nokogiri::HTML(s) a=doc.search(".testolocalizzazioni").search("a").to_a.collect {|x| x.text.gsub("\n","").strip} a.delete_if {|x| /Tutte/=~x} a.uniq end ' where id=3; -- polito update entities set procedures=' def nontrovato(s) r = (/record richiesto non esiste/ =~ s) r.nil? ? false : true end def trovato(s) r = (/Formato completo del record/ =~ s) r.nil? ? false : true end def estrai_biblioteche(s,abe) doc=Nokogiri::HTML(s) a=doc.search(".td1").to_a.collect {|x| t=x.text.strip; n=x.parent.children[2].text.strip if (t =~ /^Poss/); n} a.compact.uniq end ' where id=4; update entities set procedures=' def nontrovato(s) doc=Nokogiri::HTML(s) f=doc.search("#form1")[0] return false if f.nil? (f["action"] == "/Opac/RicercaBase.aspx") ? true : false end def trovato(s) puts "sbam page size: #{s.size}" doc=Nokogiri::HTML(s) f=doc.search("#form1")[0] return false if f.nil? puts %Q{in trovato sbam: #{f["action"]}} (f["action"].split("?").first == "/Opac/EsameTitolo.aspx") ? true : false end def ricavabid_daoid(oid) return nil if oid.blank? data=Entity.fetch_web_page("http://sbam.erasmo.it/Opac/EsameTitolo.aspx?IDTIT=#{oid}") doc=Nokogiri::HTML(data) doc.search("#lbBid").text end def estrai_biblioteche(s,abe) doc=Nokogiri::HTML(s) a=doc.search("#gvSbnLocalizza").search("tr").to_a.collect {|x| x.search("span")[0].text} a.uniq end ' where id=5; update entities set procedures=' def nontrovato(s) doc=Nokogiri::HTML(s) false end def trovato(s) doc=Nokogiri::HTML(s) x=doc.search("h3").to_a.collect {|x| x.text if x.text=~/Dublin/}.compact.size x>0 ? true : false end def ricavabid_daoid(oid) return nil if oid.blank? nil end ' where id=8; -- biella - decommentare questa insert per riattivare biella -- insert into entities(id,name,baseurl,sbn,itempath) values (6,'Sistema bibliotecario biellese','www.polobibliotecario.biella.it',true,'vufind/Record/__%%__'); update entities set procedures=' def nontrovato(s) r = (/Record Does Not Exist/ =~ s) r.nil? ? false : true end def trovato(s) r = (/Esporta il record/ =~ s) r.nil? ? false : true end ' where id=6;
/* SQLyog Ultimate v12.16 (64 bit) MySQL - 5.1.50-community : Database - athletica_liveresultate ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`athletica_liveresultate` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `athletica_liveresultate`; /*Table structure for table `config` */ DROP TABLE IF EXISTS `config`; CREATE TABLE `config` ( `xConfig` int(11) NOT NULL DEFAULT '0', `ftpHost` varchar(100) NOT NULL DEFAULT '', `ftpUser` varchar(30) NOT NULL DEFAULT '', `ftpPwd` varchar(30) NOT NULL DEFAULT '', `url` varchar(100) NOT NULL DEFAULT '', `dir` varchar(100) DEFAULT '', PRIMARY KEY (`xConfig`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*Data for the table `config` */ insert into `config`(`xConfig`,`ftpHost`,`ftpUser`,`ftpPwd`,`url`) values (0,'','','',''); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
INSERT INTO recipe_diets (recipe_id, diet_id) VALUES (3, 1), (3, 2);
-- -------------------------------------------------- -- Generated by Enterprise Architect Version 8.0.856 -- Created On : martes, 27 octubre, 2015 -- DBMS : SQL Server 2005 -- -------------------------------------------------- CREATE TABLE ADM_TUSUA ( USUA_USUA numeric(38) NOT NULL, -- id de tabla usuarios USUA_NOMB varchar(255), -- nombre de acceso al sistema USUA_PASS varchar(50), -- Contraseña de acceso al sistema USUA_CREA numeric(38), -- id del usuario que creóel registro USUA_UPDA decimal(38), -- id del usuario que actulizó el registro USUA_ESTA varchar(1), -- Estado del usuario USUA_FUIN timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL, -- Fecha del último ingreso USUA_APELL varchar(50), -- Apellido del usuario USUA_NUSU varchar(50), -- Nombre de autenticación del usuario USUA_EMAI varchar(50), -- Email del usuario USUA_TELE varchar(50), -- Telefono de contacto del usuario USUA_NIDE varchar(50) -- Número de identificación del usuario ) ; ALTER TABLE ADM_TUSUA ADD CONSTRAINT PK_Usuarios PRIMARY KEY (USUA_USUA) ;
DROP TABLE IF EXISTS gacha_type; CREATE TABLE gacha_type ( `gacha_type_id` int unsigned NOT NULL COMMENT 'ガチャタイプを識別するためのID', `gacha_type_name` varchar(128) NOT NULL COMMENT 'ガチャタイプ名', `cost_type` int NOT NULL COMMENT 'ガチャを引くのにかかるコストのタイプ 0:無料コイン 1:有料コイン', `cost` int NOT NULL COMMENT 'ガチャを引くのにかかるコスト', PRIMARY KEY (`gacha_type_id`) )CHARACTER SET 'utf8mb4', ENGINE=InnoDB, COMMENT='1レコードが「1セットのガチャ」を意味するテーブル'; INSERT INTO gacha_type SET gacha_type_id='1', gacha_type_name='ノーマルガチャ', cost_type='0', cost='100'; INSERT INTO gacha_type SET gacha_type_id='2', gacha_type_name='プレミアムガチャ', cost_type='1', cost='200'; DROP TABLE IF EXISTS gacha; CREATE TABLE gacha ( `gacha_type_id` int unsigned NOT NULL COMMENT 'ガチャタイプを識別するためのID', `card_id` int unsigned NOT NULL COMMENT '取得できるカードを識別するためのID', `probability` int unsigned NOT NULL COMMENT '取得確率', PRIMARY KEY (`gacha_type_id`, `card_id`) )CHARACTER SET 'utf8mb4', ENGINE=InnoDB, COMMENT='1レコードが「1つのガチャの1アイテム」を意味するテーブル'; INSERT INTO gacha SET gacha_type_id='1', card_id='1', probability='10'; INSERT INTO gacha SET gacha_type_id='1', card_id='2', probability='10'; INSERT INTO gacha SET gacha_type_id='1', card_id='3', probability='10'; INSERT INTO gacha SET gacha_type_id='1', card_id='4', probability='10'; INSERT INTO gacha SET gacha_type_id='1', card_id='5', probability='10'; INSERT INTO gacha SET gacha_type_id='1', card_id='6', probability='10'; INSERT INTO gacha SET gacha_type_id='1', card_id='7', probability='10'; INSERT INTO gacha SET gacha_type_id='1', card_id='8', probability='10'; INSERT INTO gacha SET gacha_type_id='1', card_id='9', probability='10'; INSERT INTO gacha SET gacha_type_id='1', card_id='10', probability='2'; INSERT INTO gacha SET gacha_type_id='1', card_id='11', probability='2'; INSERT INTO gacha SET gacha_type_id='1', card_id='12', probability='2'; INSERT INTO gacha SET gacha_type_id='1', card_id='13', probability='2'; INSERT INTO gacha SET gacha_type_id='1', card_id='14', probability='1'; INSERT INTO gacha SET gacha_type_id='1', card_id='15', probability='1'; INSERT INTO gacha SET gacha_type_id='2', card_id='9', probability='15'; INSERT INTO gacha SET gacha_type_id='2', card_id='10', probability='15'; INSERT INTO gacha SET gacha_type_id='2', card_id='11', probability='15'; INSERT INTO gacha SET gacha_type_id='2', card_id='12', probability='15'; INSERT INTO gacha SET gacha_type_id='2', card_id='13', probability='15'; INSERT INTO gacha SET gacha_type_id='2', card_id='14', probability='15'; INSERT INTO gacha SET gacha_type_id='2', card_id='15', probability='10'; DROP TABLE IF EXISTS cards; CREATE TABLE cards ( `card_id` int unsigned NOT NULL COMMENT 'カードを識別するためのID', `card_name` varchar(128) NOT NULL COMMENT 'カード名', `attack` int unsigned NOT NULL COMMENT '攻撃力', `defense` int unsigned NOT NULL COMMENT '防御力', `flavor_text` text NOT NULL COMMENT 'フレーバーテキスト', PRIMARY KEY (`card_id`) )CHARACTER SET 'utf8mb4', ENGINE=InnoDB, COMMENT='1レコードが1枚のカードを意味するテーブル'; INSERT INTO cards SET card_id='1', card_name='コボルト', attack='5', defense='5', flavor_text='キング of 雑魚'; INSERT INTO cards SET card_id='2', card_name='ゴブリン', attack='6', defense='4', flavor_text='一般的な雑魚'; INSERT INTO cards SET card_id='3', card_name='スケルトン', attack='10', defense='2', flavor_text='ポピュラーなアンデッド'; INSERT INTO cards SET card_id='4', card_name='ゾンビ', attack='8', defense='6', flavor_text='ポピュラーなアンデッド'; INSERT INTO cards SET card_id='5', card_name='スライム', attack='20', defense='15', flavor_text='意外と強いよ?'; INSERT INTO cards SET card_id='6', card_name='インプ', attack='15', defense='20', flavor_text='ちょこまかやかましい'; INSERT INTO cards SET card_id='7', card_name='ホブゴブリン', attack='30', defense='10', flavor_text='ホブってるから強い'; INSERT INTO cards SET card_id='8', card_name='オーク', attack='50', defense='25', flavor_text='場所によっては豚扱い'; INSERT INTO cards SET card_id='9', card_name='キャリオンクロウラー', attack='100', defense='50', flavor_text='トラウマになりうるモンスター'; INSERT INTO cards SET card_id='10', card_name='エレメンタル', attack='150', defense='150', flavor_text='いわゆる精霊たち'; INSERT INTO cards SET card_id='11', card_name='ガーゴイル', attack='200', defense='250', flavor_text='魔法生物としてはおなじみ'; INSERT INTO cards SET card_id='12', card_name='ヴァンパイア', attack='400', defense='300', flavor_text='おつよいアンデッド'; INSERT INTO cards SET card_id='13', card_name='ケルベロス', attack='1000', defense='500', flavor_text='三つ首のワンコ'; INSERT INTO cards SET card_id='14', card_name='ジャバウォック', attack='1500', defense='1500', flavor_text='魔獣。正体不明で怖い'; INSERT INTO cards SET card_id='15', card_name='ドラゴン', attack='5000', defense='5000', flavor_text='問答無用系モンスター'; -- 決まった時間になったらtruncateする(と、引けるようになる) -- TRUNCATE TABLE daily_gacha; DROP TABLE IF EXISTS daily_gacha; CREATE TABLE daily_gacha ( `user_id` int unsigned NOT NULL COMMENT 'ユーザを識別するためのID', PRIMARY KEY (`user_id`) )CHARACTER SET 'utf8mb4', ENGINE=InnoDB, COMMENT='1レコードが「今日、無料がちゃを引いたかどうか」を意味するテーブル'; DROP TABLE IF EXISTS users_deck; CREATE TABLE users_deck ( `users_deck_id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '「1ユーザの1枚のカード」を識別するためのID', `user_id` int unsigned NOT NULL COMMENT 'ユーザを識別するためのID', `card_id` int unsigned NOT NULL COMMENT 'カードを識別するためのID', `created` datetime NOT NULL COMMENT 'カード取得日', PRIMARY KEY (`users_deck_id`) );
DECLARE v_dummy INTEGER; BEGIN SELECT NULL INTO v_dummy FROM tbl_casecc WHERE col_id = :CaseId; RETURN 1; EXCEPTION WHEN OTHERS THEN RETURN 0; END;
{{ config( alias='pools', post_hook='{{ expose_spells(\'["ethereum"]\', "project", "sudoswap", \'["niftytable"]\') }}') }} WITH pool_stats AS ( SELECT pool_address, nft_contract_address, creator_address, pool_type, pricing_type, initial_price, initial_nft_count, initial_eth, day_created, delta, spot_price FROM {{ ref('sudoswap_ethereum_pool_balance_changes') }} ORDER BY DAY DESC LIMIT 1 -- To get the most recent delta and spot price ), pool_balance AS ( SELECT pool_address, SUM(nft_balance_change) AS nft_balance, SUM(eth_balance_change) AS eth_balance FROM {{ ref('sudoswap_ethereum_pool_balance_changes') }} GROUP BY 1 ), pool_trades AS ( SELECT pool_address, SUM(eth_volume) AS eth_volume, SUM(nfts_traded) AS nfts_traded, SUM(usd_volume) AS usd_volume, SUM(owner_fee_volume_eth) AS owner_fee_volume_eth, SUM(platform_fee_volume_eth) as platform_fee_volume_eth, SUM(eth_change_trading) AS eth_change_trading, SUM(nft_change_trading) AS nft_change_trading FROM {{ ref('sudoswap_ethereum_pool_trades') }} GROUP BY 1 ) SELECT ps.pool_address AS pool_address, nft_contract_address, creator_address, spot_price, pool_type, pricing_type, delta, day_created, initial_price, initial_nft_count, initial_eth, nft_balance, eth_balance, eth_volume, nfts_traded, usd_volume, owner_fee_volume_eth, platform_fee_volume_eth, eth_change_trading, nft_change_trading FROM pool_stats ps INNER JOIN pool_balance pb ON pb.pool_address = ps.pool_address INNER JOIN pool_trades pt ON pt.pool_address = ps.pool_address ;
# 用户表 drop table if exists mp_user; create table mp_user ( id int(19) not null AUTO_INCREMENT comment '数据主健', open_id varchar(255) not null comment 'openid', nick_name varchar(255) comment '昵称', sex char(1) comment '性别,0-未知,1-男,2-女', language varchar(40) comment '语言', headImgUrl varchar(1000) comment '头像链接', subscribe_scene varchar(40) comment '订阅场景', delete_flag char(1) comment '删除标志', create_date DATETIME comment '创建时间', creator varchar(255) comment '创建人', update_date DATETIME comment '更新时间', updater varchar(255) comment '更新人', primary key (id) );
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 04-08-2021 a las 03:45:41 -- Versión del servidor: 10.4.18-MariaDB -- Versión de PHP: 7.3.27 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de datos: `sistema_test` -- DELIMITER $$ -- -- Procedimientos -- CREATE DEFINER=`root`@`localhost` PROCEDURE `listar_areas_fechas` (IN `f_inicio` DATE, IN `f_fin` DATE) BEGIN SELECT * FROM areas WHERE fec_insercion BETWEEN f_inicio ANd f_fin AND estado=1; END$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `listar_reclamo_confirmados` (IN `f_inicio` DATE, IN `f_fin` DATE) BEGIN SELECT * FROM reclamo_confirmados WHERE fec_insercion BETWEEN f_inicio ANd f_fin AND estado=1; END$$ -- -- Funciones -- CREATE DEFINER=`root`@`localhost` FUNCTION `contar_empleados` () RETURNS INT(11) BEGIN DECLARE resultado INT; SELECT COUNT(id_empleado) INTO resultado FROM empleados WHERE estado=1; RETURN resultado; END$$ CREATE DEFINER=`root`@`localhost` FUNCTION `contar_reclamos` () RETURNS INT(11) BEGIN DECLARE resultado INT; SELECT COUNT(id_reclamo) INTO resultado FROM reclamos WHERE estado=1; RETURN resultado; END$$ DELIMITER ; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `accesos` -- CREATE TABLE `accesos` ( `id_acceso` int(11) NOT NULL, `id_grupo` int(11) NOT NULL, `id_opcion` int(11) NOT NULL, `id_rol` int(11) NOT NULL, `permisos` varchar(60) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `accesos` -- INSERT INTO `accesos` (`id_acceso`, `id_grupo`, `id_opcion`, `id_rol`, `permisos`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (292, 1, 1, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (293, 1, 2, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (294, 1, 3, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (295, 1, 4, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (296, 1, 5, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (297, 1, 6, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (298, 1, 7, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (299, 2, 8, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (300, 3, 9, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (301, 3, 10, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (302, 3, 11, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (303, 3, 12, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (304, 3, 13, 1, 'a', '2021-07-30 22:40:34', '2021-07-30 22:40:34', 1, '1'), (305, 3, 18, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (306, 3, 19, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (307, 3, 20, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (308, 3, 21, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (309, 3, 22, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (310, 3, 23, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (311, 4, 14, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (312, 4, 15, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (313, 4, 16, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (314, 4, 17, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (315, 4, 24, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (316, 4, 25, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (317, 4, 26, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'), (318, 4, 27, 1, 'a', '2021-07-30 22:40:35', '2021-07-30 22:40:35', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `areas` -- CREATE TABLE `areas` ( `id_area` int(11) NOT NULL, `id_sistema_reclamo` int(11) NOT NULL, `nombre` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `descripcion` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `areas` -- INSERT INTO `areas` (`id_area`, `id_sistema_reclamo`, `nombre`, `descripcion`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 1, 'Mantenimientosssss', 'Mantenimiento de tuberias de agua potable y a', '2021-06-30 08:16:34', '2021-06-30 08:16:34', 1, '1'), (2, 1, 'Comercialssdddd', 'Odecos cobros de morasddddddddddddddddddddddd', '2021-06-30 08:31:54', '2021-06-30 08:31:54', 1, '1'), (3, 1, 'ererererddddddddddddddddddddd', 'erererer', '2021-06-30 08:31:46', '2021-06-30 08:31:46', 1, '1'), (4, 1, 'rgtrsh', 'ghgfh', '2021-06-30 08:13:18', '2021-06-30 08:13:18', 1, '0'), (5, 1, 'rrrrrddddddddddddddd', 'fffff', '2021-06-30 08:31:35', '2021-06-30 08:31:35', 1, '0'), (6, 1, 'ssssaaa', 'dddd', '2021-06-30 08:29:51', '2021-06-30 08:29:51', 1, '0'), (7, 1, 'hjygy', 'hjghyjhbbcccccccccccccccccccccc', '2021-06-30 08:31:23', '2021-06-30 08:31:23', 1, '0'), (8, 1, 'tryj', 'tyyjkuyl', '2021-06-30 07:57:26', '2021-06-30 07:57:26', 1, '0'), (9, 1, 'ertyr', 'tytuiu', '2021-06-30 08:14:39', '2021-06-30 08:14:39', 1, '0'), (10, 1, 'ertyr', 'armandocccc', '2021-06-30 07:56:46', '2021-06-30 07:56:46', 1, '0'), (11, 1, 'ertyr', 'armandohjjj', '2021-06-30 08:08:30', '2021-06-30 08:08:30', 1, '0'), (12, 1, 'ertyr', 'armandohjjjdf', '2021-06-30 07:55:59', '2021-06-30 07:55:59', 1, '0'), (13, 1, 'ertyr', 'armandohjjjdf', '2021-06-30 08:22:50', '2021-06-30 08:22:50', 1, '0'), (14, 1, 'rosa', 'armandocccc', '2021-06-30 08:18:31', '2021-06-30 08:18:31', 1, '0'), (15, 1, 'rosaliadfdf', 'armandocccc', '2021-06-30 08:18:18', '2021-06-30 08:18:18', 1, '0'), (16, 1, 'rosaliaccccccc', 'armandocccc', '2021-06-30 08:16:45', '2021-06-30 08:16:45', 1, '0'), (17, 1, 'teamo', 'armandocccc', '2021-06-30 08:24:41', '2021-06-30 08:24:41', 1, '0'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `asignaciones` -- CREATE TABLE `asignaciones` ( `id_asignar` int(11) NOT NULL, `id_conf` int(11) NOT NULL, `id_empleado` int(11) NOT NULL, `descripcion` varchar(100) COLLATE utf8_spanish_ci NOT NULL, `fec_inicio` date NOT NULL, `fec_fin` date NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `asignaciones` -- INSERT INTO `asignaciones` (`id_asignar`, `id_conf`, `id_empleado`, `descripcion`, `fec_inicio`, `fec_fin`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 1, 1, 'kgkjgfgfh', '2021-06-10', '2021-06-12', '2021-06-17 21:25:10', '2021-06-17 21:25:10', 1, '1'), (2, 2, 1, 'gffndsfg', '2021-07-02', '2021-07-03', '2021-07-02 22:58:41', '2021-07-02 22:58:41', 1, '1'); -- -- Disparadores `asignaciones` -- DELIMITER $$ CREATE TRIGGER `inserta_registro_asignaciones` BEFORE INSERT ON `asignaciones` FOR EACH ROW BEGIN INSERT INTO registro_huellas(consulta, fec_insercion,usuario) VALUES ("INSERT-ASIGNACIONES", NEW.fec_insercion, NEW.usuario); END $$ DELIMITER ; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `empleados` -- CREATE TABLE `empleados` ( `id_empleado` int(11) NOT NULL, `id_tipo_empleado` int(11) NOT NULL, `id_area` int(11) NOT NULL, `id_sistema_reclamo` int(11) NOT NULL, `nombres` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `ap` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `am` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `ci` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `tel_fijo` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `tel_cel` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `direccion` varchar(50) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `empleados` -- INSERT INTO `empleados` (`id_empleado`, `id_tipo_empleado`, `id_area`, `id_sistema_reclamo`, `nombres`, `ap`, `am`, `ci`, `tel_fijo`, `tel_cel`, `direccion`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 1, 1, 1, 'Ariel', 'Mendieta', 'ddd', '778', '3534', '5343', 'uuuuggggffffff', '2021-06-10 20:07:09', '2021-06-10 20:07:09', 1, '1'), (2, 1, 1, 1, 'rrr', 'rrr', 'fdsg', '722', '25', '454', 'hgmh', '2021-07-02 02:16:10', '2021-07-02 02:16:10', 1, '0'), (3, 1, 2, 1, 'hjy', 'jhj', 'hj', '27', '2525', '25275', 'jfj', '2021-06-29 21:19:19', '2021-06-29 21:19:19', 1, '0'), (4, 1, 2, 1, 'gfh', 'ghgf', 'gh', '45', '0042', '254', 'fggfxngf', '2021-06-29 21:18:33', '2021-06-29 21:18:33', 1, '0'), (5, 1, 1, 1, 'tjtyj', 'jytjyt', 'jytjtyjuu', '252', '2572', '5272', 'yet5yuhtr', '2021-06-29 21:19:14', '2021-06-29 21:19:14', 1, '0'), (6, 1, 3, 1, 'thth', 'yhyt', 'yjtyj', '72', '2572', '4242', 'dtyrth', '2021-06-29 21:19:05', '2021-06-29 21:19:05', 1, '0'), (7, 1, 1, 1, 'jhghhj', 'hgj', 'ytjuj', '252', '42424', '24424', 'uykt', '2021-07-02 02:17:05', '2021-07-02 02:17:05', 1, '0'), (8, 2, 1, 1, 'Santos ', 'Ramos', 'Tejerina', '4544', '5454', '655', 'La florida', '2021-07-31 00:08:39', '2021-07-31 00:08:39', 1, '1'), (9, 3, 1, 1, 'LIdio', 'Bejarano', 'Senteno', '6644', '6445', '484', 'La florida', '2021-07-31 00:09:30', '2021-07-31 00:09:30', 1, '1'); -- -- Disparadores `empleados` -- DELIMITER $$ CREATE TRIGGER `inserta_registro_empleados` BEFORE INSERT ON `empleados` FOR EACH ROW BEGIN INSERT INTO registro_huellas(consulta, fec_insercion,usuario) VALUES ("INSERT-EMPLEADOS", NEW.fec_insercion, NEW.usuario); END $$ DELIMITER ; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `grupos` -- CREATE TABLE `grupos` ( `id_grupo` int(11) NOT NULL, `grupo` varchar(100) COLLATE utf8_spanish_ci NOT NULL, `icono` varchar(200) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `gr_estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `grupos` -- INSERT INTO `grupos` (`id_grupo`, `grupo`, `icono`, `fec_insercion`, `fec_modificacion`, `usuario`, `gr_estado`) VALUES (1, 'Herramientas', 'fa fa-cog', '2021-06-09 07:05:53', '2021-06-09 07:05:53', 1, '1'), (2, 'Parametros', 'fa fa-list', '2021-06-09 07:06:35', '2021-06-09 07:06:35', 1, '1'), (3, 'Sistema', 'fa fa-windows', '2021-06-09 07:07:14', '2021-06-09 07:07:14', 1, '1'), (4, 'Reportes', 'fa fa-table', '2021-06-09 07:07:42', '2021-06-09 07:07:42', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `jefes_areas` -- CREATE TABLE `jefes_areas` ( `id_jefe_area` int(11) NOT NULL, `id_area` int(11) NOT NULL, `nombres` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `ap` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `am` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `ci` int(11) NOT NULL, `telefono` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `correo` char(50) COLLATE utf8_spanish_ci NOT NULL, `fec_inicio` date NOT NULL, `fec_fin` date NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `jefes_areas` -- INSERT INTO `jefes_areas` (`id_jefe_area`, `id_area`, `nombres`, `ap`, `am`, `ci`, `telefono`, `correo`, `fec_inicio`, `fec_fin`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 1, 'fff', 'dddgggggggggg', 'ffff', 42, '4252', 'd@gmail.com', '2021-06-05', '2021-06-10', '2021-06-17 21:13:59', '2021-06-17 21:13:59', 1, '1'), (2, 2, 'gttrYTYTRY', 'bgb', 'bgd', 46044, '4446', 'd@gmail.com', '2021-06-04', '2021-06-05', '2021-06-17 21:15:14', '2021-06-17 21:15:14', 1, '1'), (3, 2, 'ytjy', 'yjyu', 'thtyuythhty', 353, '33', 'g@gmail.com', '2021-06-17', '2021-06-20', '2021-06-17 21:47:28', '2021-06-17 21:47:28', 1, '1'), (4, 3, 'ukuy', 'kuyki', 'uykuyik', 753, '873', 'e@gmail.com', '2021-06-09', '2021-06-18', '2021-06-17 21:48:03', '2021-06-17 21:48:03', 1, '1'), (5, 2, 'iuyiuyi', 'iuyiy', 'iuyiuyiu', 5873, '36536', 'd@gmail.com', '2021-06-16', '2021-06-18', '2021-06-17 21:48:35', '2021-06-17 21:48:35', 1, '1'), (6, 1, 'kuiu', 'yuyi', 'yytuytu', 33, '35433', 'c@gmail.com', '2021-06-17', '2021-06-25', '2021-06-17 21:49:07', '2021-06-17 21:49:07', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `opciones` -- CREATE TABLE `opciones` ( `id_opcion` int(11) NOT NULL, `id_grupo` int(11) NOT NULL, `nombre` varchar(100) COLLATE utf8_spanish_ci NOT NULL, `op_url` varchar(200) COLLATE utf8_spanish_ci NOT NULL, `mostrar` varchar(20) COLLATE utf8_spanish_ci NOT NULL, `orden` int(100) NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `op_estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `opciones` -- INSERT INTO `opciones` (`id_opcion`, `id_grupo`, `nombre`, `op_url`, `mostrar`, `orden`, `fec_insercion`, `fec_modificacion`, `usuario`, `op_estado`) VALUES (1, 1, 'Personas', '../tablaSeguridad/personas.php', 'si', 1, '2021-06-09 07:00:25', '2021-06-09 07:00:25', 1, '1'), (2, 1, 'Usuario', '../tablaSeguridad/usuario.php', 'si', 2, '2021-06-10 04:18:19', '2021-06-10 04:18:19', 1, '1'), (3, 1, 'Usuario roles', '../tablaSeguridad/usuario_roles.php', 'si', 3, '2021-06-10 04:38:14', '2021-06-10 04:38:14', 1, '1'), (4, 1, 'Roles', '../tablaSeguridad/roles.php', 'si', 4, '2021-06-09 07:03:33', '2021-06-09 07:03:33', 1, '1'), (5, 1, 'Accesos', '../tablaSeguridad/accesos.php', 'si', 5, '2021-06-09 07:04:04', '2021-06-09 07:04:04', 1, '1'), (6, 1, 'Opciones', '../tablaSeguridad/opciones.php', 'si', 6, '2021-06-09 07:04:39', '2021-06-09 07:04:39', 1, '1'), (7, 1, 'Grupos', '../tablaSeguridad/grupos.php', 'si', 7, '2021-06-09 07:05:03', '2021-06-09 07:05:03', 1, '1'), (8, 2, 'Parametro', 'ss', 'si', 1, '2021-06-09 07:08:19', '2021-06-09 07:08:19', 1, '1'), (9, 3, 'Sistema', '../tablas_sistema/mostrar.php', 'si', 1, '2021-06-09 07:10:10', '2021-06-09 07:10:10', 1, '1'), (10, 3, 'Areas', '../tablas_sistema/tabla_areas.php', 'si', 2, '2021-06-09 07:20:51', '2021-06-09 07:20:51', 1, '1'), (11, 3, 'Jefe de Areas', '../tablas_sistema/tabla_jefe_areas.php', 'si', 3, '2021-06-09 07:15:28', '2021-06-09 07:15:28', 1, '1'), (12, 3, 'Empleados', '../tablas_sistema/tabla_empleados.php', 'si', 4, '2021-06-09 07:17:29', '2021-06-09 07:17:29', 1, '1'), (13, 3, 'Asignaciones', '../tablas_sistema/tabla_asignacion.php', 'si', 5, '2021-06-09 07:18:28', '2021-06-09 07:18:28', 1, '1'), (14, 4, 'Rep. Personas Usuarios', ' ../reportes/persona_usuarios.php', 'si', 1, '2021-06-09 07:23:53', '2021-06-09 07:23:53', 1, '1'), (15, 4, 'Rep. Personas Fehcas', '../reportes/persona_fecha.php', 'si', 2, '2021-06-09 07:24:45', '2021-06-09 07:24:45', 1, '1'), (16, 4, 'Rep. Areas y Jefes de Areas', '../reportes/areas_jef.php', 'si', 3, '2021-06-09 07:26:40', '2021-06-09 07:26:40', 1, '1'), (17, 4, 'Areas y Fechas', '../reportes/areas_fech.php', 'si', 4, '2021-06-09 07:27:29', '2021-06-09 07:27:29', 1, '1'), (18, 3, 'Tipo de empleados', '../formularios/tipo_empleados.php', 'si', 6, '2021-06-09 08:05:09', '2021-06-09 08:05:09', 1, '1'), (19, 3, 'Reclamos', '../formularios/reclamos.php', 'si', 7, '2021-06-09 08:10:00', '2021-06-09 08:10:00', 1, '1'), (20, 3, 'Reclamos confirmados', '../formularios/reclamo_confirmados.php', 'si', 8, '2021-06-09 08:10:58', '2021-06-09 08:10:58', 1, '1'), (21, 3, 'mvc', '../view/personas.php', 'si', 24, '2021-06-17 02:53:13', '2021-06-17 02:53:13', 1, '1'), (22, 3, 'sistem', '../view/sistem.php', 'si', 28, '2021-06-17 02:55:53', '2021-06-17 02:55:53', 1, '1'), (23, 3, 'sisresp', '../menu_sistema_responsive/', 'si', 30, '2021-06-18 05:38:38', '2021-06-18 05:38:38', 1, '1'), (24, 4, 'REP. Empleados - Tipo de empleados', '../reportes/empleados_tipo.php', 'si', 5, '2021-06-29 21:33:22', '2021-06-29 21:33:22', 1, '1'), (25, 4, 'RP. Empleados - Fechas', '../reportes/empleados_fechas.php', 'si', 6, '2021-06-29 22:10:50', '2021-06-29 22:10:50', 1, '1'), (26, 4, 'Persona genero', '../formularios/reporte_genero.php', 'si', 8, '2021-07-30 20:48:34', '2021-07-30 20:48:34', 1, '1'), (27, 4, 'Reporte_tipo_empleado_param', '../formularios/reporte_tipo_empleado.php', 'si', 9, '2021-07-30 22:40:17', '2021-07-30 22:40:17', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `personas` -- CREATE TABLE `personas` ( `id_persona` int(11) NOT NULL, `id_sistema_reclamo` int(11) NOT NULL, `ci` varchar(15) COLLATE utf8_spanish_ci NOT NULL, `nombres` varchar(20) COLLATE utf8_spanish_ci NOT NULL, `ap` varchar(30) COLLATE utf8_spanish_ci DEFAULT NULL, `am` varchar(30) COLLATE utf8_spanish_ci DEFAULT NULL, `telefono` varchar(30) COLLATE utf8_spanish_ci DEFAULT NULL, `direccion` varchar(30) COLLATE utf8_spanish_ci DEFAULT NULL, `genero` varchar(90) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `personas` -- INSERT INTO `personas` (`id_persona`, `id_sistema_reclamo`, `ci`, `nombres`, `ap`, `am`, `telefono`, `direccion`, `genero`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 1, '5435', 'Juan', 'Perez', 'Vejarano', '687', 'La florida', 'M', '2021-07-30 21:57:20', '2021-07-30 21:57:20', 1, '1'), (2, 1, '733', 'Maria', 'Tapia', 'Rivera', '7852', 'El Molino', 'F', '2021-07-30 21:58:00', '2021-07-30 21:58:00', 1, '1'), (3, 1, '7373', 'Mirta', 'Quevedo', 'Lozano', '7852857', 'Cenac', 'F', '2021-07-30 21:58:34', '2021-07-30 21:58:34', 1, '1'), (4, 1, '5421', 'Ricardo', 'Arancibia', 'Portal', '454545', 'Luis de Fuentes', 'M', '2021-07-30 21:59:46', '2021-07-30 21:59:46', 1, '1'), (5, 1, '22', 'Fabio', 'Zambrana', 'zeta', '75', 'Tomatitas', 'M', '2021-07-30 22:00:29', '2021-07-30 22:00:29', 1, '1'), (6, 1, '45', 'Lidia', 'Sanches', 'Saabedra', '55', 'El Constructor', 'F', '2021-07-30 22:01:26', '2021-07-30 22:01:26', 1, '1'), (7, 1, '453', 'hjk', 'kh', 'gfhgfgh', '52', 'jh', 'm', '2021-08-03 11:33:15', '2021-08-03 11:33:15', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `reclamos` -- CREATE TABLE `reclamos` ( `id_reclamo` int(11) NOT NULL, `nombres` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `ap` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `am` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `telefono` int(45) NOT NULL, `correo` char(1) COLLATE utf8_spanish_ci NOT NULL, `codigo_usuario` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `barrio` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `calle_avenida` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `entre_que_calles` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `numero_de_casa` int(11) NOT NULL, `referencias` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `descripcion_del_reclamo` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `map` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `otro_recurrente` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `telefono_del_recurrente` int(11) NOT NULL, `tipo_de_calzada` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `reclamos` -- INSERT INTO `reclamos` (`id_reclamo`, `nombres`, `ap`, `am`, `telefono`, `correo`, `codigo_usuario`, `barrio`, `calle_avenida`, `entre_que_calles`, `numero_de_casa`, `referencias`, `descripcion_del_reclamo`, `map`, `otro_recurrente`, `telefono_del_recurrente`, `tipo_de_calzada`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 'hgsfh', 'hdgfh', 'gdh', 0, 'h', 'hdgfh', 'ghd', 'hdhg', '', 0, '', '', '', '', 0, '..........', '2021-06-09 08:11:36', '2021-06-09 08:11:36', 1, '1'), (2, 'dddddd', 'fffffffff', 'gggggggggg', 27227, 'f', '142', 'nnnnn', 'kkkkk', 'xxxxxx', 45, 'thrjyujyfjmuyh', 'hthgjhrdgcbv', 'no', 'dfhfgfvc', 2542, 'hnhg', '2021-06-30 00:06:24', '2021-06-30 00:06:24', 1, '1'), (3, 'rgrthgf', 'hgfhgjhg', 'jghjh', 27527, 'd', '2527', 'ghggh', 'jgjhjgh', 'jhjh', 45, 'hfjgyjfjtku', 'jytgkuuyjy', 'no', 'trhyttr', 2727, 'Cemento', '2021-07-02 22:57:27', '2021-07-02 22:57:27', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `reclamo_confirmados` -- CREATE TABLE `reclamo_confirmados` ( `id_conf` int(11) NOT NULL, `id_reclamo` int(11) NOT NULL, `nombres` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `ap` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `am` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `telefono` int(45) NOT NULL, `correo` char(1) COLLATE utf8_spanish_ci NOT NULL, `codigo_usuario` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `barrio` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `calle_avenida` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `entre_que_calles` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `numero_de_casa` int(11) NOT NULL, `referencias` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `descripcion_del_reclamo` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `fotos` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `map` varchar(45) COLLATE utf8_spanish_ci DEFAULT NULL, `otro_recurrente` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `telefono_del_recurrente` int(11) NOT NULL, `tipo_de_calzada` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `reclamo_confirmados` -- INSERT INTO `reclamo_confirmados` (`id_conf`, `id_reclamo`, `nombres`, `ap`, `am`, `telefono`, `correo`, `codigo_usuario`, `barrio`, `calle_avenida`, `entre_que_calles`, `numero_de_casa`, `referencias`, `descripcion_del_reclamo`, `fotos`, `map`, `otro_recurrente`, `telefono_del_recurrente`, `tipo_de_calzada`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 1, 'hgfd', 'ghdf', 'hgf', 0, 'h', 'ghd', 'dhf', 'hgdf', 'dhg', 0, 'hgfhh', 'ghd', 'fotosbd/cosal.jpg', 'hjh', 'hjfhj', 27275, 'Adoquin', '2021-06-09 08:12:19', '2021-06-09 08:12:19', 1, '1'), (2, 1, 'nghjggbvg', 'hfjhmj,hg', 'jjjhg', 27527, 'd', '2527', 'ghggh', 'jgjhjgh', 'jhjh', 45, 'rtykuyrtrdt', 'e5yr6ut7rytr', 'fotosbd/cosal17.jpg', 'no', 'uytuyikujyu', 2727, 'Cemento', '2021-07-02 22:58:12', '2021-07-02 22:58:12', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `registro_huellas` -- CREATE TABLE `registro_huellas` ( `id_registro_huellas` int(11) NOT NULL, `consulta` varchar(50) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `registro_huellas` -- INSERT INTO `registro_huellas` (`id_registro_huellas`, `consulta`, `fec_insercion`, `usuario`) VALUES (1, 'INSERT-EMPLEADOS', '2021-06-16 00:41:22', 1), (2, 'INSERT-EMPLEADOS', '2021-06-16 00:42:09', 1), (3, 'INSERT-EMPLEADOS', '2021-06-16 00:43:00', 1), (4, 'INSERT-EMPLEADOS', '2021-07-02 02:16:57', 1), (5, 'INSERT-ASIGNACIONES', '2021-07-02 22:58:41', 1), (6, 'INSERT-EMPLEADOS', '2021-07-31 00:08:39', 1), (7, 'INSERT-EMPLEADOS', '2021-07-31 00:09:30', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `roles` -- CREATE TABLE `roles` ( `id_rol` int(11) NOT NULL, `rol` varchar(30) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `roles` -- INSERT INTO `roles` (`id_rol`, `rol`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 'super_administrador', '2021-06-09 06:56:47', '2021-06-09 06:56:47', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `sistema_reclamos` -- CREATE TABLE `sistema_reclamos` ( `id_sistema_reclamo` int(11) NOT NULL, `nombre` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `nombre_creador` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `logo` varchar(200) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `sistema_reclamos` -- INSERT INTO `sistema_reclamos` (`id_sistema_reclamo`, `nombre`, `nombre_creador`, `logo`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 'Cosaalt R.L.', 'Armando', '../fotos/cosaalt.jpg', '2021-06-10 21:58:35', '2021-06-10 21:58:35', 1, '1'), (2, 'dddd', 'ssssfffff', '../fotos/', '2021-07-02 07:58:55', '2021-07-02 07:58:55', 1, '1'), (3, 'dddd', 'ssss', '../fotos/IMG-20200726-WA0015.jpg', '2021-06-12 02:39:59', '2021-06-12 02:39:59', 1, '0'), (4, 'dddd', 'ssss', '../fotos/foto2.jpg', '2021-06-12 02:39:14', '2021-06-12 02:39:14', 1, '0'), (5, 'eric', 'herlan', '../fotos/', '2021-07-07 02:24:37', '2021-07-07 02:24:37', 1, '0'), (6, 'sdf', 'dsf', '../fotos/', '2021-06-30 04:10:05', '2021-06-30 04:10:05', 1, '1'), (7, 'ghg', 'tytj', '../fotos/', '2021-06-30 04:20:12', '2021-06-30 04:20:12', 1, '1'), (8, 'ghg', 'tytj', '../fotos/', '2021-06-30 04:32:14', '2021-06-30 04:32:14', 1, '1'), (9, 'ghg', 'tytj', '../fotos/', '2021-06-30 04:39:20', '2021-06-30 04:39:20', 1, '1'), (10, 'ghg', 'tytj', '../fotos/', '2021-06-30 04:40:01', '2021-06-30 04:40:01', 1, '1'), (11, 'ghg', 'tytj', '../fotos/', '2021-06-30 04:40:09', '2021-06-30 04:40:09', 1, '1'), (12, 'ghg', 'tytj', '../fotos/', '2021-06-30 05:53:17', '2021-06-30 05:53:17', 1, '0'), (13, 'ghg', 'tytj', '../fotos/', '2021-06-30 04:40:30', '2021-06-30 04:40:30', 1, '1'), (14, 'gfn', 'fgn', '../fotos/', '2021-06-30 04:43:05', '2021-06-30 04:43:05', 1, '1'), (15, 'gfn', 'fgn', '../fotos/', '2021-06-30 05:44:39', '2021-06-30 05:44:39', 1, '0'), (16, 'gfn', 'fgn', '../fotos/', '2021-06-30 05:54:03', '2021-06-30 05:54:03', 1, '0'), (17, 'gfn', 'fgn', '../fotos/', '2021-06-30 05:44:40', '2021-06-30 05:44:40', 1, '0'), (18, 'gfn', 'fgn', '../fotos/', '2021-06-30 05:54:02', '2021-06-30 05:54:02', 1, '0'), (19, 'gfn', 'fgn', '../fotos/', '2021-06-30 05:55:26', '2021-06-30 05:55:26', 1, '0'), (20, 'gfn', 'fgn', '../fotos/', '2021-06-30 05:46:06', '2021-06-30 05:46:06', 1, '0'), (21, 'gfn', 'fgn', '../fotos/', '2021-06-30 05:46:04', '2021-06-30 05:46:04', 1, '0'), (22, 'gfn', 'fgn', '../fotos/', '2021-06-30 05:44:02', '2021-06-30 05:44:02', 1, '0'), (23, 'ddfgf', 'hgjhg', '../fotos/', '2021-06-30 06:43:08', '2021-06-30 06:43:08', 1, '1'), (24, 'fff', 'ddd', '../fotos/', '2021-07-02 03:33:34', '2021-07-02 03:33:34', 1, '1'), (25, 'fff', 'ddd', '../fotos/', '2021-07-02 03:38:18', '2021-07-02 03:38:18', 1, '1'), (26, 'fff', 'ddd', '../fotos/', '2021-07-02 03:38:42', '2021-07-02 03:38:42', 1, '1'), (27, 'fff', 'ddd', '../fotos/', '2021-07-02 03:40:18', '2021-07-02 03:40:18', 1, '1'), (28, 'fff', 'ddd', '../fotos/', '2021-07-02 03:40:22', '2021-07-02 03:40:22', 1, '1'), (29, 'fff', 'ddd', '../fotos/', '2021-07-02 03:41:15', '2021-07-02 03:41:15', 1, '1'), (30, 'fff', 'ddd', '../fotos/', '2021-07-02 03:42:19', '2021-07-02 03:42:19', 1, '1'), (31, 'fff', 'ddd', '../fotos/', '2021-07-02 03:43:34', '2021-07-02 03:43:34', 1, '1'), (32, 'fff', 'ddd', './fotos/', '2021-07-07 02:24:59', '2021-07-07 02:24:59', 1, '0'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `tipo_empleados` -- CREATE TABLE `tipo_empleados` ( `id_tipo_empleado` int(11) NOT NULL, `nombre` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `descripcion` varchar(45) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `tipo_empleados` -- INSERT INTO `tipo_empleados` (`id_tipo_empleado`, `nombre`, `descripcion`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 'Plomero', 'mantenimiento de red de agua potable', '2021-06-09 08:05:56', '2021-06-09 08:05:56', 1, '1'), (2, 'albanil', 'limpieza y mantenimiento de la red de alcanta', '2021-07-31 00:07:02', '2021-07-31 00:07:02', 1, '1'), (3, 'cortador', 'cortes de agua potable', '2021-07-31 00:07:15', '2021-07-31 00:07:15', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuarios` -- CREATE TABLE `usuarios` ( `id_usuario` int(11) NOT NULL, `id_persona` int(11) NOT NULL, `nom_usuario` varchar(30) COLLATE utf8_spanish_ci NOT NULL, `clave` varchar(40) COLLATE utf8_spanish_ci NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `usuarios` -- INSERT INTO `usuarios` (`id_usuario`, `id_persona`, `nom_usuario`, `clave`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 1, 'eric', '29988429c481f219b8c5ba8c071440e1', '2021-06-09 06:56:04', '2021-06-09 06:56:04', 1, '1'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuario_roles` -- CREATE TABLE `usuario_roles` ( `id_usuario_rol` int(11) NOT NULL, `id_usuario` int(11) NOT NULL, `id_rol` int(11) NOT NULL, `fec_insercion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fec_modificacion` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `usuario` int(11) NOT NULL, `estado` char(1) COLLATE utf8_spanish_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci; -- -- Volcado de datos para la tabla `usuario_roles` -- INSERT INTO `usuario_roles` (`id_usuario_rol`, `id_usuario`, `id_rol`, `fec_insercion`, `fec_modificacion`, `usuario`, `estado`) VALUES (1, 1, 1, '2021-06-09 06:57:37', '2021-06-09 06:57:37', 1, '1'); -- -------------------------------------------------------- -- -- Estructura Stand-in para la vista `vista_areas` -- (Véase abajo para la vista actual) -- CREATE TABLE `vista_areas` ( `nombre` varchar(45) ,`descripcion` varchar(45) ); -- -------------------------------------------------------- -- -- Estructura Stand-in para la vista `vista_tipo_empleados` -- (Véase abajo para la vista actual) -- CREATE TABLE `vista_tipo_empleados` ( `nombre` varchar(45) ,`descripcion` varchar(45) ); -- -------------------------------------------------------- -- -- Estructura para la vista `vista_areas` -- DROP TABLE IF EXISTS `vista_areas`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vista_areas` AS SELECT `areas`.`nombre` AS `nombre`, `areas`.`descripcion` AS `descripcion` FROM `areas` WHERE `areas`.`estado` = 1 ; -- -------------------------------------------------------- -- -- Estructura para la vista `vista_tipo_empleados` -- DROP TABLE IF EXISTS `vista_tipo_empleados`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vista_tipo_empleados` AS SELECT `tipo_empleados`.`nombre` AS `nombre`, `tipo_empleados`.`descripcion` AS `descripcion` FROM `tipo_empleados` WHERE `tipo_empleados`.`estado` = 1 ; -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `accesos` -- ALTER TABLE `accesos` ADD PRIMARY KEY (`id_acceso`), ADD KEY `id_opcion` (`id_opcion`), ADD KEY `id_grupo` (`id_grupo`), ADD KEY `id_rol` (`id_rol`); -- -- Indices de la tabla `areas` -- ALTER TABLE `areas` ADD PRIMARY KEY (`id_area`), ADD KEY `id_sistema_reclamo` (`id_sistema_reclamo`); -- -- Indices de la tabla `asignaciones` -- ALTER TABLE `asignaciones` ADD PRIMARY KEY (`id_asignar`), ADD KEY `id_conf` (`id_conf`), ADD KEY `id_empleado` (`id_empleado`); -- -- Indices de la tabla `empleados` -- ALTER TABLE `empleados` ADD PRIMARY KEY (`id_empleado`), ADD KEY `id_tipo_empleado` (`id_tipo_empleado`), ADD KEY `id_area` (`id_area`), ADD KEY `id_sistema_reclamo` (`id_sistema_reclamo`); -- -- Indices de la tabla `grupos` -- ALTER TABLE `grupos` ADD PRIMARY KEY (`id_grupo`); -- -- Indices de la tabla `jefes_areas` -- ALTER TABLE `jefes_areas` ADD PRIMARY KEY (`id_jefe_area`), ADD KEY `id_area` (`id_area`); -- -- Indices de la tabla `opciones` -- ALTER TABLE `opciones` ADD PRIMARY KEY (`id_opcion`), ADD KEY `id_grupo` (`id_grupo`); -- -- Indices de la tabla `personas` -- ALTER TABLE `personas` ADD PRIMARY KEY (`id_persona`), ADD KEY `id_sistema_reclamo` (`id_sistema_reclamo`); -- -- Indices de la tabla `reclamos` -- ALTER TABLE `reclamos` ADD PRIMARY KEY (`id_reclamo`); -- -- Indices de la tabla `reclamo_confirmados` -- ALTER TABLE `reclamo_confirmados` ADD PRIMARY KEY (`id_conf`), ADD KEY `id_reclamo` (`id_reclamo`); -- -- Indices de la tabla `registro_huellas` -- ALTER TABLE `registro_huellas` ADD PRIMARY KEY (`id_registro_huellas`); -- -- Indices de la tabla `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id_rol`); -- -- Indices de la tabla `sistema_reclamos` -- ALTER TABLE `sistema_reclamos` ADD PRIMARY KEY (`id_sistema_reclamo`); -- -- Indices de la tabla `tipo_empleados` -- ALTER TABLE `tipo_empleados` ADD PRIMARY KEY (`id_tipo_empleado`); -- -- Indices de la tabla `usuarios` -- ALTER TABLE `usuarios` ADD PRIMARY KEY (`id_usuario`), ADD KEY `id_persona` (`id_persona`); -- -- Indices de la tabla `usuario_roles` -- ALTER TABLE `usuario_roles` ADD PRIMARY KEY (`id_usuario_rol`), ADD KEY `id_usuario` (`id_usuario`), ADD KEY `id_rol` (`id_rol`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `accesos` -- ALTER TABLE `accesos` MODIFY `id_acceso` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=319; -- -- AUTO_INCREMENT de la tabla `areas` -- ALTER TABLE `areas` MODIFY `id_area` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18; -- -- AUTO_INCREMENT de la tabla `asignaciones` -- ALTER TABLE `asignaciones` MODIFY `id_asignar` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT de la tabla `empleados` -- ALTER TABLE `empleados` MODIFY `id_empleado` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT de la tabla `grupos` -- ALTER TABLE `grupos` MODIFY `id_grupo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT de la tabla `jefes_areas` -- ALTER TABLE `jefes_areas` MODIFY `id_jefe_area` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT de la tabla `opciones` -- ALTER TABLE `opciones` MODIFY `id_opcion` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28; -- -- AUTO_INCREMENT de la tabla `personas` -- ALTER TABLE `personas` MODIFY `id_persona` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT de la tabla `reclamos` -- ALTER TABLE `reclamos` MODIFY `id_reclamo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `reclamo_confirmados` -- ALTER TABLE `reclamo_confirmados` MODIFY `id_conf` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT de la tabla `registro_huellas` -- ALTER TABLE `registro_huellas` MODIFY `id_registro_huellas` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT de la tabla `roles` -- ALTER TABLE `roles` MODIFY `id_rol` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT de la tabla `sistema_reclamos` -- ALTER TABLE `sistema_reclamos` MODIFY `id_sistema_reclamo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33; -- -- AUTO_INCREMENT de la tabla `tipo_empleados` -- ALTER TABLE `tipo_empleados` MODIFY `id_tipo_empleado` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `usuarios` -- ALTER TABLE `usuarios` MODIFY `id_usuario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT de la tabla `usuario_roles` -- ALTER TABLE `usuario_roles` MODIFY `id_usuario_rol` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `accesos` -- ALTER TABLE `accesos` ADD CONSTRAINT `accesos_ibfk_1` FOREIGN KEY (`id_opcion`) REFERENCES `opciones` (`id_opcion`), ADD CONSTRAINT `accesos_ibfk_2` FOREIGN KEY (`id_grupo`) REFERENCES `grupos` (`id_grupo`), ADD CONSTRAINT `accesos_ibfk_3` FOREIGN KEY (`id_rol`) REFERENCES `roles` (`id_rol`); -- -- Filtros para la tabla `areas` -- ALTER TABLE `areas` ADD CONSTRAINT `areas_ibfk_1` FOREIGN KEY (`id_sistema_reclamo`) REFERENCES `sistema_reclamos` (`id_sistema_reclamo`); -- -- Filtros para la tabla `asignaciones` -- ALTER TABLE `asignaciones` ADD CONSTRAINT `asignaciones_ibfk_1` FOREIGN KEY (`id_conf`) REFERENCES `reclamo_confirmados` (`id_conf`), ADD CONSTRAINT `asignaciones_ibfk_2` FOREIGN KEY (`id_empleado`) REFERENCES `empleados` (`id_empleado`); -- -- Filtros para la tabla `empleados` -- ALTER TABLE `empleados` ADD CONSTRAINT `empleados_ibfk_1` FOREIGN KEY (`id_tipo_empleado`) REFERENCES `tipo_empleados` (`id_tipo_empleado`), ADD CONSTRAINT `empleados_ibfk_2` FOREIGN KEY (`id_area`) REFERENCES `areas` (`id_area`), ADD CONSTRAINT `empleados_ibfk_3` FOREIGN KEY (`id_sistema_reclamo`) REFERENCES `sistema_reclamos` (`id_sistema_reclamo`); -- -- Filtros para la tabla `jefes_areas` -- ALTER TABLE `jefes_areas` ADD CONSTRAINT `jefes_areas_ibfk_1` FOREIGN KEY (`id_area`) REFERENCES `areas` (`id_area`); -- -- Filtros para la tabla `opciones` -- ALTER TABLE `opciones` ADD CONSTRAINT `opciones_ibfk_1` FOREIGN KEY (`id_grupo`) REFERENCES `grupos` (`id_grupo`); -- -- Filtros para la tabla `personas` -- ALTER TABLE `personas` ADD CONSTRAINT `personas_ibfk_1` FOREIGN KEY (`id_sistema_reclamo`) REFERENCES `sistema_reclamos` (`id_sistema_reclamo`); -- -- Filtros para la tabla `reclamo_confirmados` -- ALTER TABLE `reclamo_confirmados` ADD CONSTRAINT `reclamo_confirmados_ibfk_1` FOREIGN KEY (`id_reclamo`) REFERENCES `reclamos` (`id_reclamo`); -- -- Filtros para la tabla `usuarios` -- ALTER TABLE `usuarios` ADD CONSTRAINT `usuarios_ibfk_1` FOREIGN KEY (`id_persona`) REFERENCES `personas` (`id_persona`); -- -- Filtros para la tabla `usuario_roles` -- ALTER TABLE `usuario_roles` ADD CONSTRAINT `usuario_roles_ibfk_1` FOREIGN KEY (`id_usuario`) REFERENCES `usuarios` (`id_usuario`), ADD CONSTRAINT `usuario_roles_ibfk_2` FOREIGN KEY (`id_rol`) REFERENCES `roles` (`id_rol`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
# --- !Ups create EXTENSION pgcrypto; INSERT INTO book(title, author, description) VALUES ('W pustyni i w puszczy', 'Henryk Sienkiwicz', 'Opis ksiazki'), ('Szklany tron. Tom 4. Królowa Cieni', 'Maas Sarah J.', 'Opis ksiazki Maas Sarah J.'), ('Przygoda fryzjera damskiego', 'Eduardo Mendoza', 'Opis ksiazki 3');
-- phpMyAdmin SQL Dump -- version 3.3.7deb7 -- http://www.phpmyadmin.net -- -- Serveur: localhost -- Généré le : Dim 23 Septembre 2012 à 14:38 -- Version du serveur: 5.1.63 -- Version de PHP: 5.3.3-7+squeeze13 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Base de données: `vetathlon` -- -- -------------------------------------------------------- -- -- Structure de la table `config` -- CREATE TABLE IF NOT EXISTS `config` ( `age_junior` int(3) NOT NULL COMMENT 'Age en dessous duquel on est junior et au dessus ou égale duquel on est majeus', `date` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `config` -- INSERT INTO `config` (`age_junior`, `date`) VALUES (14, '2012-06-17'); -- -------------------------------------------------------- -- -- Structure de la table `departement` -- CREATE TABLE IF NOT EXISTS `departement` ( `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `nom` varchar(60) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Contenu de la table `departement` -- INSERT INTO `departement` (`code`, `nom`) VALUES ('01', 'AIN'), ('02', 'AISNE'), ('03', 'ALLIER'), ('04', 'ALPES DE HAUTES PROVENCE'), ('05', 'HAUTES ALPES'), ('06', 'ALPES MARITIMES'), ('07', 'ARDECHE'), ('08', 'ARDENNES'), ('09', 'ARIEGE'), ('10', 'AUBE'), ('11', 'AUDE'), ('12', 'AVEYRON'), ('13', 'BOUCHES DU RHONE'), ('14', 'CALVADOS'), ('15', 'CANTAL'), ('16', 'CHARENTE'), ('17', 'CHARENTE MARITIME'), ('18', 'CHER'), ('19', 'CORREZE'), ('21', 'COTE D''OR'), ('22', 'COTES D''ARMOR'), ('23', 'CREUSE'), ('24', 'DORDOGNE'), ('25', 'DOUBS'), ('26', 'DROME'), ('27', 'EURE'), ('28', 'EURE ET LOIR'), ('29', 'FINISTERE'), ('2A', 'CORSE DU SUD'), ('2B', 'HAUTE CORSE'), ('30', 'GARD'), ('31', 'HAUTE GARONNE'), ('32', 'GERS'), ('33', 'GIRONDE'), ('34', 'HERAULT'), ('35', 'ILLE ET VILAINE'), ('36', 'INDRE'), ('37', 'INDRE ET LOIRE'), ('38', 'ISERE'), ('39', 'JURA'), ('40', 'LANDES'), ('41', 'LOIR ET CHER'), ('42', 'LOIRE'), ('43', 'HAUTE LOIRE'), ('44', 'LOIRE ATLANTIQUE'), ('45', 'LOIRET'), ('46', 'LOT'), ('47', 'LOT ET GARONNE'), ('48', 'LOZERE'), ('49', 'MAINE ET LOIRE'), ('50', 'MANCHE'), ('51', 'MARNE'), ('52', 'HAUTE MARNE'), ('53', 'MAYENNE'), ('54', 'MEURTHE ET MOSELLE'), ('55', 'MEUSE'), ('56', 'MORBIHAN'), ('57', 'MOSELLE'), ('58', 'NIEVRE'), ('59', 'NORD'), ('60', 'OISE'), ('61', 'ORNE'), ('62', 'PAS DE CALAIS'), ('63', 'PUY DE DOME'), ('64', 'PYRENEES ATLANTIQUES'), ('65', 'HAUTE PYRENEES'), ('66', 'PYRENEES ORIENTALES'), ('67', 'BAS RHIN'), ('68', 'HAUT RHIN'), ('69', 'RHONE'), ('70', 'HAUTE SAONE'), ('71', 'SAONE ET LOIRE'), ('72', 'SARTHE'), ('73', 'SAVOIE'), ('74', 'HAUTE SAVOIE'), ('75', 'PARIS'), ('76', 'SEINE MARITIME'), ('77', 'SEINE ET MARNE'), ('78', 'YVELINES'), ('79', 'DEUX SEVRES'), ('80', 'SOMME'), ('81', 'TARN'), ('82', 'TARN ET GARONNE'), ('83', 'VAR'), ('84', 'VAUCLUSE'), ('85', 'VENDEE'), ('86', 'VIENNE'), ('87', 'HAUTE VIENNE'), ('88', 'VOSGES'), ('89', 'YONNE'), ('90', 'TERITOIRE DE BELFORT'), ('91', 'ESSONNE'), ('92', 'HAUTS DE SEINE'), ('93', 'SEINE SAINT DENIS'), ('94', 'VAL DE MARNE'), ('95', 'VAL D''OISE'), ('971', 'GUADELOUPE'), ('972', 'MARTINIQUE'), ('973', 'GUYANNE'), ('974', 'REUNION'), ('975', 'SAINT PIERRE ET MIQUELON'), ('976', 'MAYOTTE'), ('984', 'ILES EPARSES DE L''OCEAN INDIEN ET T.A.A.F.'), ('985', 'MAYOTTE'), ('986', 'WALLIS ET FUTUNA'), ('987', 'POLYNESIE FRANCAISE'), ('988', 'NOUVELLE CALEDONIE'); -- -------------------------------------------------------- -- -- Structure de la table `dossards` -- CREATE TABLE IF NOT EXISTS `dossards` ( `numero` int(10) unsigned NOT NULL, `pieton` int(10) unsigned NOT NULL, `vtt` int(10) unsigned NOT NULL, `payer` tinyint(1) unsigned NOT NULL, `etat` tinyint(1) unsigned NOT NULL, `tmp_pieton` time NOT NULL, `tmp_vtt` time NOT NULL, `tmp_total` time NOT NULL, PRIMARY KEY (`numero`), KEY `vtt` (`vtt`), KEY `pieton` (`pieton`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Contenu de la table `dossards` -- INSERT INTO `dossards` (`numero`, `pieton`, `vtt`, `payer`, `etat`, `tmp_pieton`, `tmp_vtt`, `tmp_total`) VALUES (1, 1, 1, 1, 0, '00:37:40', '01:24:17', '02:01:57'), (2, 2, 2, 0, 2, '00:00:00', '00:00:00', '00:00:00'), (3, 3, 3, 1, 0, '00:35:49', '01:17:54', '01:53:43'), (4, 4, 5, 1, 0, '00:31:43', '01:09:30', '01:41:13'), (5, 6, 7, 1, 0, '00:45:19', '01:20:48', '02:06:07'), (6, 8, 9, 1, 0, '00:33:51', '01:08:04', '01:41:55'), (7, 11, 12, 1, 0, '00:35:29', '01:31:38', '02:07:07'), (8, 13, 13, 1, 0, '00:34:06', '01:19:48', '01:53:54'), (9, 14, 14, 1, 0, '00:39:38', '01:38:14', '02:17:52'), (10, 15, 16, 1, 0, '00:41:23', '01:26:14', '02:07:37'), (11, 17, 18, 1, 0, '00:40:47', '01:20:22', '02:01:09'), (12, 19, 19, 1, 0, '00:31:37', '01:13:19', '01:44:56'), (13, 20, 21, 1, 0, '00:34:14', '01:28:32', '02:02:46'), (14, 37, 37, 1, 0, '00:35:13', '01:17:37', '01:52:50'), (15, 23, 24, 1, 0, '00:39:46', '01:25:14', '02:05:00'), (16, 25, 26, 1, 0, '00:48:22', '02:09:37', '02:57:59'), (17, 27, 28, 1, 0, '00:41:55', '01:32:02', '02:13:57'), (18, 29, 30, 0, 2, '00:00:00', '00:00:00', '00:00:00'), (19, 31, 32, 0, 2, '00:00:00', '00:00:00', '00:00:00'), (20, 33, 33, 1, 0, '00:40:21', '01:31:54', '02:12:15'), (21, 34, 35, 1, 0, '00:55:55', '01:23:12', '02:19:07'), (22, 38, 39, 1, 0, '00:39:07', '01:19:15', '01:58:22'), (23, 41, 42, 1, 0, '00:30:00', '01:19:30', '01:49:30'), (24, 44, 44, 1, 0, '00:32:09', '01:14:06', '01:46:15'), (25, 45, 45, 1, 0, '00:35:27', '01:25:13', '02:00:40'), (26, 46, 47, 1, 0, '00:35:45', '01:29:25', '02:05:10'), (27, 48, 49, 1, 0, '00:32:34', '01:00:28', '01:33:02'), (28, 50, 51, 0, 2, '00:00:00', '00:00:00', '00:00:00'), (29, 54, 54, 1, 0, '00:47:43', '01:32:51', '02:20:34'), (30, 56, 56, 1, 0, '00:36:20', '01:23:45', '02:00:05'), (31, 57, 57, 1, 0, '00:47:56', '01:44:56', '02:32:52'), (32, 58, 59, 1, 0, '00:38:40', '01:30:35', '02:09:15'), (33, 60, 60, 1, 0, '00:36:22', '01:14:59', '01:51:21'), (34, 61, 62, 1, 0, '00:41:44', '01:15:23', '01:57:07'), (35, 63, 63, 1, 0, '00:33:07', '01:08:26', '01:41:33'), (36, 64, 64, 1, 0, '00:41:35', '01:42:57', '02:24:32'), (37, 65, 65, 1, 0, '00:38:47', '01:26:21', '02:05:08'), (38, 66, 66, 1, 0, '00:42:56', '01:45:43', '02:28:39'), (39, 67, 67, 1, 0, '00:35:57', '01:29:00', '02:04:57'), (40, 68, 68, 1, 0, '00:37:41', '01:44:24', '02:22:05'), (41, 69, 70, 1, 0, '00:44:41', '01:51:35', '02:36:16'), (42, 71, 72, 1, 0, '00:45:16', '01:35:26', '02:20:42'), (43, 73, 74, 1, 0, '00:39:59', '01:13:29', '01:53:28'), (44, 75, 75, 1, 0, '00:43:33', '01:29:46', '02:13:19'), (45, 78, 79, 1, 0, '00:32:25', '01:16:42', '01:49:07'), (46, 80, 81, 1, 0, '00:40:51', '01:20:37', '02:01:28'), (47, 82, 83, 1, 0, '00:33:22', '01:13:48', '01:47:10'), (48, 84, 85, 1, 0, '00:29:59', '01:07:50', '01:37:49'), (49, 86, 87, 1, 0, '00:41:42', '02:14:54', '02:56:36'), (50, 90, 90, 1, 0, '00:40:11', '01:23:51', '02:04:02'), (51, 91, 92, 1, 0, '00:40:36', '01:37:03', '02:17:39'), (52, 95, 95, 1, 0, '00:43:01', '01:44:17', '02:27:18'), (53, 98, 99, 1, 0, '00:37:31', '00:00:00', '00:00:00'), (54, 101, 101, 0, 0, '00:00:00', '00:00:00', '00:00:00'), (55, 103, 103, 1, 0, '00:00:00', '00:00:00', '00:00:00'), (201, 10, 10, 1, 0, '00:14:22', '00:34:23', '00:48:45'), (202, 36, 36, 1, 0, '00:13:19', '00:24:44', '00:38:03'), (203, 40, 40, 1, 0, '00:13:40', '00:31:31', '00:45:11'), (204, 43, 43, 1, 0, '00:15:19', '00:37:52', '00:53:11'), (205, 52, 53, 0, 2, '00:00:00', '00:00:00', '00:00:00'), (206, 55, 55, 1, 0, '00:12:34', '00:32:46', '00:45:20'), (207, 76, 77, 1, 0, '00:14:50', '00:29:54', '00:44:44'), (208, 88, 89, 1, 0, '00:14:28', '00:43:40', '00:58:08'), (209, 93, 94, 1, 0, '00:15:37', '00:29:32', '00:45:09'), (210, 97, 97, 0, 0, '00:14:18', '00:30:47', '00:45:05'), (211, 100, 100, 1, 0, '00:12:26', '00:26:46', '00:39:12'), (212, 102, 102, 1, 0, '00:12:05', '00:21:07', '00:33:12'); -- -------------------------------------------------------- -- -- Structure de la table `minichat` -- CREATE TABLE IF NOT EXISTS `minichat` ( `nick` varchar(20) DEFAULT NULL, `texte` varchar(255) NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Contenu de la table `minichat` -- -- -------------------------------------------------------- -- -- Structure de la table `participants` -- CREATE TABLE IF NOT EXISTS `participants` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `nom` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `prenom` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `date_nais` date NOT NULL, `sexe` tinyint(1) unsigned NOT NULL, `certif` tinyint(1) unsigned DEFAULT NULL, `commune` int(10) unsigned DEFAULT NULL, `departement` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `mail` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `commune` (`commune`,`departement`), KEY `departement` (`departement`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=104 ; -- -- Contenu de la table `participants` -- INSERT INTO `participants` (`id`, `nom`, `prenom`, `date_nais`, `sexe`, `certif`, `commune`, `departement`, `mail`) VALUES (1, 'lagrange', 'benjamin', '1978-03-31', 2, 1, 42, '35', 'benjamin.lagrange2@wanadoo.fr'), (2, 'marchand', 'jérome', '1976-08-04', 2, 0, 44, '35', ''), (3, 'chassat', 'dider', '1971-10-20', 2, 1, 45, '35', 'tigatina@hotmail.fr'), (4, 'hamon', 'anthony', '1987-07-06', 2, 1, 46, '22', 'pierre.mordrelle@gmail.com'), (5, 'mordrelle', 'pierre', '1987-07-13', 2, 1, 47, '22', ''), (6, 'poulain', 'stéphanie', '1977-01-14', 1, 1, 1, '35', 'speedy.poulain@free.fr'), (7, 'cotonnec', 'cedric', '1982-12-29', 2, 1, 48, '35', 'cotonnec@gmail.com'), (8, 'foucher', 'anthony', '1984-10-02', 2, 1, 50, '53', ''), (9, 'chevreul', 'fred', '1977-06-25', 2, 1, 51, '35', 'frederic.chevreul@sfr.fr'), (10, 'gernigon', 'oceane', '1999-07-20', 1, 1, 1, '35', 'vincent.gernigon@orange.fr'), (11, 'leclere', 'anthony', '1976-08-19', 2, 1, 1, '35', 'anthonyleclere@free.fr'), (12, 'mazurais', 'françois', '1962-02-14', 2, 1, 48, '35', ''), (13, 'paquet', 'xavier', '1976-05-03', 2, 1, 52, '35', 'paquet.xavier@orange.fr'), (14, 'aubert', 'anne marie', '1965-06-27', 1, 1, 53, '35', 'annemarie.aubert29@sfr.fr'), (15, 'dauguet', 'antoine', '1970-03-01', 2, 1, 54, '35', ''), (16, 'goby', 'antoine', '1970-06-25', 2, 1, 54, '35', ''), (17, 'gauthier', 'fabrice', '1967-10-30', 2, 1, 1, '35', 'gauthieranne3993@neuf.fr'), (18, 'cosmao', 'michel', '1966-09-23', 2, 1, 18, '35', 'miki.co@infonie.fr'), (19, 'prodhomme', 'sylvain', '1972-12-05', 2, 1, 43, '53', ''), (20, 'benard', 'christian', '1959-06-06', 2, 1, 1, '35', ''), (21, 'deniard', 'cedric', '1980-05-21', 2, 1, 1, '35', ''), (23, 'gazengel', 'jean marie', '1994-05-11', 2, 1, 55, '50', 'jeanmarc.gazengel@wanadoo.fr'), (24, 'gazengel', 'jean marc', '1971-04-07', 2, 1, 55, '50', ''), (25, 'colas', 'celine', '1977-03-28', 1, 1, 1, '35', 'jcollas@aliceadsl.fr'), (26, 'laurent', 'isabelle', '1965-08-24', 1, 1, 56, '35', ''), (27, 'sabin', 'francois', '1976-04-07', 2, 1, 57, '35', 'francoissabin@orange.fr'), (28, 'sabin', 'daniel', '1952-09-15', 2, 1, 58, '85', ''), (29, 'le gall', 'charles', '1992-06-23', 2, 0, 59, '35', 'c.legall134@la poste.net'), (30, 'tondoux', 'antoine', '1993-09-18', 2, 0, 52, '35', 'antoine.tondoux@hotmail.fr'), (31, 'le pouliquen', 'efflammig', '1979-01-01', 2, 1, 60, '22', ''), (32, 'clolus', 'pierre yves', '1982-01-01', 2, 1, 61, '22', ''), (33, 'bobet', 'patrick', '1975-04-17', 2, 1, 62, '35', 'patrennes@hotmail.fr'), (34, 'coquemont', 'sandrine', '1974-12-11', 1, 1, 1, '35', ''), (35, 'coquemont', 'philippe', '1972-12-01', 2, 1, 1, '35', 'filip.coquemont@gmail.com'), (36, 'gazengel', 'pierre', '2001-05-02', 2, 1, 55, '50', 'jean.marc.gazengel@wanadoo.fr'), (37, 'berdat', 'david', '1976-06-23', 2, 1, 63, '35', ''), (38, 'gieu', 'valentin', '1995-08-08', 2, 1, 64, '35', ''), (39, 'granger', 'basile', '1993-12-09', 2, 1, 64, '35', ''), (40, 'gilet', 'paul', '2001-01-06', 2, 1, 29, '35', ''), (41, 'vigner', 'ronald', '1978-04-30', 2, 1, 73, '35', ''), (42, 'le strat', 'philippe', '1971-09-08', 2, 1, 11, '35', ''), (43, 'jouault', 'clément', '1999-10-14', 2, 1, 1, '35', ''), (44, 'havard', 'alain', '1968-11-02', 2, 1, 66, '56', 'alin.avard830@orange.fr'), (45, 'jeuland', 'mickael', '1976-06-21', 2, 1, 67, '35', 'jeulandmi@wanadoo.fr'), (46, 'page', 'jean robert', '1973-12-22', 2, 1, 37, '35', ''), (47, 'le ménes', 'goulven', '1974-04-21', 2, 1, 68, '35', ''), (48, 'despas', 'sebastien', '1980-05-05', 2, 1, 69, '50', ''), (49, 'despas', 'régis', '1988-01-06', 2, 1, 69, '50', 'regispam@orange.fr'), (50, 'collas', 'francois', '1996-01-01', 2, 0, 4, '35', ''), (51, 'poras', 'florent', '1996-01-01', 2, 0, 70, '35', ''), (52, 'devernois', 'corentin', '2000-08-14', 2, 0, 1, '35', ''), (53, 'thomas', 'pierre', '1999-04-06', 2, 0, 1, '35', 'jft@cegetel.net'), (54, 'massot', 'lionel', '1974-02-22', 0, 1, 41, '35', 'fienel@sfr.fr'), (55, 'compain', 'quentin', '2000-05-18', 2, 1, 1, '35', ''), (56, 'jain', 'arnaud', '1977-12-13', 2, 1, 71, '35', 'jain_arnaud@yaou.fr'), (57, 'hurault', 'christophe', '1969-08-14', 2, 1, 72, '35', ''), (58, 'piel', 'catherine', '1963-02-23', 1, 1, 18, '35', 'piel.hubert@wanadoo.fr'), (59, 'piel', 'hubert', '1962-08-13', 2, 1, 18, '35', ''), (60, 'Fougeray', 'Geoffrey', '1981-01-21', 2, 1, 37, '35', ''), (61, 'Souvest', 'Romzin', '1981-02-19', 2, 1, 29, '35', ''), (62, 'Herve', 'Peter', '1978-10-13', 2, 1, 29, '35', ''), (63, 'Guerin', 'Stephane', '1971-10-01', 2, 1, 74, '35', ''), (64, 'Fougeray', 'Andre', '1954-01-06', 2, 1, 27, '53', ''), (65, 'Lenouvel', 'Jerome', '1983-09-15', 2, 1, 3, '35', ''), (66, 'Blin', 'Stephane', '1972-11-26', 2, 1, 75, '35', ''), (67, 'Liminier', 'Bruno', '1983-03-02', 2, 1, 3, '35', ''), (68, 'beaudoin', 'jerome', '1975-03-12', 2, 1, 76, '35', ''), (69, 'Bigot', 'Adrien', '1990-11-20', 2, 1, 48, '35', ''), (70, 'Froc', 'Didier', '1965-07-08', 2, 1, 15, '35', ''), (71, 'bigot', 'catherine', '1967-10-08', 1, 1, 15, '35', ''), (72, 'bigot', 'vincent', '1964-09-29', 2, 1, 15, '35', ''), (73, 'Martin', 'Vincent', '1980-07-07', 2, 1, 30, '35', ''), (74, 'Thoin', 'Frederic', '1979-11-05', 2, 1, 30, '35', ''), (75, 'colomb', 'alexendre', '1972-09-18', 2, 1, 77, '35', ''), (76, 'Devernois', 'Corentin', '2000-08-14', 2, 1, 1, '35', ''), (77, 'Thomas', 'Pierre', '1999-04-06', 2, 1, 1, '35', ''), (78, 'Thichaut', 'Jean christoph', '1970-11-01', 2, 1, 25, '35', ''), (79, 'Rimasson', 'Addy', '1975-06-18', 2, 1, 78, '35', ''), (80, 'parichi', 'lionel', '1967-10-30', 2, 1, 79, '35', ''), (81, 'petit', 'guillaume', '1996-12-05', 2, 1, 79, '35', ''), (82, 'Colas', 'Pierre', '1963-09-25', 2, 1, 25, '35', ''), (83, 'Lecoursonnais', 'Rommualde', '1971-11-20', 2, 1, 1, '35', ''), (84, 'Descourmiers', 'Sebastien', '1968-11-24', 2, 1, 80, '35', ''), (85, 'Marchand', 'Dominique', '1973-07-26', 2, 1, 56, '35', ''), (86, 'trevidic', 'henry', '1961-08-24', 2, 1, 81, '35', ''), (87, 'petit', 'laurent', '1963-12-23', 2, 1, 82, '35', ''), (88, 'Boixere', 'Lucas', '2002-08-09', 2, 1, 1, '35', ''), (89, 'Thomas', 'Yann', '2002-10-24', 2, 1, 1, '35', ''), (90, 'Hamon', 'Jean francois', '1967-07-31', 2, 1, 18, '35', ''), (91, 'javaudin', 'patrick', '1966-03-23', 2, 1, 83, '35', ''), (92, 'raffray', 'aurelin', '1996-04-14', 2, 1, 84, '35', ''), (93, 'Guillochet', 'Julien', '2000-03-17', 2, 1, 1, '35', ''), (94, 'Goby', 'Theo', '2000-03-10', 2, 1, 1, '35', ''), (95, 'emery', 'anthony', '1980-03-13', 2, 1, 1, '35', ''), (97, 'Gougeon', 'Sylveun', '1999-04-13', 2, 0, 1, '35', ''), (98, 'Paquet', 'Ange', '1966-02-17', 2, 1, 85, '35', ''), (99, 'Cochet', 'Serge', '1965-04-02', 2, 1, 1, '35', ''), (100, 'lefeuvre', 'pierre', '2002-07-20', 2, 1, 86, '35', ''), (101, 'Havard', 'Daniet', '1952-09-11', 2, 1, 7, '35', ''), (102, 'lefeuvre', 'victor', '1999-10-28', 2, 1, 87, '35', ''), (103, 'Sourdrille', 'jean christoph', '1958-12-02', 2, 1, 7, '35', ''); -- -------------------------------------------------------- -- -- Structure de la table `villes` -- CREATE TABLE IF NOT EXISTS `villes` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `nom` varchar(50) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=88 ; -- -- Contenu de la table `villes` -- INSERT INTO `villes` (`id`, `nom`) VALUES (1, 'Dourdain'), (3, 'Rennes'), (4, 'Val d''Izé'), (5, 'Nantes'), (6, 'Vitré'), (7, 'CHATEAUBOURG'), (8, 'L''HOPITAL CAMFROUT'), (9, 'BOURG BLANC'), (10, 'MELESSE'), (11, 'MORDELLES'), (12, 'LE VERGER'), (13, 'BALAZE'), (14, 'GUIGNEN'), (15, 'LA BOUËXIERE'), (16, 'ST AUBIN DU CORMIER'), (17, 'VERN SUR SEICHE'), (18, 'LIFFRE'), (19, 'CRANCHEVRIER'), (20, 'BREAL / VITRE'), (21, 'CHAILLAND'), (22, 'VERN / SEICHE'), (23, 'PONTORSON'), (24, 'CARNAC'), (25, 'SERVON/VILAINE'), (26, 'POULIGUEN'), (27, 'ST DENIS DE GASTINES'), (28, 'ST BRICE EN COGLES'), (29, 'VITRE'), (30, 'CHATILLION EN VENDELAIS'), (31, 'NONTREIL DES LANDS'), (32, 'LAILLE'), (33, 'TREMBLET'), (34, 'St CRISTOPHE DES BOIS'), (35, 'LA FONTELEL'), (36, 'LA BARONNIERE'), (37, 'ST AUBIN D''AUBIGNE'), (38, 'THORIGNE'), (39, 'TREVRON'), (40, 'LA CELLE EN LUITRE'), (41, 'VAL D''IZE'), (42, 'bruc sur aff'), (43, 'laubrière'), (44, 'la lande'), (45, 'st jaques de la lande'), (46, 'pleslin trigavou'), (47, 'dinan'), (48, 'la bouexière'), (49, 'laubriere'), (50, 'laval'), (51, 'bréal/s vitre'), (52, 'pocé les bois'), (53, 'amanlis'), (54, 'javené'), (55, 'vessey'), (56, 'doudain'), (57, 'st ouen'), (58, 'le fenouillet'), (59, 'la méziere'), (60, 'st samson sur rance'), (61, 'lanvallay'), (62, 'goven'), (63, 'st armel'), (64, 'montreuil sous perouse'), (65, 'st benoit des ondes'), (66, 'ploermel'), (67, 'monteuil des landes'), (68, 'le rheu'), (69, 'juilley'), (70, 'balazé'), (71, 'chantepie'), (72, 'landavran'), (73, 'brece'), (74, 'Acélent le vitre'), (75, 'Chateaugiron'), (76, 'pire sur seiche'), (77, 'betton'), (78, 'Le petit corsee'), (79, 'ossé'), (80, 'Bresson'), (81, 'corp nuds'), (82, 'osse'), (83, 'marpire'), (84, 'val d ize'), (85, 'Domagne'), (86, 'gosne'), (87, 'gosné'); -- -- Contraintes pour les tables exportées -- -- -- Contraintes pour la table `dossards` -- ALTER TABLE `dossards` ADD CONSTRAINT `dossards_ibfk_1` FOREIGN KEY (`pieton`) REFERENCES `participants` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `dossards_ibfk_2` FOREIGN KEY (`vtt`) REFERENCES `participants` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Contraintes pour la table `participants` -- ALTER TABLE `participants` ADD CONSTRAINT `participants_ibfk_1` FOREIGN KEY (`commune`) REFERENCES `villes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `participants_ibfk_2` FOREIGN KEY (`departement`) REFERENCES `departement` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION;
CREATE TABLE IF NOT EXISTS question ( id int auto_increment, question_id int, title varchar(255) not null, description text not null, PRIMARY KEY(id) ); CREATE INDEX idx_question_title ON question(title); CREATE TABLE IF NOT EXISTS question_meta ( question_id int not null, difficulty varchar(255) not null, acceptance_rate decimal(30,29) null, article text null, creation_time DATETIME not null, last_updated_time DATETIME not null, PRIMARY KEY(question_id), FOREIGN KEY(question_id) REFERENCES question(id) ); CREATE TABLE IF NOT EXISTS company ( id int not null auto_increment, company_name varchar(255) not null, address1 varchar(255), address2 varchar(255), zip varchar(255), country varchar(255), contact_firstname varchar(255), contact_middlename varchar(255), contact_lastname varchar(255), email varchar(255), creation_time DATETIME not null, last_updated_time DATETIME not null, PRIMARY KEY(id) ); CREATE TABLE IF NOT EXISTS user_profile ( id int not null auto_increment, contact_firstname varchar(255), contact_middlename varchar(255), contact_lastname varchar(255), contact_email varchar(255), dob_day int, dob_month int, dob_year int, address1 varchar(255), address2 varchar(255), zip varchar(255), country varchar(255), avatar_link varchar(255), creation_time DATETIME not null, last_updated_time DATETIME not null, PRIMARY KEY(id) ); CREATE INDEX idx_user_email ON user_profile(contact_email); CREATE TABLE IF NOT EXISTS mocking_config ( id int not null auto_increment, company_id int, score int, expiration_time FLOAT(2, 1), creation_time DATETIME not null, last_updated_time DATETIME not null, PRIMARY KEY(id) ); CREATE TABLE IF NOT EXISTS mocking_config_question ( id int not null auto_increment, mocking_config_id int not null, source_type varchar(255) not null, question_type varchar(255) not null, question_body text not null, question_solution text null, last_updated_time DATETIME not null, PRIMARY KEY(id) ); CREATE TABLE IF NOT EXISTS answer_submission ( id int not null auto_increment, submission_time DATETIME not null, code text not null, userId int not null, questionId int not null, PRIMARY KEY(id) );
DROP DATABASE IF EXISTS "overview"; CREATE DATABASE "overview"; \c "overview"; CREATE TABLE productInfo ( id SERIAL PRIMARY KEY, name VARCHAR NOT NULL, slogan VARCHAR NOT NULL, description VARCHAR NOT NULL, category VARCHAR NOT NULL, default_price VARCHAR NOT NULL ); CREATE TABLE productStyle ( id SERIAL PRIMARY KEY, productId INTEGER, name VARCHAR NOT NULL, original_price VARCHAR NOT NULL, sale_price VARCHAR NOT NULL, "default?" BOOLEAN, FOREIGN KEY(productId) REFERENCES productInfo(id) ); CREATE TABLE skus ( id SERIAL PRIMARY KEY, style_id SERIAL, size VARCHAR NOT NULL, quantity INTEGER NOT NULL, FOREIGN KEY(style_id) REFERENCES productStyle(id) ); CREATE TABLE features ( id SERIAL PRIMARY KEY, product_id INTEGER, feature VARCHAR NOT NULL, value VARCHAR NOT NULL, FOREIGN KEY(product_id) REFERENCES productInfo(id) ); CREATE TABLE photos ( id INT PRIMARY KEY, style_id INTEGER, thumbnail_url VARCHAR NOT NULL, url VARCHAR NOT NULL, FOREIGN KEY(style_id) REFERENCES productStyle(id) ); CREATE TABLE related ( id INT PRIMARY KEY, current_product_id INTEGER, related_product_id INTEGER ); \COPY productinfo FROM '/Users/sophiacheong/Desktop/Hackreactor/Overview/product.csv' DELIMITER ',' CSV HEADER; \COPY productstyle FROM '/Users/sophiacheong/Desktop/Hackreactor/Overview/styles.csv' DELIMITER ',' CSV HEADER; \COPY skus FROM '/Users/sophiacheong/Desktop/Hackreactor/Overview/skus.csv' DELIMITER ',' CSV HEADER; \COPY features FROM '/Users/sophiacheong/Desktop/Hackreactor/Overview/features.csv' DELIMITER ',' CSV HEADER; \COPY photos FROM '/Users/sophiacheong/Desktop/Hackreactor/Overview/photos.csv' DELIMITER ',' CSV HEADER; \COPY related FROM '/Users/sophiacheong/Desktop/Hackreactor/Overview/related.csv' DELIMITER ',' CSV HEADER; -- THIS IS FOR THE VIRUAL MACHINE UBUNTU -- \COPY productinfo FROM '/home/ubuntu/csvFiles/product.csv' DELIMITER ',' CSV HEADER; -- \COPY productstyle FROM '/home/ubuntu/csvFiles/styles.csv' DELIMITER ',' CSV HEADER; -- \COPY skus FROM '/home/ubuntu/csvFiles/skus.csv' DELIMITER ',' CSV HEADER; -- \COPY features FROM '/home/ubuntu/csvFiles/features.csv' DELIMITER ',' CSV HEADER; -- \COPY photos FROM '/home/ubuntu/csvFiles/photos.csv' DELIMITER ',' CSV HEADER; -- \COPY related FROM '/home/ubuntu/csvFiles/related.csv' DELIMITER ',' CSV HEADER; -- RUN THIS AFTER TABLES AND CSV FILES ARE MADE. -- CREATE TABLE fullStyle AS SELECT productstyle.productid, json_agg(json_build_object('style_id', productstyle.id, 'name', productstyle.name, -- 'original_price', productstyle.original_price, 'sale_price', productstyle.sale_price, -- 'default?', productstyle."default?", 'photos', photos, 'skus', skus)) results FROM productstyle -- LEFT JOIN (SELECT skus.style_id, json_object_agg(skus.id, json_build_object('quantity', skus.quantity, 'size', skus.size)) skus -- FROM skus GROUP BY skus.style_id ) skus ON skus.style_id = productstyle.id -- LEFT JOIN (SELECT photos.style_id, json_agg(json_build_object('thumbnail_url' , photos.url, 'url', photos.thumbnail_url)) -- photos FROM photos GROUP BY photos.style_id) photos ON photos.style_id = productstyle.id -- GROUP BY productstyle.productid; -- CREATE TABLE relatedID as SELECT productinfo.id, json_agg(related_product_id) AS related FROM productinfo -- LEFT JOIN related ON related.current_product_id=productinfo.id GROUP BY productinfo.id ORDER BY productinfo.id ASC;
--Exercícios do PowerPoint "Workbench" CREATE TABLE curso ( cod_curso VARCHAR(10), nome_curso VARCHAR(10), PRIMARY KEY (cod_curso) ); CREATE TABLE professor ( id_professor VARCHAR(11), nome_professor VARCHAR(45), PRIMARY KEY (id_professor) ); CREATE TABLE disciplina ( cod_disciplina VARCHAR(10), nome_disciplina VARCHAR(45), PRIMARY KEY (cod_disciplina) );
insert into people values ('Fyodor', 'Dostoyevsky'); insert into people values ('Mohatma', 'Ghandi'); insert into people values ('Leo', 'Tolstoy');
DROP DATABASE IF EXISTS cocktails_db; CREATE DATABASE cocktails_db; USE cocktails_db; CREATE TABLE cocktails ( id INT AUTO_INCREMENT NOT NULL, cocktail_name VARCHAR(30) NOT NULL, enjoyed BOOLEAN DEFAULT 0, PRIMARY KEY (id) ); INSERT INTO cocktails (cocktail_name) VALUES ("Sazerac"), ("Negroni"), ("Old Fashioned"), ("Moscow Mule");
drop table if exists song; create table song( id integer primary key autoincrement, title text not null, ip varchar(20) );
-- 21 SELECT NR, NAME, SUM(AP.GESAMTPREIS) AS UMSATZ FROM KUNDE K RIGHT OUTER JOIN AUFTRAG A ON K.NR = A.KUNDNR RIGHT OUTER JOIN AUFTRAGSPOSTEN AP ON A.AUFTRNR = AP.AUFTRNR GROUP BY K.NR, NAME
-- Ex 03 CREATE PROC Q03 AS BEGIN SELECT C1.Country_Id,C1.Country_Name FROM ( SELECT ROW_NUMBER() OVER (ORDER BY Country_Name ASC) AS ROWNUMBER, C.* FROM COUNTRY C) as C1 WHERE ROWNUMBER <= 3; END;
use rest_with_asp_net_udemy; /*CREATE TABLE persons ( Id int(10) unsigned NULL DEFAULT NULL, FirstName varchar(50) NULL DEFAULT NULL, LastName varchar(50) NULL DEFAULT NULL, Address varchar(50) NULL DEFAULT NULL, Gender varchar(50) NULL DEFAULT NULL ) ENGINE=InnoDB;*/ ALTER TABLE persons MODIFY COLUMN ID INT(10) AUTO_INCREMENT PRIMARY KEY;
USE `hutoma`; ALTER TABLE `hutoma`.`intent_variable_prompt` MODIFY COLUMN `prompt` VARCHAR(1000);
/**********************************/ /* Table Name: 설문항목 */ /**********************************/ DROP TABLE SURV_ITEM; CREATE TABLE SURV_ITEM( SURV_ITEM_NO NUMBER(10) NOT NULL PRIMARY KEY, SURV_NO NUMBER(10) NOT NULL, SURV_item_SEQNO NUMBER(10) NOT NULL, SURV_item_QUES VARCHAR2(300) NOT NULL, SURV_item_ANS_1 CLOB NULL, SURV_item_ANS_2 CLOB NULL, SURV_item_ANS_3 CLOB NULL, SURV_item_ANS_4 CLOB NULL, SURV_item_RESP NUMBER(10) NOT NULL, surv_item_passwd varchar2(300) not null, FOREIGN KEY (SURV_NO) REFERENCES SURV (SURV_NO) ); COMMENT ON TABLE SURV_ITEM is '설문항목'; COMMENT ON COLUMN SURV_ITEM.SURV_ITEM_NO is '설문항목번호'; COMMENT ON COLUMN SURV_ITEM.SURV_NO is '설문조사번호'; COMMENT ON COLUMN SURV_ITEM.SURV_item_SEQNO is '설문항목순서'; COMMENT ON COLUMN SURV_ITEM.SURV_item_QUES is '설문항목질문'; COMMENT ON COLUMN SURV_ITEM.SURV_item_ANS_1 is '설문항목답변1'; COMMENT ON COLUMN SURV_ITEM.SURV_item_ANS_2 is '설문항목답변2'; COMMENT ON COLUMN SURV_ITEM.SURV_item_ANS_3 is '설문항목답변3'; COMMENT ON COLUMN SURV_ITEM.SURV_item_ANS_4 is '설문항목답변4'; COMMENT ON COLUMN SURV_ITEM.SURV_item_RESP is '설문응답수'; COMMENT ON COLUMN SURV_ITEM.SURV_item_passwd is '설문항목패스워드'; DROP SEQUENCE SURV_ITEM_seq; CREATE SEQUENCE SURV_ITEM_seq START WITH 1 -- 시작번호 INCREMENT BY 1 -- 증가 값 MAXVALUE 9999999999 -- 최대값 : 9999999999 --> NUMBER(10) 대응 CACHE 2 -- 2번은 메모리에서만 계산(업데이트를 계속해서 하지 않음 ), insert가 많으면 cache를 100~200정도로 하면 오라클 속도가 빨라짐.. NOCYCLE; 1) 등록 INSERT INTO SURV_ITEM(SURV_ITEM_NO, SURV_NO, SURV_item_SEQNO, SURV_item_QUES, SURV_item_ANS_1, SURV_item_ANS_2, SURV_item_ANS_3, SURV_item_ANS_4, SURV_item_RESP,surv_item_passwd) VALUES(surv_item_seq.nextval, 1, 1, '설문질문1','설문답변항목1', '설문답변항목2', '설문답변항목3', '설문답변항목4', 0, '1234'); INSERT INTO SURV_ITEM(SURV_ITEM_NO, SURV_NO, SURV_item_SEQNO, SURV_item_QUES, SURV_item_ANS_1, SURV_item_ANS_2, SURV_item_ANS_3, SURV_item_ANS_4, SURV_item_RESP,surv_item_passwd) VALUES(surv_item_seq.nextval, 1, 1, '설문질문2','설문답변항목1', '설문답변항목2', '설문답변항목3', '설문답변항목4', 0,'1234'); INSERT INTO SURV_ITEM(SURV_ITEM_NO, SURV_NO, SURV_item_SEQNO, SURV_item_QUES, SURV_item_ANS_1, SURV_item_ANS_2, SURV_item_ANS_3, SURV_item_ANS_4, SURV_item_RESP,surv_item_passwd) VALUES(surv_item_seq.nextval, 1, 1, '설문질문3','설문답변항목1', '설문답변항목2', '설문답변항목3', '설문답변항목4', 0,'1234'); INSERT INTO SURV_ITEM(SURV_ITEM_NO, SURV_NO, SURV_item_SEQNO, SURV_item_QUES, SURV_item_ANS_1, SURV_item_ANS_2, SURV_item_ANS_3, SURV_item_ANS_4, SURV_item_RESP,surv_item_passwd) VALUES(surv_item_seq.nextval, 1, 1, '설문질문4','설문답변항목1', '설문답변항목2', '설문답변항목3', '설문답변항목4', 0,'1234'); 2) 목록 SELECT SURV_ITEM_NO, SURV_NO, SURV_item_SEQNO, SURV_item_QUES, SURV_item_ANS_1, SURV_item_ANS_2, SURV_item_ANS_3, SURV_item_ANS_4, SURV_item_RESP,surv_item_passwd FROM SURV_ITEM ORDER BY SURV_item_SEQNO ASC; commit; 3) 조회 SELECT SURV_ITEM_NO, SURV_NO, SURV_item_SEQNO, SURV_item_QUES, SURV_item_ANS_1, SURV_item_ANS_2, SURV_item_ANS_3, SURV_item_ANS_4, SURV_item_RESP,surv_item_passwd FROM SURV_ITEM where surv_item_seqno=1; 4) 수정 update surv_item set surv_item_seqno=2, surv_item_ques='질문수정', surv_item_ans_1='항목수정1', surv_item_ans_2='항목수정2', surv_item_ans_3='항목수정3', surv_item_ans_4='항목수정4',surv_item_passwd='5678' where surv_item_no=2; commit; 5) 삭제 delete from surv_item where surv_item_no=6; commit; -- 패스워드 확인 SELECT COUNT(*) as passwd_cnt FROM surv_item WHERE surv_item_no= 1 AND surv_item_passwd='1234' -- surv와 surv_item 테이블 join SELECT s.surv_no as s_surv_no, s.surv_seqno as s_surv_seqno, s.surv_title as s_surv_title, s.surv_content as s_surv_content, s.surv_passwd as surv_passwd, s.surv_startdate as s_surv_startdate, s.surv_enddate as s_surv_enddate, s.surv_cnt as s_surv_cnt, s.surv_continue as s_surv_continue, s.mem_no as s_mem_no, i.surv_item_no as i_surv_item_no, i.surv_no as i_surv_no, i.surv_item_seqno as i_surv_item_seqno, i.surv_item_ques as i_surv_item_ques, i.surv_item_ans_1 as i_surv_item_ans_1, i.surv_item_ans_2 as i_surv_item_ans_2, i.surv_item_ans_3 as i_surv_item_ans_3, i.surv_item_ans_4 as i_surv_item_ans_4, i.surv_item_resp as i_surv_item_resp, i.surv_item_passwd as i_surv_item_passwd FROM surv s, surv_item i WHERE s.surv_no = i.surv_no ORDER BY s.surv_no ASC, i.surv_no DESC;
-- phpMyAdmin SQL Dump -- version 4.6.4 -- https://www.phpmyadmin.net/ -- -- Host: fdb4.biz.nf -- Generation Time: Jan 06, 2017 at 07:34 AM -- Server version: 5.7.16-log -- PHP Version: 5.5.38 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `2219560_17dburr` -- -- -------------------------------------------------------- -- -- Table structure for table `contact` -- CREATE TABLE `contact` ( `user_id` tinyint(10) NOT NULL, `first_name` text NOT NULL, `last_name` text NOT NULL, `email` text NOT NULL, `comments` longtext NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `deals` -- CREATE TABLE `deals` ( `first_name` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `last_name` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `email` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `phpmyreservation_configuration` -- CREATE TABLE `phpmyreservation_configuration` ( `id` int(10) NOT NULL, `price` float NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `phpmyreservation_configuration` -- INSERT INTO `phpmyreservation_configuration` (`id`, `price`) VALUES (1, 25); -- -------------------------------------------------------- -- -- Table structure for table `phpmyreservation_reservations` -- CREATE TABLE `phpmyreservation_reservations` ( `reservation_id` int(10) NOT NULL, `reservation_made_time` datetime NOT NULL, `reservation_year` smallint(4) NOT NULL, `reservation_week` tinyint(2) NOT NULL, `reservation_day` tinyint(1) NOT NULL, `reservation_time` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `reservation_price` float NOT NULL, `reservation_user_id` int(10) NOT NULL, `reservation_user_email` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `reservation_user_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `phpmyreservation_reservations` -- INSERT INTO `phpmyreservation_reservations` (`reservation_id`, `reservation_made_time`, `reservation_year`, `reservation_week`, `reservation_day`, `reservation_time`, `reservation_price`, `reservation_user_id`, `reservation_user_email`, `reservation_user_name`) VALUES (57, '2016-12-22 05:53:44', 2016, 51, 3, '11 AM - 12 AM', 25, 10, '17dburr@stu.sgdragons.org', 'Dylan Burr'), (56, '2016-12-22 05:53:09', 2016, 51, 3, '9 AM - 10 AM', 25, 10, '17dburr@stu.sgdragons.org', 'Dylan Burr'); -- -------------------------------------------------------- -- -- Table structure for table `phpmyreservation_users` -- CREATE TABLE `phpmyreservation_users` ( `user_id` int(10) NOT NULL, `user_is_admin` tinyint(1) NOT NULL, `user_email` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `user_password` varchar(1000) COLLATE utf8_unicode_ci NOT NULL, `user_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `user_reservation_reminder` tinyint(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `phpmyreservation_users` -- INSERT INTO `phpmyreservation_users` (`user_id`, `user_is_admin`, `user_email`, `user_password`, `user_name`, `user_reservation_reminder`) VALUES (10, 1, '17dburr@stu.sgdragons.org', '$1$jfidue84$zda3mdOvm1SGHp2Ck3FeB0', 'Dylan Burr', 0), (11, 0, 'grass.caitlin@yahoo.com', '$1$jfidue84$ecTAazdLMaw3b2e.9NimG/', 'Caitlin', 0); -- -- Indexes for dumped tables -- -- -- Indexes for table `contact` -- ALTER TABLE `contact` ADD PRIMARY KEY (`user_id`); -- -- Indexes for table `deals` -- ALTER TABLE `deals` ADD PRIMARY KEY (`email`(100)); -- -- Indexes for table `phpmyreservation_configuration` -- ALTER TABLE `phpmyreservation_configuration` ADD PRIMARY KEY (`id`); -- -- Indexes for table `phpmyreservation_reservations` -- ALTER TABLE `phpmyreservation_reservations` ADD PRIMARY KEY (`reservation_id`); -- -- Indexes for table `phpmyreservation_users` -- ALTER TABLE `phpmyreservation_users` ADD PRIMARY KEY (`user_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `contact` -- ALTER TABLE `contact` MODIFY `user_id` tinyint(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `phpmyreservation_configuration` -- ALTER TABLE `phpmyreservation_configuration` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `phpmyreservation_reservations` -- ALTER TABLE `phpmyreservation_reservations` MODIFY `reservation_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=82; -- -- AUTO_INCREMENT for table `phpmyreservation_users` -- ALTER TABLE `phpmyreservation_users` MODIFY `user_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- Account Comment DROP VIEW api.accountcomment; CREATE VIEW api.accountcomment AS SELECT crmacct_number::varchar AS account_number, cmnttype_name AS type, comment_date AS date, comment_user AS username, comment_text AS text FROM crmacct(), cmnttype, comment WHERE ((comment_source='CRMA') AND (comment_source_id=crmacct_id) AND (comment_cmnttype_id=cmnttype_id)); GRANT ALL ON TABLE api.accountcomment TO xtrole; COMMENT ON VIEW api.accountcomment IS 'Account Comment'; --Rules CREATE OR REPLACE RULE "_INSERT" AS ON INSERT TO api.accountcomment DO INSTEAD INSERT INTO comment ( comment_date, comment_source, comment_source_id, comment_user, comment_cmnttype_id, comment_text ) VALUES ( COALESCE(NEW.date,now()), 'CRMA', getCrmAcctId(NEW.account_number), COALESCE(NEW.username,getEffectiveXtUser()), getCmntTypeId(NEW.type), NEW.text); CREATE OR REPLACE RULE "_UPDATE" AS ON UPDATE TO api.accountcomment DO INSTEAD NOTHING; CREATE OR REPLACE RULE "_DELETE" AS ON DELETE TO api.accountcomment DO INSTEAD NOTHING;
-- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema Paytm -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema Paytm -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `Paytm` DEFAULT CHARACTER SET utf8 ; USE `Paytm` ; -- ----------------------------------------------------- -- Table `Paytm`.`Branches` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `Paytm`.`Branches` ( `idBranches` INT NOT NULL, PRIMARY KEY (`idBranches`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `Paytm`.`Accounts` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `Paytm`.`Accounts` ( `idAccounts` INT NOT NULL, `BranchID` INT NOT NULL, PRIMARY KEY (`idAccounts`), INDEX `fk_Accounts_1_idx` (`BranchID` ASC), CONSTRAINT `fk_Accounts_1` FOREIGN KEY (`BranchID`) REFERENCES `Paytm`.`Branches` (`idBranches`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `Paytm`.`customer` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `Paytm`.`customer` ( `idcustomer` INT NOT NULL, `account_id` INT NOT NULL, `customer_branch` INT NOT NULL, `customer_name` VARCHAR(45) NOT NULL, PRIMARY KEY (`idcustomer`, `customer_branch`), INDEX `fk_customer_1_idx` (`account_id` ASC), INDEX `fk_customer_2_idx` (`customer_branch` ASC), CONSTRAINT `fk_customer_1` FOREIGN KEY (`account_id`) REFERENCES `Paytm`.`Accounts` (`idAccounts`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_customer_2` FOREIGN KEY (`customer_branch`) REFERENCES `Paytm`.`Branches` (`idBranches`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
/*EJERCICIO 2*/ use practicas; /*Crea un trigger sobre la tabla Emple para impedir que un empleado que se quiere insertar y su jefe pertenezcan a departamentos distintos.*/ /*No funciona*/ DELIMITER | CREATE TRIGGER ComprobarEmple before insert on emple for each row begin declare department int(6); select dept_no from emple where emp_no = new.dir into department; if (department NOT LIKE new.dept_no) then signal sqlstate '45000' set message_text='El departamento del empleado debe ser el mismo que el de su jefe'; end if; end ;| delimiter ; drop trigger ComprobarEmple; insert into emple values (6977,'Perez','Francisco',7698,current_date(),100000,null,20); /*Hoja 25 Ejercicio 3*/ /*Crea un procedimiento que visualice el apellido y la fecha de alta de todos los empleados de la tabla emple ordenados por apellido, utilizando cursores para ello.*/ delimiter | create procedure Ordenar () begin select apellido, fecha_alt from emple order by apellido asc; end ;| delimiter ; call ordenar(); /*HOJA 25 EJERCICIO 4*/ /* Crea un procedimiento que muestre el nombre de cada departamento y el número de empleados que tiene a partir de las tablas emple y depart. */ DELIMITER | CREATE PROCEDURE DEPART() BEGIN SELECT DEPART.DNOMBRE, COUNT(EMPLE.DEPT_NO) FROM EMPLE INNER JOIN DEPART ON EMPLE.DEPT_NO = DEPART.DEPT_NO GROUP BY DEPART.DNOMBRE; END ;| DELIMITER ; CALL DEPART(); DROP PROCEDURE DEPART; /*HOJA 25 EJERCICIO 9*/ /*Crea un trigger sobre la tabla Emple que controle las actualizaciones de salarios de empleados en dicha tabla para que ningún empleado tenga un salario superior al de su jefe inmediato*/ delimiter | create trigger controlsalarios before update on emple for each row begin declare sueldodir int(10); select salario from emple where emp_no =new.dir into sueldodir; if (sueldodir <= new.salario) then signal sqlstate '45000' set message_text='El empleado no puede superar el sueldo de su superior'; end if ; end ;| delimiter ; update emple set salario = 700000 where emp_no=7499; update emple set dir=7369 where emp_no= 7499; /*Los cambios sobre la tabla Emple de la base de datos sólo están permitidos dentro del horario de trabajo, de lunes a viernes entre las 8:00 y las 18:00 horas. Crea el esquema de seguridad necesario para impedir cambios en dicha tabla fuera del horario establecido*/ /*DELETE*/ delimiter | create trigger ControlHorario before delete on emple for each row begin declare dd int; declare hh int; set dd= dayofweek(now()); set hh=hour(now()); if (dd=1 or dd=7) or (hh<8 or hh>18) then signal sqlstate '45000' set message_text='Prohibidos los cambios fuera del horario laboral'; end if ; end ;| delimiter ; /*UPDATE*/ delimiter | create trigger ControlHorario before update on emple for each row begin declare dd int; declare hh int; set dd= dayofweek(now()); set hh=hour(now()); if (dd=1 or dd=7) or (hh<8 or hh>18) then signal sqlstate '45000' set message_text='Prohibidos los cambios fuera del horario laboral'; end if ; end ;| delimiter ; /*INSERT*/ delimiter | create trigger ControlHorario before INSERT on emple for each row begin declare dd int; declare hh int; set dd= dayofweek(now()); set hh=hour(now()); if (dd=1 or dd=7) or (hh<8 or hh>18) then signal sqlstate '45000' set message_text='Prohibidos los cambios fuera del horario laboral'; end if ; end ;| delimiter ;
create or replace PROCEDURE prc_insert_memory_usage -- p at the beginning of a variable represents those variables which are passed to the function -- l at the beginning of a variable represents that its a local variable used within the function ( p_device_name IN VARCHAR2, p_ram_usage IN NUMBER, p_cpu_usage IN NUMBER, p_updated_datetime IN DATE ) IS l_device_checker NUMBER; l_device_id NUMBER; BEGIN dbms_output.put_line('running fnc_check_if_device_exists......'); l_device_checker := fnc_check_if_device_exists(p_device_name); dbms_output.put_line('checking function - fnc_check_if_device_exists - output'); IF l_device_checker = 0 THEN prc_insert_device(p_device_name); END IF; dbms_output.put_line('checking devices id'); l_device_id := fnc_check_device_id(p_device_name); dbms_output.put_line('performing insert......'); INSERT INTO memory_history ( m_device_id, ram_usage, cpu_usage, updated_datetime ) VALUES ( l_device_id, p_ram_usage, p_cpu_usage, p_updated_datetime ); dbms_output.put_line('Insert successfull. commiting.....'); COMMIT; EXCEPTION WHEN OTHERS THEN raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM); END; /
INSERT INTO BOOK(Book_Name) VALUES ('Sapiens'),('Choosing');
-- 1. Create a database named `portfolio` CREATE DATABASE "portfolio"; CREATE TABLE "tags" (     "id" SERIAL PRIMARY KEY,     "name" varchar(255) NOT NULL ); INSERT INTO "tags" ("name") VALUES ('React'), ('jQuery'), ('Node'), ('SQL'), ('Redux'), ('HTML'); CREATE TABLE "projects" (     "id" SERIAL PRIMARY KEY,     "name" varchar(255) NOT NULL,     "description" varchar(2048), "thumbnail" varchar(2048), "website" varchar(2048), "github" varchar(2048), "date_completed" date, "tag_id" INT REFERENCES "tags", "github_repo_name" varchar(2048), "total_commits" integer, "personal_commits" integer ); INSERT INTO "projects" ("name", "description", "thumbnail", "github", "date_completed", "github_repo_name") VALUES ('Gallery App', 'This is my first CRUD react app. It shares photos from my life, allows users to like them, and has a form for uploading more pictures.', '/images/running-app.png', 'https://github.com/adunahee/react-gallery-app', '01/25/2019', 'react-gallery-app'); INSERT INTO "projects" ("name", "description", "thumbnail", "website", "github", "date_completed", "github_repo_name")     VALUES ('Feedback App', 'This is my second CRUD react app, which uses redux and react-router. It keeps track of user progress through the survey and once they have finished all parts allows them to submit it to the server. There is also an admin view that feedback to be flagged or deleted with some styling and confirmation windows.', '/images/feedback-app.png', 'https://peaceful-ridge-23540.herokuapp.com/#/ongoing/feeling', 'https://github.com/adunahee/react-redux-feedback-app', '01/29/2019', 'react-redux-feedback-app');
USE AP SELECT [VendorID] ,[LastName] ,[FirstName] , LEFT(FirstName,1) + LEFT(LastName,1) AS Initials FROM AP.dbo.ContactUpdates SELECT InvoiceDate, GETDATE() AS Today, DATEDIFF(YEAR, InvoiceDate, GETDATE()) AS InvoiceAge FROM Invoices SELECT DISTINCT VendorCity, VendorState FROM Vendors SELECT * FROM Invoices WHERE (InvoiceDate > '01/01/2016' OR InvoiceTotal > 500) AND InvoiceTotal - PaymentTotal - CreditTotal > 0 SELECT InvoiceNumber FROM Invoices WHERE InvoiceDate BETWEEN '01/01/2016' AND '04/01/2016' SELECT VendorName, VendorCity FROM Vendors ORDER BY VendorName DESC
update ACT_GE_PROPERTY set VALUE_ = '6.2.1.0' where NAME_ = 'common.schema.version'; update ACT_GE_PROPERTY set VALUE_ = '6.2.1.0' where NAME_ = 'identitylink.schema.version'; update ACT_GE_PROPERTY set VALUE_ = '6.2.1.0' where NAME_ = 'task.schema.version'; update ACT_GE_PROPERTY set VALUE_ = '6.2.1.0' where NAME_ = 'variable.schema.version'; alter table ACT_RU_JOB add SCOPE_ID_ nvarchar(255); alter table ACT_RU_JOB add SUB_SCOPE_ID_ nvarchar(255); alter table ACT_RU_JOB add SCOPE_TYPE_ nvarchar(255); alter table ACT_RU_JOB add SCOPE_DEFINITION_ID_ nvarchar(255); alter table ACT_RU_TIMER_JOB add SCOPE_ID_ nvarchar(255); alter table ACT_RU_TIMER_JOB add SUB_SCOPE_ID_ nvarchar(255); alter table ACT_RU_TIMER_JOB add SCOPE_TYPE_ nvarchar(255); alter table ACT_RU_TIMER_JOB add SCOPE_DEFINITION_ID_ nvarchar(255); alter table ACT_RU_SUSPENDED_JOB add SCOPE_ID_ nvarchar(255); alter table ACT_RU_SUSPENDED_JOB add SUB_SCOPE_ID_ nvarchar(255); alter table ACT_RU_SUSPENDED_JOB add SCOPE_TYPE_ nvarchar(255); alter table ACT_RU_SUSPENDED_JOB add SCOPE_DEFINITION_ID_ nvarchar(255); alter table ACT_RU_DEADLETTER_JOB add SCOPE_ID_ nvarchar(255); alter table ACT_RU_DEADLETTER_JOB add SUB_SCOPE_ID_ nvarchar(255); alter table ACT_RU_DEADLETTER_JOB add SCOPE_TYPE_ nvarchar(255); alter table ACT_RU_DEADLETTER_JOB add SCOPE_DEFINITION_ID_ nvarchar(255); create index ACT_IDX_JOB_SCOPE on ACT_RU_JOB(SCOPE_ID_, SCOPE_TYPE_); create index ACT_IDX_JOB_SUB_SCOPE on ACT_RU_JOB(SUB_SCOPE_ID_, SCOPE_TYPE_); create index ACT_IDX_JOB_SCOPE_DEF on ACT_RU_JOB(SCOPE_DEFINITION_ID_, SCOPE_TYPE_); create index ACT_IDX_TJOB_SCOPE on ACT_RU_TIMER_JOB(SCOPE_ID_, SCOPE_TYPE_); create index ACT_IDX_TJOB_SUB_SCOPE on ACT_RU_TIMER_JOB(SUB_SCOPE_ID_, SCOPE_TYPE_); create index ACT_IDX_TJOB_SCOPE_DEF on ACT_RU_TIMER_JOB(SCOPE_DEFINITION_ID_, SCOPE_TYPE_); create index ACT_IDX_SJOB_SCOPE on ACT_RU_SUSPENDED_JOB(SCOPE_ID_, SCOPE_TYPE_); create index ACT_IDX_SJOB_SUB_SCOPE on ACT_RU_SUSPENDED_JOB(SUB_SCOPE_ID_, SCOPE_TYPE_); create index ACT_IDX_SJOB_SCOPE_DEF on ACT_RU_SUSPENDED_JOB(SCOPE_DEFINITION_ID_, SCOPE_TYPE_); create index ACT_IDX_DJOB_SCOPE on ACT_RU_DEADLETTER_JOB(SCOPE_ID_, SCOPE_TYPE_); create index ACT_IDX_DJOB_SUB_SCOPE on ACT_RU_DEADLETTER_JOB(SUB_SCOPE_ID_, SCOPE_TYPE_); create index ACT_IDX_DJOB_SCOPE_DEF on ACT_RU_DEADLETTER_JOB(SCOPE_DEFINITION_ID_, SCOPE_TYPE_); alter table ACT_RU_JOB add CUSTOM_VALUES_ID_ nvarchar(64); alter table ACT_RU_TIMER_JOB add CUSTOM_VALUES_ID_ nvarchar(64); alter table ACT_RU_SUSPENDED_JOB add CUSTOM_VALUES_ID_ nvarchar(64); alter table ACT_RU_DEADLETTER_JOB add CUSTOM_VALUES_ID_ nvarchar(64); alter table ACT_RU_HISTORY_JOB add CUSTOM_VALUES_ID_ nvarchar(64); create index ACT_IDX_JOB_CUSTOM_VALUES_ID on ACT_RU_JOB(CUSTOM_VALUES_ID_); create index ACT_IDX_TIMER_JOB_CUSTOM_VALUES_ID on ACT_RU_TIMER_JOB(CUSTOM_VALUES_ID_); create index ACT_IDX_SUSPENDED_JOB_CUSTOM_VALUES_ID on ACT_RU_SUSPENDED_JOB(CUSTOM_VALUES_ID_); create index ACT_IDX_DEADLETTER_JOB_CUSTOM_VALUES_ID on ACT_RU_DEADLETTER_JOB(CUSTOM_VALUES_ID_); alter table ACT_RU_JOB add constraint ACT_FK_JOB_CUSTOM_VALUES foreign key (CUSTOM_VALUES_ID_) references ACT_GE_BYTEARRAY (ID_); alter table ACT_RU_TIMER_JOB add constraint ACT_FK_TIMER_JOB_CUSTOM_VALUES foreign key (CUSTOM_VALUES_ID_) references ACT_GE_BYTEARRAY (ID_); alter table ACT_RU_SUSPENDED_JOB add constraint ACT_FK_SUSPENDED_JOB_CUSTOM_VALUES foreign key (CUSTOM_VALUES_ID_) references ACT_GE_BYTEARRAY (ID_); alter table ACT_RU_DEADLETTER_JOB add constraint ACT_FK_DEADLETTER_JOB_CUSTOM_VALUES foreign key (CUSTOM_VALUES_ID_) references ACT_GE_BYTEARRAY (ID_); update ACT_GE_PROPERTY set VALUE_ = '6.2.1.0' where NAME_ = 'job.schema.version'; update ACT_GE_PROPERTY set VALUE_ = '6.2.1.0' where NAME_ = 'schema.version'; update ACT_ID_PROPERTY set VALUE_ = '6.2.1.0' where NAME_ = 'schema.version'; UPDATE [ACT_CMMN_DATABASECHANGELOGLOCK] SET [LOCKED] = 1, [LOCKEDBY] = '192.168.1.5 (192.168.1.5)', [LOCKGRANTED] = '2019-03-13T21:41:20.512' WHERE [ID] = 1 AND [LOCKED] = 0 ALTER TABLE [ACT_CMMN_CASEDEF] ADD [DGRM_RESOURCE_NAME_] [varchar](4000) ALTER TABLE [ACT_CMMN_CASEDEF] ADD [HAS_START_FORM_KEY_] [bit] ALTER TABLE [ACT_CMMN_DEPLOYMENT_RESOURCE] ADD [GENERATED_] [bit] ALTER TABLE [ACT_CMMN_RU_CASE_INST] ADD [LOCK_TIME_] [datetime] ALTER TABLE [ACT_CMMN_RU_PLAN_ITEM_INST] ADD [ITEM_DEFINITION_ID_] [varchar](255) ALTER TABLE [ACT_CMMN_RU_PLAN_ITEM_INST] ADD [ITEM_DEFINITION_TYPE_] [varchar](255) INSERT INTO [ACT_CMMN_DATABASECHANGELOG] ([ID], [AUTHOR], [FILENAME], [DATEEXECUTED], [ORDEREXECUTED], [MD5SUM], [DESCRIPTION], [COMMENTS], [EXECTYPE], [CONTEXTS], [LABELS], [LIQUIBASE], [DEPLOYMENT_ID]) VALUES ('2', 'flowable', 'org/flowable/cmmn/db/liquibase/flowable-cmmn-db-changelog.xml', GETDATE(), 2, '7:72a1f3f4767524ec0e22288a1621ebb9', 'addColumn tableName=ACT_CMMN_CASEDEF; addColumn tableName=ACT_CMMN_DEPLOYMENT_RESOURCE; addColumn tableName=ACT_CMMN_RU_CASE_INST; addColumn tableName=ACT_CMMN_RU_PLAN_ITEM_INST', '', 'EXECUTED', NULL, NULL, '3.5.3', '2509681303') UPDATE [ACT_CMMN_DATABASECHANGELOGLOCK] SET [LOCKED] = 0, [LOCKEDBY] = NULL, [LOCKGRANTED] = NULL WHERE [ID] = 1 UPDATE [ACT_DMN_DATABASECHANGELOGLOCK] SET [LOCKED] = 1, [LOCKEDBY] = '192.168.1.5 (192.168.1.5)', [LOCKGRANTED] = '2019-03-13T21:41:27.977' WHERE [ID] = 1 AND [LOCKED] = 0 UPDATE [ACT_DMN_DATABASECHANGELOGLOCK] SET [LOCKED] = 0, [LOCKEDBY] = NULL, [LOCKGRANTED] = NULL WHERE [ID] = 1 UPDATE [ACT_FO_DATABASECHANGELOGLOCK] SET [LOCKED] = 1, [LOCKEDBY] = '192.168.1.5 (192.168.1.5)', [LOCKGRANTED] = '2019-03-13T21:41:34.801' WHERE [ID] = 1 AND [LOCKED] = 0 UPDATE [ACT_FO_DATABASECHANGELOGLOCK] SET [LOCKED] = 0, [LOCKEDBY] = NULL, [LOCKGRANTED] = NULL WHERE [ID] = 1 UPDATE [ACT_CO_DATABASECHANGELOGLOCK] SET [LOCKED] = 1, [LOCKEDBY] = '192.168.1.5 (192.168.1.5)', [LOCKGRANTED] = '2019-03-13T21:41:41.571' WHERE [ID] = 1 AND [LOCKED] = 0 UPDATE [ACT_CO_DATABASECHANGELOGLOCK] SET [LOCKED] = 0, [LOCKEDBY] = NULL, [LOCKGRANTED] = NULL WHERE [ID] = 1
[findCurrentSurvey] SELECT * FROM tagbalay_survey WHERE tagbalay_objid = $P{tagbalayid} [deleteSurvey] DELETE FROM tagbalay_survey WHERE objid = $P{surveyid}
INSERT INTO burgers (burger_name, devoured) VALUES ("Double Cheeseburger", 0),("Portebello Mushroomburger", 0), ("Veggieburger", 0),("Yummyburger", 0),("Deluxeburger", 0),("Angusburger", 0) ,("Doubledeckerburger", 0);
CREATE TABLE [endur].[vw_idx_group] ( SUBSYSTEM_ID INT NULL, NAME NVARCHAR(MAX) NULL, ID_NUMBER INT NULL )
CREATE TABLE `user` ( `id` INT AUTO_INCREMENT NOT NULL COMMENT '主键', `name` varchar(50) NOT NULL );
CREATE TABLE sys_ref( ref_type VARCHAR(10) NULL ,ref_value VARCHAR(2) NULL ,ref_name VARCHAR(20) NULL)
SELECT ps_partkey, ps_suppkey, ps_availqty, ps_supplycost FROM partsupp WHERE ps_partkey=123 AND ps_suppkey>10 AND ps_suppkey<100
with tmp as ( select pg_get_userbyid(db.datdba) datdba, pg_encoding_to_char(db.encoding) "encoding", db.datcollate, db.datctype, db.datallowconn, db.datconnlimit, db.datlastsysoid, db.datfrozenxid, db.datminmxid, db.dattablespace, db.datacl, s.*, c.* from pg_database db join pg_stat_database s on db.oid = s.datid join pg_stat_database_conflicts c on db.oid = c.datid where db.oid = $database.id$ ) select * from jsonb_each_text(to_jsonb((select tmp from tmp))) order by 1
 -- Insert city data INSERT INTO public.city SELECT code, geom, cityname, ecityname FROM public.cityin; DROP TABLE IF EXISTS public.cityin; -- Insert town data INSERT INTO public.town SELECT TOW.code, TOW.geom, TOW.townname, TOW.etownname, TOW.zipcode, C.id FROM public.townin TOW, public.city C WHERE ST_Intersects(TOW.geom, C.geom); DROP TABLE IF EXISTS public.townin; -- Replace NULL values with string 'NONE' in the input source table 'roadin'. UPDATE public.roadin SET txt = 'NONE' WHERE txt IS NULL; UPDATE public.roadin SET fullname = 'NONE' WHERE fullname IS NULL; -- Insert road data INSERT INTO public.road_info SELECT nextval('road_info_id_seq'::regclass), T.* FROM (SELECT DISTINCT txt, fullname, TYPE, kind FROM public.roadin WHERE (txt, fullname, TYPE, kind) NOT IN (SELECT road_name, full_name, TYPE, kind FROM road_info) ORDER BY txt) T; INSERT INTO public.road SELECT nextval('road_id_seq'::regclass), geom, L.id, town FROM public.road_info L, public.roadin R WHERE L.road_name = R.txt AND L.full_name = R.fullname AND L.TYPE = R.TYPE AND L.kind = R.kind; DROP TABLE IF EXISTS public.roadin; -- Replace NULL values with string 'NONE' in the input source table 'schoolin'. UPDATE public.schoolin SET code = 'NONE' WHERE code IS NULL; -- Insert school data INSERT INTO public.school SELECT nextval('school_id_seq'::regclass), SC.geom, SC.txtname, SC.code FROM public.schoolin SC; DROP TABLE IF EXISTS public.schoolin;
delete from HtmlLabelIndex where id=26027 / delete from HtmlLabelInfo where indexid=26027 / INSERT INTO HtmlLabelIndex values(26027,'确认删除该索引库吗?') / INSERT INTO HtmlLabelInfo VALUES(26027,'确认删除该索引库吗?',7) / INSERT INTO HtmlLabelInfo VALUES(26027,'Do you confirm the deletion of the index database?',8) / INSERT INTO HtmlLabelInfo VALUES(26027,'确認删除該索引庫嗎?',9) /
CREATE DATABASE awardData; use awardData; CREATE TABLE IF NOT EXISTS oscarAgeMale ( `id` INT NOT NULL AUTO_INCREMENT, `year` INT, `age` INT, `name` VARCHAR(22) , `movie` VARCHAR(43) , PRIMARY KEY (`id`) );
DROP TABLE IF EXISTS leads; DROP TABLE IF EXISTS high_priority; CREATE DATABASE leadsdb WITH OWNER = postgres ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' CONNECTION LIMIT = -1; CREATE TABLE leads ( registration_dttm varchar, id varchar, first_name varchar, last_name varchar, email varchar, gender varchar, ip_address varchar, cc varchar, country varchar, birthdate varchar, salary varchar, title varchar, comments varchar); CREATE TABLE high_priority ( registration_dttm varchar, id varchar, first_name varchar, last_name varchar, email varchar, gender varchar, ip_address varchar, cc varchar, country varchar, birthdate varchar, salary varchar, title varchar, comments varchar);
/* Navicat MySQL Data Transfer Source Server : MySQL1 Source Server Version : 50624 Source Host : localhost:3306 Source Database : springbootdb_cluster Target Server Type : MYSQL Target Server Version : 50624 File Encoding : 65001 Date: 2018-10-18 13:27:30 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `city` -- ---------------------------- DROP TABLE IF EXISTS `city`; CREATE TABLE `city` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '城市编号', `province_id` int(10) unsigned NOT NULL COMMENT '省份编号', `city_name` varchar(25) DEFAULT NULL COMMENT '城市名称', `description` varchar(25) DEFAULT NULL COMMENT '描述', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of city -- ---------------------------- INSERT INTO `city` VALUES ('1', '1', '温岭市', 'BYSocket 的家在温岭。'); INSERT INTO `city` VALUES ('2', '2', '大连市', '梦在大连'); INSERT INTO `city` VALUES ('3', '3', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('4', '4', '成都', '梦在成都'); INSERT INTO `city` VALUES ('6', '6', '成都', '梦在成都'); INSERT INTO `city` VALUES ('10', '5', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('11', '5', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('12', '5', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('13', '5', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('14', '5', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('15', '5', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('16', '5', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('17', '5', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('18', '5', '三亚', '梦在三亚'); INSERT INTO `city` VALUES ('19', '12', '郑州市', 'zhengzhou'); INSERT INTO `city` VALUES ('20', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('21', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('22', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('23', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('24', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('25', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('26', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('27', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('28', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('29', '11', '唐山市', 'tangshan'); INSERT INTO `city` VALUES ('30', '11', '唐山市', 'tangshan');
drop table if exists `category`; create table if not exists `category`( `id` bigint(20) primary key auto_increment, `fatherId` bigint(20) not null default 0, `name` varchar(100) not null, `description` longtext )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
call apoc.load.json('?') yield value unwind value.data["@graph"] as q MERGE (canonicalEntity:CanonicalEntity {entityCode:q.entityCode}) ON CREATE SET canonicalEntity.entityDescription = q.entityDescription FOREACH (attribute IN q.attributes | MERGE (canonicalAttribute:CanonicalAttribute {name:attribute.name, displayName:attribute.displayName,type:attribute.type, length: attribute.length, precision:attribute.precision, isUnique:attribute.isUnique, isMandatory: attribute.isMandatory,isNaturalKey: attribute.isNaturalKey, naturalKeyOrder:attribute.naturalKeyOrder, ownership: attribute.ownership, source:attribute.source }) MERGE (canonicalEntity)-[:ATTRIBUTE]->(canonicalAttribute))
SELECT count(*) as COUNT_NOTDEPLOYED FROM tbl_som_object so INNER JOIN tbl_fom_object fo on fo.col_id = so.col_som_objectfom_object INNER JOIN tbl_fom_attribute fa on fa.col_fom_attributefom_object = fo.col_id LEFT JOIN vw_util_deployedbo dbo on lower(dbo.BACODE) = lower(fa.col_apicode) LEFT JOIN vw_fom_relationship frc on lower(frc.CODE) = lower(fa.col_apicode) WHERE ((:ConfigId is not null and so.col_som_objectsom_model = (SELECT sm.col_id FROM tbl_som_config sc INNER JOIN tbl_som_model sm ON sm.col_id = sc.col_som_configsom_model WHERE sc.col_id = :ConfigId)) or (:ModelId is not null and so.col_som_objectsom_model = :ModelId)) and so.col_type IN ('businessObject', 'rootBusinessObject') and dbo.col_id is null and frc.col_id is null and fa.col_alias NOT IN ('PARENTID', 'ID')