text
stringlengths
6
9.38M
-- phpMyAdmin SQL Dump -- version 4.2.11 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jun 27, 2017 at 04:02 PM -- Server version: 5.6.21 -- PHP Version: 5.6.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 */; -- -- Database: `shop_sale` -- -- -------------------------------------------------------- -- -- Table structure for table `shop` -- CREATE TABLE IF NOT EXISTS `shop` ( `shop_code` int(5) NOT NULL, `shopkeeper_name` varchar(50) COLLATE sjis_bin NOT NULL, `gender` varchar(10) COLLATE sjis_bin NOT NULL, `shopkeeper_image` varchar(40) COLLATE sjis_bin NOT NULL, `shop_name` varchar(50) COLLATE sjis_bin NOT NULL, `shop_type` varchar(20) COLLATE sjis_bin NOT NULL, `shop_address` varchar(70) COLLATE sjis_bin NOT NULL, `landmark` varchar(20) COLLATE sjis_bin NOT NULL, `mobile_number` bigint(12) NOT NULL, `shop_image` varchar(50) COLLATE sjis_bin NOT NULL, `adhar_image` varchar(50) COLLATE sjis_bin NOT NULL, `opening_time` time NOT NULL, `closing_time` time NOT NULL, `e_mail` varchar(30) COLLATE sjis_bin NOT NULL, `password` varchar(15) COLLATE sjis_bin NOT NULL, `date` date NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=sjis COLLATE=sjis_bin; -- -- Dumping data for table `shop` -- INSERT INTO `shop` (`shop_code`, `shopkeeper_name`, `gender`, `shopkeeper_image`, `shop_name`, `shop_type`, `shop_address`, `landmark`, `mobile_number`, `shop_image`, `adhar_image`, `opening_time`, `closing_time`, `e_mail`, `password`, `date`) VALUES (37, 'Abhishek Sharma', 'male', 'images.jpg', 'Tequila Restaurant', 'Restaurant', 'Opp Hint Institute, Bhuwana, Udaipur-Rajasthan - 313001, Near Parmanan', 'Bhuwana', 2147483647, 'everest-resort-bhuwana-udaipur-rajasthan-dmr0q.jpg', 'Aadhar Card.png', '10:00:00', '23:00:00', 'avishobhawat@gmail.com', 'abhishek', '2017-03-22'), (38, 'mudit', 'male', 'images (1).jpg', 'Lal Bagh Restaurants', 'Restaurant', '65 Sardarpura, Mg College Road, Udaipur HO, Udaipur-Rajasthan - 313001', 'sardarpura', 2147483647, 'aa.jpg', 'Aadhar Card.png', '11:00:00', '03:00:00', 'mudit@gmail.com', 'mudit', '2017-05-17'), (39, 'Omji Prakash', 'male', 'accountant.jpg', 'Om prakash Associate', 'Electronics', 'link role town hall udaipur 313001', 'town hall', 964999964, 'electr.JPG', 'Aadhar Card.png', '10:00:00', '19:00:00', 'om@gmail.com', 'omi', '2016-12-15'), (40, 'Shefali Mishra', 'female', '120813-New-Manager-275x275.jpg', 'Vikas Nursing Home', 'Medical Store', 'kheda mata chawk, Badgaon, Udaipur-Rajasthan - 313011, opp. CHC hospit', 'Badgaon', 9462300442, 'default-chemists-134.jpg', 'Aadhar Card.png', '10:00:00', '18:00:00', 'shefalimsr1996@gmail.com', 'shefali', '2017-05-19'), (41, 'Ankush Khatri', 'male', 'AS.jpg', 'Ankush Stationary', 'Stationary', 'hathipole', 'hathipole', 9785753886, '1.jpg', 'images.jpg', '08:00:00', '20:00:00', 'dhhrruvkhatri@gmail.com', 'ankush', '1996-06-13'), (44, 'Arvind Singh', 'male', 'IMG-20170409-WA0011.jpg', 'Arvind book store', 'Book Store', '246,harsh nagar ', 'Rampura', 7791942858, 'SAM_1830.JPG', 'images.jpg', '10:00:00', '21:00:00', 'ankush.khatri1311@gmail.com', 'arvind', '1995-07-11'), (45, 'Avinash Jain', 'male', 'IMG-20140224-WA0009.jpg', 'Avinash Stationary', 'Stationary', 'JagdishChowk', 'JagdishChowk', 8560970885, 'udaipur+city1.jpg', 'images.jpg', '07:00:00', '21:00:00', 'avishobhawat@live.com', 'avi', '1995-10-10'), (46, 'Anki Khatri', 'male', 'IMG_20140110_155023.JPG', 'Ankush Namkeen', 'Others', '204 harsh nagar', 'Harsh nagar', 9785753886, 'hdcolourfu_dATqZeok.jpg', 'images.jpg', '11:00:00', '22:00:00', 'ankush.khatri1306@gmail.com', 'anksuh', '1996-06-13'), (47, 'Deepesh', 'male', 'IMG_7244.JPG', 'Deepesh Kirana store', 'Kirana', '250 harsh nagar', 'Harsh nagar', 8769344023, 'TC-Lindsey-730x350.jpg', 'images.jpg', '06:00:00', '23:00:00', 'abhaysen786@gmail.com', 'dipu', '1995-12-29'), (48, 'Abhimayu Meena', 'male', 'B612_20160119_182124.jpg', 'Abhimanyu Meena Kirana', 'Kirana', '246, Pahada', 'pahada', 7732861825, 'P_20160119_162420.jpg', 'images.jpg', '05:00:00', '12:00:00', 'mabhimanyu721@gmail.com', 'abhi', '1995-10-12'); -- -------------------------------------------------------- -- -- Table structure for table `shop_add` -- CREATE TABLE IF NOT EXISTS `shop_add` ( `shop_code` int(11) NOT NULL, `shop_name` varchar(60) COLLATE sjis_bin NOT NULL, `product_name` varchar(30) COLLATE sjis_bin NOT NULL, `product_discription` varchar(60) COLLATE sjis_bin NOT NULL, `add_n` int(10) NOT NULL DEFAULT '0', `buy_n` int(10) NOT NULL DEFAULT '0', `get_n` int(10) NOT NULL DEFAULT '0', `shop_rs` varchar(20) COLLATE sjis_bin NOT NULL DEFAULT '0', `get_rs` varchar(20) COLLATE sjis_bin NOT NULL DEFAULT '0', `marked_price` varchar(20) COLLATE sjis_bin NOT NULL DEFAULT '0', `selling_price` varchar(20) COLLATE sjis_bin NOT NULL DEFAULT '0', `discount` decimal(30,1) DEFAULT NULL, `product_image` varchar(60) COLLATE sjis_bin NOT NULL, `p` int(4) NOT NULL, `aa` bigint(255) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=196 DEFAULT CHARSET=sjis COLLATE=sjis_bin; -- -- Dumping data for table `shop_add` -- INSERT INTO `shop_add` (`shop_code`, `shop_name`, `product_name`, `product_discription`, `add_n`, `buy_n`, `get_n`, `shop_rs`, `get_rs`, `marked_price`, `selling_price`, `discount`, `product_image`, `p`, `aa`) VALUES (39, 'Om prakash Associate', 'Asus Mobile', 'Zenfone 2 Laser', 0, 0, 0, '0', '0', '10000', '8000', '20.0', 'download (2).jpg', 2, 149), (39, 'Om prakash Associate', 'Laptops', 'Any product you want to buy in laptops', 0, 0, 0, '80000', '10000', '0', '0', '12.5', 'download.jpg', 1, 150), (39, 'Om prakash Associate', 'Nokia Mobile', 'Nokia 2700 classic', 0, 3, 1, '0', '0', '0', '0', '25.0', 'download (1).jpg', 3, 151), (39, 'Om prakash Associate', 'Mobiles', 'Any Mobile of Brand I phone', 0, 0, 0, '100000', '20000', '0', '0', '20.0', 'apple-iphone6s-apple-iphone-6s-plus-1.jpg', 1, 152), (39, 'Om prakash Associate', 'Asus Mobile', 'Asus Zenfone 5 (16gb)', 0, 0, 0, '0', '0', '10000', '7500', '25.0', 'asus.jpeg', 2, 153), (39, 'Om prakash Associate', 'Micromax Mobile', 'range Between 2000 to 5000', 0, 3, 1, '0', '0', '0', '0', '25.0', '1 (2).jpg', 3, 155), (41, 'Ankush Stationary', 'Pencil Box', 'Natraj Pencil box', 0, 0, 0, '10000', '200', '0', '0', '2.0', 'download.png', 1, 156), (41, 'Ankush Stationary', 'Classmate Copy', 'A4 size copy ', 0, 0, 0, '0', '0', '100', '97', '3.0', '17.jpg', 2, 157), (41, 'Ankush Stationary', 'Rubber', 'Rubber box of 50 pieces', 0, 4, 1, '0', '0', '0', '0', '20.0', 'natraj-rubber-250x250.jpg', 3, 158), (41, 'Ankush Stationary', 'Any Product', 'stationary,colurs,chart papers etc', 0, 0, 0, '2000', '100', '0', '0', '5.0', 'download (3).jpg', 1, 159), (41, 'Ankush Stationary', 'Pens', 'cello pens Box', 0, 0, 0, '0', '0', '200', '190', '5.0', 'download (4).jpg', 2, 160), (44, 'Arvind book store', 'Books', 'Any type of Book', 0, 0, 0, '2000', '500', '0', '0', '25.0', 'Beautyful_Doll(2).jpg', 1, 162), (44, 'Arvind book store', 'Ganpatiji Book', 'All pray of ganpatiji', 0, 0, 0, '0', '0', '100', '60', '40.0', '255344_116986171776342_1219144879_n.jpg', 2, 163), (44, 'Arvind book store', 'Gitaar Tutorial Book', 'How to play a gitar by ankush(Any book)', 0, 2, 1, '0', '0', '0', '0', '33.3', 'guitar.jpg', 3, 164), (44, 'Arvind book store', 'Cartoon ', 'Cartoon stories based on POGO Channels', 0, 0, 0, '1000', '300', '0', '0', '30.0', 'noddy1.jpg', 1, 165), (44, 'Arvind book store', 'Book on Girl', 'Stories on girls that how they are ghost', 0, 0, 0, '0', '0', '200', '110', '45.0', 'amazing_b8lvxsry.jpg', 2, 166), (44, 'Arvind book store', 'Book on Ankush Life', 'Stories of Ankush Khatri Life and the things happens', 0, 4, 3, '0', '0', '0', '0', '42.9', 'keep-calm-and-love-ankush-2.png', 3, 167), (45, 'Avinash Stationary', 'Pen', 'Butterflow packet of 20pcs', 0, 0, 0, '1000', '200', '0', '0', '20.0', 'download (1).png', 1, 168), (45, 'Avinash Stationary', 'Rubber', 'Natraj Rubber ', 0, 0, 0, '0', '0', '5', '3', '40.0', 'natraj-rubber-250x250.jpg', 2, 169), (45, 'Avinash Stationary', 'Pencil Box', 'Natraj Pencil box(10pcs)', 0, 6, 3, '0', '0', '0', '0', '33.3', 'download.png', 3, 170), (45, 'Avinash Stationary', 'Cello Pen ', 'Pen box of cello containing 10pcs', 0, 0, 0, '2000', '500', '0', '0', '25.0', 'download (4).jpg', 1, 171), (45, 'Avinash Stationary', 'Classmate Copy', 'A4 size Copy for Students having 250 pages', 0, 0, 0, '0', '0', '120', '75', '37.5', '17.jpg', 2, 172), (45, 'Avinash Stationary', 'Stationary Basket', 'Contains all pens and pencils you get free pencil box', 0, 5, 10, '0', '0', '0', '0', '66.7', 'download (3).jpg', 3, 173), (46, 'Ankush Namkeen', 'Namkeen', 'all Namkeen', 0, 0, 0, '2000', '500', '0', '0', '25.0', 'download (5).jpg', 1, 174), (46, 'Ankush Namkeen', 'Bikaji Bhujia', 'Packet of 1kg', 0, 0, 0, '0', '0', '180', '140', '22.2', 'download (6).jpg', 2, 175), (46, 'Ankush Namkeen', 'Soya Sticks', 'Soya sticks home made packet of 2kg', 0, 2, 1, '0', '0', '0', '0', '33.3', 'soya-sticks.jpg', 3, 176), (46, 'Ankush Namkeen', 'pea', 'pea', 0, 0, 0, '200', '100', '0', '0', '50.0', 'download (7).jpg', 1, 177), (46, 'Ankush Namkeen', 'Mix namkeen', 'mix namkeen packet of 2kg', 0, 0, 0, '0', '0', '200', '100', '50.0', 'download (8).jpg', 2, 178), (47, 'Deepesh Kirana store', 'All Product', 'all kirana thing', 0, 0, 0, '2000', '100', '0', '0', '5.0', 'TC-Lindsey-730x350.jpg', 1, 179), (47, 'Deepesh Kirana store', 'Sampoo', 'Nyle sampoo Bottle of 1 litre', 0, 0, 0, '0', '0', '210', '140', '33.3', 'nyle.jpg', 2, 180), (47, 'Deepesh Kirana store', 'Sampoo', 'Buy sampoo bottle(1 L) and get free Conditionar(250ml)', 0, 3, 2, '0', '0', '0', '0', '40.0', 'g.jpg', 3, 181), (47, 'Deepesh Kirana store', 'Bourn vita', 'packet 2kg', 0, 0, 0, '0', '0', '450', '250', '44.4', 'download (9).jpg', 2, 182), (47, 'Deepesh Kirana store', 'Bourn vita ', 'bourn vita little champs 1 kg', 0, 3, 2, '0', '0', '0', '0', '40.0', 'download (10).jpg', 3, 183), (48, 'Abhimanyu Meena Kira', 'All Shampo', 'shampo of brand dove,nyle,panteen etc', 0, 0, 0, '2000', '500', '0', '0', '25.0', 'g.jpg', 1, 184), (48, 'Abhimanyu Meena Kira', 'Hide and sick biscuits', 'packet of 3 ', 0, 0, 0, '0', '0', '120', '70', '41.7', 'parle-hide-seek-chocolate-chips-biscuits-1319848.jpg', 2, 185), (48, 'Abhimanyu Meena Kira', 'Maggi', 'Maggi packet of Rs60', 0, 4, 2, '0', '0', '0', '0', '33.3', 'download (11).jpg', 3, 186), (48, 'Abhimanyu Meena Kira', 'Everest masala', 'all everest product', 0, 0, 0, '1000', '200', '0', '0', '20.0', 'download (12).jpg', 1, 187), (48, 'Abhimanyu Meena Kira', 'Bourn vita', 'bourn vita little champs 1 kg', 0, 200, 110, '0', '0', '0', '0', '35.5', 'download (10).jpg', 3, 188), (38, 'Lal Bagh Restaurants', 'chowmin', 'chinese full plate only Rs 70', 0, 0, 0, '210', '30', '0', '0', '14.3', 'abhi.jpg', 1, 189), (38, 'Lal Bagh Restaurants', 'pepsi', '200ml bottle', 0, 4, 2, '0', '0', '0', '0', NULL, 'images (2).jpg', 3, 191), (41, 'Ankush Stationary', 'maggi', 'maggi packet s', 0, 0, 0, '2000', '100', '0', '0', '5.0', '51C48Rbwr9L._SX385_.jpg', 1, 194); -- -- Indexes for dumped tables -- -- -- Indexes for table `shop` -- ALTER TABLE `shop` ADD PRIMARY KEY (`shop_code`); -- -- Indexes for table `shop_add` -- ALTER TABLE `shop_add` ADD PRIMARY KEY (`aa`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `shop` -- ALTER TABLE `shop` MODIFY `shop_code` int(5) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=49; -- -- AUTO_INCREMENT for table `shop_add` -- ALTER TABLE `shop_add` MODIFY `aa` bigint(255) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=196; /*!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 */;
create database if not exists douyu; use douyu; create table if not exists dt( user_id char(11), room_id char(11), content varchar(200), if_fan int, if_vip int, time varchar(20) )DEFAULT charset = utf8; create table if not exists streamer( room_id char(11), startype_1 varchar(20), startype_2 varchar(20), startype_3 varchar(20), gender int, age int, community_id bigint, date_1 varchar(20), date_2 varchar(20), location_1 varchar(20), location_2 varchar(20) )DEFAULT charset = utf8; create table if not exists start_live_only2019( live_date char(8), room_id char(11), start_time bigint, end_time bigint, roomtype_1 varchar(10), roomtype_2 varchar(10), roomtype_3 varchar(10) )DEFAULT charset = utf8;
DROP PROCEDURE IF EXISTS SP_INUSR; DELIMITER $$ CREATE PROCEDURE SP_INUSR( IN pnPosicionId INT, IN pnPersonalId INT, IN pcUsuario VARCHAR(255), IN pcPass VARCHAR(32), IN pcPassHash VARCHAR(255), IN pcPassToken VARCHAR(255), IN pcCorreo VARCHAR(255), IN pnStatus SMALLINT(6), IN pnCreado int, IN pnActualizado int, IN pcTokenVerificacion VARCHAR(255) ) SP:BEGIN /*VALORES NULOS: PASSWORDR_RESET_TOKEN,STATUS,VERIFICATION_TOKEN */ INSERT INTO `ccocesna`.`user1` (`posicion_id_posicion`,`personal_id_personal`,`username`,`auth_key`,`password_hash`, `password_reset_token`,`email`,`status`,`created_at`,`updated_at`,`verification_token`) VALUES (pnPosicionId,pnPersonalId,pcUsuario,pcPass,pcPassHash, pcPassToken,pcCorreo,pnStatus,pnCreado,(SELECT YEAR(CURRENT_DATE)), pcTokenVerificacion); IF pnPosicionId=3 then insert into enviar_notificacion(user_id) values ((select id from user1 ORDER BY id DESC LIMIT 1)); end if; INSERT INTO `ccocesna`.`user` (`id`,`username`,`auth_key`,`password_hash`,`password_reset_token`, `email`,`status`,`created_at`,`updated_at`,`verification_token`) VALUES( ( select id from user1 ORDER BY id DESC LIMIT 1), ( select username from user1 ORDER BY id DESC LIMIT 1), ( select auth_key from user1 ORDER BY id DESC LIMIT 1), ( select password_hash from user1 ORDER BY id DESC LIMIT 1), ( select password_reset_token from user1 ORDER BY id DESC LIMIT 1), ( select email from user1 ORDER BY id DESC LIMIT 1), ( select `status` from user1 ORDER BY id DESC LIMIT 1), ( select created_at from user1 ORDER BY id DESC LIMIT 1), ( select updated_at from user1 ORDER BY id DESC LIMIT 1), ( select verification_token from user1 ORDER BY id DESC LIMIT 1) ); END $$ DELIMITER ; /* call SP_INUSR(1,1,'JuanLopez1970','123',123,null,'juanLopez@gmail.com',10,2019,2019,null); */
CREATE procedure Sp_Get_WeekDay (@nWeekDay Int) as SET DATEFIRST 1 If Exists(select weekdate from wcpabstract Where (IsNull(Status,0) & 128) = 0 And datepart(dw,weekdate)=@nweekday) Select 1 Else Select 0
CREATE TABLE pages ( news_preview_image int(11) unsigned DEFAULT '0', news_top_news tinyint(3) unsigned DEFAULT '0', news_teaser text );
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: localhost Database: cs470 -- ------------------------------------------------------ -- Server version 5.7.20-log /*!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 `customer` -- DROP TABLE IF EXISTS `customer`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `customer` ( `CID` int(11) NOT NULL AUTO_INCREMENT, `date_of_birth` date DEFAULT NULL, `name` varchar(30) DEFAULT NULL, `phone` varchar(14) DEFAULT NULL, `address` varchar(30) DEFAULT NULL, `tickets_purchased` int(11) DEFAULT NULL, `points_available` int(11) DEFAULT NULL, PRIMARY KEY (`CID`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!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,'1987-05-14','Waylon Dalton','816 348-4477','6700 State Ave',3,5),(2,'1996-10-21','Marcus Cruz','816 548-6223','1234 Park Ave',12,9),(3,'2000-01-27','Eddie Randolph','314 663-4112','3211 Mel Dr.',8,40),(4,'1973-03-04','Justine Henderson','816 774-5668','3499 Richmond Blvd.',22,14),(5,'1991-08-08','Angela Walker','913 455-9356','5575 Rose St.',18,28); /*!40000 ALTER TABLE `customer` 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 2017-11-27 22:16:09
set serveroutput on; DECLARE empleado empleados%rowtype; CURSOR c_empleados is select * from empleados; --Procedimiento de impresion de empleado PROCEDURE imprimir_empleado( empleado empleados%rowtype ) is salarioDiario number; BEGIN salarioDiario := empleado.salario / 30; dbms_output.put_line( '===========================' ); dbms_output.put_line( 'Nombre: ' || empleado.id ); dbms_output.put_line( 'Salario Diario: ' || round(salarioDiario,2) ); dbms_output.put_line( 'Dias trabajados: ' || empleado.diastrabajados ); dbms_output.put_line( 'Salario a pagar: ' || round( salarioDiario * empleado.diastrabajados, 2 ) ); dbms_output.put_line( '===========================' ); END; -- Fin de procedimiento de impresion de empleado BEGIN OPEN c_empleados; LOOP FETCH c_empleados into empleado; EXIT WHEN c_empleados%notfound; imprimir_empleado( empleado ); END LOOP; CLOSE c_empleados; END; /
insert into indigo.users (firstname, lastname) values ('joe', 'bloggs'), ('curly', 'sue'); insert into indigo.users (firstname, lastname) values ('aaron', 'paul'), ('dean', 'cain'), ('dana', 'carvey'), ('stephen', 'colbert'), ('seth', 'meyers'), ('john', 'oliver'), ('bill','maher'), ('trevor', 'noah'), ('jimmy', 'fallon'), ('james', 'corden'), ('david', 'letterman'), ('samantha', 'bee'), ('rick', 'santorum'), ('don', 'lemon'), ('dana', 'bash'), ('jeffrey', 'toobin'), ('philip', 'mudd'), ('jake', 'tapper'), ('wolf', 'blitzer'), ('anderson', 'cooper'), ('chris', 'cuomo'), ('maggie', 'lake'), ('richard', 'quest');
-- MySQL Script generated by MySQL Workbench -- Qui 23 Nov 2017 10:24:13 -02 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema bdsistemast -- ----------------------------------------------------- DROP SCHEMA IF EXISTS `bdsistemast` ; -- ----------------------------------------------------- -- Schema bdsistemast -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `bdsistemast` DEFAULT CHARACTER SET utf8 ; USE `bdsistemast` ; -- ----------------------------------------------------- -- Table `bdsistemast`.`Pessoa` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`Pessoa` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`Pessoa` ( `idPessoa` INT NOT NULL, `nome` VARCHAR(45) NOT NULL, `idade` INT NOT NULL, `sexo` VARCHAR(1) NOT NULL, `end_num` VARCHAR(45) NOT NULL, `end_rua` VARCHAR(45) NOT NULL, `end_cidade` VARCHAR(45) NOT NULL, `end_estado` VARCHAR(45) NOT NULL, `cpf` VARCHAR(45) NOT NULL, PRIMARY KEY (`idPessoa`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdsistemast`.`Administrador` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`Administrador` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`Administrador` ( `senha` VARCHAR(32) NOT NULL, `cod_adm` INT NOT NULL, `salario` DOUBLE NOT NULL, `Pessoa_idPessoa` INT NOT NULL, PRIMARY KEY (`cod_adm`), INDEX `fk_Administrador_Pessoa1_idx` (`Pessoa_idPessoa` ASC), CONSTRAINT `fk_Administrador_Pessoa1` FOREIGN KEY (`Pessoa_idPessoa`) REFERENCES `bdsistemast`.`Pessoa` (`idPessoa`) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdsistemast`.`Funcionario` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`Funcionario` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`Funcionario` ( `senha` VARCHAR(32) NOT NULL, `cod_func` INT NOT NULL, `salario` DOUBLE NOT NULL, `Pessoa_idPessoa` INT NOT NULL, `cargo` VARCHAR(45) NOT NULL, PRIMARY KEY (`cod_func`), INDEX `fk_Funcionario_Pessoa1_idx` (`Pessoa_idPessoa` ASC), CONSTRAINT `fk_Funcionario_Pessoa1` FOREIGN KEY (`Pessoa_idPessoa`) REFERENCES `bdsistemast`.`Pessoa` (`idPessoa`) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdsistemast`.`Categoria` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`Categoria` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`Categoria` ( `cod_categoria` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(45) NOT NULL, `beneficios` VARCHAR(45) NOT NULL, `valor_mensalidade` DOUBLE NOT NULL, PRIMARY KEY (`cod_categoria`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdsistemast`.`SocioTorcedor` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`SocioTorcedor` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`SocioTorcedor` ( `cod_st` INT NOT NULL, `Categoria_cod_categoria` INT NOT NULL, `Pessoa_idPessoa` INT NOT NULL, PRIMARY KEY (`cod_st`), INDEX `fk_SocioTorcedor_Categoria_idx` (`Categoria_cod_categoria` ASC), INDEX `fk_SocioTorcedor_Pessoa1_idx` (`Pessoa_idPessoa` ASC), CONSTRAINT `fk_SocioTorcedor_Categoria` FOREIGN KEY (`Categoria_cod_categoria`) REFERENCES `bdsistemast`.`Categoria` (`cod_categoria`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_SocioTorcedor_Pessoa1` FOREIGN KEY (`Pessoa_idPessoa`) REFERENCES `bdsistemast`.`Pessoa` (`idPessoa`) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdsistemast`.`Pagamento` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`Pagamento` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`Pagamento` ( `cod_pagamento` INT NOT NULL AUTO_INCREMENT, `valor` DOUBLE NOT NULL, `detalhesPagamento` VARCHAR(45) NOT NULL, `SocioTorcedor_cod_st` INT NOT NULL, `data` VARCHAR(45) NOT NULL, PRIMARY KEY (`cod_pagamento`, `SocioTorcedor_cod_st`), INDEX `fk_Pagamento_SocioTorcedor1_idx` (`SocioTorcedor_cod_st` ASC), CONSTRAINT `fk_Pagamento_SocioTorcedor1` FOREIGN KEY (`SocioTorcedor_cod_st`) REFERENCES `bdsistemast`.`SocioTorcedor` (`cod_st`) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdsistemast`.`Telefone` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`Telefone` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`Telefone` ( `telefone` VARCHAR(45) NOT NULL, `cod_tel` INT NOT NULL, PRIMARY KEY (`cod_tel`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdsistemast`.`Email` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`Email` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`Email` ( `email` VARCHAR(45) NOT NULL, `cod_email` INT NOT NULL, PRIMARY KEY (`cod_email`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdsistemast`.`Pessoa_Telefone` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`Pessoa_Telefone` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`Pessoa_Telefone` ( `Telefone_cod_tel` INT NOT NULL, `Pessoa_idPessoa` INT NOT NULL, PRIMARY KEY (`Telefone_cod_tel`, `Pessoa_idPessoa`), INDEX `fk_Pessoa_Telefone_Pessoa1_idx` (`Pessoa_idPessoa` ASC), CONSTRAINT `fk_Pessoa_Telefone_Telefone1` FOREIGN KEY (`Telefone_cod_tel`) REFERENCES `bdsistemast`.`Telefone` (`cod_tel`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_Pessoa_Telefone_Pessoa1` FOREIGN KEY (`Pessoa_idPessoa`) REFERENCES `bdsistemast`.`Pessoa` (`idPessoa`) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdsistemast`.`Pessoa_Email` -- ----------------------------------------------------- DROP TABLE IF EXISTS `bdsistemast`.`Pessoa_Email` ; CREATE TABLE IF NOT EXISTS `bdsistemast`.`Pessoa_Email` ( `Pessoa_idPessoa` INT NOT NULL, `Email_cod_email` INT NOT NULL, PRIMARY KEY (`Pessoa_idPessoa`, `Email_cod_email`), INDEX `fk_Pessoa_Email_Email1_idx` (`Email_cod_email` ASC), CONSTRAINT `fk_Pessoa_Email_Pessoa1` FOREIGN KEY (`Pessoa_idPessoa`) REFERENCES `bdsistemast`.`Pessoa` (`idPessoa`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_Pessoa_Email_Email1` FOREIGN KEY (`Email_cod_email`) REFERENCES `bdsistemast`.`Email` (`cod_email`) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
CREATE OR REPLACE VIEW History_Current_Counts_View AS SELECT pmi.tid_id AS tidid, pmi.interface_id as ifcid, to_char(pmi.timeentered, 'MM-DD-YYYY HH24:MI:SS') AS lasttime, to_char(pmi.timeentered, 'YYYY-MM-DD HH24:MI:SS') AS sorttime, decode( to_char(pmi.timeentered, 'MM-DD-YYYY'), to_char(SYSDATE - 1, 'MM-DD-YYYY'), '0', '86400') + to_char(timeentered, 'SSSSS') AS lasttimenumber, pmi.c1 AS c1, pmi.c2 AS c2, pmi.c3 AS c3, pmi.c4 AS c4, pmi.c5 AS c5, pmi.c6 AS c6, pmi.c7 AS c7, pmi.c8 AS c8, pmi.c9 AS c9, pmi.c10 AS c10 FROM pm_info pmi ; COMMIT;
ALTER TABLE bookmarks ALTER COLUMN title SET DATA TYPE VARCHAR(30);
SELECT name, RechnungsNr, --Rappen, substr(Rappen,1,1) AS digit1, substr(Rappen,2,1) AS digit2, substr(Rappen,3,1) AS digit3, substr(Rappen,4,1) AS digit4, substr(Rappen,5,1) AS digit5, substr(Rappen,6,1) AS digit6, PR, addr2, addr3, addr4 FROM ( SELECT name, RechnungsNr, (SELECT printf("%6.0f", 100 * Bilanz) FROM balance_pr WHERE pid = payer.id AND Bilanz > 0) AS Rappen, COALESCE(addr1, name) as PR, payer.addr2 AS addr2, payer.addr3 AS addr3, payer.addr4 AS addr4 FROM payer, RechnungsNr WHERE RechnungsNr.pid = payer.id AND Rappen not like '%-%' --and payer.id < 66 ) ORDER BY name
-- phpMyAdmin SQL Dump -- version 4.7.7 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: Sep 03, 2018 at 09:38 AM -- Server version: 5.6.39-83.1 -- PHP Version: 5.6.30 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: `ab11641_hour_ctr` -- -- -------------------------------------------------------- -- -- Table structure for table `projects` -- CREATE TABLE `projects` ( `project` varchar(55) COLLATE utf8_unicode_ci NOT NULL, `logged_hrs` int(10) UNSIGNED NOT NULL DEFAULT '0', `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Indexes for dumped tables -- -- -- Indexes for table `projects` -- ALTER TABLE `projects` ADD PRIMARY KEY (`project`); 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 */;
CREATE DATABASE chat; use chat; CREATE TABLE users ( id INT AUTO_INCREMENT, name VARCHAR(50), createdAt DATETIME, updatedAt DATETIME, PRIMARY KEY(id) ); CREATE TABLE messages ( id INT AUTO_INCREMENT, user_id INT, roomname VARCHAR(30), message VARCHAR(150), createdAt DATETIME, updatedAt DATETIME, PRIMARY KEY(id), FOREIGN KEY(user_id) REFERENCES users(id) );
SELECT DISTINCT bank_name AS "BankName" FROM has_accounts WHERE robber_id = (SELECT robber_id FROM robbers WHERE nickname = 'Calamity Jane');
CREATE TABLE Subasta( idPublicacion int NOT NULL, precioBase int NOT NULL, PRIMARY KEY (idPublicacion), FOREIGN KEY (idPublicacion) REFERENCES Publicacion(idPublicacion) );
-- || 字符串连接 select 'hi' || 'girl ' from dual; select concat('hi','girl') from dual; select initcap('aaaaabbb') from dual; select lower(e.ename) from emp e; select concat(e.ename,e.job) from emp e; select lpad('test',10,'*') from dual; select rpad('test',10,'*') from dual; select trim('i' from trim('h' from 'hitesthi')) from dual; select rtrim('testtest','t') from dual; select substr('abcde',1,3) from dual; select instr('test','e') from dual; select length(e.ename) from emp e; --查看当前时间日期 select sysdate from dual; select current_date from dual; --???? select to_char(current_timestamp,'yyyy-mm-dd') from dual; select round(888.999) from dual; select round(888.666,2) from dual; select round(888.666,-2) from dual; select trunc(888.666,-2) from dual; select mod(13,5) from dual; select ceil(19.2) from dual; select floor(3.1) from dual; select add_months(sysdate,1) from dual; select sysdate-e.hiredate from emp e; --员工工作年限 select round((sysdate-e.hiredate)/365),e.ename from emp e where round((sysdate-e.hiredate)/365)>25; --2012-6-9 select last_day select sysdate,last_day(sysdate) hz from dual; select sysdate,last_day(to_date('2012-02-09','yyyy-mm-dd')) hz from dual; --to_date select to_date('20080808','yyyymmdd') from dual; select to_date('2008/08/08 09:10:58','yyyy/mm/dd hh24:mi:ss') from dual; select round(months_between(sysdate,e.hiredate)/12) from emp e; --to_char 当前使用 2016-8-30 11:44:58 select to_char(sysdate,'yyyy/mm/dd hh12:mi:ss') from dual; select to_char(234.82736422,'99999.99') from dual; select to_char(234.82736422,'000000.00') from dual; --控制符必须和数字字符长度一样 select to_number('$23.2332423','$00.0000000') from dual; select * from emp; select e.ename, nvl(to_char(e.mgr),'boss') from emp e where e.mgr is null; select e.ename, nvl2(to_char(e.mgr),'屌丝','高富帅') from emp e ; --为所有人长工资,标准是:10部门长10%;20部门长15%;30部门长20%其他部门长18% select decode(e.deptno, 10, e.sal * 1.1, 20, e.sal * 1.15, 30, e.sal * 1.2, e.sal * 1.18),e.ename,e.empno,e.sal,e.deptno from emp e; -- 500-1500 真屌丝 --1500-2000 屌丝 --2000-2500 精英 --2000以上 土豪 select case when e.sal > 500 and e.sal < 1500 then '真屌丝' when e.sal >= 1500 and e.sal < 2000 then '好屌丝' when e.sal >= 2000 and e.sal < 2500 then '好经纪人' else '土豪' end "身份",e.ename,e.sal from emp e; /* 1、查询82年员工 2、查询32年工龄的人员 3、显示员工雇佣期 6 个月后下一个星期一的日期 4、找没有上级的员工,把mgr的字段信息输出为 "boss" 5、为所有人长工资,标准是:10部门长10%;20部门长15%;30部门长20%其他部门长18% */ select e.* from emp e where to_char(e.hiredate,'yyyy')='1982'; select e.* from emp e where to_char(e.hiredate,'yy') like '82' --显示员工雇佣期 6 个月后下一个星期一的日期 select add_months(e.hiredate,6) from emp e; select next_day(add_months(e.hiredate,6),'星期一') from emp e; select next_day(add_months(e.hiredate,6),2) from emp e; select next_day(sysdate,2)from dual; --找没有上级的员工,把mgr的字段信息输出为 "boss" select decode(e.mgr,null,'boss','中国好经纪人') from emp e; --case when 作业
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50553 Source Host : localhost:3306 Source Database : yii2 Target Server Type : MYSQL Target Server Version : 50553 File Encoding : 65001 Date: 2019-05-07 07:00:07 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for gbc_admin_user -- ---------------------------- DROP TABLE IF EXISTS `gbc_admin_user`; CREATE TABLE `gbc_admin_user` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '管理员ID', `username` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '管理圆账号', `password` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '管理员密码', `auth_key` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `password_reset_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `email` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '管理员邮箱', `status` smallint(6) unsigned NOT NULL DEFAULT '10' COMMENT '账号状态', `updated_at` int(10) unsigned NOT NULL COMMENT '帐号创建时间', `login_time` int(10) unsigned NOT NULL COMMENT '账号修改时间', `login_ip` int(10) unsigned NOT NULL COMMENT '最后登陆IP', `verification_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `role` smallint(6) unsigned DEFAULT '10', `nickname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `head_pic` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `username` (`username`) USING BTREE, UNIQUE KEY `email` (`email`) USING BTREE, UNIQUE KEY `password_reset_token` (`password_reset_token`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPACT; -- ---------------------------- -- Records of gbc_admin_user -- ---------------------------- INSERT INTO `gbc_admin_user` VALUES ('1', 'admin', '$2y$13$gK0/mzy2mooIo6rkPMkTNO8lB5kQTnvAwO9Sis4aW1lw9petVpQpi', 'aaa', null, 'egquan3@163.com', '10', '1557169005', '1557168783', '2130706433', '215151', '10', '春风a', 'http://www.gbc.com/uploads/1557169003.jpg', null); INSERT INTO `gbc_admin_user` VALUES ('4', 'admin888', '7fef6171469e80d32c0559f88b377245', null, null, 'egquan1@163.com', '10', '1926547', '1554875263', '2130706433', null, '10', null, null, null); -- ---------------------------- -- Table structure for gbc_auth_assignment -- ---------------------------- DROP TABLE IF EXISTS `gbc_auth_assignment`; CREATE TABLE `gbc_auth_assignment` ( `item_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `user_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` int(11) DEFAULT NULL, PRIMARY KEY (`item_name`,`user_id`) USING BTREE, KEY `gbc_idx-auth_assignment-user_id` (`user_id`) USING BTREE, CONSTRAINT `gbc_auth_assignment_ibfk_1` FOREIGN KEY (`item_name`) REFERENCES `gbc_auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Records of gbc_auth_assignment -- ---------------------------- INSERT INTO `gbc_auth_assignment` VALUES ('创始人', '1', '1555683032'); INSERT INTO `gbc_auth_assignment` VALUES ('管理员', '2', null); -- ---------------------------- -- Table structure for gbc_auth_item -- ---------------------------- DROP TABLE IF EXISTS `gbc_auth_item`; CREATE TABLE `gbc_auth_item` ( `name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `type` smallint(6) NOT NULL, `description` text COLLATE utf8mb4_unicode_ci, `rule_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `data` blob, `created_at` int(11) DEFAULT NULL, `updated_at` int(11) DEFAULT NULL, PRIMARY KEY (`name`) USING BTREE, KEY `rule_name` (`rule_name`) USING BTREE, KEY `gbc_idx-auth_item-type` (`type`) USING BTREE, CONSTRAINT `gbc_auth_item_ibfk_1` FOREIGN KEY (`rule_name`) REFERENCES `gbc_auth_rule` (`name`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Records of gbc_auth_item -- ---------------------------- INSERT INTO `gbc_auth_item` VALUES ('/*', '2', null, null, null, null, null); INSERT INTO `gbc_auth_item` VALUES ('/admin/', '2', '', null, null, null, null); INSERT INTO `gbc_auth_item` VALUES ('/admin/*', '2', null, null, null, null, null); INSERT INTO `gbc_auth_item` VALUES ('/admin/default', '2', '', null, null, null, null); INSERT INTO `gbc_auth_item` VALUES ('/admin/default/*', '2', null, null, null, null, null); INSERT INTO `gbc_auth_item` VALUES ('/admin/default/admin-sing', '2', '', null, null, '1555682876', '1555682876'); INSERT INTO `gbc_auth_item` VALUES ('/admin/default/index', '2', '', null, null, null, null); INSERT INTO `gbc_auth_item` VALUES ('admin/', '2', null, null, null, null, null); INSERT INTO `gbc_auth_item` VALUES ('admin/default', '2', null, null, null, null, null); INSERT INTO `gbc_auth_item` VALUES ('admin/default/index', '2', null, null, null, null, null); INSERT INTO `gbc_auth_item` VALUES ('创始人', '1', '网站创始人权限', null, null, '1555682876', '1555682876'); INSERT INTO `gbc_auth_item` VALUES ('管理员', '1', '管路员权限', null, null, null, null); -- ---------------------------- -- Table structure for gbc_auth_item_child -- ---------------------------- DROP TABLE IF EXISTS `gbc_auth_item_child`; CREATE TABLE `gbc_auth_item_child` ( `parent` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `child` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`parent`,`child`) USING BTREE, KEY `child` (`child`) USING BTREE, CONSTRAINT `gbc_auth_item_child_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `gbc_auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `gbc_auth_item_child_ibfk_2` FOREIGN KEY (`child`) REFERENCES `gbc_auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Records of gbc_auth_item_child -- ---------------------------- INSERT INTO `gbc_auth_item_child` VALUES ('创始人', '/*'); INSERT INTO `gbc_auth_item_child` VALUES ('创始人', '/admin/'); INSERT INTO `gbc_auth_item_child` VALUES ('创始人', '/admin/*'); INSERT INTO `gbc_auth_item_child` VALUES ('创始人', '/admin/default'); INSERT INTO `gbc_auth_item_child` VALUES ('创始人', '/admin/default/*'); INSERT INTO `gbc_auth_item_child` VALUES ('创始人', '/admin/default/admin-sing'); INSERT INTO `gbc_auth_item_child` VALUES ('创始人', '/admin/default/index'); INSERT INTO `gbc_auth_item_child` VALUES ('创始人', 'admin/default/index'); -- ---------------------------- -- Table structure for gbc_auth_rule -- ---------------------------- DROP TABLE IF EXISTS `gbc_auth_rule`; CREATE TABLE `gbc_auth_rule` ( `name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `data` blob, `created_at` int(11) DEFAULT NULL, `updated_at` int(11) DEFAULT NULL, PRIMARY KEY (`name`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Records of gbc_auth_rule -- ---------------------------- -- ---------------------------- -- Table structure for gbc_menu -- ---------------------------- DROP TABLE IF EXISTS `gbc_menu`; CREATE TABLE `gbc_menu` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, `parent` int(11) DEFAULT NULL, `route` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `order` int(11) DEFAULT NULL, `icon` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, KEY `parent` (`parent`) USING BTREE, CONSTRAINT `gbc_menu_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `gbc_menu` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Records of gbc_menu -- ---------------------------- INSERT INTO `gbc_menu` VALUES ('1', '系统管理', null, null, '2', '&#xe602;'); INSERT INTO `gbc_menu` VALUES ('2', '角色列表', null, '/admin/default/index', '34', '&#xe6bf;'); -- ---------------------------- -- Table structure for gbc_migration -- ---------------------------- DROP TABLE IF EXISTS `gbc_migration`; CREATE TABLE `gbc_migration` ( `version` varchar(180) COLLATE utf8mb4_unicode_ci NOT NULL, `apply_time` int(11) DEFAULT NULL, PRIMARY KEY (`version`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; -- ---------------------------- -- Records of gbc_migration -- ---------------------------- INSERT INTO `gbc_migration` VALUES ('m000000_000000_base', '1555333289'); INSERT INTO `gbc_migration` VALUES ('m140506_102106_rbac_init', '1555333533'); INSERT INTO `gbc_migration` VALUES ('m170907_052038_rbac_add_index_on_auth_assignment_user_id', '1555333534'); INSERT INTO `gbc_migration` VALUES ('m180523_151638_rbac_updates_indexes_without_prefix', '1555333535');
create schema hoopin; set search_path to hoopin; create table users( admin_id serial, username varchar(50), password varchar(20) not null, primary key (admin_id) ); create table province( province_id int, province_name varchar(50), primary key (province_id) ); create table city( city_id int, province_id int, city_name varchar(50), primary key (city_id), foreign key (province_id) references province (province_id) on update cascade on delete cascade ); create table cutomer( city_id serial, cust_name varchar(100) not null, baby_name varchar (100) not null, baby_dob date not null, phone_home text, phone_mobile text, line_id text, email varchar(100), address text, city_id int, province_id int, ZIP int, favorite_toys text, milestones text, primary key (cust_id), foreign key (province_id) references province (province_id) on update cascade on delete cascade, foreign key (city_id) references city (city_id) on update cascade on delete cascade ); create table subscription( sub_id serial, cust_id serial, status varchar(20), subs_plan int, num_ofToys int, first_deliv date, final_pickup date, subs_price date, subs_promo int, deliv_price int, deliv_promo int, deposit int, payment_terms varchar(20), deposit_refund date, deposit_status text, primary key (subs_id), foreign key (cust_id) references cutomer (cust_id) on update cascade on delete cascade, );
# patch_39_40_d # # title: stable id event score column # # description: # Add stable_id_event.score column ALTER TABLE stable_id_event ADD COLUMN score FLOAT NOT NULL DEFAULT 0; # patch identifier INSERT INTO meta (meta_key, meta_value) VALUES ('patch', 'patch_39_40_d.sql|stable_id_event_score_column');
SELECT * FROM sale;
Create Procedure spr_RetailSalesSummary_PaymentMode(@FromDate DateTime, @ToDate DateTime) As Select "Date" = N'', "Date " = [Date], "Cash" = Sum(Case When [Mode] In (1) Then [Value] End), "Credit Card" = Sum(Case When [Mode] In (3) Then [Value] End), "Cheque" = Sum(Case When [Mode] In (2) Then [Value] End), "Coupons" = Sum(Case When [Mode] In (4) Then [Value] End), "Gift Voucher Redemption" = Sum(Case When [Mode] In (7) Then [Value] End), "Credit Note Adjusted" = Sum(Case When [Mode] In (6) Then [Value] End), "Credit Note Issued(Sales Return)" = Sum(Case When [Mode] In (8) Then [Value] End), "Credit Note Issued(FA)" = Sum(Case When [Mode] In (9) Then [Value] End), "Gift Voucher Issued" = Sum(Case When [Mode] In (10) Then [Value] End) From ( Select [Date] = Convert(nVarChar, DatePart(DD, ia.InvoiceDate)) + N'/' + Convert(nVarChar, DatePart(MM, ia.InvoiceDate)) + N'/' + Convert(nVarChar, DatePart(YYYY, ia.InvoiceDate)), [Value] = Sum(rpd.NetRecieved), [Mode] = pm.PaymentType From InvoiceAbstract ia, RetailPaymentDetails rpd, PaymentMode pm Where ia.InvoiceID = rpd.RetailInvoiceID And rpd.PaymentMode = pm.Mode And (IsNull(ia.status, 0) & 192) = 0 And ia.InvoiceDate Between @FromDate And @ToDate Group By ia.InvoiceDate, rpd.PaymentMode, pm.PaymentType Union Select [Date] = Convert(nVarChar, DatePart(DD, ia.InvoiceDate)) + N'/' + Convert(nVarChar, DatePart(MM, ia.InvoiceDate)) + N'/' + Convert(nVarChar, DatePart(YYYY, ia.InvoiceDate)), [Value] = Sum(ia.Balance), [Mode] = 8 From InvoiceAbstract ia Where ia.InvoiceDate Between @FromDate And @ToDate And (IsNull(ia.status, 0) & 192) = 0 And InvoiceType In (5, 6) Group By ia.InvoiceDate Union Select [Date] = Convert(nVarChar, DatePart(DD, cn.DocumentDate)) + N'/' + Convert(nVarChar, DatePart(MM, cn.DocumentDate)) + N'/' + Convert(nVarChar, DatePart(YYYY, cn.DocumentDate)), [Value] = Sum(cn.Balance), [Mode] = 9 From CreditNote cn Where cn.DocumentDate Between @FromDate And @ToDate Group By cn.DocumentDate Union Select [Date] = Convert(nVarChar, DatePart(DD, cl.DocumentDate)) + N'/' + Convert(nVarChar, DatePart(MM, cl.DocumentDate)) + N'/' + Convert(nVarChar, DatePart(YYYY, cl.DocumentDate)), [Value] = Sum(cl.Balance), [Mode] = 10 From Collections cl Where cl.DocumentDate Between @FromDate And @ToDate And IsNull(cl.CustomerID, N'') = N'GIFT VOUCHER' And (IsNull(cl.status, 0) & 192) = 0 Group By cl.DocumentDate) summ Group By [Date]
/****** Object: StoredProcedure [dbo].[prc_CWI_SetUser] Script Date: 4/25/2013 2:43:10 PM ******/ IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'prc_CWI_SetUser') DROP PROCEDURE [dbo].[prc_CWI_SetUser] GO /****** Object: StoredProcedure [dbo].[prc_CWI_SetUser] Script Date: 4/25/2013 2:43:10 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /******************************************************************* * PROCEDURE: prc_CWI_SetUser * Purpose : This PROC would be called TO insert the user * Invoked from : ClientWise.master * CREATED: MohanKumar Sundaram * MODIFICATION HISTORY * DATE AUTHOR DESCRIPTION ********************************************************************** Execution example : ********************************************************************** exec prc_CWI_SetUser @Login = 'msundaram',@Domain = 'OSS', @Names ='MohanKumar Sundaram' , @Email = 'MohanKumar.Sundaram@xerox.com', @IsActive=1, @CreatedBy = 'OSS\msundaram' **********************************************************************/ CREATE PROCEDURE [dbo].[prc_CWI_SetUser] @Login varchar(100), @Domain varchar(100), @Names varchar(200), @Email varchar(100), @IsActive bit, @CreatedBy varchar(100) AS DECLARE @OldEmail varchar(100) DECLARE @UserId int DECLARE @IsNewUser bit SET @IsNewUser = 0 SET @UserId = 0 SELECT @UserId = Id, @OldEmail = ISNULL(Email,'') FROM CWI_User WHERE Login = @login and domain = @domain IF @UserId = 0 BEGIN SET @IsNewUser = 1 INSERT INTO [dbo].[CWI_User] ([Login] ,[Domain] ,[Names] ,[Email] ,[IsActive] ,[CreatedBy] ,[CreatedOn] ,[ModifiedBy] ,[ModifiedOn] ,LastLoggedIn) VALUES (@Login , @Domain, @Names , @Email , @IsActive , @CreatedBy, getdate(), @CreatedBy, getdate(), getdate()) SET @UserId = SCOPE_IDENTITY() END ELSE IF @OldEmail = '' AND ISNULL(@Email,'') <> '' BEGIN UPDATE [CWI_User] SET EMail = @Email, LastLoggedIn = getdate() WHERE Id = @UserId END ELSE BEGIN UPDATE [CWI_User] SET LastLoggedIn = getdate() WHERE Id = @UserId END SELECT Id UserId, [Login] LoginName, Domain LoginDomain, Names UserName, Email EmailAddress, IsActive, cast('' as varchar(max)) Groups, CASE @IsNewUser WHEN 1 THEN NULL ELSE LastLoggedIn END LastLoggedIn FROM CWI_User WHERE Id = @UserId GO
/*CREAR IDICES:*/ ALTER TABLE customer_contacts ADD INDEX<customer_code>; /*CREAR UN INDICE*/ CREATE INDEX NOMBRE_INDEX ON TABLE(COLUM1,COLUM2....); /*MOSTRAR INDICES CREADOS PARA LA TABLA X...*/ SHOW INDEXES FROM NOMBRE_TABLA; /*BORRAR INDICES*/ DROP INDEX <NOMBRE DEL INDEX> ON <TABLA>; /*INDICES PARCIALES*/ /*Podemos crear un indice utilizando solo una parte del campo (de su contenido), por ejemplo este comando crea un indice sobre los primeros 5 caracteres del campo*/ CREATE INDEX cust_name_indx ON customers<name<5>> /*INDICE COMPUESTO*/ CREATE INDEX Nombre_llave ON nombreTabla(campo1,campo2,campo3....); /* SOLO LAS TABLAS CON TIPO MyISAM*(No transaccionales ) soportan indices tipo FULL-Tex/ */ CREATE TABLE clientes( customes_code VARCHAR(10) NOT NULL, name VARCHAR(40) NOT NULL, PRIMARY KEY(CUSTOMER_CODE) ) ENGINE = MyISAM; /*-------------------2019-01-21--------------------*/ EXPLAIN mysql> use CEMABE; mysql> SHOW TABLES; mysql> DESCRIBE CEMABE_PERSONAL; mysql> SELECT ENT,COUNT(*) FROM CEMABE_PERSONAL GOUP BY ENT; mysql> EXPLAIN SELECT ENT,COUNT(*) FROM CEMABE_PERSONAL GOUP BY ENT; mysql> CREATE INDEX IND_CEMABE_ENT ON CEMABE_PERSONAL(ENT); mysql> EXPLAIN SELECT ENT,COUNT(*) FROM CEMABE_PERSONAL GOUP BY ENT; mysql> SELECT ENT,COUNT(*) FROM CEMABE_PERSONAL GOUP BY ENT;
DELETE FROM platforms WHERE name IN ('solaris2', 'aix', 'ubuntu', 'centos', 'redhat', 'windows');
-- MySQL Script generated by MySQL Workbench -- Sun Sep 13 19:14:53 2020 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; -- ----------------------------------------------------- -- Schema booksdb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema booksdb -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `booksdb` DEFAULT CHARACTER SET utf8 ; USE `booksdb` ; -- ----------------------------------------------------- -- Table `booksdb`.`users` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `booksdb`.`users` ( `id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NULL, `alias` VARCHAR(255) NULL, `email` VARCHAR(255) NULL, `password_hash` VARCHAR(255) NULL, `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `booksdb`.`authors` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `booksdb`.`authors` ( `id` INT NOT NULL AUTO_INCREMENT, `author_name` VARCHAR(255) NULL, `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `booksdb`.`books` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `booksdb`.`books` ( `id` INT NOT NULL AUTO_INCREMENT, `author_id` INT NOT NULL, `title` VARCHAR(255) NULL, `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), INDEX `fk_books_authors_idx` (`author_id` ASC) VISIBLE, CONSTRAINT `fk_books_authors` FOREIGN KEY (`author_id`) REFERENCES `booksdb`.`authors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `booksdb`.`reviews` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `booksdb`.`reviews` ( `id` INT NOT NULL AUTO_INCREMENT, `book_id` INT NOT NULL, `user_id` INT NOT NULL, `content` TEXT NULL, `rating` VARCHAR(2) NULL, `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), INDEX `fk_reviews_books1_idx` (`book_id` ASC) VISIBLE, INDEX `fk_reviews_users1_idx` (`user_id` ASC) VISIBLE, CONSTRAINT `fk_reviews_books1` FOREIGN KEY (`book_id`) REFERENCES `booksdb`.`books` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_reviews_users1` FOREIGN KEY (`user_id`) REFERENCES `booksdb`.`users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
#!Ups INSERT INTO SITE VALUES (1, 'site_name', 'http://example.com', 'http://example.com/index.rdf', NULL, '', 0, 0, '2014-01-01 00:00:00'); INSERT INTO SITE SELECT ID + 1, NAME, URL, RSS_URL, THUMBNAIL, SCRAPING_CSS_SELECTOR, CLICK_COUNT, HATEBU_COUNT, CRAWLED_AT FROM SITE; INSERT INTO SITE SELECT ID + 2, NAME, URL, RSS_URL, THUMBNAIL, SCRAPING_CSS_SELECTOR, CLICK_COUNT, HATEBU_COUNT, CRAWLED_AT FROM SITE; INSERT INTO SITE SELECT ID + 4, NAME, URL, RSS_URL, THUMBNAIL, SCRAPING_CSS_SELECTOR, CLICK_COUNT, HATEBU_COUNT, CRAWLED_AT FROM SITE; INSERT INTO SITE SELECT ID + 8, NAME, URL, RSS_URL, THUMBNAIL, SCRAPING_CSS_SELECTOR, CLICK_COUNT, HATEBU_COUNT, CRAWLED_AT FROM SITE; INSERT INTO SITE SELECT ID + 16, NAME, URL, RSS_URL, THUMBNAIL, SCRAPING_CSS_SELECTOR, CLICK_COUNT, HATEBU_COUNT, CRAWLED_AT FROM SITE;
\c olx_scrapper_db CREATE TABLE appartments( id serial, offered_by text, surface integer, partitioning text, year_of_construction text, floor text, no_rooms int, description int, images text[], price int )
ALTER TABLE `crm_record` CHANGE COLUMN `user_id` `owned_by` BIGINT UNSIGNED NOT NULL DEFAULT 0; ALTER TABLE `crm_record` ADD COLUMN `created_by` BIGINT UNSIGNED NOT NULL DEFAULT 0; ALTER TABLE `crm_record` ADD COLUMN `updated_by` BIGINT UNSIGNED NOT NULL DEFAULT 0; ALTER TABLE `crm_record` ADD COLUMN `deleted_by` BIGINT UNSIGNED NOT NULL DEFAULT 0; UPDATE crm_record SET created_by = owned_by; UPDATE crm_record SET updated_by = owned_by WHERE updated_at IS NOT NULL; UPDATE crm_record SET deleted_by = owned_by WHERE deleted_at IS NOT NULL;
CREATE Procedure sp_get_payment_adjustment (@VendorID nvarchar(20)) As Select 1, VoucherPrefix.Prefix + Cast(AdjustmentReturnAbstract.DocumentID As nvarchar), AdjustmentReturnAbstract.AdjustmentDate, AdjustmentReturnAbstract.AdjustmentID, AdjustmentReturnAbstract.Balance, AdjustmentReturnAbstract.Total_Value, Null From AdjustmentReturnAbstract, VoucherPrefix Where AdjustmentReturnAbstract.VendorID = @VendorID And AdjustmentReturnAbstract.Balance > 0 And IsNull(AdjustmentReturnAbstract.Status, 0) & 64 = 0 And IsNull(AdjustmentReturnAbstract.Status, 0) & 128 = 0 And VoucherPrefix.TranID = 'STOCK ADJUSTMENT PURCHASE RETURN' Union Select 2, VoucherPrefix.Prefix + Cast(DocumentID As nvarchar), DocumentDate, DebitID, Balance, NoteValue, DocRef From DebitNote, VoucherPrefix Where DebitNote.VendorID = @VendorID And Balance > 0 And VoucherPrefix.TranID = 'DEBIT NOTE' Union Select 3, FullDocID, DocumentDate, DocumentID, Balance, Value, Null From Payments Where Payments.VendorID = @VendorID And Balance > 0 And IsNull(Status, 0) & 128 = 0 Union Select 6, VoucherPrefix.Prefix + Cast(DocumentID As nvarchar), ClaimDate, ClaimID, Balance, ClaimValue, DocumentReference From ClaimsNote, VoucherPrefix Where ClaimsNote.VendorID = @VendorID And IsNull(Balance, 0) > 0 And VoucherPrefix.TranID = 'CLAIMS NOTE'
INSERT INTO VERSION(ID, START_DATE, END_DATE, IS_CURRENT) VALUES(1, '2019-01-01', null, true); INSERT INTO TECHTALK_TEAMS(TEAM_NAME, VERSION_ID) VALUES ('UNSTOPPABLE', 1); INSERT INTO TECHTALK_TEAMS(TEAM_NAME, VERSION_ID) VALUES ('AVENGERS', 1); INSERT INTO TEAM_MEMBER_DETAILS(ID,EMPID, EMPNAME, DESIGNATION, TEAM_ID, BU, EMAIL) VALUES (1,'IS3987','VIGNESH','DEVELOPER',1, 'HDS','vignesh@innovasolutions.com'); INSERT INTO TEAM_MEMBER_DETAILS(ID,EMPID, EMPNAME, DESIGNATION, TEAM_ID, BU, EMAIL) VALUES (2,'IS3988','Naveen','manager', 1, 'HDS','naveen@innovasolutions.com'); INSERT INTO TEAM_MEMBER_DETAILS(ID,EMPID, EMPNAME, DESIGNATION, TEAM_ID, BU, EMAIL) VALUES (3,'IS3989','chandrasekar','DEVELOPER', 2, 'HDS','chandra@innovasolutions.com'); INSERT INTO TEAM_MEMBER_DETAILS(ID,EMPID, EMPNAME, DESIGNATION, TEAM_ID, BU, EMAIL) VALUES (4,'IS4215','Sundar','DEVELOPER', 2, 'HDS','sundar@innovasolutions.com'); INSERT INTO TOPICS (ID,TITLE, ATTACHEMENT, PRESENTED_BY, PRESENTED_ON) VALUES (1,'SAFE', null, 1, '2019-01-01'); INSERT INTO TOPICS (ID,TITLE, ATTACHEMENT, PRESENTED_BY, PRESENTED_ON) VALUES (2,'CYPRESS', null, 2, '2019-01-04'); -- -- -- -- --INSERT INTO TEAM_MEMBER_DETAILS VALUES (4,'IS3999','VIGNESH','DEVELOPER','HDS','123',1); --INSERT INTO TEAM_MEMBER_DETAILS VALUES (5,'IS3234','Naveen','manager','HDS','123',1); --INSERT INTO TEAM_MEMBER_DETAILS VALUES (6,'IS3453','chandrasekar','DEVELOPER','HDS','123',1); --INSERT INTO TEAM_MEMBER_DETAILS VALUES (7,'IS3233','VIGNESH','DEVELOPER','HDS','123',1); --INSERT INTO TEAM_MEMBER_DETAILS VALUES (8,'IS3432','Naveen','manager','HDS','123',1); --INSERT INTO TEAM_MEMBER_DETAILS VALUES (9,'IS3435','chandrasekar','DEVELOPER','HDS','123',1); -- -- INSERT INTO RATINGS(ID,FEED1, FEED2,FEED3,FEED4,FEED5,FEED6, TOPIC_ID,TEAM_MEMBER_ID) VALUES (1,10, 9, 8, 7, 6, 5, 1, 1); INSERT INTO RATINGS(ID,FEED1, FEED2,FEED3,FEED4,FEED5,FEED6, TOPIC_ID,TEAM_MEMBER_ID) VALUES (2,10, 9, 8, 7, 6, 5, 2, 2); -- -- ----INSERT INTO SCOREBOARD VALUES (1,1,1,10,1); --
CREATE USER NHS_OFFENDER PASSWORD 'dummy';
-- SLAVE REQUIREMENTS CHANGE MASTER TO MASTER_HOST='hybrid3', MASTER_USER='repl3', MASTER_PASSWORD='1234567890', MASTER_LOG_FILE='bin-logs.000003', MASTER_LOG_POS=154; START SLAVE;
select id,name from products where id_categories=9 or id_categories=7
--public static String EP_WALLET_INSERT = INSERT INTO Wallet VALUES (?,?) / --public static String EP_WALLET_SELECT = SELECT idGlobal, wallet FROM Wallet / --public static String EP_WALLET_UPDATE = UPDATE Wallet SET wallet=? WHERE idGlobal=? / --public static String EP_USER_SELECT = SELECT idGlobal FROM User WHERE login=? AND passHash=? / --public static String EP_USER_INSERT = INSERT INTO User VALUES (?,?,?) / --public static String EP_WALTER_SELECT = SELECT idGlobal, expires FROM Walter WHERE token=? / --public static String EP_WALTER_DELETE = DELETE FROM Walter WHERE token=? / --public static String EP_SESSION_SELECT = SELECT idGlobal, expires FROM Session WHERE token=? / --public static String EP_SESSION_SELECT_ALL = SELECT idGlobal FROM Session / --public static String EP_SESSION_DELETE = DELETE FROM Session WHERE token=? / --public static String EP_SESSION_INSERT = INSERT INTO Session VALUES (?,?,?,?) / --public static String EP_TRANSACTION_SELECT = SELECT * FROM Transaction WHERE address=? / --public static String EP_TRANSACTION_SELECT_ALL = SELECT idGlobal FROM Transaction / --public static String EP_TRANSACTION_INSERT = INSERT INTO Transaction VALUES (?,?,?,?,?) / --public static String EP_TRANSACTION_DELETE = DELETE FROM Transaction WHERE address=? / --public static String EP_ADDRESS_SELECT = SELECT * FROM Address WHERE idWallet=? / --public static String EP_ADDRESS_SELECT_ALL = SELECT idGlobal FROM Address / --public static String EP_ADDRESS_INSERT = INSERT INTO Address VALUES (?,?,?,?) / --public static String EP_ADDRESS_UPDATE = UPDATE Address SET balance=? WHERE idGlobal=? / --public static String EP_ADDRESS_DELETE = DELETE FROM Address WHERE address=? /
# Copyright 2015 CityGrid Media, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use arsenal; # Initial Admin password is 'password' INSERT INTO users VALUES (1, 'admin@yourcompany.com', 'Nope', 'Nope', 'Vf7ZmjQarLus/TqT', '$6$Vf7ZmjQarLus/TqT$l5qsqY4ntpX8nEzbm33n5StF5D.93yV3uoh8ucthwFf8mEJBitnGLr5SWhzD2vpkpnAJnUiLl40d0hH24qPOq1', 'Admin', NOW(),NOW()); # Initial kaboom password is 'password' INSERT INTO users VALUES (2, 'kaboom', 'Register', 'Bot', 'Vf7ZmjQarLus/TqT', '$6$Vf7ZmjQarLus/TqT$l5qsqY4ntpX8nEzbm33n5StF5D.93yV3uoh8ucthwFf8mEJBitnGLr5SWhzD2vpkpnAJnUiLl40d0hH24qPOq1', 'Admin', NOW(),NOW()); # Initial hvm password is 'test' INSERT INTO users VALUES (3, 'hvm', 'Hypervisor Vm', 'Bot', 'MRM/VA0wb3zbpkOq', '$6$rounds=656000$MRM/VA0wb3zbpkOq$i5GhDFjIFj9IgRmhEgxWvmt0U6VOUQp5K6XGCn/ExuieuJu8xA7Oxqc6.SVUaM0wjXgyQBw188L3ZVxolC6/m1', 'Admin', NOW(),NOW()); INSERT INTO users VALUES (4, 'aaron.bandt@citygridmedia.com', 'Aaron', 'Bandt', '$6$Vf7ZmjQarLus/TqT', '$6$Vf7ZmjQarLus/TqT$l5qsqY4ntpX8nEzbm33n5StF5D.93yV3uoh8ucthwFf8mEJBitnGLr5SWhzD2vpkpnAJnUiLl40d0hH24qPOq1', 'Admin', NOW(),NOW()); INSERT INTO groups VALUES (1,'local_admin','Admin',NOW(),NOW()); INSERT INTO groups VALUES (2,'api_write','Admin',NOW(),NOW()); INSERT INTO groups VALUES (3,'api_register','Admin',NOW(),NOW()); INSERT INTO group_perms VALUES (1,'admin',NOW(),NOW()); INSERT INTO group_perms VALUES (2,'api_write',NOW(),NOW()); INSERT INTO group_perms VALUES (3,'api_register',NOW(),NOW()); INSERT INTO group_perm_assignments (group_id,perm_id,updated_by) VALUES (1,1,'Admin'); INSERT INTO group_perm_assignments (group_id,perm_id,updated_by) VALUES (1,2,'Admin'); INSERT INTO group_perm_assignments (group_id,perm_id,updated_by) VALUES (1,3,'Admin'); INSERT INTO group_perm_assignments (group_id,perm_id,updated_by) VALUES (2,2,'Admin'); INSERT INTO group_perm_assignments (group_id,perm_id,updated_by) VALUES (3,3,'Admin'); INSERT INTO local_user_group_assignments (group_id,user_id,updated_by,created,updated) VALUES (1, 1, 'Admin', NOW(),NOW()); INSERT INTO local_user_group_assignments (group_id,user_id,updated_by,created,updated) VALUES (2, 1, 'Admin', NOW(),NOW()); INSERT INTO local_user_group_assignments (group_id,user_id,updated_by,created,updated) VALUES (3, 1, 'Admin', NOW(),NOW()); INSERT INTO local_user_group_assignments (group_id,user_id,updated_by,created,updated) VALUES (3, 2, 'Admin', NOW(),NOW()); INSERT INTO local_user_group_assignments (group_id,user_id,updated_by,created,updated) VALUES (2, 3, 'Admin', NOW(),NOW()); INSERT INTO statuses VALUES (1, 'initializing', 'Instances in the process of spinning up.', 'Admin', NOW(),NOW()); INSERT INTO statuses VALUES (2, 'setup', 'New node, not yet configured.', 'Admin', NOW(),NOW()); INSERT INTO statuses VALUES (3, 'inservice', 'Hardware and OS functional, applications running.', 'Admin', NOW(),NOW()); INSERT INTO statuses VALUES (4, 'hibernating', 'Instances that have been spun down that will be spun up on demand.', 'Admin', NOW(),NOW()); INSERT INTO statuses VALUES (5, 'decom', 'Nodes that are dead and gone.', 'Admin', NOW(),NOW()); INSERT INTO node_groups VALUES (1, 'default_install', 'Default node gorup for all nodes.', 'admin@yourcompany.com', NOW(), NOW(), 'Admin');
/* Navicat Premium Data Transfer Source Server : my_mysql Source Server Type : MySQL Source Server Version : 50623 Source Host : 10.10.40.81 Source Database : MQMonDB Target Server Type : MySQL Target Server Version : 50623 File Encoding : utf-8 Date: 03/11/2015 14:19:52 PM */ SET NAMES utf8; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for `MQTpsByBroker` -- ---------------------------- DROP TABLE IF EXISTS `MQTpsByBroker`; CREATE TABLE `MQTpsByBroker` ( `Date` datetime NOT NULL, `NameServerAddr` varchar(22) NOT NULL COMMENT '服务发现server地址', `ClusterName` varchar(32) NOT NULL COMMENT '集群名称', `BrokerID` int(2) NOT NULL COMMENT 'Broker集群ID', `InTPS` int(11) NOT NULL DEFAULT '0' COMMENT '单台Broker下生产并发量TPS', `OutTPS` int(11) NOT NULL DEFAULT '0' COMMENT '单台Broker下消费并发量TPS', PRIMARY KEY (`Date`,`BrokerID`,`ClusterName`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; SET FOREIGN_KEY_CHECKS = 1;
--CRIANDO UM BANCO DE DADOS CREATE DATABASE aula; --CRIANDO UM USUARIO E ALTERANDO O NOME DO BANCO CREATE USER tiago PASSWORD '123'; ALTER DATABASE aula OWNER TO tiago; --LOGANDO COM O NOSSO USUARIO \q exit exit psql -H localhost -U tiago -d aula; --COMANDOS POSTGRES \d => estrutura da tabela \l => lista os bancos de dados \dt => lista as tabelas \du => lista todos os usuarios \x => altera o tipo de visualizacao --CRIANDO TABELA DE USUARIOS CREATE TABLE usuarios( id SERIAL PRIMARY KEY, nome VARCHAR(200) NOT NULL, email VARCHAR(150) NOT NULL UNIQUE, senha VARCHAR(200) NOT NULL ); --CRIANDO TABELA POSTS CREATE TABLE posts( id SERIAL PRIMARY KEY, titulo VARCHAR(150) NOT NULL UNIQUE, conteudo TEXT, criado_em TIMESTAMP DEFAULT NOW(), publicado BOOLEAN DEFAULT FALSE, usuario_id INT NOT NULL REFERENCES usuarios(id) ); --ALTERANDO VALOR DA TABELA ALTER TABLE posts ALTER COLUMN criado_em TYPE TIMESTAMP DEFAULT DEFAULT NOW(); --inserir dados usuarios INSERT INTO usuarios(nome, email, senha) VALUES('Tiago Felipe', 'tiagosantos0412@gmail.com', '123'); --inserir dados posts INSERT INTO posts(titulo, usuario_id) VALUES('Meu primeiro post', 1); --removendo a chave unique ALTER TABLE POSTS DROP CONSTRAINT posts_titulo_key; SELECT u.*, p.* FROM posts p INNER JOIN usuarios u ON p.usuario_id = u.id WHERE u.id = 3;
INSERT INTO users (username, password) VALUES ('carla', '123'); INSERT INTO watson (saved_on, anger_score, disgust_score, fear_score, joy_score, sadness_score, username) VALUES ('2016-12-14', '0.142021', '0.209965', '0.030666', '0.0798084', '0.0568845', 'carla'), ('2016-12-13', '0.437327', '0.456828', '0.048761', '0.033854', '0.482709', 'carla'), ('2016-12-12', '0.144327', '0.174828', '0.44961', '0.143854', '0.482709', 'carla'), ('2016-12-12', '0.144327', '0.174828', '0.11961', '0.143854', '0.482709', 'carla'), ('2016-12-11', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'carla'), ('2016-12-10', '0.144327', '0.174828', '0.11961', '0.143854', '0.482709', 'carla'), ('2016-12-09', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'carla'), ('2016-12-08', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'carla'), ('2016-12-07', '0.144327', '0.174828', '0.11961', '0.143854', '0.482709', 'carla'), ('2016-12-06', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'carla'); INSERT INTO users (username, password) VALUES ('jo', '123'); INSERT INTO watson (saved_on, anger_score, disgust_score, fear_score, joy_score, sadness_score, username) VALUES ('2016-12-14', '0.142021', '0.209965', '0.430666', '0.298084', '0.268845', 'jo'), ('2016-12-13', '0.037327', '0.026828', '0.12761', '0.213854', '0.482709', 'jo'), ('2016-12-12', '0.144327', '0.174828', '0.44961', '0.143854', '0.482709', 'jo'), ('2016-12-11', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'jo'), ('2016-12-10', '0.144327', '0.174828', '0.11961', '0.143854', '0.482709', 'jo'), ('2016-12-09', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'jo'), ('2016-12-08', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'jo'), ('2016-12-07', '0.144327', '0.174828', '0.11961', '0.143854', '0.482709', 'jo'), ('2016-12-06', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'jo'); INSERT INTO users (username, password) VALUES ('bo', '123'); INSERT INTO watson (saved_on, anger_score, disgust_score, fear_score, joy_score, sadness_score, username) VALUES ('2016-12-14', '0.342021', '0.109965', '0.080666', '0.098084', '0.268845', 'bo'), ('2016-12-13', '0.077327', '0.174828', '0.12761', '0.013854', '0.122709', 'bo'), ('2016-12-12', '0.144327', '0.174828', '0.11961', '0.143854', '0.482709', 'bo'), ('2016-12-11', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'bo'), ('2016-12-10', '0.144327', '0.174828', '0.11961', '0.143854', '0.482709', 'bo'), ('2016-12-09', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'bo'), ('2016-12-08', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'bo'), ('2016-12-07', '0.144327', '0.174828', '0.11961', '0.143854', '0.482709', 'bo'), ('2016-12-06', '0.542021', '0.109965', '0.080666', '0.098084', '0.268845', 'bo'); INSERT INTO quotes (quote, author, emotion) VALUES ('Speak when you''re angry, and you''ll make the best speech you''ll ever regret', 'Ambrose Bierce', 'anger'), ('You will not be punished for your anger, you will be punished by your anger.', 'Buddha', 'anger'), ('For every minute you remain angry, you give up sixty seconds of peace of mind.', 'Ralph Waldo Emerson', 'anger'), ('Anger is the enemy of non-violence and pride is a monster that swallows it up.', 'Mahatma Gandhi', 'anger'), ('Holding on to anger is like grasping a hot coal with the intent of throwing it at someone else; you are the one who gets burned.', 'Buddha', 'angry'), ('People won''t have time for you if you are always angry or complaining.', 'Stephen Hawking', 'anger'), ('When anger rises, think of the consequences.', 'Confucius', 'anger'), ('Anybody can become angry - that is easy, but to be angry with the right person and to the right degree and at the right time and for the right purpose, and in the right way - that is not within everybody''s power and is not easy.', 'Aristotle', 'anger'), ('Whatever is begun in anger ends in shame.', 'Benjamin Franklin', 'anger'), ('Anger and intolerance are the enemies of correct understanding.', 'Mahatma Gandhi', 'anger'), ('Appearance is something absolute, but reality is not that way - everything is interdependent, not absolute. So that view is very helpful to maintain a peace of mind because the main destroyer of a peaceful mind is anger.', 'Dalai Lama', 'anger'), ('I shall allow no man to belittle my soul by making me hate him.', 'Booker T. Washington', 'anger'), ('I used to be disgusted; now I try to be amused.', 'Elvis Costello', 'disgust'), ('No one is so completely disenchanted with the world, or knows it so thoroughly, or is so utterly disgusted with it, that when it begins to smile upon him he does not become partially reconciled to it.', 'Giacomo Leopardi', 'disgust'), ('I am hard to disgust, but a pretentious poet can do it', 'Marianne Moore', 'disgust'), ('I had forgotten. Disgust shadows desire. Another life is never safely envied', 'Robert Wells', 'disgust'), ('I learned that courage was not the absence of fear, but the triumph over it. The brave man is not he who does not feel afraid, but he who conquers that fear', 'Nelson Mandela', 'fear'), ('The fear of death follows from the fear of life. A man who lives fully is prepared to die at any time.', 'Mark Twain', 'fear'), ('We are afraid to care too much, for fear that the other person does not care at all.', 'Eleanor Roosevelt', 'fear'), ('Fear keeps us focused on the past or worried about the future. If we can acknowledge our fear, we can realize that right now we are okay. Right now, today, we are still alive, and our bodies are working marvelously. Our eyes can still see the beautiful sky. Our ears can still hear the voices of our loved ones.', 'Thich Nhat Hanh', 'fear'), ('We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light.', 'Plato', 'fear'), ('Courage is resistance to fear, mastery of fear, not absence of fear.', 'Mark Twain', 'fear'), ('Remembering that I''ll be dead soon is the most important tool I''ve ever encountered to help me make the big choices in life. Because almost everything - all external expectations, all pride, all fear of embarrassment or failure - these things just fall away in the face of death, leaving only what is truly important.', 'Steve Jobs', 'fear'), ('If you know the enemy and know yourself you need not fear the results of a hundred battles.', 'Sun Tzu', 'fear'), ('Being happy never goes out of style.', 'Lilly Pulitzer', 'joy'), ('Don''t waste a minute not being happy. If one window closes, run to the next window or break down a door.', 'Brooke Shields', 'joy'), ('When you rise in the morning, give thanks for the light, for your life, for your strength. Give thanks for your food and for the joy of living. If you see no reason to give thanks, the fault lies in yourself', 'Tecumseh', 'joy'), ('Joy in looking and comprehending is nature''s most beautiful gift.', 'Albert Einstein', 'joy'), ('We are shaped by our thoughts; we become what we think. When the mind is pure, joy follows like a shadow that never leaves.', 'Buddha', 'joy'), ('Happiness lies in the joy of achievement and the thrill of creative effort.', 'Franklin D. Roosevelt', 'joy'), ('It is the supreme art of the teacher to awaken joy in creative expression and knowledge.', 'Albert Einstein', 'joy'), ('Gratitude can transform common days into thanksgivings, turn routine jobs into joy, and change ordinary opportunities into blessings.', 'William Arthur Ward', 'joy'), ('Let my soul smile through my heart and my heart smile through my eyes, that I may scatter rich smiles in sad hearts. ', 'Paramahansa Yogananda', 'sadness'), ('Tears come from the heart and not from the brain.', 'Leonardo DaVinci', 'sadness'), ('The good times of today, are the sad thoughts of tomorrow.', 'Bob Marley', 'sadness'), ('It''s sad to know I''m done. But looking back, I''ve got a lot of great memories.', 'Bonnie Blair', 'sadness'), ('First, accept sadness. Realize that without losing, winning isn''t so great.', 'Alyssa Milano', 'sadness'), ('The word ''happy'' would lose its meaning if it were not balanced by sadness.', 'Carl Jung', 'sadness'), ('Your pain is the breaking of the shell that encloses your understanding.', 'Khalil Gibran', 'sadness'), ('Affliction comes to us, not to make us sad but sober; not to make us sorry but wise.', 'H. G. Wells', 'sadness'), ('The rose and the thorn, and sorrow and gladness are linked together.', 'Saadi', 'sadness'), ('Sadness is but a wall between two gardens.', 'Khalil Gibran', 'sadness');
CREATE DATABASE myflaskapp ; use myflaskapp; CREATE TABLE articles ( username varchar(20), author varchar(20), title varchar(20), body varchar(100) ); CREATE TABLE users ( name varchar(20), email varchar(20), username varchar(20), password varchar(100) );
create or replace view v1_hdjh004_zball as ( select f."CZDE397",f."DE011",f."DE007",f."CZDE420",f."JSDE221",f."DE181",f."JSDE053",f."CZDE391",f."JSDE901",f."JSDE940", f."DE042",f."JSDE955",f."DE151",f."DE001",f."JSDE909",f."CZDE388",f."CZDE387",f."DE390",f."DE382",f."DE384",f."JSDE220",f."DE281", f."CZDE954",f."DE052",f."JSDE960",f."JSDE961",f."CZDE095",nvl(f."CZDE053",0) czde053,f."CZDE054",f."JSDE041",f."JSDE039",f."JSDE012",f."JSDE016", f."CZDE057",f."JSDE214",f."DE062",f."CZDE938",f."JSDE068",f."JSDE019",f."JSDE014",f."CZDE940",f."CZDE941",f."JSDE090",f."JSDE999",f."DE022", f."JSDE007",f."DE102",f.de101,f.de102||f."DE101" as xmdmmc,f."CZDE126",f."DE046",f."DE050",f."CZDE061",f."DE192",f."HDDE149", nvl(f."HDDE150",0) hdde150,f."CZDED34",nvl(f."HDDE151",0) hdde151,nvl(f."HDDE152",0) hdde152, f."JSDE963",f.jsde964,f.jsde965,nvl(f.HDDE157,0) hdde157,f.CZDE402,nvl(f.czde015,0) czde015,f.czde425,f.czde435,f.czde438, (select sum(a.de181) from zb010 a,zb006 b where jsde013=25 and a.jsde107 = b.jsde107 and a.jsde115 = f.czde397 and b.de186 like '1%') as czbzje, (select sum(a.de181) from zb010 a,zb006 b where jsde013=25 and a.jsde107 = b.jsde107 and a.jsde115 = f.czde397 and b.de186 like '9%') as yswje, (select sum(a.de181) from hdjh005 a where a.czde397 = f.czde397 and a.czde056 = 0) as qtzj, (select jsde121 from zb099 b where b.jsde117='HDJH004' and f.czde397=b.jsde125) FJ, (select zbbh from v1_hdjh004_zbbh a where a.czde397 = f.czde397) as tzdbh, (select distinct min(jsde318) from hdcg005 a where a.czde397 = f.czde397) as SCZBSJ--首次中标时间 from hdjh004 f );
INSERT INTO employees(empno, ename, hiredate) VALUES (&&empno,'&ename', '&hiredate') / select empno, ename, hiredate from employees / rollback / select empno, ename, hiredate from employees /
SELECT empresas.id, almacen.precio_detal, almacen.cantidad,producto.imagen,producto.img1,producto.img2,producto.img3, producto.nombre, producto.slug,producto.categoria,producto.subcat_id, producto.descripcion, producto.estado, producto.created_at, producto.updated_at FROM `almacen` JOIN producto ON almacen.producto = producto.id JOIN categorias ON producto.categoria = categorias.id JOIN sedes ON almacen.sede = sedes.id JOIN empresas ON sedes.empresa_id = empresas.id WHERE almacen.sede =21 /*29 cod sport center sedes 20, 21 services.msc stetikline sede 24 */
create table tab_view ( col_add_ix_1 number(15) not null, col_add_ix_2 number(15) not null ); create materialized view mview_add_clob_viewselect as select col_add_ix_1, col_add_ix_2, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_3, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_4, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_5, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_6, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_7, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_8, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_9, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_10, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_11, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_12, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_13, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_14, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_15, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_16, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_17, '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' as col_18 from tab_view; create table tab_add_mview ( col_add_ix_1 number(15) not null, col_add_ix_2 number(15) not null ); create materialized view tab_add_mview on prebuilt table refresh complete on demand enable query rewrite as select col_add_ix_1, col_add_ix_2 from tab_view; create table tab_mod_mview ( col_add_ix_1 number(15) not null, col_add_ix_2 number(15) not null ); create materialized view tab_mod_mview on prebuilt table never refresh enable query rewrite as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view tab_mod_rewrite never refresh disable query rewrite as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_mod_select as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_mod_build_mode build immediate as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_mod_compress compress for direct_load operations build immediate as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_mod_parallel parallel build immediate as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_mod_parallel_4 parallel 4 build immediate as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_mod_noparallel noparallel build immediate as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_mod_tabspace tablespace SYSTEM noparallel build immediate as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_mod_tabspace_reverse noparallel build immediate as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_add_immediate build immediate refresh complete disable query rewrite as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_add_deferred build deferred refresh complete on demand as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_add_force build deferred refresh force on demand as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_add_compress compress for all operations refresh force on demand as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_add_default_tabspace tablespace USERS compress refresh force as select col_add_ix_1, col_add_ix_2 from tab_view; create materialized view mview_add_domain_tabspace tablespace SYSTEM compress refresh force as select col_add_ix_1, col_add_ix_2 from tab_view;
CREATE SCHEMA barcodes; CREATE TABLE barcodes.access_controls ( access_level varchar(10) NOT NULL, access_value integer NOT NULL, CONSTRAINT pk_access_controls PRIMARY KEY ( access_level ) ); COMMENT ON TABLE barcodes.access_controls IS 'Track access levels for bitwise comparisons'; CREATE TABLE barcodes.barcode ( barcode varchar(9) NOT NULL, obsolete varchar(1) , assigned_on timestamp , create_timestamp timestamp DEFAULT current_timestamp NOT NULL, CONSTRAINT barcode_pkey PRIMARY KEY ( barcode ) ); COMMENT ON COLUMN barcodes.barcode.assigned_on IS 'date barcode assigned to a project'; COMMENT ON COLUMN barcodes.barcode.create_timestamp IS 'Date barcode created on the system'; CREATE TABLE barcodes.extraction_settings ( extractionkit_lot varchar(40) NOT NULL, extraction_robot varchar(40) NOT NULL, tm1000_8_tool varchar(40) NOT NULL ); CREATE TABLE barcodes.people ( person_id bigserial NOT NULL, name varchar(100) NOT NULL, email varchar NOT NULL, address varchar(100) , affiliation varchar , phone varchar(20) , CONSTRAINT pk_people PRIMARY KEY ( person_id ) ); CREATE TABLE barcodes.plates ( plate_barcode varchar NOT NULL, plate_name varchar(100) NOT NULL, created_on timestamp DEFAULT current_timestamp NOT NULL, finalized bool DEFAULT 'F' NOT NULL, person_id bigint NOT NULL, CONSTRAINT idx_plates UNIQUE ( plate_barcode ) , CONSTRAINT pk_plates PRIMARY KEY ( plate_barcode ), CONSTRAINT fk_plates FOREIGN KEY ( plate_barcode ) REFERENCES barcodes.barcode( barcode ) , CONSTRAINT fk_plates_0 FOREIGN KEY ( person_id ) REFERENCES barcodes.people( person_id ) ); CREATE INDEX idx_plates_0 ON barcodes.plates ( person_id ); COMMENT ON COLUMN barcodes.plates.person_id IS 'Who plated the samples'; CREATE TABLE barcodes.primers ( primer_id bigserial NOT NULL, primer_name varchar , company varchar NOT NULL, linker varchar NOT NULL, fwd_primer varchar NOT NULL, rev_primer varchar NOT NULL, barcodes json NOT NULL, CONSTRAINT pk_primers PRIMARY KEY ( primer_id ) ); CREATE TABLE barcodes.primers_lots ( primer_id bigint NOT NULL, lot varchar , created_on timestamp DEFAULT current_timestamp NOT NULL, person_id bigint NOT NULL, CONSTRAINT pk_primers_lots UNIQUE ( lot ) , CONSTRAINT fk_primers_lots FOREIGN KEY ( primer_id ) REFERENCES barcodes.primers( primer_id ) , CONSTRAINT fk_primers_lots_0 FOREIGN KEY ( person_id ) REFERENCES barcodes.people( person_id ) ); CREATE INDEX idx_primers_lots ON barcodes.primers_lots ( primer_id ); CREATE INDEX idx_primers_lots_0 ON barcodes.primers_lots ( person_id ); CREATE TABLE barcodes.project ( project_id bigserial NOT NULL, project varchar(1000) NOT NULL, description varchar , pi bigint , contact_person bigint , created_on timestamp DEFAULT current_timestamp NOT NULL, CONSTRAINT project_pkey PRIMARY KEY ( project_id ) ); COMMENT ON COLUMN barcodes.project.pi IS 'primary investigator on the study'; CREATE TABLE barcodes.project_barcode ( project_id bigint NOT NULL, barcode varchar NOT NULL, CONSTRAINT fk_project_barcode FOREIGN KEY ( project_id ) REFERENCES barcodes.project( project_id ) , CONSTRAINT fk_project_barcode_0 FOREIGN KEY ( barcode ) REFERENCES barcodes.barcode( barcode ) ); CREATE INDEX idx_project_barcode ON barcodes.project_barcode ( project_id ); CREATE INDEX idx_project_barcode_0 ON barcodes.project_barcode ( barcode ); CREATE TABLE barcodes.run ( run_id bigserial NOT NULL, name varchar(100) NOT NULL, created_on timestamp DEFAULT current_timestamp NOT NULL, created_by bigint NOT NULL, finalized bool DEFAULT 'F' NOT NULL, finalized_on timestamp , finalized_by bigint , CONSTRAINT idx_run_0 UNIQUE ( name ) , CONSTRAINT pk_run PRIMARY KEY ( run_id ), CONSTRAINT fk_run FOREIGN KEY ( finalized_by ) REFERENCES barcodes.people( person_id ) ); CREATE INDEX idx_run ON barcodes.run ( finalized_by ); COMMENT ON TABLE barcodes.run IS 'Full run, equivalent to a multi-lane sequencing run'; CREATE TABLE barcodes.samples ( sample_id bigserial NOT NULL, external_name varchar(100) NOT NULL, barcode varchar , sample_type varchar NOT NULL, sample_location varchar , biomass_remaining bool DEFAULT 'T' NOT NULL, created_on timestamp DEFAULT current_timestamp NOT NULL, created_by bigint NOT NULL, last_scanned timestamp DEFAULT current_timestamp NOT NULL, last_scanned_by bigint NOT NULL, CONSTRAINT pk_samples PRIMARY KEY ( sample_id ), CONSTRAINT pk_samples_0 UNIQUE ( external_name ) , CONSTRAINT fk_samples FOREIGN KEY ( barcode ) REFERENCES barcodes.barcode( barcode ) , CONSTRAINT fk_samples_1 FOREIGN KEY ( last_scanned_by ) REFERENCES barcodes.people( person_id ) , CONSTRAINT fk_samples_2 FOREIGN KEY ( created_by ) REFERENCES barcodes.people( person_id ) ); CREATE INDEX idx_samples ON barcodes.samples ( barcode ); CREATE INDEX idx_samples_1 ON barcodes.samples ( last_scanned_by ); CREATE INDEX idx_samples_2 ON barcodes.samples ( created_by ); COMMENT ON COLUMN barcodes.samples.sample_type IS 'The type of sample collected (stool, soil, etc)'; COMMENT ON COLUMN barcodes.samples.sample_location IS 'Physical location of sample tube'; COMMENT ON COLUMN barcodes.samples.last_scanned_by IS 'Pereson who last scanned the barcode'; CREATE TABLE barcodes.users ( username varchar NOT NULL, pass varchar(36) NOT NULL, person_id integer NOT NULL, "access" integer NOT NULL, created_on timestamp DEFAULT current_timestamp NOT NULL, CONSTRAINT pk_users PRIMARY KEY ( username ), CONSTRAINT fk_users FOREIGN KEY ( person_id ) REFERENCES barcodes.people( person_id ) ); CREATE INDEX idx_users ON barcodes.users ( person_id ); COMMENT ON COLUMN barcodes.users."access" IS 'What access the user is allowed'; CREATE TABLE barcodes.plates_samples ( plate_barcode varchar NOT NULL, sample_id bigint NOT NULL, well varchar(3) NOT NULL, CONSTRAINT idx_plate_samples PRIMARY KEY ( plate_barcode, sample_id ), CONSTRAINT fk_plate_samples FOREIGN KEY ( sample_id ) REFERENCES barcodes.samples( sample_id ) , CONSTRAINT fk_plate_samples_0 FOREIGN KEY ( plate_barcode ) REFERENCES barcodes.plates( plate_barcode ) ); CREATE INDEX idx_plate_samples_0 ON barcodes.plates_samples ( sample_id ); CREATE INDEX idx_plate_samples_1 ON barcodes.plates_samples ( plate_barcode ); CREATE TABLE barcodes.pool ( pool_id bigserial NOT NULL, run_id bigint , name varchar(100) NOT NULL, created_on timestamp DEFAULT current_timestamp NOT NULL, created_by bigint NOT NULL, finalized bool DEFAULT 'F' NOT NULL, finalized_on timestamp , finalized_by bigint NOT NULL, CONSTRAINT idx_pool_2 UNIQUE ( name ) , CONSTRAINT pk_pool PRIMARY KEY ( pool_id ), CONSTRAINT fk_pool FOREIGN KEY ( run_id ) REFERENCES barcodes.run( run_id ) , CONSTRAINT fk_pool_0 FOREIGN KEY ( created_by ) REFERENCES barcodes.people( person_id ) , CONSTRAINT fk_pool_1 FOREIGN KEY ( finalized_by ) REFERENCES barcodes.people( person_id ) ); CREATE INDEX idx_pool ON barcodes.pool ( run_id ); CREATE INDEX idx_pool_0 ON barcodes.pool ( created_by ); CREATE INDEX idx_pool_1 ON barcodes.pool ( finalized_by ); COMMENT ON TABLE barcodes.pool IS 'Pool of samples, equivalent to a single lane for sequencing'; CREATE TABLE barcodes.project_sample ( sample_id bigint NOT NULL, project_id bigint NOT NULL, CONSTRAINT project_barcode_pkey PRIMARY KEY ( project_id ), CONSTRAINT pk_project_sample UNIQUE ( sample_id ) , CONSTRAINT fk_pb_to_project FOREIGN KEY ( project_id ) REFERENCES barcodes.project( project_id ) , CONSTRAINT fk_project_sample FOREIGN KEY ( sample_id ) REFERENCES barcodes.samples( sample_id ) ); CREATE TABLE barcodes.protocol_settings ( protocol_settings_id bigserial NOT NULL, protocol_id integer , sample_id bigint , plate_barcode varchar , created_on timestamp DEFAULT current_timestamp NOT NULL, created_by bigint NOT NULL, CONSTRAINT pk_protocol_runs PRIMARY KEY ( protocol_settings_id ), CONSTRAINT fk_protocol_runs FOREIGN KEY ( created_by ) REFERENCES barcodes.people( person_id ) , CONSTRAINT fk_protocol_runs_1 FOREIGN KEY ( plate_barcode ) REFERENCES barcodes.plates( plate_barcode ) , CONSTRAINT fk_protocol_runs_2 FOREIGN KEY ( sample_id ) REFERENCES barcodes.samples( sample_id ) ); CREATE INDEX idx_protocol_runs ON barcodes.protocol_settings ( created_by ); CREATE INDEX idx_protocol_runs_1 ON barcodes.protocol_settings ( plate_barcode ); CREATE INDEX idx_protocol_runs_2 ON barcodes.protocol_settings ( sample_id ); CREATE TABLE barcodes.pcr_settings ( protocol_settings_id bigint NOT NULL, extraction_protocol_settings_id bigint , primer_lot varchar NOT NULL, mastermix_lot varchar(40) NOT NULL, water_lot varchar(40) NOT NULL, processing_robot varchar(40) NOT NULL, tm300_8_tool varchar(40) NOT NULL, tm50_8_tool varchar(40) NOT NULL, CONSTRAINT pk_hardcode_settings UNIQUE ( protocol_settings_id ) , CONSTRAINT pk_hardcode_settings_0 PRIMARY KEY ( protocol_settings_id ), CONSTRAINT fk_hardcode_settings FOREIGN KEY ( primer_lot ) REFERENCES barcodes.primers_lots( lot ) , CONSTRAINT fk_hardcode_settings_0 FOREIGN KEY ( protocol_settings_id ) REFERENCES barcodes.protocol_settings( protocol_settings_id ) , CONSTRAINT fk_pcr_settings FOREIGN KEY ( extraction_protocol_settings_id ) REFERENCES barcodes.protocol_settings( protocol_settings_id ) ); CREATE INDEX idx_hardcode_settings ON barcodes.pcr_settings ( primer_lot ); CREATE INDEX idx_pcr_settings ON barcodes.pcr_settings ( extraction_protocol_settings_id ); CREATE TABLE barcodes.pool_samples ( pool_id bigint NOT NULL, protocol_settings_id bigint NOT NULL, volume varchar , CONSTRAINT fk_pool_samples FOREIGN KEY ( pool_id ) REFERENCES barcodes.pool( pool_id ) , CONSTRAINT fk_pool_samples_0 FOREIGN KEY ( protocol_settings_id ) REFERENCES barcodes.protocol_settings( protocol_settings_id ) ); CREATE INDEX idx_pool_samples ON barcodes.pool_samples ( pool_id ); CREATE INDEX idx_pool_samples_0 ON barcodes.pool_samples ( protocol_settings_id ); COMMENT ON COLUMN barcodes.pool_samples.volume IS 'Volume used from each plate/sample for final pool';
SELECT TOP (5) e.EmployeeID, e.FirstName, p.[Name] AS ProjectName FROM Employees e JOIN [EmployeesProjects] ep ON e.EmployeeID = ep.EmployeeID JOIN [Projects] p ON p.ProjectID = ep.ProjectID WHERE p.StartDate > '2002-08-13 00:00:00' AND p.EndDate IS NULL ORDER BY e.EmployeeID
/* Warnings: - Added the required column `duration` to the `assessment` table without a default value. This is not possible if the table is not empty. - Added the required column `schedule` to the `assessment` table without a default value. This is not possible if the table is not empty. */ -- AlterTable ALTER TABLE "assessment" ADD COLUMN "duration" TIMETZ NOT NULL, ADD COLUMN "schedule" TIMESTAMPTZ NOT NULL;
CREATE TABLE users( Nom VARCHAR(120) NOT NULL, Score INT(11) DEFAULT 0, PRIMARY KEY (Nom) ); /* Dès que vous avez créer la base vous faites "USE calculatrice;" Puis "SOURCE C:/wamp64/www/sql/Creation_table.sql" */
create table city ( id bigint auto_increment primary key, name varchar(255) null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create table company ( id bigint auto_increment primary key, company_logo varchar(255) null, company_registration varchar(255) null, date_of_creation datetime null, info varchar(255) null, legal_address varchar(255) null, name varchar(255) null, city_of_company bigint null, constraint FKbk2fldd8i3j16sxhiv7u1wlum foreign key (city_of_company) references city (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKbk2fldd8i3j16sxhiv7u1wlum on company (city_of_company) ; create table courses ( id bigint auto_increment primary key, name varchar(255) null, company bigint null, constraint FKn3kho9fsq2dk9icugjb1jav04 foreign key (company) references company (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKn3kho9fsq2dk9icugjb1jav04 on courses (company) ; create table courses_skill ( id bigint auto_increment primary key, mark int null, courses bigint null, skill bigint null, constraint FKidnaroskqv5a32karjau56mor foreign key (courses) references courses (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKidnaroskqv5a32karjau56mor on courses_skill (courses) ; create index FKq4vcy9s377iccqifiudb6gb4a on courses_skill (skill) ; create table department ( id bigint auto_increment primary key, name varchar(255) null, specialization varchar(255) null, faculty bigint null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK6sk1ry6h6g5ejrihwm8haf88l on department (faculty) ; create table department_skill ( id bigint auto_increment primary key, mark int null, department bigint null, skill bigint null, constraint FKn66blblyc0ixoaebeo92noopm foreign key (department) references department (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKd4w53bv22gcd2y2sqxqc0l1c7 on department_skill (skill) ; create index FKn66blblyc0ixoaebeo92noopm on department_skill (department) ; create table education ( id bigint auto_increment primary key, end_of_education datetime null, start_of_education datetime null, department bigint null, school bigint null, type_of_education bigint null, user bigint null, constraint FK63tr6a4xjq3e62tq52gmt5twn foreign key (department) references department (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK198l9sf1b0xanx6mp4au0cmgf on education (type_of_education) ; create index FK2mvosaxmdk20x35f654ykcplj on education (user) ; create index FK63tr6a4xjq3e62tq52gmt5twn on education (department) ; create index FKaisuay6bqm69r0pd1omskh0l8 on education (school) ; create table experience ( id bigint auto_increment primary key, date_of_end datetime null, date_of_start datetime null, prev_company bigint null, position bigint null, user bigint null, constraint FKc19dq0h5qymr9epwviyngjxic foreign key (prev_company) references company (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKc19dq0h5qymr9epwviyngjxic on experience (prev_company) ; create index FKpfh1r83yw1avr31sw3ub99ppa on experience (position) ; create index FKsal35eberq8nmfvfis0bxp5j on experience (user) ; create table faculty ( id bigint auto_increment primary key, name varchar(255) null, university bigint null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKl1hcf6t7l10y28o108exht46d on faculty (university) ; alter table department add constraint FK6sk1ry6h6g5ejrihwm8haf88l foreign key (faculty) references faculty (id) ; create table gender ( id bigint auto_increment primary key, name varchar(255) not null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create table history ( id bigint auto_increment primary key, date_of_history datetime null, history_info varchar(255) null, education bigint null, experience bigint null, user bigint null, courses bigint null, constraint FKpip11hwoqfjrrp6leo2prk5ny foreign key (education) references education (id), constraint FK3mqsud0tlrcn67vg2f1vnwy0v foreign key (experience) references experience (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK3mqsud0tlrcn67vg2f1vnwy0v on history (experience) ; create index FK9i377avigaa5nxmjyts3qhnwy on history (courses) ; create index FKcgxo71htg9isvktffsodq8g94 on history (user) ; create index FKpip11hwoqfjrrp6leo2prk5ny on history (education) ; create table position ( id bigint auto_increment primary key, name varchar(255) null ) engine=InnoDb DEFAULT CHARSET=utf8 ; alter table experience add constraint FKpfh1r83yw1avr31sw3ub99ppa foreign key (position) references position (id) ; create table position_skill ( id bigint auto_increment primary key, psition bigint null, skill bigint null, constraint FKrbwccr2kt3yatpx8wgglsarcr foreign key (psition) references position (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKftw0v131ksvhtjsxuq9lo00bm on position_skill (skill) ; create index FKrbwccr2kt3yatpx8wgglsarcr on position_skill (psition) ; create table possible_cities_to_work ( id_user bigint not null, id_city bigint not null, primary key (id_user, id_city), constraint FK2pykxv9f2pgdoa7298s3pxpgn foreign key (id_city) references city (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK2pykxv9f2pgdoa7298s3pxpgn on possible_cities_to_work (id_city) ; create table school ( id bigint auto_increment primary key, name varchar(255) null, city bigint null, constraint FKfoakajih50nlit17nuymdsc4w foreign key (city) references city (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKfoakajih50nlit17nuymdsc4w on school (city) ; alter table education add constraint FKaisuay6bqm69r0pd1omskh0l8 foreign key (school) references school (id) ; create table skill ( id bigint auto_increment primary key, name varchar(255) null, type_of_skill bigint not null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK2pq7nkn4vi1tw0f3sh9te20ak on skill (type_of_skill) ; alter table courses_skill add constraint FKq4vcy9s377iccqifiudb6gb4a foreign key (skill) references skill (id) ; alter table department_skill add constraint FKd4w53bv22gcd2y2sqxqc0l1c7 foreign key (skill) references skill (id) ; alter table position_skill add constraint FKftw0v131ksvhtjsxuq9lo00bm foreign key (skill) references skill (id) ; create table summary ( id bigint auto_increment primary key, text varchar(255) null, user bigint null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKsr71us8i74ib72m71y2jy21tc on summary (user) ; create table task ( id bigint auto_increment primary key, info varchar(255) null, name varchar(255) null, type_of_task bigint null ) ; create index FKhnxotnqsbea4shipxmjxk4a1v on task (type_of_task) ; create table task_skill ( id bigint auto_increment primary key, skill bigint null, task bigint null, constraint FKrqovwv8qhc3vt1r5etshfs0ge foreign key (skill) references skill (id), constraint FK531rx05uc86qlhwtkx049ce18 foreign key (task) references task (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK531rx05uc86qlhwtkx049ce18 on task_skill (task) ; create index FKrqovwv8qhc3vt1r5etshfs0ge on task_skill (skill) ; create table temp_user ( id bigint auto_increment primary key, birthday datetime null, confirm_link varchar(255) null, email varchar(255) null, first_name varchar(255) null, last_name varchar(255) null, middle_name varchar(255) null, password varchar(255) null, username varchar(255) null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create table type_of_education ( id bigint auto_increment primary key, name varchar(255) null ) engine=InnoDb DEFAULT CHARSET=utf8 ; alter table education add constraint FK198l9sf1b0xanx6mp4au0cmgf foreign key (type_of_education) references type_of_education (id) ; create table type_of_link ( id bigint auto_increment primary key, name varchar(255) null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create table type_of_skill ( id bigint auto_increment primary key, name varchar(255) null ) engine=InnoDb DEFAULT CHARSET=utf8 ; alter table skill add constraint FK2pq7nkn4vi1tw0f3sh9te20ak foreign key (type_of_skill) references type_of_skill (id) ; create table type_of_task ( id bigint auto_increment primary key, name varchar(255) null ) engine=InnoDb DEFAULT CHARSET=utf8 ; alter table task add constraint FKhnxotnqsbea4shipxmjxk4a1v foreign key (type_of_task) references type_of_task (id) ; create table type_of_user ( id bigint auto_increment primary key, name varchar(255) null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create table type_of_vacancy ( id bigint auto_increment primary key, name varchar(255) null ) engine=InnoDb DEFAULT CHARSET=utf8 ; create table university ( id bigint auto_increment primary key, name varchar(255) null, city bigint null, constraint FKgpb65dw0enw32ntji9bjuhr0l foreign key (city) references city (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKgpb65dw0enw32ntji9bjuhr0l on university (city) ; alter table faculty add constraint FKl1hcf6t7l10y28o108exht46d foreign key (university) references university (id) ; create table user ( id bigint auto_increment primary key, active bit null, birthday datetime null, email varchar(255) not null, first_name varchar(255) not null, last_name varchar(255) not null, middle_name varchar(255) not null, uid varchar(255) not null, username varchar(255) not null, city_of_living bigint null, gender bigint null, type_of_user bigint null, constraint FKkrcm363wm8xl5ydosqnynmhym foreign key (city_of_living) references city (id), constraint FK1isrcw5olh4k3cddck2x7um5p foreign key (gender) references gender (id), constraint FKgcjmd56vdfe8y4uxwq5jb852d foreign key (type_of_user) references type_of_user (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK1isrcw5olh4k3cddck2x7um5p on user (gender) ; create index FKgcjmd56vdfe8y4uxwq5jb852d on user (type_of_user) ; create index FKkrcm363wm8xl5ydosqnynmhym on user (city_of_living) ; alter table education add constraint FK2mvosaxmdk20x35f654ykcplj foreign key (user) references user (id) ; alter table experience add constraint FKsal35eberq8nmfvfis0bxp5j foreign key (user) references user (id) ; alter table history add constraint FKcgxo71htg9isvktffsodq8g94 foreign key (user) references user (id) ; alter table possible_cities_to_work add constraint FKhawf6m0kjxwn02ajtgjpjbam7 foreign key (id_user) references user (id) ; alter table summary add constraint FKsr71us8i74ib72m71y2jy21tc foreign key (user) references user (id) ; create table user_company ( id_user_company bigint auto_increment primary key, change_approve bit null, company_approve bit null, company bigint null, position bigint null, user bigint null, constraint FKi6q4u3i9d85h47qjn7w7p9687 foreign key (company) references company (id), constraint FKc1goa9mr96odm0l38subly2jf foreign key (position) references position (id), constraint FKopbeqqs42qr4nhq4ew10dt069 foreign key (user) references user (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKc1goa9mr96odm0l38subly2jf on user_company (position) ; create index FKi6q4u3i9d85h47qjn7w7p9687 on user_company (company) ; create index FKopbeqqs42qr4nhq4ew10dt069 on user_company (user) ; create table user_courses ( id bigint auto_increment primary key, date_of_end datetime null, date_of_start datetime null, if_courses_pass bit null, courses bigint null, user bigint null, constraint FKfl9etfqvikmtqq9exitrcg5ue foreign key (courses) references courses (id), constraint FKdlc2xqew3j47dpxpg97mllb7d foreign key (user) references user (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKdlc2xqew3j47dpxpg97mllb7d on user_courses (user) ; create index FKfl9etfqvikmtqq9exitrcg5ue on user_courses (courses) ; alter table history add constraint FK9i377avigaa5nxmjyts3qhnwy foreign key (courses) references user_courses (id) ; create table user_link ( id bigint auto_increment primary key, link varchar(255) null, type_of_link bigint null, user bigint null, constraint FK87htt7kka5c380ilp3vk0efqm foreign key (type_of_link) references type_of_link (id), constraint FKb6w40vevtg43uda0m72yddfb7 foreign key (user) references user (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK87htt7kka5c380ilp3vk0efqm on user_link (type_of_link) ; create index FKb6w40vevtg43uda0m72yddfb7 on user_link (user) ; create table user_skill ( id bigint auto_increment primary key, end_skilling datetime null, skill_mark varchar(255) null, skill_practical_mark varchar(255) null, start_skilling datetime null, id_marker bigint null, id_skill bigint null, id_user bigint null, constraint FK6pru830ugj5nuapp3nhdl2p9p foreign key (id_marker) references user (id), constraint FKrsvxrshr30q4756yoxncoaeyl foreign key (id_skill) references skill (id), constraint FKkwwol8ie05lcjsko1qewnm6r7 foreign key (id_user) references user (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK6pru830ugj5nuapp3nhdl2p9p on user_skill (id_marker) ; create index FKkwwol8ie05lcjsko1qewnm6r7 on user_skill (id_user) ; create index FKrsvxrshr30q4756yoxncoaeyl on user_skill (id_skill) ; create table vacancy ( id bigint auto_increment primary key, info varchar(255) null, company bigint null, type_of_vacancy bigint null, constraint FKd8i1boc2bf2p3pmtgi3ucxyqf foreign key (company) references company (id), constraint FKg1qrdnkrpjlkt2fr9twump8pt foreign key (type_of_vacancy) references type_of_vacancy (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKd8i1boc2bf2p3pmtgi3ucxyqf on vacancy (company) ; create index FKg1qrdnkrpjlkt2fr9twump8pt on vacancy (type_of_vacancy) ; create table vacancy_skill ( id bigint auto_increment primary key, expected_mark varchar(255) null, skill bigint null, vacancy bigint null, constraint FKk10dm3uxe9tlepfwottw6q072 foreign key (skill) references skill (id), constraint FKogk31vh34wanbyjgvq8yer6hi foreign key (vacancy) references vacancy (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKk10dm3uxe9tlepfwottw6q072 on vacancy_skill (skill) ; create index FKogk31vh34wanbyjgvq8yer6hi on vacancy_skill (vacancy) ; create table vacancy_task ( id bigint auto_increment primary key, task bigint null, vacancy bigint null, constraint FK6ba9j9jtk95526blq7994470h foreign key (task) references task (id), constraint FKsfm3668avg4bw12qfax2slrrd foreign key (vacancy) references vacancy (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FK6ba9j9jtk95526blq7994470h on vacancy_task (task) ; create index FKsfm3668avg4bw12qfax2slrrd on vacancy_task (vacancy) ; create table vacancy_user ( id bigint auto_increment primary key, if_accepted_user bit null, if_company_accepted bit null, user bigint null, vacancy bigint null, constraint FKgqk92dw8f09b5kttg02uff0rm foreign key (user) references user (id), constraint FKpe3ak6fx2jbgormipmkxy9rff foreign key (vacancy) references vacancy (id) ) engine=InnoDb DEFAULT CHARSET=utf8 ; create index FKgqk92dw8f09b5kttg02uff0rm on vacancy_user (user) ; create index FKpe3ak6fx2jbgormipmkxy9rff on vacancy_user (vacancy) ;
SELECT -- eventID -- eventID includes a reference to the specific network project and the identifier of the specific receiver deployment (id_pk) involved in the detection occurrence 'etn:' || projectcode || ':' || id_pk || ':' || 'event-receiver-deployment' AS eventID, measurementType, measurementValue, measurementUnit FROM ( -- receiver id SELECT projectcode, id_pk, 'receiver id'::text AS measurementType, receiver::text AS measurementValue, ''::text AS measurementUnit FROM vliz.deployments_view UNION ALL -- receiver status SELECT projectcode, id_pk, 'receiver status'::text AS measurementType, CASE WHEN receiver_status = 'Active' THEN 'active'::text WHEN receiver_status = 'Available' THEN 'available'::text WHEN receiver_status = 'Lost' THEN 'lost'::text WHEN receiver_status = 'Broken' THEN 'broken'::text WHEN receiver_status = 'Returned to manufacturer' THEN 'returned to manufacturer'::text END AS measurementValue, ''::text AS measurementUnit FROM vliz.deployments_view UNION ALL -- receiver type SELECT d.projectcode, d.id_pk, 'receiver type'::text AS measurementType, CASE WHEN r.receiver_type = 'acoustic_telemetry' THEN 'acoustic telemetry'::text END AS measurementValue, ''::text AS measurementUnit FROM vliz.deployments_view AS d JOIN vliz.receivers AS r ON (d.receiver_fk = r.id_pk) UNION ALL -- receiver bottom depth SELECT projectcode, id_pk, 'receiver bottom depth'::text AS measurementType, bottom_depth AS measurementValue, 'm'::text AS measurementUnit FROM vliz.deployments_view WHERE bottom_depth IS NOT NULL UNION ALL -- intended coordinates SELECT projectcode, id_pk, 'receiver intended coordinates'::text AS measurementType, ( 'latitude: ' || ROUND(intended_lat::numeric,5) || ', ' 'longitude: ' || ROUND(intended_long::numeric,5) )::text AS measurementValue, ''::text AS measurementUnit FROM vliz.deployments_view WHERE intended_lat IS NOT NULL UNION ALL -- drop dead date SELECT projectcode, id_pk, 'receiver drop dead date'::text AS measurementType, (to_char(drop_dead_date, 'YYYY-MM-DD'))::text AS measurementValue, ''::text AS measurementUnit FROM vliz.deployments_view WHERE drop_dead_date IS NOT NULL UNION ALL -- Time interval between the recording of temperature statistic SELECT projectcode, id_pk, 'time interval between recording of temperature statistic'::text AS measurementType, log_temperature_stats_period::text AS measurementValue, 's'::text AS measurementUnit FROM vliz.deployments_view WHERE log_temperature_stats_period IS NOT NULL UNION ALL -- Time interval between the sample values of temperature SELECT projectcode, id_pk, 'time interval between the sample values of temperature'::text AS measurementType, log_temperature_sample_period::text AS measurementValue, 's'::text AS measurementUnit FROM vliz.deployments_view WHERE log_temperature_sample_period IS NOT NULL UNION ALL -- Time interval between the recording of noise statistic SELECT projectcode, id_pk, 'time interval between the recording of noise statistic'::text AS measurementType, log_noise_stats_period::text AS measurementValue, 's'::text AS measurementUnit FROM vliz.deployments_view WHERE log_noise_stats_period IS NOT NULL UNION ALL -- Time interval between the sample values of noise SELECT projectcode, id_pk, 'time interval between the sample values of noise'::text AS measurementType, log_noise_sample_period::text AS measurementValue, 's'::text AS measurementUnit FROM vliz.deployments_view WHERE log_noise_sample_period IS NOT NULL UNION ALL -- Time interval between the recording of depth statistic SELECT projectcode, id_pk, 'time interval between the recording of depth statistic'::text AS measurementType, log_depth_stats_period::text AS measurementValue, 's'::text AS measurementUnit FROM vliz.deployments_view WHERE log_depth_stats_period IS NOT NULL UNION ALL -- Time interval between the sample values of depth SELECT projectcode, id_pk, 'time interval between the sample values of depth'::text AS measurementType, log_depth_sample_period::text AS measurementValue, 's'::text AS measurementUnit FROM vliz.deployments_view WHERE log_depth_sample_period IS NOT NULL UNION ALL -- Time interval between the sample values of tilt SELECT projectcode, id_pk, 'time interval between the sample values of tilt'::text AS measurementType, log_tilt_sample_period::text AS measurementValue, 's'::text AS measurementUnit FROM vliz.deployments_view WHERE log_tilt_sample_period IS NOT NULL ) AS x WHERE projectcode IN ({network_projects*}) ORDER BY eventID
-------------------------------------------------------- -- Archivo creado - jueves-enero-05-2017 -------------------------------------------------------- -------------------------------------------------------- -- DDL for Package PK_T004_PROY_FTE_FINANC -------------------------------------------------------- CREATE OR REPLACE PACKAGE "PK_T004_PROY_FTE_FINANC" IS /************************************************************************ DESCRIPCION : Servicios CRUD sobre la tabla PK_T004_PROY_FTE_FINANC REALIZADO POR : Fernando Mondragón Amaya FECHA CREACION : 29/12/2016 FECHA MODIFICA : 29/12/2016 MODIFICADO POR : DESCRIPCION CAMBIO: ************************************************************************/ NOMBRE_PAQUETE CONSTANT VARCHAR2(100) := 'PK_T004_Proy_Fte_Financ'; TYPE CURSOR_SALIDA IS REF CURSOR; ---- PROCEDURE Pr_Insertar( p_A004IDPROYECTO IN GPYT_T004_Proy_Fte_Financ.A004IDPROYECTO%TYPE, p_A004IDFUNTFINNCCN IN GPYT_T004_Proy_Fte_Financ.A004IDFUNTFINNCCN%TYPE, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2); PROCEDURE Pr_Eliminar( p_A004CODIGO IN GPYT_T004_Proy_Fte_Financ.A004CODIGO%TYPE, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2); PROCEDURE Pr_Actualizar( p_A004CODIGO IN GPYT_T004_Proy_Fte_Financ. A004CODIGO%TYPE, p_A004IDPROYECTO IN GPYT_T004_Proy_Fte_Financ.A004IDPROYECTO%TYPE, p_A004IDFUNTFINNCCN IN GPYT_T004_Proy_Fte_Financ.A004IDFUNTFINNCCN%TYPE, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2); PROCEDURE Pr_ConsultarPorFiltro( p_Filtro IN VARCHAR2, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2); END PK_T004_Proy_Fte_Financ; /************************************************************************ FIN creación del HEADER del package PK_T004_Proy_Fte_Financ ************************************************************************/ /
SELECT msn, ac_reg_no, flight_no, tail_no, fleet_id AS FLEET_ID, dep AS DEP_CITY, arr AS ARR_CITY, dep_gate, grnd_stn, MAX(off_time) AS OFF_TIME, MAX(on_time) AS ON_TIME, MAX(out_time) AS OUT_TIME, MAX(in_time) AS IN_TIME FROM (SELECT msn, ac_reg_no, tail_no, grnd_stn, ( CASE flights.phase WHEN 'OFF' THEN event_time END ) AS OFF_TIME, ( CASE flights.phase WHEN 'OUT' THEN event_time END ) AS OUT_TIME, ( CASE flights.phase WHEN 'ON' THEN event_time END ) AS ON_TIME, ( CASE flights.phase WHEN 'IN' THEN event_time END ) AS IN_TIME, flights.dep_city AS dep, flights.arr_city AS arr, flights.flight_no, fleet.fleet_id, flights.dep_gate, flights.operator FROM bombardier.servs_fleets flights, bombardier.servs_flight_history hist, bombardier.fleet_info fleet WHERE flights.leg_id = hist.leg_id AND fleet.ac_mcn = flights.msn AND hist.phase IN ( 'OFF', 'OUT', 'ON' ) AND operator = ? ) AS stg GROUP BY msn, ac_reg_no, fleet_id, flight_no, tail_no, dep, arr, dep_gate, grnd_stn
/* Name: Listings Impressions > Views > Leads Data source: 4 Created By: Admin Last Update At: 2015-09-03T18:12:49.858418+00:00 */ SELECT MG_HL.marketingGroup_name AS MarketingGroup, MG_HL.brokerage_name AS Brokerage, MG_HL.branch_name AS Branch, MG_HL.agent_name AS Agent, MG_HL.listing_id+'-'+nvl(MG_HL.listing_address,'') AS Listing, sum(nvl(integer(HHCI.Impressions),0)) AS Hero_Imp, sum(nvl(integer(V_HHC.Views),0)) AS Hero_Views, sum(nvl(integer(HFLI.Impressions),0)) AS Featured_Imp, sum(nvl(integer(V_HFL.Views),0)) AS Featured_Views, sum(nvl(integer(V.Views),0)) AS Views, sum(nvl(integer(L.Leads),0)) AS Leads FROM [djomniture:devspark.MG_Hierarchy_Listing] MG_HL /**** SELECT FOR TOTAL VIEWS, VISITS AND VISITORS ****/ JOIN EACH (SELECT Listing, COUNT(*) AS Views, COUNT(DISTINCT post_visid_high + "-" + post_visid_low + "-" + visit_num) Visits, COUNT(DISTINCT post_visid_high + "-" + post_visid_low) Visitors FROM (SELECT NTH(1, SPLIT(post_prop20, '-')) AS Listing, post_visid_high, post_visid_low, visit_num FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')) WHERE post_page_event = "0" /*PAGE VIEW CALLS*/ AND DATE(date_time) >= DATE('{{startdate}}') AND DATE(date_time) <= DATE('{{enddate}}') AND post_prop20 != '' /* listing id is not null*/ AND post_prop19 = 'listing' /* Counting Listings */ ) a GROUP BY Listing) V ON MG_HL.listing_id = V.Listing /**** SELECT FOR LEADS ****/ LEFT OUTER JOIN EACH (SELECT count(*) Leads, string(Listing_id) AS Listing_ID FROM [djomniture:devspark.MG_Leads] WHERE DATE(date) >= DATE('{{startdate}}') AND DATE(date) <= DATE('{{enddate}}') GROUP BY Listing_ID) AS L ON MG_HL.listing_id = L.Listing_ID /**** SELECT FOR IMPRESSIONS:home_hero_carousel ****/ LEFT OUTER JOIN EACH (SELECT listing_id, Impressions FROM ( SELECT DESC,HHC.listing_id AS listing_id, count(*) Impressions FROM ( SELECT SPLIT(post_prop69, ',') AS listing_id, 'home_hero_carousel' AS DESC FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')) WHERE post_page_event = "0" /*Page View Calls*/ AND DATE(date_time) >= DATE('{{startdate}}') AND DATE(date_time) <= DATE('{{enddate}}') AND post_prop1 = 'home' /*Impressions Made in Home*/ AND post_prop69 != '' /*impressions_home_hero_carousel*/ AND post_prop70 != '' /*impressions_home_featured_developments*/ AND post_prop71 != '' /*impressions_home_featured_listings*/ ) HHC GROUP BY DESC,listing_id )) HHCI ON MG_HL.listing_id = HHCI.listing_id /**** SELECT FOR IMPRESSIONS:home_featured_listings ****/ LEFT OUTER JOIN EACH ( SELECT HFL.listing_id AS listing_id, count(*) Impressions FROM ( SELECT SPLIT(post_prop71, ',') AS listing_id, 'home_featured_listings' AS DESC FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')) WHERE post_page_event = "0" /*Page View Calls*/ AND DATE(date_time) >= DATE('{{startdate}}') AND DATE(date_time) <= DATE('{{enddate}}') AND post_prop1 = 'home' /*Impressions Made in Home*/ AND post_prop69 != '' /*impressions_home_hero_carousel*/ AND post_prop70 != '' /*impressions_home_featured_developments*/ AND post_prop71 != '' /*impressions_home_featured_listings*/ ) HFL GROUP BY DESC,listing_id ) HFLI ON MG_HL.listing_id = HFLI.listing_id /**** SELECT FOR VIEWS:home_featured_listing ****/ LEFT OUTER JOIN EACH (SELECT Listing, COUNT(*) AS Views, COUNT(DISTINCT post_visid_high + "-" + post_visid_low + "-" + visit_num) Visits, COUNT(DISTINCT post_visid_high + "-" + post_visid_low) Visitors FROM (SELECT NTH(1, SPLIT(post_prop20, '-')) AS Listing, post_prop10, post_visid_high, post_visid_low, visit_num FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')) WHERE post_page_event = "0" /*PAGE VIEW CALLS*/ AND DATE(date_time) >= DATE('{{startdate}}') AND DATE(date_time) <= DATE('{{enddate}}') AND post_prop20 != '' /* listing id is not null*/ AND post_prop19 = 'listing' /* Counting Listings */ ) a JOIN [djomniture:devspark.MODS] M ON post_prop10 = MOD WHERE MOD IN ('home_featured_listing') GROUP BY Listing) V_HFL ON MG_HL.listing_id = V_HFL.Listing /**** SELECT FOR VIEWS:home_hero ****/ LEFT OUTER JOIN EACH (SELECT Listing, COUNT(*) AS Views, COUNT(DISTINCT post_visid_high + "-" + post_visid_low + "-" + visit_num) Visits, COUNT(DISTINCT post_visid_high + "-" + post_visid_low) Visitors FROM (SELECT NTH(1, SPLIT(post_prop20, '-')) AS Listing, post_prop10, post_visid_high, post_visid_low, visit_num FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')) WHERE post_page_event = "0" /*PAGE VIEW CALLS*/ AND DATE(date_time) >= DATE('{{startdate}}') AND DATE(date_time) <= DATE('{{enddate}}') AND {{mgid}} != 0 AND post_prop20 != '' /* listing id is not null*/ AND post_prop19 = 'listing' /* Counting Listings */ ) a JOIN [djomniture:devspark.MODS] M ON post_prop10 = MOD WHERE MOD IN ('home_hero') GROUP BY Listing) V_HHC ON MG_HL.listing_id = V_HHC.Listing WHERE MG_HL.marketingGroup_id = '{{mgid}}' GROUP BY ROLLUP (MarketingGroup, Brokerage, Branch, Agent, Listing) ORDER BY MarketingGroup, Brokerage, Branch, Agent, Listing
use burgers_db; INSERT INTO burgers (burger_name,devoured) VALUE ("cheese burger" , 0); INSERT INTO burgers (burger_name,devoured) VALUE ("hamburger", 0); INSERT INTO burgers (burger_name,devoured) VALUE ("double cheese burger", 0);
CREATE DATABASE IF NOT EXISTS `Presentations_generator` DEFAULT CHARACTER SET utf8; USE `Presentations_generator`; CREATE TABLE `presentations` ( `id` int PRIMARY KEY AUTO_INCREMENT, `name` varchar(255), `category_id` int, `path` varchar(255) ); CREATE TABLE `slides` ( `id` int PRIMARY KEY AUTO_INCREMENT, `presentation_id` int, `heading` varchar(255), `text_area` longtext DEFAULT NULL, `list_json` json DEFAULT NULL, `codeblock` text DEFAULT NULL, `photo` varchar(255) DEFAULT NULL, `ordering` int, `type_id` int ); CREATE TABLE `slides_types` ( `id` int PRIMARY KEY AUTO_INCREMENT, `layout` varchar(255) ); CREATE TABLE `categories` ( `id` int PRIMARY KEY AUTO_INCREMENT, `name` varchar(255) ); ALTER TABLE `presentations` ADD FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`); ALTER TABLE `slides` ADD FOREIGN KEY (`presentation_id`) REFERENCES `presentations` (`id`); ALTER TABLE `slides` ADD FOREIGN KEY (`type_id`) REFERENCES `slides_types` (`id`);
CREATE Procedure sprc_Stock_by_ItemCategory_Details (@CATID INT, @FROMDATE DATETIME, @TODATE DATETIME) as Select "Item Code" = Batch_Products.Product_Code, "Item Name" = Items.ProductName, "StockValue" = cast(ISNULL(SUM(Batch_Products.quantity * Batch_Products.Purchaseprice),0) as decimal(18,2)), "StockQty (UOM)" = cast(cast(ISNULL(SUM(Batch_Products.Quantity), 0) as decimal(18,2)) as nvarchar) + ' ' + (SELECT Description From UOM WHERE UOM = Items.UOM) , "StockQty (CF)" = cast(cast(ISNULL(SUM(Batch_Products.Quantity * Items.ConversionFactor),0) as decimal (18,2) ) as nvarchar) + ' ' + (SELECT ConversionUnit From ConversionTable WHERE ConversionID = Items.ConversionUnit) , "StockQty (RU)" = cast(cast(SUM(Batch_Products.Quantity / (case ISNULL(Items.ReportingUnit, 0) when 0 then 1 else ISNULL(Items.ReportingUnit, 0) end)) as decimal(18,2) ) as nvarchar) + ' ' + (SELECT Description From UOM WHERE UOM = Items.ReportingUOM) from Batch_Products,Items where Batch_Products.product_code = items.product_code And Items.Categoryid=@CatID Group by Batch_Products.Product_Code, Items.ProductName , Items.UOM, Items.ReportingUOM, Items.ConversionUnit
-- phpMyAdmin SQL Dump -- version 4.9.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 07, 2020 at 10:06 AM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.3.13 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: `importexcel` -- -- -------------------------------------------------------- -- -- Table structure for table `mahasiswa` -- CREATE TABLE `mahasiswa` ( `nim` char(20) NOT NULL, `name` varchar(50) NOT NULL, `major` varchar(50) NOT NULL, `address` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `mahasiswa` -- INSERT INTO `mahasiswa` (`nim`, `name`, `major`, `address`) VALUES ('22', 'Jakarta', 'si', 'DSS'), ('224', 'Jakarta', 'gh', 'hfgh'), ('34', 'Jakarta', 'hg', 'hfgh'), ('422342', 'Medan', 'gh', 'hg'), ('423', 'Medan', 'hg', 'gh'), ('423423', 'Bogor', 'hg', 'hggf'), ('43', 'Medan', 'hg', 'FGF'), ('434', 'Medan', 'hg', 'hfgh'); -- -- Indexes for dumped tables -- -- -- Indexes for table `mahasiswa` -- ALTER TABLE `mahasiswa` ADD PRIMARY KEY (`nim`); 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 */;
-- phpMyAdmin SQL Dump -- version 4.8.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 02, 2019 at 07:32 PM -- Server version: 10.1.37-MariaDB -- PHP Version: 7.3.1 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: `db2` -- -- -------------------------------------------------------- -- -- Table structure for table `assign` -- CREATE TABLE `assign` ( `sec_id` int(11) NOT NULL, `ses_id` int(11) NOT NULL, `moderator_id` int(11) NOT NULL, `material_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `assign` -- INSERT INTO `assign` (`sec_id`, `ses_id`, `moderator_id`, `material_id`) VALUES (2, 1, 5, 1), (2, 1, 5, 11), (2, 2, 5, 2), (4, 3, 7, 3), (4, 4, 7, 4), (5, 5, 8, 5), (5, 6, 8, 5), (8, 7, 10, 7), (8, 8, 10, 8), (9, 9, 11, 9), (9, 10, 11, 10); -- -------------------------------------------------------- -- -- Table structure for table `courses` -- CREATE TABLE `courses` ( `c_id` int(11) NOT NULL, `title` varchar(255) NOT NULL, `description` varchar(255) DEFAULT NULL, `mentor_grade_req` int(11) NOT NULL, `mentee_grade_req` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `courses` -- INSERT INTO `courses` (`c_id`, `title`, `description`, `mentor_grade_req`, `mentee_grade_req`) VALUES (1, 'Database 1', 'A first course in databases.', 4, 3), (2, 'Database 2', 'A second course in databases.', 4, 3), (3, 'Operating Systems', 'A deep dive into OS.', 3, 2), (4, 'Computer Architecture', 'Learn the inner workings of computers.', 3, 2), (5, 'Computing 1', 'Begin the path of Computer Science', 2, 1), (6, 'Computing 2', 'Continue with advanced C techniques.', 2, 1), (7, 'Calculus 1', 'Measure under a curve.', 2, 1), (8, 'Mobile App 1', 'Learn how to develop native android applications.', 4, 3), (9, 'Foundations of Computer Science', 'Understand the origins of Comp Sci.', 3, 2), (10, 'College Writing 1', 'But words into sentences.', 2, 1); -- -------------------------------------------------------- -- -- Table structure for table `enroll` -- CREATE TABLE `enroll` ( `sec_id` int(11) NOT NULL, `mentee_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `enroll` -- INSERT INTO `enroll` (`sec_id`, `mentee_id`) VALUES (2, 20), (2, 29), (2, 30), (2, 40), (4, 20), (4, 21), (4, 22), (4, 34), (4, 40), (5, 18), (5, 21), (5, 22), (5, 29), (5, 30), (5, 34), (5, 40), (7, 18), (7, 35), (7, 40); -- -------------------------------------------------------- -- -- Table structure for table `material` -- CREATE TABLE `material` ( `material_id` int(11) NOT NULL, `title` varchar(255) NOT NULL, `author` varchar(255) DEFAULT NULL, `type` varchar(255) NOT NULL, `url` varchar(255) DEFAULT NULL, `assigned_date` date NOT NULL, `notes` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `material` -- INSERT INTO `material` (`material_id`, `title`, `author`, `type`, `url`, `assigned_date`, `notes`) VALUES (1, 'PHP and MySQL', 'Richard Bachman', 'Book', 'N/A', '2019-03-22', 'Read only chapters 2 and 3.'), (2, 'Building Web Apps', 'Kyle Demeter', 'Article', 'www.website.com/WebApp', '2019-01-28', 'N/A'), (3, 'Linux Pocket Guide', 'Linus Torvald', 'Book', 'N/A', '2019-01-29', 'Review common commands.'), (4, 'Introduction to Operating Systems', 'Timothy Oses', 'Book', 'N/A', '2019-01-29', 'Read chapter 1.'), (5, 'Bitwise foundations', 'William Bills', 'Article', 'www.uml.edu/~Bills/bwf.pdf', '2019-01-30', 'Read carefully'), (6, 'Absolue C++', 'Jimothy James', 'Book', 'N/A', '2019-01-31', 'Read chapter 2.'), (7, 'C++ for dummies.', 'Peter Brast', 'Handout', 'N/A', '2019-01-31', 'N/A'), (8, 'C++ for smarties', 'Richard Brast', 'Handout', 'N/A', '2019-02-07', 'Read last.'), (9, 'Pre-calculus', 'Liz Mattis', 'Book', 'www.LizMat.com', '2019-02-01', 'Review chapters 1-12.'), (10, 'Calculus', 'Liz Mattiz', 'Book', 'www.LizMat.com', '2019-02-08', 'Read chapter 1.'), (11, 'title', 'aauthor', 'type', 'kjklj', '2019-01-31', ''); -- -------------------------------------------------------- -- -- Table structure for table `mentees` -- CREATE TABLE `mentees` ( `mentee_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `mentees` -- INSERT INTO `mentees` (`mentee_id`) VALUES (18), (19), (20), (21), (22), (28), (29), (30), (33), (34), (35), (40); -- -------------------------------------------------------- -- -- Table structure for table `mentors` -- CREATE TABLE `mentors` ( `mentor_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `mentors` -- INSERT INTO `mentors` (`mentor_id`) VALUES (23), (24), (25), (26), (27), (28), (29), (30), (33), (34), (35); -- -------------------------------------------------------- -- -- Table structure for table `moderate` -- CREATE TABLE `moderate` ( `sec_id` int(11) NOT NULL, `moderator_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `moderate` -- INSERT INTO `moderate` (`sec_id`, `moderator_id`) VALUES (1, 4), (2, 4), (3, 6), (4, 7), (5, 8), (6, 9), (7, 10), (8, 11), (9, 12), (10, 13); -- -------------------------------------------------------- -- -- Table structure for table `moderators` -- CREATE TABLE `moderators` ( `moderator_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `moderators` -- INSERT INTO `moderators` (`moderator_id`) VALUES (4), (5), (6), (7), (8), (9), (10), (11), (12), (13); -- -------------------------------------------------------- -- -- Table structure for table `parenting` -- CREATE TABLE `parenting` ( `parent_id` int(11) NOT NULL, `student_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `parenting` -- INSERT INTO `parenting` (`parent_id`, `student_id`) VALUES (4, 18), (4, 40), (5, 19), (6, 20), (7, 21), (8, 22), (9, 23), (10, 24), (11, 25), (12, 26), (13, 27), (14, 28), (15, 29), (16, 30), (17, 33), (31, 34), (32, 35); -- -------------------------------------------------------- -- -- Table structure for table `parents` -- CREATE TABLE `parents` ( `parent_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `parents` -- INSERT INTO `parents` (`parent_id`) VALUES (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15), (16), (17), (31), (32); -- -------------------------------------------------------- -- -- Table structure for table `participate` -- CREATE TABLE `participate` ( `student_id` int(11) NOT NULL, `sec_id` int(11) NOT NULL, `ses_id` int(11) NOT NULL, `participate` tinyint(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `participate` -- INSERT INTO `participate` (`student_id`, `sec_id`, `ses_id`, `participate`) VALUES (18, 9, 9, 1), (19, 8, 7, 1), (19, 9, 9, 1), (20, 4, 3, 1), (21, 4, 3, 1), (21, 5, 5, 1), (22, 4, 3, 1), (22, 5, 5, 1), (28, 2, 1, 1), (29, 2, 1, 1), (29, 5, 5, 1), (30, 2, 1, 1), (30, 5, 5, 1), (33, 2, 1, 1), (34, 4, 3, 1), (34, 5, 5, 1), (35, 2, 1, 1), (35, 2, 2, 1); -- -------------------------------------------------------- -- -- Table structure for table `post` -- CREATE TABLE `post` ( `moderator_id` int(11) NOT NULL, `material_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `post` -- INSERT INTO `post` (`moderator_id`, `material_id`) VALUES (5, 1), (5, 2), (5, 11), (7, 3), (7, 4), (8, 5), (11, 6), (11, 7), (11, 8), (12, 9), (12, 10); -- -------------------------------------------------------- -- -- Table structure for table `sections` -- CREATE TABLE `sections` ( `sec_id` int(11) NOT NULL, `sec_name` varchar(255) NOT NULL, `start_date` date NOT NULL, `end_date` date NOT NULL, `time_slot_id` int(11) NOT NULL, `capacity` int(11) NOT NULL, `c_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `sections` -- INSERT INTO `sections` (`sec_id`, `sec_name`, `start_date`, `end_date`, `time_slot_id`, `capacity`, `c_id`) VALUES (1, 'DataBase_Mon', '2018-09-02', '2018-12-17', 1, 9, 1), (2, 'DataBase2_Mon', '2019-01-21', '2019-06-06', 2, 9, 2), (3, 'OS_Tue', '2018-09-04', '2018-12-05', 3, 9, 3), (4, 'ComputerArchitecture_Tue', '2019-01-22', '2019-06-07', 4, 9, 4), (5, 'Computing_Wed', '2019-01-23', '2019-06-01', 5, 9, 5), (6, 'Comp2_Wed', '2017-01-18', '2017-06-03', 6, 9, 6), (7, 'Calc_Thu', '2019-09-06', '2019-12-13', 7, 9, 7), (8, 'Mobile_Thu', '2019-01-24', '2019-06-02', 8, 9, 8), (9, 'Foundations_Fri', '2019-01-25', '2019-06-03', 9, 9, 9), (10, 'CollegeWriting_Fri', '2017-09-01', '2017-12-15', 10, 9, 10); -- -------------------------------------------------------- -- -- Table structure for table `sessions` -- CREATE TABLE `sessions` ( `ses_id` int(11) NOT NULL, `sec_id` int(11) NOT NULL, `ses_name` varchar(255) DEFAULT NULL, `date` date DEFAULT NULL, `announcement` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `sessions` -- INSERT INTO `sessions` (`ses_id`, `sec_id`, `ses_name`, `date`, `announcement`) VALUES (1, 2, 'DB2_1', '2019-04-01', 'Our first class.'), (2, 2, 'DB2_2', '2019-01-28', 'Project details.'), (3, 4, 'OS_1', '2019-01-22', 'Introduction to OS.'), (4, 4, 'OS_2', '2019-01-29', 'Linux overview.'), (5, 5, 'CA_1', '2019-01-23', 'Intro to architecture.'), (6, 5, 'CA_2', '2019-01-30', 'Second class.'), (7, 8, 'COMP2_1', '2019-01-24', 'C++ overview.'), (8, 8, 'COMP2_2', '2019-01-31', 'Classes in C++'), (9, 9, 'CALC_1', '2019-01-25', 'What is a derivative.'), (10, 9, 'CALC_2', '2019-02-01', 'Measuring under the curve.'); -- -------------------------------------------------------- -- -- Table structure for table `students` -- CREATE TABLE `students` ( `student_id` int(11) NOT NULL, `grade` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `students` -- INSERT INTO `students` (`student_id`, `grade`) VALUES (18, 1), (19, 1), (20, 3), (21, 2), (22, 2), (23, 2), (24, 3), (25, 3), (26, 3), (27, 4), (28, 4), (29, 4), (30, 3), (33, 4), (34, 2), (35, 4), (40, 3); -- -------------------------------------------------------- -- -- Table structure for table `teach` -- CREATE TABLE `teach` ( `sec_id` int(11) NOT NULL, `mentor_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `teach` -- INSERT INTO `teach` (`sec_id`, `mentor_id`) VALUES (2, 28), (2, 33), (2, 35), (4, 26), (4, 27), (4, 30), (5, 24), (5, 26), (5, 33), (7, 26), (8, 29), (8, 35), (9, 29); -- -------------------------------------------------------- -- -- Table structure for table `time_slot` -- CREATE TABLE `time_slot` ( `time_slot_id` int(11) NOT NULL, `day_of_the_week` varchar(255) NOT NULL, `start_time` time NOT NULL, `end_time` time NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `time_slot` -- INSERT INTO `time_slot` (`time_slot_id`, `day_of_the_week`, `start_time`, `end_time`) VALUES (1, 'Monday', '11:15:00', '12:30:00'), (2, 'Monday', '02:00:00', '03:45:00'), (3, 'Tuesday', '10:00:00', '10:50:00'), (4, 'Tuesday', '05:30:00', '08:45:00'), (5, 'Wednesday', '11:50:00', '12:30:00'), (6, 'Wednesday', '12:45:00', '02:00:00'), (7, 'Thursday', '11:00:00', '12:15:00'), (8, 'Thursday', '01:45:00', '03:00:00'), (9, 'Friday', '09:30:00', '10:45:00'), (10, 'Friday', '11:00:00', '12:30:00'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `email` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, `phone` varchar(255) DEFAULT NULL, `city` varchar(255) DEFAULT NULL, `state` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `email`, `password`, `name`, `phone`, `city`, `state`) VALUES (4, 'aParent@gmail.com', '1111', 'Alfred Rent', '978-555-5555', 'Lowell', 'Massachusetts'), (5, 'bParent@gmail.com', '1112', 'Barbara Modero', '603-555-5555', 'Cambridge', 'Massachusetts'), (6, 'cParent@yahoo.com', '1113', 'Charles Darles', '708-555-5555', 'Seabrook', 'New Hampshire'), (7, 'dParent@gmail.com', '1114', 'Darla Barlent', '978-555-5555', 'Amesbury', 'Massachusetts'), (8, 'eParent@gmail.com', '1115', 'Emil Watson', '387-555-5555', 'Lowell', 'Massachusetts'), (9, 'fParent@gmail.com', '1116', 'Faye Penta', '212-555-5555', 'Nashua', 'New Hampshire'), (10, 'gParent@gmail.com', '1117', 'George DeSande', '403-555-5555', 'Scranton', 'New Hampshire'), (11, 'hParent@gmail.com', '1118', 'Hiro Stu', '388-555-5555', 'Jamestown', 'New Hampshire'), (12, 'iParent@gmail.com', '1119', 'Irene Lemonde', '753-555-5555', 'Concord', 'Massachusetts'), (13, 'jParent@gmail.com', '1121', 'Joshua Johnson', '908-555-5555', 'Lexington', 'Massachusetts'), (14, 'kParent@gmail.com', '1122', 'Karen Layton', '345-555-5555', 'Keene', 'New Hampshire'), (15, 'lParent@gmail.com', '1123', 'Larry Carrie', '123-555-5555', 'Haverhill', 'Massachusetts'), (16, 'mParent@gmail.com', '1124', 'Milton Post', '455-555-5555', 'Lawrence', 'Massachusetts'), (17, 'nParent@gmail.com', '1125', 'Nathanial Great', '988-555-5555', 'Andover', 'Massachusetts'), (18, 'aStudnet@yahoo.com', '9999', 'Arthur Rent', '356-555-5555', 'Lowell', 'Massachusetts'), (19, 'bStudnet@yahoo.com', '9998', 'Bethany Modero', '763-555-5555', 'Methuen', 'Massachusetts'), (20, 'cStudnet@yahoo.com', '9997', 'Cameron Dent', '257-555-5555', 'Salisbury', 'Massachusetts'), (21, 'dStudnet@yahoo.com', '9996', 'Damien Barlent', '245-555-5555', 'Seabrook', 'New Hampshire'), (22, 'eStudnet@yahoo.com', '9995', 'Emily Watson', '359-555-5555', 'Newbury', 'Massachusetts'), (23, 'fStudnet@yahoo.com', '9994', 'Frank Penta', '195-555-5555', 'Byfield', 'Massachusetts'), (24, 'gStudnet@yahoo.com', '9993', 'Georgina DeSane', '438-555-5555', 'Lowell', 'Massachusetts'), (25, 'hStudnet@yahoo.com', '9992', 'Halie Stu', '324-555-5555', 'Nashua', 'New Hampshire'), (26, 'iStudnet@yahoo.com', '9991', 'Ira Lemonde', '234-555-5555', 'Keene', 'New Hampshire'), (27, 'jStudnet@yahoo.com', '9989', 'James Johnson', '690-555-5555', 'Haverhill', 'Massachusetts'), (28, 'kStudnet@yahoo.com', '9988', 'Kristoff Layton', '674-555-5555', 'Lawrence', 'Massachusetts'), (29, 'lStudnet@yahoo.com', '9987', 'Lindsay Carrie', '135-555-5555', 'Lowell', 'Massachusetts'), (30, 'mStudnet@yahoo.com', '9986', 'Mary Post', '296-555-5555', 'Seabrook', 'New Hampshire'), (31, 'oParent@gmail.com', '1126', 'Olieda Rincet', '986-555-5555', 'Wouburn', 'Massachusetts'), (32, 'pParent@gmail.com', '1127', 'Paula Peters', '933-555-5555', 'Salem', 'New Hampshire'), (33, 'nStudent@gmail.com', '9985', 'Naomi Great', '153-555-5555', 'Andover', 'Massachusetts'), (34, 'oStudent@gmail.com', '9984', 'Oliver Rincet', '927-555-555', 'Woburn', 'Massachusetts'), (35, 'pStudent@gmail.com', '9983', 'Paul Peters', '129-555-5555', 'Salem', 'New Hampshire'), (40, 'test@email.com', '1234', 'bobert robert', NULL, NULL, NULL); -- -- Indexes for dumped tables -- -- -- Indexes for table `assign` -- ALTER TABLE `assign` ADD PRIMARY KEY (`sec_id`,`ses_id`,`moderator_id`,`material_id`), ADD KEY `assign_material` (`material_id`), ADD KEY `assign_moderator` (`moderator_id`), ADD KEY `assign_session` (`ses_id`,`sec_id`); -- -- Indexes for table `courses` -- ALTER TABLE `courses` ADD PRIMARY KEY (`c_id`); -- -- Indexes for table `enroll` -- ALTER TABLE `enroll` ADD PRIMARY KEY (`sec_id`,`mentee_id`), ADD KEY `enroll_mentee` (`mentee_id`); -- -- Indexes for table `material` -- ALTER TABLE `material` ADD PRIMARY KEY (`material_id`); -- -- Indexes for table `mentees` -- ALTER TABLE `mentees` ADD PRIMARY KEY (`mentee_id`); -- -- Indexes for table `mentors` -- ALTER TABLE `mentors` ADD PRIMARY KEY (`mentor_id`); -- -- Indexes for table `moderate` -- ALTER TABLE `moderate` ADD PRIMARY KEY (`sec_id`,`moderator_id`), ADD KEY `moderate_moderator` (`moderator_id`); -- -- Indexes for table `moderators` -- ALTER TABLE `moderators` ADD PRIMARY KEY (`moderator_id`); -- -- Indexes for table `parenting` -- ALTER TABLE `parenting` ADD PRIMARY KEY (`parent_id`,`student_id`), ADD KEY `parenting_student` (`student_id`); -- -- Indexes for table `parents` -- ALTER TABLE `parents` ADD PRIMARY KEY (`parent_id`); -- -- Indexes for table `participate` -- ALTER TABLE `participate` ADD PRIMARY KEY (`student_id`,`sec_id`,`ses_id`), ADD KEY `paticipate_session` (`sec_id`,`ses_id`); -- -- Indexes for table `post` -- ALTER TABLE `post` ADD PRIMARY KEY (`moderator_id`,`material_id`), ADD KEY `post_material` (`material_id`); -- -- Indexes for table `sections` -- ALTER TABLE `sections` ADD PRIMARY KEY (`sec_id`), ADD KEY `section_course` (`c_id`), ADD KEY `section_timeslot` (`time_slot_id`); -- -- Indexes for table `sessions` -- ALTER TABLE `sessions` ADD PRIMARY KEY (`ses_id`,`sec_id`), ADD KEY `session_section` (`sec_id`); -- -- Indexes for table `students` -- ALTER TABLE `students` ADD PRIMARY KEY (`student_id`); -- -- Indexes for table `teach` -- ALTER TABLE `teach` ADD PRIMARY KEY (`sec_id`,`mentor_id`), ADD KEY `teach_mentor` (`mentor_id`); -- -- Indexes for table `time_slot` -- ALTER TABLE `time_slot` ADD PRIMARY KEY (`time_slot_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `email` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `courses` -- ALTER TABLE `courses` MODIFY `c_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `material` -- ALTER TABLE `material` MODIFY `material_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `sections` -- ALTER TABLE `sections` MODIFY `sec_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `sessions` -- ALTER TABLE `sessions` MODIFY `ses_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `time_slot` -- ALTER TABLE `time_slot` MODIFY `time_slot_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=41; -- -- Constraints for dumped tables -- -- -- Constraints for table `assign` -- ALTER TABLE `assign` ADD CONSTRAINT `assign_material` FOREIGN KEY (`material_id`) REFERENCES `material` (`material_id`) ON DELETE CASCADE, ADD CONSTRAINT `assign_moderator` FOREIGN KEY (`moderator_id`) REFERENCES `moderators` (`moderator_id`) ON DELETE CASCADE, ADD CONSTRAINT `assign_session` FOREIGN KEY (`ses_id`,`sec_id`) REFERENCES `sessions` (`ses_id`, `sec_id`) ON DELETE CASCADE; -- -- Constraints for table `enroll` -- ALTER TABLE `enroll` ADD CONSTRAINT `enroll_mentee` FOREIGN KEY (`mentee_id`) REFERENCES `mentees` (`mentee_id`) ON DELETE CASCADE, ADD CONSTRAINT `enroll_section` FOREIGN KEY (`sec_id`) REFERENCES `sections` (`sec_id`) ON DELETE CASCADE; -- -- Constraints for table `mentees` -- ALTER TABLE `mentees` ADD CONSTRAINT `mentee_student` FOREIGN KEY (`mentee_id`) REFERENCES `students` (`student_id`) ON DELETE CASCADE; -- -- Constraints for table `mentors` -- ALTER TABLE `mentors` ADD CONSTRAINT `mentor_student` FOREIGN KEY (`mentor_id`) REFERENCES `students` (`student_id`) ON DELETE CASCADE; -- -- Constraints for table `moderate` -- ALTER TABLE `moderate` ADD CONSTRAINT `moderate_moderator` FOREIGN KEY (`moderator_id`) REFERENCES `moderators` (`moderator_id`) ON DELETE CASCADE, ADD CONSTRAINT `moderate_section` FOREIGN KEY (`sec_id`) REFERENCES `sections` (`sec_id`) ON DELETE CASCADE; -- -- Constraints for table `moderators` -- ALTER TABLE `moderators` ADD CONSTRAINT `moderator_parents` FOREIGN KEY (`moderator_id`) REFERENCES `parents` (`parent_id`) ON DELETE CASCADE; -- -- Constraints for table `parenting` -- ALTER TABLE `parenting` ADD CONSTRAINT `parenting_parent` FOREIGN KEY (`parent_id`) REFERENCES `parents` (`parent_id`) ON DELETE CASCADE, ADD CONSTRAINT `parenting_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`) ON DELETE CASCADE; -- -- Constraints for table `parents` -- ALTER TABLE `parents` ADD CONSTRAINT `parent_user` FOREIGN KEY (`parent_id`) REFERENCES `users` (`id`); -- -- Constraints for table `participate` -- ALTER TABLE `participate` ADD CONSTRAINT `paticipate_session` FOREIGN KEY (`sec_id`,`ses_id`) REFERENCES `sessions` (`sec_id`, `ses_id`) ON DELETE CASCADE, ADD CONSTRAINT `paticipate_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`) ON DELETE CASCADE; -- -- Constraints for table `post` -- ALTER TABLE `post` ADD CONSTRAINT `post_material` FOREIGN KEY (`material_id`) REFERENCES `material` (`material_id`) ON DELETE CASCADE, ADD CONSTRAINT `post_moderator` FOREIGN KEY (`moderator_id`) REFERENCES `moderators` (`moderator_id`) ON DELETE CASCADE; -- -- Constraints for table `sections` -- ALTER TABLE `sections` ADD CONSTRAINT `section_course` FOREIGN KEY (`c_id`) REFERENCES `courses` (`c_id`) ON DELETE CASCADE, ADD CONSTRAINT `section_timeslot` FOREIGN KEY (`time_slot_id`) REFERENCES `time_slot` (`time_slot_id`) ON DELETE CASCADE; -- -- Constraints for table `sessions` -- ALTER TABLE `sessions` ADD CONSTRAINT `session_section` FOREIGN KEY (`sec_id`) REFERENCES `sections` (`sec_id`) ON DELETE CASCADE; -- -- Constraints for table `students` -- ALTER TABLE `students` ADD CONSTRAINT `student_user` FOREIGN KEY (`student_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; -- -- Constraints for table `teach` -- ALTER TABLE `teach` ADD CONSTRAINT `teach_mentor` FOREIGN KEY (`mentor_id`) REFERENCES `mentors` (`mentor_id`) ON DELETE CASCADE, ADD CONSTRAINT `teach_section` FOREIGN KEY (`sec_id`) REFERENCES `sections` (`sec_id`) ON DELETE 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 */;
/*Table: Employee +------+----------+-----------+----------+ |Id |Name |Department|ManagerId | +------+----------+-----------+----------+ |101 |John |A |null | |102 |Dan |A |101 | |103 |James |A |101 | |104 |Amy |A |101 | |105 |Anne |A |101 | |106 |Ron |B |101 | +------+----------+-----------+----------+ */ SELECT Name FROM Employee e JOIN (SELECT ManagerId FROM Employee GROUPBY ManagerId HAVING COUNT(ManagerId) >= 5) AS t ON e.Id = t.ManagerId;
-- phpMyAdmin SQL Dump -- version 4.5.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: 30-Maio-2016 às 14:04 -- Versão do servidor: 10.1.10-MariaDB -- PHP Version: 5.6.19 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: `cadastropes` -- -- -------------------------------------------------------- -- -- Estrutura da tabela `pessoa` -- CREATE TABLE `pessoa` ( `codigo` int(11) NOT NULL, `nome` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `endereco` varchar(220) COLLATE utf8_unicode_ci NOT NULL, `telefone` int(11) NOT NULL, `sexo` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(220) COLLATE utf8_unicode_ci NOT NULL, `datanasc` date NOT NULL, `cpf` varchar(14) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Extraindo dados da tabela `pessoa` -- INSERT INTO `pessoa` (`codigo`, `nome`, `endereco`, `telefone`, `sexo`, `email`, `datanasc`, `cpf`) VALUES (31, 'Rafael Cardoso', 'Rua das flores, Bessa, João Pessoa', 986352253, 'Masculino', 'rafael.ciano@hotmail.com', '1995-11-22', '112.988.786-98'), (32, 'Maria da Silva', 'Rua das laranjas, Laranjeira, Recife, PE', 98890654, 'Feminino', 'maria@gmail.com', '1988-11-01', '243.543.666-45'); -- -- Indexes for dumped tables -- -- -- Indexes for table `pessoa` -- ALTER TABLE `pessoa` ADD PRIMARY KEY (`codigo`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `pessoa` -- ALTER TABLE `pessoa` MODIFY `codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33; /*!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 */;
-- Bug Fix -- http://sourceforge.net/tracker/index.php?func=detail&aid=1707995&group_id=176962&atid=879332 INSERT INTO AD_VAL_RULE (ad_val_rule_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, name, description, type, code, entitytype ) VALUES(271, 0, 0, 'Y', TO_TIMESTAMP('2007-04-26','YYYY-MM-DD'), 100, TO_TIMESTAMP('2007-04-26','YYYY-MM-DD'), 100, 'M_PriceList is SO/PO', 'Limits the Sales & Purchase Order window to the correct price lsits', 'S', '(M_PriceList.IsSOPriceList = ''Y'' AND ''@IsSOTrx@''=''Y'') OR (M_PriceList.IsSOPriceList = ''N'' AND ''@IsSOTrx@''=''N'')', 'D'); UPDATE AD_COLUMN set ad_val_rule_id = 271 where ad_column_id = 2204; COMMIT; UPDATE AD_SEQUENCE SET currentnextsys = (SELECT MAX (ad_val_rule_id) + 1 FROM AD_VAL_RULE WHERE ad_val_rule_id < 1000000) WHERE NAME = 'AD_Val_Rule'; COMMIT;
--##Rollback Queries --select * from ADC_FACILITY_EFORM_TYPE_MAPPING where META_ENT_ID = '2205000149' delete from ADC_FACILITY_EFORM_TYPE_MAPPING where META_ENT_ID = '2205000149' --[DELETE] --select * from WF_PROCESS_PARTICIPANT where PROCESS_ALLOC_ID = '200205' delete WF_PROCESS_PARTICIPANT where PROCESS_ALLOC_ID = '200205' --[DELETE] --select * from WF_PROCESS_ENTITY_ALLOC where PROCESS_ALLOC_ID = '200205' delete from WF_PROCESS_ENTITY_ALLOC where PROCESS_ALLOC_ID = '200205' --[DELETE] --select * from META_ENTITY_CATEGORY where META_ENT_ID = '2205000149' delete from META_ENTITY_CATEGORY where META_ENT_ID = '2205000149' --[DELETE] --select * from VALUE_TREE_NODE where TREE_NODE_ID = '2000000200' --[Roshan Account] --delete from VALUE_TREE_NODE where TREE_NODE_ID = '2000000200' --[DELETE] --select * from META_VIEW_PARAM where META_VIEW_ID = '2205000149_002' delete from META_VIEW_PARAM where META_VIEW_ID = '2205000149_002' --[DELETE] --select * from META_ENTITY_RELATION where MAIN_ENTITY_ID = '2205000149' delete from META_ENTITY_RELATION where MAIN_ENTITY_ID = '2205000149' --[DELETE] --select * from META_VIEW_RELATIONSHIP where PARENT_VIEW_ID = '2205000149_001' delete from META_VIEW_RELATIONSHIP where PARENT_VIEW_ID = '2205000149_001' --[DELETE] --select * from META_VIEW_ATTRIB where META_ENT_ID = '2205000149' delete from META_VIEW_ATTRIB where META_ENT_ID = '2205000149' --[DELETE] --select * from META_VIEW where META_ENT_ID = '2205000149' delete from META_VIEW where META_ENT_ID = '2205000149' --[DELETE] --select * from META_ENTITY_ATTRIB where META_ENT_ID = '2205000149' delete from META_ENTITY_ATTRIB where META_ENT_ID = '2205000149' --[DELETE] --select * from META_ENTITY where META_ENT_ID = '2205000149' delete from META_ENTITY where META_ENT_ID = '2205000149' --[DELETE]
CREATE TABLE user( ID INT AUTO_INCREMENT, FIRSTNAME VARCHAR(255), LASTNAME VARCHAR(255), EMAIL VARCHAR(255) );
DROP TABLE IF EXISTS properties; CREATE TABLE properties ( id SERIAL4 PRIMARY KEY, address VARCHAR(255), price INT, number_of_bedrooms INT, year_of_build INT, buy_let VARCHAR(255), square_footage INT, build_type VARCHAR(255) );
select 'All' union select sub.name from ( select distinct r.alias as name, count(distinct e.id) as cnt from gha_repos r, gha_events e where r.alias is not null and e.repo_id = r.id group by r.alias order by cnt desc, alias asc limit {{lim}} ) sub ;
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 22, 2021 at 04:54 AM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.4.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: `nexttrain2` -- -- -------------------------------------------------------- -- -- Table structure for table `platforms` -- CREATE TABLE `platforms` ( `ID` varchar(20) NOT NULL, `StationID` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `rail` -- CREATE TABLE `rail` ( `ID` varchar(20) NOT NULL, `network` varchar(20) NOT NULL, `length` int(11) NOT NULL, `width` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `rail_connections` -- CREATE TABLE `rail_connections` ( `railID` varchar(20) NOT NULL, `StationID` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `route` -- CREATE TABLE `route` ( `ID` varchar(20) NOT NULL, `network` varchar(20) NOT NULL, `popularity` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `route_station` -- CREATE TABLE `route_station` ( `LineID` varchar(20) NOT NULL, `StationID` varchar(20) NOT NULL, `stopNumber` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `stations` -- CREATE TABLE `stations` ( `ID` varchar(20) NOT NULL, `Name` varchar(50) NOT NULL, `Network` varchar(20) NOT NULL, `Popularity` int(11) NOT NULL, `isStation` tinyint(1) NOT NULL DEFAULT 1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Indexes for dumped tables -- -- -- Indexes for table `platforms` -- ALTER TABLE `platforms` ADD KEY `StationID` (`StationID`); -- -- Indexes for table `rail` -- ALTER TABLE `rail` ADD PRIMARY KEY (`ID`); -- -- Indexes for table `rail_connections` -- ALTER TABLE `rail_connections` ADD KEY `railID` (`railID`), ADD KEY `StationID` (`StationID`); -- -- Indexes for table `route` -- ALTER TABLE `route` ADD PRIMARY KEY (`ID`); -- -- Indexes for table `route_station` -- ALTER TABLE `route_station` ADD KEY `LineID` (`LineID`), ADD KEY `StationID` (`StationID`); -- -- Indexes for table `stations` -- ALTER TABLE `stations` ADD PRIMARY KEY (`ID`), ADD UNIQUE KEY `ID` (`ID`); -- -- Constraints for dumped tables -- -- -- Constraints for table `platforms` -- ALTER TABLE `platforms` ADD CONSTRAINT `platforms_ibfk_1` FOREIGN KEY (`StationID`) REFERENCES `stations` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `rail_connections` -- ALTER TABLE `rail_connections` ADD CONSTRAINT `rail_connections_ibfk_1` FOREIGN KEY (`railID`) REFERENCES `rail` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `rail_connections_ibfk_2` FOREIGN KEY (`StationID`) REFERENCES `stations` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `route_station` -- ALTER TABLE `route_station` ADD CONSTRAINT `route_station_ibfk_1` FOREIGN KEY (`StationID`) REFERENCES `stations` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `route_station_ibfk_2` FOREIGN KEY (`LineID`) REFERENCES `route` (`ID`) ON DELETE CASCADE 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 */;
CREATE DATABASE IF NOT EXISTS `guiyi_config` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `guiyi_config`; -- MySQL dump 10.13 Distrib 5.6.24, for osx10.8 (x86_64) -- -- Host: 192.168.0.168 Database: guiyi_config -- ------------------------------------------------------ -- Server version 5.6.19-0ubuntu0.14.04.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 `t_message_config` -- DROP TABLE IF EXISTS `t_message_config`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t_message_config` ( `msg_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'msg_id for grouping', `msg_key` varchar(64) NOT NULL COMMENT '唯一键', `msg_content` varchar(1024) DEFAULT NULL COMMENT '内容', `short_desc` varchar(256) DEFAULT NULL COMMENT '描述', PRIMARY KEY (`msg_id`), UNIQUE KEY `msg_key_UNIQUE` (`msg_key`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='消息'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `t_message_config` -- LOCK TABLES `t_message_config` WRITE; /*!40000 ALTER TABLE `t_message_config` DISABLE KEYS */; INSERT INTO `t_message_config` VALUES (1,'regist_validation','{0}(家庭e柜手机动态码,{1}分钟内有效,请完成验证),如非本人操作,请忽略此短信。(归一科技)','手机方式注册账号验证码短信内容。{0}验证码,{1}为有效时间'),(2,'reset_pswd_validation','{0}(修改账号密码验证,{}分钟内有效)','修改密码手机短信验证码'),(3,'test_validation','尊敬的用户,您的手机动态验证码为{}.\r为保证个人账户安全请勿泄露他人','测试用验证码'); /*!40000 ALTER TABLE `t_message_config` 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 2015-08-28 12:02:11
-- 1- Get film ratings. select rating from film; -- 2 - Get release years. select release_year from film; -- 3 - Get all films with ARMAGEDDON in the title. select film_id, title from film where title like '%ARMAGEDDON%'; -- 4 - Get all films with APOLLO in the title select film_id, title from film where title like '%APOLLO%'; -- 5 - Get all films which title ends with APOLLO. select film_id, title from film where title like '%APOLLO'; -- 6 - Get all films with word DATE in the title. select film_id, title from film where title like '%DATE%'; -- 7 - Get 10 films with the longest title. select film_id as Film, title, char_length(title) as Length from film order by Length desc limit 10; -- 8 - Get 10 the longest films. select film_id, title, length as duration from film order by length desc limit 10; -- 9 - How many films include Behind the Scenes content? select count(film_id) from film where special_features like '%Behind the scene%'; -- 10 - List films ordered by release year and title in alphabetical order. select film_id, title, release_year from film order by release_year, title;
-- -- Update sql for MailWizz EMA from version 1.3.5.6 to 1.3.5.7 --
SELECT SUM(price) as Total_publicity_cost FROM publicity;
INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (60,'Kill dragon guarding treasure',7000,true); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (20,'Protect town from wild beasts',2000,true); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (30,'Escort caravane of refugees',1800,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (15,'Kill the aggresive stray dogs',2000,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (10,'Check swamps for lost necklace',4500,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (50,'Slay the troll asking for toll',2500,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (40,'Avenge murdered royal daughter',5000,true); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (20,'Find lost royal daughter',1500,true); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (15,'Hunt down the golden deer',1000,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (15,'Find ingredients for shaman',2000,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (45,'Measure the chimera tail',6000,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (35,'Recover cargo of wrecked ship',3500,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (15,'Bring 10 rabbit furs',1000,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (40,'Assassinate rogue general',5000,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (25,'Protect miners in haunted mine',3000,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (15,'Beat down rival thug',1000,false); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (40,'Save kidnapped princess',6500,true); INSERT INTO JOBOFFER (MINSKILL, DESCRIPTION, REWARD, POSSIBLEGLORY)VALUES (45,'Sabotage the enemy defencies',6000,false);
-- using sub queries -- LEFT JOIN of what is in tv_genres that is not in "dexter" -- "dexter" result of mini query SELECT tv_genres.name FROM tv_genres LEFT JOIN (SELECT tv_genres.name FROM tv_genres JOIN tv_show_genres ON tv_genres.id = tv_show_genres.genre_id RIGHT JOIN tv_shows ON tv_shows.id = tv_show_genres.show_id WHERE tv_shows.title = "Dexter") dexter ON tv_genres.name = dexter.name WHERE dexter.name IS NULL ORDER BY tv_genres.name ASC;
-- Get moved tickets based on the change log -- How to list issues moved from one project to another in Jira select k.oldstring as "Old Key", coalesce(t.oldstring,it.pname) as "Old Type", k.newstring as "New Key", coalesce(t.newstring,it.pname) as "New Type", u.lower_user_name as "Username", kg.created as "Moved date" from changeitem k join changegroup kg on kg.id = k.groupid join app_user a on a.user_key = kg.author join cwd_user u on u.lower_user_name = a.lower_user_name join changegroup gt on gt.id = k.groupid left join changeitem t on t.groupid = gt.id and t.field = 'issuetype' join jiraissue i on i.id = kg.issueid join issuetype it on it.id = i.issuetype where k.field = 'Key'; -- also, you can check in moved_issue_key table
-- MySQL Script generated by MySQL Workbench -- 03/12/15 11:25:37 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering -- SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -- SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -- SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema hermanmk_calDB -- ----------------------------------------------------- -- ----------------------------------------------------- -- Table `User` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `User` ( `userid` INT NOT NULL AUTO_INCREMENT, `username` VARCHAR(20) NOT NULL, `name` VARCHAR(255) NOT NULL, `email` VARCHAR(255) NULL, `password` CHAR(64) NOT NULL, `salt` CHAR(32) NOT NULL, `create_time` DATETIME NULL, `update_time` TIMESTAMP NULL DEFAULT NOW(), PRIMARY KEY (`userid`), UNIQUE INDEX `username_UNIQUE` (`username` ASC)); -- ----------------------------------------------------- -- Table `Room` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `Room` ( `roomid` INT NOT NULL AUTO_INCREMENT, `capacity` INT NOT NULL, `room_num` VARCHAR(45) NOT NULL, `available` TINYINT(1) NOT NULL DEFAULT 1, PRIMARY KEY (`roomid`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `User_group` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `User_group` ( `groupid` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(128) NOT NULL, `owner_id` INT NOT NULL, `create_time` DATETIME NULL, `update_time` TIMESTAMP NULL DEFAULT NOW(), PRIMARY KEY (`groupid`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `Meeting` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `Meeting` ( `meetingid` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(128) NOT NULL, `description` MEDIUMTEXT NULL, `start_time` DATETIME NOT NULL, `end_time` DATETIME NOT NULL, `Room_roomid` INT NULL, `location` MEDIUMTEXT NOT NULL, `owner_id` INT NOT NULL, `Group_groupid` INT NULL, `create_time` DATETIME NULL, `update_time` TIMESTAMP NULL DEFAULT NOW(), PRIMARY KEY (`meetingid`), INDEX `fk_Meeting_Room_idx` (`Room_roomid` ASC), INDEX `fk_Meeting_Group1_idx` (`Group_groupid` ASC), CONSTRAINT `fk_Meeting_Room` FOREIGN KEY (`Room_roomid`) REFERENCES `Room` (`roomid`) ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT `fk_Meeting_Group1` FOREIGN KEY (`Group_groupid`) REFERENCES `User_group` (`groupid`) ON DELETE SET NULL ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `User_invited_to_meeting` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `User_invited_to_meeting` ( `User_userid` INT NOT NULL, `Meeting_meetingid` INT NOT NULL, `notification_message` MEDIUMTEXT NOT NULL, `notification_read` TINYINT(1) NOT NULL DEFAULT 0, `confirmed` TINYINT(1) NULL DEFAULT 0, `hide` TINYINT(1) NOT NULL DEFAULT 0, `alarm_time` TIME NULL, PRIMARY KEY (`Meeting_meetingid`, `User_userid`), INDEX `fk_User_has_Meeting_Meeting1_idx` (`Meeting_meetingid` ASC), INDEX `fk_User_has_Meeting_User1_idx` (`User_userid` ASC), CONSTRAINT `fk_User_has_Meeting_User1` FOREIGN KEY (`User_userid`) REFERENCES `User` (`userid`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_User_has_Meeting_Meeting1` FOREIGN KEY (`Meeting_meetingid`) REFERENCES `Meeting` (`meetingid`) ON DELETE CASCADE ON UPDATE NO ACTION); -- ----------------------------------------------------- -- Table `User_group_has_User` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `User_group_has_User` ( `User_userid` INT NOT NULL, `User_group_groupid` INT NOT NULL, `notification_message` MEDIUMTEXT NOT NULL, `notification_read` TINYINT(1) NOT NULL DEFAULT 0, `confirmed` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`User_userid`, `User_group_groupid`), INDEX `fk_User_has_Group_Group1_idx` (`User_group_groupid` ASC), INDEX `fk_User_has_Group_User1_idx` (`User_userid` ASC), CONSTRAINT `fk_User_has_Group_User1` FOREIGN KEY (`User_userid`) REFERENCES `User` (`userid`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_User_has_Group_Group1` FOREIGN KEY (`User_group_groupid`) REFERENCES `User_group` (`groupid`) ON DELETE CASCADE ON UPDATE NO ACTION); -- SET SQL_MODE=@OLD_SQL_MODE; -- SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -- SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
;WITH MyDuplicate AS (SELECT Sch.[name] AS SchemaName, Obj.[name] AS TableName, Idx.[name] AS IndexName, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 1) AS Col1, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 2) AS Col2, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 3) AS Col3, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 4) AS Col4, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 5) AS Col5, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 6) AS Col6, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 7) AS Col7, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 8) AS Col8, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 9) AS Col9, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 10) AS Col10, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 11) AS Col11, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 12) AS Col12, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 13) AS Col13, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 14) AS Col14, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 15) AS Col15, INDEX_COL(Sch.[name] + '.' + Obj.[name], Idx.index_id, 16) AS Col16 FROM sys.indexes Idx INNER JOIN sys.objects Obj ON Idx.[object_id] = Obj.[object_id] INNER JOIN sys.schemas Sch ON Sch.[schema_id] = Obj.[schema_id] WHERE index_id > 0) SELECT MD1.SchemaName, MD1.TableName, MD1.IndexName, MD2.IndexName AS OverLappingIndex, MD1.Col1, MD1.Col2, MD1.Col3, MD1.Col4, MD1.Col5, MD1.Col6, MD1.Col7, MD1.Col8, MD1.Col9, MD1.Col10, MD1.Col11, MD1.Col12, MD1.Col13, MD1.Col14, MD1.Col15, MD1.Col16 FROM MyDuplicate MD1 INNER JOIN MyDuplicate MD2 ON MD1.tablename = MD2.tablename AND MD1.IndexName <> MD2.IndexName AND MD1.Col1 = MD2.Col1 AND (MD1.Col2 IS NULL OR MD2.Col2 IS NULL OR MD1.Col2 = MD2.Col2) AND (MD1.Col3 IS NULL OR MD2.Col3 IS NULL OR MD1.Col3 = MD2.Col3) AND (MD1.Col4 IS NULL OR MD2.Col4 IS NULL OR MD1.Col4 = MD2.Col4) AND (MD1.Col5 IS NULL OR MD2.Col5 IS NULL OR MD1.Col5 = MD2.Col5) AND (MD1.Col6 IS NULL OR MD2.Col6 IS NULL OR MD1.Col6 = MD2.Col6) AND (MD1.Col7 IS NULL OR MD2.Col7 IS NULL OR MD1.Col7 = MD2.Col7) AND (MD1.Col8 IS NULL OR MD2.Col8 IS NULL OR MD1.Col8 = MD2.Col8) AND (MD1.Col9 IS NULL OR MD2.Col9 IS NULL OR MD1.Col9 = MD2.Col9) AND (MD1.Col10 IS NULL OR MD2.Col10 IS NULL OR MD1.Col10 = MD2.Col10) AND (MD1.Col11 IS NULL OR MD2.Col11 IS NULL OR MD1.Col11 = MD2.Col11) AND (MD1.Col12 IS NULL OR MD2.Col12 IS NULL OR MD1.Col12 = MD2.Col12) AND (MD1.Col13 IS NULL OR MD2.Col13 IS NULL OR MD1.Col13 = MD2.Col13) AND (MD1.Col14 IS NULL OR MD2.Col14 IS NULL OR MD1.Col14 = MD2.Col14) AND (MD1.Col15 IS NULL OR MD2.Col15 IS NULL OR MD1.Col15 = MD2.Col15) AND (MD1.Col16 IS NULL OR MD2.Col16 IS NULL OR MD1.Col16 = MD2.Col16) ORDER BY MD1.SchemaName,MD1.TableName,MD1.IndexName
SELECT * FROM PhoneNumberType SELECT * FROM PersonPhone SELECT * FROM PersonPhone WHERE PhoneNumberTypeID = 1
CREATE PROCEDURE sp_get_Pending_REQ_Qty(@PRODUCTCODE NVARCHAR(15)) AS SELECT SUM(stock_request_detail.Pending), Product_Code FROM stock_request_abstract, stock_request_detail WHERE stock_request_detail.Stock_Req_Number = stock_request_abstract.Stock_Req_Number AND (stock_request_abstract.Status & 128 = 0) AND Product_Code = @PRODUCTCODE GROUP BY Product_Code
CREATE Procedure sp_update_DocumentUsers(@SerialNo int,@UserName nvarchar(100)=N'',@ClearAll int=0,@Active int) As If (@ClearAll=1) begin Delete From DocumentUsers Where SerialNo=@SerialNo Update TransactionDocNumber Set Active=@Active Where SerialNo=@SerialNo End If Len(@UserName) <> 0 Insert into DocumentUsers(SerialNo,UserName) Values(@SerialNo,@UserName)
-- phpMyAdmin SQL Dump -- version 3.5.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Apr 09, 2013 at 07:38 PM -- Server version: 5.5.25 -- PHP Version: 5.4.4 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- Database: `clearmind` -- -- -------------------------------------------------------- -- -- Table structure for table `node` -- CREATE TABLE `node` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `root` int(10) unsigned DEFAULT NULL, `lft` int(10) unsigned NOT NULL, `rgt` int(10) unsigned NOT NULL, `level` smallint(5) unsigned NOT NULL, `title` varchar(255) CHARACTER SET utf8 NOT NULL, `content` text CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`), KEY `lft` (`lft`), KEY `rgt` (`rgt`), KEY `level` (`level`), KEY `root` (`root`), KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=301 ; -- -- Dumping data for table `node` -- INSERT INTO `node` (`id`, `user_id`, `root`, `lft`, `rgt`, `level`, `title`, `content`) VALUES (1, 167, 1, 1, 16, 1, 'Joe Schmoe', 'That''s me'), (2, 167, 1, 2, 7, 2, 'Personal', 'My personal stuff'), (283, 168, 1, 1, 16, 1, 'McSilviorr', 'That''s mexdddhhdjhkfjfhkasdf\n\nwas this the one, i cant believe this is working. oh yeah i know its working.'), (284, 168, 1, 2, 7, 2, 'Personal', 'My personal stuffuytuyt'), (295, 168, 1, 8, 13, 2, 'New node', 'kjhkjhkjhk'), (296, 168, 1, 14, 15, 2, 'hkjhkjhlkjlkj', 'utyui'), (297, 168, 1, 3, 6, 3, 'asdasdd', ''), (298, 168, 1, 4, 5, 4, 'asd', ''), (299, 168, 1, 9, 10, 3, 'oink', ''), (300, 168, 1, 11, 12, 3, 'oink', ''); -- -------------------------------------------------------- -- -- Table structure for table `profile` -- CREATE TABLE `profile` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `first_name` varchar(45) DEFAULT NULL, `last_name` varchar(45) DEFAULT NULL, `birthday` date DEFAULT NULL, `emailNewsLetter` tinyint(1) NOT NULL DEFAULT '0', `emailUpdates` tinyint(1) NOT NULL DEFAULT '0', `daily_emails` tinyint(1) NOT NULL DEFAULT '1', `last_emailed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=97 ; -- -- Dumping data for table `profile` -- INSERT INTO `profile` (`id`, `user_id`, `first_name`, `last_name`, `birthday`, `emailNewsLetter`, `emailUpdates`, `daily_emails`, `last_emailed`) VALUES (95, 167, NULL, NULL, NULL, 0, 0, 1, '2013-03-10 05:41:36'), (96, 168, NULL, NULL, NULL, 0, 0, 1, '2013-03-14 02:26:14'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(128) NOT NULL, `password` varchar(60) NOT NULL, `email` varchar(128) NOT NULL, `activationcode` varchar(60) DEFAULT NULL, `activated` tinyint(1) NOT NULL, `registration_date` datetime NOT NULL, `last_login_date` datetime NOT NULL, `last_login_ip` varchar(20) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `activationcode` (`activationcode`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=169 ; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `username`, `password`, `email`, `activationcode`, `activated`, `registration_date`, `last_login_date`, `last_login_ip`) VALUES (167, 'mcsilvio', '$2a$08$476e2fbf45ac927435ac8uzJB3Kk0FqgGXohGTW43bcURk4i3Y1V.', 'mcsilvio@gmail.com', '$2a$08$95ff0bb0bd42988e9eb25uuV2zldKuiGyVrwKRthFTdQ4zKGXkC0i', 1, '2013-03-10 00:41:36', '2013-04-09 11:28:38', 'asdsa'), (168, 'mcsilvior', '$2a$08$c0a7abeb97aba6104d208OGEKN9rqluyXuEqy.WforE6ZIM7Y3uyy', 'asd@asd.asd', '$2a$08$77328bda04a16126440ecOxHh5GpN1N.0azPLtdaBV73eLnp9GC/W', 1, '2013-03-13 22:26:14', '2013-04-09 11:28:49', 'asdsa'); -- -- Constraints for dumped tables -- -- -- Constraints for table `profile` -- ALTER TABLE `profile` ADD CONSTRAINT `profile_ibfk_9` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
DROP DATABASE IF EXISTS bamazon_db; CREATE DATABASE bamazon_db; USE bamazon_db; CREATE TABLE products( id INT NOT NULL AUTO_INCREMENT, product_name VARCHAR(75) NOT NULL, department_name VARCHAR(45) NOT NULL, price INT(8) NOT NULL, stock_quantity INT default 0, PRIMARY KEY (id) ); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Air Force 1', "Shoes",80, 10); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Jordan Retro 1', "Shoes", 110, 15); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Vans Old Skool' , "Shoes", 65, 30); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Sweatshirt', "Clothing", 65, 20); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Shirt', "Clothing", 45, 35); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Jeans', "Clothing", 75, 10); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Hat', "Accessories", 30, 30); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Wallet', "Accessories", 45, 10); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Bag', "Accessories", 65, 8); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ('Sticker', "Misc", 5, 90); SELECT * FROM products;
insert into student values (1, 'BCA', 'Amit'); insert into student values (2, 'B.Com', 'Anuj'); insert into student values (3, 'BCA', 'sangeet'); insert into student values (4, 'MCA', 'Deepak'); insert into student values (5, 'BBA', 'Rajkmar');
SELECT gbkmut.datum, gbkmut.ID, gbkmut.bkstnr, gbkmut.faktuurnr, gbkmut.docnumber, gbkmut.oms25, (CASE WHEN gbkmut.documentID IS NULL THEN 0 ELSE 1 END) AS Note, (CASE WHEN gbkmut.docattachmentID IS NULL THEN 0 ELSE 1 END) AS Attach, ROUND(((CASE WHEN transsubtype NOT IN ('R','S') THEN CASE WHEN bdr_hfl >= 0 THEN bdr_hfl ELSE NULL END ELSE CASE WHEN bdr_hfl < 0 THEN bdr_hfl ELSE NULL END END)), 2) AS Debit, ROUND(((CASE WHEN transsubtype NOT IN ('R','S') THEN CASE WHEN bdr_hfl >= 0 THEN NULL ELSE -bdr_hfl END ELSE CASE WHEN bdr_hfl < 0 THEN NULL ELSE -bdr_hfl END END)), 2) AS Credit, gbkmut.transsubtype, gbkmut.valcode, gbkmut.bdr_val, gbkmut.docdate, grtbk.oms25_0 AS MyOms, Dagbk.afk, gbkmut.btw_code, gbkmut.tegreknr, gbkmut.betcond, gbkmut.btwper, gbkmut.artcode, gbkmut.transtype, gbkmut.bankacc, gbkmut.project, gbkmut.facode, gbkmut.bkstnr_sub, gbkmut.reknr, humres.fullname, (CASE WHEN reminderlayout = 0 THEN 1 ELSE reminderlayout END) AS Reminderlayout, gbkmut.syscreated, c1.debcode, gbkmut.verwerknrl, gbkmut.betaalref, gbkmut.kstplcode, gbkmut.kstdrcode, (CASE WHEN gbkmut.koers = 0 THEN CONVERT(VARCHAR(20),ROUND(gbkmut.koers,5)) ELSE (CASE WHEN 1/gbkmut.koers > 10000 THEN '1/' + CONVERT(VARCHAR(20), ROUND(1/gbkmut.koers,5)) ELSE CONVERT(VARCHAR(20), ROUND(gbkmut.koers,5)) END) END) AS Koers FROM gbkmut INNER JOIN dagbk ON gbkmut.dagbknr = dagbk.dagbknr INNER JOIN grtbk ON gbkmut.reknr = grtbk.reknr LEFT OUTER JOIN humres ON gbkmut.res_id = humres.res_id AND gbkmut.res_id IS NOT NULL LEFT OUTER JOIN cicmpy c1 ON gbkmut.debnr = c1.debnr AND gbkmut.debnr IS NOT NULL AND c1.debnr IS NOT NULL WHERE gbkmut.debnr = ' 32409' AND grtbk.omzrek = 'D' AND gbkmut.transtype IN ('N', 'C', 'P') AND gbkmut.datum >= {d '2012-02-01'} AND gbkmut.datum <= {d '2012-05-01'} AND remindercount <= 13 ORDER BY gbkmut.datum, gbkmut.id
DELETE FROM tokens WHERE dateCreated < DATE_ADD(NOW(), INTERVAL -2 DAY)
SELECT USER FROM DUAL; --==>> SCOTT --■■■ UNION / UNION ALL ■■■-- --○ 실습 테이블 생성(TBL_JUMUN) CREATE TABLE TBL_JUMUN -- 주문 테이블 생성 ( JUNO NUMBER -- 주문 번호 , JECODE VARCHAR2(30) -- 주문된 제품 코드 , JUSU NUMBER -- 주문 수량 , JUDAY DATE DEFAULT SYSDATE -- 주문 일자 ); --==>> Table TBL_JUMUN이(가) 생성되었습니다. --> 곡개의 주문이 발생(접수)되었을 경우 -- 주문 내용에 대한 데이터가 입력될 수 있는 테이블 --○ 데이터 입력 -> 고객의 주문 발생(접수) INSERT INTO TBL_JUMUN VALUES(1, '바나나킥', 20, TO_DATE('2010-11-01 09:13:24', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(2, '썬칩', 10, TO_DATE('2010-11-01 10:10:12', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(3, '홈런볼', 30, TO_DATE('2010-11-01 13:32:12', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(4, '포카칩', 10, TO_DATE('2010-11-02 11:11:11', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(5, '꼬북칩', 50, TO_DATE('2010-11-02 12:12:12', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(6, '초코파이', 20, TO_DATE('2010-11-02 16:40:10', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(7, '새우깡', 10, TO_DATE('2010-11-03 05:25:32', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(8, '콘칩', 30, TO_DATE('2010-11-03 06:50:52', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(9, '수미칩', 20, TO_DATE('2010-11-03 07:29:45', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(10, '조리퐁', 30, TO_DATE('2010-11-04 15:20:20', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(11, '새우깡', 10, TO_DATE('2010-11-05 05:05:05', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(12, '꼬북칩', 30, TO_DATE('2010-11-06 06:12:13', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(13, '홈런볼', 20, TO_DATE('2010-11-07 07:12:13', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(14, '홈런볼', 25, TO_DATE('2010-11-08 08:12:13', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(15, '포카칩', 30, TO_DATE('2010-11-09 09:09:09', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(16, '콘칩', 10, TO_DATE('2010-11-10 10:10:10', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(17, '포카칩', 20, TO_DATE('2010-11-11 11:11:11', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(18, '포카칩', 30, TO_DATE('2010-11-11 22:22:22', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(19, '새우깡', 20, TO_DATE('2010-11-12 14:00:00', 'YYYY-MM-DD HH24:MI:SS')); INSERT INTO TBL_JUMUN VALUES(20, '맛동산', 20, TO_DATE('2010-11-12 15:00:00', 'YYYY-MM-DD HH24:MI:SS')); --==>> 1 행 이(가) 삽입되었습니다. * 20 ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'; SELECT * FROM TBL_JUMUN; --==>> /* 1 바나나킥 20 2010-11-01 09:13:24 2 썬칩 10 2010-11-01 10:10:12 3 홈런볼 30 2010-11-01 13:32:12 4 포카칩 10 2010-11-02 11:11:11 5 꼬북칩 50 2010-11-02 12:12:12 6 초코파이 20 2010-11-02 16:40:10 7 새우깡 10 2010-11-03 05:25:32 8 콘칩 30 2010-11-03 06:50:52 9 수미칩 20 2010-11-03 07:29:45 10 조리퐁 30 2010-11-04 15:20:20 11 새우깡 10 2010-11-05 05:05:05 12 꼬북칩 30 2010-11-06 06:12:13 13 홈런볼 20 2010-11-07 07:12:13 14 홈런볼 25 2010-11-08 08:12:13 15 포카칩 30 2010-11-09 09:09:09 16 콘칩 10 2010-11-10 10:10:10 17 포카칩 20 2010-11-11 11:11:11 18 포카칩 30 2010-11-11 22:22:22 19 새우깡 20 2010-11-12 14:00:00 20 맛동산 20 2010-11-12 15:00:00 */ --○ 커밋 COMMIT; --==>> 커밋 완료. -- ○ 추가 데이터 입력 -> 2010년 부터 시작된 주문이... 현재(2020년)까지 계속 발생~!!! INSERT INTO TBL_JUMUN VALUES(98764, '꼬북칩', 10, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98765, '빼빼로', 20, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98766, '포카칩', 20, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98767, '홈런볼', 20, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98768, '칸쵸', 20, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98769, '포카칩', 10, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98770, '바나나킥', 10, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98771, '바나나킥', 20, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98772, '바나나킥', 30, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98773, '바나나킥', 40, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98774, '홈런볼', 10, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. INSERT INTO TBL_JUMUN VALUES(98775, '홈런볼', 20, SYSDATE); --==>> 1 행 이(가) 삽입되었습니다. --○ 확인 SELECT * FROM TBL_JUMUN; --==>> /* 1 바나나킥 20 2010-11-01 09:13:24 2 썬칩 10 2010-11-01 10:10:12 3 홈런볼 30 2010-11-01 13:32:12 4 포카칩 10 2010-11-02 11:11:11 5 꼬북칩 50 2010-11-02 12:12:12 6 초코파이 20 2010-11-02 16:40:10 7 새우깡 10 2010-11-03 05:25:32 8 콘칩 30 2010-11-03 06:50:52 9 수미칩 20 2010-11-03 07:29:45 10 조리퐁 30 2010-11-04 15:20:20 11 새우깡 10 2010-11-05 05:05:05 12 꼬북칩 30 2010-11-06 06:12:13 13 홈런볼 20 2010-11-07 07:12:13 14 홈런볼 25 2010-11-08 08:12:13 15 포카칩 30 2010-11-09 09:09:09 16 콘칩 10 2010-11-10 10:10:10 17 포카칩 20 2010-11-11 11:11:11 18 포카칩 30 2010-11-11 22:22:22 19 새우깡 20 2010-11-12 14:00:00 20 맛동산 20 2010-11-12 15:00:00 98764 꼬북칩 10 2020-10-06 14:37:10 98765 빼빼로 20 2020-10-06 14:37:45 98766 포카칩 20 2020-10-06 14:38:24 98767 홈런볼 20 2020-10-06 14:38:35 98768 칸쵸 20 2020-10-06 14:39:07 98769 포카칩 10 2020-10-06 14:39:31 98770 바나나킥 10 2020-10-06 14:40:07 98771 바나나킥 20 2020-10-06 14:40:20 98772 바나나킥 30 2020-10-06 14:40:34 98773 바나나킥 40 2020-10-06 14:40:46 98774 홈런볼 10 2020-10-06 14:41:07 98775 홈런볼 20 2020-10-06 14:41:15 */ --○ 커밋 COMMIT; --==>> 커밋 완료. --※ 홍준이가 과자 쇼핑몰 운영중... -- TBL_JUMUN 테이블이 너무 무거워진 상황 -- 어플리케이션과의 연동으로 인해 주문 내역을 다른 테이블에 -- 저장될 수 있도록 만드는 것은 불가능한 상황. -- 기존의 모든 데이터를 덮어놓고 지우는 것도 불가능한 상황 -- -> 결과적으로... -- 현재까지 누적된 주문 데이터들 중 -- 금일 발생한 주문 내역을 제외하고 -- 나머지 데이터를 다른 테이블(TBL_JUMUNBACKUP)로 데이터 이관을 수행할 계획. DESC TBL_JUMUN; CREATE TABLE TBL_JUMUNBACKUP AS SELECT * FROM TBL_JUMUN WHERE TO_CHAR(JUDAY, 'YYYY-MM-DD') <> TO_CHAR(SYSDATE, 'YYYY-MM-DD'); SELECT * FROM TBL_JUMUNBACKUP; --==>> /* 1 바나나킥 20 2010-11-01 09:13:24 2 썬칩 10 2010-11-01 10:10:12 3 홈런볼 30 2010-11-01 13:32:12 4 포카칩 10 2010-11-02 11:11:11 5 꼬북칩 50 2010-11-02 12:12:12 6 초코파이 20 2010-11-02 16:40:10 7 새우깡 10 2010-11-03 05:25:32 8 콘칩 30 2010-11-03 06:50:52 9 수미칩 20 2010-11-03 07:29:45 10 조리퐁 30 2010-11-04 15:20:20 11 새우깡 10 2010-11-05 05:05:05 12 꼬북칩 30 2010-11-06 06:12:13 13 홈런볼 20 2010-11-07 07:12:13 14 홈런볼 25 2010-11-08 08:12:13 15 포카칩 30 2010-11-09 09:09:09 16 콘칩 10 2010-11-10 10:10:10 17 포카칩 20 2010-11-11 11:11:11 18 포카칩 30 2010-11-11 22:22:22 19 새우깡 20 2010-11-12 14:00:00 20 맛동산 20 2010-11-12 15:00:00 */ --> TBL_JUMUN 테이블의 데이터들 중 -- 금일 주문 내역 이외의 데이터는 모두 TBL_JUMUNBACKUP 테이블에 -- 백업을 마친 상태 -- TBL_JUMUN 테이블의 데이터들 중 -- 벡업을 마친 데이터들 삭제 -> 즉, 금일 발생한 주문 내역이 아닌 데이터들 제거 DELETE FROM TBL_JUMUN WHERE TO_CHAR(JUDAY, 'YYYY-MM-DD') <> TO_CHAR(SYSDATE, 'YYYY-MM-DD'); SELECT * FROM TBL_JUMUN; --==>> /* 98764 꼬북칩 10 2020-10-06 14:37:10 98765 빼빼로 20 2020-10-06 14:37:45 98766 포카칩 20 2020-10-06 14:38:24 98767 홈런볼 20 2020-10-06 14:38:35 98768 칸쵸 20 2020-10-06 14:39:07 98769 포카칩 10 2020-10-06 14:39:31 98770 바나나킥 10 2020-10-06 14:40:07 98771 바나나킥 20 2020-10-06 14:40:20 98772 바나나킥 30 2020-10-06 14:40:34 98773 바나나킥 40 2020-10-06 14:40:46 98774 홈런볼 10 2020-10-06 14:41:07 98775 홈런볼 20 2020-10-06 14:41:15 */ COMMIT; --==>> 커밋 완료. --※ 아직 제품 발송이 이루어지지 않은 금일 주문 데이터를 제외하고 -- 이전의 모든 주문 데이터들이 삭제된 상황이므로 -- 테이블은 행(레코드)의 갯수가 줄어들어 매우 가벼워진 상황이다. -- 그런데, 지금까지 주문받은 내역에 대한 정보를 -- 제품별 총 주문량으로 나타내어야 할 상황이 발생하게 되었다. -- 그렇다면, TBL_JUMUNBACKUP 테이블의 레코드(행)와 -- TBL_JUMUN 테이블의 레코드(행)를 합쳐서 -- 하나의 테이블을 조회하는 것과 같은 결과를 확인할 수 있도록 -- 조회가 이루어져야 한다. --※ 컬럼과 컬럼의 관계를 고려하여 테이블을 결합하고자 하는 경우 -- JOIN 을 사용하지만 -- 레코드와 레코드를 결합하고자 하는 경우 -- UNION / UNION ALL 을 사용할 수 있다. SELECT * FROM TBL_JUMUN UNION SELECT * FROM TBL_JUMUNBACKUP; SELECT * FROM TBL_JUMUN UNION ALL SELECT * FROM TBL_JUMUNBACKUP; --※ UNION 은 항상 결과물의 첫 번째 컬럼을 기준으로 -- 오름차순 정렬을 수행한다. -- UNION ALL 은 결합된 순서대로 (구문 상 테이블을 명시한 순서대로) -- 조회한 결과를 반환한다. (즉, 정렬 없음) -- 이로 인해 UNION 이 부하가 더 크가. (즉, 리소스 소모가 더 큼) -- 또한, UNION 은 결과물에 중복된 행이 존재할 경우 -- 중복을 제거하고 1개 행만 조회된 결과를 반환하게 된다. --○ 지금까지 주문받은 데이터를 통해 -- 제품별 총 주문량을 조회할 수 있는 쿼리문을 구성한다. SELECT CASE GROUPING(T.JECODE) WHEN 0 THEN T.JECODE ELSE '총 주문량' END , SUM(T.JUSU) FROM ( SELECT * FROM TBL_JUMUNBACKUP UNION ALL SELECT * FROM TBL_JUMUN ) T GROUP BY ROLLUP(T.JECODE); /* 꼬북칩 90 맛동산 20 바나나킥 120 빼빼로 20 새우깡 40 수미칩 20 썬칩 10 조리퐁 30 초코파이 20 칸쵸 20 콘칩 40 포카칩 120 홈런볼 125 총 주문량 675 */ --○ INTERSECT / MINUS (-> 교집합과 차집합) -- TBL_JUMUNBACKUP 테이블과 TBL_JUMUN 테이블에서 -- 제품코드와 주문수량의 값이 똑같은 행만 추출하여 조회하고자 한다. SELECT JECODE, JUSU FROM TBL_JUMUNBACKUP INTERSECT SELECT JECODE, JUSU FROM TBL_JUMUN; --==>> /* 바나나킥 20 포카칩 10 포카칩 20 홈런볼 20 */ SELECT JECODE, JUSU FROM TBL_JUMUNBACKUP MINUS SELECT JECODE, JUSU FROM TBL_JUMUN; --==>> /* 꼬북칩 30 꼬북칩 50 맛동산 20 새우깡 10 새우깡 20 수미칩 20 썬칩 10 조리퐁 30 초코파이 20 콘칩 10 콘칩 30 포카칩 30 홈런볼 25 홈런볼 30 */ --○ TBL_JUMUNBACKUP 테이블과 TBL_JUMUN 테이블을 대상으로 -- 제품코드와 주문량의 값이 똑같은 행의 정보를 -- 주문번호, 제품코드, 주문량, 주문일자 항목으로 조회한다. -- TEACHER'S CODE -- 방법 1. SELECT T2.JUNO "주문번호", T1.JECODE "제품코드", T1.JUSU "주문량", T2.JUDAY "주문일자" FROM ( SELECT JECODE, JUSU FROM TBL_JUMUNBACKUP INTERSECT SELECT JECODE, JUSU FROM TBL_JUMUN ) T1 JOIN ( SELECT JUNO, JECODE, JUSU, JUDAY FROM TBL_JUMUNBACKUP UNION ALL SELECT JUNO, JECODE, JUSU, JUDAY FROM TBL_JUMUN ) T2 ON T1.JECODE = T2.JECODE AND T1.JUSU = T2.JUSU; -- 방법 2. (내가 한 코드와 비슷해서 생략) -- MY CODE SELECT J_ALL.JUNO "주문번호", J_ALL.JECODE "제품코드" , J_ALL.JUSU "주문량", J_ALL.JUDAY "주문일자" FROM ( SELECT * FROM TBL_JUMUNBACKUP UNION ALL SELECT * FROM TBL_JUMUN ) J_ALL, ( SELECT JECODE, JUSU FROM TBL_JUMUNBACKUP INTERSECT SELECT JECODE, JUSU FROM TBL_JUMUN ) J_INTER WHERE J_ALL.JECODE = J_INTER.JECODE AND J_ALL.JUSU = J_INTER.JUSU;
select color, count(id) as product_cnt, sum(price) as value_amt from product group by 1
Data Driven Decision Making with advanced SQL queries
Create Procedure mERP_sp_CheckDocRef(@DocType nVarchar(255), @DocRef nVarchar(255)) As Begin If @DocType = '' Select 0 --Select Count(*) -- From InvoiceAbstract -- Where DocReference = @DocRef And DocSerialType = N'' Else Select Count(*) From InvoiceAbstract Where DocSerialType = @DocType And DocReference = @DocRef End
select hour_min , io_read_mb , io_write_mb , io_read_mb+io_write_mb io_total_mb from ( select hour_min , round(io_read_bytes/1024/1024,0) io_read_mb , round(io_write_bytes/1024/1024,0) io_write_mb from ( select to_char(sample_time,'yyyy-mm-dd hh24:mi') hour_min ,sum(delta_read_io_bytes) io_read_bytes ,sum(delta_write_io_bytes) io_write_bytes from ash where to_char(sample_time,'yyyy-mm-dd hh24')=to_char(sysdate,'yyyy-mm-dd ')||'&1' and (delta_read_io_bytes+delta_write_io_bytes)>0 and sql_id is not null and tm_delta_cpu_time is not null group by to_char(sample_time,'yyyy-mm-dd hh24:mi') ) where io_read_bytes+io_write_bytes >0 ) order by hour_min;
-- phpMyAdmin SQL Dump -- version 5.0.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 17, 2020 at 03:33 PM -- Server version: 10.4.14-MariaDB -- PHP Version: 7.4.11 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: `ci4` -- -- -------------------------------------------------------- -- -- Table structure for table `auth_activation_attempts` -- CREATE TABLE `auth_activation_attempts` ( `id` int(11) UNSIGNED NOT NULL, `ip_address` varchar(255) NOT NULL, `user_agent` varchar(255) NOT NULL, `token` varchar(255) DEFAULT NULL, `created_at` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `auth_groups` -- CREATE TABLE `auth_groups` ( `id` int(11) UNSIGNED NOT NULL, `name` varchar(255) NOT NULL, `description` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `auth_groups_permissions` -- CREATE TABLE `auth_groups_permissions` ( `group_id` int(11) UNSIGNED NOT NULL DEFAULT 0, `permission_id` int(11) UNSIGNED NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `auth_groups_users` -- CREATE TABLE `auth_groups_users` ( `group_id` int(11) UNSIGNED NOT NULL DEFAULT 0, `user_id` int(11) UNSIGNED NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `auth_logins` -- CREATE TABLE `auth_logins` ( `id` int(11) UNSIGNED NOT NULL, `ip_address` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `user_id` int(11) UNSIGNED DEFAULT NULL, `date` datetime NOT NULL, `success` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `auth_logins` -- INSERT INTO `auth_logins` (`id`, `ip_address`, `email`, `user_id`, `date`, `success`) VALUES (1, '::1', 'anscc209@gmail.com', 1, '2020-12-17 01:39:51', 1), (2, '::1', 'anscc209@gmail.com', NULL, '2020-12-17 01:48:32', 0), (3, '::1', 'anscc209@gmail.com', NULL, '2020-12-17 01:48:43', 0), (4, '::1', 'anscc', NULL, '2020-12-17 02:32:33', 0), (5, '::1', 'anscc209@gmail.com', NULL, '2020-12-17 02:32:53', 0), (6, '::1', 'anscc209@gmail.com', NULL, '2020-12-17 02:33:01', 0), (7, '::1', 'admin@blog.com', 2, '2020-12-17 02:33:59', 1), (8, '::1', 'admin@blog.com', 2, '2020-12-17 02:37:42', 1), (9, '::1', 'admin@blog.com', 2, '2020-12-17 02:38:18', 1), (10, '::1', 'admin@blog.com', 2, '2020-12-17 02:46:09', 1), (11, '::1', 'admin@blog.com', 2, '2020-12-17 02:58:16', 1), (12, '::1', 'admin@blog.com', 2, '2020-12-17 03:10:08', 1), (13, '::1', 'admin@blog.com', 2, '2020-12-17 03:11:33', 1), (14, '::1', 'admin@blog.com', 2, '2020-12-17 03:18:03', 1), (15, '::1', 'admin@blog.com', 2, '2020-12-17 03:22:23', 1), (16, '::1', 'admin@blog.com', 2, '2020-12-17 03:25:10', 1), (17, '::1', 'admin@blog.com', 3, '2020-12-17 03:31:09', 1), (18, '::1', 'admin@blog.com', 3, '2020-12-17 03:35:56', 1), (19, '::1', 'admin@blog.com', 3, '2020-12-17 04:35:12', 1), (20, '::1', 'eka.efira@gmail.com', NULL, '2020-12-17 05:54:35', 0), (21, '::1', 'nursalsabila209', NULL, '2020-12-17 07:31:24', 0), (22, '::1', 'admin@blog.com', 6, '2020-12-17 07:35:49', 1), (23, '::1', 'admin@blog.com', 6, '2020-12-17 07:37:22', 1), (24, '::1', 'admin@blog.com', 6, '2020-12-17 08:02:21', 1); -- -------------------------------------------------------- -- -- Table structure for table `auth_permissions` -- CREATE TABLE `auth_permissions` ( `id` int(11) UNSIGNED NOT NULL, `name` varchar(255) NOT NULL, `description` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `auth_reset_attempts` -- CREATE TABLE `auth_reset_attempts` ( `id` int(11) UNSIGNED NOT NULL, `email` varchar(255) NOT NULL, `ip_address` varchar(255) NOT NULL, `user_agent` varchar(255) NOT NULL, `token` varchar(255) DEFAULT NULL, `created_at` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `auth_tokens` -- CREATE TABLE `auth_tokens` ( `id` int(11) UNSIGNED NOT NULL, `selector` varchar(255) NOT NULL, `hashedValidator` varchar(255) NOT NULL, `user_id` int(11) UNSIGNED NOT NULL, `expires` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `auth_users_permissions` -- CREATE TABLE `auth_users_permissions` ( `user_id` int(11) UNSIGNED NOT NULL DEFAULT 0, `permission_id` int(11) UNSIGNED NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `komik` -- CREATE TABLE `komik` ( `id` int(11) NOT NULL, `judul` varchar(255) NOT NULL, `slug` varchar(255) NOT NULL, `penulis` varchar(255) NOT NULL, `penerbit` varchar(255) NOT NULL, `sampul` varchar(255) NOT NULL, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `komik` -- INSERT INTO `komik` (`id`, `judul`, `slug`, `penulis`, `penerbit`, `sampul`, `created_at`, `updated_at`) VALUES (4, 'Doraemon', 'doraemon', 'Fujiko Fujio', 'Shogakukan', '1608213874_d46cec7c59b3e2339359.jpg', NULL, NULL), (5, 'Naruto', 'naruto', 'Masashi Kishimoto', 'Shonen Jump', '1608213918_c857a7fdddd5b6019301.jpg', NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` bigint(20) UNSIGNED NOT NULL, `version` varchar(255) NOT NULL, `class` text NOT NULL, `group` varchar(255) NOT NULL, `namespace` varchar(255) NOT NULL, `time` int(11) NOT NULL, `batch` int(11) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `version`, `class`, `group`, `namespace`, `time`, `batch`) VALUES (1, '2020-12-17-051439', 'App\\Database\\Migrations\\Orang', 'default', 'App', 1608183472, 1), (2, '2017-11-20-223112', 'Myth\\Auth\\Database\\Migrations\\CreateAuthTables', 'default', 'Myth\\Auth', 1608189744, 2); -- -------------------------------------------------------- -- -- Table structure for table `orang` -- CREATE TABLE `orang` ( `id` int(11) UNSIGNED NOT NULL, `nama` varchar(255) NOT NULL, `alamat` varchar(255) DEFAULT NULL, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `orang` -- INSERT INTO `orang` (`id`, `nama`, `alamat`, `created_at`, `updated_at`) VALUES (1, 'Ade Lailasari', 'Dk. Bambon No. 668, Administrasi Jakarta Barat 78264, SulTra', '2015-11-04 21:23:05', '2020-12-17 00:16:35'), (2, 'Tirtayasa Tarihoran', 'Psr. Baladewa No. 33, Ternate 50570, SulTra', '1984-10-12 08:53:52', '2020-12-17 00:16:35'), (3, 'Wisnu Budiman S.Farm', 'Jln. Cihampelas No. 699, Dumai 51571, KalUt', '1992-05-18 05:13:05', '2020-12-17 00:16:35'), (4, 'Dalima Uyainah', 'Jln. Siliwangi No. 589, Tangerang Selatan 24259, NTT', '1970-06-16 21:18:22', '2020-12-17 00:16:35'), (5, 'Septi Sabrina Pudjiastuti S.Psi', 'Gg. Pasteur No. 345, Subulussalam 67849, DKI', '1971-05-24 07:59:29', '2020-12-17 00:16:35'), (6, 'Keisha Faizah Agustina S.Sos', 'Gg. Wahidin No. 2, Gorontalo 50894, SumUt', '2012-04-26 11:22:42', '2020-12-17 00:16:35'), (7, 'Kasiyah Haryanti', 'Jln. Jamika No. 655, Lubuklinggau 15151, SulBar', '1983-09-05 15:36:24', '2020-12-17 00:16:35'), (8, 'Paramita Kezia Safitri', 'Ki. Thamrin No. 534, Cimahi 12572, SumUt', '1982-06-12 16:52:15', '2020-12-17 00:16:35'), (9, 'Gaiman Irsad Iswahyudi M.M.', 'Dk. Imam No. 302, Tanjung Pinang 33148, DIY', '1985-06-14 17:29:51', '2020-12-17 00:16:35'), (10, 'Zelaya Kasiyah Haryanti', 'Kpg. Yohanes No. 298, Pagar Alam 25877, Lampung', '2006-05-16 04:23:01', '2020-12-17 00:16:35'), (11, 'Vera Susanti', 'Dk. Abdullah No. 126, Bekasi 28247, Aceh', '1986-10-07 01:31:06', '2020-12-17 00:16:35'), (12, 'Yunita Kusmawati', 'Ki. Pasir Koja No. 249, Bukittinggi 23284, Maluku', '2009-06-01 17:15:13', '2020-12-17 00:16:35'), (13, 'Elvina Usada', 'Jr. Gajah Mada No. 989, Solok 15326, KalUt', '1975-08-22 21:03:42', '2020-12-17 00:16:35'), (14, 'Caraka Caturangga Saragih', 'Ki. Karel S. Tubun No. 181, Salatiga 62571, Papua', '1971-02-11 00:27:30', '2020-12-17 00:16:35'), (15, 'Prima Lantar Gunawan', 'Ds. BKR No. 702, Solok 44106, Aceh', '1976-09-14 00:30:32', '2020-12-17 00:16:35'), (16, 'Mitra Marbun', 'Ds. Abdul. Muis No. 920, Palu 20081, Aceh', '2019-07-19 00:36:33', '2020-12-17 00:16:35'), (17, 'Eli Tania Laksmiwati S.Farm', 'Gg. Sutan Syahrir No. 854, Administrasi Jakarta Timur 93210, MalUt', '1987-12-20 15:35:06', '2020-12-17 00:16:35'), (18, 'Ibun Megantara M.Pd', 'Ki. Ketandan No. 649, Jayapura 30427, NTB', '2000-03-15 08:58:26', '2020-12-17 00:16:36'), (19, 'Paulin Hariyah S.T.', 'Psr. Bass No. 680, Depok 36979, Aceh', '1989-01-21 14:47:01', '2020-12-17 00:16:36'), (20, 'Natalia Hariyah', 'Jr. Kusmanto No. 381, Sibolga 91393, Jambi', '2013-03-20 20:17:53', '2020-12-17 00:16:36'), (21, 'Galih Nugroho', 'Gg. Babadak No. 236, Sabang 42849, Jambi', '1992-12-09 06:55:38', '2020-12-17 00:16:36'), (22, 'Uchita Anita Novitasari S.T.', 'Kpg. Yoga No. 758, Yogyakarta 67479, SulTeng', '1988-03-12 08:24:18', '2020-12-17 00:16:36'), (23, 'Eman Dongoran', 'Jln. Antapani Lama No. 989, Manado 48343, SulUt', '1987-05-23 15:13:07', '2020-12-17 00:16:36'), (24, 'Luwes Luwes Setiawan', 'Dk. Yogyakarta No. 423, Lubuklinggau 95563, Maluku', '1984-04-29 16:04:32', '2020-12-17 00:16:36'), (25, 'Unggul Parman Pradana', 'Jr. Abdul No. 21, Padangsidempuan 96658, JaBar', '2012-07-22 20:50:19', '2020-12-17 00:16:36'), (26, 'Jatmiko Simbolon', 'Ds. Banda No. 42, Pangkal Pinang 14289, Jambi', '2016-05-01 17:33:31', '2020-12-17 00:16:36'), (27, 'Ciaobella Padma Utami', 'Jln. Ciwastra No. 263, Bontang 97267, Banten', '1998-04-21 13:49:46', '2020-12-17 00:16:36'), (28, 'Marsito Dongoran', 'Ki. Gotong Royong No. 332, Pariaman 18490, Gorontalo', '2001-06-24 10:33:26', '2020-12-17 00:16:36'), (29, 'Eko Sirait', 'Jr. Suharso No. 985, Parepare 83829, SulTra', '1991-08-29 17:17:28', '2020-12-17 00:16:36'), (30, 'Xanana Rajasa', 'Psr. Dahlia No. 179, Banjar 85535, PapBar', '1987-02-10 05:28:14', '2020-12-17 00:16:36'), (31, 'Baktianto Lazuardi S.Ked', 'Jr. Bhayangkara No. 838, Kotamobagu 59866, SumBar', '2006-11-12 16:01:51', '2020-12-17 00:16:36'), (32, 'Rika Yuliarti', 'Psr. Sudirman No. 918, Surabaya 27959, NTB', '1982-08-28 07:55:44', '2020-12-17 00:16:36'), (33, 'Vivi Anggraini S.Pt', 'Jln. Bappenas No. 212, Binjai 72341, NTB', '2000-01-10 13:18:58', '2020-12-17 00:16:36'), (34, 'Cindy Janet Purnawati', 'Jr. Pasteur No. 682, Gorontalo 75098, SulSel', '2004-10-12 22:03:11', '2020-12-17 00:16:36'), (35, 'Jarwadi Pratama S.Pd', 'Psr. Sutoyo No. 96, Mataram 38748, NTT', '1991-06-26 16:31:19', '2020-12-17 00:16:37'), (36, 'Yulia Nasyidah', 'Ds. Supomo No. 792, Depok 51771, PapBar', '1993-01-07 02:53:12', '2020-12-17 00:16:37'), (37, 'Kamila Nova Wulandari S.Psi', 'Ds. Gatot Subroto No. 75, Surabaya 83680, SulBar', '2018-01-30 04:05:22', '2020-12-17 00:16:37'), (38, 'Cindy Eka Laksita', 'Jr. Bahagia No. 40, Makassar 39768, SulUt', '2002-09-25 11:48:14', '2020-12-17 00:16:37'), (39, 'Zelda Lailasari S.IP', 'Psr. Baik No. 32, Sabang 11934, SumBar', '2005-12-05 17:12:31', '2020-12-17 00:16:37'), (40, 'Edward Opung Gunawan', 'Dk. Sutarto No. 571, Makassar 21588, SumBar', '2009-11-19 00:46:15', '2020-12-17 00:16:37'), (41, 'Tri Kusumo', 'Ds. Baya Kali Bungur No. 881, Administrasi Jakarta Timur 14444, KalTim', '1983-01-05 08:10:27', '2020-12-17 00:16:37'), (42, 'Puspa Hasna Permata', 'Jln. Abdul No. 684, Administrasi Jakarta Selatan 86511, DKI', '1987-01-08 13:25:28', '2020-12-17 00:16:37'), (43, 'Wani Karimah Sudiati S.E.', 'Ki. Banda No. 740, Pekalongan 74829, PapBar', '1986-03-29 19:20:06', '2020-12-17 00:16:37'), (44, 'Carla Wastuti', 'Dk. Jend. A. Yani No. 124, Surabaya 62826, KalBar', '2012-02-06 08:26:52', '2020-12-17 00:16:37'), (45, 'Cecep Dodo Dabukke', 'Jln. Nanas No. 49, Bandung 88425, Lampung', '1998-04-13 11:02:59', '2020-12-17 00:16:37'), (46, 'Gawati Wastuti M.Pd', 'Jr. Lembong No. 31, Batam 92915, DIY', '1982-04-09 17:50:44', '2020-12-17 00:16:37'), (47, 'Gasti Nasyiah S.Sos', 'Ds. Banal No. 168, Pagar Alam 12064, Jambi', '1980-11-28 12:59:59', '2020-12-17 00:16:37'), (48, 'Zulaikha Uchita Mulyani', 'Psr. Achmad No. 480, Sabang 61195, JaBar', '2012-06-02 22:30:25', '2020-12-17 00:16:37'), (49, 'Sadina Nuraini', 'Jln. Gegerkalong Hilir No. 404, Banjar 55390, KalTim', '1984-02-13 23:17:45', '2020-12-17 00:16:37'), (50, 'Hana Oktaviani S.H.', 'Ki. Sumpah Pemuda No. 423, Madiun 31635, JaBar', '1987-07-05 13:37:52', '2020-12-17 00:16:37'), (51, 'Genta Kania Handayani', 'Psr. Setiabudhi No. 690, Gorontalo 64113, Maluku', '1991-05-02 22:18:38', '2020-12-17 00:16:37'), (52, 'Laswi Thamrin S.T.', 'Kpg. W.R. Supratman No. 452, Yogyakarta 92937, DIY', '1970-07-29 01:44:34', '2020-12-17 00:16:37'), (53, 'Umar Manullang', 'Ki. Gedebage Selatan No. 633, Banjarmasin 35281, KalBar', '1973-06-26 19:32:34', '2020-12-17 00:16:37'), (54, 'Daryani Januar', 'Jln. Bakhita No. 222, Bontang 90179, Riau', '1998-12-25 19:36:11', '2020-12-17 00:16:37'), (55, 'Umi Andriani', 'Psr. Arifin No. 484, Metro 49885, DKI', '1998-07-14 14:35:03', '2020-12-17 00:16:37'), (56, 'Sabrina Septi Zulaika', 'Jr. Flora No. 782, Cirebon 31447, PapBar', '1992-12-28 11:17:51', '2020-12-17 00:16:37'), (57, 'Michelle Mayasari', 'Ki. Ir. H. Juanda No. 60, Administrasi Jakarta Selatan 75850, SulBar', '1979-09-04 13:02:16', '2020-12-17 00:16:38'), (58, 'Lembah Simbolon M.Kom.', 'Psr. Banal No. 393, Pekalongan 22794, SumSel', '2003-08-04 18:23:02', '2020-12-17 00:16:38'), (59, 'Jamalia Sudiati', 'Ki. Baja Raya No. 43, Pagar Alam 80926, SulTra', '1993-07-25 18:19:23', '2020-12-17 00:16:38'), (60, 'Gatra Latif Permadi M.Farm', 'Jln. Bakau Griya Utama No. 43, Batam 36395, Bengkulu', '1991-07-20 19:06:01', '2020-12-17 00:16:38'), (61, 'Kairav Mulyanto Prayoga', 'Ds. Bass No. 258, Bau-Bau 57266, Bali', '1985-05-28 17:42:14', '2020-12-17 00:16:38'), (62, 'Zelda Tania Rahimah M.TI.', 'Jr. Katamso No. 330, Madiun 75837, KalSel', '2018-10-08 06:25:03', '2020-12-17 00:16:38'), (63, 'Mila Dewi Handayani', 'Ds. Kebangkitan Nasional No. 223, Bontang 28153, SumSel', '1971-01-15 08:51:26', '2020-12-17 00:16:38'), (64, 'Kenzie Widodo M.Pd', 'Gg. Baja No. 380, Bukittinggi 69181, Bali', '1993-12-09 15:00:03', '2020-12-17 00:16:38'), (65, 'Tania Titin Yuliarti M.Ak', 'Gg. Halim No. 745, Samarinda 71212, DKI', '2015-08-15 23:07:30', '2020-12-17 00:16:38'), (66, 'Lantar Haryanto', 'Jr. Bazuka Raya No. 386, Sibolga 78886, SulBar', '2009-06-12 01:15:57', '2020-12-17 00:16:38'), (67, 'Zulfa Yuliarti', 'Gg. Suryo Pranoto No. 968, Ambon 64266, Bali', '1981-01-06 04:29:15', '2020-12-17 00:16:38'), (68, 'Enteng Martaka Najmudin', 'Psr. Nanas No. 871, Tangerang 75774, SulUt', '1980-03-01 07:37:45', '2020-12-17 00:16:38'), (69, 'Umar Gunarto', 'Dk. Kalimalang No. 518, Gorontalo 74347, Aceh', '1990-09-28 03:57:40', '2020-12-17 00:16:38'), (70, 'Kasiyah Utami M.TI.', 'Psr. K.H. Wahid Hasyim (Kopo) No. 809, Medan 44548, KalBar', '2000-07-08 16:00:42', '2020-12-17 00:16:38'), (71, 'Malik Hardiansyah', 'Ds. Supomo No. 281, Banjarbaru 43638, SumSel', '2002-08-24 00:59:51', '2020-12-17 00:16:38'), (72, 'Violet Yuliarti', 'Jr. Imam Bonjol No. 912, Padangpanjang 48976, KalBar', '1982-05-09 15:57:10', '2020-12-17 00:16:38'), (73, 'Hasna Pertiwi S.I.Kom', 'Jln. Pasirkoja No. 580, Administrasi Jakarta Utara 95030, Gorontalo', '1980-11-19 03:51:41', '2020-12-17 00:16:39'), (74, 'Hartana Jailani', 'Ds. Honggowongso No. 356, Administrasi Jakarta Timur 36639, KalSel', '2008-08-15 02:26:37', '2020-12-17 00:16:39'), (75, 'Cakrawala Muhammad Siregar', 'Kpg. Tambun No. 806, Pontianak 57984, SumUt', '1993-09-03 17:37:24', '2020-12-17 00:16:39'), (76, 'Yono Gaiman Suwarno', 'Ki. Abdul No. 304, Sorong 49803, Aceh', '1984-04-08 20:20:14', '2020-12-17 00:16:39'), (77, 'Dalimin Rajata', 'Jr. Babah No. 263, Kendari 92086, Bali', '1981-08-31 02:33:39', '2020-12-17 00:16:39'), (78, 'Emas Halim', 'Psr. Bara Tambar No. 136, Lubuklinggau 89725, NTB', '1987-01-27 04:15:25', '2020-12-17 00:16:39'), (79, 'Citra Laksita', 'Jln. Abdul. Muis No. 352, Manado 59093, Maluku', '2010-02-13 06:54:04', '2020-12-17 00:16:39'), (80, 'Mariadi Damu Zulkarnain', 'Ki. Baha No. 824, Lhokseumawe 77316, SumBar', '1970-10-26 16:59:31', '2020-12-17 00:16:39'), (81, 'Oliva Pudjiastuti S.E.', 'Ds. Ir. H. Juanda No. 686, Bima 86138, NTB', '1998-07-02 20:49:00', '2020-12-17 00:16:39'), (82, 'Yusuf Damu Mustofa M.Kom.', 'Ds. W.R. Supratman No. 798, Binjai 36847, Aceh', '2016-03-18 08:33:28', '2020-12-17 00:16:39'), (83, 'Hardana Prasetya', 'Jln. Padma No. 959, Bitung 88775, Aceh', '1974-02-10 12:21:13', '2020-12-17 00:16:40'), (84, 'Lalita Vanya Utami', 'Psr. Rajawali Timur No. 110, Palangka Raya 47679, KepR', '2011-02-20 01:23:23', '2020-12-17 00:16:40'), (85, 'Elma Olivia Laksmiwati S.Psi', 'Jln. Bhayangkara No. 358, Pekalongan 63285, SulTeng', '2013-05-28 20:53:01', '2020-12-17 00:16:40'), (86, 'Dian Ghaliyati Kusmawati S.T.', 'Dk. Sugiyopranoto No. 665, Pagar Alam 61150, KalTim', '1976-05-14 23:30:19', '2020-12-17 00:16:40'), (87, 'Marsito Natsir', 'Dk. Reksoninten No. 661, Palangka Raya 28795, JaBar', '2010-11-17 09:58:23', '2020-12-17 00:16:40'), (88, 'Salimah Sudiati', 'Jr. Pattimura No. 180, Tomohon 76075, KalSel', '2005-03-04 17:48:09', '2020-12-17 00:16:40'), (89, 'Zizi Hariyah', 'Gg. Sugiono No. 172, Bima 16898, Jambi', '1973-05-26 12:43:24', '2020-12-17 00:16:40'), (90, 'Hesti Agnes Maryati M.Ak', 'Dk. Taman No. 299, Tual 20880, KalBar', '1971-12-09 20:35:18', '2020-12-17 00:16:40'), (91, 'Hafshah Jane Zulaika S.Sos', 'Jr. Cikapayang No. 340, Bandar Lampung 71591, KalTeng', '2005-02-26 10:59:30', '2020-12-17 00:16:40'), (92, 'Nabila Nurdiyanti', 'Kpg. Cikapayang No. 348, Lhokseumawe 81138, DKI', '2012-08-19 19:14:52', '2020-12-17 00:16:40'), (93, 'Patricia Yulia Wijayanti', 'Psr. Suharso No. 364, Administrasi Jakarta Selatan 21010, Jambi', '1982-12-13 18:54:39', '2020-12-17 00:16:40'), (94, 'Utama Natsir', 'Dk. Ters. Pasir Koja No. 997, Padangpanjang 95397, Bali', '2013-09-05 10:10:59', '2020-12-17 00:16:40'), (95, 'Citra Utami', 'Jln. R.E. Martadinata No. 372, Gunungsitoli 58462, Aceh', '2003-04-13 19:02:03', '2020-12-17 00:16:40'), (96, 'Aisyah Riyanti', 'Dk. Kyai Mojo No. 784, Bau-Bau 27282, Papua', '2003-11-23 07:24:26', '2020-12-17 00:16:40'), (97, 'Tania Mardhiyah', 'Dk. Nakula No. 1, Singkawang 84168, PapBar', '1985-12-22 02:46:04', '2020-12-17 00:16:40'), (98, 'Hamima Mayasari', 'Psr. Suniaraja No. 246, Kupang 80879, NTT', '2009-01-06 05:34:47', '2020-12-17 00:16:41'), (99, 'Olivia Violet Nasyidah', 'Gg. Bayam No. 358, Sorong 15191, SulTeng', '1978-04-20 09:20:15', '2020-12-17 00:16:41'), (100, 'Mustofa Carub Siregar', 'Jln. Salak No. 205, Yogyakarta 90629, Bengkulu', '1995-11-04 19:04:46', '2020-12-17 00:16:41'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) UNSIGNED NOT NULL, `email` varchar(255) NOT NULL, `username` varchar(30) DEFAULT NULL, `password_hash` varchar(255) NOT NULL, `reset_hash` varchar(255) DEFAULT NULL, `reset_at` datetime DEFAULT NULL, `reset_expires` datetime DEFAULT NULL, `activate_hash` varchar(255) DEFAULT NULL, `status` varchar(255) DEFAULT NULL, `status_message` varchar(255) DEFAULT NULL, `active` tinyint(1) NOT NULL DEFAULT 0, `force_pass_reset` tinyint(1) NOT NULL DEFAULT 0, `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, `deleted_at` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `email`, `username`, `password_hash`, `reset_hash`, `reset_at`, `reset_expires`, `activate_hash`, `status`, `status_message`, `active`, `force_pass_reset`, `created_at`, `updated_at`, `deleted_at`) VALUES (6, 'admin@blog.com', 'admin', '$2y$10$qOpJ.9Th2tfBUQpnZu4yJOgvIjQsFYGNp3vI75lsPlwoV3fojWHse', NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, '2020-12-17 07:35:40', '2020-12-17 07:35:40', NULL); -- -- Indexes for dumped tables -- -- -- Indexes for table `auth_activation_attempts` -- ALTER TABLE `auth_activation_attempts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `auth_groups` -- ALTER TABLE `auth_groups` ADD PRIMARY KEY (`id`); -- -- Indexes for table `auth_groups_permissions` -- ALTER TABLE `auth_groups_permissions` ADD KEY `auth_groups_permissions_permission_id_foreign` (`permission_id`), ADD KEY `group_id_permission_id` (`group_id`,`permission_id`); -- -- Indexes for table `auth_groups_users` -- ALTER TABLE `auth_groups_users` ADD KEY `auth_groups_users_user_id_foreign` (`user_id`), ADD KEY `group_id_user_id` (`group_id`,`user_id`); -- -- Indexes for table `auth_logins` -- ALTER TABLE `auth_logins` ADD PRIMARY KEY (`id`), ADD KEY `email` (`email`), ADD KEY `user_id` (`user_id`); -- -- Indexes for table `auth_permissions` -- ALTER TABLE `auth_permissions` ADD PRIMARY KEY (`id`); -- -- Indexes for table `auth_reset_attempts` -- ALTER TABLE `auth_reset_attempts` ADD PRIMARY KEY (`id`); -- -- Indexes for table `auth_tokens` -- ALTER TABLE `auth_tokens` ADD PRIMARY KEY (`id`), ADD KEY `auth_tokens_user_id_foreign` (`user_id`), ADD KEY `selector` (`selector`); -- -- Indexes for table `auth_users_permissions` -- ALTER TABLE `auth_users_permissions` ADD KEY `auth_users_permissions_permission_id_foreign` (`permission_id`), ADD KEY `user_id_permission_id` (`user_id`,`permission_id`); -- -- Indexes for table `komik` -- ALTER TABLE `komik` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `orang` -- ALTER TABLE `orang` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `email` (`email`), ADD UNIQUE KEY `username` (`username`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `auth_activation_attempts` -- ALTER TABLE `auth_activation_attempts` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `auth_groups` -- ALTER TABLE `auth_groups` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `auth_logins` -- ALTER TABLE `auth_logins` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25; -- -- AUTO_INCREMENT for table `auth_permissions` -- ALTER TABLE `auth_permissions` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `auth_reset_attempts` -- ALTER TABLE `auth_reset_attempts` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `auth_tokens` -- ALTER TABLE `auth_tokens` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `komik` -- ALTER TABLE `komik` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `orang` -- ALTER TABLE `orang` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- Constraints for dumped tables -- -- -- Constraints for table `auth_groups_permissions` -- ALTER TABLE `auth_groups_permissions` ADD CONSTRAINT `auth_groups_permissions_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `auth_groups` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `auth_groups_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `auth_permissions` (`id`) ON DELETE CASCADE; -- -- Constraints for table `auth_groups_users` -- ALTER TABLE `auth_groups_users` ADD CONSTRAINT `auth_groups_users_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `auth_groups` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `auth_groups_users_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; -- -- Constraints for table `auth_tokens` -- ALTER TABLE `auth_tokens` ADD CONSTRAINT `auth_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; -- -- Constraints for table `auth_users_permissions` -- ALTER TABLE `auth_users_permissions` ADD CONSTRAINT `auth_users_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `auth_permissions` (`id`) ON DELETE CASCADE, ADD CONSTRAINT `auth_users_permissions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE 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 */;
drop sequence if exists customer_seq; create sequence customer_seq minvalue 1 start with 4 increment by 50; drop sequence if exists address_seq; create sequence address_seq minvalue 1 start with 3 increment by 50; drop sequence if exists product_seq; create sequence product_seq minvalue 1 start with 4 increment by 50; drop sequence if exists orders_seq; create sequence orders_seq minvalue 1 start with 2 increment by 50; drop sequence if exists line_item_seq; create sequence line_item_seq minvalue 1 start with 3 increment by 50; drop table if exists Customer; create table Customer(id bigint auto_increment primary key, email varchar(255), firstname varchar(255), lastname varchar(255), version int); drop table if exists Address; create table Address(id bigint auto_increment primary key, street varchar(255), suburb varchar(255), state varchar(3), postcode varchar(4), customer_id bigint, version int); drop table if exists Product; create table Product(id bigint auto_increment primary key, name varchar(255), description varchar(255), state varchar(255), price decimal, version int); drop table if exists Product_Attributes; create table Product_Attributes(attributes_key varchar(255), product_id bigint, attributes varchar(255), version int); drop table if exists Orders; create table Orders(id bigint auto_increment primary key, customer_id bigint, shippingaddress_id bigint, billingAddress_id bigint, created timestamp, version int); drop table if exists LineItem; create table LineItem(id bigint auto_increment primary key, product_id bigint, amount int, order_id bigint, price decimal, version int);
SELECT member, name FROM members WHERE name = :name;
CREATE procedure sp_ser_itemoptions_fmcg(@ProductCode nvarchar(15)) as Select i.Track_Batches 'Batch', i.TrackPKD 'PKD', c.Track_Inventory 'INVENTORY', c.Price_Option 'CSP', Sale_Price 'Sale Price' from Items i Inner Join ItemCategories c on i.categoryID = c.categoryID Where Product_Code = @ProductCode
CREATE TABLE flightstats_fbwind ( fbwindairportid BIGINT, ordinal BIGINT, bearing BIGINT, knots BIGINT, temperature CHARACTER VARYING); CREATE TABLE flightstats_fbwindairport ( fbwindairportid BIGINT, fbwindreportid BIGINT, airportcode CHARACTER VARYING); CREATE TABLE flightstats_fbwindaltitude ( fbwindreportid BIGINT, ordinal BIGINT, altitude BIGINT); CREATE TABLE flightstats_fbwindreport ( fbwindreportid BIGINT, createdutc TIMESTAMP WITH TIME ZONE, reporttype1 CHARACTER VARYING, reporttype2 CHARACTER VARYING, reporttype3 CHARACTER VARYING, generated BIGINT, basedon CHARACTER VARYING, valid CHARACTER VARYING, forusestart BIGINT, foruseend BIGINT, negativeabove BIGINT, altitudescale CHARACTER VARYING, altitudeunits CHARACTER VARYING); CREATE TABLE flightstats_taf ( tafid BIGINT, station CHARACTER VARYING, airport CHARACTER VARYING, rawtext CHARACTER VARYING, latitude DOUBLE PRECISION, longitude DOUBLE PRECISION, elevationmeters BIGINT, remarks CHARACTER VARYING, bulletintimeutc TIMESTAMP WITH TIME ZONE, issuetimeutc TIMESTAMP WITH TIME ZONE, validtimefromutc TIMESTAMP WITH TIME ZONE, validtimetoutc TIMESTAMP WITH TIME ZONE); CREATE TABLE flightstats_tafforecast ( tafforecastid BIGINT, tafid BIGINT, altimiter CHARACTER VARYING, changeindicator CHARACTER VARYING, forecasttimefromutc TIMESTAMP WITH TIME ZONE, forecasttimetoutc TIMESTAMP WITH TIME ZONE, probability CHARACTER VARYING, timebecomingutc CHARACTER VARYING, verticalvisibility CHARACTER VARYING, visibilitystatutemiles DOUBLE PRECISION, windspeedknots DOUBLE PRECISION, winddirectiondegrees DOUBLE PRECISION, windgustspeedknots DOUBLE PRECISION, windsheardirectiondegrees CHARACTER VARYING, windshearheightfeet CHARACTER VARYING, windshearspeedknots CHARACTER VARYING, weatherstring CHARACTER VARYING, notdecoded CHARACTER VARYING); CREATE TABLE flightstats_taficing ( tafforecastid BIGINT, intensity DOUBLE PRECISION, minimumaltitudefeet CHARACTER VARYING, maximumaltitudefeet DOUBLE PRECISION); CREATE TABLE flightstats_tafsky ( tafforecastid BIGINT, cloudbasefeet DOUBLE PRECISION, cloudtype CHARACTER VARYING, cloudcover CHARACTER VARYING); CREATE TABLE flightstats_taftemperature ( tafforecastid BIGINT, validtimeutc TIMESTAMP WITH TIME ZONE, mintemperaturecelcius CHARACTER VARYING, maxtemperaturecelcius DOUBLE PRECISION, surfacetemperaturecelcius CHARACTER VARYING); CREATE TABLE flightstats_tafturbulence ( tafforecastid BIGINT, intensity DOUBLE PRECISION, minimumaltitudefeet DOUBLE PRECISION, maximumaltitudefeet DOUBLE PRECISION);
{{ config( materialized='incremental', sql_where = 'TRUE', unique_key='event_id' ) }} with new_events as ( select * from {{ ref('parsely_rawdata') }} {% if adapter.get_relation(database=this.database, schema=this.schema, identifier=this.name) and not flags.FULL_REFRESH %} where insert_timestamp > ( select coalesce(max(t.insert_timestamp), '0001-01-01') from {{ this }} as t ) {% endif %} ), timezone_convert as ( SELECT *, -- ts_action convert_timezone({{ var('parsely:timezone') }}, ts_action) as ts_action_tz, -- ts_session_current convert_timezone({{ var('parsely:timezone') }}, ts_session_current) as ts_session_current_tz, -- ts_session_last convert_timezone({{ var('parsely:timezone') }}, ts_session_last) as ts_session_last_tz, -- metadata_pub_date_tmsp convert_timezone({{ var('parsely:timezone') }}, (TIMESTAMP 'epoch' + left(metadata_pub_date_tmsp,10)::bigint * INTERVAL '1 Second ')) as metadata_pub_date_tmsp_tz, -- metadata_save_date_tmsp convert_timezone({{ var('parsely:timezone') }}, (TIMESTAMP 'epoch' + left(metadata_save_date_tmsp,10)::bigint * INTERVAL '1 Second ')) as metadata_save_date_tmsp_tz, -- timestamp_info_nginx_ms convert_timezone({{ var('parsely:timezone') }}, (TIMESTAMP 'epoch' + left(timestamp_info_nginx_ms,10)::bigint * INTERVAL '1 Second ')) as timestamp_info_nginx_ms_tz, -- session_last_session_timestamp convert_timezone({{ var('parsely:timezone') }}, (TIMESTAMP 'epoch' + left(session_last_session_timestamp,10)::bigint * INTERVAL '1 Second ')) as session_last_session_timestamp_tz, -- session_timestamp convert_timezone({{ var('parsely:timezone') }}, (TIMESTAMP 'epoch' + left(session_timestamp,10)::bigint * INTERVAL '1 Second ')) as session_timestamp_tz, -- timestamp_info_pixel_ms convert_timezone({{ var('parsely:timezone') }}, (TIMESTAMP 'epoch' + left(timestamp_info_pixel_ms,10)::bigint * INTERVAL '1 Second ')) as timestamp_info_pixel_ms_tz from new_events ), dedupe as ( select *, -- event action dates and times DATE_PART('day',ts_action_tz) as day, DATE_PART('quarter',ts_action_tz) as quarter, DATE_PART('month',ts_action_tz) as month, DATE_PART('year',ts_action_tz) as year, DATE_PART('week',ts_action_tz) as week, (DATE_PART('y', ts_action_tz)*10000+DATE_PART('mon', ts_action_tz)*100+DATE_PART('day', ts_action_tz)) AS date_id, (DATE_PART('y', ts_session_current_tz)*10000+DATE_PART('mon', ts_session_current_tz)*100+DATE_PART('day', ts_session_current_tz)) AS session_date_id, -- transformed fields coalesce(metadata_canonical_url,url) as pageview_post_id, json_extract_path_text( extra_data, {{var('custom:extradata')}}) as {{var('custom:extradataname')}}, case when referrer = 'http://facebook.com/instantarticles' then true else false end as flag_is_fbia, -- dedupe field as we can receive duplicate event_ids that can be excluded row_number() over (partition by event_id order by ts_action) as n, -- counter fields case when action = 'pageview' then 1 else 0 end as pageview_counter, case when action = 'videostart' then 1 else 0 end as videostart_counter, -- hash identifier fields md5( coalesce(videostart_id::text,'')|| '_' || coalesce(apikey::text,'') || '_' || coalesce(session_id::text,'') || '_' || coalesce(visitor_site_id::text,'') || '_' || coalesce(url::text,'') || '_' || coalesce(metadata_canonical_url::text,'') || '_' || coalesce(referrer::text,'') || '_' || coalesce(ts_session_current::text,'')) as videostart_key, md5( coalesce(pageview_id::text,'')|| '_' || coalesce(apikey::text,'') || '_' || coalesce(session_id::text,'') || '_' || coalesce(visitor_site_id::text,'') || '_' || coalesce(metadata_canonical_url::text,url) || '_' || coalesce(referrer::text,'') || '_' || coalesce(ts_session_current::text,'')) as pageview_key, md5( coalesce(apikey::text,'') || '_' || coalesce(utm_campaign::text,'') || '_' || coalesce(utm_medium::text,'') || '_' || coalesce(utm_source::text,'') || '_' || coalesce(utm_term::text,'') || '_' || coalesce(utm_content::text,'') ) as utm_id, md5( coalesce(apikey::text,'') || '_' || coalesce(session_id::text,'') || '_' || coalesce(visitor_site_id::text,'') || '_' || coalesce(session_timestamp::text,'')) as parsely_session_id, md5( coalesce(apikey::text,'') || '_' || coalesce(visitor_site_id::text,'')) as apikey_visitor_id from timezone_convert ) select * from dedupe where n = 1
-- phpMyAdmin SQL Dump -- version 4.7.9 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Nov 23, 2018 at 12:24 PM -- Server version: 5.7.22-0ubuntu18.04.1 -- PHP Version: 7.2.5-1+ubuntu18.04.1+deb.sury.org+1 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: `web_developer_test` -- -- -------------------------------------------------------- -- -- Table structure for table `migration_versions` -- CREATE TABLE `migration_versions` ( `version` varchar(255) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `migration_versions` -- INSERT INTO `migration_versions` (`version`) VALUES ('20181123101148'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `password` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `first_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `last_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `roles` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` datetime DEFAULT NULL, `modified_at` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `username`, `password`, `first_name`, `last_name`, `roles`, `created_at`, `modified_at`) VALUES (1, 'admin', '$2y$13$9./JSVkG/nH9A/IfWXJdYOi6xJHgPsbB.YIdI546ZxH2Hvmkip9EK', NULL, NULL, 'ROLE_ADMIN', '2018-11-23 00:00:00', NULL); -- -- Indexes for dumped tables -- -- -- Indexes for table `migration_versions` -- ALTER TABLE `migration_versions` ADD PRIMARY KEY (`version`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `UNIQ_8D93D649F85E0677` (`username`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `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 */;
--select select * from members; select * from card; select * from address; select * from members m join card c on m.members_no=c.members_no where m.members_no=1; select * from members m join address a on m.members_no=a.members_no where m.members_no=1; select * from members m join card c on m.members_no=c.members_no join address a on a.members_no=c.members_no where m.members_no=1; select * from category; select * from food; select * from cart; select * from cart c join food f on c.food_no=f.food_no where f.food_no = 302; select * from cart c join members m on c.members_no=m.members_no where m.members_no = 302; select * from orders; select * from orders_detail; select * from orders o join orders_detail od on o.orders_no=od.orders_no; select * from comments; select * from comments where comments_writer='mac123@google.com'; select o.orders_no as orders_no,orders_desc,orders_date,orders_price,members_no,orders_detail_no, orders_detail_qty,food_no from orders o join orders_detail od on o.orders_no=od.orders_no where members_no=1 --update /* update members set Members_name='김춘향', Members_gender='F', Members_email='abc123@naver.com', Members_password='1111', Members_phone=01045987556 where members_no=4; update card set card_number=4525798535464598, Card_name='삼성카드', Card_type=0 where card_no=1 and members_no=1; update address set Address_name='이모집', Address_detail='대구광역시 산 좋고 물 좋은데', Address_type=1 where Address_no=2 and members_no=1; update cart set cart_qty=2 where cart_no=1 and food_no=301; update orders_detail set orders_detail_qty=2 where orders_detail_no=3 and orders_no=2; update orders set orders_price=14400 where orders_no=2; */ /* update comments set Comments_title=?, Comments_content=?, Comments_star=?, Comments_date=sysdate, Comments_count=Comments_count+1, where Comments_writer=? and Comments_no=?; */ --delete --회원 한명의 삭제는 카드,주소,카트,주문을 먼저 삭제하고 해야한다. /* delete from orders_detail where orders_no in(select orders_no from orders where members_no=1); delete from orders where members_no=1; delete from card where members_no=1; delete from address where members_no=1; delete from members where members_no=1; delete from food where food_no=301; delete from category where category_no=?; delete from comments where comments_group=2 and comments_step=1 and comments_dept=2; */
\c pseph TRUNCATE TABLE Preference; INSERT INTO Preference (PaperId, CandidateId, PreferenceNumber) VALUES (1, 1, 1), (1, 2, 1), (2, 1, 2), (2, 2, 1), (3, 4, 1), (3, 3, 2), (3, 2, 3), (3, 1, 4), (4, 3, 1), (5, 3, 2), (5, 4, 1), (5, 1, 3), (5, 2, 4), (6, 2, 1) ; TRUNCATE TABLE Weight; INSERT INTO Weight (PreferenceNumber, Weight) VALUES (1, 1), (2, 0.5), (3, 0.33), (4, 0.25), (5, 0.2) ;
CREATE TABLE apps ( PK SERIAL PRIMARY KEY, ID VARCHAR, TITLE VARCHAR, RATING FLOAT(2), LAST_UPDATE_DATE DATE );
--insert INSERT INTO member (m_id, m_password, m_name, m_address, m_age, m_married, m_regdate) VALUES ('guard','1111','김경호','서울시 관악구',42,'T',sysdate); INSERT INTO member (m_id, m_password, m_name, m_address, m_age, m_married, m_regdate) VALUES ('xxxx','2222','김경우','서울시 강남구',34,'F',sysdate); INSERT INTO member (m_id, m_password, m_name, m_address, m_age, m_married, m_regdate) VALUES ('yyyy','3333','김경미','서울시 동작구',23,'F',sysdate); --update pk update member set m_password='1111',m_name='김변경',m_address='제주',m_age=28,m_married='F' where m_id='xxxx'; --delete pk delete member where m_id='xxxx'; --select pk select * from member where m_id='xxxx'; --select all select * from member;
-- Para entrar no MySql == mysql -h localhost -u root -p -- -- create database == cria o banco -- -- show database == mosta o banco -- -- CREATE TABLE usuarios( == cria a tabela -- nome VARCHAR(50), -- email VARCHAR(100), -- idade INT -- ); -- -- INSERT INTO usuarios(nome, email, idade) VALUES( == insere valores na tabela -- 'Will', -- 'will.roc@hotmail.com', -- 22 -- ); -- describe usuarios == mostra a tabela usuarios -- show tables; == lista as tabelas -- SELECT * FROM usuarios; == seleciona todos os dados cadastrados na tabela usuario -- SELECT * FROM usuarios WHERE idade = 4; == seleciona todos os usuarios na tebela que tenha a idade 4