PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE students ( id INT PRIMARY KEY, name VARCHAR(256) NOT NULL ); CREATE TABLE marks ( id INT PRIMARY KEY, student_id INT NOT NULL, val TINYINT NOT NULL ); INSERT INTO students (id, name) VALUES (1, Иван), (2, Николай), (3, Михаил), (4, Владимир), (5, Петр), (6, Лидия), (7, Анфиса), (8, Артур), (9, Сергей), (10, Таня), (11, Света), (12, Григорий), (13, Афанасий), (14, Эльдар), (15, John), (16, Barbara); INSERT INTO marks (id, student_id, val) VALUES (1030519, 1, 4), (1135927, 1, 5), (1261802, 1, 4), (1332383, 1, 4), (1471022, 1, 5), (1591752, 1, 4), (1623454, 1, 4), (1778917, 1, 3), (1863503, 1, 3), (1977462, 1, 5), (11087996, 1, 4), (11187698, 1, 4), (11257662, 1, 4), (11333378, 1, 4), (11476177, 1, 3), (11518274, 1, 5), (11618457, 1, 5), (11765183, 1, 2), (11848528, 1, 2), (11962527, 1, 3), (12034936, 1, 4), (12155543, 1, 5), (12231593, 1, 4), (12376136, 1, 3), (12495969, 1, 4), (12567465, 1, 5), (12615940, 1, 4), (12782049, 1, 3), (12896504, 1, 3), (12947605, 1, 3), (13062469, 1, 2), (13147055, 1, 4), (13269839, 1, 3), (13365972, 1, 4), (13433636, 1, 3), (13574305, 1, 4), (13649733, 1, 3), (13764566, 1, 4), (13890738, 1, 3), (13915240, 1, 5), (14054387, 1, 5), (14153289, 1, 4), (14224971, 1, 2), (14378068, 1, 5), (14413077, 1, 4), (14512521, 1, 4), (14680006, 1, 4), (14749576, 1, 5), (14867406, 1, 3), (14950886, 1, 2), (15034135, 1, 4), (2075644, 2, 3), (2118780, 2, 5), (2257345, 2, 3), (2354976, 2, 3), (2477753, 2, 2), (2592741, 2, 4), (2664258, 2, 5), (2785548, 2, 3), (2823164, 2, 4), (2953632, 2, 5), (21057083, 2, 5), (21159548, 2, 5), (21247318, 2, 4), (21321606, 2, 2), (21418097, 2, 4), (21578890, 2, 3), (21691609, 2, 4), (21782912, 2, 2), (21862956, 2, 2), (21976404, 2, 4), (22038273, 2, 2), (22149014, 2, 3), (22278297, 2, 4), (22338856, 2, 4), (22426762, 2, 2), (22541523, 2, 3), (22650029, 2, 2), (22775329, 2, 3), (22845665, 2, 4), (22916685, 2, 2), (23092865, 2, 2), (23119075, 2, 3), (23284657, 2, 5), (23367142, 2, 4), (23448779, 2, 2), (23574946, 2, 2), (23677682, 2, 4), (23728670, 2, 4), (23826857, 2, 3), (23946317, 2, 5), (24043047, 2, 5), (24174959, 2, 3), (24291405, 2, 5), (24374079, 2, 4), (24421769, 2, 2), (24545649, 2, 3), (24642047, 2, 3), (24764599, 2, 3), (24868578, 2, 2), (24925345, 2, 3), (25067681, 2, 3), (3092040, 3, 2), (3184775, 3, 3), (3225421, 3, 4), (3386423, 3, 4), (3472468, 3, 4), (3528590, 3, 2), (3612067, 3, 3), (3781621, 3, 3), (3862961, 3, 3), (3912749, 3, 4), (31054606, 3, 3), (31197505, 3, 5), (31291419, 3, 4), (31344416, 3, 4), (31453495, 3, 4), (31581583, 3, 5), (31679129, 3, 4), (31768764, 3, 3), (31828206, 3, 3), (31941335, 3, 5), (32062780, 3, 4), (32129075, 3, 4), (32295420, 3, 4), (32366771, 3, 4), (32412733, 3, 5), (32536381, 3, 3), (32666926, 3, 4), (32730632, 3, 4), (32861892, 3, 4), (32911037, 3, 3), (33016351, 3, 5), (33126023, 3, 5), (33241895, 3, 2), (33384084, 3, 2), (33459024, 3, 5), (33533852, 3, 4), (33625234, 3, 4), (33726315, 3, 3), (33883335, 3, 3), (33944038, 3, 5), (34094049, 3, 4), (34118908, 3, 4), (34235410, 3, 4), (34331955, 3, 5), (34460693, 3, 4), (34539240, 3, 4), (34622951, 3, 2), (34731871, 3, 4), (34815212, 3, 4), (34966352, 3, 4), (35077593, 3, 3), (4072188, 4, 3), (4122754, 4, 4), (4222806, 4, 4), (4377091, 4, 3), (4442421, 4, 4), (4510641, 4, 3), (4670491, 4, 3), (4732306, 4, 5), (4816266, 4, 5), (4974620, 4, 2), (41044535, 4, 3), (41162700, 4, 2), (41227321, 4, 3), (41336283, 4, 4), (41489635, 4, 2), (41542183, 4, 4), (41650966, 4, 5), (41770695, 4, 4), (41845080, 4, 5), (41934202, 4, 3), (42089495, 4, 5), (42122201, 4, 2), (42277962, 4, 5), (42312353, 4, 4), (42444149, 4, 4), (42514035, 4, 4), (42614460, 4, 4), (42719904, 4, 3), (42855385, 4, 5), (42945950, 4, 3), (43091283, 4, 4), (43174620, 4, 5), (43242708, 4, 4), (43323421, 4, 4), (43499697, 4, 4), (43515161, 4, 5), (43628318, 4, 4), (43771975, 4, 3), (43851943, 4, 3), (43968217, 4, 3), (44034205, 4, 4), (44164837, 4, 5), (44271211, 4, 5), (44375604, 4, 2), (44445236, 4, 5), (44523621, 4, 3), (44643802, 4, 4), (44771617, 4, 3), (44875371, 4, 5), (44936805, 4, 5), (45095142, 4, 2), (5058710, 5, 5), (5114900, 5, 4), (5214018, 5, 4), (5317739, 5, 2), (5437204, 5, 3), (5593026, 5, 4), (5688440, 5, 3), (5738605, 5, 4), (5869223, 5, 5), (5957085, 5, 4), (51060636, 5, 5), (51182292, 5, 5), (51221069, 5, 4), (51374047, 5, 4), (51490086, 5, 3), (51579345, 5, 5), (51639747, 5, 3), (51739005, 5, 4), (51822703, 5, 2), (51926000, 5, 4), (52016740, 5, 2), (52144151, 5, 4), (52252890, 5, 5), (52369726, 5, 3), (52481381, 5, 4), (52562608, 5, 3), (52678703, 5, 4), (52762132, 5, 5), (52855770, 5, 4), (52922039, 5, 4), (53092807, 5, 3), (53182585, 5, 5), (53251223, 5, 3), (53316003, 5, 4), (53459636, 5, 4), (53579281, 5, 5), (53610554, 5, 5), (53775722, 5, 2), (53811636, 5, 3), (53937562, 5, 3), (54057517, 5, 3), (54144557, 5, 4), (54286124, 5, 4), (54310460, 5, 5), (54496409, 5, 4), (54580958, 5, 3), (54646615, 5, 4), (54777812, 5, 3), (54827985, 5, 4), (54975760, 5, 3), (55058595, 5, 4), (6033870, 6, 2), (6134715, 6, 4), (6224606, 6, 4), (6362436, 6, 4), (6414654, 6, 4), (6523456, 6, 3), (6669463, 6, 4), (6715319, 6, 4), (6891630, 6, 4), (6949882, 6, 2), (61096248, 6, 5), (61191576, 6, 5), (61241585, 6, 2), (61320418, 6, 2), (61415060, 6, 3), (61526057, 6, 4), (61662212, 6, 4), (61731412, 6, 3), (61822111, 6, 5), (61944422, 6, 4), (62085691, 6, 2), (62158785, 6, 4), (62269463, 6, 4), (62349630, 6, 3), (62438593, 6, 4), (62510938, 6, 3), (62654800, 6, 5), (62743474, 6, 4), (62863871, 6, 5), (62918338, 6, 4), (63081803, 6, 4), (63178338, 6, 5), (63220981, 6, 3), (63331049, 6, 5), (63411848, 6, 4), (63511862, 6, 5), (63638675, 6, 5), (63786480, 6, 3), (63816963, 6, 5), (63952355, 6, 4), (64090727, 6, 2), (64193808, 6, 3), (64217447, 6, 4), (64397206, 6, 3), (64447267, 6, 2), (64558485, 6, 4), (64630452, 6, 4), (64763047, 6, 4), (64830237, 6, 2), (64958081, 6, 2), (65018319, 6, 3), (7021165, 7, 3), (7119915, 7, 3), (7224957, 7, 3), (7388717, 7, 3), (7423856, 7, 2), (7563259, 7, 4), (7658070, 7, 4), (7717074, 7, 3), (7841108, 7, 4), (7928110, 7, 3), (71049369, 7, 5), (71144036, 7, 3), (71283211, 7, 5), (71370473, 7, 5), (71423417, 7, 3), (71527303, 7, 3), (71686428, 7, 2), (71737128, 7, 2), (71873075, 7, 4), (71940424, 7, 3), (72029932, 7, 2), (72155674, 7, 4), (72217570, 7, 5), (72357199, 7, 2), (72498534, 7, 4), (72563578, 7, 4), (72637431, 7, 3), (72712316, 7, 4), (72835357, 7, 5), (72947214, 7, 5), (73024831, 7, 4), (73146106, 7, 4), (73285095, 7, 5), (73382413, 7, 4), (73417461, 7, 3), (73599421, 7, 3), (73625730, 7, 4), (73786928, 7, 2), (73844170, 7, 3), (73958561, 7, 3), (74042701, 7, 3), (74178107, 7, 4), (74290968, 7, 4), (74382263, 7, 2), (74481307, 7, 5), (74512183, 7, 2), (74644305, 7, 4), (74776328, 7, 3), (74875972, 7, 4), (74949482, 7, 3), (75029064, 7, 3), (8051374, 8, 4), (8190732, 8, 4), (8226137, 8, 4), (8327773, 8, 4), (8496395, 8, 2), (8548680, 8, 5), (8671891, 8, 4), (8773104, 8, 4), (8816277, 8, 5), (8948219, 8, 4), (81069524, 8, 2), (81147084, 8, 3), (81256048, 8, 4), (81379553, 8, 4), (81464902, 8, 3), (81514568, 8, 2), (81636115, 8, 5), (81724090, 8, 4), (81829147, 8, 5), (81945582, 8, 4), (82089905, 8, 5), (82162242, 8, 4), (82277942, 8, 5), (82327866, 8, 4), (82448139, 8, 2), (82547075, 8, 4), (82670316, 8, 2), (82762692, 8, 4), (82899924, 8, 4), (82919364, 8, 2), (83081933, 8, 3), (83154076, 8, 2), (83227166, 8, 4), (83348013, 8, 3), (83442201, 8, 4), (83593684, 8, 5), (83617581, 8, 3), (83710546, 8, 5), (83835127, 8, 3), (83971652, 8, 5), (84033112, 8, 4), (84116453, 8, 5), (84218116, 8, 4), (84310505, 8, 5), (84437943, 8, 3), (84597698, 8, 5), (84679247, 8, 3), (84737358, 8, 4), (84810530, 8, 3), (84933447, 8, 2), (85041154, 8, 5), (9019455, 9, 5), (9187879, 9, 4), (9295119, 9, 3), (9385313, 9, 3), (9420694, 9, 5), (9566679, 9, 3), (9652325, 9, 3), (9749022, 9, 5), (9847784, 9, 4), (9912508, 9, 5), (91015357, 9, 3), (91163835, 9, 5), (91227381, 9, 5), (91379414, 9, 3), (91485189, 9, 5), (91593094, 9, 5), (91645452, 9, 3), (91715864, 9, 3), (91831339, 9, 4), (91932484, 9, 4), (92089370, 9, 3), (92149552, 9, 4), (92217493, 9, 5), (92356249, 9, 4), (92435354, 9, 5), (92564225, 9, 5), (92610211, 9, 5), (92786937, 9, 3), (92832458, 9, 4), (92953571, 9, 4), (93051483, 9, 2), (93183883, 9, 2), (93245736, 9, 4), (93337350, 9, 3), (93487658, 9, 3), (93547581, 9, 4), (93653047, 9, 5), (93792139, 9, 3), (93828502, 9, 2), (93947633, 9, 2), (94043302, 9, 3), (94126186, 9, 2), (94263822, 9, 5), (94338637, 9, 3), (94420523, 9, 4), (94519573, 9, 5), (94696639, 9, 4), (94752802, 9, 3), (94834973, 9, 2), (94989571, 9, 5), (95052639, 9, 2), (10016570, 10, 4), (10179433, 10, 4), (10237452, 10, 4), (10338265, 10, 5), (10445048, 10, 4), (10546031, 10, 5), (10615250, 10, 2), (10783951, 10, 5), (10811055, 10, 2), (10940249, 10, 4), (101093809, 10, 3), (101113391, 10, 4), (101219214, 10, 5), (101366663, 10, 3), (101481202, 10, 4), (101541625, 10, 4), (101691045, 10, 5), (101748958, 10, 3), (101869958, 10, 5), (101932747, 10, 3), (102030781, 10, 3), (102189823, 10, 5), (102224036, 10, 2), (102324987, 10, 4), (102424619, 10, 5), (102529441, 10, 3), (102627827, 10, 3), (102784568, 10, 4), (102868379, 10, 4), (102978900, 10, 3), (103018843, 10, 5), (103147329, 10, 5), (103280576, 10, 3), (103352870, 10, 5), (103419248, 10, 4), (103554961, 10, 4), (103630761, 10, 5), (103710397, 10, 5), (103813347, 10, 5), (103945093, 10, 3), (104089225, 10, 3), (104172492, 10, 5), (104224727, 10, 3), (104351973, 10, 5), (104466336, 10, 3), (104579845, 10, 3), (104637683, 10, 4), (104714509, 10, 4), (104846754, 10, 3), (104976248, 10, 2), (105028875, 10, 3), (11019184, 11, 4), (11114699, 11, 3), (11232451, 11, 3), (11361672, 11, 4), (11469424, 11, 3), (11598158, 11, 5), (11640796, 11, 2), (11772141, 11, 5), (11815260, 11, 4), (11925881, 11, 3), (111086496, 11, 4), (111187176, 11, 4), (111262638, 11, 2), (111323816, 11, 5), (111449608, 11, 4), (111582839, 11, 5), (111693102, 11, 3), (111770360, 11, 4), (111810980, 11, 2), (111962670, 11, 4), (112011046, 11, 5), (112142908, 11, 3), (112217623, 11, 4), (112340996, 11, 4), (112420749, 11, 5), (112571586, 11, 4), (112695662, 11, 2), (112799587, 11, 4), (112833255, 11, 3), (112933554, 11, 3), (113012839, 11, 3), (113157552, 11, 5), (113227448, 11, 5), (113354387, 11, 2), (113476851, 11, 4), (113585886, 11, 5), (113679578, 11, 4), (113747984, 11, 4), (113816802, 11, 3), (113940308, 11, 3), (114094343, 11, 4), (114178432, 11, 4), (114270549, 11, 3), (114354340, 11, 5), (114447992, 11, 3), (114513410, 11, 2), (114631905, 11, 4), (114750611, 11, 4), (114839278, 11, 3), (114970989, 11, 3), (115054949, 11, 4), (12019740, 12, 3), (12147176, 12, 5), (12297544, 12, 4), (12394585, 12, 5), (12497559, 12, 4), (12541242, 12, 3), (12686916, 12, 4), (12722338, 12, 4), (12812892, 12, 2), (12992004, 12, 5), (121053926, 12, 3), (121133456, 12, 3), (121270568, 12, 4), (121396344, 12, 4), (121454110, 12, 4), (121574837, 12, 3), (121665643, 12, 5), (121794742, 12, 5), (121810309, 12, 4), (121930450, 12, 3), (122031201, 12, 2), (122142814, 12, 5), (122284051, 12, 3), (122316871, 12, 3), (122423049, 12, 3), (122522721, 12, 4), (122627253, 12, 4), (122721247, 12, 4), (122895152, 12, 3), (122932965, 12, 3), (123063090, 12, 5), (123174231, 12, 3), (123299054, 12, 2), (123338407, 12, 3), (123461050, 12, 4), (123546873, 12, 5), (123685602, 12, 3), (123746631, 12, 4), (123843250, 12, 5), (123962701, 12, 3), (124092481, 12, 4), (124186228, 12, 3), (124269974, 12, 3), (124345679, 12, 3), (124464640, 12, 3), (124575274, 12, 4), (124647272, 12, 3), (124778964, 12, 4), (124851688, 12, 2), (124913761, 12, 4), (125068490, 12, 4), (13062656, 13, 4), (13198413, 13, 4), (13286152, 13, 3), (13379004, 13, 3), (13419193, 13, 4), (13530313, 13, 4), (13661960, 13, 2), (13747434, 13, 2), (13830861, 13, 4), (13986677, 13, 4), (131081083, 13, 3), (131184890, 13, 3), (131221786, 13, 5), (131386977, 13, 2), (131462562, 13, 3), (131515027, 13, 2), (131661078, 13, 3), (131782314, 13, 3), (131825132, 13, 4), (131931326, 13, 5), (132085932, 13, 3), (132123037, 13, 2), (132224213, 13, 4), (132364207, 13, 4), (132452611, 13, 5), (132532782, 13, 4), (132677716, 13, 2), (132799045, 13, 2), (132849334, 13, 4), (132982465, 13, 3), (133045610, 13, 3), (133168818, 13, 4), (133257579, 13, 3), (133330340, 13, 3), (133470180, 13, 5), (133568579, 13, 4), (133692910, 13, 3), (133793646, 13, 2), (133882523, 13, 3), (133930171, 13, 4), (134070574, 13, 4), (134180790, 13, 5), (134232269, 13, 3), (134356594, 13, 3), (134469662, 13, 5), (134549717, 13, 5), (134665755, 13, 4), (134726993, 13, 4), (134873878, 13, 4), (134976162, 13, 3), (135019715, 13, 4), (14046171, 14, 5), (14124085, 14, 5), (14284894, 14, 3), (14375683, 14, 2), (14415434, 14, 5), (14510574, 14, 4), (14687432, 14, 5), (14758921, 14, 3), (14884107, 14, 5), (14997577, 14, 5), (141011896, 14, 5), (141153973, 14, 2), (141215641, 14, 3), (141376935, 14, 5), (141426129, 14, 5), (141580024, 14, 5), (141672900, 14, 3), (141754037, 14, 2), (141875445, 14, 3), (141969996, 14, 5), (142068251, 14, 2), (142136625, 14, 2), (142219786, 14, 5), (142384876, 14, 2), (142416560, 14, 3), (142543841, 14, 4), (142675095, 14, 4), (142747715, 14, 4), (142845715, 14, 4), (142975938, 14, 3), (143093211, 14, 4), (143137085, 14, 5), (143297833, 14, 5), (143350421, 14, 2), (143467128, 14, 4), (143531577, 14, 4), (143674934, 14, 4), (143744592, 14, 4), (143832791, 14, 4), (143944760, 14, 2), (144041331, 14, 2), (144172302, 14, 5), (144250653, 14, 2), (144355451, 14, 3), (144417458, 14, 4), (144529559, 14, 5), (144665440, 14, 4), (144766506, 14, 3), (144840927, 14, 4), (144978746, 14, 4), (145021545, 14, 4), (15083790, 15, 3), (15114376, 15, 3), (15285869, 15, 3), (15366149, 15, 4), (15478070, 15, 4), (15578116, 15, 4), (15698009, 15, 3), (15790534, 15, 3), (15895960, 15, 5), (15990466, 15, 5), (151038807, 15, 3), (151128124, 15, 4), (151269496, 15, 5), (151356065, 15, 4), (151446189, 15, 5), (151518713, 15, 5), (151653399, 15, 5), (151731114, 15, 3), (151870002, 15, 3), (151928852, 15, 4), (152038844, 15, 3), (152144401, 15, 3), (152243599, 15, 4), (152371487, 15, 4), (152428934, 15, 3), (152542204, 15, 4), (152619914, 15, 3), (152722434, 15, 2), (152817732, 15, 4), (152917334, 15, 4), (153075332, 15, 4), (153149064, 15, 3), (153262796, 15, 4), (153380236, 15, 5), (153482239, 15, 4), (153582530, 15, 4), (153622104, 15, 4), (153766534, 15, 5), (153863277, 15, 4), (153990071, 15, 4), (154019488, 15, 5), (154156864, 15, 4), (154232741, 15, 2), (154397306, 15, 4), (154463291, 15, 5), (154573483, 15, 2), (154623453, 15, 4), (154761986, 15, 3), (154864578, 15, 4), (154980412, 15, 4), (155019870, 15, 4), (16086082, 16, 5), (16189074, 16, 4), (16281424, 16, 5), (16342185, 16, 4), (16421563, 16, 5), (16575690, 16, 5), (16631528, 16, 4), (16736191, 16, 2), (16896790, 16, 5), (16950738, 16, 5), (161029523, 16, 5), (161165739, 16, 5), (161241725, 16, 5), (161337588, 16, 3), (161417050, 16, 5), (161592712, 16, 3), (161613859, 16, 3), (161738731, 16, 3), (161889015, 16, 3), (161983727, 16, 5), (162053124, 16, 5), (162182433, 16, 2), (162246146, 16, 5), (162316793, 16, 4), (162436717, 16, 4), (162530619, 16, 5), (162692577, 16, 4), (162779280, 16, 5), (162852650, 16, 3), (162989736, 16, 4), (163025765, 16, 4), (163195855, 16, 4), (163284148, 16, 5), (163342798, 16, 4), (163417682, 16, 2), (163584366, 16, 3), (163633354, 16, 3), (163793464, 16, 4), (163884862, 16, 5), (163983623, 16, 5), (164023751, 16, 5), (164165771, 16, 3), (164223649, 16, 2), (164311965, 16, 2), (164467031, 16, 5), (164514244, 16, 5), (164695896, 16, 4), (164712691, 16, 2), (164841973, 16, 5), (164960582, 16, 5), (165054310, 16, 3); SELECT COUNT(*) FROM students; SELECT COUNT(*) FROM marks;
Copy Clear
Copy Format Clear
<?php $studentsList = array('Иван', 'Николай', 'Михаил', 'Владимир', 'Петр', 'Лидия', 'Анфиса', 'Артур', 'Сергей', 'Таня', 'Света', 'Григорий', 'Афанасий', 'Эльдар', 'John', 'Barbara'); $studentsInsert = 'INSERT INTO students (id, name) VALUES '; $counter = count($studentsList); $marksInsert = 'INSERT INTO marks (id, student_id, val) VALUES '; $i = 0; foreach ($studentsList as $student) { $i++; $studentsInsert .= "\r\n"; $studentsInsert .= "($i, '$student')"; if ($i < $counter) { $studentsInsert .= ','; } else { $studentsInsert .= ';'; } $qty = 50; for ($j = 0; $j <= $qty; $j++) { $id = (string)$i . (string)$j . (string)random_int(10000, 99999); $mark = random_int(2, 5); if ($mark === 3) $mark = random_int(3, 4); if ($mark === 2) $mark = random_int(2, 3); $mark = (string)$mark; $marksInsert .= "\r\n"; $marksInsert .= "($id, $i, $mark)"; $marksInsert .= ','; } } $marksInsert = rtrim($marksInsert, ','); $marksInsert .= ';'; echo $studentsInsert; echo "\r\n"; echo "\r\n"; echo "\r\n"; echo $marksInsert;
Show:  
Copy Clear