blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
3
276
src_encoding
stringclasses
33 values
length_bytes
int64
23
9.61M
score
float64
2.52
5.28
int_score
int64
3
5
detected_licenses
listlengths
0
44
license_type
stringclasses
2 values
text
stringlengths
23
9.43M
download_success
bool
1 class
80cca0c03ae314bd94601fe08cd2ec05ac39823f
SQL
blue19demon/div-mybatis
/div-mybatis/bin/sql-case/test.sql
GB18030
706
3.09375
3
[]
no_license
CREATE TABLE `user` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_name` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `phone` varchar(255) DEFAULT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE `answer` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `enabled` bit(1) NOT NULL, `update_time` datetime DEFAULT NULL, `version` int(11) NOT NULL, `user_id` int(11) DEFAULT NULL COMMENT 'ûid', `questionnaire_id` int(11) DEFAULT NULL COMMENT 'ʾid', `choice_id` int(11) DEFAULT NULL COMMENT 'ѡid', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
true
5729707b0613b35431bebb39d86d3dee1343cfd4
SQL
FaithMandela/QuestionThree
/projects/vms/database/data/counties.sql
UTF-8
4,002
2.9375
3
[]
no_license
-- -- PostgreSQL database dump -- SET statement_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = off; SET check_function_bodies = false; SET client_min_messages = warning; SET escape_string_warning = off; SET search_path = public, pg_catalog; SET default_tablespace = ''; SET default_with_oids = false; -- -- Name: counties; Type: TABLE; Schema: public; Owner: iebc; Tablespace: -- CREATE TABLE counties ( id integer NOT NULL, name character varying(35) NOT NULL, code character varying(3) NOT NULL, region_id integer NOT NULL, created timestamp(6) with time zone NOT NULL ); ALTER TABLE public.counties OWNER TO iebc; -- -- Name: counties_id_seq; Type: SEQUENCE; Schema: public; Owner: iebc -- CREATE SEQUENCE counties_id_seq START WITH 47 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE public.counties_id_seq OWNER TO iebc; -- -- Name: counties_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: iebc -- ALTER SEQUENCE counties_id_seq OWNED BY counties.id; -- -- Name: counties_id_seq; Type: SEQUENCE SET; Schema: public; Owner: iebc -- SELECT pg_catalog.setval('counties_id_seq', 47, false); -- -- Name: id; Type: DEFAULT; Schema: public; Owner: iebc -- ALTER TABLE counties ALTER COLUMN id SET DEFAULT nextval('counties_id_seq'::regclass); -- -- Data for Name: counties; Type: TABLE DATA; Schema: public; Owner: iebc -- COPY counties (id, name, code, region_id, created) FROM stdin; 1 NAIROBI 001 1 2011-01-01 00:00:00+03 31 BARINGO 031 12 2011-01-01 00:00:00+03 36 BOMET 036 13 2011-01-01 00:00:00+03 40 BUNGOMA 040 15 2011-01-01 00:00:00+03 41 BUSIA 041 14 2011-01-01 00:00:00+03 29 ELGEYO/MARAKWET 029 11 2011-01-01 00:00:00+03 8 GARISSA 008 4 2011-01-01 00:00:00+03 44 HOMA BAY 044 16 2011-01-01 00:00:00+03 12 ISIOLO 012 6 2011-01-01 00:00:00+03 35 KAJIADO 035 1 2011-01-01 00:00:00+03 38 KAKAMEGA 038 14 2011-01-01 00:00:00+03 37 KERICHO 037 13 2011-01-01 00:00:00+03 23 KIAMBU 023 9 2011-01-01 00:00:00+03 4 KILIFI 004 2 2011-01-01 00:00:00+03 21 KIRINYAGA 021 10 2011-01-01 00:00:00+03 46 KISII 046 17 2011-01-01 00:00:00+03 43 KISUMU 043 16 2011-01-01 00:00:00+03 3 KWALE 003 2 2011-01-01 00:00:00+03 32 LAIKIPIA 032 12 2011-01-01 00:00:00+03 6 LAMU 006 3 2011-01-01 00:00:00+03 18 MAKUENI 018 8 2011-01-01 00:00:00+03 17 MACHAKOS 017 8 2011-01-01 00:00:00+03 10 MANDERA 010 5 2011-01-01 00:00:00+03 11 MARSABIT 011 6 2011-01-01 00:00:00+03 13 MERU 013 7 2011-01-01 00:00:00+03 45 MIGORI 045 17 2011-01-01 00:00:00+03 2 MOMBASA 002 2 2011-01-01 00:00:00+03 22 MURANG'A 022 10 2011-01-01 00:00:00+03 33 NAKURU 033 12 2011-01-01 00:00:00+03 30 NANDI 030 11 2011-01-01 00:00:00+03 34 NAROK 034 13 2011-01-01 00:00:00+03 47 NYAMIRA 047 17 2011-01-01 00:00:00+03 19 NYANDARUA 019 10 2011-01-01 00:00:00+03 20 NYERI 020 10 2011-01-01 00:00:00+03 26 SAMBURU 026 12 2011-01-01 00:00:00+03 42 SIAYA 042 16 2011-01-01 00:00:00+03 7 TAITA TAVETA 007 2 2011-01-01 00:00:00+03 5 TANA RIVER 005 3 2011-01-01 00:00:00+03 14 THARAKA NITHI 014 7 2011-01-01 00:00:00+03 27 TRANS NZOIA 027 11 2011-01-01 00:00:00+03 24 TURKANA 024 11 2011-01-01 00:00:00+03 28 UASIN GISHU 028 11 2011-01-01 00:00:00+03 39 VIHIGA 039 14 2011-01-01 00:00:00+03 9 WAJIR 009 5 2011-01-01 00:00:00+03 25 WEST POKOT 025 11 2011-01-01 00:00:00+03 16 KITUI 016 8 2011-01-01 00:00:00+03 15 EMBU 015 7 2011-01-01 00:00:00+03 \. -- -- Name: counties_pkey; Type: CONSTRAINT; Schema: public; Owner: iebc; Tablespace: -- ALTER TABLE ONLY counties ADD CONSTRAINT counties_pkey PRIMARY KEY (id); -- -- Name: counties_region_id; Type: INDEX; Schema: public; Owner: iebc; Tablespace: -- CREATE INDEX counties_region_id ON counties USING btree (region_id); -- -- Name: counties_region_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: iebc -- ALTER TABLE ONLY counties ADD CONSTRAINT counties_region_id_fkey FOREIGN KEY (region_id) REFERENCES regions(id) DEFERRABLE INITIALLY DEFERRED; -- -- PostgreSQL database dump complete --
true
10fdf56c76b68d47b52f137f96e1623363306dac
SQL
ds-steven-matison/astra-php-bank
/transactions.cql
UTF-8
346
3.09375
3
[ "Apache-2.0" ]
permissive
CREATE TABLE IF NOT EXISTS bank.transactions ( account_id text, transaction_id text, transaction_date timestamp, amount double, merchant_id text, medium text, tx_status text, description text, category text, PRIMARY KEY ((account_id), transaction_date) ) WITH CLUSTERING ORDER BY (transaction_date DESC);
true
4388903f777d68fdae4a98a7143bcfb5853c1c2b
SQL
PeshrawSarwar/POSjava
/src/pospro/pos.sql
UTF-8
14,263
2.84375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 03, 2020 at 10:00 PM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.2.27 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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: `pos` -- -- -------------------------------------------------------- -- -- Table structure for table `cart` -- CREATE TABLE `cart` ( `cartid` int(11) NOT NULL, `INID` int(11) NOT NULL, `Product_Name` varchar(50) NOT NULL, `Bar_code` varchar(50) NOT NULL, `qty` varchar(20) NOT NULL, `Unit_Price` varchar(20) NOT NULL, `Total_Price` varchar(20) NOT NULL, `qty1` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `cart` -- INSERT INTO `cart` (`cartid`, `INID`, `Product_Name`, `Bar_code`, `qty`, `Unit_Price`, `Total_Price`, `qty1`) VALUES (49, 20, 'cake', '475869321452', '10', '100', '1000.0', '0'), (50, 20, 'Kinder', '10102222', '10', '1000', '10000.0', '0'), (51, 20, 'Pepsi', '789865453212', '10', '500', '10000.0', '0'), (52, 21, 'cake', '475869321452', '5', '100', '500.0', '0'), (53, 21, 'cold drink', '1122556644', '2', '1000', '2000.0', '0'), (54, 21, 'biscuit', '102541256398', '4', '100', '400.0', '0'), (55, 21, 'Kinder', '10102222', '2', '1000', '2000.0', '0'), (56, 21, 'Candy', '0012541263', '2', '500', '1000.0', '0'), (57, 21, 'Pepsi', '789865453212', '5', '500', '2500.0', '0'), (58, 22, 'biscuit', '102541256398', '5', '100', '500.0', '0'), (59, 22, 'cake', '475869321452', '5', '100', '500.0', '5'), (60, 22, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (61, 23, 'cold drink', '1122556644', '2', '1000', '2000.0', '0'), (62, 23, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (63, 23, 'Candy', '0012541263', '3', '500', '1500.0', '0'), (64, 24, 'cake', '475869321452', '2', '100', '200.0', '2'), (65, 24, 'cold drink', '1122556644', '2', '1000', '2000.0', '0'), (66, 24, 'biscuit', '102541256398', '4', '100', '400.0', '0'), (67, 24, 'Kinder', '10102222', '3', '1000', '3000.0', '0'), (68, 24, 'Candy', '0012541263', '5', '500', '2500.0', '0'), (69, 24, 'Pepsi', '789865453212', '2', '500', '1000.0', '0'), (70, 25, 'cold drink', '1122556644', '4', '1000', '4000.0', '0'), (71, 25, 'Candy', '0012541263', '3', '500', '1500.0', '0'), (72, 25, 'Pepsi', '789865453212', '3', '500', '1500.0', '0'), (73, 25, 'Kinder', '10102222', '2', '1000', '2000.0', '0'), (74, 26, 'cold drink', '1122556644', '3', '1000', '3000.0', '0'), (75, 26, 'biscuit', '102541256398', '20', '100', '2000.0', '0'), (76, 26, 'Pepsi', '789865453212', '4', '500', '2000.0', '0'), (77, 27, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (78, 28, 'biscuit', '102541256398', '10', '100', '1000.0', '0'), (79, 28, 'cold drink', '1122556644', '5', '1000', '5000.0', '0'), (80, 28, 'Pepsi', '789865453212', '4', '500', '2000.0', '0'), (81, 28, 'cold drink', '1122556644', '3', '1000', '3000.0', '0'), (82, 29, 'cold drink', '1122556644', '4', '1000', '4000.0', '4'), (83, 29, 'biscuit', '102541256398', '5', '100', '500.0', '5'), (84, 29, 'Kinder', '10102222', '6', '1000', '6000.0', '0'), (85, 29, 'Pepsi', '789865453212', '2', '500', '1000.0', '0'), (86, 29, 'candy', '110022336655', '4', '250', '1000.0', '0'), (87, 30, 'Pepsi', '789865453212', '38', '500', '19000.0', '0'), (88, 31, 'cold drink', '1122556644', '2', '1000', '2000.0', '2'), (89, 31, 'biscuit', '102541256398', '4', '100', '400.0', '4'), (90, 31, 'Kinder', '10102222', '3', '1000', '3000.0', '0'), (91, 32, 'Pepsi', '789865453212', '10', '500', '5000.0', '10'), (92, 33, 'Kinder', '10102222', '10', '1000', '10000.0', '0'), (93, 34, 'Kinder', '10102222', '10', '1000', '10000.0', '0'), (94, 35, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (95, 36, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (96, 36, 'Pepsi', '789865453212', '6', '500', '3000.0', '6'), (97, 37, 'candy', '110022336655', '4', '250', '1000.0', '0'), (98, 37, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (99, 38, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (100, 38, 'candy', '110022336655', '4', '250', '1000.0', '0'), (101, 39, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (102, 39, 'candy', '110022336655', '4', '250', '1000.0', '0'), (103, 40, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (104, 40, 'cold drink', '1122556644', '6', '1000', '6000.0', '6'), (105, 41, 'Kinder', '10102222', '6', '1000', '6000.0', '0'), (106, 41, 'candy', '110022336655', '6', '250', '1500.0', '0'), (107, 42, 'Kinder', '10102222', '5', '1000', '5000.0', '0'), (108, 42, 'Pepsi', '789865453212', '4', '500', '2000.0', '4'), (109, 42, 'Kinder', '10102222', '5', '1000', '5000.0', '0'), (110, 42, 'Pepsi', '789865453212', '10', '500', '5000.0', '10'), (111, 43, 'Pepsi', '789865453212', '4', '500', '2000.0', '4'), (112, 44, 'Kinder', '10102222', '4', '1000', '4000.0', '0'), (113, 44, 'Pepsi', '789865453212', '5', '500', '2500.0', '5'), (114, 44, 'biscuit', '102541256398', '1', '100', '100.0', '1'), (115, 44, 'biscuit', '102541256398', '1', '100', '100.0', '1'), (116, 45, 'cold drink', '1122556644', '5', '1000', '5000.0', '5'), (117, 45, 'candy', '110022336655', '10', '250', '2500.0', '0'), (118, 46, 'Kinder', '10102222', '8', '1000', '8000.0', '8'), (119, 46, 'candy', '110022336655', '10', '250', '2500.0', '0'), (120, 47, 'cold drink', '1122556644', '1', '1000', '1000.0', '1'), (121, 47, 'Kinder', '10102222', '1', '1000', '1000.0', '1'), (122, 47, 'Pepsi', '789865453212', '1', '500', '500.0', '1'), (123, 47, 'candy', '110022336655', '10', '250', '2500.0', '0'), (124, 47, 'cold drink', '1122556644', '2', '1000', '2000.0', '2'); -- -------------------------------------------------------- -- -- Table structure for table `customer` -- CREATE TABLE `customer` ( `cid` int(11) NOT NULL, `customer_name` varchar(50) NOT NULL, `Tp_Number` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `customer` -- INSERT INTO `customer` (`cid`, `customer_name`, `Tp_Number`) VALUES (1, 'test', '123'), (5, 'pesha', '7707707777'), (6, 'ahmad', '11110'), (9, 'hawshad', '5456958'); -- -------------------------------------------------------- -- -- Table structure for table `employee` -- CREATE TABLE `employee` ( `eid` int(11) NOT NULL, `employee_Name` varchar(50) NOT NULL, `Tp_Number` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `employee` -- INSERT INTO `employee` (`eid`, `employee_Name`, `Tp_Number`) VALUES (1, 'hawshad', '7707707777'), (2, 'rayan', '77011111'); -- -------------------------------------------------------- -- -- Table structure for table `extra` -- CREATE TABLE `extra` ( `exid` int(11) NOT NULL, `val` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `extra` -- INSERT INTO `extra` (`exid`, `val`) VALUES (1, '47'); -- -------------------------------------------------------- -- -- Table structure for table `product` -- CREATE TABLE `product` ( `pid` int(11) NOT NULL, `product_Name` varchar(50) NOT NULL, `Bar_code` varchar(20) NOT NULL, `price` varchar(10) NOT NULL, `Qty` int(11) NOT NULL, `sid` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `product` -- INSERT INTO `product` (`pid`, `product_Name`, `Bar_code`, `price`, `Qty`, `sid`) VALUES (3, 'cold drink', '1122556644', '1000', 80, 1), (4, 'biscuit', '102541256398', '100', 39, 1), (5, 'Kinder', '10102222', '1000', 91, 1), (7, 'Pepsi', '789865453212', '500', 30, 1), (8, 'candy', '110022336655', '250', 20, 1); -- -------------------------------------------------------- -- -- Table structure for table `sales` -- CREATE TABLE `sales` ( `saleid` int(11) NOT NULL, `INID` int(11) NOT NULL, `Cid` int(11) NOT NULL, `Customer_Name` varchar(50) NOT NULL, `Total_Qty` varchar(10) NOT NULL, `Total_Bill` varchar(10) NOT NULL, `Status` varchar(10) NOT NULL, `Balance` varchar(10) NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `tot_bill_after_disc` varchar(20) DEFAULT NULL, `disc_amt` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `sales` -- INSERT INTO `sales` (`saleid`, `INID`, `Cid`, `Customer_Name`, `Total_Qty`, `Total_Bill`, `Status`, `Balance`, `created_at`, `tot_bill_after_disc`, `disc_amt`) VALUES (21, 20, 5, 'pesha', '30.0', '21000.0', 'Paid', '0.0', '2020-12-01 15:43:29', NULL, NULL), (22, 21, 6, 'ahmad', '20.0', '8400.0', 'Paid', '600.0', '2020-12-01 15:49:02', NULL, NULL), (23, 22, 5, 'pesha', '14.0', '5000.0', 'UnPaid', '-5000.0', '2020-12-01 16:31:56', NULL, NULL), (24, 23, 5, 'pesha', '9.0', '7500.0', 'Paid', '2500.0', '2020-12-01 18:12:18', NULL, NULL), (25, 24, 5, 'pesha', '18.0', '9100.0', 'Paid', '900.0', '2020-12-01 19:06:08', NULL, NULL), (26, 25, 5, 'pesha', '12.0', '9000.0', 'Paid', '1000.0', '2020-12-02 15:32:54', NULL, NULL), (27, 26, 5, 'pesha', '27.0', '7000.0', 'Paid', '3000.0', '2020-12-02 15:37:44', NULL, NULL), (28, 27, 5, 'pesha', '4.0', '4000.0', 'UnPaid', '-4000.0', '2020-12-02 17:56:37', NULL, NULL), (29, 28, 5, 'pesha', '22.0', '11000.0', 'UnPaid', '-11000.0', '2020-12-02 17:58:24', NULL, NULL), (30, 29, 6, 'ahmad', '21.0', '12500.0', 'UnPaid', '-12500.0', '2020-12-02 18:37:24', NULL, NULL), (31, 30, 5, 'pesha', '38.0', '19000.0', 'Paid', '1000.0', '2020-12-02 18:49:09', NULL, NULL), (32, 31, 5, 'pesha', '9.0', '5400.0', 'UnPaid', '-5400.0', '2020-12-02 19:21:08', NULL, NULL), (33, 32, 5, 'test', '10.0', '5000.0', 'Paid', '0.0', '2020-12-02 19:22:04', NULL, NULL), (34, 33, 5, 'pesha', '10.0', '10000.0', 'Paid', '1000.0', '2020-12-02 22:59:19', NULL, NULL), (35, 34, 5, 'pesha', '10.0', '9000.0', 'Paid', '1000.0', '2020-12-02 23:03:35', NULL, NULL), (36, 35, 5, 'pesha', '4.0', '3600.0', 'Paid', '400.0', '2020-12-03 11:03:48', NULL, NULL), (37, 36, 5, 'pesha', '10.0', '6300.0', 'Partial', '200.0', '2020-12-03 11:39:40', NULL, NULL), (38, 37, 5, 'pesha', '8.0', '5000.0', 'Partial', '0.0', '2020-12-03 12:06:49', NULL, NULL), (39, 38, 5, 'pesha', '8.0', '5000.0', 'Partial', '0.0', '2020-12-03 12:10:36', '4500.0', NULL), (40, 39, 5, 'pesha', '8.0', '5000.0', 'Paid', '0.0', '2020-12-03 12:14:22', '4500.0', NULL), (41, 40, 5, 'pesha', '10.0', '10000.0', 'Paid', '1000.0', '2020-12-03 12:23:21', '9000.0', NULL), (42, 41, 5, 'pesha', '12.0', '7500.0', 'Paid', '2500.0', '2020-12-03 12:25:32', '00.00', NULL), (43, 42, 5, 'pesha', '9.0', '7000.0', 'Paid', '3000.0', '2020-12-03 19:47:34', '7000.0', NULL), (45, 43, 5, 'pesha', '4.0', '2000.0', 'Paid', '0.0', '2020-12-03 19:50:49', '2000.0', NULL), (46, 44, 5, 'pesha', '11.0', '6700.0', 'Paid', '0.0', '2020-12-03 19:55:40', '6030.0', NULL), (47, 45, 5, 'pesha', '15.0', '7500.0', 'Paid', '0.0', '2020-12-03 20:00:29', '6750.0', '0.10'), (48, 46, 6, 'ahmad', '18.0', '10500.0', 'Paid', '1600.0', '2020-12-03 20:22:24', '8400.0', '0.20'), (49, 47, 9, 'hawshad', '15.0', '7000.0', 'Paid', '700.0', '2020-12-03 20:31:17', '6300.0', '0.10'); -- -------------------------------------------------------- -- -- Table structure for table `supplier` -- CREATE TABLE `supplier` ( `sid` int(11) NOT NULL, `supplier_Name` varchar(50) NOT NULL, `Tp_Number` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `supplier` -- INSERT INTO `supplier` (`sid`, `supplier_Name`, `Tp_Number`) VALUES (1, 'cola', '101010'), (3, 'pepsi', '4456332211'), (4, 'ozmo', '5854815181'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `ID` int(11) NOT NULL, `Name` varchar(20) NOT NULL, `Password` varchar(20) NOT NULL, `Roll` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `users` -- INSERT INTO `users` (`ID`, `Name`, `Password`, `Roll`) VALUES (1, 'pesha', 'aabbcc112233', 'admin'); -- -- Indexes for dumped tables -- -- -- Indexes for table `cart` -- ALTER TABLE `cart` ADD PRIMARY KEY (`cartid`); -- -- Indexes for table `customer` -- ALTER TABLE `customer` ADD PRIMARY KEY (`cid`); -- -- Indexes for table `employee` -- ALTER TABLE `employee` ADD PRIMARY KEY (`eid`); -- -- Indexes for table `extra` -- ALTER TABLE `extra` ADD PRIMARY KEY (`exid`); -- -- Indexes for table `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`pid`); -- -- Indexes for table `sales` -- ALTER TABLE `sales` ADD PRIMARY KEY (`saleid`); -- -- Indexes for table `supplier` -- ALTER TABLE `supplier` ADD PRIMARY KEY (`sid`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`ID`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `cart` -- ALTER TABLE `cart` MODIFY `cartid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=125; -- -- AUTO_INCREMENT for table `customer` -- ALTER TABLE `customer` MODIFY `cid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `employee` -- ALTER TABLE `employee` MODIFY `eid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `extra` -- ALTER TABLE `extra` MODIFY `exid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `product` -- ALTER TABLE `product` MODIFY `pid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `sales` -- ALTER TABLE `sales` MODIFY `saleid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50; -- -- AUTO_INCREMENT for table `supplier` -- ALTER TABLE `supplier` MODIFY `sid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; 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 */;
true
7bdf5f2cea018949c89755905e83665935d8892d
SQL
MTheSestrim/MSSQL-January-2021
/05.SubqueriesAndJoins/SubqueriesAndJoins/ContinentsAndCurrencies/SQLQuery1.sql
UTF-8
829
4.09375
4
[]
no_license
WITH Currencies_CTE(ContinentCode, CurrencyCode, CurrencyUsage, Ranked) AS ( SELECT ContinentCode, CurrencyCode, COUNT(CurrencyCode) AS CurrencyUsage, DENSE_RANK() OVER (PARTITION BY ContinentCode ORDER BY COUNT(CurrencyCode) DESC) AS Ranked FROM Countries GROUP BY ContinentCode, CurrencyCode ) SELECT ContinentCode, CurrencyCode, CurrencyUsage FROM Currencies_CTE WHERE Ranked = 1 AND CurrencyUsage > 1 ORDER BY ContinentCode; --SELECT ContinentCode, CurrencyCode, CurrencyUsage FROM --( SELECT ContinentCode, CurrencyCode, COUNT(CurrencyCode) AS CurrencyUsage, -- DENSE_RANK() OVER (PARTITION BY ContinentCode ORDER BY COUNT(CurrencyCode) DESC) AS Ranked -- FROM Countries -- GROUP BY ContinentCode, CurrencyCode -- ) AS c -- WHERE Ranked = 1 AND CurrencyUsage > 1 -- ORDER BY ContinentCode; -- -- Both solutions work.
true
92a76222150424ea29348fbf037c30cdd2778e24
SQL
adriangotca98/PSGBD_Project
/sql/get_matches.sql
UTF-8
515
2.96875
3
[]
no_license
create or replace function get_matches(stage int) return number is type vector is varray (60000) of int; type strvector is varray (60000) of varchar(50); teams vector := vector(); names strvector := strvector(); begin select id_team bulk collect into teams from play where (stage-1)*1024+1<=ID_play and ID_play<=stage*1024; for i in 1..teams.COUNT loop select name bulk collect into names from team where id_team = teams(i); DBMS_OUTPUT.put_line(names(1)); end loop; return teams.count; end;
true
2a8189c391ced6e83d466a4936f897ca9c104287
SQL
nelsonjr86/Sankhya
/RELATORIOS/RELA LANCAMENTOS DE PEDIDOS.sql
ISO-8859-1
1,571
3.71875
4
[]
no_license
SELECT /*LANAMENTOS PEDIDOS*/ DISTINCT EMP.CODEMP, EMP.NOMEFANTASIA, COUNT(ITE.CODPROD) AS 'ITENS', (SELECT DISTINCT COUNT (C.NUNOTA) FROM TGFCAB C INNER JOIN TSIUSU U ON (U.CODUSU=SANKHYA.STP_GET_CODUSULOGADO()) INNER JOIN TSIEMP E ON (E.CODEMP=C.CODEMP) WHERE C.CODUSU = :CODUSU AND C.DTMOV BETWEEN :PERIODO.INI AND :PERIODO.FIN AND C.TIPMOV = 'O' AND C.CODTIPOPER NOT IN (100) AND C.STATUSNOTA = CAB.STATUSNOTA AND (C.CODEMP = CAB.CODEMP) AND (CAB.CODEMP IS NULL OR CAB.CODEMP IN :CODEMP) ) AS 'PEDIDO', SUM(ITE.VLRTOT) AS 'VALOR', (SELECT DISTINCT SUM (I.QTDNEG) FROM TGFCAB C INNER JOIN TGFITE I ON (C.NUNOTA = I.NUNOTA) INNER JOIN TSIUSU U ON (U.CODUSU=SANKHYA.STP_GET_CODUSULOGADO()) INNER JOIN TSIEMP E ON (E.CODEMP=C.CODEMP) WHERE C.CODUSU = :CODUSU AND C.DTMOV BETWEEN :PERIODO.INI AND :PERIODO.FIN AND C.TIPMOV = 'O' AND C.CODTIPOPER NOT IN (100) AND C.STATUSNOTA = CAB.STATUSNOTA AND (C.CODEMP = CAB.CODEMP) AND (CAB.CODEMP IS NULL OR CAB.CODEMP IN :CODEMP) ) AS 'QUANTIDADE', SUM(ITE.VLRTOT) AS 'VALOR', CASE WHEN CAB.STATUSNOTA = 'L' THEN 'LIBERADO' ELSE 'NO LIBERADO' END AS 'STATUS' FROM TGFCAB CAB INNER JOIN TGFITE ITE ON (CAB.NUNOTA=ITE.NUNOTA) INNER JOIN TSIUSU USU ON (USU.CODUSU=SANKHYA.STP_GET_CODUSULOGADO()) INNER JOIN TSIEMP EMP ON (EMP.CODEMP=CAB.CODEMP) WHERE CAB.CODUSU = :CODUSU AND CAB.DTMOV BETWEEN :PERIODO.INI AND :PERIODO.FIN AND CAB.TIPMOV = 'O' AND CAB.CODTIPOPER NOT IN (100) AND (CAB.CODEMP IS NULL OR CAB.CODEMP IN :CODEMP) GROUP BY EMP.CODEMP,EMP.NOMEFANTASIA,CAB.STATUSNOTA, CAB.CODEMP,CAB.STATUSNOTA
true
d9fd79577ec43a02f7925935dde8af7142cc0a5f
SQL
Rudii/project4
/data.sql
UTF-8
1,029
3
3
[]
no_license
DROP TABLE IF EXISTS User; CREATE TABLE User ( user_id INT UNSIGNED NOT NULL PRIMARY KEY, firstname VARCHAR(32) DEFAULT NULL, lastname VARCHAR(32) DEFAULT NULL, password VARCHAR(100) DEFAULT NULL, username VARCHAR (20) DEFAULT NULL ); DROP TABLE IF EXISTS Message; CREATE TABLE Message ( id INT UNSIGNED NOT NULL PRIMARY KEY, body VARCHAR(1000) DEFAULT NULL, subject VARCHAR(50) DEFAULT NULL, user_id VARCHAR(32) DEFAULT NULL, recipient_id VARCHAR(32) DEFAULT NULL ); DROP TABLE IF EXISTS Message_read; CREATE TABLE Message_read ( id INT UNSIGNED NOT NULL PRIMARY KEY, message_id VARCHAR(32) DEFAULT NULL, reader_id VARCHAR DEFAULT NULL, date VARCHAR(20) DEFAULT NULL ); INSERT INTO User (firstname, lastname, password, username) VALUES ("Trudy-Ann", "Barrett", "fingers", "Rudii"); INSERT INTO User (firstname, lastname, password, username) VALUES ("Davian", "Litchmore", "davey1", "Dave"); INSERT INTO User (firstname, lastname, password, username) VALUES ("Dekel", "Hamilton", "KelHam123", "Dekz");
true
863d6bb9a19a5867d79fc6171184209a73739dfc
SQL
Mkhdv/Databases
/SQL PL HW/schema.sql
UTF-8
543
3.203125
3
[]
no_license
-- SCHEMA create table Parts ( pid number(38) primary key, pname varchar(38), year number(6), price number(12) ); create table Suppliers ( sid number(38) primary key, sname varchar(20), state varchar(20), zipcode varchar(20) ); create table Orders ( pid number(38), sid number(38), quantity number(38), primary key (pid, sid), foreign key (pid) references Parts, foreign key (sid) references Suppliers );
true
5071610d5d6413295ba69b47ce52a5fce2175890
SQL
jshurak/sql-scripts
/Diagnostics/All Database Fragmentation.sql
UTF-8
1,136
4.09375
4
[]
no_license
-- Get fragmentation info for all indexes above a certain size in the current database (Query 48) (Index Fragmentation) -- Note: This could take some time on a very large database -- Helps determine whether you have framentation in your relational indexes -- and how effective your index maintenance strategy is CREATE table #tmp ( [Database Name] sysname ,[object Name] sysname ,[index name] sysname null ,[index_id] int ,[index type desc] nvarchar(60) ,avg_fragmentation_in_percent float ,fragment_count bigint ,page_count bigint ) insert into #tmp exec sp_msforeachdb N' use [?] SELECT DB_NAME(database_id) AS [Database Name], OBJECT_NAME(ps.OBJECT_ID) AS [Object Name], i.name AS [Index Name], ps.index_id, index_type_desc, avg_fragmentation_in_percent, fragment_count, page_count FROM sys.dm_db_index_physical_stats(DB_ID(),NULL, NULL, NULL ,N''LIMITED'') AS ps INNER JOIN sys.indexes AS i WITH (NOLOCK) ON ps.[object_id] = i.[object_id] AND ps.index_id = i.index_id WHERE database_id = DB_ID() AND page_count > 1500 ORDER BY avg_fragmentation_in_percent DESC OPTION (RECOMPILE);' select * from #tmp drop table #tmp
true
c1c82c089b9f7a66b635068e0b28f0a15ee00bdf
SQL
maquiavelo79/bodyflex
/dataBase/[DEP-SP]/x_SP_ELIMINA_CURRICULUM.sql
UTF-8
567
2.703125
3
[]
no_license
-- select * from estudios DROP PROCEDURE IF EXISTS bodyflex.SP_ELIMINA_CURRICULUM; CREATE PROCEDURE bodyflex.`SP_ELIMINA_CURRICULUM`( IN id VARCHAR(20), IN rut VARCHAR(20) ) BEGIN DELETE FROM ESTUDIOS WHERE CURID=id; DELETE FROM EXPERIENCIA WHERE CURID=id; DELETE FROM OTRO WHERE CURID=id; DELETE FROM CURRICULUM WHERE PRUT=rut AND CURID=id; SELECT 1; END;
true
cc349dce635b03e8670648319e7d3ab18b7072d8
SQL
Pawstel/Gallery
/database/mysql/schema.sql
UTF-8
1,144
3.828125
4
[]
no_license
DROP DATABASE IF EXISTS hero; CREATE DATABASE hero; USE hero; CREATE TABLE users ( id INT NOT NULL AUTO_INCREMENT, user_name VARCHAR(30) NOT NULL, PRIMARY KEY(id) ); CREATE TABLE lists ( id INT NOT NULL AUTO_INCREMENT, list_name VARCHAR(50) , list_user_id INT NOT NULL, PRIMARY KEY(id), FOREIGN KEY(list_user_id) REFERENCES users(id) ); CREATE TABLE listings ( id INT NOT NULL AUTO_INCREMENT, listing_name TEXT, listing_review_average INT, listing_review_total INT, listing_host_name VARCHAR(50), listing_address TEXT, listing_host_photo_url VARCHAR(255), listing_description TEXT, listing_space_description TEXT, listing_neighborhood_description TEXT, PRIMARY KEY(id) ); CREATE TABLE listings_lists ( listing_id INT NOT NULL, list_id INT NOT NULL, FOREIGN KEY (listing_id) REFERENCES listings(id), FOREIGN KEY (list_id) REFERENCES lists(id) ); CREATE TABLE listing_photos ( id INT NOT NULL AUTO_INCREMENT, photo_description VARCHAR(255), photo_url VARCHAR(200) NOT NULL, photo_listing_id INT NOT NULL, PRIMARY KEY(id), FOREIGN KEY(photo_listing_id) REFERENCES listings(id) );
true
615e7cbb5cb0e5481115b3168f4c1ed2b35f017e
SQL
kongyew/gpdb
/src/test/tinc/tincrepo/mpp/gpdb/tests/storage/vacuum/reindex/concurrency/sql/vacuum_while_reindex_heap_btree_setup.sql
UTF-8
325
2.59375
3
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "PostgreSQL", "LicenseRef-scancode-other-copyleft", "metamail", "BSD-3-Clause", "LicenseRef-scancode-openssl", "LicenseRef-scancode-other-permissive", "ISC", "Python-2.0", "bzip2-1.0.6", "LicenseRef-scancode-ssleay-windows", "LicenseRef-scanco...
permissive
-- start_ignore SET gp_create_table_random_default_distribution=off; -- end_ignore DROP TABLE IF EXISTS reindex_heap; CREATE TABLE reindex_heap (a INT); insert into reindex_heap select generate_series(1,1000); insert into reindex_heap select generate_series(1,1000); create index idx_btree_reindex_heap on reindex_heap(a);
true
0004594eeee9edd707dd620a75e17cb217bbf06c
SQL
ajnatzic/cs
/CIS353/DatabasesHW5/ddl.sql
UTF-8
2,331
4.0625
4
[]
no_license
SPOOL ddl.out SET ECHO ON /* Homework on SQL/DDL Author: <<<ALFRED NATZIC>>> */ -- -- IMPORTANT: use the names IC1, IC2, etc. as given below. -- -------------------------------------------------------------------- DROP TABLE Employee CASCADE CONSTRAINTS; DROP TABLE Dependent CASCADE CONSTRAINTS; -- CREATE TABLE Employee ( id INTEGER PRIMARY KEY, name CHAR(10) NOT NULL, rank CHAR(10) NOT NULL, salary INTEGER NOT NULL, /* IC1: The rank is one of: 'DB guru', 'DB expert', or 'DB rookie' */ CONSTRAINT IC1 CHECK (rank IN('DB guru', 'DB expert', 'DB rookie')), /* IC2: The salary of a 'DB guru' is above 200. */ CONSTRAINT IC2 CHECK (NOT(rank = 'DB guru' AND salary <= 200)), /* IC3: The salary of a 'DB expert' is between 80 and 220 (inclusive). */ CONSTRAINT IC3 CHECK (NOT(rank = 'DB expert' AND (salary > 220 OR salary < 80))), /* IC4: The salary of a 'DB rookie' is less than 100. */ CONSTRAINT IC4 CHECK (NOT(rank = 'DB rookie' AND salary >= 100)) ); -- -- CREATE TABLE Dependent ( empID INTEGER, dependentName CHAR(20) NOT NULL, relationship CHAR(20) NOT NULL, PRIMARY KEY (empID, dependentName), /* IC5: empID must refer to an employee in the company. Also: if an employee is deleted then his/her dependents must be deleted. IMPORTANT: DO NOT declare this IC as DEFERRABLE. */ CONSTRAINT IC5 FOREIGN KEY (empID) REFERENCES Employee(id) ON DELETE CASCADE ); -- -- ---------------------------------------------------------------- -- TESTING THE SCHEMA -- ---------------------------------------------------------------- INSERT INTO Employee VALUES (10, 'Gray', 'DB guru', 240); INSERT INTO Employee VALUES (20, 'Garland', 'DB guru', 190); INSERT INTO Employee VALUES (30, 'Edison', 'DB expert', 210); INSERT INTO Employee VALUES (40, 'Eckerd', 'DB expert', 70); INSERT INTO Employee VALUES (50, 'Roberts', 'DB rookie', 110); INSERT INTO Employee VALUES (60, 'Rush', 'DB rookie', 90); SELECT * from Employee; -- ---------------------------------------------------------------- INSERT INTO Dependent VALUES (10, 'Grace', 'daughter'); INSERT INTO Dependent VALUES (10, 'George', 'son'); INSERT INTO Dependent VALUES (60, 'Reba', 'daughter'); INSERT INTO Dependent VALUES (15, 'Dustin', 'son'); SELECT * FROM Dependent; -- DELETE FROM Employee WHERE id = 10; SELECT * From Employee; SELECT * FROM Dependent; -- SET ECHO OFF SPOOL OFF
true
195eb6c946ac56f3769d1bbd665034dd973033f0
SQL
Tilak612/IIAS
/New_folder/stock_information.sql
UTF-8
1,714
2.8125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.9.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Mar 10, 2020 at 05:57 PM -- Server version: 10.4.8-MariaDB -- PHP Version: 7.1.32 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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: `froze` -- -- -------------------------------------------------------- -- -- Table structure for table `stock_information` -- CREATE TABLE `stock_information` ( `date` date NOT NULL, `item_code` varchar(50) NOT NULL, `item_name` varchar(50) NOT NULL, `quality` int(11) NOT NULL, `dymanic_quality` int(11) NOT NULL, `Amount` int(11) NOT NULL, `price` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `stock_information` -- INSERT INTO `stock_information` (`date`, `item_code`, `item_name`, `quality`, `dymanic_quality`, `Amount`, `price`) VALUES ('2020-03-09', 'I01', 'Chocolate ice cream', 15, 0, 90, 6), ('2020-03-09', 'I01', 'Chocolate ice cream', 15, 0, 90, 6), ('2020-03-09', 'I01', 'Chocolate ice cream', 15, 0, 90, 6), ('2020-03-09', 'I01', 'Chocolate ice cream', 15, 0, 90, 6), ('2020-03-10', 'I01', 'Chocolate ice cream', 15, 0, 60, 4), ('2020-03-10', 'I02', 'Vanilla ice cream', 20, 7, 100, 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 */;
true
2a14df5819a1b1294a0d5c1c3a0eca9a0089f480
SQL
Nackeey/Database-basics-and-EF
/Database - basics/Exam preparation 24-04-2017/06. Job Status.sql
UTF-8
100
2.890625
3
[]
no_license
SELECT j.Status, j.IssueDate FROM Jobs AS j WHERE Status <> 'Finished' ORDER BY IssueDate, JobId
true
56a5e1ef043f7d54a4316c8270b213aca9617fef
SQL
joaocarias/HiringDev
/Joao.HiringDev/sql/create_mysql.sql
UTF-8
980
2.84375
3
[]
no_license
create database db_hiring_dev; use db_hiring_dev; create table VideosYoutube ( Id varchar(255), Title varchar(1000), Description varchar(2000), ChannelId varchar(255), ChannelTitle varchar(1000), PublishedAtRaw varchar(25), LiveBroadcastContent varchar(255), ETag varchar(1000), ThumbnailUrlVideoImage varchar(1000) ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; create table CanaisYoutube ( Id varchar(255), Title varchar(1000), Description varchar(2000), ChannelId varchar(255), ChannelTitle varchar(1000), PublishedAtRaw varchar(25), LiveBroadcastContent varchar(255), ETag varchar(1000), ThumbnailUrlVideoImage varchar(1000) ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ; -- drop table CanaisYoutube; -- drop table VideosYoutube; select * from CanaisYoutube; select * from VideosYoutube; select * from CanaisYoutube where Id = 'UCvkYQZ80HOAV8hvngztdMOg'; delete from CanaisYoutube where Id is not null;
true
158e503cfd6345cd2f3e4d8b3d459080f20f44c9
SQL
jesus143/thesis_hotel_reservation
/smc_hotel_online_reservation.sql
UTF-8
7,716
3.0625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 3.5.2.2 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jan 07, 2014 at 01:54 PM -- Server version: 5.5.27 -- PHP Version: 5.4.7 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 utf8 */; -- -- Database: `smc_hotel_online_reservation` -- -- -------------------------------------------------------- -- -- Table structure for table `amenities` -- CREATE TABLE IF NOT EXISTS `amenities` ( `Amenities_id` int(11) NOT NULL AUTO_INCREMENT, `Room_id` int(11) NOT NULL, `Amenities_name` varchar(30) NOT NULL, `Amenities_description` varchar(150) NOT NULL, PRIMARY KEY (`Amenities_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `guest` -- CREATE TABLE IF NOT EXISTS `guest` ( `Guest_id` int(11) NOT NULL AUTO_INCREMENT, `Guest_email` varchar(30) NOT NULL, `Guest_name` varchar(30) NOT NULL, `Guest_address` varchar(30) NOT NULL, `Guest_contact_number` int(11) NOT NULL, `Company_Group` varchar(30) NOT NULL, `Guest_joindate` datetime NOT NULL, PRIMARY KEY (`Guest_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `guest` -- INSERT INTO `guest` (`Guest_id`, `Guest_email`, `Guest_name`, `Guest_address`, `Guest_contact_number`, `Company_Group`, `Guest_joindate`) VALUES (1, 'mrjesuserwinsuarez@gmai.com', 'Jesus Erwin Suarez', 'Buru un Iligan City', 2147483647, 'no', '0000-00-00 00:00:00'); -- -------------------------------------------------------- -- -- Table structure for table `reservation` -- CREATE TABLE IF NOT EXISTS `reservation` ( `Reservation_id` int(11) NOT NULL AUTO_INCREMENT, `Guest_id` int(11) NOT NULL, `Reservation_date` datetime NOT NULL, PRIMARY KEY (`Reservation_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `reservation` -- INSERT INTO `reservation` (`Reservation_id`, `Guest_id`, `Reservation_date`) VALUES (1, 1, '2013-12-03 11:13:00'); -- -------------------------------------------------------- -- -- Table structure for table `reservation_line` -- CREATE TABLE IF NOT EXISTS `reservation_line` ( `Reservation_line_id` int(11) NOT NULL AUTO_INCREMENT, `Reservation_id` int(11) NOT NULL, `Room_id` int(11) NOT NULL, `ETA` time NOT NULL, `Check_in_date` date NOT NULL, `Check_out_date` date NOT NULL, PRIMARY KEY (`Reservation_line_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; -- -- Dumping data for table `reservation_line` -- INSERT INTO `reservation_line` (`Reservation_line_id`, `Reservation_id`, `Room_id`, `ETA`, `Check_in_date`, `Check_out_date`) VALUES (1, 1, 1, '09:20:00', '2014-01-11', '2014-01-11'), (4, 1, 2, '09:20:00', '2014-01-15', '2014-01-16'), (5, 1, 3, '09:20:00', '2014-01-24', '2014-01-25'), (6, 1, 4, '09:20:00', '2014-01-26', '2014-01-28'), (7, 1, 5, '09:20:00', '2014-01-26', '2014-01-28'); -- -------------------------------------------------------- -- -- Table structure for table `room` -- CREATE TABLE IF NOT EXISTS `room` ( `Room_id` int(11) NOT NULL AUTO_INCREMENT, `Room_number` int(11) NOT NULL, `room_desc` text NOT NULL, `Room_type` varchar(20) NOT NULL, PRIMARY KEY (`Room_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; -- -- Dumping data for table `room` -- INSERT INTO `room` (`Room_id`, `Room_number`, `room_desc`, `Room_type`) VALUES (1, 101, '1077 sqft, master bedroom, living & powder room. WiFi access, buffet breakfast, ipod docking station, access to Lounge with its benefits, Plasma TV, DVD player, electronic safe. Read More ', 'Presidential'), (2, 102, '432 sq ft, the room gives a holistic view of the city with an I-Pod docking station, this is a space that you cannot resist, WiFi access, buffet breakfast, access to LaLiT Luxury Lounge & lounge benefits, Plasma TV with DVD player, tea-coffee maker, electronic safe, mini-bar, writing desk with lamp, seasonal fruits & alarm clock. Read More ', 'Standard/Dormitory'), (3, 103, 'With a bouquet of 461 hotels accommodation spread over 18 residential guest floors, The LaLiT New Delhi welcomes all its guests to it limitless hospitality. Our vision at The LaLiT Delhi hotels, which is one of the best amongst 5 stars hotels in Delhi, is to provide world class services to all our guests and to put ourselves as the executive hotel choice amongst the business traveler. Contemporary and uber-stylish, all hotel accommodations at The LaLiT Luxury hotels, offer comfort and luxury for a discerning business executive on the move or a family on a vacation.\n', 'Sweet Room'), (4, 104, 'Spread across six different category of rooms at hotel, including four categories of suites, guests have an option of choosing the mode of Delhi accommodation, from fully furnished suites to the rooms catering to the need of all types of traveler. Suites are generously spaced & have bed room along with a living room. These Room Types are a perfect blend of Luxury & comfort with a touch of ultra modern fixtures & facilities. Having been recently modified, the hotel suites are fitted with all the contemporary amenities while the hotel rooms are luxuriously accommodated with the needs of a business traveler on move – all aimed to make hotel stay more comfortable.', 'Delux 1'), (5, 105, 'Guests have an option of choosing from a range of luxury accommodations option, from king size bed to twin beds and from smoking room to non-smoking room. Guests can also connect to the world outside with the power of wireless internet access at all our guest’s hotel accomodation while guests opting for hotel accommodation at LaLiT Luxury room onwards can enjoy the lounge benefits where they can connect with team or even friends, grab your favorite drink as you watch your favorite TV channel. At all our accommodations at hotels we provide our guests with a unique blend of Indian hospitality, modern comfort and sumptuous meals', 'Delux 2'), (6, 106, 'With an elegant business like décor, this standard deluxe 432 sqft room is the most spacious in the city, option of a king size or a twin bed, WiFi access, complementary tea and coffee maker, mineral water, magazines, newspaper, plasma television with DVD player, large wardrobe, electronic safe, mini bar and writing desk with lamp. Read More ', 'Function Hall'), (7, 107, 'With an elegant business like décor, the LaLiT view room is a pool facing 432 sqft room and comes with an option of king or a twin size bed, WiFi access and breakfast. LaLiT View Room offers panoramic view of the famous landmarks in the city along with modern facilities such as complementary tea and coffee maker, newspaper, plasma television with DVD player, electronic safe, mini bar and writing desk with lamp. Read More ', 'Conference Hall'), (8, 110, '432 sq ft, the room at the higher floors of the hotel gives a holistic view of the city with an I-Pod docking station, this is a space that you cannot resist, WiFi access, buffet breakfast, exclusive access to LaLiT Luxury Lounge & lounge benefits, Plasma TV with DVD player, tea-coffee maker, electronic safe, mini-bar, writing desk with lamp, seasonal fruits & alarm clock. Read More Take a Virtual Tour of the Club Lounge', 'Lafarge'); /*!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 */;
true
cdc2c71a7e2ec2e0297659f7b750ed286158a2e8
SQL
Ltre/FleaMarket
/fkb/core/setting/sql/rzstatus/updateSellNone.sql
UTF-8
275
3.1875
3
[]
no_license
-- 查询处于剩余交易期内、且没有任何预约的转让记录,并将其状态改为3(无人预约已超时) update fm_sell set status = 3 where booklimit <= :rightnow and endlimit > :rightnow and id not in ( select recordz from fm_book where booktype='Z' )
true
c4cf07e214a60e058d3a71a2fb7725fdf1cec18a
SQL
ITsolution-git/Ecommerce-solution-php
/changes.sql
UTF-8
645
2.609375
3
[]
no_license
CREATE TABLE `gsr_system`.`products_amazon` ( `product_amazon_id` INT NOT NULL AUTO_INCREMENT, `product_id` INT UNSIGNED NOT NULL, PRIMARY KEY (`product_amazon_id`)); ALTER TABLE `gsr_system`.`website_carts` ADD COLUMN `website_amazon_shipping_method_id` INT(11) NULL DEFAULT NULL AFTER `website_ashley_express_shipping_method_id`; ALTER TABLE `gsr_system`.`product_import` ADD COLUMN `amazon_eligible` VARCHAR(2) NULL DEFAULT NULL AFTER `type`; -- ------------------------------------------------------------------------------ ALTER TABLE `gsr_system`.`website_pages` ADD COLUMN `landing_page` TINYINT(1) NULL AFTER `header_script`;
true
df6b83c6f400d740bf2db268f5054c42b7ddc3c6
SQL
linkedinyou/gridsearch
/db-schema/schema.sql
UTF-8
8,890
2.96875
3
[]
no_license
-- MySQL dump 10.13 Distrib 5.1.49, for debian-linux-gnu (i486) -- -- Host: localhost Database: gridspider -- ------------------------------------------------------ -- Server version 5.1.49-1~bpo50+1 /*!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 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!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 */; -- -- Table structure for table `Agent` -- DROP TABLE IF EXISTS `Agent`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Agent` ( `AgentID` char(16) NOT NULL, `Grid` mediumint(2) NOT NULL, `Name` text, `LastScrape` datetime NOT NULL DEFAULT '1970-01-01 12:00:00', `About` text, `FirstLife` text, `LockID` int(11) DEFAULT NULL, PRIMARY KEY (`Grid`,`AgentID`) ) ENGINE=MyISAM AUTO_INCREMENT=406 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `Grid` -- DROP TABLE IF EXISTS `Grid`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Grid` ( `PKey` int(11) NOT NULL AUTO_INCREMENT, `name` text, `LoginURI` text, `Description` text, `new` tinyint(1) DEFAULT '1', PRIMARY KEY (`PKey`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `Logins` -- DROP TABLE IF EXISTS `Logins`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Logins` ( `PKey` int(11) NOT NULL AUTO_INCREMENT, `grid` int(11) DEFAULT NULL, `First` text, `Last` text, `Password` text, `LockID` int(11) DEFAULT NULL, `LastScrape` datetime DEFAULT NULL, `PID` int(11) DEFAULT NULL, PRIMARY KEY (`PKey`) ) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `Object` -- DROP TABLE IF EXISTS `Object`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Object` ( `Region` bigint(32) NOT NULL, `Grid` int(11) NOT NULL, `Creator` char(16) DEFAULT NULL, `Owner` char(16) DEFAULT NULL, `Name` text, `Description` text, `Flags` bit(8) DEFAULT NULL, `SalePrice` mediumint(11) DEFAULT NULL, `Prims` smallint(11) DEFAULT NULL, `Location` int(11) DEFAULT NULL, `LastScrape` datetime DEFAULT NULL, `LocalID` int(11) NOT NULL DEFAULT '0', `ID` char(16) DEFAULT NULL, `SaleType` tinyint(4) DEFAULT NULL COMMENT 'Not = 0 Original = 1 Copy = 2, Contents = 3', `ParcelID` tinyint(4) DEFAULT NULL, `Perms` int(11) NOT NULL DEFAULT '0' COMMENT 'Next Owner Permissions Mask { Transfer = 1 << 13, Modify = 1 << 14, Copy = 1 << 15, Move = 1 << 19, Damage = 1 << 20 }', `uniquekey` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Region`,`LocalID`), UNIQUE KEY `uniquekey` (`uniquekey`), FULLTEXT KEY `gText` (`Name`,`Description`) ) ENGINE=MyISAM AUTO_INCREMENT=1094303 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Temporary table structure for view `ObjectView` -- DROP TABLE IF EXISTS `ObjectView`; /*!50001 DROP VIEW IF EXISTS `ObjectView`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE TABLE `ObjectView` ( `CreatorName` text, `OwnerName` text, `GridName` text, `RegionName` text, `GridLoginURI` text, `Creator` char(16), `Owner` char(16), `ObjectName` text, `SalePrice` mediumint(11), `SaleType` tinyint(4), `Perms` int(11), `ObjectID` char(16), `OLocalID` int(11), `Description` text, `Location` int(11) ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- -- Table structure for table `Parcel` -- DROP TABLE IF EXISTS `Parcel`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Parcel` ( `PKey` int(11) NOT NULL AUTO_INCREMENT, `Region` bigint(21) NOT NULL, `Grid` int(11) NOT NULL, `Description` text, `Size` smallint(11) DEFAULT NULL, `Dwell` smallint(11) DEFAULT NULL, `Owner` char(16) DEFAULT NULL, `ParcelFlags` int(11) DEFAULT NULL, `Rating` bit(8) DEFAULT NULL, `LastScrape` datetime DEFAULT NULL, `Name` text, `GroupID` char(16) DEFAULT NULL, `ParcelID` tinyint(4) NOT NULL DEFAULT '0', `SalePrice` int(11) DEFAULT '-1', PRIMARY KEY (`PKey`,`Region`,`Grid`,`ParcelID`), FULLTEXT KEY `Name` (`Name`,`Description`) ) ENGINE=MyISAM AUTO_INCREMENT=295922 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `Region` -- DROP TABLE IF EXISTS `Region`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Region` ( `Grid` int(11) NOT NULL, `Handle` bigint(21) NOT NULL, `LastScrape` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `ID` char(16) DEFAULT NULL, `Owner` char(16) DEFAULT NULL, `Name` text, `Status` tinyint(4) NOT NULL DEFAULT '0', `LockID` int(11) NOT NULL DEFAULT '0', `pkey` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`Grid`,`Handle`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `SearchQueue` -- DROP TABLE IF EXISTS `SearchQueue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `SearchQueue` ( `PKey` int(11) NOT NULL AUTO_INCREMENT, `Priority` int(11) DEFAULT NULL, `Grid` int(11) DEFAULT NULL, `QueuedAT` datetime DEFAULT NULL, `QueuedBY` int(11) DEFAULT NULL, PRIMARY KEY (`PKey`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `Users` -- DROP TABLE IF EXISTS `Users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Users` ( `PKey` int(11) NOT NULL AUTO_INCREMENT, `Username` text, `Password` text, `Email` text, `Verified` tinyint(4) DEFAULT NULL, `AccountCreated` datetime DEFAULT NULL, PRIMARY KEY (`PKey`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Final view structure for view `ObjectView` -- /*!50001 DROP TABLE IF EXISTS `ObjectView`*/; /*!50001 DROP VIEW IF EXISTS `ObjectView`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET character_set_client = utf8 */; /*!50001 SET character_set_results = utf8 */; /*!50001 SET collation_connection = utf8_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ /*!50001 VIEW `ObjectView` AS select `Agent`.`Name` AS `CreatorName`,`Agent`.`Name` AS `OwnerName`,`Grid`.`name` AS `GridName`,`Region`.`Name` AS `RegionName`,`Grid`.`LoginURI` AS `GridLoginURI`,`Object`.`Creator` AS `Creator`,`Object`.`Owner` AS `Owner`,`Object`.`Name` AS `ObjectName`,`Object`.`SalePrice` AS `SalePrice`,`Object`.`SaleType` AS `SaleType`,`Object`.`Perms` AS `Perms`,`Object`.`ID` AS `ObjectID`,`Object`.`LocalID` AS `OLocalID`,`Object`.`Description` AS `Description`,`Object`.`Location` AS `Location` from (((`Agent` join `Object`) join `Grid`) join `Region`) where ((`Agent`.`AgentID` = `Object`.`Creator`) and (`Agent`.`AgentID` = `Object`.`Owner`) and (`Grid`.`PKey` = `Object`.`Grid`) and (`Region`.`Handle` = `Object`.`Region`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!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 */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2011-01-27 7:57:00
true
f4db2936d0f2c7af5f661a5498cf1ddf42fa8f6d
SQL
EgorDudyrev/data_analytics
/homeworks/HW1_EDudyrev.sql
UTF-8
5,213
3.953125
4
[]
no_license
SELECT 'ФИО: Дудырев Егор'; --Создание таблиц CREATE TABLE films ( id SERIAL PRIMARY KEY, title VARCHAR(255) NOT NULL, country VARCHAR(255), box_office INTEGER, release_year TIMESTAMP ); CREATE TABLE persons ( id SERIAL PRIMARY KEY, fio VARCHAR(255) UNIQUE NOT NULL ); CREATE TABLE persons2content ( person_id INTEGER REFERENCES persons(id), film_id INTEGER REFERENCES films(id), person_type VARCHAR(255) ); --Фильм 1: Богемская рапсодия INSERT INTO persons (fio) VALUES ('Рами Малек'), ('Люси Бойнтон'), ('Гвилим Ли'), ('Брайан Сингер'), ('Энтони МакКартен'), ('Роберт Де Ниро'); INSERT INTO films (title, country, box_office, release_year) VALUES ('Богемская рапсодия', 'Великобритания', 801536458, to_timestamp('2018', 'yyyy')); INSERT INTO persons2content (person_id, film_id, person_type) WITH f AS ( SELECT id film_id FROM films WHERE title='Богемская рапсодия' ) SELECT p.id person_id, film_id, 'Актёр' person_type FROM persons p, f WHERE p.fio IN ('Рами Малек', 'Люси Бойнтон', 'Гвилим Ли') UNION SELECT p.id person_id, film_id, 'Режиссёр' person_type FROM persons p, f WHERE p.fio = 'Брайан Сингер' UNION SELECT p.id person_id, film_id, 'Сценарист' person_type FROM persons p, f WHERE p.fio = 'Энтони МакКартен' UNION SELECT p.id person_id, film_id, 'Продюсер' person_type FROM persons p, f WHERE p.fio = 'Роберт Де Ниро'; --Фильм 2: Зелёная книга INSERT INTO persons (fio) VALUES ('Вигго Мортенсен'), ('Махершала Али'), ('Линда Карделлини'), ('Питер Фаррелли'), ('Ник Валлелонга'), ('Джим Бёрк'); INSERT INTO films (title, country, box_office, release_year) VALUES ('Зелёная книга', 'США', 47888188, to_timestamp('2018', 'yyyy')); INSERT INTO persons2content (person_id, film_id, person_type) WITH f AS ( SELECT id film_id FROM films WHERE title='Зелёная книга' ) SELECT p.id person_id, film_id, 'Актёр' person_type FROM persons p, f WHERE p.fio IN ('Вигго Мортенсен', 'Махершала Али', 'Линда Карделлини') UNION SELECT p.id person_id, film_id, 'Режиссёр' person_type FROM persons p, f WHERE p.fio = 'Питер Фаррелли' UNION SELECT p.id person_id, film_id, 'Сценарист' person_type FROM persons p, f WHERE p.fio = 'Ник Валлелонга' UNION SELECT p.id person_id, film_id, 'Продюсер' person_type FROM persons p, f WHERE p.fio = 'Джим Бёрк'; --Фильм 3: Человек-паук: Через вселенные INSERT INTO persons (fio) VALUES ('Шамеик Мур'), ('Джейк Джонсон'), ('Хейли Стайнфелд'), ('Боб Персичетти'), ('Фил Лорд'), ('Уилл Аллегра'); INSERT INTO films (title, country, box_office, release_year) VALUES ('Человек-паук: Через вселенные', 'США', 327987352, to_timestamp('2018', 'yyyy')); INSERT INTO persons2content (person_id, film_id, person_type) WITH f AS ( SELECT id film_id FROM films WHERE title='Человек-паук: Через вселенные' ) SELECT p.id person_id, film_id, 'Актёр' person_type FROM persons p, f WHERE p.fio IN ('Шамеик Мур', 'Джейк Джонсон', 'Хейли Стайнфелд') UNION SELECT p.id person_id, film_id, 'Режиссёр' person_type FROM persons p, f WHERE p.fio = 'Боб Персичетти' UNION SELECT p.id person_id, film_id, 'Сценарист' person_type FROM persons p, f WHERE p.fio = 'Фил Лорд' UNION SELECT p.id person_id, film_id, 'Продюсер' person_type FROM persons p, f WHERE p.fio = 'Уилл Аллегра'; --Фильм 4: Дом, который построил Джек INSERT INTO persons (fio) VALUES ('Мэтт Диллон'), ('Бруно Ганц'), ('Ума Турман'), ('Ларс фон Триер'), ('Луиза Вест'); INSERT INTO films (title, country, box_office, release_year) VALUES ('Дом, который построил Джек', 'Дания', 1217734 , to_timestamp('2018', 'yyyy')); INSERT INTO persons2content (person_id, film_id, person_type) WITH f AS ( SELECT id film_id FROM films WHERE title='Дом, который построил Джек' ) SELECT p.id person_id, film_id, 'Актёр' person_type FROM persons p, f WHERE p.fio IN ('Мэтт Диллон', 'Бруно Ганц', 'Ума Турман') UNION SELECT p.id person_id, film_id, 'Режиссёр' person_type FROM persons p, f WHERE p.fio = 'Ларс фон Триер' UNION SELECT p.id person_id, film_id, 'Сценарист' person_type FROM persons p, f WHERE p.fio = 'Ларс фон Триер' UNION SELECT p.id person_id, film_id, 'Продюсер' person_type FROM persons p, f WHERE p.fio = 'Луиза Вест'; --Фильм 5: Ла-Ла Ленд INSERT INTO persons (fio) VALUES ('Райан Гослинг'), ('Эмма Стоун'), ('Джон Ледженд'), ('Дэмьен Шазелл'), ('Фред Бергер'); INSERT INTO films (title, country, box_office, release_year) VALUES ('Ла-Ла Ленд', 'США', 446050389, to_timestamp('2016', 'yyyy')); INSERT INTO persons2content (person_id, film_id, person_type) WITH f AS ( SELECT id film_id FROM films WHERE title='Ла-Ла Ленд' ) SELECT p.id person_id, film_id, 'Актёр' person_type FROM persons p, f WHERE p.fio IN ('Райан Гослинг', 'Эмма Стоун', 'Джон Ледженд') UNION SELECT p.id person_id, film_id, 'Режиссёр' person_type FROM persons p, f WHERE p.fio = 'Дэмьен Шазелл' UNION SELECT p.id person_id, film_id, 'Сценарист' person_type FROM persons p, f WHERE p.fio = 'Дэмьен Шазелл' UNION SELECT p.id person_id, film_id, 'Продюсер' person_type FROM persons p, f WHERE p.fio = 'Фред Бергер';
true
6984bcad45e743b24db87daabd90bcddd0df1483
SQL
HTTPArchive/almanac.httparchive.org
/sql/2021/privacy/data_breaches_pwned_websites_per_date_and_breach_sensitivity.sql
UTF-8
690
3.40625
3
[ "Apache-2.0" ]
permissive
#standardSQL # 'Sensitive' HaveIBeenPwned breaches, where the existence of an account is sensitive in and of itself. # https://haveibeenpwned.com/FAQs#SensitiveBreach # https://docs.google.com/spreadsheets/d/148SxZICZ24O44roIuEkRgbpIobWXpqLxegCDhIiX8XA/edit#gid=1435927653 SELECT DATE_TRUNC(DATE(BreachDate), MONTH) AS breach_date, IF(isSensitive, 'Sensitive', 'Not sensitive') AS sensitivity, COUNT(DISTINCT Title) AS number_of_breaches, SUM(PwnCount) AS number_of_affected_accounts FROM `httparchive.almanac.breaches` WHERE date = '2021-07-01' AND BreachDate BETWEEN '2020-08-01' AND '2021-07-31' GROUP BY breach_date, sensitivity ORDER BY breach_date, sensitivity
true
4317760ae6c4eb2c865903ea15e302a568cc34b0
SQL
jjangbkh/byeolsolResort
/byeolsolResort.sql
UTF-8
14,885
3.40625
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.20, for Win64 (x86_64) -- -- Host: localhost Database: resort -- ------------------------------------------------------ -- Server version 8.0.20 /*!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 */; /*!50503 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!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 */; -- -- Table structure for table `answer` -- DROP TABLE IF EXISTS `answer`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `answer` ( `id` int NOT NULL AUTO_INCREMENT COMMENT 'answer 식별 id', `title` varchar(45) NOT NULL COMMENT 'answer의 title ', `message` text NOT NULL COMMENT '답변의 message', `question_id` int NOT NULL COMMENT '답변을 쓴 질문의 id', `writer` varchar(45) NOT NULL COMMENT '작성자', `reg_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '작성일 (입력 안할시 기본값 현재 시간)', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `answer` -- LOCK TABLES `answer` WRITE; /*!40000 ALTER TABLE `answer` DISABLE KEYS */; /*!40000 ALTER TABLE `answer` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `board` -- DROP TABLE IF EXISTS `board`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `board` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '게시글의 식별 id', `title` varchar(45) NOT NULL COMMENT '게시글 제목', `content` text NOT NULL COMMENT '게시글 내용', `user_Id` varchar(45) NOT NULL COMMENT '작성자(유저 Id , 현재 로그인 중인 사용자의 ID)', `state` enum('admin','others') NOT NULL DEFAULT 'others' COMMENT '게시글이 admin이 작성한 건지 다른 사람이 작성한 건지 확인하기 위한 컬럼 ( null이라면 others , "others","admin"밖에 안됨)', `w_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '작성일 시간(입력 안할시 기본값 현재 시간)', `first_path` text COMMENT '첫번째 이미지 경로', `second_path` text COMMENT '두번째 이미지 경로', `third_path` text COMMENT '세번째 이미지 경로', `comment_count` int NOT NULL DEFAULT '0' COMMENT '댓글의 수(입력 하지 않을 시 기본 값 0)', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `board` -- LOCK TABLES `board` WRITE; /*!40000 ALTER TABLE `board` DISABLE KEYS */; /*!40000 ALTER TABLE `board` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `comment` -- DROP TABLE IF EXISTS `comment`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `comment` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '식별 id', `board_id` int NOT NULL COMMENT '게시글의 식별 id', `message` text NOT NULL COMMENT '댓글의 message', `user_id` varchar(45) NOT NULL COMMENT '작성자(로그인 되어있는 ID)', `w_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '작성일 (입력 안할시 기본값 현재 시간)', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `comment` -- LOCK TABLES `comment` WRITE; /*!40000 ALTER TABLE `comment` DISABLE KEYS */; /*!40000 ALTER TABLE `comment` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `customer` -- DROP TABLE IF EXISTS `customer`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `customer` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '식별 id', `user_id` varchar(45) NOT NULL COMMENT '유저의 ID', `password` varchar(45) NOT NULL COMMENT '비밀번호', `name` varchar(45) NOT NULL COMMENT '이름', `email` varchar(45) NOT NULL COMMENT '이메일', `zip_code` int NOT NULL COMMENT '우편번호', `address` varchar(45) NOT NULL COMMENT '주소', `address_detail` varchar(45) DEFAULT NULL COMMENT '상세 주소(기본값 null)', `phone` varchar(45) NOT NULL COMMENT '전화번호', `email_state` varchar(45) NOT NULL DEFAULT '미인증' COMMENT '이메일 인증 상태를 확인 하기 위한 컬럼(기본값 ''미인증'')', `birth_date` date NOT NULL COMMENT '생일', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `customer` -- LOCK TABLES `customer` WRITE; /*!40000 ALTER TABLE `customer` DISABLE KEYS */; INSERT INTO `customer` VALUES (1,'admin','admin04','진교범','gyobeom291@gmail.com',1234,'서울특별시 광진구 천호대로 107길 48-7',NULL,'01040449135','인증','1998-08-29'),(2,'test','password','별솔테스트','gyobeom29@gmail.com',3140,'서울특별시 종로구 수표로 105, 육의전빌딩','','01012345678','인증','1998-08-29'),(3,'test01','password01','진교범','wlsryqka@naver.com',3140,'서울특별시 종로구 수표로 105, 육의전빌딩','','01056789156','미인증','2015-07-01'); /*!40000 ALTER TABLE `customer` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `event` -- DROP TABLE IF EXISTS `event`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `event` ( `id` int NOT NULL AUTO_INCREMENT COMMENT 'event 식별 아이디', `title` varchar(45) NOT NULL COMMENT '이벤트의 제목', `img_path` text NOT NULL COMMENT '이벤트 ftp올린 이미지 경로', `reg_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '작성일 (입력 안할시 기본값 현재 시간)', `start_date` date NOT NULL COMMENT '이벤트 시작일', `end_date` date NOT NULL COMMENT '이벤트 종료일', `state` enum('상시','미상시') NOT NULL DEFAULT '미상시' COMMENT '이벤트가 상시 이벤트 인지 기간이 있는 이벤트 인지 확인 하는 컬럼 (기본값 ''미상시'')', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `event` -- LOCK TABLES `event` WRITE; /*!40000 ALTER TABLE `event` DISABLE KEYS */; INSERT INTO `event` VALUES (1,'함께 이겨내요,코로나!','https://gyonewproject.000webhostapp.com/byeolsolResort/event/16_48_47_7895/코로나1(1~).png','2020-07-16 07:48:51','1850-01-01','1850-12-31','상시'),(2,'봄맞이 이벤트','https://gyonewproject.000webhostapp.com/byeolsolResort/event/16_49_48_4818/봄맞이1(3~4).png','2020-07-16 07:49:52','2020-03-18','2020-04-18','미상시'),(3,'오래 있으면 더~~즐겁다!','https://gyonewproject.000webhostapp.com/byeolsolResort/event/16_50_44_7722/31이벤트1(5~6).png','2020-07-16 07:50:48','2020-05-01','2020-06-30','미상시'),(4,'호캉스 이벤트!','https://gyonewproject.000webhostapp.com/byeolsolResort/event/16_55_03_9130/호캉스1(7~8).png','2020-07-16 07:55:07','2020-07-01','2020-08-30','미상시'); /*!40000 ALTER TABLE `event` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `event_img` -- DROP TABLE IF EXISTS `event_img`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `event_img` ( `id` int NOT NULL AUTO_INCREMENT COMMENT 'event 임지 식병Id', `event_id` int NOT NULL COMMENT '썸네일을 올릴 event의 id', `img_path` text NOT NULL COMMENT 'ftp에 올린 썸네일 이미지 경로', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `event_img` -- LOCK TABLES `event_img` WRITE; /*!40000 ALTER TABLE `event_img` DISABLE KEYS */; INSERT INTO `event_img` VALUES (1,1,'https://gyonewproject.000webhostapp.com/byeolsolResort/event/event_1_thumbnail/코로나2(1~).png'),(2,2,'https://gyonewproject.000webhostapp.com/byeolsolResort/event/event_2_thumbnail/봄맞이2(3~4).png'),(3,3,'https://gyonewproject.000webhostapp.com/byeolsolResort/event/event_3_thumbnail/3+1이벤트2(5~6).png'),(4,4,'https://gyonewproject.000webhostapp.com/byeolsolResort/event/event_4_thumbnail/호캉스2(7~8).png'); /*!40000 ALTER TABLE `event_img` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `question` -- DROP TABLE IF EXISTS `question`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `question` ( `id` int NOT NULL AUTO_INCREMENT COMMENT 'question 식별 iid', `title` varchar(45) NOT NULL COMMENT '질문의 제목', `message` text NOT NULL COMMENT '질문 내용', `division` varchar(45) NOT NULL COMMENT '분류', `writer` varchar(45) NOT NULL COMMENT '작성자', `reg_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '작성일 (입력 안할시 기본값 현재 시간)', `state` enum('yet','cea') NOT NULL DEFAULT 'yet' COMMENT '작성자가 질문을 하였을 때 관리자가 답변을 달아 주었는가 아닌가를 판단하기 위한 컬럼 (기본값 ''yet'' , yet 과 cea밖에 안들어감)', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `question` -- LOCK TABLES `question` WRITE; /*!40000 ALTER TABLE `question` DISABLE KEYS */; /*!40000 ALTER TABLE `question` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `remove` -- DROP TABLE IF EXISTS `remove`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `remove` ( `id` int NOT NULL AUTO_INCREMENT COMMENT 'remove 식별 id', `user_id` varchar(45) NOT NULL COMMENT '사용자의 ID', `room_id` int NOT NULL COMMENT '방 id', `start_date` date NOT NULL COMMENT '입실일 ', `end_date` date NOT NULL COMMENT '종료일', `total_price` int NOT NULL COMMENT '입금 가격', `user_name` varchar(45) NOT NULL COMMENT 'customer의 이름', `user_phone` varchar(45) NOT NULL COMMENT 'customer의 전화번호', `state` enum('처리','미처리') NOT NULL DEFAULT '미처리' COMMENT '환불 처리를 했는지 판단 하기 위한 컬럼(기본값 ''미처리'')', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `remove` -- LOCK TABLES `remove` WRITE; /*!40000 ALTER TABLE `remove` DISABLE KEYS */; /*!40000 ALTER TABLE `remove` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `reserv` -- DROP TABLE IF EXISTS `reserv`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `reserv` ( `id` int NOT NULL AUTO_INCREMENT COMMENT 'reserv의 식별 id', `user_id` varchar(45) NOT NULL COMMENT 'customer의 ID', `room_id` int NOT NULL COMMENT 'room의 id', `start_date` date NOT NULL COMMENT '입실일', `end_date` date NOT NULL COMMENT '퇴실일', `total_price` int NOT NULL COMMENT '총 가격', `people_count` int NOT NULL COMMENT '인원수', `reg_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '예약일 (입력 안할시 기본값 현재 시간)', `state` enum('입금','미입금') NOT NULL DEFAULT '미입금' COMMENT '입금을 했는지 안했는지 판단하기 위한 컬럼(기본값 ''미입금'')', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `reserv` -- LOCK TABLES `reserv` WRITE; /*!40000 ALTER TABLE `reserv` DISABLE KEYS */; /*!40000 ALTER TABLE `reserv` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `room` -- DROP TABLE IF EXISTS `room`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `room` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '식별 id', `room_num` int NOT NULL COMMENT '방의 번호', `min_people` int NOT NULL COMMENT '최소 인원', `max_people` int NOT NULL COMMENT '최대 인원', `day_price` int NOT NULL COMMENT '평일 가격', `weekend_price` int NOT NULL COMMENT '주말 , 공휴일 , 성수기 가격', `concept` varchar(45) NOT NULL COMMENT '방의 컨셉', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `room` -- LOCK TABLES `room` WRITE; /*!40000 ALTER TABLE `room` DISABLE KEYS */; INSERT INTO `room` VALUES (1,101,4,6,120000,150000,'kids'),(2,102,4,6,120000,150000,'kids'),(3,103,4,6,120000,150000,'kids'),(4,104,4,8,160000,190000,'kids'),(5,105,4,8,160000,190000,'kids'),(6,201,4,6,120000,150000,'game'),(7,202,4,6,120000,150000,'game'),(8,203,4,6,120000,150000,'game'),(9,204,4,8,160000,190000,'game'),(10,205,4,8,160000,190000,'game'),(11,301,4,6,120000,150000,'healing'),(12,302,4,6,120000,150000,'healing'),(13,303,4,6,120000,150000,'healing'),(14,304,4,8,160000,190000,'healing'),(15,305,4,8,160000,190000,'healing'); /*!40000 ALTER TABLE `room` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!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 */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2020-07-17 12:52:26
true
018df2566814bca9b1c0df8d3e4d72a42fd83da7
SQL
underground-xx/matun
/matundb.sql
UTF-8
17,090
2.71875
3
[]
no_license
CREATE DATABASE IF NOT EXISTS `matundb` /*!40100 DEFAULT CHARACTER SET cp1251 COLLATE cp1251_general_cs */; USE `matundb`; -- MySQL dump 10.13 Distrib 5.1.40, for Win32 (ia32) -- -- Host: localhost Database: matundb -- ------------------------------------------------------ -- Server version 5.1.45-community /*!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 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!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 */; -- -- Table structure for table `valuti` -- DROP TABLE IF EXISTS `valuti`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `valuti` ( `rid` int(11) NOT NULL AUTO_INCREMENT, `cod` char(3) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `dsc` varchar(50) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `drz` char(2) COLLATE cp1251_general_cs NOT NULL DEFAULT '', PRIMARY KEY (`rid`), UNIQUE KEY `cod_UNIQUE` (`cod`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='валути'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `valuti` -- LOCK TABLES `valuti` WRITE; /*!40000 ALTER TABLE `valuti` DISABLE KEYS */; /*!40000 ALTER TABLE `valuti` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `art` -- DROP TABLE IF EXISTS `art`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `art` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='default карактеристики на материјали - шифрарник'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `art` -- LOCK TABLES `art` WRITE; /*!40000 ALTER TABLE `art` DISABLE KEYS */; /*!40000 ALTER TABLE `art` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `arhdoks` -- DROP TABLE IF EXISTS `arhdoks`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `arhdoks` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='архива на промени во документи - ставки'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `arhdoks` -- LOCK TABLES `arhdoks` WRITE; /*!40000 ALTER TABLE `arhdoks` DISABLE KEYS */; /*!40000 ALTER TABLE `arhdoks` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cen` -- DROP TABLE IF EXISTS `cen`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cen` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='ценовник'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cen` -- LOCK TABLES `cen` WRITE; /*!40000 ALTER TABLE `cen` DISABLE KEYS */; /*!40000 ALTER TABLE `cen` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `doks` -- DROP TABLE IF EXISTS `doks`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `doks` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='документи ставки'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `doks` -- LOCK TABLES `doks` WRITE; /*!40000 ALTER TABLE `doks` DISABLE KEYS */; /*!40000 ALTER TABLE `doks` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `klg` -- DROP TABLE IF EXISTS `klg`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `klg` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='генералии на курсни листи'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `klg` -- LOCK TABLES `klg` WRITE; /*!40000 ALTER TABLE `klg` DISABLE KEYS */; /*!40000 ALTER TABLE `klg` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `dblog` -- DROP TABLE IF EXISTS `dblog`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dblog` ( `rid` int(11) NOT NULL AUTO_INCREMENT, `iddbusr` varchar(6) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `logout` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `terminal` varchar(60) COLLATE cp1251_general_cs NOT NULL DEFAULT '', PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='лог на пристапи во апликацијата'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `dblog` -- LOCK TABLES `dblog` WRITE; /*!40000 ALTER TABLE `dblog` DISABLE KEYS */; /*!40000 ALTER TABLE `dblog` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `pflica` -- DROP TABLE IF EXISTS `pflica`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `pflica` ( `rid` int(11) NOT NULL AUTO_INCREMENT, `cod` char(6) NOT NULL DEFAULT '', `dsc1` varchar(100) NOT NULL DEFAULT '', `dsc2` varchar(100) NOT NULL DEFAULT '', `embg` char(13) NOT NULL DEFAULT '', `edb` char(13) NOT NULL DEFAULT '', `pasos` varchar(30) NOT NULL DEFAULT '', `eori` varchar(20) NOT NULL DEFAULT '', `tip` char(2) NOT NULL DEFAULT '', `adr` varchar(70) NOT NULL DEFAULT '', `grad` varchar(35) NOT NULL DEFAULT '', `post` char(6) NOT NULL DEFAULT '', `drzava` varchar(50) NOT NULL DEFAULT '', `konlic` varchar(100) NOT NULL DEFAULT '', `tel1` char(20) NOT NULL DEFAULT '', `tel2` char(20) NOT NULL DEFAULT '', `faks` char(20) NOT NULL DEFAULT '', `email` varchar(60) NOT NULL DEFAULT '', `banka` varchar(50) NOT NULL DEFAULT '', `smetka` char(15) NOT NULL DEFAULT '', `regs` varchar(50) NOT NULL DEFAULT '' COMMENT 'registracija', `isbank` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`rid`), UNIQUE KEY `cod_UNIQUE` (`cod`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='физички и правни лица'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `pflica` -- LOCK TABLES `pflica` WRITE; /*!40000 ALTER TABLE `pflica` DISABLE KEYS */; /*!40000 ALTER TABLE `pflica` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `dbprm` -- DROP TABLE IF EXISTS `dbprm`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dbprm` ( `iddbprm` int(11) NOT NULL AUTO_INCREMENT, `cod` varchar(20) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `dsc` varchar(100) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `usr` char(17) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `hdn` bit(1) NOT NULL DEFAULT b'0', `autold` bit(1) NOT NULL DEFAULT b'0', `valc` varchar(255) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `vali` int(11) NOT NULL DEFAULT '0', `valn` decimal(20,4) NOT NULL DEFAULT '0.0000', `valf` float NOT NULL DEFAULT '0', `vall` bit(1) NOT NULL DEFAULT b'0', `vald` date NOT NULL DEFAULT '0000-00-00', `valt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `accessed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`iddbprm`), UNIQUE KEY `sid` (`cod`,`usr`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='параметри за апликација'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `dbprm` -- LOCK TABLES `dbprm` WRITE; /*!40000 ALTER TABLE `dbprm` DISABLE KEYS */; /*!40000 ALTER TABLE `dbprm` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `hrono` -- DROP TABLE IF EXISTS `hrono`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `hrono` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='хронологија на настани во магацините'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hrono` -- LOCK TABLES `hrono` WRITE; /*!40000 ALTER TABLE `hrono` DISABLE KEYS */; /*!40000 ALTER TABLE `hrono` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `dokg` -- DROP TABLE IF EXISTS `dokg`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dokg` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='документи генералии'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `dokg` -- LOCK TABLES `dokg` WRITE; /*!40000 ALTER TABLE `dokg` DISABLE KEYS */; /*!40000 ALTER TABLE `dokg` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `orged` -- DROP TABLE IF EXISTS `orged`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `orged` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='организациски единици'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `orged` -- LOCK TABLES `orged` WRITE; /*!40000 ALTER TABLE `orged` DISABLE KEYS */; /*!40000 ALTER TABLE `orged` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `artsos` -- DROP TABLE IF EXISTS `artsos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `artsos` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='моментална состојба на магацини'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `artsos` -- LOCK TABLES `artsos` WRITE; /*!40000 ALTER TABLE `artsos` DISABLE KEYS */; /*!40000 ALTER TABLE `artsos` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `artkat` -- DROP TABLE IF EXISTS `artkat`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `artkat` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='каталошки броеви на ниво на материјал+производител'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `artkat` -- LOCK TABLES `artkat` WRITE; /*!40000 ALTER TABLE `artkat` DISABLE KEYS */; /*!40000 ALTER TABLE `artkat` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `arhdokg` -- DROP TABLE IF EXISTS `arhdokg`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `arhdokg` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='архива на промени во документи - генералии'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `arhdokg` -- LOCK TABLES `arhdokg` WRITE; /*!40000 ALTER TABLE `arhdokg` DISABLE KEYS */; /*!40000 ALTER TABLE `arhdokg` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tipcen` -- DROP TABLE IF EXISTS `tipcen`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tipcen` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='типови на цени'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tipcen` -- LOCK TABLES `tipcen` WRITE; /*!40000 ALTER TABLE `tipcen` DISABLE KEYS */; /*!40000 ALTER TABLE `tipcen` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tipdok` -- DROP TABLE IF EXISTS `tipdok`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tipdok` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='типови документи'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tipdok` -- LOCK TABLES `tipdok` WRITE; /*!40000 ALTER TABLE `tipdok` DISABLE KEYS */; /*!40000 ALTER TABLE `tipdok` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `kls` -- DROP TABLE IF EXISTS `kls`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `kls` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='ставки на курсни листи'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `kls` -- LOCK TABLES `kls` WRITE; /*!40000 ALTER TABLE `kls` DISABLE KEYS */; /*!40000 ALTER TABLE `kls` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `magaci` -- DROP TABLE IF EXISTS `magaci`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `magaci` ( `rid` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`rid`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='магацини'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `magaci` -- LOCK TABLES `magaci` WRITE; /*!40000 ALTER TABLE `magaci` DISABLE KEYS */; /*!40000 ALTER TABLE `magaci` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `dbusr` -- DROP TABLE IF EXISTS `dbusr`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dbusr` ( `rid` int(11) NOT NULL AUTO_INCREMENT, `iddbuser` varchar(6) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `ime` varchar(60) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `prezime` varchar(70) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `profil` varchar(20) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `pass` varchar(45) COLLATE cp1251_general_cs NOT NULL DEFAULT '', `lastin` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `terminal` varchar(60) COLLATE cp1251_general_cs NOT NULL DEFAULT '', PRIMARY KEY (`rid`), UNIQUE KEY `iddbuser_UNIQUE` (`iddbuser`) ) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs COMMENT='Корисници на апликација'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `dbusr` -- LOCK TABLES `dbusr` WRITE; /*!40000 ALTER TABLE `dbusr` DISABLE KEYS */; /*!40000 ALTER TABLE `dbusr` ENABLE KEYS */; UNLOCK TABLES; -- -- Dumping routines for database 'matundb' -- /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!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 */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2011-03-20 21:50:06
true
9ade77f76ccb44a72d1d1fb308c0e39137a10cf6
SQL
Soura283/Bank-Database
/Bank-Database.sql
UTF-8
1,452
3.890625
4
[]
no_license
DROP DATABASE DB_BANK; CREATE DATABASE DB_BANK; USE DB_BANK; -- CUSTOMER PERSONAL INFORMATION CREATE TABLE CUSTOMER (ID INT, C_NAME NVARCHAR(50), DOB DATE, CONTACT_NO NVARCHAR(11), ADDRESS NVARCHAR(100), GENDER CHAR(5), MAIL_ID NVARCHAR(50), MARTIAL_STATUS VARCHAR(10), CONSTRAINT CUST_INFO PRIMARY KEY (ID) ) SELECT * FROM CUSTOMER; -- CUSTOMER REFERENCE INFORMATION CREATE TABLE CUSTOMER_INFO (ID INT, ACC_NAME NVARCHAR(20), ACC_NO NVARCHAR(16), ACC_ADDRESS NVARCHAR(25), CONSTRAINT CUST_REF_INFO PRIMARY KEY(ID), FOREIGN KEY(ID) REFERENCES CUSTOMER(ID) ) SELECT * FROM CUSTOMER_INFO; -- BANK INFORAMTION CREATE TABLE BANK_INFO (IFSC_CODE VARCHAR(15), BANK_NAME VARCHAR(25), BRANCH_NAME VARCHAR(25), CONSTRAINT BANK_INFO_PK PRIMARY KEY(IFSC_CODE) ) SELECT * FROM BANK_INFO; -- INSERT VALUES INSERT INTO CUSTOMER(ID, C_NAME, DOB, CONTACT_NO, ADDRESS, GENDER, MAIL_ID, MARTIAL_STATUS) VALUES(1, 'SAHIL', '1996-09-04', '987654321', 'JALANDHAR, PUNJAB', 'M', 'SAHILKALYAN@GMAIL.COM', 'SINGLE'), (2, 'HARPREET', '1996-10-31', '986532741', 'LAXMI NAGAR, DELHI', 'M', 'HAPPYSINGH@GMAIL.COM', 'SINGLE'); INSERT INTO CUSTOMER_INFO(ID, ACC_NAME, ACC_NO, ACC_ADDRESS) VALUES(1, 'SAHIL', '12345678912', 'JALANDHAR, PUNJAB'), (2, 'HARPREET', '85236974123', 'LAXMI NAGAR, DELHI'); INSERT INTO BANK_INFO(IFSC_CODE, BANK_NAME, BRANCH_NAME) VALUES('SBI00040N', 'STATE BANK OF INDIA', 'SBI JANDHAR PUNJAB'), ('PNB00P50', 'PUNJAB NATIONAL BANK', ' PNB LAXMI NAGAR DELHI'); SELECT * FROM BANK_INFO
true
c276439ac4ed6bbc2393b17b2e266060e378881f
SQL
GeneTinderholm/assignment_viking_flight_booker
/3_advanced.sql
UTF-8
2,786
4.75
5
[]
no_license
-- Find the most popular travel destination for users who live in California. state.name >> users.state_id >> itineraries.user_id >> tickets.itinerary_id | flight_id >> flights.id SELECT flights.destination_id, count(flights.id) FROM flights JOIN tickets ON(flights.id = tickets.flight_id) JOIN itineraries ON (tickets.itinerary_id = itineraries.id) JOIN users ON (itineraries.user_id = users.id) JOIN states ON(users.state_id = states.id) WHERE states.name = 'California' GROUP BY flights.destination_id ORDER BY count(flights.id) desc; -- How many flights have round trips possible? In other words, we want the count of all airports where there exists a flight FROM that airport and a later flight TO that airport. SELECT * FROM flights a JOIN flights b ON(a.destination_id = b.origin_id AND b.destination_id = a.origin_id) WHERE b.departure_time > a.arrival_time; -- Find the cheapest flight that was taken by a user who only had one itinerary. -- wrong answer, need to debug SELECT users.username, users.id, count(itineraries.user_id), MIN(price) AS min FROM flights JOIN tickets ON (tickets.flight_id = flights.id) JOIN itineraries ON(itineraries.id = itinerary_id) JOIN users ON (users.id = itineraries.user_id) GROUP BY users.id HAVING count(itineraries.user_id) = 1 ORDER BY MIN(price) LIMIT 1; -- right answer SELECT users.first_name, users.last_name, flights.id AS flight_id, flights.price FROM flights JOIN tickets ON (tickets.flight_id = flights.id) JOIN itineraries ON(itineraries.id = itinerary_id) JOIN users ON (users.id = itineraries.user_id) GROUP BY users.id, flights.id HAVING count(itineraries.user_id) = 1 ORDER BY price LIMIT 1; -- Find the average cost of a flight itinerary for users in each state in 2012. SELECT states.name, AVG(flights.price) FROM flights JOIN tickets ON (tickets.flight_id = flights.id) JOIN itineraries ON (itineraries.id = tickets.itinerary_id) JOIN users ON (users.id = itineraries.user_id) JOIN states ON(states.id = users.state_id) WHERE departure_time BETWEEN '2012-01-01 00:00:00.000000' AND '2013-01-01 00:00:00.000000' GROUP BY states.name ORDER BY states.name; -- Bonus: You're a tourist. It's May 6, 2013. Book the cheapest set of flights over the next six weeks that connect Oregon, Pennsylvania and Arkansas, but do not take any flights over 400 miles in distance. Note: This can be ~50 lines long but doesn't require any subqueries. -- No flights originating in Oregon, Pennsylvania or Arkansas during this 6 week period SELECT states.name, count(flights.id) FROM flights JOIN airports ON (flights.origin_id = airports.id) JOIN states ON (states.id = airports.state_id) WHERE distance < 400 AND departure_time BETWEEN '2013-05-06 00:00:00.000000' AND '2013-06-17 00:00:00.000000' GROUP BY states.name;
true
5c29b70f9bb6c106d35d0528e79351f3bdfe081f
SQL
b1tw0rker/vsftpd
/lib/vsftpd.sql
UTF-8
684
2.59375
3
[]
no_license
-- -- Table structure for table `passwd` -- CREATE TABLE `passwd` ( `id` int(11) NOT NULL auto_increment, `dom_id` int(11) default NULL, `username` char(255) default NULL, `passwd` char(80) default NULL, `rootdir` char(255) default NULL, `status` char(1) NOT NULL default 'A', PRIMARY KEY (`id`) ) ENGINE=MyISAM; -- -- Table structure for table `passwd_logs` -- CREATE TABLE `passwd_logs` ( `id` int(11) NOT NULL auto_increment, `msg` char(255) default NULL, `user` char(255) default NULL, `pid` char(255) default NULL, `host` char(255) default NULL, `rhost` char(255) default NULL, `logtime` char(255) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM;
true
963498968621bfa54d31672f33633dbab1ff669c
SQL
Denitsa2212/php19
/02_PHP_MySQL/16_final_test/solutions/kristiqn/news.sql
UTF-8
4,777
3.46875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: 26 апр 2020 в 13:36 -- Версия на сървъра: 10.1.37-MariaDB -- PHP Version: 7.2.12 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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: `news` -- -- -------------------------------------------------------- -- -- Структура на таблица `authors` -- CREATE TABLE `authors` ( `author_id` int(11) NOT NULL, `author_name` varchar(250) NOT NULL, `author_biography` varchar(250) NOT NULL, `author_photo` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Схема на данните от таблица `authors` -- INSERT INTO `authors` (`author_id`, `author_name`, `author_biography`, `author_photo`) VALUES (1, 'Simon Sinek', 'Motivator', 0), (2, 'Jordan Peterson', 'Pshychologist', 0); -- -------------------------------------------------------- -- -- Структура на таблица `author_publication` -- CREATE TABLE `author_publication` ( `id` int(11) NOT NULL, `author_id` int(11) NOT NULL, `publication_id` int(11) NOT NULL, `photos` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Структура на таблица `categories` -- CREATE TABLE `categories` ( `category_id` int(11) NOT NULL, `category_name` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Схема на данните от таблица `categories` -- INSERT INTO `categories` (`category_id`, `category_name`) VALUES (1, 'Healthcare'), (2, 'Economics'); -- -------------------------------------------------------- -- -- Структура на таблица `publications` -- CREATE TABLE `publications` ( `publication_id` int(11) NOT NULL, `publication_name` varchar(250) NOT NULL, `publication_title` varchar(250) NOT NULL, `publication_author` varchar(250) NOT NULL, `date_publicated` datetime NOT NULL, `publication_theme` varchar(250) NOT NULL, `publication_text` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Структура на таблица `publications_photos` -- CREATE TABLE `publications_photos` ( `id` int(11) NOT NULL, `publication_id` int(11) NOT NULL, `photo_id` int(11) NOT NULL, `author` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Структура на таблица `publication_types` -- CREATE TABLE `publication_types` ( `publication_type_id` int(11) NOT NULL, `publication_type` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Схема на данните от таблица `publication_types` -- INSERT INTO `publication_types` (`publication_type_id`, `publication_type`) VALUES (1, 'news'), (2, 'ads'), (3, 'articles'); -- -- Indexes for dumped tables -- -- -- Indexes for table `authors` -- ALTER TABLE `authors` ADD PRIMARY KEY (`author_id`); -- -- Indexes for table `categories` -- ALTER TABLE `categories` ADD PRIMARY KEY (`category_id`); -- -- Indexes for table `publications` -- ALTER TABLE `publications` ADD PRIMARY KEY (`publication_id`); -- -- Indexes for table `publications_photos` -- ALTER TABLE `publications_photos` ADD PRIMARY KEY (`id`); -- -- Indexes for table `publication_types` -- ALTER TABLE `publication_types` ADD PRIMARY KEY (`publication_type_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `authors` -- ALTER TABLE `authors` MODIFY `author_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `categories` -- ALTER TABLE `categories` MODIFY `category_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `publications` -- ALTER TABLE `publications` MODIFY `publication_id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `publications_photos` -- ALTER TABLE `publications_photos` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `publication_types` -- ALTER TABLE `publication_types` MODIFY `publication_type_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; 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 */;
true
bf0f1eaf4513dfa331beea6eeae493eb4892fd8d
SQL
nichepah/daily-prod-app
/non-android-scripts/sql/devel/ssp.sql
UTF-8
1,078
2.703125
3
[]
no_license
CREATE TABLE SAILPRO.T_SSP( Production_Date date NOT NULL, CS_Mon_CPLY int, CS_Mon_Tar_APP int, CS_Mon_Tar_Rev int, CS_Daily_Tar_APP int, CS_Daily_Tar_Rev int, CS_Act int, CS_Cum int, CS_MRate int, CS_APP_Fulfill int, HRM_Mon_CPLY int, HRM_Mon_Tar_APP int, HRM_Mon_Tar_Rev int, HRM_Daily_Tar_APP int, HRM_Daily_Tar_Rev int, HRM_Act int, HRM_Cum int, HRM_MRate int, HRM_APP_Fulfill int, SS_Prod_Mon_CPLY int, SS_Prod_Mon_Tar_APP int, SS_Prod_Mon_Tar_Rev int, SS_Prod_Daily_Tar_APP int, SS_Prod_Daily_Tar_Rev int, SS_Prod_Act int, SS_Prod_Cum int, SS_Prod_MRate int, SS_Prod_APP_Fulfill int, SS_Desp_Mon_CPLY int, SS_Desp_Mon_Tar_APP int, SS_Desp_Mon_Tar_Rev int, SS_Desp_Daily_Tar_APP int, SS_Desp_Daily_Tar_Rev int, SS_Desp_Act int, SS_Desp_Cum int, SS_Desp_MRate int, SS_Desp_APP_Fulfill int, PRIMARY KEY (Production_Date) ); -- CREATE USER 'test_updater'@'localhost' IDENTIFIED BY 'updater123'; GRANT SELECT, INSERT ON SAILPRO.* TO 'test_updater'@'localhost'; -- CREATE USER 'test'@'localhost' IDENTIFIED BY 'test'; GRANT SELECT ON SAILPRO.* TO 'test'@'localhost';
true
ec1c922dd58a52e16e4d9fda2df7796d24ab0592
SQL
CUBRID/cubrid-testcases
/sql/_27_banana_qa/issue_5765_timezone_support/_01_table_operations/_01_create/cases/_02_create_constraints_tsltz.sql
UTF-8
1,287
3.953125
4
[ "BSD-3-Clause" ]
permissive
--create table with TIMESTAMPLTZ columns with constraints --test: default drop table if exists ltz; create table ltz(c_tsltz timestamp with local time zone default sys_timestamp); desc ltz; drop table ltz; --test: shared create table ltz(c_tsltz timestamp with local time zone shared '2000-12-12 12:00:00 AM +02:00'); desc ltz; drop table ltz; --test: [er] auto_increment create table ltz(c_tsltz timestamp with local time zone auto_increment); desc ltz; drop table ltz; --test: not null create table ltz(c_tsltz timestamp with local time zone not null); show columns in ltz; drop table ltz; --test: unique create table ltz(c_tsltz timestamp with local time zone unique); show columns in ltz; drop table ltz; --test: primary key create table ltz(c_tsltz timestamp with local time zone primary key); show columns in ltz; drop table ltz; --test: foreign key create table a_ltz(c_tsltz timestamp with local time zone primary key); create table b_ltz(c_tsltz timestamp with local time zone primary key, constraint fk_id foreign key (c_tsltz) references a_ltz(c_tsltz)); desc b_ltz; show index in b_ltz; drop table a_ltz, b_ltz cascade constraints; --test: reuse_oid create table ltz(c_tsltz timestamp with local time zone not null) reuse_oid; show columns in ltz; drop table ltz;
true
e52a0e155b9e6990bb9ae60473aa93d3fca5049f
SQL
SantiagoHazana/asgbd-2asir
/examen_Santiago_Hazana/ejercicio3.sql
UTF-8
3,790
4.1875
4
[]
no_license
-- Santiago Hazaña - Examen ASGBD 2020 use nation; -- a) select name, national_day from countries where national_day is not null order by national_day desc; -- b) select name, area, population from countries inner join country_stats cs on countries.country_id = cs.country_id where area>2000000 and year='2018' order by area; -- c) select concat(countries.name, ' tiene ', area, 'km2, ', population, ' habitantes, ', (gdp/population), '$ por persona de PBI, ', 'esta en ', c.name, ' y mas concretamente en ', r.name) as Information from countries inner join regions r on countries.region_id = r.region_id inner join country_stats cs on countries.country_id = cs.country_id inner join continents c on r.continent_id = c.continent_id where year='2018'; -- d) select name, national_day from countries where national_day>'1944-12-31' and national_day<'1971-01-01' order by national_day desc; -- e) select name, gdp from countries inner join country_stats cs on countries.country_id = cs.country_id where gdp<(select max(gdp) from countries inner join country_stats c on countries.country_id = c.country_id) and year='2018' order by gdp desc limit 1; -- f) select * from countries inner join regions r on countries.region_id = r.region_id inner join continents c on r.continent_id = c.continent_id where national_day is null and c.name='Europe'; -- g) select r.name, count(c.name) as cantidad from countries c inner join regions r on c.region_id = r.region_id group by r.name order by cantidad desc; -- h) select c2.name, sum(c.area) as areaTotal from countries c inner join regions r on c.region_id = r.region_id inner join continents c2 on r.continent_id = c2.continent_id group by c2.name order by areaTotal desc; -- i) select r.name as region, min(c.area) as mas_pequeno, max(c.area) as mas_grande from countries c inner join regions r on c.region_id = r.region_id group by r.name; -- j) select c.name, (avg(gdp)/1000000000) as pib_promedio from countries c inner join country_stats cs on c.country_id = cs.country_id inner join regions r on c.region_id = r.region_id inner join continents c2 on r.continent_id = c2.continent_id where c2.name='Europe' group by c.name order by pib_promedio desc; -- k) select c.name, l.language from countries c inner join country_languages cl on c.country_id = cl.country_id inner join languages l on cl.language_id = l.language_id inner join regions r on c.region_id = r.region_id inner join continents c2 on r.continent_id = c2.continent_id inner join country_stats cs on c.country_id = cs.country_id where c2.name='Europe' and c.country_id=(select countries.country_id from countries inner join country_stats s on countries.country_id = s.country_id inner join regions r2 on countries.region_id = r2.region_id inner join continents c3 on r2.continent_id = c3.continent_id where c3.name='Europe' and s.year='2018' order by gdp limit 1) group by l.language; -- l) select r.name, count(c.name) as country_count from countries c inner join regions r on c.region_id = r.region_id group by r.name having count(c.name)>10 order by country_count desc; -- m) select c.name from countries c inner join country_stats cs on c.country_id = cs.country_id where cs.population > (select avg(country_stats.population) from country_stats where country_stats.year='2018') and cs.gdp > (select avg(country_stats.gdp) from country_stats where country_stats.year='2018') group by c.name;
true
83d793a892422013ffc5e1370f3076a34ba9b5d8
SQL
SP186138/Test_MDM
/script/Release552BkUp.sql
UTF-8
858
2.984375
3
[]
no_license
CREATE TABLE user_work.REGIS_PRSNA_R552 AS (SEL * FROM ICRM_TBL.REGIS_PRSNA WHERE REGIS_PRSNA_ID IN (SEL REGIS_PRSNA_ID FROM MDM.REGIS_PRSNA WHERE CNTRY_CODE IN ('LAT','CAN','ARG','CHL','MEX'))) WITH DATA PRIMARY INDEX REGIS_PRSNA_NUPI ( REGIS_PRSNA_ID ,MKTNG_PGM_NBR ) PARTITION BY MKTNG_PGM_NBR INDEX CNSMRIdx ( LEGAL_ENT_NBR ,MATCHD_CNSMR_PRSNA_ID ,PRSNA_STATUS_CODE ) INDEX REGIS_PRSNA_NUSI_1 ( FAMLY_NAME ) INDEX REGIS_PRSNA_NUSI_2 ( NATIONAL_ID_NBR ) INDEX REGIS_PRSNA_NUSI_3 ( LYLTY_ACCT_NUM ) INDEX REGIS_PRSNA_NUSI_4 ( REGIS_CNSMR_ID_VAL ); CREATE TABLE user_work.REGIS_PRSNA_POSTL_ADDR_R552 AS (SEL * FROM ICRM_TBL.REGIS_PRSNA_POSTL_ADDR WHERE MKTNG_PGM_NBR IN (SEL MKTNG_PGM_NBR FROM MKTNG_PGM WHERE LEGAL_ENT_NBR IN (23))) WITH DATA PRIMARY INDEX REGIS_PRSNA_POSTL_ADDR_NUPI ( REGIS_PRSNA_ID ,MKTNG_PGM_NBR ) PARTITION BY MKTNG_PGM_NBR ;
true
ffddb0f932f8a08fa981426050277515ac6fdb45
SQL
himabha/scr_panel
/student_course.sql
UTF-8
5,218
3.109375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 12, 2021 at 03:23 AM -- Server version: 10.4.18-MariaDB -- PHP Version: 7.4.16 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: `student_course` -- -- -------------------------------------------------------- -- -- Table structure for table `courses` -- CREATE TABLE `courses` ( `id` int(11) NOT NULL, `course_name` varchar(100) NOT NULL, `detail` longtext NOT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), `modified_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `courses` -- INSERT INTO `courses` (`id`, `course_name`, `detail`, `created_at`, `modified_at`) VALUES (2, 'PHP', 'PHP', '2021-08-07 09:32:49', '2021-08-12 06:42:54'), (3, 'Oracle', 'Oracle', '2021-08-07 09:33:15', '2021-08-07 09:33:15'), (14, 'Java', 'Java', '2021-08-12 03:14:00', '2021-08-12 03:14:29'); -- -------------------------------------------------------- -- -- Table structure for table `students` -- CREATE TABLE `students` ( `id` int(11) NOT NULL, `firstname` varchar(100) NOT NULL, `lastname` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `dob` date NOT NULL, `contact_no` varchar(20) NOT NULL, `active` tinyint(1) NOT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), `modified_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `students` -- INSERT INTO `students` (`id`, `firstname`, `lastname`, `email`, `dob`, `contact_no`, `active`, `created_at`, `modified_at`) VALUES (2, 'Subodhika', 'Malhotra Bhatia', 'mlht.subodhika@gmail.com', '2021-08-07', '7508719734333', 0, '2021-08-07 20:47:08', '2021-08-10 14:11:09'), (3, 'Himanshu', 'Bhatia', 'himanshu.bhatia9@gmail.com', '2021-08-13', '7508719734', 1, '2021-08-07 22:22:28', '2021-08-12 03:16:16'), (50, 'Rajat', 'Bhatia', 'rajatbhatia10889@gmail.com', '1991-08-04', '7878787878', 1, '2021-08-12 03:17:38', '2021-08-12 03:17:51'); -- -------------------------------------------------------- -- -- Table structure for table `subscriptions` -- CREATE TABLE `subscriptions` ( `id` int(11) NOT NULL, `student_id` int(11) NOT NULL, `course_id` int(11) NOT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), `modified_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `subscriptions` -- INSERT INTO `subscriptions` (`id`, `student_id`, `course_id`, `created_at`, `modified_at`) VALUES (5, 9, 3, '2021-08-08 15:35:48', '2021-08-12 02:41:13'), (7, 2, 5, '2021-08-11 20:53:28', '2021-08-12 02:40:39'), (8, 6, 4, '2021-08-12 02:40:26', '2021-08-12 02:40:52'), (9, 3, 2, '2021-08-12 03:18:14', '2021-08-12 03:18:14'), (10, 50, 3, '2021-08-12 03:18:22', '2021-08-12 03:18:22'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(256) NOT NULL, `email` varchar(100) NOT NULL, `firstname` varchar(100) NOT NULL, `lastname` varchar(100) NOT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), `modified_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `username`, `password`, `email`, `firstname`, `lastname`, `created_at`, `modified_at`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 'himanshu.bhatia9@gmail.com', 'Himanshu', 'Bhatia', '2021-08-10 22:03:31', '2021-08-10 22:03:31'); -- -- Indexes for dumped tables -- -- -- Indexes for table `courses` -- ALTER TABLE `courses` ADD PRIMARY KEY (`id`); -- -- Indexes for table `students` -- ALTER TABLE `students` ADD PRIMARY KEY (`id`); -- -- Indexes for table `subscriptions` -- ALTER TABLE `subscriptions` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `courses` -- ALTER TABLE `courses` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; -- -- AUTO_INCREMENT for table `students` -- ALTER TABLE `students` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51; -- -- AUTO_INCREMENT for table `subscriptions` -- ALTER TABLE `subscriptions` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; 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 */;
true
93929a744fabc10868d8f8b75d1b78695b080387
SQL
akshaytambekar17/soyosystem
/database/aspirevision_syo(1).sql
UTF-8
22,916
2.84375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.5.4.1deb2ubuntu2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Feb 19, 2018 at 03:46 PM -- Server version: 5.7.21-0ubuntu0.16.04.1 -- PHP Version: 7.2.1-1+ubuntu16.04.1+deb.sury.org+1 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: `soyosystem` -- -- -------------------------------------------------------- -- -- Table structure for table `project_data` -- CREATE TABLE `project_data` ( `project_id` int(100) NOT NULL, `project_name` varchar(500) NOT NULL, `project_state` varchar(200) NOT NULL, `project_dist` varchar(200) NOT NULL, `project_city` varchar(200) NOT NULL, `sys_type` varchar(500) NOT NULL, `d_id` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `project_data` -- INSERT INTO `project_data` (`project_id`, `project_name`, `project_state`, `project_dist`, `project_city`, `sys_type`, `d_id`) VALUES (1, 'Pump', 'Maharashtra', 'Pune', 'Pune', 'solar', '0'), (2, 'AC', 'Maharashtra', 'Jalgoan', 'Jalgaon', 'Conditioner', '0'), (3, '2', 'fdgdf', 'gfdgvf', 'gfg', 'gfg', 'gdfg'), (4, 'dfgvfg', 'fgf', 'fgf', 'fg', 'gfgf', '4'); -- -------------------------------------------------------- -- -- Table structure for table `soyo_device` -- CREATE TABLE `soyo_device` ( `id` bigint(11) NOT NULL, `device_name` varchar(255) NOT NULL, `drive_manufacture_id` int(11) NOT NULL, `created_at` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_device` -- INSERT INTO `soyo_device` (`id`, `device_name`, `drive_manufacture_id`, `created_at`) VALUES (3, '862118028689567', 3, ''), (4, '866762020580492', 6, '2018-02-10 10:28:16am'), (6, '813697485216932', 3, '2018-02-10 04:10:13pm'), (7, 'Test device123', 0, '2018-02-12 11:27:18pm'); -- -------------------------------------------------------- -- -- Table structure for table `soyo_device_param` -- CREATE TABLE `soyo_device_param` ( `dvc_id` int(100) NOT NULL, `dev_imei` decimal(50,0) NOT NULL, `itv` float NOT NULL, `itc` float NOT NULL, `itp` float NOT NULL, `acv1` float NOT NULL, `acv2` float NOT NULL, `acv3` float NOT NULL, `acc1` float NOT NULL, `acc2` float NOT NULL, `acc3` float NOT NULL, `frq` float NOT NULL, `enrg` float NOT NULL, `lph` float NOT NULL, `temp` float NOT NULL, `sig_str` int(5) NOT NULL, `p_stat` int(5) NOT NULL, `nlc` int(5) NOT NULL, `drc` int(5) NOT NULL, `srt_ckt` int(5) NOT NULL, `x_heat` int(5) NOT NULL, `o_load` int(5) NOT NULL, `dcb_err` int(5) NOT NULL, `temp_sen_abst` int(5) NOT NULL, `emrg` int(5) NOT NULL, `user_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_device_param` -- INSERT INTO `soyo_device_param` (`dvc_id`, `dev_imei`, `itv`, `itc`, `itp`, `acv1`, `acv2`, `acv3`, `acc1`, `acc2`, `acc3`, `frq`, `enrg`, `lph`, `temp`, `sig_str`, `p_stat`, `nlc`, `drc`, `srt_ckt`, `x_heat`, `o_load`, `dcb_err`, `temp_sen_abst`, `emrg`, `user_id`) VALUES (1, '4', 0, 0, 0, 45535, 34.88, 234, 0, 0, 0, 0, 600.67, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14), (2, '3', 0, 0, 0, 9875, 888, 234, 0, 0, 0, 0, 600.67, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14), (3, '813697485216932', 0, 0, 0, 3087, 546, 534, 0, 0, 0, 0, 600.67, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (4, '793145268315463', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (5, '746982531498651', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (6, '865479315874236', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (7, '697521364892167', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); -- -------------------------------------------------------- -- -- Table structure for table `soyo_device_paramters` -- CREATE TABLE `soyo_device_paramters` ( `id` bigint(11) NOT NULL, `name` varchar(255) NOT NULL, `device_id` int(11) NOT NULL, `category` varchar(50) NOT NULL, `unique_id` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_device_paramters` -- INSERT INTO `soyo_device_paramters` (`id`, `name`, `device_id`, `category`, `unique_id`) VALUES (13, 'acv1', 2, '', ''), (14, 'new itv', 2, '', ''), (15, 'acv4', 2, '', ''), (16, 'engry', 1, '', ''), (17, 'work', 1, '', ''), (26, 'Energy Meter Comm unication', 3, '', 'F1'), (27, 'EnergyMeter CBC', 3, '', 'F2'), (28, 'Vo Mode', 3, '', 'F3'), (29, 'Actual Energy', 3, '', 'P1'), (30, 'VO mode Energy', 3, '', 'P2'), (31, 'lnput Voltage R-Y', 3, '', 'P3'), (32, 'Phase Voltage', 3, '', 'F4'), (33, 'Energy Meter Comm unication', 4, '', 'F1'), (34, 'Low Voltage', 6, '', 'F1'), (35, 'System ON', 6, '', 'F2'), (36, 'lnput Current B', 6, '', 'P1'), (38, 'acce', 7, '', 'F1'), (39, 'acce2', 7, '', 'F2'); -- -------------------------------------------------------- -- -- Table structure for table `soyo_device_request` -- CREATE TABLE `soyo_device_request` ( `id` bigint(11) NOT NULL, `parameter` varchar(100) NOT NULL, `value` float NOT NULL, `imei` varchar(100) NOT NULL, `vfd_id` int(11) NOT NULL, `product_type` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_device_request` -- INSERT INTO `soyo_device_request` (`id`, `parameter`, `value`, `imei`, `vfd_id`, `product_type`) VALUES (1, 'F1', 100, '866762020580492', 3, 1), (2, 'F2', 2345.91, '866762020580492', 3, 1), (3, 'F3', 1098.09, '862118028689567', 3, 1), (4, 'P1', 0.9, '866762020580492', 3, 1), (5, 'P2', 8.9, '862118028689567', 3, 1), (6, 'P3', 3, '862118028689567', 3, 1), (7, 'F4', 1, '862118028689567', 3, 1), (8, 'F1', 100, '862118028689567', 3, 1), (9, 'F2', 2345.91, '862118028689567', 3, 1), (10, 'F3', 1098.09, '862118028689567', 3, 1), (11, 'P1', 0.9, '862118028689567', 3, 1), (12, 'P2', 8.9, '862118028689567', 3, 1), (13, 'P3', 3, '862118028689567', 3, 1), (14, 'F4', 1, '862118028689567', 3, 1), (15, 'F1', 100, '862118028689567', 3, 1), (16, 'F2', 2345.91, '862118028689567', 3, 1), (17, 'F3', 1098.09, '862118028689567', 3, 1), (18, 'P1', 0.9, '862118028689567', 3, 1), (19, 'P2', 8.9, '862118028689567', 3, 1), (20, 'P3', 3, '862118028689567', 3, 1), (21, 'F4', 1, '862118028689567', 3, 1), (22, 'F1', 100, '862118028689567', 3, 1), (23, 'F2', 2345.91, '862118028689567', 3, 1), (24, 'F3', 1098.09, '862118028689567', 3, 1), (25, 'P1', 0.9, '862118028689567', 3, 1), (26, 'P2', 8.9, '862118028689567', 3, 1), (27, 'P3', 3, '862118028689567', 3, 1), (28, 'F4', 1, '862118028689567', 3, 1); -- -------------------------------------------------------- -- -- Table structure for table `soyo_district` -- CREATE TABLE `soyo_district` ( `id` int(11) NOT NULL, `name` varchar(200) NOT NULL, `state_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_district` -- INSERT INTO `soyo_district` (`id`, `name`, `state_id`) VALUES (1, 'Ahmednagar', 15), (2, 'Akola', 15), (3, 'Amravati', 15), (4, 'Aurangabad', 15), (5, 'Beed', 15), (6, 'Bhandara', 15), (7, 'Buldhana', 15), (8, 'Chandrapur', 15), (9, 'Dhule', 15), (10, 'Gadchiroli', 15), (11, 'Gondia', 15), (12, 'Hingoli', 15), (13, 'Jalgaon', 15), (14, 'Jalna', 15), (15, 'Kolhapur', 15), (16, 'Latur', 15), (17, 'Mumbai City', 15), (18, 'Mumbai Suburban', 15), (19, 'Nagpur', 15), (20, 'Nanded', 15), (21, 'Nandurbar', 15), (22, 'Nashik', 15), (23, 'Osmanabad', 15), (24, 'Parbhani', 15), (25, 'Pune', 15), (26, 'Raigad', 15), (27, 'Ratnagiri', 15), (28, 'Sangli', 15), (29, 'Satara', 15), (30, 'Sindhudurg', 15), (31, 'Solapur', 15), (32, 'Thane', 15), (33, 'Wardha', 15), (34, 'Washim', 15), (35, 'Yavatmal', 15), (36, 'Palghar', 15); -- -------------------------------------------------------- -- -- Table structure for table `soyo_drive_manufacture` -- CREATE TABLE `soyo_drive_manufacture` ( `id` int(11) NOT NULL, `name` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_drive_manufacture` -- INSERT INTO `soyo_drive_manufacture` (`id`, `name`) VALUES (1, 'Nord Drive Systems Pvt. Ltd.'), (2, 'Srijan Control Drives'), (3, 'Chemco Group of Companies'), (4, 'Powercare Corporation'), (5, 'Gennext Control, India'), (6, 'Hyco Drive Company'), (7, 'Drive Technologies'); -- -------------------------------------------------------- -- -- Table structure for table `soyo_notification` -- CREATE TABLE `soyo_notification` ( `id` int(100) NOT NULL, `message` varchar(500) NOT NULL, `send_to` int(100) NOT NULL, `send_from` int(100) NOT NULL, `type` int(10) NOT NULL, `status` int(5) NOT NULL, `user_id` int(11) NOT NULL, `view` int(5) NOT NULL, `created_at` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_notification` -- INSERT INTO `soyo_notification` (`id`, `message`, `send_to`, `send_from`, `type`, `status`, `user_id`, `view`, `created_at`) VALUES (1, 'vdfg fgvdfv has registered. Waiting for your response.', 1, 8, 1, 0, 0, 1, ''), (2, 'Saniya Sharmahas registered. Waiting for your response.', 1, 10, 1, 0, 0, 1, ''), (3, 'Admin added new distributer Nikhil Vharamble', 1, 1, 0, 0, 17, 1, '2018-02-11 06:03:55pm'), (4, 'akshay tambekar added new user akshay User tambekar user', 1, 14, 0, 0, 20, 1, '2018-02-15 10:54:19am'), (5, 'akshay tambekar added new user test2 user surname user', 1, 14, 0, 0, 22, 1, '2018-02-15 10:57:52am'), (6, 'Nikhil Vharamble added new user test2 user surname user', 1, 17, 0, 0, 27, 0, '2018-02-19 03:17:57pm'); -- -------------------------------------------------------- -- -- Table structure for table `soyo_product` -- CREATE TABLE `soyo_product` ( `p_id` int(10) NOT NULL, `product_name` varchar(500) COLLATE utf8_unicode_ci NOT NULL, `product_img` varchar(1000) COLLATE utf8_unicode_ci NOT NULL, `added_by` int(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `soyo_product` -- INSERT INTO `soyo_product` (`p_id`, `product_name`, `product_img`, `added_by`) VALUES (2, 'Solar Water Pumping System', 'solar-water2.jpg', 1), (3, 'Solar Off Grid Power Plant', 'solar-off-grid-power-plant1.jpg', 1), (4, 'Solar Inverters', 'inverter2.jpg', 1), (5, 'LED Garden Light', 'led-lights1.jpg', 1), (6, '20 Kw Power Pack', 'battery1.jpg', 1), (7, 'Offline UPS', 'ups1.jpg', 1); -- -------------------------------------------------------- -- -- Table structure for table `soyo_projects` -- CREATE TABLE `soyo_projects` ( `id` bigint(11) NOT NULL, `name` varchar(255) NOT NULL, `state_id` int(11) NOT NULL, `district_id` int(11) NOT NULL, `description` varchar(255) NOT NULL, `city` varchar(100) NOT NULL, `created_at` datetime NOT NULL, `distributer_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_projects` -- INSERT INTO `soyo_projects` (`id`, `name`, `state_id`, `district_id`, `description`, `city`, `created_at`, `distributer_id`) VALUES (1, 'Test project1', 15, 15, 'Test project description2', 'Kolhapur', '2018-02-19 12:23:17', 17); -- -------------------------------------------------------- -- -- Table structure for table `soyo_state` -- CREATE TABLE `soyo_state` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `country_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_state` -- INSERT INTO `soyo_state` (`id`, `name`, `country_id`) VALUES (1, 'Andhra Pradesh', 82), (2, 'Arunachal Pradesh', 82), (3, 'Assam', 82), (4, 'Bihar', 82), (5, 'Chhattisgarh', 82), (6, 'Goa', 82), (7, 'Gujarat', 82), (8, 'Haryana', 82), (9, 'Himachal Pradesh', 82), (10, 'Jammu and Kashmir', 82), (11, 'Jharkhand', 82), (12, 'Karnataka', 82), (13, 'Kerala', 82), (14, 'Madhya Pradesh', 82), (15, 'Maharashtra', 82), (16, 'Manipur', 82), (17, 'Meghalaya', 82), (18, 'Mizoram', 82), (19, 'Nagaland', 82), (20, 'Odisha', 82), (21, 'Punjab', 82), (22, 'Rajasthan', 82), (23, 'Sikkim', 82), (24, 'Tamil Nadu', 82), (25, 'Telangana', 82), (26, 'Tripura', 82), (27, 'Uttar Pradesh', 82), (28, 'Uttarakhand', 82), (29, 'West Bengal', 82), (30, 'Andaman and Nicobar Islands', 82), (31, 'Chandigarh', 82), (32, 'Dadra and Nagar Haveli', 82), (33, 'Daman and Diu', 82), (34, 'Delhi', 82), (35, 'Lakshadweep', 82), (36, 'Puducherry', 82); -- -------------------------------------------------------- -- -- Table structure for table `soyo_users` -- CREATE TABLE `soyo_users` ( `user_id` int(100) NOT NULL, `fname` varchar(100) NOT NULL, `lname` varchar(100) NOT NULL, `state` varchar(100) NOT NULL, `dist` varchar(100) NOT NULL, `city` varchar(100) NOT NULL, `mobile` bigint(11) NOT NULL, `email` varchar(200) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `adhar` bigint(16) NOT NULL, `date` date NOT NULL, `time` varchar(50) NOT NULL DEFAULT '00:00:00', `type` int(3) NOT NULL, `status` int(5) NOT NULL, `profile_image` varchar(255) NOT NULL, `added_by` int(11) NOT NULL, `address` varchar(255) NOT NULL, `site_image` varchar(255) NOT NULL, `created_at` varchar(255) NOT NULL, `project_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_users` -- INSERT INTO `soyo_users` (`user_id`, `fname`, `lname`, `state`, `dist`, `city`, `mobile`, `email`, `username`, `password`, `adhar`, `date`, `time`, `type`, `status`, `profile_image`, `added_by`, `address`, `site_image`, `created_at`, `project_id`) VALUES (1, 'Admin', 'Soyo', '15', '25', 'Kolhapur', 9876543213, 'info@gmail.com', 'admin', 'admin@123', 0, '2018-01-25', '01:00:', 1, 0, 'admin2.png', 0, '', '', '', 0), (2, 'karishma', 'kawate', '15', '25', 'Kolhapur', 9156886093, 'karishma6.kawat@gmail.com', 'kk', 'kk', 0, '2018-01-25', '07:32 ', 2, 0, 'debate_web_team.jpg', 0, '', '', '', 0), (3, 'test', 'test', '15', '25', 'Bhusawal', 9156886093, 'test@gamil.com', 'test', 'test123', 0, '2018-01-26', '12:37 ', 3, 1, '400266_237783952963915_21745964_n.jpg', 0, 'pune', 'Image_Slider1.jpg', '', 0), (5, 'vishal', 'Kawate', '15', '25', 'Bhusawal', 7986543215, 'vish@gmail.com', 'vish', 'vish', 0, '2018-01-26', '12:44 ', 3, 1, '', 0, '', '', '', 0), (6, 'Yash', 'Khadke', 'Maharashtra', 'Jalgoan', 'Jalgaon', 8765432187, 'yash@gmail.com', 'yash', 'yash', 0, '2018-01-26', '12:54 ', 2, 0, '', 0, '', '', '', 0), (8, 'ved', 'gfdgdf', 'fgvdfv', 'cvcvfd', 'fvd', 8765432187, 'hema1007@gmail.com', 'asas', 'asas', 0, '2018-02-02', '05:29 ', 2, 0, '', 0, '', '', '', 0), (10, 'Saniya', 'Sharma', 'Maharashtra', 'Pune', 'Pune', 9458699068, 'saniya@gmail.com', 'saniya', 'saniya', 0, '2018-02-02', '07:01 ', 3, 1, '', 0, '', '', '', 0), (17, 'Nikhil', 'Vharamble', '15', '25', 'Pune', 12345678901, 'niks@gmail.com', 'niks', '12345', 0, '2018-02-11', '06:03:55pm', 2, 1, 'ERP_slider2.jpg', 0, '', '', '', 0), (19, 'test1', 'test1', '15', '25', 'Pune', 7789456213, 'test@gmail.com', 'testuser1', '12345', 78, '2018-02-11', '06:03:55pm', 3, 1, 'images1.jpeg', 2, 'pune', 'images2.jpeg', '2018-02-13 12:45:55pm', 0), (20, 'akshay User', 'tambekar user', '15', '25', 'pune', 12345678901, 'akitambekar17@gmail.com', 'akshayuser', '123456', 0, '2018-02-15', '10:54:19am', 3, 1, 'admin5.png', 14, 'pune', 'Image_Slider2.jpg', '2018-02-15 10:54:19am', 0), (22, 'test2 user', 'surname user', '15', '25', 'pune', 12345678901, 'test2@gmail.com', 'test2 user', '12345', 0, '2018-02-15', '10:57:52am', 3, 0, 'ERP_slider4.jpg', 14, 'pune', 'Team_Velociracers___website_photo8.jpg', '2018-02-15 10:57:52am', 0), (27, 'test2 user', 'surname user', '15', '3', 'amrabati', 12345678901, 'test2@gmail.com', 'test2user', 'test', 1234567890123456, '2018-02-19', '03:17:57pm', 3, 0, 'coepfinal1.jpg', 17, 'amrvati', '', '2018-02-19 03:17:57pm', 1); -- -------------------------------------------------------- -- -- Table structure for table `soyo_user_site_information` -- CREATE TABLE `soyo_user_site_information` ( `id` bigint(11) NOT NULL, `user_id` int(11) NOT NULL, `location` varchar(255) NOT NULL, `owner` varchar(255) NOT NULL, `solar_panel` varchar(255) NOT NULL, `pump` varchar(255) NOT NULL, `no_lbows` varchar(255) NOT NULL, `installer` varchar(255) NOT NULL, `installation_date` datetime NOT NULL, `warranty` varchar(255) NOT NULL, `imei_no` varchar(255) NOT NULL, `device_type` int(11) NOT NULL, `vfd_type` int(11) NOT NULL, `pipe_height` varchar(255) NOT NULL, `pipe_diameter` varchar(255) NOT NULL, `site_image` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_user_site_information` -- INSERT INTO `soyo_user_site_information` (`id`, `user_id`, `location`, `owner`, `solar_panel`, `pump`, `no_lbows`, `installer`, `installation_date`, `warranty`, `imei_no`, `device_type`, `vfd_type`, `pipe_height`, `pipe_diameter`, `site_image`) VALUES (1, 19, 'pune', 'dist', 'a1', 'solar', '43', 'distributerdsd', '2018-02-13 12:45:55', '2sd', '123456789', 6, 3, '21', '43', ''), (2, 20, 'pune', 'owener', 'solar panel', 'pump', '5', 'Akshay', '2018-02-15 10:54:19', '2', '866762020580492', 6, 2, '15', '24', ''), (3, 22, 'pune', 'owener', 'solar panel', 'pump', '5', 'Akshay', '2018-02-15 10:57:52', '2', '0987654321s', 3, 2, '15', '24', ''); -- -------------------------------------------------------- -- -- Table structure for table `soyo_user_system` -- CREATE TABLE `soyo_user_system` ( `sys_id` int(10) NOT NULL, `sys_imei` decimal(50,0) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_user_system` -- INSERT INTO `soyo_user_system` (`sys_id`, `sys_imei`, `username`, `password`) VALUES (1, '866762020580492', 'admin', 'admin@123'), (2, '862118028689567', 'kk', 'kk123'), (3, '813697485216932', 'vish', 'vish'), (4, '793145268315463', 'pune', 'pune@123'), (5, '746982531498651', 'karish', 'karish123'), (6, '865479315874236', 'soyo', 'soyo@123'), (7, '697521364892167', 'system', 'sys@123'); -- -------------------------------------------------------- -- -- Table structure for table `soyo_vfd` -- CREATE TABLE `soyo_vfd` ( `id` bigint(11) NOT NULL, `vfd_name` varchar(255) NOT NULL, `drive_manufacture_id` int(11) NOT NULL, `created_at` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `soyo_vfd` -- INSERT INTO `soyo_vfd` (`id`, `vfd_name`, `drive_manufacture_id`, `created_at`) VALUES (1, 'VFD 1', 2, '2018-02-12 11:06:32pm'), (2, 'Testing vfd', 2, '2018-02-16 10:55:20pm'); -- -- Indexes for dumped tables -- -- -- Indexes for table `project_data` -- ALTER TABLE `project_data` ADD PRIMARY KEY (`project_id`); -- -- Indexes for table `soyo_device` -- ALTER TABLE `soyo_device` ADD PRIMARY KEY (`id`); -- -- Indexes for table `soyo_device_param` -- ALTER TABLE `soyo_device_param` ADD PRIMARY KEY (`dvc_id`); -- -- Indexes for table `soyo_device_paramters` -- ALTER TABLE `soyo_device_paramters` ADD PRIMARY KEY (`id`), ADD KEY `device_id_fk` (`device_id`); -- -- Indexes for table `soyo_device_request` -- ALTER TABLE `soyo_device_request` ADD PRIMARY KEY (`id`); -- -- Indexes for table `soyo_district` -- ALTER TABLE `soyo_district` ADD PRIMARY KEY (`id`); -- -- Indexes for table `soyo_drive_manufacture` -- ALTER TABLE `soyo_drive_manufacture` ADD PRIMARY KEY (`id`); -- -- Indexes for table `soyo_notification` -- ALTER TABLE `soyo_notification` ADD PRIMARY KEY (`id`); -- -- Indexes for table `soyo_product` -- ALTER TABLE `soyo_product` ADD PRIMARY KEY (`p_id`); -- -- Indexes for table `soyo_projects` -- ALTER TABLE `soyo_projects` ADD PRIMARY KEY (`id`); -- -- Indexes for table `soyo_state` -- ALTER TABLE `soyo_state` ADD PRIMARY KEY (`id`); -- -- Indexes for table `soyo_users` -- ALTER TABLE `soyo_users` ADD PRIMARY KEY (`user_id`), ADD UNIQUE KEY `username` (`username`); -- -- Indexes for table `soyo_user_site_information` -- ALTER TABLE `soyo_user_site_information` ADD PRIMARY KEY (`id`); -- -- Indexes for table `soyo_user_system` -- ALTER TABLE `soyo_user_system` ADD PRIMARY KEY (`sys_id`); -- -- Indexes for table `soyo_vfd` -- ALTER TABLE `soyo_vfd` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `project_data` -- ALTER TABLE `project_data` MODIFY `project_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `soyo_device` -- ALTER TABLE `soyo_device` MODIFY `id` bigint(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `soyo_device_param` -- ALTER TABLE `soyo_device_param` MODIFY `dvc_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `soyo_device_paramters` -- ALTER TABLE `soyo_device_paramters` MODIFY `id` bigint(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40; -- -- AUTO_INCREMENT for table `soyo_device_request` -- ALTER TABLE `soyo_device_request` MODIFY `id` bigint(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29; -- -- AUTO_INCREMENT for table `soyo_district` -- ALTER TABLE `soyo_district` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37; -- -- AUTO_INCREMENT for table `soyo_drive_manufacture` -- ALTER TABLE `soyo_drive_manufacture` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `soyo_notification` -- ALTER TABLE `soyo_notification` MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `soyo_product` -- ALTER TABLE `soyo_product` MODIFY `p_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `soyo_projects` -- ALTER TABLE `soyo_projects` MODIFY `id` bigint(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `soyo_state` -- ALTER TABLE `soyo_state` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37; -- -- AUTO_INCREMENT for table `soyo_users` -- ALTER TABLE `soyo_users` MODIFY `user_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28; -- -- AUTO_INCREMENT for table `soyo_user_site_information` -- ALTER TABLE `soyo_user_site_information` MODIFY `id` bigint(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `soyo_user_system` -- ALTER TABLE `soyo_user_system` MODIFY `sys_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `soyo_vfd` -- ALTER TABLE `soyo_vfd` MODIFY `id` bigint(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; /*!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 */;
true
8bbeed960204dbd4cb9e9f4271ff3c560eba5983
SQL
denisbarboni/Projeto-AG
/AG/DML AG JSSP.sql
UTF-8
4,033
3.46875
3
[]
no_license
CREATE TABLE sku( id_sku int NOT NULL, nome_sku VARCHAR(100), peso_caixa numeric(15,4), constraint pk_sku primary key (id_sku) ); -- Cria Tabela com respectivos campos. CREATE TABLE unidade( codigo VARCHAR(4) NOT NULL, nome VARCHAR(100), constraint pk_codigo primary key (codigo) ); CREATE TABLE setor( id_setor INT NOT NULL, nome VARCHAR(100), constraint pk_setor primary key (id_setor) ); CREATE TABLE maquina( id_maquina INT NOT NULL, nome VARCHAR(100), constraint pk_maquina primary key (id_maquina) ); CREATE TABLE velocidade( id_velocidade INT NOT NULL, id_setor INT, id_maquina INT, id_sku INT, velocidade_hora numeric(5,4), constraint pk_velocidade primary key (id_velocidade, id_setor, id_maquina, id_sku), constraint fk_velocidade_setor foreign key (id_setor) references setor (id_setor), constraint fk_velocidade_maquina foreign key (id_maquina) references maquina (id_maquina), constraint fk_velocidade_sku foreign key (id_sku) references sku (id_sku) ); -- tROCAR PARA CHAVE COMPOSTA. CREATE TABLE job( id_job INT NOT NULL, id_sku int, quantidade numeric(15,4), constraint pk_job primary key (id_job), constraint fk_job_sku foreign key (id_sku) references sku (id_sku) ); -- Cria Tabela com respectivos campos. CREATE TABLE plano ( IdPlano int not null, Nome varchar(50) not null, Descricao text not null, Valor numeric (5,2) not null, constraint Pk_plano primary key (IdPlano) ); CREATE SEQUENCE nextplano INCREMENT 1 MINVALUE 1 MAXVALUE 99999999999 START 1 CACHE 1; INSERT INTO plano VALUES (nextval('nextplano'), 'Principal', 'Plano Principal de 100 reais', 100.00); CREATE TABLE usuario ( IdUsuario int not null, Login varchar(30) not null, Senha varchar(30) not null, IdPlano int not null, constraint pk_usuario primary key (IdUsuario), constraint fk_usuario_plano foreign key (IdPlano) references plano (IdPlano) ); CREATE SEQUENCE nextuser INCREMENT 1 MINVALUE 1 MAXVALUE 99999999999 START 1 CACHE 1; INSERT INTO usuario VALUES (nextval('nextuser'), 'ADMIN', '123', 1); CREATE TABLE configuracao( IdUser int not null, SolucaoMax numeric(15,5) not null, TaxaCrossover numeric(1,1) not null, TaxaMutacao numeric(1,1) not null, Eltismo boolean null, TotalPopulacao int not null, TotalGeracao int not null, constraint pk_configuracao primary key (IdUser), constraint fk_confgs_user foreign key (idUser) references usuario (IdUsuario) ); INSERT INTO Configuracao VALUES (1,9999,0.6,0.4,true,10,3000); CREATE SEQUENCE nextjob INCREMENT 1 MINVALUE 1 MAXVALUE 99999999999 START 1 CACHE 1; CREATE SEQUENCE nextmaquina INCREMENT 1 MINVALUE 1 MAXVALUE 99999999999 START 1 CACHE 1; CREATE SEQUENCE nextsetor INCREMENT 1 MINVALUE 1 MAXVALUE 99999999999 START 1 CACHE 1; CREATE SEQUENCE nextsku INCREMENT 1 MINVALUE 1 MAXVALUE 99999999999 START 1 CACHE 1; CREATE SEQUENCE nextvelocidade INCREMENT 1 MINVALUE 1 MAXVALUE 99999999999 START 1 CACHE 1; CREATE SEQUENCE nextunidade INCREMENT 1 MINVALUE 1 MAXVALUE 99999999999 START 1 CACHE 1; ALTER TABLE maquina ADD COLUMN IdUser int not null; ALTER TABLE maquina add constraint fk_maquina_user foreign key (idUser) references usuario (IdUsuario); ALTER TABLE setor ADD COLUMN IdUser int not null; ALTER TABLE setor add constraint fk_setor_user foreign key (idUser) references usuario (IdUsuario); ALTER TABLE sku ADD COLUMN IdUser int not null; ALTER TABLE sku add constraint fk_sku_user foreign key (idUser) references usuario (IdUsuario); ALTER TABLE unidade ADD COLUMN IdUser int not null; ALTER TABLE unidade add constraint fk_unidade_user foreign key (idUser) references usuario (IdUsuario); ALTER TABLE job ADD COLUMN IdUser int not null; ALTER TABLE job add constraint fk_job_user foreign key (idUser) references usuario (IdUsuario); ALTER TABLE velocidade ADD COLUMN IdUser int not null; ALTER TABLE velocidade add constraint fk_velocidade_user foreign key (idUser) references usuario (IdUsuario); ALTER TABLE velocidade ALTER COLUMN velocidade_hora type numeric(10,4); select * from usuario
true
6921be8b25039975fc5f65c969f5fab315982d5f
SQL
seodongmi/github-dbSql
/200129.sql
UHC
9,016
4.5
4
[]
no_license
--Function (data ǽ fn1) SELECT TO_DATE('2019/12/31', 'YY-MM-DD') LASTDAY, TO_DATE('2019/12/31', 'YY-MM-DD') - 5 LASTDAYBEFORE5, SYSDATE NOW, SYSDATE - 3 NOW_BEFORE3 FROM dual; --DATE : TO_DATE ڿ -> ¥(DATE) -- TO_CHAR ¥ -> ڿ (¥ ) --JAVA ¥ ҹڸ ( MM / mm -> , ) SELECT TO_CHAR(SYSDATE, 'YYYY-MM/DD HH24:MI:SS') FROM dual; --ְ(1~7) D : Ͽ 1 , 2 ... 7 -- IW : ISOǥ - ش -- 2019/12/31 (ȭ) --> 2020/01/02 () -> ׷ 1 SELECT TO_CHAR(SYSDATE, 'YYYY-MM/DD HH24:MI:SS'), TO_CHAR(SYSDATE,'D'), TO_CHAR(SYSDATE,'IW'), TO_CHAR(TO_DATE('2019/12/31', 'YYYY/MM/DD'), 'IW') FROM dual; --emp ̺ hiredate(Ի)÷ :: SELECT ename, hiredate, TO_CHAR(hiredate, 'YYYY-MM/DD HH24:MI:SS'),--ú Ͱ ȳ? ú ʾұ⋚ TO_CHAR(hiredate + 1, 'YYYY-MM/DD HH24:MI:SS'), TO_CHAR(hiredate + 1/24, 'YYYY-MM/DD HH24:MI:SS'), --hiredate 30 Ͽ TO_CHAR ǥ TO_CHAR(hiredate + (1/24/60)*30, 'YYYY-MM/DD HH24:MI:SS') FROM emp; --Function (data ǽ fn2) SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD') DT_DASH, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS') DT_DASH_WITH_TIME , TO_CHAR(SYSDATE, 'DD-MM-YYYY') DT_DD_MM_YYYY FROM dual; --¥ -- ROUND(DATE, format) -- TRUNC(DATE, format) --MONTHS_BETWEEN(DATE,DATE) --ڷ ¥ SELECT ename, hiredate, MONTHS_BETWEEN(sysdate, hiredate), --Ի  (߿) MONTHS_BETWEEN(TO_DATE('2020-01-17', 'yyyy-mm-dd'), hiredate), 469/12 --39 FROM emp WHERE ename='SMITH'; --ADD MONTHS(DATE, - ) SELECT ADD_MONTHS(SYSDATE, 5), -- 2020/01/29 --> 2020/06/29 ADD_MONTHS(SYSDATE, -5) -- 2020/01/29 --> 2019/08/29 FROM dual; --NEXT_DAY(DATE, ְ), ex) NEXT_DAY(SYSDATE , 5) --> SYSDATE ó ϴ ְ 5() شϴ -- SYSDATE 2020/01/29() ó ϴ 5() -> 2020/01/30 () SELECT NEXT_DAY(SYSDATE, 5) FROM dual; --LAST DATNEXT(DAY) DATE ڸ ڸ SELECT LAST_DAY(SYSDATE) --SYSDATE 2020/01/29 --> SYSDATE 2020/01/31 FROM dual; --LAST_DAY ڷ date ڸ ִµ --date ù° ڴ  ұ? SELECT SYSDATE, LAST_DAY(SYSDATE), TO_DATE('01','DD'), ADD_MONTHS(LAST_DAY(SYSDATE)+1,-1), TO_DATE(TO_CHAR(SYSDATE, 'YYYY-MM') || '-01', 'YYYY-MM-DD') FROM dual; --hiredate ̿Ͽ ش ù° ڷ ǥ SELECT ename, hiredate, ADD_MONTHS(LAST_DAY(hiredate)+1,-1), TO_DATE(TO_CHAR(hiredate, 'YYYY-MM') || '-01', 'YYYY-MM-DD') FROM emp; -- ȯ -- ȯ --empno numberŸ, ڴ ڿ --Ÿ ʱ⶧ ȯ Ͼ --̺ ÷ ŸԿ ° ùٸ ִ ߿ SELECT * FROM emp WHERE empno='7369'; - SELECT * FROM emp WHERE empno=7369; --hiredate dataŸ, ڴ ڿ ־⶧ ȯ ߻ --¥ ڿ ¥ Ÿ ϴ SELECT * FROM emp WHERE hiredate = '1980/12/17'; --80/12/17 ȵdz? YYYY/MM/DD ٲ⶧ -- SELECT * FROM emp WHERE hiredate = TO_DATE('1980/12/17', 'YYYY/MM/DD'); --ȹ --ܰ1 EXPLAIN PLAN FOR SELECT * FROM emp WHERE empno='7369'; --ܰ2 SELECT * FROM table(dbms_xplan.display); --Id | Operation | Name --> ߿ -- Ʒ д --Ⱑ Ǿ ڽ̶ ڽĺ --emp ϴ ̺ ͸ д´ --1 - filter("EMPNO"=7369) --> filter Ÿ -- ڵ ȯ EXPLAIN PLAN FOR SELECT * FROM emp WHERE TO_CHAR(empno)='7369'; SELECT * FROM table(dbms_xplan.display); -- 1 - filter(TO_CHAR("EMPNO")='7369') --ڸ ڿ ϴ : --õ --1000̶ ڸ --ѱ: 1,000.50 -- : 1.000,50 --emp̺ ִ sal÷(NumberŸ) --9 : --0 : ڸ (0 ǥ) --L : ȭ SELECT ename, sal, TO_CHAR(sal, 'L0,999') FROM emp; --ȭ -- Լ --NULL ׻ NULL --emp ̺ sal÷ nullͰ (14 Ϳ ) ---emp ̺ comm÷ nullͰ (14 Ϳ ) --sal + comm -> comm null ࿡ ؼ null ´ SELECT ename, sal, comm, sal+comm FROM emp; --䱸 comm null̸ sal÷ ȸ --䱸 Ű Ѵ -> SW --NVL(Ÿ, ü) --Ÿ NULL̸ ü ȯϰ --Ÿ NULL ƴϸ Ÿ ȯ --if(Ÿ == null) --retrun ü; --else -- return Ÿ; SELECT ename, sal, comm, NVL(comm, 0), sal+NVL(comm,0), NVL(sal+comm, 0) FROM emp; --NVL2(expr1, expr2, expr3) --if(ecpr1 != null) --return expr2 --else --return expr3 SELECT ename, sal, comm, NVL2(comm, 10000, 0 ), -- ƴϸ 10000ο sal+NVL(comm,0), NVL(sal+comm, 0) FROM emp; --NULLIF(expr1, expr2) --if(expr1 == expr2) --return null; --else --return expr1; SELECT ename, sal, comm, NULLIF(sal, 1250) --sal 1250 null , 1250 ƴ sal FROM emp; -- --COALESCE(expr1, expr2...) ߿ ó ϴ --NULL ƴ ڸ ȯ --if(expr1 != null) --return expr1; --else --return COALESCE(expr2, expr3...); --COALESCE(comm, sal) : comm null ƴϸ comm -- comm null̸ sal (, sal÷ NULL ƴ ) SELECT ename,sal,comm, COALESCE(comm, sal) coalesce_comm_sal FROM emp; --fn4 SELECT EMPNO, ENAME, MGR, NVL(mgr, 9999) mgr_n, NVL2(mgr, mgr, 9999), coalesce(mgr, 9999) FROM emp; --fn5 SELECT USERID, USERNM, REG_DT, NVL(REG_DT,SYSDATE) N_REG_DT FROM users WHERE userid != 'brown'; --CONDITION: --CASE : JAVA if-else if-else --CASE -- WHEN THEN ϰ1 -- WHEN 2 THEN ϰ2 -- ELSE ⺻ -- END --emp ̺ kob÷ SALESMAL SAL*1.05 -- MANAGER̸ SAL * 1.1 -- KING̸ SAL * 1.2 -- SAL SELECT ename, job, sal ,CASE WHEN job = 'SALESMAN' THEN sal * 1.05 WHEN job = 'MANAGER' THEN sal * 1.1 WHEN job = 'PRESIDENT' THEN sal * 1.2 ELSE sal END BONUS FROM emp; --DECODEԼ :CASE --(ٸ CASE WHEN Ǻ񱳰 ο -- DECODE Լ ϳ ؼ = 񱳸 -- DECODEԼ: ( Ȳ þ ) -- DECODE(col | expr, ù° ڿ 1, ι° ڰ ȯ , -- ù° ڿ 2, ù° ڿ ׹° ڰ ȯ ..., -- option - else ȯ ⺻) SELECT ename, job, sal, DECODE(job, 'SALESMAN', sal * 1.05, 'MANAGER', sal * 1.1, 'PRESIDENT', sal * 1.2, sal) BONUS FROM emp; --emp ̺ kob÷ SALESMAN̸鼭 sal 1400 ũ SAL*1.05 -- SALESMAN̸鼭 sal 1400 SAL*1.1 -- MANAGER̸ SAL * 1.1 -- KING̸ SAL * 1.2 -- SAL SELECT ename, job, sal ,CASE WHEN job = 'SALESMAN' AND sal>1400 THEN sal * 1.05 WHEN job = 'SALESMAN' AND sal<1400 THEN sal * 1.1 WHEN job = 'MANAGER' THEN sal * 1.1 WHEN job = 'PRESIDENT' THEN sal * 1.2 ELSE sal END BONUS FROM emp; SELECT ename, job, sal, DECODE(job, 'MANAGER', sal * 1.1, 'PRESIDENT', sal * 1.2 ,CASE WHEN job = 'SALESMAN' AND sal>1400 THEN sal * 1.05 WHEN job = 'SALESMAN' AND sal<1400 THEN sal * 1.1 ELSE sal END ) BONUS FROM emp;
true
124d79f7fb43955a0809ad6abd44158344cee269
SQL
kdw912001/kh
/DB/1월8일/DAY7.sql
UTF-8
7,990
4.59375
5
[]
no_license
-- DAY7 --SET OPERATOR (집합 연산자) --UNION, UNION ALL, INTERSECT, MINUS --UNION, UNION ALL (합집합) : 여러 개의 SELECT 문의 결과를 하나로 합침 --INTERSECT (교집합) : 여러 개의 SELECT 결과에서 공통된 행만 골라냄 --MINUS(차집합) : 첫번째 SELECT 결과에서 두번째 SELECT 결과와 겹치는 -- 일치하는 부분을 뺀 결과만 선택함 SELECT EMP_ID, ROLE_NAME FROM EMPLOYEE_ROLE UNION ALL SELECT EMP_ID, ROLE_NAME FROM ROLE_HISTORY; SELECT EMP_ID, ROLE_NAME FROM EMPLOYEE_ROLE INTERSECT--교집합(중복) SELECT EMP_ID, ROLE_NAME FROM ROLE_HISTORY; SELECT EMP_ID, ROLE_NAME FROM EMPLOYEE_ROLE MINUS--차집합 SELECT EMP_ID, ROLE_NAME FROM ROLE_HISTORY; --SET 연산자 사용시 주의사항 --SELECT 절에 컬럼의 갯수가 같아야 함 : 더미(DUMMY) 컬럼을 이용함 --SELECT 절의 각 항목별로 자료형이 같아야 함 SELECT EMP_NAME, JOB_ID, HIRE_DATE FROM EMPLOYEE WHERE DEPT_ID = '20' UNION SELECT DEPT_NAME, DEPT_ID, NULL FROM DEPARTMENT WHERE DEPT_ID = '20'; --50번 부서에 소속된 직원 중 관리자와 일반 직원을 따로 조회해서 하나로 합쳐라. SELECT * FROM EMPLOYEE WHERE DEPT_ID = '50'; --MGR_ID로 관리자 확인 SELECT EMP_ID, EMP_NAME, '관리자' 구분 FROM EMPLOYEE WHERE DEPT_ID = '50' AND EMP_ID = '141' UNION SELECT EMP_ID, EMP_NAME, '직원' 구분 FROM EMPLOYEE WHERE DEPT_ID = '50' AND EMP_ID <> '141' ORDER BY 3,1; SELECT 'SQL을 공부하고 있습니다' 문장, 3 순서 FROM DUAL UNION SELECT '우리는 지금', 1 FROM DUAL UNION SELECT '아주 재미있게', 2 FROM DUAL ORDER BY 순서; --ERROR SELECT 'SQL을 공부하고 있습니다' 문장, 3 순서 FROM DUAL UNION SELECT '우리는 지금', 1 FROM DUAL UNION SELECT '아주 재미있게', 2 FROM DUAL ORDER BY 2; --집합 연산자와 JOIN의 관계 SELECT EMP_ID, ROLE_NAME FROM EMPLOYEE_ROLE INTERSECT SELECT EMP_ID, ROLE_NAME FROM ROLE_HISTORY; --조인구문에서 USING (EMP_ID, ROLE_NAME) 의 의미 --두 컬럼의 값을 하나의 값으로 생각하고 일치하는 항목을 찾음. --(104 SE) = (104 SE) --(104 SE-ANLY) != (104 SE) : 다른 값 --위의 쿼리문을 조인구문으로 바꾸면 SELECT EMP_ID, ROLE_NAME FROM EMPLOYEE_ROLE JOIN ROLE_HISTORY USING(EMP_ID, ROLE_NAME); --집합 연산자와 IN 연산자의 관계 --UNION과 IN이 서로 동일한 결과를 만들 수 있음 --직급이 대리 또는 사원인 직원의 이름과 직급명 조회 --직급순 오름차순정렬하고, 직급이 같으면 이름순 오름차순 정렬 처리함. SELECT EMP_NAME, JOB_TITLE FROM EMPLOYEE JOIN JOB USING(JOB_ID) WHERE JOB_TITLE IN('대리','사원') ORDER BY 2,1; --UNION 으로 바꾸면 SELECT EMP_NAME, JOB_TITLE FROM EMPLOYEE JOIN JOB USING (JOB_ID) WHERE JOB_TITLE = '대리' UNION SELECT EMP_NAME, JOB_TITLE FROM EMPLOYEE JOIN JOB USING (JOB_ID) WHERE JOB_TITLE = '사원' ORDER BY 2,1; --********************************* /* 메소드(리턴값이 있는 메소드()) 컬럼명 비교연산자 비교할 값 <---비교할 값을 알아내기 위한 SELECT 문을 값 사용 위치에 바로 쓸 수 있음 컬럼명 비교연산자 (SELECT ....) */ --서브쿼리(SUB QUERY) --쿼리문 안에 사용된 쿼리문 --예 : 나승원 이라는 직원과 같은 부서에 소속된 직원들의 명단 조회 -- 1. 나승원이 소속된 부서 조회 SELECT DEPT_ID FROM EMPLOYEE WHERE EMP_NAME = '나승원'; --50번 부서 --2. 조회된 결과값을 사용해서 부서원들 조회 SELECT EMP_NAME FROM EMPLOYEE WHERE DEPT_ID = '50'; -- 서브쿼리를 이용하면 SELECT EMP_NAME FROM EMPLOYEE WHERE DEPT_ID = (SELECT DEPT_ID FROM EMPLOYEE WHERE EMP_NAME = '나승원'); --서브쿼리의 유형은 --단일행 서브쿼리, 다중행 서브쿼리, 다중열 서브쿼리, 다중열 다중행 서브쿼리 --상호연관 서브쿼리, 스칼라 서브쿼리 로 구분됨. --서브쿼리 앞에 붙는 연산자가 달라짐. --단일행 서브쿼리(SINGLE ROW SUBQUERY) --서브쿼리의 결과값이 한 개인 경우 --단일행 서브쿼리 앞에는 일반 비교연산자 모두 사용 가능함 -- <, >, <=, >=, =, != | <> | ^= --예 : 나승원과 직급이 같으면서, 나승원보다 급여를 많이 받는 직원 조회 --이름, 직급, 급여 조회 --1.나승원의 직급조회 SELECT JOB_ID FROM EMPLOYEE WHERE EMP_NAME = '나승원'; -- J5 --2. 나승원의 급여조회 SELECT SALARY FROM EMPLOYEE WHERE EMP_NAME = '나승원'; --3. 결과 조회 SELECT EMP_NAME, JOB_ID, SALARY FROM EMPLOYEE WHERE JOB_ID = 'J5' AND SALARY > 2300000; --서브쿼리로 바꾼다면 SELECT EMP_NAME, JOB_ID, SALARY FROM EMPLOYEE WHERE JOB_ID = (SELECT JOB_ID FROM EMPLOYEE WHERE EMP_NAME = '나승원') AND SALARY > (SELECT SALARY FROM EMPLOYEE WHERE EMP_NAME = '나승원'); -- 최저급여를 받고 있는 직원 조회 SELECT EMP_NAME, JOB_ID, SALARY FROM EMPLOYEE WHERE SALARY = (SELECT MIN(SALARY) FROM EMPLOYEE); --부서원 급여합계 중 가장 큰 값 조회 --가장 많은 급여를 받아가는 부서 조회 SELECT DEPT_NAME, SUM(SALARY) FROM EMPLOYEE LEFT JOIN DEPARTMENT USING (DEPT_ID) GROUP BY DEPT_NAME HAVING SUM(SALARY) = (SELECT MAX(SUM(SALARY)) FROM EMPLOYEE GROUP BY DEPT_ID); --단일행 서브쿼리 --서브쿼리는 SELECT절, FROM 절, WHERE 절, GROUP BY절, HAVING절, --ORDER BY절에서 모두 사용 가능함 --다중행(MULTIPLE ROW) 서브쿼리**************************** --서브쿼리 결과값의 갯수가 여러 개인 경우 --예 : 부서별 급여 최저값 조회 SELECT MIN(SALARY) FROM EMPLOYEE GROUP BY DEPT_ID; --부서별로 그 부서의 최저급여를 받고 있는 직원 조회 SELECT EMP_ID, SALARY FROM EMPLOYEE WHERE SALARY = (SELECT MIN(SALARY) FROM EMPLOYEE GROUP BY DEPT_ID);--ERROR--다중행 서브쿼리 /* 다중행 서브쿼리 앞에는 일반 비교연산자 사용 못 함 일반 비교연산자는 한 개의 값을 가지고 비교 판단함. 다중행 서브쿼리 앞에 사용할 수 있는 연산자는 컬렴명 IN (다중행 서브쿼리) : 여러 개의 값 중에서 한 개라도 일치하는 값이 있다면... 컬럼명 NOT IN (다중행 서브쿼리) : 여러 개의 값 중 한 개라도 일치하지 않는다면... 컬럼명 > ANY(다중행 서브쿼리) : 여러 값 중 하나라도 크냐? 가장 작은 값보다 크냐? 컬럼명 < ANY(다중행 서브쿼리) : 여러 값 중 하나라도 작으냐? 가장 큰 값보다 작으냐? 컬럼명 > ALL (다중행 서브쿼리) : 모든 값보다 크냐?(가장 큰 값보다 크냐?) 컬럼명 < ALL (다중행 서브쿼리) : 모든 값보다 작으냐?(가장 작은 값보다 작으냐?) */ SELECT EMP_ID, SALARY FROM EMPLOYEE WHERE SALARY IN (SELECT MIN(SALARY) FROM EMPLOYEE GROUP BY DEPT_ID); --IN / NOT IN --여러 개의 값과 비교해서 같은 값이 있는지 / 같은 값이 없는지 비교 SELECT DISTINCT MGR_ID FROM EMPLOYEE WHERE MGR_ID IS NOT NULL; --직원 정보에서 관리자만 추출 조회 SELECT EMP_ID, EMP_NAME, '관리자' 구분 FROM EMPLOYEE WHERE EMP_ID IN (SELECT MGR_ID FROM EMPLOYEE) UNION SELECT EMP_ID, EMP_NAME, '직원' 구분 FROM EMPLOYEE WHERE EMP_ID NOT IN (SELECT MGR_ID FROM EMPLOYEE WHERE MGR_ID IS NOT NULL)--NOT IN은 NULL이 있으면 안됨 ORDER BY 3,1; --SELECT 절에서도 서브쿼리 사용할 수 있음 SELECT EMP_ID, EMP_NAME, CASE WHEN EMP_ID IN (SELECT MGR_ID FROM EMPLOYEE) THEN '관리자' ELSE '직원' END 구분 FROM EMPLOYEE ORDER BY 3,1;
true
29cf862188b83270852cd3e0ae88b8c15418540f
SQL
VieruTudor/Web-Programming
/Lab6/db/script.sql
UTF-8
374
2.78125
3
[]
no_license
DROP TABLE LogReport DROP TABLE Loggers CREATE TABLE Loggers( id int primary key auto_increment, username varchar(50), password varchar(20) ); CREATE TABLE LogReport( id int primary key auto_increment, user_id int foreign key references Loggers(id), message varchar(255), type varchar(25), severity varchar(25), posted_on varchar(16) );
true
f581a547e1bd4a0958f70cec2956970d90725db8
SQL
fredrischter/digitalparking
/src/main/resources/data.sql
UTF-8
2,598
2.75
3
[]
no_license
INSERT INTO Customer (email, password) VALUES ('andrew@test.com', 123); INSERT INTO Customer (email, password) VALUES ('mary@test.com', 321); INSERT INTO Customer (email, password) VALUES ('nathew@test.com', 223); INSERT INTO Customer (email, password) VALUES ('zoe@test.com', 331); INSERT INTO Vehicle (plate, customer_id) values ('A111', (select id from customer where email like 'andrew@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('A222', (select id from customer where email like 'andrew@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('A333', (select id from customer where email like 'andrew@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('M111', (select id from customer where email like 'mary@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('M222', (select id from customer where email like 'mary@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('M333', (select id from customer where email like 'mary@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('N111', (select id from customer where email like 'nathew@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('N222', (select id from customer where email like 'nathew@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('N333', (select id from customer where email like 'nathew@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('Z111', (select id from customer where email like 'zoe@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('Z222', (select id from customer where email like 'zoe@test.com')); INSERT INTO Vehicle (plate, customer_id) values ('Z333', (select id from customer where email like 'zoe@test.com')); INSERT INTO Transaction (value, customer_id) values (10, (select id from customer where email like 'andrew@test.com')); INSERT INTO Transaction (value, customer_id) values (20, (select id from customer where email like 'mary@test.com')); INSERT INTO Transaction (value, customer_id) values (30, (select id from customer where email like 'nathew@test.com')); INSERT INTO Transaction (value, customer_id) values (40, (select id from customer where email like 'zoe@test.com')); INSERT INTO Parking_Lot (address, active) values ('Mad Ave 123', true); INSERT INTO Parking_Lot (address, active) values ('Wall St 34', true); INSERT INTO Parking_Lot (address, active) values ('Strange Neighborhood 999', false); INSERT INTO Parking_Lot (address, active) values ('Java Ave 23', true); INSERT INTO Parking_Session (amount_charged, start, end, customer_id, vehicle_id) values (5, '2018-01-01 10:00:00', '2018-01-01 15:00:00', (select id from customer where email like 'zoe@test.com'), (select id from vehicle where plate='Z333'));
true
7ebc91abb315f673ce325db0432a35fc7afc255b
SQL
woodyyoung/ytl
/lty-rt-service/conf/db-v1.0.2.sql
UTF-8
911
3.359375
3
[]
no_license
---2017-06-22 create or replace view v_total_level as select a.id,a.name ,a.level_unit,a.weight,a.targetlevel , b.count_date,b.actual_score, b.actual_level,a.parentId,b.is_work, to_char(b.COUNT_DATE,'yyyy-mm-dd') dd, to_char(b.COUNT_DATE,'yyyy-mm') mm, to_char(b.COUNT_DATE,'yyyy-iw') iw, to_char(b.COUNT_DATE,'yyyy') yea from pjmk_index a, v_index_source_data_level b where a.ID = b.index_id; create or replace view v_index_source_data as select a.ID, a.INDEX_ID, a.INDEX_NUM, a.INDEX_TOTAL_NUM, a.COUNT_DATE, a.CREATETIME, a.UPDATETIME, a.ACTUAL_LEVEL, a.ACTUAL_SCORE, b.name,a.is_work,a.line_id,a.area_id,b.level_unit, to_char(a.COUNT_DATE,'yyyy-mm-dd') dd, to_char(a.COUNT_DATE,'yyyy-mm') mm, to_char(a.COUNT_DATE,'yyyy-iw') iw, to_char(a.COUNT_DATE,'yyyy') yea from v_index_source_data_level a left join pjmk_index b on a.index_id = b.id where 1=1;
true
e3e50e17c87db2d87fe2cbf64d0dcd635019dfc1
SQL
n0tl3ss/oci-micronaut
/src/catalogue/src/main/resources/db/mysql/V001__CreateTables.sql
UTF-8
745
3.46875
3
[ "UPL-1.0" ]
permissive
CREATE TABLE PRODUCTS ( sku VARCHAR(20) NOT NULL, brand VARCHAR(20), title VARCHAR(40), description VARCHAR(500), weight VARCHAR(10), product_size VARCHAR(25), colors VARCHAR(20), qty INTEGER, price FLOAT, image_url_1 VARCHAR(50), image_url_2 VARCHAR(50), PRIMARY KEY(sku) ); CREATE TABLE CATEGORIES ( category_id MEDIUMINT AUTO_INCREMENT, name VARCHAR(30), PRIMARY KEY(category_id) ); CREATE TABLE PRODUCT_CATEGORY ( product_category_id MEDIUMINT AUTO_INCREMENT, sku VARCHAR(40), category_id MEDIUMINT NOT NULL, FOREIGN KEY (sku) REFERENCES PRODUCTS(sku), FOREIGN KEY(category_id) REFERENCES CATEGORIES(category_id), PRIMARY KEY(product_category_id) );
true
135bf47a8291bf411cb92134173d7bd5cd24ff5d
SQL
rougetsall/mes-projet
/XALISS/tranfertrouget.sql
UTF-8
5,151
3.25
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 3.5.1 -- http://www.phpmyadmin.net -- -- Client: localhost -- Généré le: Sam 19 Décembre 2015 à 18:11 -- Version du serveur: 5.5.24-log -- Version de PHP: 5.4.3 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 utf8 */; -- -- Base de données: `tranfertrouget` -- -- -------------------------------------------------------- -- -- Structure de la table `administrateur` -- CREATE TABLE IF NOT EXISTS `administrateur` ( `id_admin` int(10) NOT NULL AUTO_INCREMENT, `login` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `nom` varchar(50) NOT NULL, `prenom` varchar(10) NOT NULL, `telephone` varchar(20) NOT NULL, `adresse` varchar(50) NOT NULL, PRIMARY KEY (`id_admin`), UNIQUE KEY `login` (`login`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Contenu de la table `administrateur` -- INSERT INTO `administrateur` (`id_admin`, `login`, `password`, `nom`, `prenom`, `telephone`, `adresse`) VALUES (1, 'Genere', 'cool05', 'Dieng', 'Pierre', '77 327 04 78', 'pikine'); -- -------------------------------------------------------- -- -- Structure de la table `caissier` -- CREATE TABLE IF NOT EXISTS `caissier` ( `id_caissier` int(10) NOT NULL AUTO_INCREMENT, `login` varchar(50) DEFAULT NULL, `password` varchar(50) NOT NULL, `nom` varchar(50) NOT NULL, `prenom` varchar(100) NOT NULL, `telephone` varchar(20) NOT NULL, `adresse` varchar(50) NOT NULL, `etat` int(2) NOT NULL DEFAULT '0', PRIMARY KEY (`id_caissier`), UNIQUE KEY `login` (`login`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ; -- -- Contenu de la table `caissier` -- INSERT INTO `caissier` (`id_caissier`, `login`, `password`, `nom`, `prenom`, `telephone`, `adresse`, `etat`) VALUES (1, '', '', 'mmm', 'ddsw', 'hdhdhd', '', 0), (14, 'rouget', 'sall', 'sall', 'rouget', '77 458 45 14', 'medina', 0), (15, 'amadou', 'sall', 'DIOP', 'lamine', '771125802', 'rue', 1), (16, 'Genere', 'dieng', 'dieng', 'pierre', '773270224', 'pikine', 1), (17, 'licenceinf', 'fall', 'fall', 'anta', '77012580', 'mermoz', 0); -- -------------------------------------------------------- -- -- Structure de la table `client` -- CREATE TABLE IF NOT EXISTS `client` ( `id_client` int(10) NOT NULL AUTO_INCREMENT, `num_carte_ident` int(20) NOT NULL, `nom` varchar(50) NOT NULL, `prenom` varchar(100) NOT NULL, `telephone` varchar(20) NOT NULL, `adresse` varchar(100) NOT NULL, `localite` varchar(100) NOT NULL, PRIMARY KEY (`id_client`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=117 ; -- -- Contenu de la table `client` -- INSERT INTO `client` (`id_client`, `num_carte_ident`, `nom`, `prenom`, `telephone`, `adresse`, `localite`) VALUES (115, 2147483647, 'samba', 'sall', '771452326', 'rue 47', 'national'), (116, 1444511222, 'diop', 'marema', '777154518', 'ucad', 'national'); -- -------------------------------------------------------- -- -- Structure de la table `transaction` -- CREATE TABLE IF NOT EXISTS `transaction` ( `id_trans` int(10) NOT NULL AUTO_INCREMENT, `code_envoi` varchar(8) NOT NULL, `montant` double NOT NULL, `gain` double NOT NULL, `date` date NOT NULL, `type` varchar(50) NOT NULL, `id_exp` int(10) NOT NULL, `id_caissier` int(10) NOT NULL, `question` varchar(20) NOT NULL, `reponse` varchar(20) NOT NULL, `id_benef` int(10) NOT NULL, PRIMARY KEY (`id_trans`), KEY `id_exp` (`id_exp`), KEY `FK_FAIRE_UN_RETRAIT` (`id_benef`), KEY `FK_SE_FAIT_PAR` (`id_caissier`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=82 ; -- -- Contenu de la table `transaction` -- INSERT INTO `transaction` (`id_trans`, `code_envoi`, `montant`, `gain`, `date`, `type`, `id_exp`, `id_caissier`, `question`, `reponse`, `id_benef`) VALUES (76, '03189097', 10000, 700, '2015-12-19', 'TRANSFERT', 115, 15, 'maman', 'papa', 116), (77, '03189097', 10000, 700, '2015-12-19', 'RETRAIT', 115, 1, 'maman', 'papa', 116), (78, '03189097', 10000, 700, '2015-12-19', 'RETRAIT', 115, 1, 'maman', 'papa', 116), (79, '03189097', 10000, 700, '2015-12-19', 'RETRAIT', 115, 1, 'maman', 'papa', 116), (80, '03189097', 10000, 700, '2015-12-19', 'RETRAIT', 115, 1, 'maman', 'papa', 116), (81, '03189097', 10000, 700, '2015-12-19', 'RETRAIT', 115, 1, 'maman', 'papa', 116); -- -- Contraintes pour les tables exportées -- -- -- Contraintes pour la table `transaction` -- ALTER TABLE `transaction` ADD CONSTRAINT `FK_FAIRE_UN_ENVOI` FOREIGN KEY (`id_exp`) REFERENCES `client` (`id_client`), ADD CONSTRAINT `FK_FAIRE_UN_RETRAIT` FOREIGN KEY (`id_benef`) REFERENCES `client` (`id_client`), ADD CONSTRAINT `FK_SE_FAIT_PAR` FOREIGN KEY (`id_caissier`) REFERENCES `caissier` (`id_caissier`); /*!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 */;
true
919f9e71411c184c94c0102eb6c2506c066d10d2
SQL
luismigolondo/it3-SISTRANS
/docs/scripts/RequerimientosFuncionales/RFC12.sql
UTF-8
379
3.953125
4
[]
no_license
SELECT C.NOMBRE,C.ID, COUNT(R.ID) AS SERVICIOS_CONSUMIDOS FROM CLIENTES C, RESERVAS_HABITACIONES R, GASTOS G, PRODUCTOS P WHERE C.ID=R.ID_CLIENTE AND G.ID_RESERVA_HABITACION=R.ID AND G.ID_PRODUCTO=P.ID AND ((R.CHECKED_IN=1 AND R.CHECKED_OUT=1) OR (P.VALOR>300000) OR (P.ID_SERVICIO=8 OR P.ID_SERVICIO=11)) AND ROWNUM<126 GROUP BY C.NOMBRE,C.ID ORDER BY COUNT(R.ID) DESC;
true
0b6194596018de9a9f4cf46c137b3d8620813095
SQL
jgarzonext/plsql-testing
/script_plsql/bd_iaxis/script/tables/FRANQUICIASVER.sql
UTF-8
1,979
2.71875
3
[]
no_license
-------------------------------------------------------- -- DDL for Table FRANQUICIASVER -------------------------------------------------------- CREATE TABLE "AXIS"."FRANQUICIASVER" ( "CFRANQ" NUMBER(6,0), "NFRAVER" NUMBER(6,0), "FFRAINI" DATE, "FFRAFIN" DATE, "FFRAACT" DATE, "CESTADO" VARCHAR2(1 BYTE), "FALTA" DATE, "CUSUALT" VARCHAR2(20 BYTE), "FBAJA" DATE, "CUSUBAJ" VARCHAR2(20 BYTE) ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS NOLOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "AXIS" ; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."CFRANQ" IS 'Codigo de FRANQUICIAS'; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."NFRAVER" IS 'Numero de version de FRANQUICIAS'; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."FFRAINI" IS 'Fecha inicial de FRANQUICIAS'; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."FFRAFIN" IS 'Fecha final de FRANQUICIAS'; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."FFRAACT" IS 'Fecha activacion de FRANQUICIAS'; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."CESTADO" IS 'Codigo estado de FRANQUICIAS'; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."FALTA" IS 'Fecha alta'; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."CUSUALT" IS 'Usuario alta'; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."FBAJA" IS 'Fecha baja'; COMMENT ON COLUMN "AXIS"."FRANQUICIASVER"."CUSUBAJ" IS 'Usuario baja'; COMMENT ON TABLE "AXIS"."FRANQUICIASVER" IS 'Tabla versiones de FRANQUICIAS'; GRANT UPDATE ON "AXIS"."FRANQUICIASVER" TO "R_AXIS"; GRANT SELECT ON "AXIS"."FRANQUICIASVER" TO "R_AXIS"; GRANT INSERT ON "AXIS"."FRANQUICIASVER" TO "R_AXIS"; GRANT DELETE ON "AXIS"."FRANQUICIASVER" TO "R_AXIS"; GRANT SELECT ON "AXIS"."FRANQUICIASVER" TO "CONF_DWH"; GRANT SELECT ON "AXIS"."FRANQUICIASVER" TO "PROGRAMADORESCSI";
true
ba2554ad3c9a6695f26633e19bc4dc475fae67d1
SQL
jhcore/angular_springboot_example_server
/example/src/main/resources/data.sql
UTF-8
727
3.640625
4
[]
no_license
DROP TABLE IF EXISTS BOOK; DROP TABLE IF EXISTS CATEGORY; CREATE TABLE CATEGORY ( id BIGINT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(250) NOT NULL ); CREATE TABLE BOOK ( id BIGINT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(250) NOT NULL, autor VARCHAR(250) NOT NULL, category_id BIGINT DEFAULT NULL ); ALTER TABLE BOOK ADD FOREIGN KEY (category_id) REFERENCES PUBLIC.CATEGORY(id); INSERT INTO CATEGORY(id, name) VALUES (1, 'Libros de texto'); INSERT INTO CATEGORY(id, name) VALUES (2, 'Libros de economía'); INSERT INTO BOOK(id, name, autor, category_id) VALUES (1, 'Liberalismo', 'Juan Ramón Rallo', 2); INSERT INTO BOOK(id, name, autor, category_id) VALUES (2, 'Don Quijote de la Mancha', 'Miguel de Cervantes', 1);
true
1e6b61e912297c04c66334d21b302893261b98b6
SQL
Ivan-ux-dot/Domaci
/Nedelja9/33d_zad1_3330.sql
UTF-8
3,118
3.0625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jun 20, 2021 at 09:14 PM -- Server version: 10.4.18-MariaDB -- PHP Version: 8.0.5 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: `33d_zad1_3330` -- -- -------------------------------------------------------- -- -- Table structure for table `prodaja` -- CREATE TABLE `prodaja` ( `id` int(11) NOT NULL, `barkod` varchar(3) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `kolicina` int(11) NOT NULL, `cena` decimal(9,2) NOT NULL, `datum` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; -- -- Dumping data for table `prodaja` -- INSERT INTO `prodaja` (`id`, `barkod`, `kolicina`, `cena`, `datum`) VALUES (2, '321', 3, '297.00', '2021-06-17'), (3, '456', 3, '396.00', '2021-06-17'), (4, '654', 2, '198.00', '2021-06-17'), (5, '654', 1, '90.00', '2021-05-01'), (6, '123', 5, '500.00', '2021-05-01'), (8, '321', 5, '450.00', '2021-05-01'), (10, '123', 4, '400.00', '2021-05-01'), (57, '789', 20, '4400.00', '2021-06-17'), (58, '789', 40, '11000.00', '2021-06-17'), (59, '789', 10, '2420.00', '2021-06-17'), (60, '776', 30, '1500.00', '2021-05-01'), (61, '761', 10, '800.00', '2021-05-01'), (62, '761', 30, '2400.00', '2021-05-01'), (63, '761', 20, '1760.00', '2021-06-17'); -- -------------------------------------------------------- -- -- Table structure for table `proizodi` -- CREATE TABLE `proizodi` ( `barkod` varchar(3) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `naziv` varchar(30) COLLATE utf8mb4_unicode_nopad_ci NOT NULL, `cena` decimal(9,2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci; -- -- Dumping data for table `proizodi` -- INSERT INTO `proizodi` (`barkod`, `naziv`, `cena`) VALUES ('123', 'fanta', '100.00'), ('321', 'sprite', '90.00'), ('456', 'coca-cola', '120.00'), ('654', 'pepsi', '90.00'), ('761', 'beli luk', '80.00'), ('776', 'crni luk', '50.00'), ('789', 'paradajz', '200.00'); -- -- Indexes for dumped tables -- -- -- Indexes for table `prodaja` -- ALTER TABLE `prodaja` ADD PRIMARY KEY (`id`), ADD KEY `barkod` (`barkod`); -- -- Indexes for table `proizodi` -- ALTER TABLE `proizodi` ADD PRIMARY KEY (`barkod`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `prodaja` -- ALTER TABLE `prodaja` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=64; -- -- Constraints for dumped tables -- -- -- Constraints for table `prodaja` -- ALTER TABLE `prodaja` ADD CONSTRAINT `prodaja_ibfk_1` FOREIGN KEY (`barkod`) REFERENCES `proizodi` (`barkod`); 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 */;
true
d01b1b82ddf5d32dce12ccf1f3c0435d7d94d0d0
SQL
gsokolowski/fizzbuzz
/vendor/smrtr/mysql-version-control/examples/two-databases/db/web/1/data.sql
UTF-8
631
2.65625
3
[ "MIT" ]
permissive
INSERT INTO `sections` (`id`, `slug`, `title`, `created_at`, `updated_at`) VALUES (1, 'news', 'News', now(), now()), (2, 'tasks', 'Tasks', now(), now()), (3, 'questions', 'Questions', now(), now()); INSERT INTO `articles` (`id`, `slug`, `title`, `body`, `section_id`, `created_at`, `updated_at`) VALUES (1, 'fizzbuzz-announces-new-website', 'FizzBuzz announces new website', '<p>FizzBuzz today announced plans to begin development of a new website.</p>\n<p>The new website will organize articles into sections.</p>\n<p>The development plan has been described by onlookers as ambitious and challenging.</p>', 1, now(), now());
true
5af03c94ad2f5d289b73406842721720b062d1f4
SQL
pimbrouwers/realworld-starter-kit
/schema.sql
UTF-8
814
3.40625
3
[]
no_license
IF OBJECT_ID ('api_user', 'U') IS NULL BEGIN CREATE TABLE api_user ( api_user_id INT NOT NULL PRIMARY KEY IDENTITY , username NVARCHAR(32) NOT NULL UNIQUE , email NVARCHAR(512) NOT NULL UNIQUE , bio NVARCHAR(1024) NULL , image NVARCHAR(1024) NULL , passphrase_hash CHAR(44) NOT NULL , salt CHAR(24) NOT NULL , iterations INT NOT NULL CHECK(iterations between 150000 and 200000) ); END IF OBJECT_ID ('follow', 'U') IS NULL BEGIN CREATE TABLE follow ( api_user_id INT NOT NULL FOREIGN KEY REFERENCES api_user (api_user_id) , follow_api_user_id INT NOT NULL FOREIGN KEY REFERENCES api_user (api_user_id) ); END
true
58546b1ee8ecddf71cc9a2cd47593e399cab61ea
SQL
RomanMaks/dba_lesson_09
/queries.sql
UTF-8
2,796
4.25
4
[]
no_license
-- 1. Создайте в товарах поле типа jsonb для хранения различных -- характеристик товара. Например цвет (color), размер (size), -- вес (weight) и так далее, что вам придет в голову. Заполните -- это поле различными характеристиками в виде json. ALTER TABLE products ADD properties jsonb NULL; update products SET properties = '{"color": "red", "size": "40", "gender": "female"}' WHERE id = 1 -- Кеды update products SET properties = '{"color": "green", "weight": "400"}' WHERE id = 5 -- Кружка update products SET properties = '{"color": "blue", "size": "XXL", "gender": "male"}' WHERE id = 14 -- Джинсы update products SET properties = '{"color": "red", "size": "XXL", "weight": "1300", "gender": "male"}' WHERE id = 11 -- Куртка -- 2. Найдите товары: -- 1. У которых есть характеристика цвет, но нет размера SELECT * FROM products WHERE properties ? 'color' AND NOT properties ? 'size' -- 2. У которых вес не более килограмма SELECT * FROM products WHERE (properties->>'weight')::integer <= 1000 -- 3. Красного цвета и размера XXL SELECT * FROM products WHERE properties->>'color' = 'red' AND properties->>'size' = 'XXL' -- 3. Создайте материализированное представление, которое поля jsonb -- превратит в столбцы (color, size, weight) CREATE MATERIALIZED VIEW m_properties AS SELECT vendor_code, name, properties->>'color' AS color, properties->>'size' AS size, properties->>'weight' AS weight, properties->>'gender' AS gender FROM products; -- 4. * Используя оконные функции напишите запрос, который вернет все -- товары и для каждого - его долю в процентах в общей стоимости -- товаров такого же цвета (разумеется, речь про цену * количество). -- Например: -- У вас 4 красных майки по 100 рублей и 3 красных кепки по 200 рублей. -- Всего красных товаров на 1000 рублей. Из них майки - это 40%, а -- кепки - 60% SELECT name, price, -- NUMERIC(15, 2) properties->>'color' AS color, ((price * 100) / SUM(price) OVER (PARTITION BY properties->>'color'))::NUMERIC(5, 2) AS share_of FROM products
true
2a45c7a3dc21bbc415a1d73f6b0b68f9b6be96b6
SQL
mehakSadique/CISC3140-HW4
/SQLZOO.NET:SELECT/SQLZOOSELECTSEL.sql
UTF-8
2,776
4.46875
4
[]
no_license
/*List each country name where the population is larger than that of 'Russia'.*/ select name from world where population>(select population from world where name='Russia') /* Show the countries in Europe with a per capita GDP greater than 'United Kingdom'.*/ select name from world where gdp/population > (select gdp/population from world where name='United Kingdom' ) and continent='Europe' /*List the name and continent of countries in the continents containing either Argentina or Australia. Order by name of the country.*/ select name,continent from world where continent in (select continent from world where name='Argentina' or name='Australia') order by name /*Which country has a population that is more than Canada but less than Poland? Show the name and the population.*/ select name,population from world where population> (select population from world where name='Canada ') and population <(select population from world where name='Poland') /* Germany (population 80 million) has the largest population of the countries in Europe. Austria (population 8.5 million) has 11% of the population of Germany.*/ Show the name and the population of each country in Europe. Show the population as a percentage of the population of Germany. select name, concat(round(100*population/(select population from world where name='Germany')),'%') from world where continent='Europe' /*Which countries have a GDP greater than every country in Europe? [Give the name only.] (Some countries may have NULL gdp values) */ select name from world where gdp > all(select gdp from world where continent='Europe' and gdp>0) /*Find the largest country (by area) in each continent, show the continent, the name and the area: */ select continent,name,area from world x where x.area >= all(select y.area from world y where y.continent=x.continent and area>0) /* List each continent and the name of the country that comes first alphabetically. */ select continent,name from world x where x.name=(select y.name from world y where x.continent=y.continent order by name limit 1) /* Find the continents where all countries have a population <= 25000000. Then find the names of the countries associated with these continents. Show name, continent and population. */ select name,continent,population from world x where 25000000 >=all(select y.population from world y where x.continent=y.continent and population>0) /* Some countries have populations more than three times that of any of their neighbours (in the same continent). Give the countries and continents. */ select name,continent from world x where x.population >=all(select y.population*3 from world y where y.continent=x.continent and population >0 and x.name!=y.name )
true
6e0ae1fe0589bf9df4c95d12714bbeac24bb34c9
SQL
jeseon/springbook
/src/main/scripts/sql/user.sql
UTF-8
466
3.234375
3
[]
no_license
CREATE TABLE `user` ( `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '일련번호', `name` VARCHAR(50) NOT NULL COMMENT '이름', `email` VARCHAR(255) NOT NULL COMMENT '이메일', `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '등록일시', `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일시', PRIMARY KEY (`id`) ) COMMENT='사용자 정보' COLLATE='utf8_general_ci' ENGINE=InnoDB ;
true
b7029f16fc8e6dd886e83c81d20ce596f59595db
SQL
ngoodman1021/ait-library-walkthrough
/library.sql
UTF-8
867
2.9375
3
[]
no_license
CREATE DATABASE `library`; USE `library`; CREATE TABLE IF NOT EXISTS `books` ( `book_id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(128) NOT NULL, `author` varchar(64) NOT NULL, `copies` int(3) NOT NULL, `available` int(3) NOT NULL, PRIMARY KEY (`book_id`) ) ENGINE = InnoDB DEFAULT CHARSET = latin1; INSERT INTO `books` (`title`, `author`, `copies`, `available`) VALUES ("In Search of Lost Time", "Marcel Proust", 3, 3); INSERT INTO `books` (`title`, `author`, `copies`, `available`) VALUES ("Ulysses", "James Joyce", 7, 7); INSERT INTO `books` (`title`, `author`, `copies`, `available`) VALUES ("Don Quixote", "Miguel de Cervantes", 10, 10); INSERT INTO `books` (`title`, `author`, `copies`, `available`) VALUES ("The Great Gatsby", "F. Scott Fitzgerald", 12, 12); INSERT INTO `books` (`title`, `author`, `copies`, `available`) VALUES ("One Hundred Years of Solitude", "Gabriel Garcia Marquez", 14, 14);
true
873f9f78cb5d074adf025735a7403d5a5caa7f0c
SQL
gdg-work/SkillFactory__SDA6__Case_A10
/sql/13_compute_lifetime_cte.sql
UTF-8
343
3.5
4
[]
no_license
select date_trunc('month', u.created_at)::date as cohort, months_between(c.purchased_at::date, u.created_at::date) as lifetime, user_id as uid, purchased_at from case10.carts as c join case10.users as u on c.user_id = u.id join c10_russian_users_ids as rui on c.user_id = rui.uid where c.state = 'successful';
true
35e92d69622288ea5a88b74ef00b2ef8ed3e0692
SQL
imaduddinharis/crjexpress
/res/db/crjexpress_db.sql
UTF-8
2,425
3.078125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 21 Nov 2019 pada 21.36 -- Versi server: 10.1.32-MariaDB -- Versi PHP: 7.2.5 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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: `crjexpress_db` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `roles` -- CREATE TABLE `roles` ( `id_roles` int(11) NOT NULL, `role_name` varchar(50) NOT NULL, `role_description` text NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struktur dari tabel `users` -- CREATE TABLE `users` ( `id_users` int(11) NOT NULL, `username` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `role` enum('superuser','admin','kurir','manager') NOT NULL, `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `users` -- INSERT INTO `users` (`id_users`, `username`, `password`, `email`, `role`, `created_at`, `updated_at`) VALUES (3, 'superuser', '559a1f78b3ad7e9fa1a714e37276bb89', 'superuser@example.com', 'superuser', '2019-11-06 02:25:51', '2019-11-06 02:25:51'); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id_roles`); -- -- Indeks untuk tabel `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id_users`); -- -- AUTO_INCREMENT untuk tabel yang dibuang -- -- -- AUTO_INCREMENT untuk tabel `roles` -- ALTER TABLE `roles` MODIFY `id_roles` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT untuk tabel `users` -- ALTER TABLE `users` MODIFY `id_users` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; 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 */;
true
838473581ba31c9b82362de220fa67042c7a1b03
SQL
keiwatanabe42/practice_SQL
/chap6/6-2/202_like.sql
SHIFT_JIS
570
3
3
[]
no_license
-- LIKE -- Ov hit: dddabc SELECT strcol FROM SampleLike WHERE strcol LIKE 'ddd%'; -- Ԉv hit: abcddd, dddabc, abdddc SELECT strcol FROM SampleLike WHERE strcol LIKE '%ddd%'; -- v hit: abcddd SELECT strcol FROM SampleLike WHERE strcol LIKE '%ddd'; /* % ̂ _ gB_ ‚ŔCӂ1\ */ -- 2Cӂ̕ hit: abcdd SELECT strcol FROM SampleLike WHERE strcol LIKE 'abc__'; -- 3Cӂ̕ hit: abcddd SELECT strcol FROM SampleLike WHERE strcol LIKE 'abc___';
true
d440ad826637428f9460f07ec91c2b03b341a795
SQL
natashaval/idy
/apps/modules/idea/infrastructure/sql/table.sql
UTF-8
411
3.1875
3
[]
no_license
CREATE TABLE `idy`.`author` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(200) NOT NULL , `email` VARCHAR(100) NULL , PRIMARY KEY (`id`) ); CREATE TABLE `idy`.`idea` ( `id` INT NOT NULL AUTO_INCREMENT , `author_id` INT NOT NULL, `title` VARCHAR(255) NOT NULL , `description` TEXT NULL , PRIMARY KEY (`id`), FOREIGN KEY (`authorId`) REFERENCES author(id) );
true
5dac6a4156a54f574a5ba27c1ae8a61b86b9f7f6
SQL
exprezzo/diamante
/dev_docs/database/bancos.sql
UTF-8
2,240
3.234375
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50508 Source Host : localhost:3306 Source Database : diamante Target Server Type : MYSQL Target Server Version : 50508 File Encoding : 65001 Date: 2013-07-15 18:49:20 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `bancos` -- ---------------------------- DROP TABLE IF EXISTS `bancos`; CREATE TABLE `bancos` ( `BancoId` int(11) NOT NULL AUTO_INCREMENT, `Nombre` varchar(20) NOT NULL, PRIMARY KEY (`BancoId`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of bancos -- ---------------------------- INSERT INTO `bancos` VALUES ('1', 'Banamex'); INSERT INTO `bancos` VALUES ('2', 'Bancomer'); INSERT INTO `bancos` VALUES ('3', 'Banorte'); -- ---------------------------- -- Table structure for `cuentas` -- ---------------------------- DROP TABLE IF EXISTS `cuentas`; CREATE TABLE `cuentas` ( `CuentaID` int(11) NOT NULL AUTO_INCREMENT, `Nombre` varchar(30) NOT NULL, `NumeroCuenta` varchar(25) NOT NULL, `BancoId` varchar(6) NOT NULL, PRIMARY KEY (`CuentaID`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of cuentas -- ---------------------------- INSERT INTO `cuentas` VALUES ('1', 'cuenta1', '00001', '1'); INSERT INTO `cuentas` VALUES ('2', 'cuenta 002', '00002', '2'); INSERT INTO `cuentas` VALUES ('3', 'cuenta 3', '0003', '3'); -- ---------------------------- -- Table structure for `pagos` -- ---------------------------- DROP TABLE IF EXISTS `pagos`; CREATE TABLE `pagos` ( `PagosId` int(11) NOT NULL AUTO_INCREMENT, `Fecha` datetime NOT NULL, `Importe` decimal(5,2) NOT NULL, `CuentaId` varchar(6) NOT NULL, `AplicadoPor_usuarioid` varchar(6) NOT NULL, `RecargaId` varchar(6) DEFAULT NULL, PRIMARY KEY (`PagosId`) ) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of pagos -- ---------------------------- INSERT INTO `pagos` VALUES ('11', '2013-07-15 00:00:00', '0.00', '3', '9501', '27'); INSERT INTO `pagos` VALUES ('10', '2013-07-14 00:00:00', '90.00', '1', '9501', '25');
true
1c58b9a12586a35f884407c645021275ab6ecd63
SQL
fernd123/zkframeworksample
/src/main/webapp/sqlscript/createtable.sql
UTF-8
779
2.625
3
[]
no_license
DROP TABLE IF EXISTS `car`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `car` ( `id` int NOT NULL AUTO_INCREMENT, `model` varchar(45) DEFAULT NULL, `make` varchar(45) DEFAULT NULL, `description` varchar(45) DEFAULT NULL, `price` int DEFAULT NULL, `preview` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `car` -- LOCK TABLES `car` WRITE; /*!40000 ALTER TABLE `car` DISABLE KEYS */; INSERT INTO `car` VALUES (35,'6','6','6',0,NULL),(36,'7','7','7',0,NULL); /*!40000 ALTER TABLE `car` ENABLE KEYS */; UNLOCK TABLES;
true
591a1b447432411be95919aa065dc9bee3975fdd
SQL
radtek/scripts-oracle-named
/Indices/consultar_indices_quantidade_tabela.sql
UTF-8
262
3.421875
3
[ "MIT" ]
permissive
-- ver qtde de indices por tabela: select OWNER, TABLE_NAME, COUNT(1) index_count from dba_indexes where OWNER not in ('SYS','SYSTEM') group by OWNER, TABLE_NAME order by COUNT(1) desc, OWNER, TABLE_NAME
true
544505ff938dabe2bc619ad488dbdff4fe2ca966
SQL
raogaru/raoctl
/scr/RAOGARU/SCHEMA/rc_wf/p1_5a.sql
UTF-8
2,139
3.578125
4
[]
no_license
set linesi 1000 trims on pagesi 1000 ---------------------------------------------------------------------------- -- Step 5a: -- SCOTT reads the result. ---------------------------------------------------------------------------- DECLARE l_prin_id WF_PROCESS_INSTANCES.ID%TYPE; -- ID of new created process instance l_pati_id_scott WF_PARTICIPANTS.ID%TYPE; -- ID of participant 'SCOTT' l_acin_id WF_ACTIVITY_INSTANCES.ID%TYPE; -- ID of new created process instance l_worklist_cursor PL_FLOW.generic_curtype; -- a cursor variable l_worklist_record PL_FLOW.worklist_rowtype%ROWTYPE; -- PL_FLOW.worklist_rowtype is dummy cursor for %ROWTYPE l_dummy_int PLS_INTEGER; BEGIN SELECT id INTO l_pati_id_scott FROM wf_participants WHERE name='SCOTT'; PL_FLOW.OpenWorkList( pworklist_filter => 'STATE=''NOTRUNNING'' '||CHR(38)||' ACTIVITIES prce_id=10 and acti_id=60', pati_id_in => l_pati_id_scott, -- this is the ID of scott count_flag => 0, -- should rowcount be returned? pquery_handle => l_worklist_cursor, pcount => l_dummy_int ); -- get the workitem FETCH l_worklist_cursor INTO l_worklist_record; CLOSE l_worklist_cursor; -- Now, tell PL/FLOW that SCOTT starts with this workitem PL_FLOW.ChangeActivityInstanceState( acin_id_in => l_worklist_record.acin_id, state_in => 'RUNNING', pati_id_in => l_pati_id_scott ); -- Here would be code that displays the result on SCOTT's screen. -- Now, complete the same workitem PL_FLOW.ChangeActivityInstanceState( acin_id_in => l_worklist_record.acin_id, state_in => 'COMPLETED', pati_id_in => l_pati_id_scott ); END; / Prompt Activity instances after SCOTT completed 'read final result' SELECT acti_prce_id, acti_id, prin_id, id, state, date_created, date_started, date_ended FROM WF_ACTIVITY_INSTANCES /
true
4917d659d5d178dfb863ebea4588398ccea18065
SQL
brunadl/FASE5_CAP2_RM83421
/CRIACAO E POPULACAO.sql
ISO-8859-1
19,368
3.453125
3
[]
no_license
--CREATE TABLE DADOS_BRUTOS CREATE TABLE DADOS_BRUTOS ( ID CHAR(2) CONSTRAINT DADOS_BRUTOS_PK PRIMARY KEY, DADOS_BRUTOS VARCHAR2(200)); --CREATE TABLE MUNICIPIOS CREATE TABLE MUNICIPIOS ( CD_MUN NUMBER CONSTRAINT MUNICIPIOS_PK PRIMARY KEY , MUNICIPIO VARCHAR2(50)); -- CREATE TABLE UNIDADES_FEDERACAO CREATE TABLE UNIDADES_FEDERACAO ( CD_UF NUMBER CONSTRAINT UNIDADES_FEDERACAO_PK PRIMARY KEY, UF CHAR(2)); --CREATE TABLE DADOS_BRUTOS_CAPITAIS CREATE TABLE DADOS_BRUTOS_CAPITAIS ( CD_UF NUMBER, CD_MUN NUMBER, ID CHAR(2), A_2010 NUMBER, A_2011 NUMBER, A_2012 NUMBER, A_2013 NUMBER, A_2014 NUMBER, A_2015 NUMBER, A_2016 NUMBER, A_2017 NUMBER, A_2018 NUMBER, A_2019 NUMBER, CONSTRAINT UF_DBC_FK FOREIGN KEY (CD_UF) REFERENCES UNIDADES_FEDERACAO (CD_UF) ENABLE, CONSTRAINT MUNICIPIOS_DBC_FK FOREIGN KEY (CD_MUN) REFERENCES MUNICIPIOS (CD_MUN) ENABLE, CONSTRAINT DADOS_BRUTOS_DBC_FK FOREIGN KEY (ID) REFERENCES DADOS_BRUTOS (ID) ENABLE ); --INSERTS TABELA UNIDADES_FEDERACAO insert into UNIDADES_FEDERACAO values ('15','PA'); insert into UNIDADES_FEDERACAO values ('23','CE'); insert into UNIDADES_FEDERACAO values ('26','PE'); insert into UNIDADES_FEDERACAO values ('29','BA'); insert into UNIDADES_FEDERACAO values ('31','MG'); insert into UNIDADES_FEDERACAO values ('33','RJ'); insert into UNIDADES_FEDERACAO values ('35','SP'); insert into UNIDADES_FEDERACAO values ('41','PR'); insert into UNIDADES_FEDERACAO values ('53','DF'); COMMIT; --INSERTS TABELA MUNICIPIOS insert into MUNICIPIOS values ('1501402','BELM'); insert into MUNICIPIOS values ('2927408','SALVADOR'); insert into MUNICIPIOS values ('2304400','FORTALEZA'); insert into MUNICIPIOS values ('4106902','CURITIBA'); insert into MUNICIPIOS values ('2611606','RECIFE'); insert into MUNICIPIOS values ('3106200','BELO HORIZONTE'); insert into MUNICIPIOS values ('5300108','BRASLIA'); insert into MUNICIPIOS values ('3550308','SO PAULO'); insert into MUNICIPIOS values ('3304557','RIO DE JANEIRO'); COMMIT; --INSERTS TABELA DADOS_BRUTOS insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('4b','Domiclios_1_3_prximos_estao_TMA_network'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('5a','Domiclios_3_mais_total'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('5b','Domiclios_3_mais_prximos_estao_TMA_network'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('6a','Mulheres_negras_total'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('1a','Populao_total'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('3b','Domiclios_1/2_1_prximos_estao_TMA_network'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('6b','Mulheres_negras_prximas_estao_TMA_network'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('7b','Mulheres_responsveis_por_domiclio_menos_2_salrios_mnimos_prximas_estao_TM A_network'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('1b','Populao_prxima_estao_TMA_network'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('2b','Domiclios_0_1/2_prximos_estao_TMA_network'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('3a','Domiclios_1/2_1_total'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('4a','Domiclios_1_3_total'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('7a','Mulheres_responsveis_por_domiclio_menos_2_salrios_mnimos_total'); insert into DADOS_BRUTOS (ID,DADOS_BRUTOS) values ('2a','Domiclios_0_1/2_total'); COMMIT; --INSERTS TABELA DADOS_BRUTOS_CAPITAIS insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'3a',238891,238891,238891,238891,238891,238891,238891,23.8891,238891,238891); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'3b',0,0,0,0,3226.952435,7447.071815,7447.071815,10786.92671,10913.55024,10913.55024); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'4a',219189,219189,219189,219189,219189,219189,219189,219189,219189,219189); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'4b',0,0,0,0,6509.263867,10283.78906,10283.78906,14060.36242,14134.5179,14134.5179); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'5a',118791,118791,118791,118791,118791,118791,118791,118791,118791,118791); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'5b',0,0,0,0,4548.229131,6086.373003,6086.373003,9482.892952,9497.599286,9497.599286); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'6a',1123880,1123880,1123880,1123880,1123881,1123881,1123881,1123881,1123881,1123881); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'6b',0,0,0,0,17584.44888,36131.0165,36131.0165,52648.34251,53138.73905,53138.73905); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'7a',232368,232368,232368,232368,232368,232368,232368,232368,232368,232368); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'7b',0,0,0,0,3310.011136,7466.905328,7466.905328,10539.75542,10648.58908,10648.58908); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'1a',11209673,11209673,11209673,11209673,11209673,11209673,11209673,11209673,11209673,11209673); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'1b',1603080.403,1607421.792,1607421.792,1618237.699,1652665.287,1652665.287,1652665.287,1661795.358,1896572.602,1981294.975); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'2a',669801,669801,669801,669801,669801,669801,669801,669801,669801,669801); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'2b',69531.12795,69620.71457,69620.71457,70173.6993,71898.9413 ,71898.9413,71898.9413,72134.84453,81078.65341,85980.61157); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'3a',827366,827366,827366,827366,827366,827366,827366,827366,827366,827366); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'3b',86281.16926,86374.63109,86374.63109,87333.51291,88773.05138,88773.05138,88773.05138,88910.02733,99577.27278,106151.8524); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'4a',1278658,1278658,1278658,1278658,1278658,1278658,1278658,1278658,1278658,1278658); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'4b',196202.0792,196572.6783,196572.6783,197929.5964,200793.3317,200793.3317,200793.3317,201530.0794,227479.6393,236623.0667); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'5a',800482,800482,800482,800482,800482,800482,800482,800482,800482,800482); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'5b',225387.4163,226474.7289,226474.7289,226618.2006,233654.4046,233654.4046,233654.4046,235913.8876,278871.3107,285730.7181); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'6a',2134498,2134498,2134498,2134498,2134498,2134498,2134498,2134498,2134498,2134498); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'6b',226111.3294,226366.5977,226366.5977,228663.6207,232036.9935,232036.9935,232036.9935,232440.1589,252910.1783,267747.8118); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'7a',696137,696137,696137,696137,696137,696137,696137,696137,696137,696137); insert into DADOS_BRUTOS_CAPITAIS values (35,3550308,'7b',85288.4285,85397.29432,85397.29432,85994.52554,87280.02937,87280.02937,87280.02937,87471.30173,97633.63204,102988.8238); insert into DADOS_BRUTOS_CAPITAIS values (15,1501402,'1a',1391636,1391636,1391636,1391636,1391636,1391636,1391636,1391636,1391636,1391636); insert into DADOS_BRUTOS_CAPITAIS values (15,1501402,'1b',0,0,0,0,0,0,0,55422.73761,112164.5156,189565.6108); insert into DADOS_BRUTOS_CAPITAIS values (31,3106200,'5a',188555,188555,188555,188555,188555,188555,188555,188555,188555,0); insert into DADOS_BRUTOS_CAPITAIS values (31,3106200,'5b',18479.04284,18479.04284,18479.04284,18479.04284,41334.60405,41334.60405,41334.60405,41334.60405,41334.68265,0); insert into DADOS_BRUTOS_CAPITAIS values (31,3106200,'6a',641967,641967,641967,641967,641967,641967,641967,641967,641967,0); insert into DADOS_BRUTOS_CAPITAIS values (31,3106200,'6b',45041.85674,45041.85674,45041.85674,45041.85674,96964.41963,96964.41963,96964.41963,96964.41963,96964.47299,0); insert into DADOS_BRUTOS_CAPITAIS values (31,3106200,'7a',169396,169396,169396,169396,169396,169396,169396,169396,169396,0); insert into DADOS_BRUTOS_CAPITAIS values (31,3106200,'7b',12707.23325,12707.23325,12707.23325,12707.23325,27199.75371,27199.75371,27199.75371,27199.75371,27199.76957,0); insert into DADOS_BRUTOS_CAPITAIS values (53, 5300108, '1a', 2556511, 2556511, 2556511, 2556511, 2556511, 2556511, 2556511, 2556511, 2556511, 2556511); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'1b',235651.2597,235651.2597,235651.2597,235651.2597,242499.7745,242499.7745,242499.7745,242908.6303,244583.6576,244583.6576); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'2a',139576,139576,139576,139576,139576,139576,139576,139576,139576,139576); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'2b',7895.49321,7895.49321,7895.49321,7895.49321,8363.845145, 8363.845145,8363.845145,8368.895803,8447.035435,8447.035435); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'3a',171578,171578,171578,171578,171578,171578,171578,171578,171578,171574); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'3b',11977.5749,11977.5749,11977.5749,11977.5749,12565.56944, 12565.56944,12565.56944,12570.00999,12682.19205,12682.19205); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'4a',235310,235310,235310,235310,235310,235310,235310,235310,235310,235310); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'4b',21906.95337,21906.95337,21906.95337,21906.95337,22617.17231,22617.17231,22617.17231,22629.02626,22731.82641,22731.82641); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'5a',228372,228372,228372,228372,228372,228372,228372,228372,228372,228372); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'5b',36286.32873,36286.32873,36286.32873,36286.32873,36483.97643,36483.97643,36483.97643,36563.77023,36713.92453,36713.92453); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'6a',735051,735051,735051,735051,735051,735051,735051,735051,735051,735051); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'6b',59065.18081,59065.18081,59065.18081,59065.18081,61417.06699,61417.06699,61417.06699,61483.19116,61900.74081,61900.74081); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'7a',150295,150295,150295,150295,150295,150295,150295,150295,150295,150295); insert into DADOS_BRUTOS_CAPITAIS values (53,5300108,'7b',10976.81349,10976.81349,10976.81349,10976.81349,11521.98148,11521.98148,11521.98148,11524.70862,11623.51577,11623.51577); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'1a',1744129,1744129,1744129,1744129,1744129,1744129,1744129,1744129,1744129,1744129); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'1b',544209.4403,544209.4403,563240.3457,563240.3457,563240.3457,563240.3457,563240.3457,563240.3457,563240.3457,563240.3457); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'2a',58639,58639,58639,58639,58639,58639,58639,58639,58639,58639); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'2b',14872.73656,14872.73656,15339.75221,15339.75221,15339.75221,15339.75221,15339.75221,15339.75221,15339.75221,15339.75221); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'3a',118582,118582,118582,118582,118582,118582,118582,118582,118582,118582); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'3b',26307.37328,26307.37328,27551.10108,27551.10108,27551.10108,27551.10108,27551.10108,27551.10108,27551.10108,27551.10108); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'4a',245436,245436,245436,245436,245436,245436,245436,245436,245436,245436); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'4b',75849.96232,75849.96232,79092.67698,79092.67698,79092.67698,79092.67698,79092.67698,79092.67698,79092.67698,79092.67698); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'5a',153297,153297,153297,153297,153297,153297,153297,153297,153297,153297); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'5b',81273.47842,81273.47842,82615.84437,82615.84437,82615.84437,82615.84437,82615.84437,82615.84437,82615.84437,82615.84437); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'6a',169557,169557,169557,169557,169557,169557,169557,169557,169557,169557); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'6b',38371.95089,38371.95089,39915.79384,39915.79384,39915.79384,39915.79384,39915.79384,39915.79384,39915.79384,39915.79384); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'7a',103268,103268,103268,103268,103268,103268,103268,103268,103268,103268); insert into DADOS_BRUTOS_CAPITAIS values (41,4106902,'7b',27324.28365,27324.28365,28525.77642,28525.77642,28525.77642,28525.77642,28525.77642,28525.77642,28525.77642,28525.77642); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'1a',2444849,2444849,2444849,2444849,2444849,2444849,2444849,2444849,2444849,2444849); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'1b',0,0,0,0,0,0,0,187760.7624,253924.1514,253924.1514); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'2a',251334,251334,251334,251334,251334,251334,251334,251334,251334,251334); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'3a',207593,207593,207593,207593,207593,207593,207593,207593,207593,207593); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'3b',0,0,0,0,0,0,0,17033.06244,20920.57406,20920.57406); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'4a',167849,167849,167849,167849,167849,167849,167849,167849,167849,167849); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'4b',0,0,0,0,0,0,0,17755.2886,22598.77948,22598.77948); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'5a',84307,84307,84307,84307,84307,84307,84307,84307,84307,84307); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'5b',0,0,0,0,0,0,0,5947.633383,13054.34643,13054.34643); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'6a',789989,789989,789989,789989,789989,789989,789989,789989,789989,789989); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'6b',0,0,0,0,0,0,0,59052.87067,76805.69916,76805.69916); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'7a',199024,199024,199024,199024,199024,199024,199024,199024,199024,199024); insert into DADOS_BRUTOS_CAPITAIS values (23,2304400,'7b',0,0,0,0,0,0,0,16146.29216,20269.29754,20269.29754); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'1a',1530272,1530272,1530272,1530272,1530272,1530272,1530272,1530272,1530272,1530272); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'1b',153146.9195,153146.9195,153146.9195,156522.1917,266032.1803,268071.2118,268071.2118,270654.6709,270654.6709,270654.6709); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'2a',163773,163773,163773,163773,163773,163773,163773,163773,163773,163773); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'2b',17148.27683,17148.27683,17148.27683,17592.85736,26676.47648,26960.94897,26960.94897,27013.88913,27013.88913,27013.88913); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'3a',119220,119220,119220,119220,119220,119220,119220,119220,119220,119220); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'3b',13457.98852,13457.98852,13457.98852,13833.12732,21872.8221,22004.48957,22004.48957,22071.38423,22071.38423,22071.38423); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'4a',107145,107145,107145,107145,107145,107145,107145,107145,107145,107145); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'4b',12447.92538,12447.92538,12447.92538,12612.0572,23250.66423,23365.79789,23365.79789,23584.36932,23584.36932,23584.36932); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'5a',80785,80785,80785,80785,80785,80785,80785,80785,80785,80785); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'5b',4391.569389,4391.569389,4391.569389,4404.713709,11734.07528,11778.68664,11778.68664,12294.25545,12294.25545,12294.25545); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'6a',464595,464595,464595,464595,464595,464595,464595,464595,464595,464595); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'6b',48055.31697,48055.31697,48055.31697,49220.87339,80178.68024,80826.82655,80826.82655,81272.789,81272.789,81272.789); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'7a',127110,127110,127110,127110,127110,127110,127110,127110,127110,127110); insert into DADOS_BRUTOS_CAPITAIS values (26,2611606,'7b',13987.4734,13987.4734,13987.4734,14263.55266,23233.92308 ,23414.94324,23414.94324,23488.41763,23488.41763,23488.41763); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'1a',6283486,6283486,6283486,6283486,6283486,6283486,6283486,6283486,6283486,6283486); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'1b',1391226.43,1391226.43,1537930.555,1576999.694,1954620.559,1954620.559,2172595.398,2176129.574,2098964.99,2101569.836); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'2a',397563,397563,397563,397563,397563,397563,397563,397563,397563,397563); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'2b',69090.54347,69090.54347,77342.25858,81196.21402,100738.5521,100738.5521,111365.3793,111457.5232,104854.3566,105060.25); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'3a',507158,507158,507158,507158,507158,507158,507158,507158,507158,507158); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'3b',92896.84067,92896.84067,101733.3975,105978.9285,134179.4216,134179.4216,146831.3866,147083.4703,139496.4134,139704.6601); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'4a',722972,722972,722972,722972,722972,722972,722972,722972,722972,722972); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'4b',172562.0041,172562.0041,184355.2247,187986.9579,236824.637,236824.637,254762.5882,255444.8713,247333.1946,247658.0836); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'5a',518091,518091,518091,518091,518091,518091,518091,518091,518091,518091); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'5b',179123.4012,179123.4012,199008.4942,199417.5493,230876.7504,230876.7504,271443.8904,271988.7073,269756.3836,269890.1953); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'6a',1575873,1575873,1575873,1575873,1575873,1575873,1575873,1575873,1575873,1575873); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'6b',300274.9427,300274.9427,329867.1415,342594.2149,433979.7433,433979.7433,470213.5627,470932.0398,447194.2396,447915.4812); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'7a',457350,457350,457350,457350,457350,457350,457350,457350,457350,457350); insert into DADOS_BRUTOS_CAPITAIS values (33,3304557,'7b',92745.95493,92745.95493,99974.62253,103307.5206,129886.0089,129886.0089,140917.4168,141252.754,134959.6288,135129.1713); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'1a',2664211,2664211,2664211,2664211,2664211,2664211,2664211,2664211,2664211,2664211); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'1b',0,0,0,0,47020.35018,90198.34718,90198.34718,133441.0612,134598.7569,134598.7569); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'2a',283437,283437,283437,283437,283437,283437,283437,283437,283437,283437); insert into DADOS_BRUTOS_CAPITAIS values (29,2927408,'2b',0,0,0,0,2731.114572,7198.410392,7198.410392,11006.03228,11163.07404,11163.07404); COMMIT; --SELECT * FROM DADOS_BRUTOS; --SELECT * FROM DADOS_BRUTOS_CAPITAIS; --SELECT * FROM MUNICIPIOS; --SELECT * FROM UNIDADES_FEDERACAO;
true
8cffcea7a49295662bc2864b951a65452bfac553
SQL
1chott/personal_data
/mysql/01课堂笔记.sql
UTF-8
8,192
4.0625
4
[]
no_license
-- 数据库的操作 -- 链接数据库 -- mysql -u用户名 -p密码 mysql -uroot -pmysql mysql -uroot -p -- 退出数据库 exit/quit/ctrl+d -- sql语句最后需要有分号;结尾 -- 显示数据库版本 -- select后面通常都是有() select version(); -- 显示时间 select now(); -- 查看所有数据库 show databases; -- 创建数据库 -- create database 数据库名 charset=utf8; create database xxx; create database school charset=utf8; -- 查看创建数据库的语句 -- show crate database .... show create database xxx; show create database school; --后面无需加编码语句 -- 查看当前使用的数据库 select database(); -- 使用数据库 -- use 数据库的名字 use school; -- 删除数据库 -- drop database 数据库名; drop database xxx; -- 数据表的操作 -- 查看当前数据库中所有表 show tables; -- 创建表的基本用法 -- auto_increment表示自动增长 -- not null 表示不能为空 -- primary key 表示主键 -- default 默认值 -- create table 数据表名字 (字段 类型 约束[, 字段 类型 约束]); -- create table students(字段的名字 类型 约束, 字段2的名字 类型 约束); create table classes( id int unsigned not null auto_increment primary key, name varchar(50) not null ); -- 查看表结构 -- desc 数据表的名字; desc classes; +-------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | name | varchar(50) | NO | | NULL | | +-------+------------------+------+-----+---------+----------------+ 2 rows in set (0.01 sec) -- 创建students表(id、name、age、high、gender、cls_id) create table students( id int unsigned not null auto_increment primary key, name varchar(50) not null default "张三", age tinyint unsigned not null default 18, high decimal(5,2) not null, gender enum("男", "女", "保密") default "保密", cls_id int unsigned not null ); +--------+----------------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+----------------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | name | varchar(50) | NO | | 张三 | | | age | tinyint(3) unsigned | NO | | 18 | | | high | decimal(5,2) | NO | | NULL | | | gender | enum('男','女','保密') | YES | | 保密 | | | cls_id | int(10) unsigned | NO | | NULL | | +--------+----------------------------+------+-----+---------+----------------+ 6 rows in set (0.00 sec) -- 插入一条数据到classes表中 insert into classes values(0, "基础班"); insert into classes values(0, "就业班"); -- 查询classes表中所有的数据 select * from classes; -- 插入一个数据到students表中 insert into students values(0, "mike", 18, 1.45, "保密", 2); -- 下面的错误的,"中信"不是枚举中的选项 insert into students values(0, "yoyo", 18, 1.45, "中信", 2); -- 枚举可以用数字代替,1->男 2->女 insert into students values(0, "yoyo", 18, 1.45, 2, 2); -- 查询students表中的所有数据 select * from students; -- 查看表的创建语句 -- show create table 表名字; show create table students; -- 修改表-添加字段 -- alter table 表名 add 列名 类型; alter table students add birth datetime; -- 修改表-修改字段:不重命名版 -- alter table 表名 modify 列名 类型及约束; alter table students modify birth date; -- 修改表-修改字段:重命名版 -- alter table 表名 change 原名 新名 类型及约束; alter table students change birth birthday date default "2020-01-01"; -- 修改表-删除字段 -- alter table 表名 drop 列名; alter table students drop cls_id; -- drop database 数据库名; drop database xxx; -- 删除表 -- drop table 表名 drop table skill; -- 增删改查(curd) +----------+----------------------------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+----------------------------+------+-----+------------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | name | varchar(50) | NO | | 张三 | | | age | tinyint(3) unsigned | NO | | 18 | | | high | decimal(5,2) | NO | | NULL | | | gender | enum('男','女','保密') | YES | | 保密 | | | birthday | date | YES | | 2020-01-01 | | +----------+----------------------------+------+-----+------------+----------------+ -- 增加 -- 全列插入 -- insert [into] 表名 values(...) -- 主键字段 可以用 0 null default 来占位 -- 向classes表中插入 一个班级 -- 向students表插入 一个学生信息 -- 全部都要写 insert into students values(null, "lily", 22, 178, 2, "1990-01-01"); -- 失败 -- insert into students values(default, "司马懿", 20, 201.1, "第4性别", "1990-02-01"); -- 枚举中 的 下标从1 开始 1---“男” 2--->"女".... -- 部分插入 -- insert into 表名(列1,...) values(值1,...) insert into students(high) values(180.1); -- 多行插入 insert into students(name, high) values("李四", 180.1), ("王五", 1.22); insert into students values(null, "lily", 22, 178, 2, "1990-01-01"), (null, "yyyy", 22, 178, 2, "1990-01-01"); -- 修改 -- update 表名 set 列1=值1,列2=值2... where 条件; update students set age=30; -- 全部的年龄 update students set age=18 where id=1; -- 查询基本使用 -- 查询所有列 -- select * from 表名; select * from students; ---定条件查询 select * from students where id=1; select * from students where id>=1 and id<=4; -- 查询指定列 -- select 列1,列2,... from 表名; select id, name from students where id>=1 and id<=4; select name, id from students where id>=1 and id<=4; -- 字段的顺序 -- 可以使用as为列或表指定别名 -- select 字段[as 别名] , 字段[as 别名] from 数据表 where ....; select name as 姓名, id as 学号 from students where id>=1 and id<=4; -- 删除 -- 物理删除 delete from students where id=6; -- 逻辑删除 -- 用一个字段来表示 这条信息是否已经不能再使用了 -- 给students表添加一个is_delete字段 bit 类型 alter table students add is_delete bit default 0; update students set is_delete=1 where id=1; create table xxx( id int unsigned not null auto_increment primary key, name varchar(30) default "aaaa" )
true
c4fe457faaea2d35e5d7526c57fbc4ebb2a0c86b
SQL
pskowronek90/twitter
/db/tweets.sql
UTF-8
199
3.125
3
[]
no_license
CREATE TABLE Tweets ( tweet_id int(11) NOT NULL, user_id int(11) NOT NULL, text text NOT NULL, creationDate datetime, PRIMARY KEY (comm_id), FOREIGN KEY (user_id) REFERENCES Users (id) );
true
c061fbb909d446fcb981828e398061e88e957b57
SQL
salimtaiyo/connect
/db/seeds.sql
UTF-8
2,115
3.4375
3
[]
no_license
DROP TABLE IF EXISTS howto CASCADE; DROP TABLE IF EXISTS users CASCADE; -- table for the web CREATE TABLE howto( id SERIAL PRIMARY KEY, name VARCHAR, description TEXT, direction TEXT); -- table for user authentication CREATE TABLE users ( id SERIAL PRIMARY KEY, uname VARCHAR NOT NULL, email VARCHAR NOT NULL, password VARCHAR ); INSERT INTO howto (name, description, direction) VALUES ('Survived lung cancer', 'Willy Boss', 'I was diangosed with cancer about 4 years ago. I was down and depressed. I didnt want to get outta bed but I realized the sadder I got the worse I got. I decided to get up, cheerup and here I am father of 2 and happy. There is hope, hang in there mate'), ('Hip and back problem at 20', 'Kim B. Hiamasu', 'I was in pain everyday of my life, I had this when I was just 20 so I was really down. My gf left me and my dog too. I had nobody but I realized a lot of the healing first takes up in the mind. I decided to start exercising and I started thinking positive. Now, I am 23, STRONG and with the Hottest girl ever'), ('Blood cancer', 'Niamasu Katagiri', 'I had blood cancer and I was ready to die, but someone one day told me about staying positive and I gave that a chance, Now I am healthy. You might be going through dark tunnel in life, what I want you to know is that there is an exit, the tunnel might be a little dark and long but stay strong, you will eventually get out of it'), ('Scoloisis', 'A kelly', 'Had scolosis my body was bent like a banana but I decided to stay strong and exercise. I am good today.'), ('Depression', 'Alume Alala', 'I thought of dying every single day, I just didnt want to live. All of the things that happened to me in my life were painful. Raised in an orphange, I didnt expereince a lot of love. I came to realize we have to change the way we think and today I am living.#staystrong'), ('sciatica', 'KP Malhotra', 'I couldnt move, everything was painfull, the doctors werent helpful. So I decided to help myself and today I am great'); INSERT INTO users (uname,email,password) VALUES ('shalom', 'ichigeki.ccCsc@hotmail.com', 'shalom21');
true
60b85861c62452103fa2a8f3a35506339b53b970
SQL
Kosov234/University
/Data Bases Foundation/TASKS10_FINAL.sql
UTF-8
2,561
4.0625
4
[]
no_license
--1 -- INSERT INTO employees (emp_id,surname,name,job,boss_id,hire_date,salary,add_salary,dept_id) -- VALUES(300,'Jack','Snow','PROFESSOR',100,'2013-05-01',4750,NULL,30), -- (310,'Robin','Cook','PROFESSOR',100,'2016-09-15',3500,1250,40), -- (320,'Francis','Dormand','ASSISTANT',110,'2018-01-01',3900,NULL,40); -- SELECT * FROM employees --2 -- INSERT INTO departments -- VALUES(70,'DATABASE SYSTEMS'); -- SELECT * FROM DEPARTMENTS -- WHERE dept_name = 'DATABASE SYSTEMS' --3 -- UPDATE employees -- SET dept_id = 70 -- WHERE emp_id >= 300; -- SELECT * FROM employees -- WHERE emp_id >= 300 -- 4 -- Update employees -- Set salary = salary * 1.1, -- add_salary = (Case -- when add_salary is null then 100 -- else add_salary*1.2 -- end) -- where dept_id=70; -- Select surname, name, salary, add_salary from employees -- where dept_id = (Select dept_id -- from departments -- where dept_name = 'DATABASE SYSTEMS') -- order by surname; --5 -- DELETE FROM departments -- WHERE dept_name = 'DATABASE SYSTEMS' --We cannot delete DATABASE SYSTEMS department because there are still employees working in it --6 -- DELETE FROM employees -- WHERE salary < 5000 AND dept_id = 70; -- UPDATE employees -- SET dept_id = NULL -- WHERE dept_id = (SELECT dept_id from departments WHERE dept_name LIKE 'DATABASE SYSTEMS'); -- SELECT * FROM employees --7 -- DELETE FROM departments -- WHERE dept_name = 'DATABASE SYSTEMS'; -- SELECT * FROM departments --8 -- WITH -- avg_salary(dept_id, raise) AS (SELECT dept_id, AVG(salary) FROM employees GROUP BY dept_id) -- SELECT surname, salary, -- Round(CASE -- WHEN employees.dept_id is null then 0 -- ELSE raise*0.1 -- END,2) -- AS raise FROM employees -- LEFT JOIN avg_salary ON(avg_salary.dept_id = employees.dept_id) -- ORDER BY surname; --9 -- With -- avg_salary(dept_id, raise) AS (SELECT dept_id, AVG(salary) FROM employees GROUP BY dept_id) -- UPDATE employees e -- SET salary = -- CASE -- WHEN dept_id IS null THEN salary -- ELSE salary + (SELECT raise * 0.1 FROM avg_salary av_sal WHERE e.dept_id = av_sal.dept_id) -- END; -- Select surname,salary from employees order by surname; --10 -- DELETE FROM employees -- WHERE name = 'Jack' AND surname = 'Snow'; -- SELECT * FROM employees --Reset employees default salaries -- Update employees -- SET salary = 4750, -- add_salary = NULL -- WHERE emp_id = 300; -- Update employees -- SET salary = 3500, -- add_salary = 1250 -- WHERE emp_id = 310; -- Update employees -- SET salary = 3900, -- add_salary = NULL -- WHERE emp_id = 320;
true
d7c2e3bf060f46b4168b1cae3d44d2bf1d889cc2
SQL
jsonhyun/jdbc_study
/Scripts/data.sql
UTF-8
805
3.375
3
[]
no_license
-- department insert into department values (1,'영업', 8), (2,'기획', 10), (3,'개발', 9), (4,'총무', 7); -- employee insert into employee (empno, empname, title, manager, salary, dno) values (4377,'이성래','사장',null,5000000, 2), (3426,'박영권','과장',4377,3000000, 1), (1003,'조민희','과장',4377,3000000, 2), (3011,'이수민','부장',4377,4000000, 3), (1365,'김상원','사원',3426,1500000, 1), (2106,'김창섭','대리',1003,2500000, 2), (3427,'최종철','사원',3011,1500000, 3); drop procedure if exists native_jdbc_study.procedure_01; delimiter $$ $$ create procedure native_jdbc_study.procedure_01( in in_dno int ) begin select empno, empname, title, manager, salary, dno from employee where dno = in_dno; end$$ delimiter ;
true
0edad0b6aa4b63c87b31cb437b297505e1f2bb87
SQL
DataViva/dataviva-etl
/datasus/cnes/estabelecimentos/select/SELECT_ESTAB_2009.sql
UTF-8
12,495
2.96875
3
[]
no_license
-- Select estab_2009 use cnes_estabelecimentos; -- STEP 1: Criando a tabela com as variávies selecionadas: create table ESTAB_2009_STEP1 select cnes, codufmun, cod_cep, cpf_cnpj, pf_pj, niv_dep, cnpj_man, regsaude, vinc_sus, esfera_a, retencao, tp_unid, niv_hier, tp_prest, nivate_a, gesprg1e, gesprg1m, gesprg2e, gesprg2m, gesprg4e, gesprg4m, gesprg3e, gesprg3m, gesprg5e, gesprg5m, gesprg6e, gesprg6m, nivate_h, qtleitp1, qtleitp2, qtleitp3, qtinst01, qtinst02, qtinst03, qtinst04, qtinst05, qtinst06, qtinst07, qtinst08, qtinst09, qtinst10, qtinst11, qtinst12, qtinst13, qtinst14, urgemerg, qtinst15, qtinst16, qtinst17, qtinst18, qtinst19, qtinst20, qtinst21, qtinst22, qtinst23, qtinst24, qtinst25, qtinst26, qtinst27, qtinst28, qtinst29, qtinst30, atendamb, qtinst31, qtinst32, qtinst33, centrcir, qtinst34, qtinst35, qtinst36, qtinst37, centrobs, qtleit05, qtleit06, qtleit07, qtleit08, qtleit09, qtleit19, qtleit20, qtleit21, qtleit22, qtleit23, qtleit32, qtleit34, qtleit38, qtleit39, qtleit40, centrneo, atendhos, coletres, ap01cv01, ap01cv02, ap01cv05, ap01cv06, ap02cv01, ap02cv02, ap02cv05, ap02cv06, ap03cv01, ap03cv02, ap03cv05, ap03cv06, ap04cv01, ap04cv02, ap04cv05, ap04cv06, competen from estab_2009; -- STEP 2: Transformação e Padronização das variáveis selecionadas no STEP 1: CREATE TABLE ESTAB_2009_STEP2 AS SELECT *, (qtinst02 + qtinst03 + qtinst04) AS qt_sala_atend_adulto_ue, (qtinst06 + qtinst07 + qtinst08) AS qt_sala_obs_adulto_ue, (qtinst19 + qtinst20 + qtinst22) AS qt_sala_rep_amb, (qtleit06 + qtleit07 + qtleit08) AS qt_leito_rep_ue, (qtleit19 + qtleit20 + qtleit22) AS qt_leito_rep_amb, (qtleit38 + qtleit39 + qtleit40) AS qt_leito_rn_nn, concat(gesprg1e, gesprg1m) AS atencaobasica_amb, concat(gesprg2e, gesprg2m) AS mediacomplexidade_amb, concat(gesprg4e, gesprg4m) AS altacomplexidade_amb, concat(gesprg3e, gesprg3m) AS internacao_hosp, concat(gesprg5e, gesprg5m) AS mediacomplexidade_hosp, concat(gesprg6e, gesprg6m) AS altacomplexidade_hosp, concat(ap01cv01, ap01cv02, ap01cv05, ap01cv06) as tipointernacao, concat(ap02cv01, ap02cv02, ap02cv05, ap02cv06) as tipodeambulatorio, concat(ap03cv01, ap03cv02, ap03cv05, ap03cv06) as tipodesadt, concat(ap04cv01, ap04cv02, ap04cv05, ap04cv06) as tipodeurgencia FROM ESTAB_2009_STEP1; /* Renomeando a variável MUNICIPIO */ alter table ESTAB_2009_STEP2 change codufmun codmun VARCHAR(6); /*Alterando codigos dos municipios satelites de Brasilia */ #conferir se as cidades foram substituidas update ESTAB_2009_STEP2 set codmun = if(codmun in('530020','530030','530040','530050','530060','530070', '530080','530090','530100','530110','530120','530130', '530135','530140','530150','530160','530170','530180'), '530010',codmun); /* Niv_dep substituir 5 por um 1 nos anos 2009 e 2009 */ /*create table niv_dep1( fonte varchar(1), niv_dep1 varchar(1) ); insert into niv_dep1 values('1','1'),('5','1'),('3','3');*/ alter table ESTAB_2009_STEP2 add niv_dep1 varchar(2); update ESTAB_2009_STEP2 left join niv_dep1 on ESTAB_2009_STEP2.niv_dep = niv_dep1.fonte set ESTAB_2009_STEP2.niv_dep1 = niv_dep1.niv_dep1; alter table ESTAB_2009_STEP2 drop niv_dep; /* Eliminar a variavel regsaude */ alter table ESTAB_2009_STEP2 drop regsaude; /* adicionar o regsaude */ /*create table regsaude( cod_regsaude varchar(5), municipio varchar(6) ); load data local infile 'Y:/Correspondencia_Classificacoes/regsaude.csv' into table regsaude fields terminated by ';' lines terminated by '\n' ignore 1 lines;*/ alter table ESTAB_2009_STEP2 add regsaude varchar(5); update ESTAB_2009_STEP2 left join regsaude on ESTAB_2009_STEP2.codmun = regsaude.municipio set ESTAB_2009_STEP2.regsaude = regsaude.cod_regsaude; /* Recodificando a variavel esfera_a */ /*create table esfera( esfera_a varchar(2), esfera varchar(2) ); insert into esfera values('01','01'),('02','02'),('03','03'),('04','04'),(' ','99'),(' ','99');*/ alter table ESTAB_2009_STEP2 add esfera varchar(2); update ESTAB_2009_STEP2 left join esfera on ESTAB_2009_STEP2.esfera_a = esfera.esfera_a set ESTAB_2009_STEP2.esfera = esfera.esfera; alter table ESTAB_2009_STEP2 drop esfera_a; /* Recodificando a variavel retenção */ /*create table retencao ( fonte varchar(2), retencao varchar(2) ); insert into retencao values ('10','10'),('11','11'),('12','12'),('13','13'),('14','14'),('15','15'),('16','16'),(' ','99'); */ alter table ESTAB_2009_STEP2 add retencao_2 varchar (2); update ESTAB_2009_STEP2 left join retencao on ESTAB_2009_STEP2.retencao = retencao.fonte set ESTAB_2009_STEP2.retencao_2 = retencao.retencao; select * from ESTAB_2009_STEP2 left join retencao on ESTAB_2009_STEP2.retencao = retencao.fonte; alter table ESTAB_2009_STEP2 drop retencao; /* Recodificando a variavel niv_hier */ /*create table niv_hier ( fonte varchar(2), niv_hier varchar(2) ); insert into niv_hier values ('01','01'),('02','02'),('03','03'),('04','04'),('05','05'),('06','06'),('07','07'),('08','08'), ('09','09'), (' ','99'), (' ','99');*/ alter table ESTAB_2009_STEP2 add niv_hier_2 varchar (2); update ESTAB_2009_STEP2 left join niv_hier on ESTAB_2009_STEP2.niv_hier = niv_hier.fonte set ESTAB_2009_STEP2.niv_hier_2 = niv_hier.niv_hier; select * from ESTAB_2009_STEP2 left join niv_hier on ESTAB_2009_STEP2.niv_hier = niv_hier .fonte; alter table ESTAB_2009_STEP2 drop niv_hier; /* renomear qtleitp1 p/ qt_leito_hosp_cirurg */ alter table ESTAB_2009_STEP2 change qtleitp1 qt_leito_hosp_cirurg int(4); /* renomear qtleitp2 p/ qt_leito_hosp_clin */ alter table ESTAB_2009_STEP2 change qtleitp2 qt_leito_hosp_clin int(4); /* renomear qtleitp3 p/ qt_leito_hosp_complex */ alter table ESTAB_2009_STEP2 change qtleitp3 qt_leito_hosp_complex int(4); /* renomear qtinst01 p/ qt_sala_pedi_ue */ alter table ESTAB_2009_STEP2 change qtinst01 qt_sala_pedi_ue int(4); /*apagar qtinst02, qtinst03, qtinst04 */ alter table ESTAB_2009_STEP2 drop qtinst02; alter table ESTAB_2009_STEP2 drop qtinst03; alter table ESTAB_2009_STEP2 drop qtinst04; /* renomear qtinst05 p/ qt_sala_rep_pedi_ue */ alter table ESTAB_2009_STEP2 change qtinst05 qt_sala_rep_pedi_ue int(4); /*apagar qtinst02, qtinst03, qtinst04 */ alter table ESTAB_2009_STEP2 drop qtinst06; alter table ESTAB_2009_STEP2 drop qtinst07; alter table ESTAB_2009_STEP2 drop qtinst08; /* renomear qtinst09 p/ qt_cons_odonto_ue */ alter table ESTAB_2009_STEP2 change qtinst09 qt_cons_odonto_ue int(4); /* renomear qtinst10 p/ qt_cons_higie_ue */ alter table ESTAB_2009_STEP2 change qtinst10 qt_sala_higie_ue int(4); /* renomear qtinst11 p/ qt_sala_gesso_ue */ alter table ESTAB_2009_STEP2 change qtinst11 qt_sala_gesso_ue int(4); /* renomear qtinst12 p/ qt_sala_curativo_ue */ alter table ESTAB_2009_STEP2 change qtinst12 qt_sala_curativo_ue int(4); /* renomear qtinst13 p/ qt_sala_peqcirur_ue */ alter table ESTAB_2009_STEP2 change qtinst13 qt_sala_peqcirur_ue int(4); /* renomear qtinst14 p/ qt_sala_consu_med_ue */ alter table ESTAB_2009_STEP2 change qtinst14 qt_sala_cons_med_ue int(4); /* renomear qtinst15 p/ qt_cons_clincbasica_amb */ alter table ESTAB_2009_STEP2 change qtinst15 qt_cons_clincbasica_amb int(4); /* renomear qtinst16 p/ qt_cons_clincesp_amb */ alter table ESTAB_2009_STEP2 change qtinst16 qt_cons_clincesp_amb int(4); /* renomear qtinst17 p/ qt_cons_clincind_amb */ alter table ESTAB_2009_STEP2 change qtinst17 qt_cons_clincind_amb int(4); /* renomear qtinst18 p/ qt_cons_nmed_amb */ alter table ESTAB_2009_STEP2 change qtinst18 qt_cons_nmed_amb int(4); /*apagar qtinst19, qtinst20, qtinst22 */ alter table ESTAB_2009_STEP2 drop qtinst19; alter table ESTAB_2009_STEP2 drop qtinst20; alter table ESTAB_2009_STEP2 drop qtinst22; /* renomear qtinst21 p/ qt_sala_rep_ped_amb */ alter table ESTAB_2009_STEP2 change qtinst21 qt_sala_rep_ped_amb int(4); /* renomear qtinst23 p/ qt_cons_odonto_amb */ alter table ESTAB_2009_STEP2 change qtinst23 qt_cons_odonto_amb int(4); /* renomear qtinst24 p/ qt_sala_peqcirur_amb */ alter table ESTAB_2009_STEP2 change qtinst24 qt_sala_peqcirur_amb int(4); /* renomear qtinst25 p/ qt_sala_enf_amb */ alter table ESTAB_2009_STEP2 change qtinst25 qt_sala_enf_amb int(4); /* renomear qtinst26 p/ qt_sala_imun_amb */ alter table ESTAB_2009_STEP2 change qtinst26 qt_sala_imun_amb int(4); /* renomear qtinst27 p/ qt_sala_nebu_amb */ alter table ESTAB_2009_STEP2 change qtinst27 qt_sala_nebu_amb int(4); /* renomear qtinst28 p/ qt_sala_gesso_amb */ alter table ESTAB_2009_STEP2 change qtinst28 qt_sala_gesso_amb int(4); /* renomear qtinst29 p/ qt_sala_cura_amb */ alter table ESTAB_2009_STEP2 change qtinst29 qt_sala_cura_amb int(4); /* renomear qtinst30 p/ qt_sala_ciruramb_amb */ alter table ESTAB_2009_STEP2 change qtinst30 qt_sala_ciruramb_amb int(4); /* renomear qtinst31 p/ qt_sala_cirur_cc */ alter table ESTAB_2009_STEP2 change qtinst31 qt_sala_cirur_cc int(4); /* renomear qtinst32 p/ qt_sala_recup_cc */ alter table ESTAB_2009_STEP2 change qtinst32 qt_sala_recup_cc int(4); /* renomear qtinst33 p/ qt_sala_ciruramb_cc */ alter table ESTAB_2009_STEP2 change qtinst33 qt_sala_ciruramb_cc int(4); /* renomear qtinst34 p/ qt_sala_preparto_co */ alter table ESTAB_2009_STEP2 change qtinst34 qt_sala_preparto_co int(4); /* renomear qtinst35 p/ qt_sala_partonor_co */ alter table ESTAB_2009_STEP2 change qtinst35 qt_sala_partonor_co int(4); /* renomear qtinst36 p/ qt_sala_curetagem_co */ alter table ESTAB_2009_STEP2 change qtinst36 qt_sala_curetagem_co int(4); /* renomear qtinst37 p/ qt_sala_cirur_co */ alter table ESTAB_2009_STEP2 change qtinst37 qt_sala_cirur_co int(4); /* renomear qtleit05 p/ qt_leito_rep_pedi_ue*/ alter table ESTAB_2009_STEP2 change qtleit05 qt_leito_rep_pedi_ue int(4); /*apagar qtleit06, qtleit07, qtleit08*/ alter table ESTAB_2009_STEP2 drop qtleit06; alter table ESTAB_2009_STEP2 drop qtleit07; alter table ESTAB_2009_STEP2 drop qtleit08; /* renomear qtleit09 p/ qt_equip_odonto_ue*/ alter table ESTAB_2009_STEP2 change qtleit09 qt_equip_odonto_ue int(4); /* renomear qtleit21 p/ qt_leito_rep_pedi_amb*/ alter table ESTAB_2009_STEP2 change qtleit21 qt_leito_rep_pedi_amb int(4); /*apagar qtleit19, qtleit20, qtleit22 */ alter table ESTAB_2009_STEP2 drop qtleit19; alter table ESTAB_2009_STEP2 drop qtleit20; alter table ESTAB_2009_STEP2 drop qtleit22; /* renomear qtleit23 p/ qt_equip_odonto_amb*/ alter table ESTAB_2009_STEP2 change qtleit23 qt_equip_odonto_amb int(4); /* renomear qtleit32 p/ qt_leito_recu_cc*/ alter table ESTAB_2009_STEP2 change qtleit32 qt_leito_recu_cc int(4); /* renomear qtleit34 p/ qt_leito_preparto_co*/ alter table ESTAB_2009_STEP2 change qtleit34 qt_leito_preparto_co int(4); /*apagar qtleit38, qtleit39, qtleit40 */ alter table ESTAB_2009_STEP2 drop qtleit38; alter table ESTAB_2009_STEP2 drop qtleit39; alter table ESTAB_2009_STEP2 drop qtleit40; /*apagar ap01cv01, ap01cv02, ap01cv05, ap01cv06, ap02cv01,ap02cv02, ap02cv05, ap02cv06,ap03cv01, ap03cv02, ap03cv05, ap03cv06, ap04cv01, ap04cv02, ap04cv05, ap04cv06 */ alter table ESTAB_2009_STEP2 drop ap01cv01; alter table ESTAB_2009_STEP2 drop ap01cv02; alter table ESTAB_2009_STEP2 drop ap01cv05; alter table ESTAB_2009_STEP2 drop ap01cv06; alter table ESTAB_2009_STEP2 drop ap02cv01; alter table ESTAB_2009_STEP2 drop ap02cv02; alter table ESTAB_2009_STEP2 drop ap02cv05; alter table ESTAB_2009_STEP2 drop ap02cv06; alter table ESTAB_2009_STEP2 drop ap03cv01; alter table ESTAB_2009_STEP2 drop ap03cv02; alter table ESTAB_2009_STEP2 drop ap03cv05; alter table ESTAB_2009_STEP2 drop ap03cv06; alter table ESTAB_2009_STEP2 drop ap04cv01; alter table ESTAB_2009_STEP2 drop ap04cv02; alter table ESTAB_2009_STEP2 drop ap04cv05; alter table ESTAB_2009_STEP2 drop ap04cv06; /*apagar gesprg1e, gesprg1m, gesprg2e, gesprg2m, gesprg4e, gesprg4m */ alter table ESTAB_2009_STEP2 drop gesprg1e; alter table ESTAB_2009_STEP2 drop gesprg1m; alter table ESTAB_2009_STEP2 drop gesprg2e; alter table ESTAB_2009_STEP2 drop gesprg2m; alter table ESTAB_2009_STEP2 drop gesprg4e; alter table ESTAB_2009_STEP2 drop gesprg4m; alter table ESTAB_2009_STEP2 drop gesprg3e; alter table ESTAB_2009_STEP2 drop gesprg3m; alter table ESTAB_2009_STEP2 drop gesprg5e; alter table ESTAB_2009_STEP2 drop gesprg5m; alter table ESTAB_2009_STEP2 drop gesprg6e; alter table ESTAB_2009_STEP2 drop gesprg6m; -- Criando tabela final - STEP3: create table ESTAB_2009_STEP3 select * from ESTAB_2009_STEP2;
true
0c36478d60776b255126408339a9470929afde5c
SQL
ayrahisham/database
/solution2.sql
WINDOWS-1252
2,490
3.734375
4
[]
no_license
SPOOL C:\Nur_Suhaira_5841549_A2\solution2Output; /* ============================================== Student Name: Nur Suhaira Student Number: 5841549 Description: Assignment 2 Task 2 Date written: 1st May 2018 ================================================ ====================Qn 2(a)=====================*/ -- The owner of the database would like to speed up -- the queries of information about patients. -- The information is retrieved through providing -- a patient name. -- Delete previous created index DROP INDEX P_INDEX; CREATE INDEX P_INDEX ON PATIENT(PNAME); --=================END OF Qn 2(a)================= --====================Qn 2(b)===================== -- The owner of the database would like to add -- to the database a gender of the patient. -- The values M and F must be used to indicate -- if a patient is male or female. -- Delete previously created gender column in patient ALTER TABLE PATIENT DROP COLUMN PGENDER; -- View patient table DESC PATIENT; -- Add gender column in patient table ALTER TABLE PATIENT ADD (PGender VARCHAR2(1)); ALTER TABLE PATIENT ADD CONSTRAINT check_pgender CHECK (PGENDER IN ('M', 'F')); -- View updated table DESC PATIENT; --=================END OF Qn 2(b)================= --====================Qn 2(c)===================== -- Delete previously created familypharmacist column in prescription ALTER TABLE PRESCRIPTION DROP COLUMN FAMILYPHARMACIST; -- Drop previously created table DROP TABLE PHARMACIST CASCADE CONSTRAINTS PURGE; -- Create a pharmacist table who dispenses -- prescribed drugs and relationship -- with the prescription CREATE TABLE PHARMACIST ( -- A pharmacist is described by name, addressed and a license number. PharLicenseNo VARCHAR2(10) NOT NULL, PharmacistName VARCHAR2(30), -- The license number uniquely identifies each pharmacist PharmacistAddress VARCHAR2(70), CONSTRAINT pharmacist_pk PRIMARY KEY (PharLicenseNo) ); -- A pharmacist may dispense many prescription, -- and each prescription is dispensed only by one pharmacist ALTER TABLE PRESCRIPTION ADD (FamilyPharmacist VARCHAR2(10)); ALTER TABLE PRESCRIPTION ADD CONSTRAINT pres_fk4 FOREIGN KEY (FamilyPharmacist) references PHARMACIST (PharLicenseNo); -- View pharmacist table DESC PHARMACIST; -- View prescription table DESC PRESCRIPTION; --=================END OF Qn 2(c)================= SPOOL OFF;
true
e4b776d7977ce0ea3b5041ff1c736b620bb79aee
SQL
nahmed23/git-github.com-Life-Time-Inc-database_udw
/ltdatabaseudw/marketing/Views/v_dim_spabiz_product.sql
UTF-8
2,663
2.671875
3
[]
no_license
CREATE VIEW [marketing].[v_dim_spabiz_product] AS select dim_spabiz_product.dim_spabiz_product_key dim_spabiz_product_key, dim_spabiz_product.product_id product_id, dim_spabiz_product.store_number store_number, dim_spabiz_product.avg_cost avg_cost, dim_spabiz_product.back_bar back_bar, dim_spabiz_product.category category, dim_spabiz_product.commission_mapping commission_mapping, dim_spabiz_product.cost cost, dim_spabiz_product.cost2 cost2, dim_spabiz_product.cost2_quantity cost2_quantity, dim_spabiz_product.created_date_time created_date_time, dim_spabiz_product.current_quantity current_quantity, dim_spabiz_product.deleted_date_time deleted_date_time, dim_spabiz_product.deleted_flag deleted_flag, dim_spabiz_product.dim_spabiz_category_key dim_spabiz_category_key, dim_spabiz_product.dim_spabiz_manufacturer_key dim_spabiz_manufacturer_key, dim_spabiz_product.dim_spabiz_staff_key dim_spabiz_staff_key, dim_spabiz_product.dim_spabiz_store_key dim_spabiz_store_key, dim_spabiz_product.dim_spabiz_sub_category_key dim_spabiz_sub_category_key, dim_spabiz_product.dim_spabiz_vendor_key dim_spabiz_vendor_key, dim_spabiz_product.economic_order_quantity economic_order_quantity, dim_spabiz_product.edit_date_time edit_date_time, dim_spabiz_product.gl_account gl_account, dim_spabiz_product.label_name label_name, dim_spabiz_product.last_count_date_time last_count_date_time, dim_spabiz_product.last_purchased_date_time last_purchased_date_time, dim_spabiz_product.last_sold_date_time last_sold_date_time, dim_spabiz_product.location location, dim_spabiz_product.manufacturer_code manufacturer_code, dim_spabiz_product.maximum_inventory_count maximum_inventory_count, dim_spabiz_product.minimum_inventory_count minimum_inventory_count, dim_spabiz_product.on_order on_order, dim_spabiz_product.p_spabiz_product_id p_spabiz_product_id, dim_spabiz_product.print_label_flag print_label_flag, dim_spabiz_product.print_on_ticket print_on_ticket, dim_spabiz_product.product_name product_name, dim_spabiz_product.product_type_dim_description_key product_type_dim_description_key, dim_spabiz_product.product_type_id product_type_id, dim_spabiz_product.quick_id quick_id, dim_spabiz_product.retail_price retail_price, dim_spabiz_product.segment segment, dim_spabiz_product.taxable_flag taxable_flag, dim_spabiz_product.vendor_code vendor_code from dbo.dim_spabiz_product;
true
27b5147cd0845e99284279b30dd2fa7655a06fc7
SQL
HighDeFing/ABDProyecto1
/Scripts/2_new.sql
UTF-8
13,935
3.09375
3
[]
no_license
CREATE TABLE tryndamere.batalla ( id VARCHAR2(30 BYTE) NOT NULL, usuario1 VARCHAR2(30 BYTE) NOT NULL, servidor1 VARCHAR2(4 BYTE) NOT NULL, mazo1 VARCHAR2(30 BYTE) NOT NULL, carta1 VARCHAR2(30 BYTE) NOT NULL, usuario2 VARCHAR2(30 BYTE) NOT NULL, servidor2 VARCHAR2(4 BYTE) NOT NULL, mazo2 VARCHAR2(30 BYTE) NOT NULL, carta2 VARCHAR2(30 BYTE) NOT NULL, ganador VARCHAR2(30 BYTE), puntos NUMBER(3) ) PCTFREE 10 PCTUSED 40 TABLESPACE repositorio_tablas LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NO INMEMORY; CREATE UNIQUE INDEX tryndamere.batalla_id_ind ON tryndamere.batalla ( id ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; ALTER TABLE tryndamere.batalla ADD CONSTRAINT id_batalla_pk PRIMARY KEY ( id ) USING INDEX tryndamere.batalla_id_ind; CREATE TABLE tryndamere.carta ( id VARCHAR2(30 BYTE) NOT NULL, tipo VARCHAR2(50 BYTE), nombre VARCHAR2(50 BYTE), descripcion VARCHAR2(100 BYTE), mejora VARCHAR2(100 BYTE), region VARCHAR2(30 BYTE) NOT NULL, costo NUMBER(2), ataque NUMBER(3), vida NUMBER(3), rareza VARCHAR2(30 BYTE), efecto VARCHAR2(100 BYTE), palabra_clave VARCHAR2(30 BYTE) ) PCTFREE 10 PCTUSED 40 TABLESPACE repositorio_tablas LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NO INMEMORY; CREATE UNIQUE INDEX tryndamere.carta_id_ind ON tryndamere.carta ( id ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; CREATE INDEX tryndamere.carta_nombre_costo_ind ON tryndamere.carta ( nombre ASC, costo ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; ALTER TABLE tryndamere.carta ADD CONSTRAINT id_carta_pk PRIMARY KEY ( id ) USING INDEX tryndamere.carta_id_ind; CREATE TABLE tryndamere.division ( codigo VARCHAR2(5 BYTE) NOT NULL, nombre VARCHAR2(50 BYTE), descripcion VARCHAR2(50 BYTE) ) PCTFREE 10 PCTUSED 40 TABLESPACE repositorio_tablas LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NO INMEMORY; CREATE UNIQUE INDEX tryndamere.division_codigo_ind ON tryndamere.division ( codigo ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; CREATE INDEX tryndamere.ind_nombre_division ON tryndamere.division ( nombre ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; ALTER TABLE tryndamere.division ADD CONSTRAINT codigo_division_pk PRIMARY KEY ( codigo ) USING INDEX tryndamere.division_codigo_ind; CREATE TABLE tryndamere.invocador ( usuario VARCHAR2(30 BYTE) NOT NULL, servidor VARCHAR2(4 BYTE) NOT NULL, nombre_invocador VARCHAR2(50 BYTE), fecha_creacion DATE ) PCTFREE 10 PCTUSED 40 TABLESPACE repositorio_tablas LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NO INMEMORY; CREATE INDEX tryndamere.invocador_nombre_invocador_ind ON tryndamere.invocador ( nombre_invocador ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; CREATE UNIQUE INDEX tryndamere.invocador_usuario_servidor_ind ON tryndamere.invocador ( usuario ASC, servidor ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; ALTER TABLE tryndamere.invocador ADD CONSTRAINT usuario_servidor_invocador_pk PRIMARY KEY ( usuario, servidor ) USING INDEX tryndamere.invocador_usuario_servidor_ind; ALTER TABLE tryndamere.invocador ADD CONSTRAINT invocador__un UNIQUE ( nombre_invocador ); CREATE TABLE tryndamere.mazo ( id VARCHAR2(30 BYTE) NOT NULL, usuario VARCHAR2(30 BYTE) NOT NULL, servidor VARCHAR2(4 BYTE) NOT NULL, carta VARCHAR2(30 BYTE) NOT NULL, nombre VARCHAR2(50 BYTE), cantidad NUMBER(1) ) PCTFREE 10 PCTUSED 40 TABLESPACE repositorio_tablas LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NO INMEMORY; CREATE UNIQUE INDEX tryndamere.mazo_id_usuario_carta_ind ON tryndamere.mazo ( id ASC, usuario ASC, carta ASC, servidor ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; ALTER TABLE tryndamere.mazo ADD CONSTRAINT id_usuario_carta_mazo_pk PRIMARY KEY ( id, usuario, carta, servidor ) USING INDEX tryndamere.mazo_id_usuario_carta_ind; CREATE TABLE tryndamere.region ( nombre VARCHAR2(30 BYTE) NOT NULL, tipo_de_gobierno VARCHAR2(50 BYTE), nivel_de_tecnologia VARCHAR2(50 BYTE), tolerancia_a_la_magia VARCHAR2(50 BYTE), descripcion_ambiente VARCHAR2(50 BYTE) ) PCTFREE 10 PCTUSED 40 TABLESPACE repositorio_tablas LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NO INMEMORY; CREATE INDEX tryndamere.ind_tipo_de_gobierno_region ON tryndamere.region ( tipo_de_gobierno ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; CREATE UNIQUE INDEX tryndamere.region_nombre_ind ON tryndamere.region ( nombre ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; ALTER TABLE tryndamere.region ADD CONSTRAINT nombre_region_pk PRIMARY KEY ( nombre ) USING INDEX tryndamere.region_nombre_ind; CREATE TABLE tryndamere.rioter ( usuario VARCHAR2(30 BYTE) NOT NULL, servidor VARCHAR2(4 BYTE) NOT NULL, nombre_invocador VARCHAR2(50 BYTE), fecha_contrato_inicio DATE, fecha_contrato_fin DATE, salario NUMBER ) PCTFREE 10 PCTUSED 40 TABLESPACE repositorio_tablas LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NO INMEMORY; CREATE UNIQUE INDEX tryndamere.rioter_usuario_servidor_ind ON tryndamere.rioter ( usuario ASC, servidor ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; ALTER TABLE tryndamere.rioter ADD CONSTRAINT usuario_servidor_rioter_pk PRIMARY KEY ( usuario, servidor ) USING INDEX tryndamere.rioter_usuario_servidor_ind; CREATE TABLE tryndamere.servidor ( id VARCHAR2(4 BYTE) NOT NULL, nombre VARCHAR2(30 BYTE), inauguracion DATE, idiomas VARCHAR2(100 BYTE), ubicacion VARCHAR2(50 BYTE), ip VARCHAR2(50 BYTE) ) PCTFREE 10 PCTUSED 40 TABLESPACE repositorio_tablas LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NO INMEMORY; CREATE UNIQUE INDEX tryndamere.servidor_id_ind ON tryndamere.servidor ( id ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; ALTER TABLE tryndamere.servidor ADD CONSTRAINT id_servidor_pk PRIMARY KEY ( id ) USING INDEX tryndamere.servidor_id_ind; CREATE TABLE tryndamere.usuario ( id VARCHAR2(30 BYTE) NOT NULL, servidor VARCHAR2(4 BYTE) NOT NULL, correo VARCHAR2(50 BYTE), contrasena VARCHAR2(100 BYTE), nombre VARCHAR2(50 BYTE), apellido VARCHAR2(50 BYTE), telefono VARCHAR2(30 BYTE), fecha_nacimiento DATE, sexo CHAR(1 BYTE), division VARCHAR2(5 BYTE) NOT NULL, puntos NUMBER(3) ) PCTFREE 10 PCTUSED 40 TABLESPACE repositorio_tablas LOGGING STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) NO INMEMORY; CREATE INDEX tryndamere.ind_nombre_usuario ON tryndamere.usuario ( nombre ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; CREATE UNIQUE INDEX tryndamere.usuario_id_ind ON tryndamere.usuario ( id ASC, servidor ASC ) TABLESPACE repositorio_indices PCTFREE 10 STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING; ALTER TABLE tryndamere.usuario ADD CONSTRAINT id_servidor_usuario_pk PRIMARY KEY ( id, servidor ) USING INDEX tryndamere.usuario_id_ind; ALTER TABLE tryndamere.batalla ADD CONSTRAINT batalla_mazo_fk FOREIGN KEY ( mazo1, usuario1, carta1, servidor1 ) REFERENCES tryndamere.mazo ( id, usuario, carta, servidor ) NOT DEFERRABLE; ALTER TABLE tryndamere.batalla ADD CONSTRAINT batalla_mazo_fkv1 FOREIGN KEY ( mazo2, usuario2, carta2, servidor2 ) REFERENCES tryndamere.mazo ( id, usuario, carta, servidor ) NOT DEFERRABLE; ALTER TABLE tryndamere.carta ADD CONSTRAINT carta_region_fk FOREIGN KEY ( region ) REFERENCES tryndamere.region ( nombre ) NOT DEFERRABLE; ALTER TABLE tryndamere.invocador ADD CONSTRAINT invocador_rioter_fk FOREIGN KEY ( usuario, servidor ) REFERENCES tryndamere.rioter ( usuario, servidor ) NOT DEFERRABLE; ALTER TABLE tryndamere.mazo ADD CONSTRAINT mazo_carta_fk FOREIGN KEY ( carta ) REFERENCES tryndamere.carta ( id ) NOT DEFERRABLE; ALTER TABLE tryndamere.mazo ADD CONSTRAINT mazo_usuario_fk FOREIGN KEY ( usuario, servidor ) REFERENCES tryndamere.usuario ( id, servidor ) NOT DEFERRABLE; ALTER TABLE tryndamere.rioter ADD CONSTRAINT rioter_usuario_fk FOREIGN KEY ( usuario, servidor ) REFERENCES tryndamere.usuario ( id, servidor ) NOT DEFERRABLE; ALTER TABLE tryndamere.usuario ADD CONSTRAINT usuario_division_fk FOREIGN KEY ( division ) REFERENCES tryndamere.division ( codigo ) NOT DEFERRABLE; ALTER TABLE tryndamere.usuario ADD CONSTRAINT usuario_servidor_fk FOREIGN KEY ( servidor ) REFERENCES tryndamere.servidor ( id ) NOT DEFERRABLE;
true
685d3e1c7f1fdee5160f91d788954d41cf7f66bf
SQL
MaxNikollasSilvaSouza/GenerationBrasil
/SQL/Lista 2/Ex2.sql
UTF-8
2,040
3.59375
4
[]
no_license
create database db_pizzaria_legal; use db_pizzaria_legal; create table tb_pizza( id integer primary key not null auto_increment, sabor varchar(200), preco float, quantidade integer(6), ingredientes varchar(255), fk_idcat integer(6) ); create table tb_categoria( id integer primary key not null auto_increment, doces integer(25), salgada integer(25), frutos_mar integer(25), cod integer(1) ); alter table tb_pizza add foreign key (fk_idcat) references tb_categoria(id); insert into tb_categoria (doces, salgada, frutos_mar) values (2,5,1); insert into tb_categoria (doces, cod) values (2,1); insert into tb_categoria (salgada, cod) values (5,2); insert into tb_categoria (frutos_mar, cod) values (1,3); insert into tb_pizza(sabor,preco,quantidade,ingredientes,fk_idcat) values("Marguerita", 70.0,1,"Marguerita",2); insert into tb_pizza(sabor,preco,quantidade,ingredientes,fk_idcat) values("Calabresa", 25.0,1,"Calabresa na pizza",2); insert into tb_pizza(sabor,preco,quantidade,ingredientes,fk_idcat) values("Banana", 40.0,1,"Banana, canela e mussarela",1); insert into tb_pizza(sabor,preco,quantidade,ingredientes,fk_idcat) values("Asiatica", 35.0,1,"Algas marinhas e peixe",3); insert into tb_pizza(sabor,preco,quantidade,ingredientes,fk_idcat) values("Portuguesa", 48.0,1,"Marguerita",2); insert into tb_pizza(sabor,preco,quantidade,ingredientes,fk_idcat) values("Frango", 30.0,1,"Frango com catupiri",2); insert into tb_pizza(sabor,preco,quantidade,ingredientes,fk_idcat) values("Palmito", 40.0,1,"Palmito e mussarela",2); insert into tb_pizza(sabor,preco,quantidade,ingredientes,fk_idcat) values("Chocolate", 35.0,1,"Chocolate e mussarela",1); select * from tb_pizza where preco > 45; select * from tb_pizza where preco between 29 and 60; select * from tb_pizza where sabor like "%C%"; select * from tb_pizza inner join tb_categoria on tb_categoria.cod = tb_pizza.fk_idcat; select * from tb_pizza inner join tb_categoria on tb_categoria.cod = tb_pizza.fk_idcat and tb_categoria.cod = 2;
true
f641ebcca35f63ca846cdc24ff9f5e08742fa475
SQL
DCouncilCSU/Msu2u-Api
/msu2u-api/scripts/SQL Files/careTeams.sql
UTF-8
1,569
2.9375
3
[ "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.0.10deb1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 16, 2014 at 04:53 PM -- Server version: 5.5.37-0ubuntu0.14.04.1 -- PHP Version: 5.5.9-1ubuntu4 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 utf8 */; -- -- Database: `aii` -- -- -------------------------------------------------------- -- -- Table structure for table `careTeams` -- CREATE TABLE IF NOT EXISTS `careTeams` ( `CareTeamID` int(11) unsigned NOT NULL, `PatientID` int(11) unsigned NOT NULL, `OriginalFacilityID` int(11) unsigned NOT NULL, `CurrentPhaseID` int(11) unsigned NOT NULL, PRIMARY KEY (`CareTeamID`,`PatientID`,`OriginalFacilityID`,`CurrentPhaseID`), KEY `CareTeam_ibfk_1` (`OriginalFacilityID`), KEY `CareTeam_ibfk_2` (`PatientID`), KEY `CurrentPhaseID_idx` (`CurrentPhaseID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `careTeams` -- INSERT INTO `careTeams` (`CareTeamID`, `PatientID`, `OriginalFacilityID`, `CurrentPhaseID`) VALUES (1000, 1, 100, 4), (1001, 2, 100, 6), (1002, 3, 112, 2); /*!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 */;
true
0f1cc637218f93e8c3ba7e7d7725458df15864ac
SQL
jgarzonext/plsql-testing
/script_plsql/bd_iaxis/script/tables/ANURIESGOS_IR_ORDENES.sql
ISO-8859-1
2,071
3.0625
3
[]
no_license
-------------------------------------------------------- -- DDL for Table ANURIESGOS_IR_ORDENES -------------------------------------------------------- CREATE TABLE "AXIS"."ANURIESGOS_IR_ORDENES" ( "SSEGURO" NUMBER, "NRIESGO" NUMBER(6,0), "NMOVIMI" NUMBER(4,0), "CEMPRES" NUMBER(5,0), "SORDEN" NUMBER, "CNUEVA" NUMBER(1,0), "FALTA" DATE, "CUSUALT" VARCHAR2(32 BYTE), "FMODIFI" DATE, "CUSUMOD" VARCHAR2(32 BYTE) ) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE "AXIS" ; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."SSEGURO" IS 'Nmero consecutivo de seguro asignado automticamente'; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."NRIESGO" IS 'Nmero de riesgo'; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."NMOVIMI" IS 'Nmero de movimiento'; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."CEMPRES" IS 'Cdigo de empresa'; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."SORDEN" IS 'Nmero consecutivo de orden de inspeccin asignado automticamente'; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."CNUEVA" IS 'Indica si la orden es nueva para este seguro o no (1-0)'; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."FALTA" IS 'Fecha de alta'; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."CUSUALT" IS 'Usuario de alta'; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."FMODIFI" IS 'Fecha de modificacion'; COMMENT ON COLUMN "AXIS"."ANURIESGOS_IR_ORDENES"."CUSUMOD" IS 'Usuario de modificacion'; COMMENT ON TABLE "AXIS"."ANURIESGOS_IR_ORDENES" IS 'Tabla de datos de inspeccin de riesgo del riesgo (movimientos anulados)'; GRANT UPDATE ON "AXIS"."ANURIESGOS_IR_ORDENES" TO "R_AXIS"; GRANT SELECT ON "AXIS"."ANURIESGOS_IR_ORDENES" TO "R_AXIS"; GRANT INSERT ON "AXIS"."ANURIESGOS_IR_ORDENES" TO "R_AXIS"; GRANT DELETE ON "AXIS"."ANURIESGOS_IR_ORDENES" TO "R_AXIS"; GRANT SELECT ON "AXIS"."ANURIESGOS_IR_ORDENES" TO "CONF_DWH"; GRANT SELECT ON "AXIS"."ANURIESGOS_IR_ORDENES" TO "PROGRAMADORESCSI";
true
429038dd69bbb33b3d01ef65d8aa20a11f314d2f
SQL
Sistemium/ASA-SQS
/sql/sqs._init.sql
UTF-8
602
3.234375
3
[]
no_license
/* grant connect to sqs; grant dba to sqs; meta.createDbspace 'sqs'; meta.defineType 'sqs.queue:MEDIUM'; meta.defineType 'sqs.body:text'; meta.defineType 'sqs.isDelivered:BOOL'; meta.defineType 'sqs.lastError:int,,nullAble'; meta.defineEntity 'sqs.Msg', 'queue;body;isDelivered;lastError' ; meta.createTable 'sqs.Msg', 0, 1; create index XK_sqs_Msg_isDelivered_cts on sqs.Msg (isDelivered, cts); */ create or replace function sqs.post( url long varchar, headers long varchar, body text ) returns text url '!url' type 'HTTP:POST:application/json' header '!headers' ;
true
7f991ee84a9572ec33ab2708ee9eafbd9524c151
SQL
fduan0625/OTP-Tracking
/3c_otp_BIN_IBAN_attack_hourly.sql
UTF-8
810
2.828125
3
[]
no_license
INSERT OVERWRITE TABLE fduan.otp_dy_pmts_hourly PARTITION(event_utc_date,event_utc_hour) select pm.account_id ,pm.country_code ,pm.event_utc_ms_ts ,pm.processor_response ,pm.tmx_policy_score ,pm.card_type ,pm.mop_type ,pm.mop_institution as iban_bic ,pm.cc_bin_number ,pm.row_num ,dy.member_status ,dy.freetrial_t_f ,dy.visitor_device_id ,dy.device_esn ,dy.country ,dy.city ,dy.triggering_mop_mode ,dy.otp_trigger_utc_ms ,dy.otp_trigger_dateint ,dy.otp_phone_country_code ,dy.phone_country_mismatch ,dy.otp_success_signup ,pm.event_utc_date ,pm.event_utc_hour from fduan.otp_pmt_event_hourly pm left join fduan.otp_dy_journey dy on pm.account_id = dy.in_acct_id where event_utc_date between nf_dateadd(nf_dateint_today() , -1) and nf_dateint_today() ;
true
16d8c63059776f839a1671fb98689521a25ab06d
SQL
faisalachmaddwic29/AlgoritmaApriori
/db_dm.sql
UTF-8
3,234
2.9375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jan 02, 2017 at 05:38 PM -- Server version: 10.1.16-MariaDB -- PHP Version: 7.0.9 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: `db_dm` -- -- -------------------------------------------------------- -- -- Table structure for table `data` -- CREATE TABLE `data` ( `id` int(11) NOT NULL, `kd_barang` varchar(2) NOT NULL, `nm_barang` varchar(50) NOT NULL, `stok` int(11) NOT NULL, `hrg_beli` int(11) NOT NULL, `hrg_jual` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `data` -- INSERT INTO `data` (`id`, `kd_barang`, `nm_barang`, `stok`, `hrg_beli`, `hrg_jual`) VALUES (1, 'SP', 'Susu Putih', 90, 2000, 4000), (12, 'FL', 'Floridina', 80, 3000, 3500), (13, 'CL', 'Coca-Cola', 90, 3000, 4000), (14, 'KK', 'Kopi Kapal Api', 50, 7000, 9000), (16, 'RJ', 'Rokok Jarum', 45, 13000, 15000), (17, 'DL', 'Dunhill', 100, 20000, 50000), (18, 'TB', 'Tisu Basah', 100, 4000, 5000), (19, 'AQ', 'Aqua Galon', 20, 15000, 20000), (20, 'GL', 'Gelas looking', 20, 2000, 5000); -- -------------------------------------------------------- -- -- Table structure for table `datapenjualan` -- CREATE TABLE `datapenjualan` ( `id` int(11) NOT NULL, `kd_pembeli` varchar(2) NOT NULL, `nm_barang1` varchar(50) NOT NULL, `nm_barang2` varchar(50) NOT NULL, `nm_barang3` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `datapenjualan` -- INSERT INTO `datapenjualan` (`id`, `kd_pembeli`, `nm_barang1`, `nm_barang2`, `nm_barang3`) VALUES (2, 'A1', 'Susu Putih', 'Floridina', 'Kopi Kapal Api'), (3, 'A2', 'Susu Putih', 'Kopi Kapal Api', 'Coca-Cola'), (4, 'A3', 'Susu Putih', 'Kopi Kapal Api', 'Rokok Jarum'), (5, 'A4', 'Susu Putih', '', ''), (6, 'A5', 'Floridina', 'Kopi Kapal Api', 'Coca-Cola'), (7, 'A6', 'Floridina', 'Kopi Kapal Api', 'Rokok Jarum'), (8, 'A7', 'Floridina', '', ''), (9, 'A8', 'Coca-Cola', 'Kopi Kapal Api', 'Rokok Jarum'), (10, 'A9', 'Kopi Kapal Api', 'Rokok Jarum', ''), (11, 'B1', 'Rokok Jarum', '', ''), (12, 'A1', 'Aqua Galon', 'Rokok Jarum', 'Tisu Basah'), (13, 'B2', 'Dunhill', 'Rokok Jarum', 'Tisu Basah'), (14, 'B3', 'Gelas looking', 'Tisu Basah', 'Dunhill'); -- -- Indexes for dumped tables -- -- -- Indexes for table `data` -- ALTER TABLE `data` ADD PRIMARY KEY (`id`); -- -- Indexes for table `datapenjualan` -- ALTER TABLE `datapenjualan` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `data` -- ALTER TABLE `data` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- AUTO_INCREMENT for table `datapenjualan` -- ALTER TABLE `datapenjualan` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; /*!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 */;
true
98d5c562b10ea658039d1c97cec9f2ffa8c4f202
SQL
MarcoLunaGonzales/ifinanciero
/rrhh/rrhhedu.sql
UTF-8
25,504
3.109375
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : LOCAL XAMPP Source Server Version : 50505 Source Host : localhost:3307 Source Database : rrhhedu Target Server Type : MYSQL Target Server Version : 50505 File Encoding : 65001 Date: 2019-11-03 09:58:27 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `aguinaldos` -- ---------------------------- DROP TABLE IF EXISTS `aguinaldos`; --transaccion CREATE TABLE `aguinaldos` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `cod_gestion` int(11) DEFAULT NULL, `cod_mes` int(11) DEFAULT NULL, `descripcion` varchar(255) DEFAULT NULL, `cod_estadoplanilla` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of aguinaldos -- ---------------------------- -- ---------------------------- -- Table structure for `aguinaldo_personal_gestion` -- ---------------------------- DROP TABLE IF EXISTS `aguinaldo_personal_gestion`; --transaccion detalle CREATE TABLE `aguinaldo_personal_gestion` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `cod_aguinaldo` int(11) DEFAULT NULL, `cod_personal` int(11) DEFAULT NULL, `dias_trabajados` int(11) DEFAULT NULL, `meses_trabajados` int(11) DEFAULT NULL, `sueldo1` decimal(14,2) DEFAULT NULL, `sueldo2` decimal(14,2) DEFAULT NULL, `sueldo3` decimal(14,2) DEFAULT NULL, `sueldopromedio` decimal(14,2) DEFAULT NULL, `aguinaldo` decimal(14,2) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of aguinaldo_personal_gestion -- ---------------------------- -- ---------------------------- -- Table structure for `aportes_laborales` -- ---------------------------- DROP TABLE IF EXISTS `aportes_laborales`; --config CREATE TABLE `aportes_laborales` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `salario_minimo_nacional` double DEFAULT NULL, `cuenta_individual_vejez` double DEFAULT NULL, `seguro_invalidez` double DEFAULT NULL, `comision_afp` double DEFAULT NULL, `provivienda` double DEFAULT NULL, `iva` double DEFAULT NULL, `asa` double DEFAULT NULL, `aporte_nac_solidario_13` double DEFAULT NULL, `aporte_nac_solidario_25` double DEFAULT NULL, `aporte_nac_solidario_35` double DEFAULT NULL, `estado` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of aportes_laborales -- ---------------------------- -- ---------------------------- -- Table structure for `aportes_patronales` -- ---------------------------- DROP TABLE IF EXISTS `aportes_patronales`; --config CREATE TABLE `aportes_patronales` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `seguro_riesgo_profesional` double DEFAULT NULL, `provivienda` double DEFAULT NULL, `infocal` double DEFAULT NULL, `cns` double DEFAULT NULL, `aporte_patronal_solidario` double DEFAULT NULL, `estado` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of aportes_patronales -- ---------------------------- -- ---------------------------- -- Table structure for `areas` -- ---------------------------- DROP TABLE IF EXISTS `areas`; --#hecho CREATE TABLE `areas` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(255) DEFAULT NULL, `observaciones` varchar(1000) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of areas -- ---------------------------- INSERT INTO `areas` VALUES ('1', 'DIRECCION NACIONAL', 'DN', null, '1', '2019-11-03 09:48:28', null, '2019-11-03 09:53:53', null); INSERT INTO `areas` VALUES ('2', 'CERTIFICACION SISTEMAS', 'TCP', null, '1', '2019-11-03 09:48:43', null, '2019-11-03 09:48:45', null); INSERT INTO `areas` VALUES ('3', 'CERTIFICACION PRODUCTO', 'TCS', null, '1', '2019-11-03 09:49:26', null, '2019-11-03 09:49:26', null); INSERT INTO `areas` VALUES ('4', 'CAPACITACION', 'SEC', null, '1', '2019-11-03 09:49:43', null, '2019-11-03 09:49:45', null); INSERT INTO `areas` VALUES ('5', 'DIRECCION NACIONAL DE SERVICIOS', 'DNS', null, '1', '2019-11-03 09:49:57', null, '2019-11-03 09:49:59', null); INSERT INTO `areas` VALUES ('6', 'DIRECCION NACIONAL DE ADM Y FINANZAS', 'DNAF', null, '1', '2019-11-03 09:50:11', null, '2019-11-03 09:50:11', null); INSERT INTO `areas` VALUES ('7', 'GESTION ESTRATEGICA', 'GES', null, '1', '2019-11-03 09:50:58', null, '2019-11-03 09:50:58', null); INSERT INTO `areas` VALUES ('8', 'ORGANISMO DE INSPECCION', 'OI', null, '1', '2019-11-03 09:53:36', null, '2019-11-03 09:53:48', null); -- ---------------------------- -- Table structure for `areas_organizacion` -- ---------------------------- DROP TABLE IF EXISTS `areas_organizacion`; --HECHO CREATE TABLE `areas_organizacion` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `cod_unidad` int(11) DEFAULT NULL,--unidades_organizacionales `cod_area` int(11) DEFAULT NULL, --areas `cod_areaorganizacion_padre` int(11) DEFAULT NULL, --misma `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of areas_organizacion -- ---------------------------- INSERT INTO `areas_organizacion` VALUES ('1', '1', '1', '1', '1', '2019-11-03 09:48:28', null, '2019-11-03 09:54:08', null); INSERT INTO `areas_organizacion` VALUES ('2', '1', '2', '1', '1', '2019-11-03 09:48:43', null, '2019-11-03 09:54:08', null); INSERT INTO `areas_organizacion` VALUES ('3', '1', '3', '1', '1', '2019-11-03 09:49:26', null, '2019-11-03 09:54:08', null); INSERT INTO `areas_organizacion` VALUES ('4', '1', '4', '1', '1', '2019-11-03 09:49:43', null, '2019-11-03 09:54:09', null); INSERT INTO `areas_organizacion` VALUES ('5', '1', '5', '1', '1', '2019-11-03 09:49:57', null, '2019-11-03 09:54:09', null); INSERT INTO `areas_organizacion` VALUES ('6', '1', '6', '1', '1', '2019-11-03 09:50:11', null, '2019-11-03 09:54:09', null); INSERT INTO `areas_organizacion` VALUES ('7', '1', '7', '1', '1', '2019-11-03 09:50:58', null, '2019-11-03 09:54:10', null); INSERT INTO `areas_organizacion` VALUES ('8', '1', '8', '1', '1', '2019-11-03 09:54:04', null, '2019-11-03 09:54:10', null); INSERT INTO `areas_organizacion` VALUES ('9', '2', '3', '5', '1', '2019-11-03 09:54:36', null, '2019-11-03 09:54:57', null); INSERT INTO `areas_organizacion` VALUES ('10', '2', '4', '5', '1', '2019-11-03 09:54:40', null, '2019-11-03 09:54:58', null); INSERT INTO `areas_organizacion` VALUES ('11', '2', '8', '5', '1', '2019-11-03 09:54:44', null, '2019-11-03 09:54:58', null); -- ---------------------------- -- Table structure for `bonos` -- ---------------------------- DROP TABLE IF EXISTS `bonos`; --transaccion CREATE TABLE `bonos` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(255) DEFAULT NULL, `observaciones` varchar(1000) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of bonos -- ---------------------------- -- ---------------------------- -- Table structure for `bonos_personal_mes` -- ---------------------------- DROP TABLE IF EXISTS `bonos_personal_mes`; --transaccion detalle CREATE TABLE `bonos_personal_mes` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `cod_bono` int(11) DEFAULT NULL, `cod_personalcargo` int(11) DEFAULT NULL, `cod_gestion` int(11) DEFAULT NULL, `cod_mes` int(11) DEFAULT NULL, `monto` decimal(14,2) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of bonos_personal_mes -- ---------------------------- -- ---------------------------- -- Table structure for `cargos` hecho -- ---------------------------- DROP TABLE IF EXISTS `cargos`; CREATE TABLE `cargos` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(50) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of cargos -- ---------------------------- INSERT INTO `cargos` VALUES ('1', 'DIRECTOR NACIONAL', 'DN', '1', '2019-11-03 09:57:32', null, '2019-11-03 09:57:32', null); INSERT INTO `cargos` VALUES ('2', 'JEFE GESTION ESTRATEGICA', 'JGES', '1', '2019-11-03 09:57:45', null, '2019-11-03 09:57:45', null); INSERT INTO `cargos` VALUES ('3', 'PROFESIONAL GESTION ESTRATEGICA', 'PGES', '1', '2019-11-03 09:57:55', null, '2019-11-03 09:58:04', null); INSERT INTO `cargos` VALUES ('4', 'JEFE DNAF', 'JDNAF', '1', '2019-11-03 09:58:02', null, '2019-11-03 09:58:05', null); INSERT INTO `cargos` VALUES ('5', 'DIRECTOR REGIGONAL', 'DR', '1', '2019-11-03 09:58:15', null, '2019-11-03 09:58:15', null); -- ---------------------------- -- Table structure for `descuentos` -----transaccion -- ---------------------------- DROP TABLE IF EXISTS `descuentos`; CREATE TABLE `descuentos` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(50) DEFAULT NULL, `observaciones` varchar(1000) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of descuentos -- ---------------------------- -- ---------------------------- -- Table structure for `descuento_personal_mes` -----transaccion -- ---------------------------- DROP TABLE IF EXISTS `descuento_personal_mes`; CREATE TABLE `descuento_personal_mes` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `codigo_descuento` int(11) DEFAULT NULL, `codigo_personalcargo` int(11) DEFAULT NULL, `gestionmes` int(11) DEFAULT NULL, `monto` decimal(14,2) DEFAULT NULL, `estado` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` varchar(500) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` varchar(500) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of descuento_personal_mes -- ---------------------------- -- ---------------------------- -- Table structure for `dotaciones` -----transaccion -- ---------------------------- DROP TABLE IF EXISTS `dotaciones`; CREATE TABLE `dotaciones` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(255) DEFAULT NULL, `descripcion` varchar(1000) DEFAULT NULL, `nro_meses` int(11) DEFAULT NULL, `fecha_inicio` date DEFAULT NULL, `fecha_fin` date DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of dotaciones -- ---------------------------- -- ---------------------------- -- Table structure for `dotaciones_personal_mes` -----transaccion -- ---------------------------- DROP TABLE IF EXISTS `dotaciones_personal_mes`; CREATE TABLE `dotaciones_personal_mes` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `cod_dotacion` int(11) DEFAULT NULL, `cod_personalcargo` int(11) DEFAULT NULL, `cod_gestion` int(11) DEFAULT NULL, `cod_mes` int(11) DEFAULT NULL, `monto` double(14,2) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of dotaciones_personal_mes -- ---------------------------- -- ---------------------------- -- Table structure for `estados_personal` -- ---------------------------- DROP TABLE IF EXISTS `estados_personal`; --hecho CREATE TABLE `estados_personal` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(50) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of estados_personal -- ---------------------------- INSERT INTO `estados_personal` VALUES ('1', 'ACTIVO', 'ACT', '1'); INSERT INTO `estados_personal` VALUES ('2', 'RETIRADO', 'RET', '1'); -- ---------------------------- -- Table structure for `estados_planilla` -- ---------------------------- DROP TABLE IF EXISTS `estados_planilla`; --hecho CREATE TABLE `estados_planilla` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(50) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of estados_planilla -- ---------------------------- INSERT INTO `estados_planilla` VALUES ('1', 'REGISTRADO', 'REG', '1'); INSERT INTO `estados_planilla` VALUES ('2', 'APROBADO', 'APRO', '1'); INSERT INTO `estados_planilla` VALUES ('3', 'CERRADO', 'CERRA', '1'); -- ---------------------------- -- Table structure for `personal` -- ---------------------------- DROP TABLE IF EXISTS `personal`; --haciendo CREATE TABLE `personal` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `ci` varchar(20) DEFAULT NULL, `ci_lugar_emision` varchar(2) DEFAULT NULL, `fecha_nacimiento` date DEFAULT NULL, `cod_cargo` int(11) DEFAULT NULL, `cod_unidadorganizacional` int(11) DEFAULT NULL, `cod_area` int(11) DEFAULT NULL, `jubilado` int(11) DEFAULT NULL,--1si, 0 no `cod_genero` int(11) DEFAULT NULL, `cod_tipopersonal` int(11) DEFAULT NULL, `haber_basico` double DEFAULT NULL, `paterno` varchar(100) DEFAULT NULL, `materno` varchar(100) DEFAULT NULL, `apellido_casada` varchar(100) DEFAULT NULL, `primer_nombre` varchar(100) DEFAULT NULL, `otros_nombres` varchar(100) DEFAULT NULL, `nua_cua_asignado` varchar(100) DEFAULT NULL, `direccion` varchar(1000) DEFAULT NULL, `cod_tipoafp` varchar(10) DEFAULT NULL, #prevision, bolivia `cod_tipoaporteafp` varchar(10) DEFAULT NULL, `nro_seguro` varchar(25) DEFAULT NULL, `cod_estadopersonal` int(11) DEFAULT NULL, `telefono` varchar(15) DEFAULT NULL, `celular` varchar(15) DEFAULT NULL, `email` varchar(100) DEFAULT NULL, `persona_contacto` varchar(250) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of personal -- ---------------------------- -- ---------------------------- -- Table structure for `personal_area_distribucion` -- ---------------------------- --esto gestina la distribucion del salario DROP TABLE IF EXISTS `personal_area_distribucion`; --detalle arriba CREATE TABLE `personal_area_distribucion` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `cod_personal` int(11) DEFAULT NULL, `cod_area` int(11) DEFAULT NULL, `porcentaje` double(5,3) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of personal_area_distribucion -- ---------------------------- -- ---------------------------- -- Table structure for `personal_cargos` -- ---------------------------- --apenas se cambie el cargo, el basico, o el area se inserta aca DROP TABLE IF EXISTS `personal_cargos`; --detalle arriba CREATE TABLE `personal_cargos` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `cod_personal` int(11) DEFAULT NULL, `cod_area` int(11) DEFAULT NULL, `cod_cargo` int(11) DEFAULT NULL, `fecha_inicio` date DEFAULT NULL, `fecha_fin` date DEFAULT NULL, `haber_basico` double DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of personal_cargos -- ---------------------------- -- ---------------------------- -- Table structure for `planillas` -- ---------------------------- DROP TABLE IF EXISTS `planillas`; --transaccion CREATE TABLE `planillas` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `cod_gestion` int(11) DEFAULT NULL, `cod_mes` int(11) DEFAULT NULL, `cod_estadoplanilla` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of planillas -- ---------------------------- -- ---------------------------- -- Table structure for `planillas_personal_mes` -- ---------------------------- DROP TABLE IF EXISTS `planillas_personal_mes`; --detalle transaccion CREATE TABLE `planillas_personal_mes` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `cod_planilla` int(11) DEFAULT NULL, `cod_personalcargo` int(11) DEFAULT NULL, `dias_trabajados` int(11) DEFAULT NULL, `horas_pagadas` int(11) DEFAULT NULL, `haber_basico` decimal(14,2) DEFAULT NULL, `bono_antiguedad` decimal(14,2) DEFAULT NULL, `horas_extra` decimal(14,2) DEFAULT NULL, `comisiones` decimal(14,2) DEFAULT NULL, ` monto_bonos` decimal(14,2) DEFAULT NULL, `total_ganado` decimal(14,2) DEFAULT NULL, `monto_descuentos` decimal(14,2) DEFAULT NULL, `otros_descuentos` decimal(14,2) DEFAULT NULL, `total_descuentos` decimal(14,2) DEFAULT NULL, `liquido_pagable` decimal(14,2) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- ---------------------------- ---------------------------- ---------------------------- ---------------------------- ---------------------------- ---------------------------- -- Records of planillas_personal_mes -- ---------------------------- ---------------------------- ---------------------------- ---------------------------- ---------------------------- ---------------------------- ---------------------------- -- ---------------------------- -- Table structure for `tipos_aporteafp` -- ---------------------------- DROP TABLE IF EXISTS `tipos_aporteafp`; --hecho CREATE TABLE `tipos_aporteafp` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` int(11) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `porcentaje_aporte` double DEFAULT NULL, `porcentaje_riesgoprofesional` double DEFAULT NULL, `porcentaje_provivienda` double DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for `tipos_afp` -- ---------------------------- DROP TABLE IF EXISTS `tipos_afp`; --hecho AQUI VA AFP PREVISION Y FUTURO; CREATE TABLE `tipos_afp`( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(50) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of tipos_aporteafp -- ---------------------------- -- ---------------------------- -- Table structure for `tipos_genero` -- ---------------------------- DROP TABLE IF EXISTS `tipos_genero`; --hecho CREATE TABLE `tipos_genero` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(50) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of tipos_genero -- ---------------------------- -- ---------------------------- -- Table structure for `tipos_personal` hecho -- ---------------------------- DROP TABLE IF EXISTS `tipos_personal`; CREATE TABLE `tipos_personal` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(50) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of tipos_personal -- ---------------------------- -- ---------------------------- -- Table structure for `unidades_organizacionales` HECHOOOOOO -- ---------------------------- DROP TABLE IF EXISTS `unidades_organizacionales`; CREATE TABLE `unidades_organizacionales` ( `codigo` int(11) NOT NULL AUTO_INCREMENT, `nombre` varchar(255) DEFAULT NULL, `abreviatura` varchar(255) DEFAULT NULL, `observaciones` varchar(1000) DEFAULT NULL, `cod_estadoreferencial` int(11) DEFAULT NULL, `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `created_by` int(11) DEFAULT NULL, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified_by` int(11) DEFAULT NULL, PRIMARY KEY (`codigo`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of unidades_organizacionales -- ---------------------------- INSERT INTO `unidades_organizacionales` VALUES ('1', 'DN - CENTRAL', 'DN', 'UNIDAD CENTRAL', '1', '2019-11-03 09:47:12', null, '2019-11-03 09:47:12', null); INSERT INTO `unidades_organizacionales` VALUES ('2', 'OF. LPZ', 'LPZ', 'LA PAZ', '1', '2019-11-03 09:47:22', null, '2019-11-03 09:47:22', null); INSERT INTO `unidades_organizacionales` VALUES ('3', 'OF SCZ', 'SCZ', 'SCZ', '1', '2019-11-03 09:47:31', null, '2019-11-03 09:47:31', null); INSERT INTO `unidades_organizacionales` VALUES ('4', 'OF CBBA', 'CBBA', 'CBBA', '1', '2019-11-03 09:47:40', null, '2019-11-03 09:47:40', null);
true
c9d59a7b187dfb5825c02663f2531936f1bedda4
SQL
Maurice-Goldberg/W5D3
/aa_questions/import_db.sql
UTF-8
2,722
3.953125
4
[]
no_license
DROP TABLE IF EXISTS question_likes; DROP TABLE IF EXISTS replies; DROP TABLE IF EXISTS question_follows; DROP TABLE IF EXISTS questions; DROP TABLE IF EXISTS users; PRAGMA foreign_keys = ON; CREATE TABLE users ( id INTEGER PRIMARY KEY, fname TEXT NOT NULL, lname TEXT NOT NULL ); CREATE TABLE questions ( id INTEGER PRIMARY KEY, title TEXT NOT NULL, body TEXT NOT NULL, author_id INTEGER NOT NULL, FOREIGN KEY (author_id) REFERENCES users(id) ); CREATE TABLE question_follows ( id INTEGER PRIMARY KEY, author_id INTEGER NOT NULL, question_id INTEGER NOT NULL, FOREIGN KEY (author_id) REFERENCES users(id), FOREIGN KEY (question_id) REFERENCES questions(id) ); CREATE TABLE replies ( id INTEGER PRIMARY KEY, question_id INTEGER NOT NULL, user_id INTEGER NOT NULL, parent_id INTEGER, body TEXT NOT NULL, FOREIGN KEY (question_id) REFERENCES questions(id), FOREIGN KEY (parent_id) REFERENCES replies(id), FOREIGN KEY (user_id) REFERENCES users(id) ); CREATE TABLE question_likes ( id INTEGER PRIMARY KEY, user_id INTEGER NOT NULL, question_id INTEGER NOT NULL, likes INTEGER NOT NULL, FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (question_id) REFERENCES questions(id) ); INSERT INTO users (fname, lname) VALUES ('John', 'Doe'), ('Jane', 'The Virgin'); INSERT INTO questions (title, body, author_id) VALUES ('How to program?', 'Hey Jane, please teach me how to program!! Thanks :(', (SELECT id FROM users WHERE fname = 'John' AND lname = 'Doe' )); INSERT INTO question_follows (author_id, question_id) VALUES ( (SELECT id FROM users WHERE fname = 'John' AND lname = 'Doe'), (SELECT id FROM questions WHERE title = 'How to program?') ); INSERT INTO replies (question_id, user_id, parent_id, body) VALUES ( (SELECT id FROM questions WHERE title = 'How to program?'), (SELECT id FROM users WHERE fname = 'Jane' AND lname = 'The Virgin'), (NULL), ("Programming is about the mind, the body, and the soul...") ), ( (SELECT id FROM questions WHERE title = 'How to program?'), (SELECT id FROM users WHERE fname = 'Jane' AND lname = 'The Virgin'), (SELECT id FROM users WHERE fname = 'John' AND lname = 'Doe'), ("Thanks Jane!!!! :)") ); INSERT INTO question_likes (user_id, question_id, likes) VALUES ( (SELECT id FROM users WHERE fname = 'John' AND lname = 'Doe'), (SELECT id FROM questions WHERE title = 'How to program?'), (4) );
true
94240f1a495f337f759bc6767942594e55c4e4c7
SQL
vivicai/qss_doc
/07.系统开发/风险事件ETL/交易风险/盈利比例.sql
GB18030
1,742
4.125
4
[]
no_license
/** ӯ **/ INSERT INTO hub_fxsj ( bjsj, fxlb, fxzb, fxzbz, yuzhi, cce, jgdm, jgmc, cust_id, khmc, ywcdbm, ywcdmc, ywlx, ywbm, fxsj_id, unit ) SELECT to_char( (SELECT now() :: TIMESTAMP), 'yyyyMMdd HH24:mm:ss' ) AS bjsj, --ʱ '׷' AS fxlb, -- 'ӯ' AS fxzb, --ָ zjzhdy.nums AS fxzbz, --ֵָ CASE WHEN zjzhdy.nums<=50 then 30 WHEN zjzhdy.nums >30 and zjzhdy.nums<=70 then 50 ELSE 70 end AS yuzhi, --ֵ CASE WHEN zjzhdy.nums<=50 then round((zjzhdy.nums::numeric-30) /30 * 100,2) WHEN zjzhdy.nums >50 and zjzhdy.nums<=70 then round((zjzhdy.nums::numeric-50) /50 * 100,2) ELSE round((zjzhdy.nums::numeric-70) /70 * 100,2) end AS cce, -- zjzhdy.jys AS jgdm, -- zjzhdy.jysmc AS jgmc, -- zjzhdy.cid AS cust_id, --ͻ zjzhdy.khxm AS khmc, --ͻ 'JYXX' AS ywcdbm, --ҵ˵ 'Ϣ' AS ywcdmc, --ҵ˵ 'ͻ' AS ywlx, --ҵ '' AS ywbm, --ҵ --(SELECT auto_gen_fxsj_id ('DZ')) AS fxsj_id, '' AS fxsj_id, -- '%' AS unit FROM ( SELECT x.cid,x.vday,COALESCE(y.fvalue/x.jrj,0) as nums,x.jys,x.jysmc,x.khxm from --𣨾 (SELECT cid,vday,(SELECT sum(fvalue2) from insight_in_out_amount a2 WHERE a2.vday<=a1.vday and a1.cid=a2.cid) as jrj,jys,jysmc,khxm FROM insight_in_out_amount a1 GROUP BY a1.cid,a1.vday,a1.jys,a1.jysmc,a1.khxm )x LEFT JOIN --տͻӯ (SELECT cid,vday,fvalue,jys,jysmc,khxm from insight_profit_loss_amount WHERE fvalue>0 )y on x.cid=y.cid and x.vday=y.vday ) zjzhdy where zjzhdy.nums>30
true
49a041c5267488b15bb6330dd1c652c56c7cb103
SQL
bolbadim/database
/MMF_2_9/upgrade/upgrade001/create_table_employee.sql
UTF-8
834
3.578125
4
[]
no_license
CREATE TABLE EMPLOYEE ( ID NUMBER GENERATED ALWAYS AS IDENTITY INCREMENT BY 1 START WITH 1 MINVALUE 1 NOT NULL, TEAM_ID NUMBER, DEPARTMENT_ID NUMBER, FIRSTNAME VARCHAR2(100) NOT NULL, PATRONYMIC VARCHAR2(100), LASTNAME VARCHAR2(100) NOT NULL, PHONE_NUBER VARCHAR2(350) ); COMMENT ON COLUMN EMPLOYEE.ID IS 'Unique value of the primary key for the table'; COMMENT ON COLUMN EMPLOYEE.TEAM_ID IS 'Id of team that employee belongs to'; COMMENT ON COLUMN EMPLOYEE.DEPARTMENT_ID IS 'Id of department that employee belongs to'; COMMENT ON COLUMN EMPLOYEE.FIRSTNAME IS 'Employee firstname'; COMMENT ON COLUMN EMPLOYEE.PATRONYMIC IS 'Employee patronymic, may be null in specific cases' ; COMMENT ON COLUMN EMPLOYEE.LASTNAME IS 'Employee lastname'; COMMENT ON COLUMN EMPLOYEE.PHONE_NUMBER IS 'Employee phone number';
true
705a8bef7adc53d351d6c002ad51a6db07ce2f9c
SQL
cdesmarais/WebDB-Test
/WebDB/StoredProcedures/Common/dbo.RestaurantOfferDiscountTypesGet.PRC
UTF-8
483
3.0625
3
[]
no_license
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RestaurantOfferDiscountTypesGet]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[RestaurantOfferDiscountTypesGet] GO --Gets the menu types based on user language CREATE PROCEDURE dbo.RestaurantOfferDiscountTypesGet AS select m.DiscountTypeID, m.DiscountName, m.IsDefault from dbo.RestaurantOfferDiscountType m GO GRANT EXECUTE ON [RestaurantOfferDiscountTypesGet] TO ExecuteOnlyRole GO
true
4575bb564df292a260f4dd49fa9445add7f4bbd1
SQL
rsbabcock/sql
/chinook/line_item_track_artist.sql
UTF-8
309
3.625
4
[]
no_license
-- Provide a query that includes the purchased track name -- AND artist name with each invoice line item. SELECT t.name, a.name, i.InvoiceLineId FROM Track t LEFT JOIN Album LEFT JOIN Artist a LEFT JOIN InvoiceLine i WHERE t.albumId = album.albumid AND album.artistId = a.artistId AND i.trackId = t.trackId
true
204de604bc8b3ef0087bd1aa75d90e57d3b3bc66
SQL
ginterez/lougehtravel
/lougehtravel.sql
UTF-8
8,460
2.96875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 15, 2019 at 07:50 AM -- Server version: 10.1.38-MariaDB -- PHP Version: 7.3.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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: `lougehtravel` -- -- -------------------------------------------------------- -- -- Table structure for table `destination` -- CREATE TABLE `destination` ( `destination_id` int(3) NOT NULL, `city` varchar(55) NOT NULL, `country` varchar(55) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `destination` -- INSERT INTO `destination` (`destination_id`, `city`, `country`) VALUES (1, 'General Santos City', 'Sweden'), (2, 'Davao City', 'Czech Republic'), (3, 'Datong', 'China'), (4, 'Tuanjie', 'China'), (5, 'MSU', 'Pakistan'), (6, 'Punta Alta', 'Argentina'), (7, 'San Borja', 'Bolivia'), (8, 'Bonpland', 'Argentina'), (9, 'Gavea', 'Brazil'), (10, 'Besuki', 'Indonesia'); -- -------------------------------------------------------- -- -- Table structure for table `groupdestination` -- CREATE TABLE `groupdestination` ( `group_id` int(3) NOT NULL, `year_travel` int(4) NOT NULL, `user_id` int(3) NOT NULL, `fullname` varchar(55) NOT NULL, `destination_id` int(3) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `groupdestination` -- INSERT INTO `groupdestination` (`group_id`, `year_travel`, `user_id`, `fullname`, `destination_id`) VALUES (1, 2018, 1, 'Jenni Meddings', 2), (1, 2018, 2, 'Petronia Andretti', 2), (1, 2018, 3, 'Anabelle Portal', 2), (1, 2018, 4, 'Kristoforo Dignum', 2), (1, 2018, 5, 'Shay Dumbare', 2), (1, 2018, 6, 'Bertrando Treharne', 2), (1, 2018, 7, 'Federica Habron', 2), (1, 2018, 8, 'Dela Stode', 2), (1, 2018, 9, 'Granville Wims', 2), (1, 2018, 10, 'Roscoe Oxlee', 2), (1, 2018, 11, 'Fabien Moreby', 2), (1, 2018, 12, 'Estrellita Perrin', 2), (1, 2018, 13, 'Laurie Jodlkowski', 2), (1, 2019, 11, 'Fabien Moreby', 5), (1, 2019, 12, 'Estrellita Perrin', 5), (1, 2019, 13, 'Laurie Jodlkowski', 5), (1, 2019, 14, 'Humbert Casone', 5), (1, 2019, 15, 'Nikola Walkowski', 5), (1, 2019, 16, 'Fletcher Duell', 5), (1, 2019, 17, 'Veronique Piechnik', 5), (1, 2019, 18, 'Agace Reiner', 5), (1, 2019, 19, 'Pietrek Tapsell', 5), (1, 2019, 20, 'Anette Schriren', 5); -- -------------------------------------------------------- -- -- Stand-in structure for view `groupdestinationsview` -- (See below for the actual view) -- CREATE TABLE `groupdestinationsview` ( `group_id` int(3) ,`group_name` varchar(55) ,`year_created` int(4) ,`year_travel` int(4) ,`destination_id` int(3) ,`city` varchar(55) ,`country` varchar(55) ); -- -------------------------------------------------------- -- -- Stand-in structure for view `groupdetailsview` -- (See below for the actual view) -- CREATE TABLE `groupdetailsview` ( `group_id` int(3) ,`group_name` varchar(55) ,`year_created` int(4) ,`year_travel` int(4) ,`user_id` int(3) ,`fullname` varchar(55) ,`destination_id` int(3) ,`city` varchar(55) ,`country` varchar(55) ); -- -------------------------------------------------------- -- -- Table structure for table `groups` -- CREATE TABLE `groups` ( `group_id` int(3) NOT NULL, `group_name` varchar(55) NOT NULL, `year_created` int(4) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `groups` -- INSERT INTO `groups` (`group_id`, `group_name`, `year_created`) VALUES (1, 'Vidoo', 2017), (2, 'Fivechat', 2017), (3, 'Jetpulse', 2018), (4, 'Voonyx', 2019), (5, 'Zoombox', 2019); -- -------------------------------------------------------- -- -- Table structure for table `person` -- CREATE TABLE `person` ( `user_id` int(3) NOT NULL, `fullname` varchar(55) NOT NULL, `age` int(2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `person` -- INSERT INTO `person` (`user_id`, `fullname`, `age`) VALUES (1, 'Jenni Meddings', 31), (2, 'Petronia Andretti', 34), (3, 'Anabelle Portal', 39), (4, 'Kristoforo Dignum', 36), (5, 'Shay Dumbare', 43), (6, 'Bertrando Treharne', 39), (7, 'Federica Habron', 45), (8, 'Dela Stode', 31), (9, 'Granville Wims', 38), (10, 'Roscoe Oxlee', 49), (11, 'Fabien Moreby', 38), (12, 'Estrellita Perrin', 42), (13, 'Laurie Jodlkowski', 41), (14, 'Humbert Casone', 50), (15, 'Nikola Walkowski', 43), (16, 'Fletcher Duell', 40), (17, 'Veronique Piechnik', 37), (18, 'Agace Reiner', 47), (19, 'Pietrek Tapsell', 37), (20, 'Anette Schriren', 37); -- -------------------------------------------------------- -- -- Stand-in structure for view `usergroups` -- (See below for the actual view) -- CREATE TABLE `usergroups` ( `group_id` int(3) ,`group_name` varchar(55) ,`year_travel` int(4) ,`user_id` int(3) ,`fullname` varchar(55) ,`city` varchar(55) ,`country` varchar(55) ); -- -------------------------------------------------------- -- -- Structure for view `groupdestinationsview` -- DROP TABLE IF EXISTS `groupdestinationsview`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `groupdestinationsview` AS select distinct `g`.`group_id` AS `group_id`,`g`.`group_name` AS `group_name`,`g`.`year_created` AS `year_created`,`gd`.`year_travel` AS `year_travel`,`gd`.`destination_id` AS `destination_id`,`d`.`city` AS `city`,`d`.`country` AS `country` from ((`groups` `g` join `groupdestination` `gd` on((`g`.`group_id` = `gd`.`group_id`))) join `destination` `d` on((`gd`.`destination_id` = `d`.`destination_id`))) ; -- -------------------------------------------------------- -- -- Structure for view `groupdetailsview` -- DROP TABLE IF EXISTS `groupdetailsview`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `groupdetailsview` AS select `g`.`group_id` AS `group_id`,`g`.`group_name` AS `group_name`,`g`.`year_created` AS `year_created`,`gd`.`year_travel` AS `year_travel`,`gd`.`user_id` AS `user_id`,`gd`.`fullname` AS `fullname`,`gd`.`destination_id` AS `destination_id`,`d`.`city` AS `city`,`d`.`country` AS `country` from ((`groups` `g` join `groupdestination` `gd` on((`g`.`group_id` = `gd`.`group_id`))) join `destination` `d` on((`gd`.`destination_id` = `d`.`destination_id`))) ; -- -------------------------------------------------------- -- -- Structure for view `usergroups` -- DROP TABLE IF EXISTS `usergroups`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `usergroups` AS select distinct `gd`.`group_id` AS `group_id`,`g`.`group_name` AS `group_name`,`gd`.`year_travel` AS `year_travel`,`gd`.`user_id` AS `user_id`,`gd`.`fullname` AS `fullname`,`d`.`city` AS `city`,`d`.`country` AS `country` from ((`groupdestination` `gd` left join `destination` `d` on((`gd`.`destination_id` = `d`.`destination_id`))) left join `groups` `g` on((`gd`.`group_id` = `g`.`group_id`))) ; -- -- Indexes for dumped tables -- -- -- Indexes for table `destination` -- ALTER TABLE `destination` ADD PRIMARY KEY (`destination_id`); -- -- Indexes for table `groupdestination` -- ALTER TABLE `groupdestination` ADD PRIMARY KEY (`group_id`,`year_travel`,`user_id`), ADD KEY `destination_id` (`destination_id`), ADD KEY `groupdestination_ibfk_2` (`user_id`); -- -- Indexes for table `groups` -- ALTER TABLE `groups` ADD PRIMARY KEY (`group_id`); -- -- Indexes for table `person` -- ALTER TABLE `person` ADD PRIMARY KEY (`user_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `destination` -- ALTER TABLE `destination` MODIFY `destination_id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `groups` -- ALTER TABLE `groups` MODIFY `group_id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `person` -- ALTER TABLE `person` MODIFY `user_id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- Constraints for dumped tables -- -- -- Constraints for table `groupdestination` -- ALTER TABLE `groupdestination` ADD CONSTRAINT `groupdestination_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON UPDATE CASCADE, ADD CONSTRAINT `groupdestination_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `person` (`user_id`) ON UPDATE CASCADE, ADD CONSTRAINT `groupdestination_ibfk_3` FOREIGN KEY (`destination_id`) REFERENCES `destination` (`destination_id`) ON UPDATE CASCADE; 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 */;
true
06cef0e3173f43a5342816578214303a37d0092d
SQL
vtirado73/agni
/database/migrations/20210503152123_create_table_completion_code.sql
UTF-8
363
2.84375
3
[]
no_license
-- migrate:up CREATE TABLE completion_codes ( id INT(11) NOT NULL AUTO_INCREMENT, uid VARCHAR(255) NOT NULL DEFAULT '', completion_code INT(255) NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; -- migrate:down DROP TABLE IF EXISTS completion_codes;
true
5101f9b540192031139e5f602613ff4ab55d56f0
SQL
DtLooker/Edu_System
/sql/edu_student.sql
UTF-8
1,125
2.921875
3
[]
no_license
-- ---------------------------- -- Table structure for `edu_student` -- ---------------------------- DROP TABLE IF EXISTS `edu_student`; CREATE TABLE `edu_student` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(40) NOT NULL DEFAULT '' COMMENT '姓名', `num` varchar(40) NOT NULL DEFAULT '', `sex` tinyint(2) NOT NULL DEFAULT '0', `klass_id` int(11) NOT NULL DEFAULT '0', `email` varchar(40) NOT NULL DEFAULT '', `create_time` int(11) NOT NULL DEFAULT '0', `update_time` int(11) NOT NULL DEFAULT '0', PRIMARY KEY(`id`) )ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of `edu_student` -- ---------------------------- INSERT INTO `edu_student` VALUES ('1', '徐琳杰', '111', '0', '1', 'xulinjie@yunzhiclub.com', '0', '0'), ('2', '魏静云', '112', '1', '2', 'weijingyun@yunzhiclub.com', '0', '0'), ('3', '刘茜', '113', '0', '2', 'liuxi@yunzhiclub.com', '0', '0'), ('4', '李甜', '114', '1', '1', 'litian@yunzhiclub.com', '0', '0'), ('5', '李翠彬', '115', '1', '3', 'licuibin@yunzhiclub.com', '0', '0'), ('6', '孔瑞平', '115', '0', '4', 'kongruiping@yunzhiclub.com', '0', '0');
true
4100ec3d1f4a9bb8a33f0b617d33f6680a623668
SQL
dmanolov/ITCareer
/6.Бази данни/04.4. Обединяване на заявки.SQL
UTF-8
1,609
4.03125
4
[]
no_license
use soft_uni; -- Problem 1. Служители и техните мениджъри (select first_name, last_name, ('(no manager)') as manager_name from employees where manager_id is null) union (select first_name, last_name, (select concat(first_name, " ", last_name) from employees where employee_id = e.manager_id) as manager_name from employees e where manager_id is not null order by manager_name); -- Problem 2. Тримата най-добре платени (select first_name, last_name, 'manager' as position, salary from employees where employee_id = any (select distinct manager_id from employees where manager_id is not null) order by salary desc limit 3) union (select first_name, last_name, 'employee' as position, salary from employees where employee_id not in (select distinct manager_id from employees where manager_id is not null) order by salary desc limit 3); -- Problem 3. Планините в България use geography; (select mountain_range, ( select peak_name from peaks where mountain_id = m.id order by elevation desc limit 1) as peak, ( select elevation from peaks where mountain_id = m.id order by elevation desc limit 1) as elevation from mountains m where id = any(select mountain_id from mountains_countries where country_code = 'BG') and id = any (select distinct mountain_id from peaks)) union (select mountain_range, 'no' as peak, 'info' as elevation from mountains m where id = any(select mountain_id from mountains_countries where country_code = 'BG') and id not in (select distinct mountain_id from peaks));
true
920650d55237c34b15fdcd6e96b422626a81c036
SQL
RizkiAuliaRamadhan/MyApp
/SI Kas/app_kas.sql
UTF-8
3,608
3.234375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 19 Des 2020 pada 07.38 -- Versi server: 10.4.13-MariaDB -- Versi PHP: 7.4.7 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: `app_kas` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `pemasukan` -- CREATE TABLE `pemasukan` ( `id_pemasukan` int(11) NOT NULL, `nominal` int(11) NOT NULL, `keterangan` varchar(255) NOT NULL, `tanggal_pemasukan` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `pemasukan` -- INSERT INTO `pemasukan` (`id_pemasukan`, `nominal`, `keterangan`, `tanggal_pemasukan`) VALUES (17, 500000, 'cek', '2020-01-01'), (18, 300000, 'cek', '2020-09-01'), (19, 300000, 'cek\r\n', '2020-02-04'), (21, 100000, 'cek', '2020-03-03'), (22, 900000, 'cek', '2020-10-01'), (23, 200000, 'cek', '2020-05-02'), (24, 200000, 'cek', '2020-04-11'), (25, 100000, 'cek', '2020-06-23'), (26, 50000, 'cek', '2020-07-31'), (27, 450000, 'cek', '2020-08-12'), (28, 100000, 'cek', '2020-12-14'), (29, 100000, 'cek', '2019-01-01'), (30, 200000, 'cek', '2018-01-01'); -- -------------------------------------------------------- -- -- Struktur dari tabel `pengeluaran` -- CREATE TABLE `pengeluaran` ( `id_pengeluaran` int(11) NOT NULL, `nominal` int(11) NOT NULL, `keterangan` varchar(255) NOT NULL, `tanggal_pengeluaran` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `pengeluaran` -- INSERT INTO `pengeluaran` (`id_pengeluaran`, `nominal`, `keterangan`, `tanggal_pengeluaran`) VALUES (1, 700000, 'cek', '2020-11-27'), (4, 200000, 'cek', '2020-12-01'), (5, 1000000, 'cek', '2020-12-04'), (6, 200000, 'cek', '2020-12-14'), (7, 100000, 'cek', '2019-01-01'); -- -------------------------------------------------------- -- -- Struktur dari tabel `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `username` varchar(50) NOT NULL, `password` varchar(255) NOT NULL, `level` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data untuk tabel `user` -- INSERT INTO `user` (`id`, `username`, `password`, `level`) VALUES (4, 'admin', '$2y$10$52tA3t9nfyffyPwL75LOvuXlvOYCLKKHomXlw2XYnnMEX58as5J/K', 'admin'), (18, 'rama', '$2y$10$OAiBkt22dBOrojti3QeAK.Dm9ojKzp5qTDS9wdHQwGUdIJNvdZc0S', 'user'), (20, 'user', '$2y$10$7Q6JgYh5WHxyJ2DvdDnkAeEKUlY0PL0dx/DTFJvX2IRbtN/vFDP8e', 'user'); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `pemasukan` -- ALTER TABLE `pemasukan` ADD PRIMARY KEY (`id_pemasukan`); -- -- Indeks untuk tabel `pengeluaran` -- ALTER TABLE `pengeluaran` ADD PRIMARY KEY (`id_pengeluaran`); -- -- Indeks untuk tabel `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT untuk tabel yang dibuang -- -- -- AUTO_INCREMENT untuk tabel `pemasukan` -- ALTER TABLE `pemasukan` MODIFY `id_pemasukan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31; -- -- AUTO_INCREMENT untuk tabel `pengeluaran` -- ALTER TABLE `pengeluaran` MODIFY `id_pengeluaran` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT untuk tabel `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; 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 */;
true
5caac1b31a0a88133f434e910334d3478e810305
SQL
hekun97/MIS
/App/schema.sql
UTF-8
2,311
3.8125
4
[]
no_license
-- 如果存在这些表就删除掉这些表格 DROP TABLE IF EXISTS user; DROP TABLE IF EXISTS team; DROP TABLE IF EXISTS department; DROP TABLE IF EXISTS position; DROP TABLE IF EXISTS leave; DROP TABLE IF EXISTS company; -- 员工信息表 CREATE TABLE user ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT UNIQUE NOT NULL, password TEXT NOT NULL, sex TEXT DEFAULT '男', email TEXT NOT NULL, tel INTEGER NOT NULL, level TEXT NOT NULL, money INTEGER NOT NULL, birthday TEXT NOT NULL, work_begin_day TEXT NOT NULL, team_id INTEGER, pt_id INTEGER, dp_id INTEGER ); -- 团队信息表 CREATE TABLE team ( id INTEGER PRIMARY KEY AUTOINCREMENT, team_name TEXT UNIQUE NOT NULL, team_describe TEXT NOT NULL ); -- 部门信息表 CREATE TABLE department ( id INTEGER PRIMARY KEY AUTOINCREMENT, dp_name TEXT UNIQUE NOT NULL, dp_describe TEXT NOT NULL ); -- 职位信息表 CREATE TABLE position ( id INTEGER PRIMARY KEY AUTOINCREMENT, pt_name TEXT UNIQUE NOT NULL, pt_describe TEXT NOT NULL ); -- 请假信息表 CREATE TABLE leave ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL, leave_name TEXT NOT NULL, begin_time TEXT NOT NULL, end_time TEXT NOT NULL, leave_time TEXT NOT NULL, leave_describe TEXT NOT NULL, allow_name TEXT DEFAULT '无', allow_level TEXT DEFAULT '未批复', not_allow_describe TEXT DEFAULT '无' ); -- 公司信息表 CREATE TABLE company( id INTEGER PRIMARY KEY AUTOINCREMENT, cp_title TEXT NOT NULL, cp_body TEXT NOT NULL, cp_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, author_id INTEGER, cp_level TEXT DEFAULT '普通内容' ); PRAGMA foreign_keys = ON; INSERT INTO user ( username, password, sex, email, tel, level, money, birthday, work_begin_day ) VALUES ( 'admin', 'pbkdf2:sha256:150000$WJZyFqb0$672ec7509564f6ba42ea4c0dc580cf6628d96f66aa63c201595c372b980c0af9', '男', 'hekun97@outlook.com', 18883681286, '管理员', 2000, '1997-12-12', '2016-09-01' ); INSERT INTO company (cp_title, cp_body, cp_level) VALUES ( '中小型人力资源管理系统', '欢迎使用中小型人力资源管理系统', '首页信息' ), ('公司介绍', '以下内容为公司的相关介绍', '更多信息');
true
4af9fc17161b9550396c9397725a437e71ac3408
SQL
dsharpminor/SQL
/LAB4/resources/8.sql
UTF-8
270
3.34375
3
[]
no_license
SELECT DISTINCT dbo.studenti.Nume_Student, dbo.studenti.Id_Student FROM dbo.studenti INNER JOIN dbo.studenti_reusita ON dbo.studenti.Id_Student = dbo.studenti_reusita.Id_Student WHERE (YEAR(dbo.studenti_reusita.Data_Evaluare) = 2018)
true
a151a6ee24c33ec748bebf8bf8a6278c5fad136b
SQL
CUBRID/cubrid-testcases
/sql/_13_issues/_12_2h/cases/bug_bts_8000.sql
UTF-8
1,720
4.40625
4
[ "BSD-3-Clause" ]
permissive
--TEST: [Merge Statement] When there is a trigger on the target table, the merge statement does not roll back while pk violation error occurs. --+ holdcas on; drop table if exists t1; drop table if exists t2; --server side create table t1(id int primary key, name varchar(20) not null); create table t2(id int, name varchar(20) unique); insert into t1 values(1,'aaa'), (2,'bbb'), (3, 'ccc'), (4, 'ddd'), (5, 'eee'); insert into t2 values(1,'George'),(2,'Laura'),(3,'Max'), (8, 'inserted'); --pk violation error merge into t1 using t2 on (t1.id=t2.id) when matched then update set t1.name='updated' when not matched then insert values(1, t2.name); select if(count(*)=0, 'ok', 'nok') from t1 where name='updated'; select if(count(*)=0, 'ok', 'nok') from t1 where name='inserted'; drop table t1, t2; --client side create table t1(id int primary key, name varchar(20) not null); create table t2(id int, name varchar(20) unique); insert into t1 values(1,'aaa'), (2,'bbb'), (3, 'ccc'), (4, 'ddd'), (5, 'eee'); insert into t2 values(1,'George'),(2,'Laura'),(3,'Max'), (8, 'inserted'); create table trigger_actions(id smallint auto_increment, info varchar); create trigger trigg1 before update on t1 execute insert into trigger_actions(info) values ('before update'); --pk violation error merge into t1 using t2 on (t1.id=t2.id) when matched then update set t1.name='updated' when not matched then insert values(1, t2.name); select if(count(*)=0, 'ok', 'nok') from t1 where name='updated'; select if(count(*)=0, 'ok', 'nok') from t1 where name='inserted'; select if(count(*)=0, 'ok', 'nok') from trigger_actions; drop trigger trigg1; drop table trigger_actions; drop table t1, t2; commit; --+ holdcas off;
true
3ce7599cca0a9ba9b2100d48abee3a936efb560b
SQL
felamaslen/go-music-player
/gmus-backend/migrations/000003_song_file_modified_date.up.sql
UTF-8
234
3.046875
3
[ "MIT" ]
permissive
ALTER TABLE songs ADD modified_date bigint; UPDATE songs SET modified_date = 0; ALTER TABLE songs ALTER COLUMN modified_date SET NOT NULL; CREATE UNIQUE INDEX songs_file_time_unique ON songs (base_path, relative_path, modified_date)
true
08b46afe9412950ab076c4ed3c56ee42b34a66c9
SQL
duwonders/fenye
/web.sql
UTF-8
1,766
2.65625
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : fuck Source Server Version : 50617 Source Host : localhost:3306 Source Database : web Target Server Type : MYSQL Target Server Version : 50617 File Encoding : 65001 Date: 2015-03-29 21:35:29 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `fenye` -- ---------------------------- DROP TABLE IF EXISTS `fenye`; CREATE TABLE `fenye` ( `id` int(11) NOT NULL AUTO_INCREMENT, ` name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of fenye -- ---------------------------- INSERT INTO `fenye` VALUES ('1', 'a'); INSERT INTO `fenye` VALUES ('2', 'b'); INSERT INTO `fenye` VALUES ('3', 'c'); INSERT INTO `fenye` VALUES ('4', 'd'); INSERT INTO `fenye` VALUES ('5', 'e'); INSERT INTO `fenye` VALUES ('6', 'f'); INSERT INTO `fenye` VALUES ('7', 'g'); INSERT INTO `fenye` VALUES ('8', 'h'); INSERT INTO `fenye` VALUES ('9', 'i'); INSERT INTO `fenye` VALUES ('10', 'j'); INSERT INTO `fenye` VALUES ('11', 'k'); INSERT INTO `fenye` VALUES ('12', 'l'); INSERT INTO `fenye` VALUES ('13', 'm'); INSERT INTO `fenye` VALUES ('14', 'n'); INSERT INTO `fenye` VALUES ('15', 'o'); INSERT INTO `fenye` VALUES ('16', 'p'); INSERT INTO `fenye` VALUES ('17', 'q'); INSERT INTO `fenye` VALUES ('18', 'r'); INSERT INTO `fenye` VALUES ('19', 's'); INSERT INTO `fenye` VALUES ('20', 't'); INSERT INTO `fenye` VALUES ('21', 'u'); INSERT INTO `fenye` VALUES ('22', 'v'); INSERT INTO `fenye` VALUES ('23', 'w'); INSERT INTO `fenye` VALUES ('24', 'x'); INSERT INTO `fenye` VALUES ('25', 'y'); INSERT INTO `fenye` VALUES ('26', 'z'); INSERT INTO `fenye` VALUES ('27', null);
true
5489d1acbc2d184c89a6b9b150696e98db3b4e36
SQL
NozimaJ/travel-ipproject
/db-backup.sql
UTF-8
5,748
3.125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.7.7 -- https://www.phpmyadmin.net/ -- -- Хост: 127.0.0.1:3306 -- Время создания: Май 06 2018 г., 12:24 -- Версия сервера: 5.7.20 -- Версия PHP: 7.2.0 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; 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 */; -- -- База данных: `tour` -- CREATE DATABASE IF NOT EXISTS `tour` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE `tour`; -- -------------------------------------------------------- -- -- Структура таблицы `hotel` -- CREATE TABLE `hotel` ( `id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `location` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `hotel` -- INSERT INTO `hotel` (`id`, `name`, `location`) VALUES (1, 'tashkent plaza', 'Yunusabad'), (2, 'Rodisson', 'A. Temur'); -- -------------------------------------------------------- -- -- Структура таблицы `migration` -- CREATE TABLE `migration` ( `version` varchar(180) NOT NULL, `apply_time` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `migration` -- INSERT INTO `migration` (`version`, `apply_time`) VALUES ('m000000_000000_base', 1525588319), ('m130524_201442_init', 1525588325); -- -------------------------------------------------------- -- -- Структура таблицы `request` -- CREATE TABLE `request` ( `id` int(11) NOT NULL, `full_name` varchar(255) NOT NULL, `email` varchar(50) NOT NULL, `phone` varchar(30) NOT NULL, `date_from` date NOT NULL, `date_to` date NOT NULL, `people_num` int(11) NOT NULL, `hotel_id` int(11) DEFAULT NULL, `transport_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `request` -- INSERT INTO `request` (`id`, `full_name`, `email`, `phone`, `date_from`, `date_to`, `people_num`, `hotel_id`, `transport_id`) VALUES (1, 'Nozima', 'gruppa1810@mail.ru', '+998974771810', '2014-05-18', '2017-05-18', 3, 1, 2), (2, '23123', 'gruppa1810@mail.ru', '+998974771810', '2018-05-31', '2018-05-25', 3, 1, 2); -- -------------------------------------------------------- -- -- Структура таблицы `transport` -- CREATE TABLE `transport` ( `id` int(11) NOT NULL, `name` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `transport` -- INSERT INTO `transport` (`id`, `name`) VALUES (2, 'train'); -- -------------------------------------------------------- -- -- Структура таблицы `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `status` smallint(6) NOT NULL DEFAULT '10', `created_at` int(11) NOT NULL, `updated_at` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Дамп данных таблицы `user` -- INSERT INTO `user` (`id`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES (1, 'nozima', 'QfTh84TuYijFL02QAT5IHStENzy7v3-z', '$2y$13$JR6jliMhN3SvXtP0OWp2tuCgmvtOMAgM75NXzcjWmXdNpf./1y79C', NULL, 'gruppa1810@mail.ru', 10, 1525588419, 1525588419); -- -- Индексы сохранённых таблиц -- -- -- Индексы таблицы `hotel` -- ALTER TABLE `hotel` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `migration` -- ALTER TABLE `migration` ADD PRIMARY KEY (`version`); -- -- Индексы таблицы `request` -- ALTER TABLE `request` ADD PRIMARY KEY (`id`), ADD KEY `hotel` (`hotel_id`), ADD KEY `transport` (`transport_id`); -- -- Индексы таблицы `transport` -- ALTER TABLE `transport` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username` (`username`), ADD UNIQUE KEY `email` (`email`), ADD UNIQUE KEY `password_reset_token` (`password_reset_token`); -- -- AUTO_INCREMENT для сохранённых таблиц -- -- -- AUTO_INCREMENT для таблицы `hotel` -- ALTER TABLE `hotel` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT для таблицы `request` -- ALTER TABLE `request` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT для таблицы `transport` -- ALTER TABLE `transport` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT для таблицы `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- Ограничения внешнего ключа сохраненных таблиц -- -- -- Ограничения внешнего ключа таблицы `request` -- ALTER TABLE `request` ADD CONSTRAINT `request_ibfk_1` FOREIGN KEY (`hotel_id`) REFERENCES `hotel` (`id`), ADD CONSTRAINT `request_ibfk_2` FOREIGN KEY (`transport_id`) REFERENCES `transport` (`id`); 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 */;
true
fe53aac574bbbcf245562175131a213edc1dc1fd
SQL
Sarah-Marie/sql-instruction
/bmddump202003.sql
UTF-8
3,759
3.265625
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.17, for Win64 (x86_64) -- -- Host: localhost Database: bmdb_db -- ------------------------------------------------------ -- Server version 8.0.17 /*!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 */; /*!50503 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!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 */; -- -- Table structure for table `actor` -- DROP TABLE IF EXISTS `actor`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `actor` ( `id` int(11) NOT NULL AUTO_INCREMENT, `firstName` varchar(25) NOT NULL, `lastName` varchar(25) NOT NULL, `gender` varchar(6) NOT NULL, `birthDate` date NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `actor` -- LOCK TABLES `actor` WRITE; /*!40000 ALTER TABLE `actor` DISABLE KEYS */; INSERT INTO `actor` VALUES (1,'Kristen','Bell','f','1980-07-18'),(2,'Mila','Kunis','f','1983-08-14'),(3,'Russell','Brand','m','1975-06-04'); /*!40000 ALTER TABLE `actor` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `credit` -- DROP TABLE IF EXISTS `credit`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `credit` ( `id` int(11) NOT NULL AUTO_INCREMENT, `actorID` int(11) NOT NULL, `movieID` int(11) NOT NULL, `role` varchar(25) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `credit` -- LOCK TABLES `credit` WRITE; /*!40000 ALTER TABLE `credit` DISABLE KEYS */; INSERT INTO `credit` VALUES (1,1,1,'actor'),(2,1,2,'actor'),(3,1,3,'actor'),(4,2,2,'actor'),(5,2,3,'actor'),(6,3,3,'actor'),(7,1,1,'actor'),(8,1,1,'Frozen'); /*!40000 ALTER TABLE `credit` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `movie` -- DROP TABLE IF EXISTS `movie`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `movie` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(100) NOT NULL, `year` int(11) NOT NULL, `rating` varchar(5) NOT NULL, `director` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `movie` -- LOCK TABLES `movie` WRITE; /*!40000 ALTER TABLE `movie` DISABLE KEYS */; INSERT INTO `movie` VALUES (1,'Frozen',2013,'PG','Chris Buck'),(2,'Jurrasic Park',1993,'PG13','Steven Spielberg'); /*!40000 ALTER TABLE `movie` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!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 */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2020-03-20 12:00:22
true
549f684cae94df0a311343f3676a92cd93e0058f
SQL
agasiueo/siamang
/database/siamang.sql
UTF-8
4,099
3.015625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 13, 2018 at 02:41 PM -- Server version: 10.1.21-MariaDB -- PHP Version: 7.1.1 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: `siamang` -- -- -------------------------------------------------------- -- -- Table structure for table `acara` -- CREATE TABLE `acara` ( `id_acara` int(11) NOT NULL, `nama_acara` varchar(50) NOT NULL, `gs` varchar(50) NOT NULL, `genre` varchar(50) NOT NULL, `lokasi` varchar(80) NOT NULL, `harga` varchar(20) NOT NULL, `tanggal` date NOT NULL, `deskripsi` varchar(300) NOT NULL, `rating` int(2) NOT NULL, `gambar` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `acara` -- INSERT INTO `acara` (`id_acara`, `nama_acara`, `gs`, `genre`, `lokasi`, `harga`, `tanggal`, `deskripsi`, `rating`, `gambar`) VALUES (22, 'Malang JAZZ Festival 2017', 'Sheila On 7, The Overtunes', 'jazz', 'LEMBAH DIENG', '90.000', '2017-10-07', 'Malang JAZZ Festival adalah acara tahunan untuk memberikan hiburan musik-musik jazz kepada masyarakat Malang.', 9, 'poster-malang-jazz.jpg'), (24, 'Flotus Festival 2018', 'Lingkar Atmosfer, Kangroo Project, MOP, Fourtwnty', 'pop', 'GRAHA CAKRAWALA', '35000', '2017-10-14', 'Bergoyang bersama', 8, '420.png'), (25, 'Nescafe Musik Asik', 'Yoda, Lyla, Yo!k!', 'pop', 'LEMBAH DIENG', '25000', '2018-06-11', 'Asiknya Musik di Malang yang asik', 8, 'nescafe.jpg'), (26, 'Radar Malang Music Versary', 'Sheila On 7', 'pop', 'GRAHA CAKRAWALA', 'Festival', '2018-05-10', 'Dilarang berisik, mari kita asik-asik', 9, 'poster1.jpg'), (28, '-', '-', 'jazz', 'LEMBAH DIENG', '-', '2018-06-22', '-', 7, 'poster3.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `komentar` -- CREATE TABLE `komentar` ( `id_komentar` int(20) NOT NULL, `id_acara` int(20) NOT NULL, `komentar` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id_admin` int(5) NOT NULL, `username` varchar(12) NOT NULL, `password` varchar(20) NOT NULL, `role` varchar(40) NOT NULL, `nama` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id_admin`, `username`, `password`, `role`, `nama`) VALUES (1, 'admin1', 'admin1', 'admin', 'admin1'), (2, 'user', 'user', 'user', 'user'), (3, 'indonesia', '17agustus', 'admin', 'admin2'), (4, 'a', 'langsungaja', 'admin3', 'admin3'); -- -- Indexes for dumped tables -- -- -- Indexes for table `acara` -- ALTER TABLE `acara` ADD PRIMARY KEY (`id_acara`); -- -- Indexes for table `komentar` -- ALTER TABLE `komentar` ADD PRIMARY KEY (`id_komentar`), ADD KEY `id_acara` (`id_acara`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id_admin`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `acara` -- ALTER TABLE `acara` MODIFY `id_acara` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29; -- -- AUTO_INCREMENT for table `komentar` -- ALTER TABLE `komentar` MODIFY `id_komentar` int(20) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id_admin` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- Constraints for dumped tables -- -- -- Constraints for table `komentar` -- ALTER TABLE `komentar` ADD CONSTRAINT `id_acara` FOREIGN KEY (`id_acara`) REFERENCES `acara` (`id_acara`) ON DELETE CASCADE ON UPDATE CASCADE; /*!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 */;
true
3c4b330b96c4c008ce36744d836e34eacf93f47d
SQL
mitali123/Towards-Mental-Wellness
/patient_3.sql
UTF-8
7,661
2.6875
3
[]
no_license
INSERT into patient values (3, "Srishti","123"); INSERT INTO medical_history values (3, 0); # first visit INSERT INTO visit values (1,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,1,4,1,1,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,11); INSERT INTO depression_assessment VALUES(null,3,20,20); INSERT INTO nutrition_test values(null,3,3,150,120); INSERT INTO substance_use_test values(null,3, 5,true); INSERT INTO physical_health_test VALUES (null,3,2,120,65,22,20,22,120); #CALL store_diagnosis(#patient_id,#visit_id) CALL store_diagnosis(3,1); CALL update_treatment_plan(3,1,@success); SELECT @success; # during next visit, first take feedback of previous visit #visit 2 SELECT depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, 'Arrhythmias'); INSERT INTO visit values (2,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,1,4,1,1,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,11); INSERT INTO depression_assessment VALUES(null,3,20,20); INSERT INTO nutrition_test values(null,3,3,150,120); INSERT INTO substance_use_test values(null,3, 5,true); INSERT INTO physical_health_test VALUES (null,3,2,120,65,22,20,22,120); #CALL store_diagnosis(#patient_id,#visit_id) CALL store_diagnosis(3,2); CALL update_treatment_plan(3,2,@success); SELECT @success; #visit 3 SELECT depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, 'Arrhythmias'); INSERT INTO visit values (3,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,1,4,1,1,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,11); INSERT INTO depression_assessment VALUES(null,3,20,20); INSERT INTO nutrition_test values(null,3,3,150,120); INSERT INTO substance_use_test values(null,3, 5,true); INSERT INTO physical_health_test VALUES (null,3,2,120,65,22,20,22,120); #CALL store_diagnosis(#patient_id,#visit_id) CALL store_diagnosis(3,3); CALL update_treatment_plan(3,3,@success); SELECT @success; # Visit 4 select depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, null); #id, patient id, details INSERT INTO visit values (4,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,1,4,1,1,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,11); INSERT INTO depression_assessment VALUES(null,3,20,20); INSERT INTO nutrition_test values(null,3,3,150,120); INSERT INTO substance_use_test values(null,3, 5,true); INSERT INTO physical_health_test VALUES (null,3,2,120,65,22,20,22,120); #CALL store_diagnosis(#patient_id,#visit_id) CALL store_diagnosis(3,4); CALL update_treatment_plan(3,4,@success); SELECT @success; #visit 5 select depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, null); INSERT INTO visit values (5,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,1,4,1,1,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,11); INSERT INTO depression_assessment VALUES(null,3,18,18); INSERT INTO nutrition_test values(null,3,3,150,120); INSERT INTO substance_use_test values(null,3, 5,true); INSERT INTO physical_health_test VALUES (null,3,2,110,63,25,22,21,127); CALL store_diagnosis(3,5); CALL update_treatment_plan(3,5,@success); SELECT @success; #visit 6 select depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, null); INSERT INTO visit values (6,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,1,4,1,1,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,11); INSERT INTO depression_assessment VALUES(null,3,16,16); INSERT INTO nutrition_test values(null,3,4,180,135); INSERT INTO substance_use_test values(null,3, 5,true); INSERT INTO physical_health_test VALUES (null,3,2,110,63,25,22,21,127); CALL store_diagnosis(3,6); CALL update_treatment_plan(3,6,@success); SELECT @success; #visit 7 select depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, null); INSERT INTO visit values (7,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,1,4,1,1,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,11); INSERT INTO depression_assessment VALUES(null,3,15,15); INSERT INTO nutrition_test values(null,3,4,180,135); INSERT INTO substance_use_test values(null,3, 5,true); INSERT INTO physical_health_test VALUES (null,3,2,101,63,25,22,21,127); CALL store_diagnosis(3,7); CALL update_treatment_plan(3,7,@success); SELECT @success; #visit 8 select depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, null); INSERT INTO visit values (8,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,0,3,0,0,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,13); INSERT INTO depression_assessment VALUES(null,3,11,11); INSERT INTO nutrition_test values(null,3,4,180,135); INSERT INTO substance_use_test values(null,3, 4,true); INSERT INTO physical_health_test VALUES (null,3,2,101,63,25,22,21,127); CALL store_diagnosis(3,8); CALL update_treatment_plan(3,8,@success); SELECT @success; #visit 9 select depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, null); INSERT INTO visit values (9,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,0,3,0,0,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,13); INSERT INTO depression_assessment VALUES(null,3,11,11); INSERT INTO nutrition_test values(null,3,4,180,135); INSERT INTO substance_use_test values(null,3, 4,true); INSERT INTO physical_health_test VALUES (null,3,2,95,63,25,22,21,127); CALL store_diagnosis(3,9); CALL update_treatment_plan(3,9,@success); SELECT @success; #visit 10 select depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, null ); INSERT INTO visit values (10,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,0,3,0,0,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,13); INSERT INTO depression_assessment VALUES(null,3,8,8); INSERT INTO nutrition_test values(null,3,6,210,144); INSERT INTO substance_use_test values(null,3, 4,true); INSERT INTO physical_health_test VALUES (null,3,2,95,63,25,22,21,127); CALL store_diagnosis(3,10); CALL update_treatment_plan(3,10,@success); SELECT @success; #visit 11 select depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, null); INSERT INTO visit values (11,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,0,3,0,0,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,13); INSERT INTO depression_assessment VALUES(null,3,6,6); INSERT INTO nutrition_test values(null,3,6,210,144); INSERT INTO substance_use_test values(null,3, 4,false); INSERT INTO physical_health_test VALUES (null,3,2,89,63,25,22,21,127); CALL store_diagnosis(3,11); CALL update_treatment_plan(3,11,@success); SELECT @success; #Visit 12 select depression_diagnosis_treatment_tool.patient_gives_feedback('Srishti', true, true, true, null); INSERT INTO visit values (12,3,"enter details here"); INSERT INTO mental_health_test VALUES (null,3,0,3,0,0,0); INSERT INTO seasonal_affective_disorder_test VALUES (null,3,13); INSERT INTO depression_assessment VALUES(null,3,1,1); #id , patient id, phq9_self_assessment_score, phq9_social_media_score INSERT INTO nutrition_test values(null,3,6,210,144); INSERT INTO substance_use_test values(null,3, 4,false); INSERT INTO physical_health_test VALUES (null,3,2,89,63,25,22,21,127); CALL store_diagnosis(3,12); CALL update_treatment_plan(3,12,@success); SELECT @success;
true
2fec175b10849f1d058d0db1260b70912fde3cd1
SQL
Zccc-c/StudentManagePro-master
/StudentManagePro-master/studentmanage - 副本.sql
UTF-8
2,460
3.421875
3
[]
no_license
/* SQLyog Ultimate v12.09 (64 bit) MySQL - 8.0.18 : Database - studentmanage ********************************************************************* */ /*!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*/`studentmanage` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; USE `studentmanage`; /*Table structure for table `login` */ DROP TABLE IF EXISTS `login`; CREATE TABLE `login` ( `username` varchar(20) NOT NULL, `email` varchar(50) DEFAULT NULL, `password` varchar(16) NOT NULL, PRIMARY KEY (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*Data for the table `login` */ insert into `login`(`username`,`email`,`password`) values ('admin','Fjz_Kuroko@163.com','123456'); /*Table structure for table `student` */ DROP TABLE IF EXISTS `student`; CREATE TABLE `student` ( `id` int(11) NOT NULL, `name` varchar(20) DEFAULT NULL, `sex` varchar(4) DEFAULT NULL, `age` tinyint(4) DEFAULT NULL, `insitute` varchar(20) DEFAULT NULL, `majo` varchar(50) DEFAULT NULL, `grade` int(4) DEFAULT NULL, `clazz` int(2) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*Data for the table `student` */ insert into `student`(`id`,`name`,`sex`,`age`,`insitute`,`majo`,`grade`,`clazz`) values (1002,'李四','男',19,'软件学院','软件工程',2018,1),(1003,'李梅','女',18,'软件学院','软件工程',2018,3),(1004,'王五','男',18,'软件学院','软件工程',2020,9),(1005,'测试1','女',20,'国际商学院','不知道',2018,1),(1006,'测试2','男',25,'职教','幼教',2019,4),(1007,'测试3','女',24,'开院','没有',2017,2),(1008,'测试4','男',56,'计算机学院','计科',2019,5),(1010,'测试6','女',34,'化学学院','化学师范',2018,4),(1011,'测试7','男',13,'物电学院','物联网',2016,5),(1012,'测测测','男',88,'是是是','啥',2019,5); /*!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 */;
true
21210a809ade62db5cfd8e969c272965da0321ab
SQL
djlongarms/Employee-Management-System
/sql/seed.sql
UTF-8
335
2.8125
3
[]
no_license
USE employees_db; INSERT INTO departments (name) VALUES('Sales'), ('Engineering'), ('Legal'), ('Human Resources'); INSERT INTO roles (title, salary, department_id) VALUES('Sales Representative', 60000, 1), ('Engineer', 80000, 2), ('Lawyer', 100000, 3), ('Human Resources Representative', 90000, 4);
true
15bfe41796854baadeac2c8dc8408fe44a096663
SQL
kingson314/Repository
/db/mysql/sys_department.sql
UTF-8
1,236
3.25
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : root Source Server Version : 50550 Source Host : localhost:3306 Source Database : patent Target Server Type : MYSQL Target Server Version : 50550 File Encoding : 65001 Date: 2016-08-30 11:28:45 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for sys_department -- ---------------------------- DROP TABLE IF EXISTS `sys_department`; CREATE TABLE `sys_department` ( `ID` varchar(255) NOT NULL COMMENT '部门ID guid', `NAME` varchar(255) DEFAULT NULL COMMENT '部门名称', `CREATEDATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', `MODIFYDATE` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '修改日期', `CREATEUSERID` varchar(255) DEFAULT NULL COMMENT '创建人Id[sys_user.id]', `MODIFYUSERID` varchar(255) DEFAULT NULL COMMENT '修改人Id[sys_user.id]', `VERSION` varchar(255) DEFAULT '1.0.0' COMMENT '版本号', `STATE` int(11) DEFAULT '0' COMMENT '状态(0为正常,-1为不可用)', `ORD` int(19) DEFAULT '0' COMMENT '排序', `MEMO` varchar(255) DEFAULT NULL COMMENT '备注说明' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='SYS_DEPARTMENT';
true