text
stringlengths
6
9.38M
-- show_container.sql -- 12c - show current container col container format a20 select sys_context ('userenv', 'con_name') container from dual; show con_name
create or replace view v_cg002_cgysmx as select cg002.czde397,cg002.czde398,sum(jh004.czde391) as cgys from cg002,jh004 where cg002.jsde215 = jh004.jsde215 group by cg002.czde397,cg002.czde398 with read only; comment on table V_CG002_CGYSMX is '根据立项、包内码分组';
/* SQLyog Community v12.3.2 (32 bit) MySQL - 10.1.38-MariaDB : Database - nodejsrestapi ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`nodejsrestapi` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `nodejsrestapi`; /*Table structure for table `akses_token` */ DROP TABLE IF EXISTS `akses_token`; CREATE TABLE `akses_token` ( `id_akses_token` int(11) NOT NULL AUTO_INCREMENT, `id_user` int(11) DEFAULT NULL, `access_token` text, `ip_address` varchar(20) DEFAULT NULL, PRIMARY KEY (`id_akses_token`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; /*Data for the table `akses_token` */ insert into `akses_token`(`id_akses_token`,`id_user`,`access_token`,`ip_address`) values (4,1,'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb3dzIjpbeyJpZCI6MSwidXNlcm5hbWUiOiJoYW1pZCIsImVtYWlsIjoiaGFtaWRAZ21haWwuY29tIiwicGFzc3dvcmQiOiIzN2ZmZjM1N2MyMzdkNjdmMjM2NWVhYjY3MDZiYzg5OCIsInJvbGUiOjIsInRhbmdnYWxfZGFmdGFyIjoiMjAyMC0wOC0xOFQxNzowMDowMC4wMDBaIn1dLCJpYXQiOjE1OTc4Mjk0NTUsImV4cCI6MTU5NzgyOTUxNX0.FSS5kzc-SvHZCQLiLxMQT6kdLFKSC3Rk6QWgSUPTDgM','192.168.43.29'), (5,1,'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb3dzIjpbeyJpZCI6MSwidXNlcm5hbWUiOiJoYW1pZCIsImVtYWlsIjoiaGFtaWRAZ21haWwuY29tIiwicGFzc3dvcmQiOiIzN2ZmZjM1N2MyMzdkNjdmMjM2NWVhYjY3MDZiYzg5OCIsInJvbGUiOjIsInRhbmdnYWxfZGFmdGFyIjoiMjAyMC0wOC0xOFQxNzowMDowMC4wMDBaIn1dLCJpYXQiOjE1OTc4Mjk1ODksImV4cCI6MTU5NzgyOTY0OX0.S_FKBl9UNEVaN2LbVxJKOE7fkn_1Kd_qqbZHSWEtCcA','192.168.43.29'), (6,1,'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb3dzIjpbeyJpZCI6MSwidXNlcm5hbWUiOiJoYW1pZCIsImVtYWlsIjoiaGFtaWRAZ21haWwuY29tIiwicGFzc3dvcmQiOiIzN2ZmZjM1N2MyMzdkNjdmMjM2NWVhYjY3MDZiYzg5OCIsInJvbGUiOjIsInRhbmdnYWxfZGFmdGFyIjoiMjAyMC0wOC0xOFQxNzowMDowMC4wMDBaIn1dLCJpYXQiOjE1OTc4Mjk2MDgsImV4cCI6MTU5NzgyOTY2OH0.DAh04NZRvCoTLjQX3u4WqkOy1XQKiM-SkEc44IdOc7Q','192.168.43.29'); /*Table structure for table `krs` */ DROP TABLE IF EXISTS `krs`; CREATE TABLE `krs` ( `id_krs` int(11) NOT NULL AUTO_INCREMENT, `tanggal_krs` date DEFAULT NULL, `id_matakuliah` int(11) DEFAULT NULL, `id_mahasiswa` int(11) DEFAULT NULL, PRIMARY KEY (`id_krs`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; /*Data for the table `krs` */ insert into `krs`(`id_krs`,`tanggal_krs`,`id_matakuliah`,`id_mahasiswa`) values (1,'2020-08-19',2,1), (2,'2020-08-19',3,1), (3,'2020-08-19',4,1), (4,'2020-08-19',1,2), (5,'2020-08-19',2,2), (6,'2020-08-19',3,2), (7,'2020-08-19',4,2); /*Table structure for table `mahasiswa` */ DROP TABLE IF EXISTS `mahasiswa`; CREATE TABLE `mahasiswa` ( `id_mahasiswa` int(11) NOT NULL AUTO_INCREMENT, `nim` varchar(9) DEFAULT NULL, `nama` varchar(100) DEFAULT NULL, `jurusan` varchar(100) DEFAULT NULL, PRIMARY KEY (`id_mahasiswa`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1; /*Data for the table `mahasiswa` */ insert into `mahasiswa`(`id_mahasiswa`,`nim`,`nama`,`jurusan`) values (6,'465646','Sofyan Gibran','Sistem Informasi'), (7,'155410037','Abdul Hamid','Teknik Informatika'), (8,'3453453','Putri Ayu','Sistem Informasi'), (9,'78567','asrfaf edit','Teknik Komputer'); /*Table structure for table `matakuliah` */ DROP TABLE IF EXISTS `matakuliah`; CREATE TABLE `matakuliah` ( `id_matakuliah` int(11) NOT NULL AUTO_INCREMENT, `matakuliah` varchar(100) DEFAULT NULL, `sks` int(1) DEFAULT NULL, PRIMARY KEY (`id_matakuliah`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; /*Data for the table `matakuliah` */ insert into `matakuliah`(`id_matakuliah`,`matakuliah`,`sks`) values (1,'Manajemen Basis Data',2), (2,'Analisis Desain Berorirentasi Objek',3), (3,'Pemrograman Web',3), (4,'Pemrograman Mobile',3); /*Table structure for table `user` */ DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(50) DEFAULT NULL, `email` varchar(100) DEFAULT NULL, `password` varchar(100) DEFAULT NULL, `role` int(11) DEFAULT NULL, `tanggal_daftar` date DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; /*Data for the table `user` */ insert into `user`(`id`,`username`,`email`,`password`,`role`,`tanggal_daftar`) values (1,'hamid','hamid@gmail.com','37fff357c237d67f2365eab6706bc898',2,'2020-08-19'), (2,'hamid','abdul@gmail.com','37fff357c237d67f2365eab6706bc898',2,'2020-08-19'); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
SELECT * FROM applications ORDER BY app_id DESC
-- MySQL dump 10.13 Distrib 5.5.44, for osx10.11 (x86_64) -- -- Host: 104.236.181.79 Database: memories -- ------------------------------------------------------ -- Server version 5.5.49-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 `chats` -- DROP TABLE IF EXISTS `chats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `chats` ( `id` int(8) NOT NULL PRIMARY KEY AUTO_INCREMENT, `owner_name` varchar(50) DEFAULT NULL, `receiver_id` int(8) DEFAULT NULL, `is_group_chat` tinyint(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `chats` -- LOCK TABLES `chats` WRITE; /*!40000 ALTER TABLE `chats` DISABLE KEYS */; /*!40000 ALTER TABLE `chats` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `messages` -- DROP TABLE IF EXISTS `messages`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `messages` ( `id` int(8) NOT NULL PRIMARY KEY AUTO_INCREMENT, `timestamp` datetime DEFAULT NULL, `chat_id` int(8) DEFAULT NULL, `sender` varchar(50) DEFAULT NULL, `receiver_id` int(8) DEFAULT NULL, `content` text, `type` int(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `messages` -- LOCK TABLES `messages` WRITE; /*!40000 ALTER TABLE `messages` DISABLE KEYS */; /*!40000 ALTER TABLE `messages` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `users` -- DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `users` ( `id` int(8) NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` varchar(50) DEFAULT NULL, `email` varchar(50) DEFAULT NULL, `password` varchar(50) DEFAULT NULL, `openid` varchar(50) DEFAULT NULL, `status` int(1) DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users` -- LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; /*!40000 ALTER TABLE `users` 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 */; DROP TABLE IF EXISTS `attachments`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `attachments` ( `id` int(8) NOT NULL PRIMARY KEY AUTO_INCREMENT, `chat_id` int(8) DEFAULT NULL, `file_name` varchar(50) DEFAULT NULL, `path` text DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users` -- LOCK TABLES `attachements` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; /*!40000 ALTER TABLE `users` 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 2016-05-08 23:19:52
-- Assigment 2 DBS301 DROP TABLE PropertyClient; DROP TABLE Property; DROP TABLE Client; DROP TABLE School; DROP TABLE Area; CREATE TABLE Property ( propertyID NUMBER(10) PRIMARY KEY, street VARCHAR2(38), city VARCHAR2(38), state VARCHAR2(38), postal VARCHAR2(7), beds NUMBER(2), baths NUMBER(2), listPrice NUMBER(5, 2), sellPrice NUMBER(5, 2), agency VARCHAR2(38), areaID NUMBER(10), CONSTRAINT property_areaid_fk FOREIGN KEY (areaID) REFERENCES Area(areaID) ); CREATE TABLE Client ( clientID NUMBER(10) PRIMARY KEY, fName VARCHAR2(38), lName VARCHAR2(38), phone VARCHAR2(38), email VARCHAR2(38), percentOwnership NUMBER(3, 2) ); CREATE TABLE PropertyClient ( propertyID NUMBER(10), clientBuyerID NUMBER(10), clientSellerID NUMBER(10), CONSTRAINT propertyID_FK FOREIGN KEY (propertyID) REFERENCES Property(propertyID), CONSTRAINT clientBuyerID_FK FOREIGN KEY (clientBuyerID) REFERENCES Client(clientID), CONSTRAINT pc_clientSellerID_FK FOREIGN KEY (clientSellerID) REFERENCES Client(clientID), PRIMARY KEY(propertyID, clientBuyerID, clientSellerID) ); CREATE TABLE Area ( areaID NUMBER(10) PRIMARY KEY, areaName VARCHAR2(38), areaComments VARCHAR2(38) ); CREATE TABLE School ( schoolID NUMBER(10) PRIMARY KEY, schoolName VARCHAR2(38), schoolLevel VARCHAR2(38), area NUMBER(10), CONSTRAINT school_area_fk FOREIGN KEY (area) REFERENCES Area(areaID) );
--Delete database if exists and create new-- DROP DATABASE IF EXISTS employee_db; CREATE DATABASE employee_db; --Use this database-- USE employee_db; --Delete table if exists and create table with two parameters id and department_name and primary key id-- DROP TABLE IF EXISTS department; CREATE TABLE department ( id INT AUTO_INCREMENT NOT NULL, department_name VARCHAR(30) NOT NULL, PRIMARY KEY (id) ); --Delete table if exists and create table with four parameters id, title, salary, department_id-- --Primary key is id-- --Foreign key is department_id using the id from department table-- DROP TABLE IF EXISTS job_role; CREATE TABLE job_role ( id INT NOT NULL AUTO_INCREMENT, title VARCHAR(30) NOT NULL, salary DECIMAL NOT NULL, department_id INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (department_id) REFERENCES department (id) ); --Delete table if exists and create table with five parameters id, first_name, last_name, job_role_id, and manager_id-- --Primary key is id-- --Foreign keys are both the job_role_id using the id from the job_role table and manager_id DROP TABLE IF EXISTS employee; CREATE TABLE employee( id INT NOT NULL AUTO_INCREMENT, first_name VARCHAR(30) NOT NULL, last_name VARCHAR(30) NOT NULL, job_role_id INT NOT NULL, manager_id INT, PRIMARY KEY (id), FOREIGN KEY (job_role_id) REFERENCES job_role(id), FOREIGN KEY (manager_id) REFERENCES employee(id) );
select * from product where vendorID = 1 and price > 50; select * from vendor v join product p on p.vendorID = v.ID;
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `Postmsg` -- ---------------------------- DROP TABLE IF EXISTS `Postmsg`; CREATE TABLE `Postmsg` ( `ID` int(10) unsigned NOT NULL, `content` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `imagePaths` varchar(500) DEFAULT NULL, `NewsType` tinyint(4) NOT NULL, `NewsSubType` tinyint(4) DEFAULT NULL, `PostDate` datetime DEFAULT NULL, `LocationCode` int(8) DEFAULT NULL, `isHot` tinyint(4) DEFAULT NULL, `isValid` tinyint(1) NOT NULL DEFAULT '1', `UpdateAt` datetime DEFAULT NULL, `UpdateBy` varchar(45) DEFAULT NULL, `publisherId` int(10) unsigned NOT NULL, PRIMARY KEY (`ID`), KEY `PT_IDX_LOCATION` (`LocationCode`,`isValid`), KEY `PT_IDX_TYPE_SUBTYPE_locate` (`NewsType`,`NewsSubType`,`LocationCode`,`isValid`), KEY `PT_IDX_TYPE_LOCATION` (`NewsType`,`LocationCode`,`isValid`), KEY `PT_IDX_PostDate` (`PostDate`,`isValid`), KEY `PT_IDX_PublishID` (`publisherId`), CONSTRAINT `PT_FK_PublishID` FOREIGN KEY (`publisherId`) REFERENCES `User` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postmsg info'
ALTER DATABASE jwtspringsecurity_db SET timezone TO 'UTC'; REVOKE USAGE ON SCHEMA public FROM PUBLIC; REVOKE CREATE ON SCHEMA public FROM PUBLIC; GRANT USAGE ON SCHEMA public to jwtspringsecurity_admin; GRANT CREATE ON SCHEMA public to jwtspringsecurity_admin;
../../../config/db/nm_log.sql
CREATE PROCEDURE SP_ADDPRODUCT @NAME AS NVARCHAR(100), @DESCRİPTİON AS NVARCHAR(100), @IMAGE AS NVARCHAR(50), @PRICE AS INT, @STOCK AS INT, @ISHOME AS INT, @ISAPPROVED AS INT, @CATEGORYID AS INT AS INSERT INTO Product ( [Name], [Description], [Image], [Price], [Stock], [IsHome], [IsApproved], [CategoryId]) VALUES (@NAME,@DESCRİPTİON,@IMAGE,@PRICE,@STOCK,@ISHOME,@ISAPPROVED,@CATEGORYID)
BEGIN TRANSACTION; CREATE TABLE Avatars ( PrincipalID CHAR(36) NOT NULL, Name VARCHAR(32) NOT NULL, Value VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY(PrincipalID, Name)); COMMIT;
-- MySQL dump 10.13 Distrib 5.7.9, for Win32 (AMD64) -- -- Host: localhost Database: cars_hibernate -- ------------------------------------------------------ -- Server version 5.6.31-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 `body_type` -- DROP TABLE IF EXISTS `body_type`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `body_type` ( `BODY_TYPE_ID` int(11) NOT NULL AUTO_INCREMENT, `BODY_NAME` varchar(70) DEFAULT NULL, PRIMARY KEY (`BODY_TYPE_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `body_type` -- LOCK TABLES `body_type` WRITE; /*!40000 ALTER TABLE `body_type` DISABLE KEYS */; INSERT INTO `body_type` VALUES (1,'SEDAN'),(2,'CUPE'),(3,'SUV'),(4,'MINIVAN'),(5,'WAGON'),(6,'JEEP'); /*!40000 ALTER TABLE `body_type` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `brands` -- DROP TABLE IF EXISTS `brands`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `brands` ( `BRAND_ID` int(11) NOT NULL AUTO_INCREMENT, `BRAND_NAME` varchar(80) DEFAULT NULL, PRIMARY KEY (`BRAND_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `brands` -- LOCK TABLES `brands` WRITE; /*!40000 ALTER TABLE `brands` DISABLE KEYS */; INSERT INTO `brands` VALUES (1,'AUDI'),(2,'ACURA'),(3,'BMW'),(4,'DODGE'),(5,'FORD'),(6,'HONDA'),(7,'INFINITY'),(8,'LEXUS'),(9,'MAZDA'),(10,'MERCEDES'),(11,'NISSAN'),(12,'OPEL'),(13,'PORSCHE'),(14,'SKODA'); /*!40000 ALTER TABLE `brands` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cars` -- DROP TABLE IF EXISTS `cars`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cars` ( `CAR_ID` int(11) NOT NULL AUTO_INCREMENT, `BRAND_ID` int(11) NOT NULL, `MODEL` varchar(80) NOT NULL, `BODY_TYPE_ID` int(11) NOT NULL, `ENGINE_TYPE_ID` int(11) NOT NULL, `TRANSMISSION_TYPE_ID` int(11) NOT NULL, `YEAR_OF_MANUFACTURE` int(11) NOT NULL, `STATUS_ID` int(11) NOT NULL, `AMOUNT` double NOT NULL, PRIMARY KEY (`CAR_ID`), KEY `BRAND_idx` (`BRAND_ID`), KEY `BODY_TYPE_idx` (`BODY_TYPE_ID`), KEY `ENGINE_TYPE_idx` (`ENGINE_TYPE_ID`), KEY `TRANSMISSION_TYPE_idx` (`TRANSMISSION_TYPE_ID`), KEY `STATUS_idx` (`STATUS_ID`), CONSTRAINT `BODY_TYPE_ID` FOREIGN KEY (`BODY_TYPE_ID`) REFERENCES `body_type` (`BODY_TYPE_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `BRAND_ID` FOREIGN KEY (`BRAND_ID`) REFERENCES `brands` (`BRAND_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `ENGINE_TYPE_ID` FOREIGN KEY (`ENGINE_TYPE_ID`) REFERENCES `engine_type` (`ENGINE_TYPE_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `STATUS_D` FOREIGN KEY (`STATUS_ID`) REFERENCES `status_of_car` (`STATUS_OF_CAR_ID`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `TRANSMISSION_TYPE_D` FOREIGN KEY (`TRANSMISSION_TYPE_ID`) REFERENCES `transmission_type` (`TRANSMISSION_TYPE_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cars` -- LOCK TABLES `cars` WRITE; /*!40000 ALTER TABLE `cars` DISABLE KEYS */; INSERT INTO `cars` VALUES (1,1,'A4',1,1,1,2000,1,30),(5,3,'5',1,1,1,2016,1,5),(6,2,'RDX',3,2,2,2012,1,35),(7,3,'X5',3,2,2,2013,2,35),(8,1,'A8',1,1,2,2010,2,40),(9,1,'A6',1,2,3,2015,2,45),(10,3,'760',1,2,2,2012,2,45),(11,4,'CARAVAN',4,2,2,2010,2,20),(12,5,'MONDEO',5,1,1,2014,2,30),(13,6,'ACCORD',1,2,2,2012,2,30),(14,7,'FX45',3,2,2,2010,2,35),(15,8,'LX500',6,2,2,2011,2,60),(16,9,'6',1,1,1,2014,2,35),(17,10,'E350',1,1,2,2015,2,45),(18,10,'ML350',3,1,2,2010,2,40),(19,12,'VECTRA',5,1,1,2013,2,25),(20,13,'CAYENE',3,4,2,2011,2,50),(21,3,'335',2,2,2,2014,2,35),(22,7,'G35',2,2,1,2011,2,30),(23,8,'RX450',3,2,2,2014,2,50),(24,11,'ALMERA',1,1,1,2012,2,30); /*!40000 ALTER TABLE `cars` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `clients` -- DROP TABLE IF EXISTS `clients`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clients` ( `CLIENT_ID` int(11) NOT NULL AUTO_INCREMENT, `NAME` varchar(45) NOT NULL, `SURNAME` varchar(45) NOT NULL, `PHONE` varchar(45) NOT NULL, `MAIL` varchar(60) NOT NULL, `PASSPORT_NUMBER_ID` int(11) DEFAULT NULL, `PASSWORD` varchar(45) NOT NULL, `STATUS_ID` int(11) DEFAULT NULL, `ROLE_ID` int(11) DEFAULT NULL, PRIMARY KEY (`CLIENT_ID`), KEY `PASSPORT_NUMBER_idx` (`PASSPORT_NUMBER_ID`), KEY `STATUS_ID_idx` (`STATUS_ID`), KEY `ROLE_ID_idx` (`ROLE_ID`), CONSTRAINT `PASSPORT_NUMBER_ID` FOREIGN KEY (`PASSPORT_NUMBER_ID`) REFERENCES `passports` (`PASSPORT_NUMBER_ID`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ROLE_ID` FOREIGN KEY (`ROLE_ID`) REFERENCES `roles` (`ROLE_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `STATUS_ID` FOREIGN KEY (`STATUS_ID`) REFERENCES `status_of_client` (`STATUS_ID`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clients` -- LOCK TABLES `clients` WRITE; /*!40000 ALTER TABLE `clients` DISABLE KEYS */; INSERT INTO `clients` VALUES (1,'Vania','Ivanow','+375291234567','vanu@mail.ru',1,'1234',1,1),(2,'Sergey','Smirnof','+3574554444444','admin@mail.ru',2,'1234',1,2),(3,'Петя','Сергеев','+375295558869','petr@mail.ru',3,'1234',1,1),(4,'Денис','Васерман','+375291154874','denis@mail.ru',4,'1234',1,1); /*!40000 ALTER TABLE `clients` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `engine_type` -- DROP TABLE IF EXISTS `engine_type`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `engine_type` ( `ENGINE_TYPE_ID` int(11) NOT NULL AUTO_INCREMENT, `ENGINE_NAME` varchar(45) DEFAULT NULL, PRIMARY KEY (`ENGINE_TYPE_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `engine_type` -- LOCK TABLES `engine_type` WRITE; /*!40000 ALTER TABLE `engine_type` DISABLE KEYS */; INSERT INTO `engine_type` VALUES (1,'DIESEL'),(2,'GASOLINE'),(3,'ELECTRICITY'),(4,'GASOLINE\\ELECTRICITY'); /*!40000 ALTER TABLE `engine_type` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `orders` -- DROP TABLE IF EXISTS `orders`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `orders` ( `ORDER_ID` bigint(8) NOT NULL AUTO_INCREMENT, `CLIENT_ID` int(11) NOT NULL, `CAR_ID` int(11) NOT NULL, `START_DATE` date NOT NULL, `END_DATE` date NOT NULL, `MESSAGE` text, `STATUS_OF_ORDER` int(11) DEFAULT NULL, `AMOUNT` bigint(11) DEFAULT NULL, PRIMARY KEY (`ORDER_ID`), KEY `CAR_ID_idx` (`CAR_ID`), KEY `CLIENT_ID_idx` (`CLIENT_ID`), KEY `STATUS_idx` (`STATUS_OF_ORDER`), CONSTRAINT `CAR` FOREIGN KEY (`CAR_ID`) REFERENCES `cars` (`CAR_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `CLIENT` FOREIGN KEY (`CLIENT_ID`) REFERENCES `clients` (`CLIENT_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `STATUS_OF_ORDER` FOREIGN KEY (`STATUS_OF_ORDER`) REFERENCES `status_of_order` (`STATUS_ID`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `orders` -- LOCK TABLES `orders` WRITE; /*!40000 ALTER TABLE `orders` DISABLE KEYS */; INSERT INTO `orders` VALUES (12,1,16,'2016-09-08','2016-09-12','',5,20),(14,1,11,'2016-09-08','2016-09-20','Необходим навигатор',5,30),(15,1,12,'2016-09-09','2016-09-10','Необходим навигатор',5,40),(16,1,23,'2016-09-19','2016-09-20','Необходим навигатор',5,50),(17,1,20,'2016-09-19','2016-09-20','Необходим навигатор',5,50),(18,1,18,'2016-09-21','2016-09-22','Необходим навигатор',5,40),(19,1,15,'2016-09-19','2016-09-21','Необходим навигатор',5,120),(20,1,14,'2016-09-22','2016-09-23','Необходим навигатор',5,35),(21,1,13,'2016-09-20','2016-09-23','Необходим навигатор',5,90); /*!40000 ALTER TABLE `orders` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `passports` -- DROP TABLE IF EXISTS `passports`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `passports` ( `PASSPORT_NUMBER_ID` int(11) NOT NULL AUTO_INCREMENT, `PASSPORTS_NUMBER` varchar(45) DEFAULT NULL, `DATE_OF_ISSUE` date DEFAULT NULL, `DATE_OF_END` date DEFAULT NULL, PRIMARY KEY (`PASSPORT_NUMBER_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `passports` -- LOCK TABLES `passports` WRITE; /*!40000 ALTER TABLE `passports` DISABLE KEYS */; INSERT INTO `passports` VALUES (1,'fffffff','2014-09-04','2019-09-19'),(2,'MP2345678','2014-09-17','2020-09-11'),(3,'HH 2233445','2015-08-03','2019-08-09'),(4,'HH 88463524','2012-08-13','2020-08-06'),(5,'yuiyiyiyi','2016-09-07','2016-09-09'),(6,'рапрапрар','2016-09-22','2016-09-02'),(7,'sdfsdsdsf','2016-09-15','2016-09-23'); /*!40000 ALTER TABLE `passports` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `roles` -- DROP TABLE IF EXISTS `roles`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `roles` ( `ROLE_ID` int(11) NOT NULL AUTO_INCREMENT, `NAME` varchar(45) NOT NULL, PRIMARY KEY (`ROLE_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `roles` -- LOCK TABLES `roles` WRITE; /*!40000 ALTER TABLE `roles` DISABLE KEYS */; INSERT INTO `roles` VALUES (1,'USER'),(2,'ADMIN'); /*!40000 ALTER TABLE `roles` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `status_of_car` -- DROP TABLE IF EXISTS `status_of_car`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `status_of_car` ( `STATUS_OF_CAR_ID` int(11) NOT NULL AUTO_INCREMENT, `STATUS_NAME` varchar(70) DEFAULT NULL, PRIMARY KEY (`STATUS_OF_CAR_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `status_of_car` -- LOCK TABLES `status_of_car` WRITE; /*!40000 ALTER TABLE `status_of_car` DISABLE KEYS */; INSERT INTO `status_of_car` VALUES (1,'BROKEN'),(2,'WORKING'); /*!40000 ALTER TABLE `status_of_car` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `status_of_client` -- DROP TABLE IF EXISTS `status_of_client`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `status_of_client` ( `STATUS_ID` int(11) NOT NULL AUTO_INCREMENT, `NAME_OF_STATUS` varchar(45) NOT NULL, PRIMARY KEY (`STATUS_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `status_of_client` -- LOCK TABLES `status_of_client` WRITE; /*!40000 ALTER TABLE `status_of_client` DISABLE KEYS */; INSERT INTO `status_of_client` VALUES (1,'CREATED'),(2,'DELETED'); /*!40000 ALTER TABLE `status_of_client` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `status_of_order` -- DROP TABLE IF EXISTS `status_of_order`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `status_of_order` ( `STATUS_ID` int(11) NOT NULL, `STATUS_NAME` varchar(60) DEFAULT NULL, PRIMARY KEY (`STATUS_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `status_of_order` -- LOCK TABLES `status_of_order` WRITE; /*!40000 ALTER TABLE `status_of_order` DISABLE KEYS */; INSERT INTO `status_of_order` VALUES (1,'ПРИНЯТ'),(2,'В ОБРАБОТКЕ'),(3,'ОБРАБОТАН'),(4,'ОТКЛОНЕН'),(5,'ЗАВЕРШЕН'); /*!40000 ALTER TABLE `status_of_order` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `transmission_type` -- DROP TABLE IF EXISTS `transmission_type`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `transmission_type` ( `TRANSMISSION_TYPE_ID` int(11) NOT NULL AUTO_INCREMENT, `TRANSMISSION_NAME` varchar(80) DEFAULT NULL, PRIMARY KEY (`TRANSMISSION_TYPE_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `transmission_type` -- LOCK TABLES `transmission_type` WRITE; /*!40000 ALTER TABLE `transmission_type` DISABLE KEYS */; INSERT INTO `transmission_type` VALUES (1,'MANUAL'),(2,'AUTOMATE'),(3,'TIPTRONIC'); /*!40000 ALTER TABLE `transmission_type` ENABLE KEYS */; UNLOCK TABLES; -- -- Dumping routines for database 'cars_hibernate' -- /*!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 2016-09-28 13:40:43
UPDATE bpk_account_credit_detail SET ordered_by_service_point = bpkget_service_description(verify_spid) WHERE fix_visit_type_id='1' AND financial_discharge_date BETWEEN '$P!{FromDate}' AND '$P!{FromDate}'
# patch_49_50_b.sql # # title: change defaults in coord_system # # description: # Make version column in coord_system default to null ALTER TABLE coord_system CHANGE COLUMN version version VARCHAR(40) DEFAULT NULL; # patch identifier INSERT INTO meta (meta_key, meta_value) VALUES ('patch', 'patch_49_50_b.sql|coord_system_version_default');
SELECT B.Name AS Employee FROM Employee AS A, Employee AS B WHERE B.ManagerId = A.Id AND A.Salary < B.Salary;
Create Procedure mERP_sp_Update_LeanErrorStatus(@REC_ID Int,@ErrorMsg nVarchar(510)) As Begin Insert Into tbl_mERP_RecdErrMessages( TransactionType, ErrMessage, KeyValue, ProcessDate) Values('LEAN_INVT', @ErrorMsg, 'Received LEAN_INVT ID - ' + Cast(@REC_ID as nVarchar(10)) ,GetDate()) Update Recd_OCG Set Status = 64 Where ID = @REC_ID and Isnull(Status ,0) = 0 End
-- phpMyAdmin SQL Dump -- version 4.1.12 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jun 02, 2018 at 05:26 PM -- Server version: 5.6.16 -- PHP Version: 5.5.11 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: `ictresult` -- -- -------------------------------------------------------- -- -- Table structure for table `tbatch` -- CREATE TABLE IF NOT EXISTS `tbatch` ( `auto_id` int(11) NOT NULL AUTO_INCREMENT, `session` varchar(100) NOT NULL, `batchno` varchar(20) NOT NULL, `exam` varchar(50) NOT NULL, `Creationdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `UpdationDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, `user_name` varchar(100) NOT NULL, `year` varchar(20) DEFAULT NULL, `semester` varchar(20) DEFAULT NULL, PRIMARY KEY (`auto_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=49 ; -- -- Dumping data for table `tbatch` -- INSERT INTO `tbatch` (`auto_id`, `session`, `batchno`, `exam`, `Creationdate`, `UpdationDate`, `user_name`, `year`, `semester`) VALUES (44, '2013-2014', '11 th Batch', 'Undergraduate', '2018-05-31 16:42:01', '2018-06-02 15:16:29', '', '', ''), (45, '2014-2015', '12 th Batch', 'Undergraduate', '2018-06-01 07:54:08', '2018-06-01 16:50:11', '', '', ''), (46, '2015-2016', '13 th Batch', 'Undergraduate', '2018-06-01 07:54:21', '2018-06-01 09:58:18', '', '', ''), (47, '2016-2017', '14 th Batch', 'Undergraduate', '2018-06-01 07:54:50', '0000-00-00 00:00:00', '', '', ''); /*!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 OR REPLACE VIEW rv_pp_order AS SELECT o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby, o.updated, o.updatedby, o.pp_order_id, o.documentno, o.docstatus, o.m_warehouse_id, o.m_product_id, o.qtyentered, o.qtyreject, o.qtyscrap, o.qtybatchs, o.qtybatchsize, o.dateordered, o.datepromised, o.datestart, o.datestartschedule, o.datefinish, o.datefinishschedule, o.dateconfirm, o.datedelivered, o.lot, o.pp_product_bom_id, o.ad_workflow_id, ( SELECT p.weight FROM m_product p WHERE p.m_product_id = o.m_product_id) AS weight, o.c_doctypetarget_id, o.m_attributesetinstance_id, o.planner_id, o.priorityrule, o.ad_orgtrx_id, o.user1_id, o.user2_id, o.c_doctype_id, o.line, o.description, o.s_resource_id, o.floatbefored, o.floatafter, o.c_uom_id, o.qtyordered, o.qtydelivered, o.yield, o.c_project_id, o.c_campaign_id, o.c_activity_id, o.isapproved, o.isprinted, o.isselected, o.processed, o.assay, o.isqtypercentage, o.ordertype, o.issotrx, o.scheduletype, o.serno FROM pp_order o;
-- Constraint: ads_pk -- ALTER TABLE ads DROP CONSTRAINT ads_pk; ALTER TABLE ads ADD CONSTRAINT ads_pk PRIMARY KEY(id); -- Constraint: campaign_pk -- ALTER TABLE campaign DROP CONSTRAINT campaign_pk; ALTER TABLE campaign ADD CONSTRAINT campaign_pk PRIMARY KEY(id);
# ************************************************************ # Sequel Pro SQL dump # Version 4499 # # http://www.sequelpro.com/ # https://github.com/sequelpro/sequelpro # # Host: 127.0.0.1 (MySQL 5.5.46-0+deb7u1-log) # Database: fb # Generation Time: 2016-01-23 01:14:48 +0000 # ************************************************************ /*!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 */; /*!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 */; # Dump of table collection # ------------------------------------------------------------ DROP TABLE IF EXISTS `collection`; CREATE TABLE `collection` ( `collection_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `label` varchar(1000) DEFAULT NULL, `class` varchar(255) DEFAULT NULL, `template` varchar(255) DEFAULT NULL, `type` varchar(255) DEFAULT NULL, `is_required` tinyint(1) unsigned NOT NULL DEFAULT '0', `name` varchar(255) DEFAULT NULL, `is_autofilled` tinyint(1) unsigned DEFAULT NULL, PRIMARY KEY (`collection_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; # Dump of table collection_element # ------------------------------------------------------------ DROP TABLE IF EXISTS `collection_element`; CREATE TABLE `collection_element` ( `collection` int(11) unsigned DEFAULT NULL, `element` int(11) unsigned DEFAULT NULL, `sort_order` int(11) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; # Dump of table element # ------------------------------------------------------------ DROP TABLE IF EXISTS `element`; CREATE TABLE `element` ( `element_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `label` varchar(1000) DEFAULT NULL, `class` varchar(255) DEFAULT NULL, `type` varchar(255) DEFAULT NULL, `value` text, `template` varchar(255) DEFAULT NULL, `itemset` int(11) unsigned DEFAULT NULL, `is_required` tinyint(1) unsigned NOT NULL DEFAULT '0', `name` varchar(255) DEFAULT NULL, `is_required_in_collection` int(1) unsigned DEFAULT '0', `is_autofilled` tinyint(1) unsigned DEFAULT NULL, PRIMARY KEY (`element_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; # Dump of table form # ------------------------------------------------------------ DROP TABLE IF EXISTS `form`; CREATE TABLE `form` ( `form_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `path` varchar(500) DEFAULT '', `name` varchar(255) DEFAULT NULL, `description` text, `is_live` tinyint(1) unsigned DEFAULT NULL, `template` varchar(255) DEFAULT NULL, `css` varchar(255) DEFAULT NULL, `templates_path` varchar(255) DEFAULT NULL, `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `theme` varchar(255) DEFAULT NULL, `confirmation_method` varchar(255) DEFAULT NULL, `confirmation_text` varchar(10240) DEFAULT NULL, `confirmation_url` varchar(255) DEFAULT NULL, `confirmation_email` varchar(255) DEFAULT NULL, `submission_method` varchar(255) DEFAULT NULL, `submission_email` varchar(512) DEFAULT NULL, `submission_email_csv` tinyint(1) unsigned DEFAULT NULL, `creator` char(8) DEFAULT NULL, `is_deleted` int(1) unsigned zerofill NOT NULL DEFAULT '0', `date_deleted` datetime DEFAULT NULL, `deleted_by` varchar(255) DEFAULT NULL, `last_submission_date` datetime DEFAULT NULL, `url` varchar(500) DEFAULT NULL, `total_submissions` int(11) unsigned NOT NULL DEFAULT '0', `has_submission_database` int(1) unsigned DEFAULT '0', `total_database_submissions` int(11) unsigned DEFAULT '0', `submission_email_subject` varchar(255) DEFAULT NULL, `submission_email_sender` varchar(255) DEFAULT NULL, `can_be_continued` int(1) unsigned DEFAULT NULL, `confirm_before_submit` int(1) unsigned DEFAULT NULL, PRIMARY KEY (`form_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; # Dump of table item # ------------------------------------------------------------ DROP TABLE IF EXISTS `item`; CREATE TABLE `item` ( `item_id` int(11) unsigned NOT NULL auto_increment, `label` varchar(255) default NULL, `value` varchar(255) default NULL, `itemset_id` int(11) unsigned default NULL, `sort_order` int(11) unsigned default NULL, PRIMARY KEY (`item_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; # Dump of table itemset # ------------------------------------------------------------ DROP TABLE IF EXISTS `itemset`; CREATE TABLE `itemset` ( `itemset_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `label` varchar(1000) DEFAULT NULL, `is_custom` tinyint(1) unsigned DEFAULT NULL, PRIMARY KEY (`itemset_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; # Dump of table node # ------------------------------------------------------------ DROP TABLE IF EXISTS `node`; CREATE TABLE `node` ( `node_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `form_id` int(11) unsigned DEFAULT NULL, `node_type` varchar(255) DEFAULT NULL, `sort_order` int(11) unsigned DEFAULT NULL, `element_id` int(11) unsigned DEFAULT NULL, PRIMARY KEY (`node_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; # Dump of table user # ------------------------------------------------------------ DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `user_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `identifier` varchar(255) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `max_forms` int(4) DEFAULT NULL, `is_active` tinyint(4) unsigned NOT NULL DEFAULT '1', `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`), UNIQUE KEY `unique_identifier` (`identifier`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; # Dump of table user_form # ------------------------------------------------------------ DROP TABLE IF EXISTS `user_form`; CREATE TABLE `user_form` ( `form` int(11) unsigned NOT NULL DEFAULT '0', `role` varchar(255) DEFAULT NULL, `user` int(11) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`form`,`user`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_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 */;
update alm_defeitos set alm_defeitos.Aging = Aux.Aging from ( select Subprojeto, Entrega, Defeito, round( cast( Sum(Tempo_Util) as float) / 60 ,2) as Aging from ALM_Defeitos_Tempos dt WITH (NOLOCK) group by Subprojeto, Entrega, Defeito ) Aux where alm_defeitos.Subprojeto = Aux.Subprojeto and alm_defeitos.Entrega = Aux.Entrega and alm_defeitos.Defeito = Aux.Defeito and (alm_defeitos.Aging is null or alm_defeitos.Aging <> Aux.Aging)
-- AlterTable ALTER TABLE "Student" ADD COLUMN "creditDone" INTEGER NOT NULL DEFAULT 0;
/* Navicat Premium Data Transfer Source Server : mysql Source Server Type : MySQL Source Server Version : 80013 Source Host : localhost:3306 Source Schema : ewsdb Target Server Type : MySQL Target Server Version : 80013 File Encoding : 65001 Date: 21/05/2019 17:26:14 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for tb_user -- ---------------------------- DROP TABLE IF EXISTS `tb_user`; CREATE TABLE `tb_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `upwd` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `email` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `role` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `registerTime` date NULL DEFAULT NULL, `lastLoginTime` date NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of tb_user -- ---------------------------- INSERT INTO `tb_user` VALUES (1, 'laozhang', '96e79218965eb72c92a549dd5a330112', 'abc@163.com', 'admin', '2019-05-21', '2019-05-21'); INSERT INTO `tb_user` VALUES (2, 'lisi', 'e10adc3949ba59abbe56e057f20f883e', 'lisi@163.com', 'employee', '2019-05-21', '2019-05-21'); INSERT INTO `tb_user` VALUES (3, 'wangwu', '96e79218965eb72c92a549dd5a330112', 'wangwu@163.com', 'employee', '2019-05-21', '2019-05-21'); SET FOREIGN_KEY_CHECKS = 1;
--- https://sourceforge.net/tracker/index.php?func=detail&aid=2791095&group_id=176962&atid=879332 --- increase size of pw field to cater for encrypted passwords ALTER TABLE ad_user ALTER COLUMN emailuserpw TYPE varchar(255) ;
CREATE PROC usp_EmployeesBySalaryLevel (@salaryLevel VARCHAR(10)) AS SELECT FirstName, LastName FROM Employees WHERE dbo.ufn_GetSalaryLevel(Salary)=@salaryLevel
/** * Database schema relations required by MetrolyricsModule. * * @author Anastaszor * @link https://github.com/yii1-modules/yii1-music-metrolyrics * @license 2016-X MIT */ ALTER TABLE `metrolyrics_album` ADD CONSTRAINT `fk_metrolyrics_album_metrolyrics_artist` FOREIGN KEY (`metrolyrics_artist_id`) REFERENCES `metrolyrics_artist`(`metrolyrics_artist_id`) ON DELETE RESTRICT ON UPDATE CASCADE; ALTER TABLE `metrolyrics_artist` ADD CONSTRAINT `fk_metrolyrics_artist_metrolyrics_genre` FOREIGN KEY (`metrolyrics_genre_id`) REFERENCES `metrolyrics_genre`(`metrolyrics_genre_id`) ON DELETE RESTRICT ON UPDATE CASCADE; ALTER TABLE `metrolyrics_photo` ADD CONSTRAINT `fk_metrolyrics_photo_metrolyrics_artist` FOREIGN KEY (`metrolyrics_artist_id`) REFERENCES `metrolyrics_artist`(`metrolyrics_artist_id`) ON DELETE RESTRICT ON UPDATE CASCADE; ALTER TABLE `metrolyrics_album_rel_song` ADD CONSTRAINT `fk_metrolyrics_album_rel_song` FOREIGN KEY (`metrolyrics_album_id`) REFERENCES `metrolyrics_album`(`metrolyrics_album_id`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `metrolyrics_album_rel_song` ADD CONSTRAINT `fk_metrolyrics_song_rel_album` FOREIGN KEY (`metrolyrics_song_id`) REFERENCES `metrolyrics_song`(`metrolyrics_song_id`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `metrolyrics_song_rel_publisher` ADD CONSTRAINT `fk_metrolyrics_publisher_rel_song` FOREIGN KEY (`metrolyrics_song_id`) REFERENCES `metrolyrics_song`(`metrolyrics_song_id`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `metrolyrics_song_rel_publisher` ADD CONSTRAINT `fk_metrolyrics_song_rel_publisher` FOREIGN KEY (`metrolyrics_publisher_id`) REFERENCES `metrolyrics_publisher`(`metrolyrics_publisher_id`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `metrolyrics_song_rel_writer` ADD CONSTRAINT `fk_metrolyrics_writer_rel_song` FOREIGN KEY (`metrolyrics_song_id`) REFERENCES `metrolyrics_song`(`metrolyrics_song_id`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `metrolyrics_song_rel_writer` ADD CONSTRAINT `fk_metrolyrics_song_rel_writer` FOREIGN KEY (`metrolyrics_writer_id`) REFERENCES `metrolyrics_writer`(`metrolyrics_writer_id`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `metrolyrics_video` ADD CONSTRAINT `fk_metrolyrics_video_metrolyrics_artist` FOREIGN KEY (`metrolyrics_artist_id`) REFERENCES `metrolyrics_artist`(`metrolyrics_artist_id`) ON DELETE RESTRICT ON UPDATE CASCADE; ALTER TABLE `metrolyrics_video` ADD CONSTRAINT `fk_metrolyrics_video_metrolyrics_video_type` FOREIGN KEY (`metrolyrics_video_type_id`) REFERENCES `metrolyrics_video_type`(`metrolyrics_video_type_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- phpMyAdmin SQL Dump -- version 4.8.1 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 15-05-2019 a las 06:03:52 -- Versión del servidor: 10.1.33-MariaDB -- Versión de PHP: 7.2.6 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 */; -- -- Base de datos: `webservice_aj` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cabeza` -- CREATE TABLE `cabeza` ( `id_palabra_cabeza` int(15) NOT NULL, `palabra` varchar(15) NOT NULL, `traduccion` varchar(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `cabeza` -- INSERT INTO `cabeza` (`id_palabra_cabeza`, `palabra`, `traduccion`) VALUES (1, 'nbhjkh', 'vdvcxxvc'), (2, 'cxvcvc', 'vcxcvx'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `clientes` -- CREATE TABLE `clientes` ( `id_cliente` int(11) NOT NULL, `nombre` varchar(30) NOT NULL, `apellido_pa` varchar(30) NOT NULL, `apellido_ma` varchar(30) NOT NULL, `telefono` varchar(30) NOT NULL, `email` varchar(50) NOT NULL, `utl` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `clientes` -- INSERT INTO `clientes` (`id_cliente`, `nombre`, `apellido_pa`, `apellido_ma`, `telefono`, `email`, `utl`) VALUES (9, 'ricordo ', 'antonio', 'martinez', '7751484038', 'ricardo@gmail.com', 'https://www.google.com/maps/d/u/0/viewer?mid=1qaqne8IDKY9Ofjab_AjRTcY-J_v8PskE&ll=20.078204539910285%2C-98.40556204772952&z=15'), (10, 'merio', 'castañeda', 'jasir', '7751449660', 'mario@gmail.com', 'https://www.google.com/maps/d/u/0/viewer?usp=sharing_eip&mid=1qaqne8IDKY9Ofjab_AjRTcY-J_v8PskE'), (11, 'brenda', 'diaz', 'martinez', '77754645', 'brenda@gmail.com', 'brendabrenda'), (12, 'jose', 'matias', 'morelos', '7775465465', 'gaby@gmail.com', 'manuelmanuel'), (14, 'mario', 'lopez', 'obrador', '7751449660', '1717110251', 'mariomario'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `datos` -- CREATE TABLE `datos` ( `nombre` varchar(50) NOT NULL, `correo` varchar(50) NOT NULL, `mensaje` varchar(150) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `logs` -- CREATE TABLE `logs` ( `id_log` int(11) NOT NULL, `username` varchar(20) NOT NULL, `ip` varchar(16) NOT NULL, `access` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `logs` -- INSERT INTO `logs` (`id_log`, `username`, `ip`, `access`) VALUES (1, 'admin', '127.0.0.1', '2019-03-19 21:35:05'), (2, 'admin', '127.0.0.1', '2019-03-19 21:36:41'), (3, 'axbrenj', '127.0.0.1', '2019-03-19 21:37:45'), (4, 'admin', '127.0.0.1', '2019-03-19 21:38:01'), (5, 'axbrenj', '127.0.0.1', '2019-03-19 21:39:32'), (6, 'axbrenj', '127.0.0.1', '2019-03-19 22:04:47'), (7, 'axbrenj', '127.0.0.1', '2019-03-19 22:09:56'), (8, 'axbrenj', '127.0.0.1', '2019-03-19 22:17:28'), (9, 'axbrenj', '127.0.0.1', '2019-03-19 22:23:27'), (10, 'axbrenj', '127.0.0.1', '2019-03-20 13:13:50'), (11, 'axbrenj', '127.0.0.1', '2019-03-21 13:26:43'), (12, 'axbrenj', '127.0.0.1', '2019-03-21 13:48:56'), (13, 'axbrenj', '127.0.0.1', '2019-03-21 14:11:33'), (14, 'axbrenj', '127.0.0.1', '2019-03-21 14:26:26'), (15, 'axbrenj', '127.0.0.1', '2019-03-21 14:32:56'), (16, 'axbrenj', '127.0.0.1', '2019-04-03 20:08:31'), (17, 'axbrenj', '127.0.0.1', '2019-04-03 20:26:49'), (18, 'axbrenj', '127.0.0.1', '2019-04-04 13:23:48'), (19, 'axbrenj', '127.0.0.1', '2019-04-04 16:32:26'), (20, 'axbrenj', '127.0.0.1', '2019-04-04 16:37:50'), (21, 'axbrenj', '127.0.0.1', '2019-04-06 17:58:32'), (22, 'axbrenj', '127.0.0.1', '2019-04-10 17:35:30'), (23, 'axbrenj', '127.0.0.1', '2019-04-10 17:59:53'), (24, 'axbrenj', '127.0.0.1', '2019-04-10 18:02:04'), (25, 'axbrenj', '127.0.0.1', '2019-04-11 12:44:29'), (26, 'axbrenj', '127.0.0.1', '2019-04-11 12:56:36'), (27, 'axbrenj', '127.0.0.1', '2019-04-11 12:58:13'), (28, 'axbrenj', '127.0.0.1', '2019-04-11 13:31:08'), (29, 'axbrenj', '127.0.0.1', '2019-04-11 13:38:03'), (30, 'axbrenj', '127.0.0.1', '2019-04-11 14:55:27'), (31, 'axbrenj', '127.0.0.1', '2019-04-11 17:39:15'), (32, 'axbrenj', '127.0.0.1', '2019-04-11 19:43:33'), (33, 'axbrenj', '127.0.0.1', '2019-04-14 20:25:21'), (34, 'axbrenj', '192.168.1.114', '2019-04-14 21:50:17'), (35, 'axbrenj', '127.0.0.1', '2019-04-14 22:20:49'), (36, 'axbrenj', '127.0.0.1', '2019-04-14 23:29:16'), (37, 'axbrenj', '127.0.0.1', '2019-04-14 23:30:46'), (38, 'axbrenj', '127.0.0.1', '2019-04-15 14:19:47'), (39, 'axbrenj', '127.0.0.1', '2019-04-15 15:22:19'), (40, 'axbrenj', '127.0.0.1', '2019-04-15 15:36:10'), (41, 'axbrenj', '127.0.0.1', '2019-04-15 20:53:25'), (42, 'axbrenj', '127.0.0.1', '2019-04-16 13:40:53'), (43, 'axbrenj', '127.0.0.1', '2019-04-16 13:47:03'), (44, 'axbrenj', '127.0.0.1', '2019-04-16 14:02:45'), (45, 'axbrenj', '127.0.0.1', '2019-04-16 14:08:01'), (46, 'axbrenj', '127.0.0.1', '2019-04-16 14:11:04'), (47, 'axbrenj', '127.0.0.1', '2019-04-16 14:12:48'), (48, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-16 14:15:24'), (49, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-16 14:20:21'), (50, 'axbrenj', '127.0.0.1', '2019-04-16 14:26:31'), (51, 'axbrenj', '127.0.0.1', '2019-04-16 14:33:07'), (52, 'axbrenj', '127.0.0.1', '2019-04-16 15:55:28'), (53, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-16 16:25:18'), (54, 'axbrenj', '127.0.0.1', '2019-04-16 16:25:32'), (55, 'axbrenj', '127.0.0.1', '2019-04-16 16:54:14'), (56, 'axbrenj', '127.0.0.1', '2019-04-16 16:56:46'), (57, 'axbrenj', '127.0.0.1', '2019-04-16 17:59:01'), (58, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-16 23:15:02'), (59, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-16 23:17:43'), (60, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-16 23:18:04'), (61, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-17 01:08:59'), (62, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-17 01:12:23'), (63, 'axbrenj', '127.0.0.1', '2019-04-17 01:21:25'), (64, 'axbrenj', '127.0.0.1', '2019-04-17 01:26:12'), (65, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-29 11:47:32'), (66, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-29 13:54:32'), (67, 'axbrenj', '127.0.0.1', '2019-04-29 16:33:37'), (68, 'axbrenj', '127.0.0.1', '2019-04-29 16:35:16'), (69, 'axbrenj', '127.0.0.1', '2019-04-29 17:00:16'), (70, 'axbrenj', '127.0.0.1', '2019-04-29 17:04:01'), (71, 'axbrenj', '127.0.0.1', '2019-04-30 12:38:42'), (72, 'axbrenj', '127.0.0.1', '2019-04-30 13:14:44'), (73, 'axbrenj', '127.0.0.1', '2019-04-30 13:55:02'), (74, 'axbrenj', '127.0.0.1', '2019-04-30 19:47:00'), (75, 'axbrenj', '127.0.0.1', '2019-04-30 19:48:27'), (76, 'axbrenj', '127.0.0.1', '2019-04-30 20:34:57'), (77, 'axbrenj', '127.0.0.1', '2019-04-30 20:34:57'), (78, 'axbrenj', '127.0.0.1', '2019-04-30 20:47:25'), (79, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-30 21:33:46'), (80, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-30 21:39:58'), (81, 'xXBARTOLOCOXx', '127.0.0.1', '2019-04-30 21:45:02'), (82, 'axbrenj', '127.0.0.1', '2019-05-06 20:14:06'), (83, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-06 20:14:51'), (84, 'admin', '127.0.0.1', '2019-05-06 20:15:21'), (85, 'axbrenj', '127.0.0.1', '2019-05-06 20:15:50'), (86, 'axbrenj', '127.0.0.1', '2019-05-06 20:20:05'), (87, 'admin', '127.0.0.1', '2019-05-07 15:28:13'), (88, 'axbrenj', '127.0.0.1', '2019-05-07 15:29:11'), (89, 'axbrenj', '127.0.0.1', '2019-05-07 16:47:10'), (90, 'axbrenj', '127.0.0.1', '2019-05-07 16:51:43'), (91, 'axbrenj', '127.0.0.1', '2019-05-07 16:54:05'), (92, 'axbrenj', '127.0.0.1', '2019-05-07 16:57:02'), (93, 'axbrenj', '127.0.0.1', '2019-05-07 17:43:39'), (94, 'guess', '127.0.0.1', '2019-05-07 17:49:31'), (95, 'axbrenj', '127.0.0.1', '2019-05-07 17:55:41'), (96, 'guess', '127.0.0.1', '2019-05-07 17:56:32'), (97, 'axbrenj', '127.0.0.1', '2019-05-07 17:57:05'), (98, 'guess', '127.0.0.1', '2019-05-07 18:03:23'), (99, 'axbrenj', '127.0.0.1', '2019-05-07 18:05:14'), (100, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-09 17:33:41'), (101, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-09 17:56:25'), (102, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-09 18:13:38'), (103, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-09 18:39:13'), (104, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-09 18:50:32'), (105, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-09 19:02:39'), (106, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-09 22:40:37'), (107, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-09 22:46:52'), (108, 'axbrenj', '127.0.0.1', '2019-05-09 23:15:47'), (109, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-09 23:48:23'), (110, 'xXBARTOLOCOXx', '192.168.1.114', '2019-05-10 02:10:41'), (111, 'axbrenj', '192.168.1.114', '2019-05-10 02:12:02'), (112, 'xXBARTOLOCOXx', '192.168.1.114', '2019-05-10 02:12:42'), (113, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-13 16:58:03'), (114, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-13 18:15:59'), (115, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-13 18:32:44'), (116, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-13 20:32:09'), (117, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 16:42:30'), (118, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:23:32'), (119, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:28:36'), (120, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:28:36'), (121, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:30:01'), (122, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:31:09'), (123, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:33:15'), (124, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:34:44'), (125, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:47:21'), (126, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:48:37'), (127, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:49:50'), (128, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 17:53:01'), (129, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 18:09:20'), (130, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 18:37:20'), (131, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 19:42:16'), (132, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 19:43:39'), (133, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 20:00:07'), (134, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 20:23:50'), (135, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-14 20:23:50'), (136, 'xXBARTOLOCOXx', '127.0.0.1', '2019-05-15 03:56:35'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `partes_de_cuerpo` -- CREATE TABLE `partes_de_cuerpo` ( `id_palabra` int(5) NOT NULL, `palabra` varchar(50) NOT NULL, `palabra_otomi` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `partes_de_cuerpo` -- INSERT INTO `partes_de_cuerpo` (`id_palabra`, `palabra`, `palabra_otomi`) VALUES (1, 'cabeza', 'ña'), (2, 'pecho', 'jaya'), (3, 'manos', 'ye'), (4, 'pies', 'yowa'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `pies` -- CREATE TABLE `pies` ( `id_palabra` int(5) NOT NULL, `palabra_uno` varchar(50) NOT NULL, `palabra_dos` varchar(50) NOT NULL, `palabra_tres` varchar(50) NOT NULL, `palabra_cuatro` varchar(50) NOT NULL, `palabra_oto_uno` varchar(50) NOT NULL, `palabra_oto_dos` varchar(50) NOT NULL, `palabra_oto_tres` varchar(50) NOT NULL, `palabra_oto_cuatro` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `sessions` -- CREATE TABLE `sessions` ( `session_id` char(128) NOT NULL, `atime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `data` text ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `sessions` -- INSERT INTO `sessions` (`session_id`, `atime`, `data`) VALUES ('3e05e5a62048000bfa886e9805ccc336be2a00bf', '2019-05-14 20:45:28', 'KGRwMQpTJ2NvdW50JwpwMgpJMApzUydsb2dnZWRpbicKcDMKSTAwCnNTJ2lwJwpwNApWMTI3LjAu\nMC4xCnA1CnNTJ3Nlc3Npb25faWQnCnA2ClMnM2UwNWU1YTYyMDQ4MDAwYmZhODg2ZTk4MDVjY2Mz\nMzZiZTJhMDBiZicKcDcKc1MndXNlcicKcDgKUydhbm9ueW1vdXMnCnA5CnNTJ3ByaXZpbGVnZScK\ncDEwCkktMQpzUydsb2dpbicKcDExCkkwCnMu\n'), ('7d05690f388fe6712f4577a9fe8fbf9e6ecf2fe0', '2019-05-15 03:56:36', 'KGRwMQpTJ2NvdW50JwpwMgpJMApzUyd1c2VybmFtZScKcDMKVnhYQkFSVE9MT0NPWHgKcDQKc1Mn\nbG9nZ2VkaW4nCnA1CkkwMQpzUydpcCcKcDYKVjEyNy4wLjAuMQpwNwpzUydzZXNzaW9uX2lkJwpw\nOApTJzdkMDU2OTBmMzg4ZmU2NzEyZjQ1NzdhOWZlOGZiZjllNmVjZjJmZTAnCnA5CnNTJ3VzZXIn\nCnAxMApTJ2Fub255bW91cycKcDExCnNTJ3ByaXZpbGVnZScKcDEyCkwwTApzUydsb2dpbicKcDEz\nCkkwCnMu\n'), ('9f51f4753b75cbc896c6923e61909c0980f83b0f', '2019-05-14 18:28:00', 'KGRwMQpTJ2NvdW50JwpwMgpJMApzUydsb2dnZWRpbicKcDMKSTAwCnNTJ2lwJwpwNApWMTkyLjE2\nOC4xLjc2CnA1CnNTJ3Nlc3Npb25faWQnCnA2ClMnOWY1MWY0NzUzYjc1Y2JjODk2YzY5MjNlNjE5\nMDljMDk4MGY4M2IwZicKcDcKc1MndXNlcicKcDgKUydhbm9ueW1vdXMnCnA5CnNTJ3ByaXZpbGVn\nZScKcDEwCkktMQpzUydsb2dpbicKcDExCkkwCnMu\n'), ('dd3a693b2db3ff3d043fb0a31b88da7a330d4715', '2019-05-14 17:04:17', 'KGRwMQpTJ2NvdW50JwpwMgpJMApzUydsb2dnZWRpbicKcDMKSTAwCnNTJ2lwJwpwNApWMTkyLjE2\nOC4xLjc2CnA1CnNTJ3Nlc3Npb25faWQnCnA2ClMnZGQzYTY5M2IyZGIzZmYzZDA0M2ZiMGEzMWI4\nOGRhN2EzMzBkNDcxNScKcDcKc1MndXNlcicKcDgKUydhbm9ueW1vdXMnCnA5CnNTJ3ByaXZpbGVn\nZScKcDEwCkktMQpzUydsb2dpbicKcDExCkkwCnMu\n'), ('e468ac8eccc112bf05ac81136ced1c19583fec43', '2019-05-14 17:43:53', 'KGRwMQpTJ2NvdW50JwpwMgpJMApzUydsb2dnZWRpbicKcDMKSTAwCnNTJ2lwJwpwNApWMTkyLjE2\nOC4xLjc2CnA1CnNTJ3Nlc3Npb25faWQnCnA2ClMnZTQ2OGFjOGVjY2MxMTJiZjA1YWM4MTEzNmNl\nZDFjMTk1ODNmZWM0MycKcDcKc1MndXNlcicKcDgKUydhbm9ueW1vdXMnCnA5CnNTJ3ByaXZpbGVn\nZScKcDEwCkktMQpzUydsb2dpbicKcDExCkkwCnMu\n'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `users` -- CREATE TABLE `users` ( `username` varchar(20) NOT NULL, `password` varchar(32) NOT NULL, `privilege` int(11) NOT NULL DEFAULT '-1', `status` int(11) NOT NULL DEFAULT '1', `name` varchar(150) NOT NULL, `email` varchar(100) NOT NULL, `other_data` varchar(50) NOT NULL, `user_hash` varchar(32) NOT NULL, `change_pwd` int(11) NOT NULL DEFAULT '1', `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `users` -- INSERT INTO `users` (`username`, `password`, `privilege`, `status`, `name`, `email`, `other_data`, `user_hash`, `change_pwd`, `created`) VALUES ('admin', '80793b8cc71ae0b004a06aa405c205ac', 0, 1, 'Admin', 'admin@gmail.com', 'TIC:SI', 'dc243fdf1a24cbced74db81708b30788', 0, '2019-03-19 21:28:36'), ('axbrenj', '2324ac45a214915d2446b58d6134e7b5', 0, 1, 'Ricardo Antonio Diaz Martinez', 'alguien@gmail.com', 'nada', '62488a686164e425e5beb305acb738c0', 0, '2019-05-13 17:50:04'), ('guess', 'dbd485102f445e1929d174726d10470b', 1, 1, 'Guess', 'guess@gmail.com', 'TIC:SI', 'eba1c13c68d351dbc1d3f3d76a18d16d', 0, '2019-03-19 21:28:36'), ('xXBARTOLOCOXx', '2324ac45a214915d2446b58d6134e7b5', 0, 1, 'juanito', '1717110251@utectulancingo.edu.mx', 'nada', '4f9a0e5a9c57b9d350b1b8afa6e7f0f6', 0, '2019-05-06 20:14:28'); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `cabeza` -- ALTER TABLE `cabeza` ADD PRIMARY KEY (`id_palabra_cabeza`); -- -- Indices de la tabla `clientes` -- ALTER TABLE `clientes` ADD PRIMARY KEY (`id_cliente`); -- -- Indices de la tabla `logs` -- ALTER TABLE `logs` ADD PRIMARY KEY (`id_log`), ADD KEY `username` (`username`); -- -- Indices de la tabla `partes_de_cuerpo` -- ALTER TABLE `partes_de_cuerpo` ADD PRIMARY KEY (`id_palabra`); -- -- Indices de la tabla `sessions` -- ALTER TABLE `sessions` ADD UNIQUE KEY `session_id` (`session_id`); -- -- Indices de la tabla `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`username`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `cabeza` -- ALTER TABLE `cabeza` MODIFY `id_palabra_cabeza` int(15) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT de la tabla `clientes` -- ALTER TABLE `clientes` MODIFY `id_cliente` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT de la tabla `logs` -- ALTER TABLE `logs` MODIFY `id_log` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=137; -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `logs` -- ALTER TABLE `logs` ADD CONSTRAINT `logs_ibfk_1` FOREIGN KEY (`username`) REFERENCES `users` (`username`); 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 */;
-- Adminer 4.7.9 MySQL dump SET NAMES utf8; SET time_zone = '+00:00'; SET foreign_key_checks = 0; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; SET NAMES utf8mb4; CREATE DATABASE `ahmedd` ; USE `ahmed`; DROP TABLE IF EXISTS `extra`; CREATE TABLE `extra` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `descreption` varchar(255) NOT NULL, `price` float NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ; DROP TABLE IF EXISTS `extra_demande`; CREATE TABLE `extra_demande` ( `id` int NOT NULL AUTO_INCREMENT, `user_id` varchar(255) NOT NULL, `descreption` varchar(255) NOT NULL, `amount` float NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ; DROP TABLE IF EXISTS `hotels`; CREATE TABLE `hotels` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `room` varchar(255) NOT NULL, `location` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ; INSERT INTO `hotels` (`id`, `name`, `room`, `location`) VALUES (1, 'Hotel 1', '1', 'Sousse'); DROP TABLE IF EXISTS `payment`; CREATE TABLE `payment` ( `id` int NOT NULL AUTO_INCREMENT, `id_user` varchar(255) NOT NULL, `card_number` varchar(255) NOT NULL, `ex_date` varchar(255) NOT NULL, `cvv` int NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ; INSERT INTO `payment` (`id`, `id_user`, `card_number`, `ex_date`, `cvv`) VALUES (1, '1', '1234556', '024', 555), (2, '1', '1234556', '024', 555), (3, '1', '1234556', '024', 555), (4, '1', '1234556', '024', 555), (5, '1', '1234556', '024', 555), (6, '1', '1234556', '024', 555), (7, '1', '1234556', '024', 555), (8, '1', '1234548484856', '024', 555); DROP TABLE IF EXISTS `reservations`; CREATE TABLE `reservations` ( `id` int NOT NULL AUTO_INCREMENT, `user_id` varchar(255) NOT NULL, `room_id` varchar(255) NOT NULL, `from` date NOT NULL, `to` decimal(10,0) NOT NULL, `amount` float NOT NULL, `nb_nuit` int NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ; DROP TABLE IF EXISTS `rooms`; CREATE TABLE `rooms` ( `id` int NOT NULL AUTO_INCREMENT, `room_name` varchar(255) NOT NULL, `nb_adulte` int NOT NULL, `nb_children` int NOT NULL, `type` varchar(255) NOT NULL, `descreption` varchar(255) NOT NULL, `price` float NOT NULL, `nb_disponible` int NOT NULL, `hotel_id` varchar(255) NOT NULL, `image` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ; INSERT INTO `rooms` (`id`, `room_name`, `nb_adulte`, `nb_children`, `type`, `descreption`, `price`, `nb_disponible`, `hotel_id`, `image`) VALUES (1, 'room 1 ', 2, 0, 'double', 'double', 150, 8, '1', 'https://i.ytimg.com/vi/6K44JEduspY/maxresdefault.jpg'), (2, 'room 12', 1, 0, 'simple', 'simple', 150, 10, '1', 'https://i.ytimg.com/vi/6K44JEduspY/maxresdefault.jpg'); DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` int NOT NULL AUTO_INCREMENT, `first_name` varchar(255) NOT NULL, `last_name` varchar(255) NOT NULL, `passeport` varchar(255) DEFAULT NULL, `cin` varchar(255) DEFAULT NULL, `gender` varchar(255) NOT NULL, `country` varchar(255) NOT NULL, `nb_reservation` int NOT NULL, `username` varchar(255) CHARACTER SET utf8mb4, `password` varchar(255) CHARACTER SET utf8mb4, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ; INSERT INTO `users` (`id`, `first_name`, `last_name`, `passeport`, `cin`, `gender`, `country`, `nb_reservation`, `username`, `password`) VALUES (1, 'bader', 'rachedddddddddd', '123456789', '12841138', 'male', 'sousse', 0, 'bader', '123456789'), (2, 'test', 'test', '121212', '121212', 'male', 'sousse', 0, 'test', '123456789'), (3, 'test', 'test', '121212', '121212', 'male', 'sousse', 0, 'test2', '123456789'), (6, 'test', 'test', '121212', '121212', 'male', 'sousse', 0, 'test55', '123456789'); -- 2021-06-17 14:24:43
-- Import database .headers off .mode csv .separator ',' DROP TABLE IF EXISTS pums_data; -- CREATE pums_data table and populate it .mode csv CREATE TABLE pums_data( SERIALNO INT, SPORDER INT, PUMA INT, ST INT, ADJINC DOUBLE, PWGTP DOUBLE, AGEP INT, COW INT, INTP DOUBLE, NWAB INT, NWAV INT, NWLA INT, NWLK INT, OIP DOUBLE, SCHG INT, SCHL INT, SEMP DOUBLE, SEX INT, SSIP DOUBLE, SSP DOUBLE, WAGP DOUBLE, WKHP INT, WKL INT, WKW INT, WRK TEXT, ESR INT, FOD1P TEXT, FOD2P TEXT, INDP TEXT, NAICSP TEXT, OCCP TEXT, PERNP DOUBLE, PINCP DOUBLE, POWPUMA TEXT, POWSP TEXT, SOCP TEXT ); .import data/interim/pums_extracted.csv pums_data
--PROBLEM 06 --Write a SQL query to find all towns that start with letters M, K, B or E. Order them alphabetically by town name. SELECT * FROM Towns WHERE [Name] LIKE ('M%') OR [Name] LIKE('K%') OR [Name]LIKE('B%') OR [Name] LIKE('E%') ORDER BY [Name]
CREATE TABLE DEMO ( NAME VARCHAR2(5) NOT NULL, VALUE VARCHAR2(5) NOT NULL ); ALTER TABLE DEMO ADD CONSTRAINT DEMO_PK PRIMARY KEY (NAME);
/* Warnings: - You are about to drop the `_CourseToStudent` table. If the table is not empty, all the data it contains will be lost. */ -- DropForeignKey ALTER TABLE "_CourseToStudent" DROP CONSTRAINT "_CourseToStudent_A_fkey"; -- DropForeignKey ALTER TABLE "_CourseToStudent" DROP CONSTRAINT "_CourseToStudent_B_fkey"; -- DropTable DROP TABLE "_CourseToStudent"; -- CreateTable CREATE TABLE "FinishedCourses" ( "courseId" INTEGER NOT NULL, "studentID" INTEGER NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "grade" DOUBLE PRECISION, "semester" "Semester", "instructorName" TEXT, PRIMARY KEY ("courseId","studentID") ); -- AddForeignKey ALTER TABLE "FinishedCourses" ADD FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "FinishedCourses" ADD FOREIGN KEY ("studentID") REFERENCES "Student"("id") ON DELETE CASCADE ON UPDATE CASCADE;
select mcd.project, mcd.sha, cs.author, cs.author_email, cs.commit_date, cs.is_bug, mcd.language, mcd.file_name, mcd.is_test, mcd.method_name, mcd."tf.function_adds", mcd."tf.function_dels", mcd.total_adds, mcd.total_dels, mcd.warning_alert from method_change_detail as mcd inner join change_summary as cs on mcd.sha = cs.sha where mcd."tf.function_adds" > 0 or mcd."tf.function_dels" > 0 order by cs.project desc, file_name, method_name
--创建表空间 create tablespace wis datafile 'F:\oracle\product\10.2.0\oradata\orcl\wis.dbf' size 500m autoextend on next 10m maxsize unlimited;
-- 문제 1. -- 현재 급여가 많은 직원부터 직원의 사번, 이름, 그리고 연봉을 출력 하시오. -- 현재 = to_date - 9999 01 01 select * from salaries; select * from employees; select max(salary) from salaries; select * from salaries join employees on salaries.emp_no = employees.emp_no; select max(salary) from salaries join employees on salaries.emp_no = employees.emp_no; select * from salaries where salary = 158220; select * from employees where emp_no = 43624; -- tokutasu select first_name from salaries join employees on salaries.emp_no = employees.emp_no group by salary,first_name having max(salary); -- 문제2. -- 전체 사원의 사번, 이름, 현재 직책을 이름 순서로 출력하세요. -- 문제3. -- 전체 사원의 사번, 이름, 현재 부서를 이름 순서로 출력하세요.. -- 문제4. -- 전체 사원의 사번, 이름, 연봉, 직책, 부서를 모두 이름 순서로 출력합니다. -- 문제5. -- ‘Technique Leader’의 직책으로 과거에 근무한 적이 있는 모든 사원의 -- 사번과 이름을 출력하세요. (현재 ‘Technique Leader’의 직책(으로 근무하는 -- 사원은 고려하지 않습니다.) 이름은 first_name과 last_name을 합쳐 출력 -- 합니다. -- not -- 문제6. -- 직원 이름(last_name) 중에서 S(대문자)로 시작하는 직원들의 이름, 부서명, -- 직책을 조회하세요. -- where 대문자 -- 문제7. -- 현재, 직책이 Engineer인 사원 중에서 현재 급여가 40000 이상인 사원을 급여가 -- 큰 순서대로 출력하세요. -- 문제8. -- 현재 급여가 50000이 넘는 직책을 직책, 급여로 급여가 큰 순서대로 출력하시오 -- 문제9. -- 현재, 부서별 평균 연봉을 연봉이 큰 부서 순서대로 출력하세요. -- 부서, 연봉 섞고 / avg -- 문제10. -- 현재, 직책별 평균 연봉을 연봉이 큰 직책 순서대로 출력하세요.
/* Navicat MySQL Data Transfer Designer: Liyh Description: YW-220 create table project_sort_child Source Server : 192.168.20.200 Source Server Version : 50621 Source Host : 192.168.20.200:3306 Source Database : dev Target Server Type : MYSQL Target Server Version : 50621 File Encoding : 65001 Date: 2015-04-22 16:21:50 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `project_sort_child` -- ---------------------------- CREATE TABLE IF NOT EXISTS `project_sort_child` ( `id` varchar(32) NOT NULL COMMENT '工程编号', `parent_id` varchar(32) DEFAULT NULL COMMENT '依赖工程编号', `name` varchar(255) DEFAULT NULL COMMENT '工程名称', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of project_sort_child -- ----------------------------
DROP DATABASE IF EXISTS converter; CREATE DATABASE converter; USE converter; CREATE TABLE configs ( id varchar(255) NOT NULL PRIMARY KEY, user_id INT NOT NULL, name varchar(255) NOT NULL, input_format varchar(255) NOT NULL, output_format varchar(255) NOT NULL, tabulation INT, property_case varchar(50) ); CREATE TABLE users ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, username VARCHAR(50) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE transformations ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, user_id INT NOT NULL, config_id varchar(255) NOT NULL, file_name varchar(255) NOT NULL, output_file_name varchar(255) NOT NULL, input_file_name varchar(255) NOT NULL, FOREIGN KEY(user_id) REFERENCES users(id), FOREIGN KEY(config_id) REFERENCES configs(id) ); CREATE TABLE shares ( user_id INT NOT NULL, transformation_id INT NOT NULL, PRIMARY KEY(user_id, transformation_id), FOREIGN KEY(user_id) REFERENCES users(id), FOREIGN KEY(transformation_id) REFERENCES transformations(id) );
SELECT SUM(`rice`) AS rice_sum FROM `sells` SELECT SUM(`rice`) AS rice_sum, SUM(`sugar`) AS sugar_sum FROM `sells` SELECT COUNT(`rice`) FROM `sells` SELECT AVG(`rice`) AS average_rice FROM `sells` SELECT MIN(`rice`) AS min_rice FROM `sells` SELECT MAX(`rice`) AS max_rice FROM `sells`
drop table IF EXISTS phone_entity cascade ; drop table IF EXISTS user_entity cascade ; drop table IF EXISTS company_entity cascade ;
use rh_servicos; Create table funcionarios_rh( id bigint auto_increment, nome varchar (30) not null, salario decimal (20,2), setor varchar (30) not null, telefone long not null, primary key (id) ); insert into funcionarios_rh (nome,salario,setor,telefone) values ("Sofia",2500.00,"Sistemas",999999); insert into funcionarios_rh (nome,salario,setor,telefone) values ("Alexandre",1900.00,"Advocacia",9929239); insert into funcionarios_rh (nome,salario,setor,telefone) values ("Marcelo",7000.00,"Gerencia",888888); insert into funcionarios_rh (nome,salario,setor,telefone) values ("Mia",1500.00,"Limpeza",777777); insert into funcionarios_rh (nome,salario,setor,telefone) values ("José",2800.00,"Serviços Gerais",555555); select * from funcionarios_rh where salario >2000; select * from funcionarios_rh where salario <2000; update funcionarios_rh set setor = "Administração" where id = 5;
CREATE OR REPLACE VIEW C_INVOICE_LINETAX_V (AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, C_INVOICELINE_ID, C_TAX_ID, TAXAMT, LINETOTALAMT, TAXINDICATOR, LINE, M_PRODUCT_ID, QTYINVOICED, QTYENTERED, UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE, PRODUCTDESCRIPTION, IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID) AS SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, 'en_US' AS AD_Language, il.C_Invoice_ID, il.C_InvoiceLine_ID, il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator, il.Line, p.M_Product_ID, CASE WHEN il.QtyInvoiced<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyInvoiced END AS QtyInvoiced, CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyEntered END AS QtyEntered, CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, COALESCE(c.Name,p.Name||productAttribute(il.M_AttributeSetInstance_ID), il.Description) AS Name, -- main line CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN il.Description END AS Description, -- second line p.DocumentNote, -- third line p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, ra.Description AS ResourceDescription, -- forth line CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 THEN il.PriceList END AS PriceList, CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 AND il.QtyEntered<>0 THEN il.PriceList*il.QtyInvoiced/il.QtyEntered END AS PriceEnteredList, CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList>il.PriceActual AND il.PriceList<>0 THEN (il.PriceList-il.PriceActual)/il.PriceList*100 END AS Discount, CASE WHEN il.PriceActual<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceActual END AS PriceActual, CASE WHEN il.PriceEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceEntered END AS PriceEntered, CASE WHEN il.LineNetAmt<>0 OR il.M_Product_ID IS NOT NULL THEN il.LineNetAmt END AS LineNetAmt, il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, p.Description as ProductDescription, p.ImageURL, il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID FROM C_InvoiceLine il INNER JOIN C_UOM uom ON (il.C_UOM_ID=uom.C_UOM_ID) INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID) LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID) LEFT OUTER JOIN C_Charge c ON (il.C_Charge_ID=c.C_Charge_ID) LEFT OUTER JOIN C_BPartner_Product pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) LEFT OUTER JOIN S_ResourceAssignment ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) UNION -- bom lines SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, 'en_US' AS AD_Language, il.C_Invoice_ID, il.C_InvoiceLine_ID, il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator, il.Line+(bl.Line/100) AS Line, p.M_Product_ID, --il.QtyInvoiced*b.BOMQty AS QtyInvoiced, CASE WHEN bl.IsQtyPercentage = 'N' THEN il.QtyInvoiced*bl.QtyBOM ELSE il.QtyInvoiced*(bl.QtyBatch / 100) END AS QtyInvoiced, --il.QtyEntered*b.BOMQty AS QtyEntered, CASE WHEN bl.IsQtyPercentage = 'N' THEN il.QtyEntered*bl.QtyBOM ELSE il.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered, uom.UOMSymbol, p.Name, -- main b.Description, p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, null, null, null, null, null, null, null, il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, p.Description as ProductDescription, p.ImageURL, il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID /*FROM M_Product_BOM b -- BOM lines INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID) LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID) LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)*/ FROM PP_Product_BOM b -- BOM lines INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID) INNER JOIN M_Product p ON (bl.M_Product_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID) LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID) LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) UNION -- comment lines SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, 'en_US', il.C_Invoice_ID, il.C_InvoiceLine_ID, null, null, null, null, il.Line, null, null, null, null, il.Description, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null FROM C_InvoiceLine il WHERE il.C_UOM_ID IS NULL UNION -- empty line SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, 'en_US', C_Invoice_ID, null, null, null, null, null, 9998, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null FROM C_Invoice UNION -- tax lines SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.Updated, it.UpdatedBy, 'en_US', it.C_Invoice_ID, null, it.C_Tax_ID, null, null, t.TaxIndicator, 9999, null, null, null, null, t.Name, null, null, null, null, null, null, null, null, null, CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END, CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END, CASE WHEN it.IsTaxIncluded='Y' THEN NULL ELSE it.TaxAmt END, null, null, null, null, null, null, null, null, null, null, null, null, null FROM C_InvoiceTax it INNER JOIN C_Tax t ON (it.C_Tax_ID=t.C_Tax_ID); CREATE OR REPLACE VIEW C_INVOICE_LINETAX_VT (AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, C_INVOICELINE_ID, C_TAX_ID, TAXAMT, LINETOTALAMT, TAXINDICATOR, LINE, M_PRODUCT_ID, QTYINVOICED, QTYENTERED, UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE, PRODUCTDESCRIPTION, IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID) AS SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, uom.AD_Language, il.C_Invoice_ID, il.C_InvoiceLine_ID, il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator, il.Line, p.M_Product_ID, CASE WHEN il.QtyInvoiced<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyInvoiced END AS QtyInvoiced, CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyEntered END AS QtyEntered, CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, COALESCE(c.Name,COALESCE(pt.Name,p.Name)||productAttribute(il.M_AttributeSetInstance_ID), il.Description) AS Name, -- main line CASE WHEN COALESCE(c.Name,pt.Name,p.Name) IS NOT NULL THEN il.Description END AS Description, -- second line COALESCE(pt.DocumentNote,p.DocumentNote) AS DocumentNote, -- third line p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, ra.Description AS ResourceDescription, -- forth line CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 THEN il.PriceList END AS PriceList, CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 AND il.QtyEntered<>0 THEN il.PriceList*il.QtyInvoiced/il.QtyEntered END AS PriceEnteredList, CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList>il.PriceActual AND il.PriceList<>0 THEN (il.PriceList-il.PriceActual)/il.PriceList*100 END AS Discount, CASE WHEN il.PriceActual<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceActual END AS PriceActual, CASE WHEN il.PriceEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceEntered END AS PriceEntered, CASE WHEN il.LineNetAmt<>0 OR il.M_Product_ID IS NOT NULL THEN il.LineNetAmt END AS LineNetAmt, il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, pt.Description as ProductDescription, p.ImageURL, il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID FROM C_InvoiceLine il INNER JOIN C_UOM_Trl uom ON (il.C_UOM_ID=uom.C_UOM_ID) INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) LEFT OUTER JOIN C_Tax_Trl t ON (il.C_Tax_ID=t.C_Tax_ID AND uom.AD_Language=t.AD_Language) LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID) LEFT OUTER JOIN C_Charge c ON (il.C_Charge_ID=c.C_Charge_ID) LEFT OUTER JOIN C_BPartner_Product pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) LEFT OUTER JOIN M_Product_Trl pt ON (il.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) LEFT OUTER JOIN S_ResourceAssignment ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) UNION -- bom lines SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, uom.AD_Language, il.C_Invoice_ID, il.C_InvoiceLine_ID, il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator, il.Line+(bl.Line/100) AS Line, p.M_Product_ID, --il.QtyInvoiced*b.BOMQty AS QtyInvoiced, CASE WHEN bl.IsQtyPercentage = 'N' THEN il.QtyInvoiced*bl.QtyBOM ELSE il.QtyInvoiced*(bl.QtyBatch / 100) END AS QtyInvoiced, --il.QtyEntered*b.BOMQty AS QtyEntered, CASE WHEN bl.IsQtyPercentage = 'N' THEN il.QtyEntered*bl.QtyBOM ELSE il.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered, uom.UOMSymbol, COALESCE(pt.Name,p.Name) AS Name, -- main b.Description, COALESCE(pt.DocumentNote,p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, null, null, null, null, null, null, null, il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, pt.Description as ProductDescription, p.ImageURL, il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID /*FROM M_Product_BOM b -- BOM lines INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID) LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)*/ FROM PP_Product_BOM b -- BOM lines INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID) INNER JOIN M_Product p ON (bl.M_Product_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) INNER JOIN M_Product_Trl pt ON (bl.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID) LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) UNION -- comment line SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, l.AD_Language, il.C_Invoice_ID, il.C_InvoiceLine_ID, null, null, null, null, il.Line, null, null, null, null, il.Description, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,null,null,null,null FROM C_InvoiceLine il, AD_Language l WHERE il.C_UOM_ID IS NULL AND l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y' UNION -- empty line SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, AD_Language, i.C_Invoice_ID, null, null, null, null, null, 9998, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,null,null,null,null FROM C_Invoice i, AD_Language l WHERE l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y' UNION -- tax lines SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.Updated, it.UpdatedBy, t.AD_Language, it.C_Invoice_ID, null, it.C_Tax_ID, null, null, t.TaxIndicator, 9999, null, null, null, null, t.Name, null, null, null, null, null, null, null, null, null, CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END, CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END, CASE WHEN it.IsTaxIncluded='Y' THEN NULL ELSE it.TaxAmt END, null, null, null, null, null, null, null, null, null,null,null,null,null FROM C_InvoiceTax it INNER JOIN C_Tax_Trl t ON (it.C_Tax_ID=t.C_Tax_ID); CREATE OR REPLACE VIEW C_ORDER_LINETAX_V (AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, C_ORDERLINE_ID, C_TAX_ID, TAXINDICATOR, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, BPNAME, C_LOCATION_ID, LINE, M_PRODUCT_ID, QTYORDERED, QTYENTERED, UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, PRODUCTDESCRIPTION, IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID) AS SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, 'en_US' AS AD_Language, ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, t.TaxIndicator, ol.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.Name AS BPName, bpl.C_Location_ID, ol.Line, p.M_Product_ID, CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered, CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered, CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, COALESCE(c.Name,p.Name||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line p.DocumentNote, -- third line p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, ra.Description AS ResourceDescription, -- forth line CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 THEN ol.PriceList END AS PriceList, CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 AND ol.QtyEntered<>0 THEN ol.PriceList*ol.QtyOrdered/ol.QtyEntered END AS PriceEnteredList, CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList>ol.PriceActual AND ol.PriceList<>0 THEN (ol.PriceList-ol.PriceActual)/ol.PriceList*100 END AS Discount, CASE WHEN ol.PriceActual<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceActual END AS PriceActual, CASE WHEN ol.PriceEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceEntered END AS PriceEntered, CASE WHEN ol.LineNetAmt<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.LineNetAmt END AS LineNetAmt, p.Description as ProductDescription, p.ImageURL, ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID FROM C_OrderLine ol INNER JOIN C_UOM uom ON (ol.C_UOM_ID=uom.C_UOM_ID) INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID) LEFT OUTER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID) LEFT OUTER JOIN S_ResourceAssignment ra ON (ol.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) LEFT OUTER JOIN C_Charge c ON (ol.C_Charge_ID=c.C_Charge_ID) LEFT OUTER JOIN C_BPartner_Product pp ON (ol.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) INNER JOIN C_BPartner bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID) INNER JOIN C_BPartner_Location bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) LEFT OUTER JOIN C_Tax t ON (ol.C_Tax_ID=t.C_Tax_ID) UNION SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, 'en_US' AS AD_Language, ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null, null, null, null, null, ol.Line+(bl.Line/100) AS Line, p.M_Product_ID, --ol.QtyOrdered*bl.BOMQty AS QtyInvoiced CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyOrdered*bl.QtyBOM ELSE ol.QtyOrdered*(bl.QtyBatch / 100) END AS QtyInvoiced, --ol.QtyEntered*bl.BOMQty AS QtyEntered, CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyEntered*bl.QtyBOM ELSE ol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered, uom.UOMSymbol, p.Name, -- main bl.Description, p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, null, null, null, null, null, null, null, p.Description as ProductDescription, p.ImageURL, ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID /*FROM M_Product_BOM b -- BOM lines INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)*/ FROM PP_Product_BOM b INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID) INNER JOIN M_Product p ON (p.M_Product_ID=bl.M_Product_ID) -- BOM line product INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID) UNION SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, 'en_US', C_Order_ID, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,null,null,null,null FROM C_Order UNION SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.Updated, ot.UpdatedBy, 'en_US', ot.C_Order_ID, null, ot.C_Tax_ID, t.TaxIndicator, null, null, null, null, null, null, null, null, null, t.Name, null, null, null, null, null, null, null, null, null, CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, CASE WHEN ot.IsTaxIncluded='Y' THEN NULL ELSE ot.TaxAmt END, null, null, null,null,null,null,null FROM C_OrderTax ot INNER JOIN C_Tax t ON (ot.C_Tax_ID=t.C_Tax_ID); CREATE OR REPLACE VIEW C_ORDER_LINETAX_VT (AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, C_ORDERLINE_ID, C_TAX_ID, TAXINDICATOR, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, BPNAME, C_LOCATION_ID, LINE, M_PRODUCT_ID, QTYORDERED, QTYENTERED, UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, PRODUCTDESCRIPTION, IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID) AS SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, uom.AD_Language, ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, t.TaxIndicator, ol.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.Name AS BPName, bpl.C_Location_ID, ol.Line, p.M_Product_ID, CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered, CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered, CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, COALESCE(c.Name,p.Name||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line CASE WHEN COALESCE(c.Name,pt.Name, p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, ra.Description AS ResourceDescription, -- forth line CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 THEN ol.PriceList END AS PriceList, CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 AND ol.QtyEntered<>0 THEN ol.PriceList*ol.QtyOrdered/ol.QtyEntered END AS PriceEnteredList, CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList>ol.PriceActual AND ol.PriceList<>0 THEN (ol.PriceList-ol.PriceActual)/ol.PriceList*100 END AS Discount, CASE WHEN ol.PriceActual<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceActual END AS PriceActual, CASE WHEN ol.PriceEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceEntered END AS PriceEntered, CASE WHEN ol.LineNetAmt<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.LineNetAmt END AS LineNetAmt, pt.Description as ProductDescription, p.ImageURL, ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID FROM C_OrderLine ol INNER JOIN C_UOM_Trl uom ON (ol.C_UOM_ID=uom.C_UOM_ID) INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID) LEFT OUTER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID) LEFT OUTER JOIN M_Product_Trl pt ON (ol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) LEFT OUTER JOIN S_ResourceAssignment ra ON (ol.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) LEFT OUTER JOIN C_Charge c ON (ol.C_Charge_ID=c.C_Charge_ID) LEFT OUTER JOIN C_BPartner_Product pp ON (ol.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) INNER JOIN C_BPartner bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID) INNER JOIN C_BPartner_Location bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) LEFT OUTER JOIN C_Tax_Trl t ON (ol.C_Tax_ID=t.C_Tax_ID AND uom.AD_Language=t.AD_Language) UNION SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, uom.AD_Language, ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null, null, null, null, null, ol.Line+(bl.Line/100) AS Line, p.M_Product_ID, --ol.QtyOrdered*b.BOMQty AS QtyInvoiced, CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyOrdered*bl.QtyBOM ELSE ol.QtyOrdered*(bl.QtyBatch / 100) END AS QtyInvoiced, --ol.QtyEntered*b.BOMQty AS QtyEntered, CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyEntered*bl.QtyBOM ELSE ol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered, uom.UOMSymbol, COALESCE(pt.Name, p.Name) AS Name, -- main b.Description, COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, null, null, null, null, null, null, null, pt.Description AS ProductDescription, p.ImageURL, ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID /*FROM M_Product_BOM b -- BOM lines INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)*/ FROM PP_Product_BOM b INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID) INNER JOIN M_Product p ON (p.M_Product_ID=bl.M_Product_ID) -- BOM line product INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) INNER JOIN M_Product_Trl pt ON (pt.M_Product_ID=bl.M_Product_ID AND uom.AD_Language=pt.AD_Language) UNION SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, l.AD_Language, o.C_Order_ID, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,null,null,null,null FROM C_Order o, AD_Language l WHERE l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y' UNION SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.Updated, ot.UpdatedBy, t.AD_Language, ot.C_Order_ID, null, ot.C_Tax_ID, t.TaxIndicator, null, null, null, null, null, null, null, null, null, t.Name, null, null, null, null, null, null, null, null, null, CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, CASE WHEN ot.IsTaxIncluded='Y' THEN NULL ELSE ot.TaxAmt END, null, null, null,null,null,null,null FROM C_OrderTax ot INNER JOIN C_Tax_Trl t ON (ot.C_Tax_ID=t.C_Tax_ID); CREATE OR REPLACE VIEW M_INOUT_LINE_V (AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, M_INOUTLINE_ID, LINE, M_PRODUCT_ID, MOVEMENTQTY, QTYENTERED, UOMSYMBOL, QTYORDERED, QTYDELIVERED, QTYBACKORDERED, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, M_LOCATOR_ID, M_WAREHOUSE_ID, X, Y, Z, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE, PRODUCTDESCRIPTION, IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID) AS SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy, 'en_US' AS AD_Language, iol.M_InOut_ID, iol.M_InOutLine_ID, iol.Line, p.M_Product_ID, CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.MovementQty END AS MovementQty, CASE WHEN iol.QtyEntered<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.QtyEntered END AS QtyEntered, CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, ol.QtyOrdered, ol.QtyDelivered, CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered-ol.QtyDelivered END AS QtyBackOrdered, COALESCE(p.Name||productAttribute(iol.M_AttributeSetInstance_ID), c.Name, iol.Description) AS Name, -- main line CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN iol.Description END AS Description, -- second line p.DocumentNote, -- third line p.UPC, p.SKU, p.Value AS ProductValue, iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, p.Description AS ProductDescription, p.ImageURL, iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID FROM M_InOutLine iol INNER JOIN C_UOM uom ON (iol.C_UOM_ID=uom.C_UOM_ID) LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID) LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID) LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID) LEFT OUTER JOIN C_Charge c ON (iol.C_Charge_ID=c.C_Charge_ID) UNION -- BOM lines SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy, 'en_US' AS AD_Language, iol.M_InOut_ID, iol.M_InOutLine_ID, iol.Line+(bl.Line/100) AS Line, p.M_Product_ID, --iol.MovementQty*b.BOMQty AS QtyInvoiced, CASE WHEN bl.IsQtyPercentage = 'N' THEN iol.MovementQty*bl.QtyBOM ELSE iol.MovementQty*(bl.QtyBatch / 100) END AS QtyInvoiced, --iol.QtyEntered*b.BOMQty AS QtyEntered, CASE WHEN bl.IsQtyPercentage = 'N' THEN iol.QtyEntered*bl.QtyBOM ELSE iol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered, uom.UOMSymbol, null, null, null, p.Name, -- main line b.Description, -- second line p.DocumentNote, -- third line p.UPC, p.SKU, p.Value AS ProductValue, iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, p.Description AS ProductDescription, p.ImageURL, iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID /*FROM M_Product_BOM b -- BOM lines INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y') INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID) LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID); */ FROM PP_Product_BOM b -- BOM lines INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y') INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID) INNER JOIN M_Product p ON (bl.M_Product_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID) LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID); CREATE OR REPLACE VIEW M_INOUT_LINE_VT (AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, M_INOUTLINE_ID, LINE, M_PRODUCT_ID, MOVEMENTQTY, QTYENTERED, UOMSYMBOL, QTYORDERED, QTYDELIVERED, QTYBACKORDERED, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, M_LOCATOR_ID, M_WAREHOUSE_ID, X, Y, Z, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE, PRODUCTDESCRIPTION, IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID) AS SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy, uom.AD_Language, iol.M_InOut_ID, iol.M_InOutLine_ID, iol.Line, p.M_Product_ID, CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.MovementQty END AS MovementQty, CASE WHEN iol.QtyEntered<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.QtyEntered END AS QtyEntered, CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, ol.QtyOrdered, ol.QtyDelivered, CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered-ol.QtyDelivered END AS QtyBackOrdered, COALESCE(COALESCE(pt.Name,p.Name)||productAttribute(iol.M_AttributeSetInstance_ID), c.Name, iol.Description) AS Name, -- main line CASE WHEN COALESCE(pt.Name,p.Name,c.Name) IS NOT NULL THEN iol.Description END AS Description, -- second line COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line p.UPC, p.SKU, p.Value AS ProductValue, iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, pt.Description AS ProductDescription, p.ImageURL, iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID FROM M_InOutLine iol INNER JOIN C_UOM_Trl uom ON (iol.C_UOM_ID=uom.C_UOM_ID) LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID) LEFT OUTER JOIN M_Product_Trl pt ON (iol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID) LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID) LEFT OUTER JOIN C_Charge c ON (iol.C_Charge_ID=c.C_Charge_ID) UNION SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy, uom.AD_Language, iol.M_InOut_ID, iol.M_InOutLine_ID, iol.Line+(bl.Line/100) AS Line, p.M_Product_ID, --iol.MovementQty*b.BOMQty AS QtyInvoiced, CASE WHEN bl.IsQtyPercentage = 'N' THEN iol.MovementQty*bl.QtyBOM ELSE iol.MovementQty*(bl.QtyBatch / 100) END AS QtyInvoiced, --iol.QtyEntered*b.BOMQty AS QtyEntered, CASE WHEN bl.IsQtyPercentage = 'N' THEN iol.QtyEntered*bl.QtyBOM ELSE iol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered, uom.UOMSymbol, null, null, null, COALESCE (pt.Name, p.Name) AS Name, -- main line b.Description, -- second line COALESCE (pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line p.UPC, p.SKU, p.Value AS ProductValue, iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, pt.Description AS ProductDescription, p.ImageURL, iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID /*FROM M_Product_BOM b -- BOM lines INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y') INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) INNER JOIN M_Product_Trl pt ON (iol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID);*/ FROM PP_Product_BOM b -- BOM lines INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID) INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y') INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID) INNER JOIN M_Product p ON (bl.M_Product_ID=p.M_Product_ID) -- BOM line product INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) INNER JOIN M_Product_Trl pt ON (iol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID); DROP FUNCTION bomqtyavailable(integer, integer, integer, integer); DROP FUNCTION bomqtyavailable(numeric, numeric, numeric, numeric); DROP FUNCTION bomqtyonhand(integer, integer, integer, integer); DROP FUNCTION bomqtyonhand(numeric, numeric, numeric, numeric); DROP FUNCTION bomqtyordered(integer, integer, integer, integer); DROP FUNCTION bomqtyordered(numeric, numeric, numeric, numeric); DROP FUNCTION bomqtyreserved(integer, integer, integer, integer); DROP FUNCTION bomqtyreserved(numeric, numeric, numeric, numeric);
-- 1) List the following details of each employee: employee number, -- last name, first name, sex, and salary. SELECT e.emp_no, e.last_name, e.first_name, e.sex, s.salary FROM employees as e JOIN salaries as s ON e.emp_no = s.emp_no; -- 2) List first name, last name, and hire date for employees who -- were hired in 1986. select first_name, last_name, hire_date from employees where hire_date >= '1986-01-01'; -- 3) List the manager of each department with the following -- information: department number, department name, the manager's -- employee number, last name, first name. select d.dept_no, d.dept_name, m.emp_no, e.last_name, e.first_name from departments as d join dept_manager as m on d.dept_no = m.dept_no join employees as e on m.emp_no = e.emp_no; -- 4) List the department of each employee with the following -- information: employee number, last name, first name, and -- department name. select e.emp_no, e.last_name, e.first_name, d.dept_name from employees as e join dept_emp as q on e.emp_no = q.emp_no join departments as d on q.dept_no = d.dept_no; -- 5) List first name, last name, and sex for employees whose first -- name is "Hercules" and last names begin with "B." select first_name, last_name, sex from employees where first_name = 'Hercules' and last_name like 'B%'; -- 6) List all employees in the Sales department, including their -- employee number, last name, first name, and department name. select e.emp_no, e.last_name, e.first_name, d.dept_name from employees as e join dept_emp as q on e.emp_no = q.emp_no join departments as d on q.dept_no = d.dept_no where d.dept_name = 'Sales' order by e.last_name, e.first_name; -- 7) List all employees in the Sales and Development departments, -- including their employee number, last name, first name, and -- department name. select e.emp_no, e.last_name, e.first_name, d.dept_name from employees as e join dept_emp as q on e.emp_no = q.emp_no join departments as d on q.dept_no = d.dept_no where d.dept_name = 'Sales' or d.dept_name = 'Development' order by e.last_name, e.first_name; -- 8) In descending order, list the frequency count of employee last -- names, i.e., how many employees share each last name. -- Instructions unclear... -- In order by last name: select last_name, count(last_name) from employees group by last_name order by last_name desc; -- In order by frequency: select last_name, count(last_name) from employees group by last_name order by count(last_name) desc;
-- --------------------------------------------------- -- RELATÓRIO - pessoas alugaram carros no último ano -- --------------------------------------------------- SELECT tipo, YEAR(data), COUNT(*) As Total FROM icar.pedido WHERE YEAR(data)='2020' AND tipo = 'Aluguel' GROUP BY YEAR(data);
-- MySQL Script generated by MySQL Workbench -- शनिबार 21 नवम्बर 2015 11:58:39 पूर्वाह्न NPT -- 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 NOC -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema NOC -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `NOC` DEFAULT CHARACTER SET utf8 ; USE `NOC` ; -- ----------------------------------------------------- -- Table `NOC`.`PetrolPumps` -- ----------------------------------------------------- DROP TABLE IF EXISTS `NOC`.`PetrolPumps` ; CREATE TABLE IF NOT EXISTS `NOC`.`PetrolPumps` ( `PetrolPumpsID` INT NOT NULL AUTO_INCREMENT, `Name` VARCHAR(1000) NOT NULL, `Capacity` INT(11) NOT NULL, `Location` VARCHAR(1000) NOT NULL, `GeoLocation` POINT NULL DEFAULT NULL, `Owner` VARCHAR(1000) NULL DEFAULT NULL, PRIMARY KEY (`PetrolPumpsID`), UNIQUE INDEX `PetrolPumpsID_UNIQUE` (`PetrolPumpsID` ASC)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT = 'This table contains petrolpumps and its related data.'; -- ----------------------------------------------------- -- Table `NOC`.`Distribution` -- ----------------------------------------------------- DROP TABLE IF EXISTS `NOC`.`Distribution` ; CREATE TABLE IF NOT EXISTS `NOC`.`Distribution` ( `DistributionID` INT NOT NULL AUTO_INCREMENT, `SentAmount` INT NOT NULL, `fk_PetrolPumpsID` INT NOT NULL, `AvailableDate` DATE NOT NULL, PRIMARY KEY (`DistributionID`), INDEX `fk_petrol_pumps_idx` (`fk_PetrolPumpsID` ASC), UNIQUE INDEX `DistributionID_UNIQUE` (`DistributionID` ASC), CONSTRAINT `fk_petrol_pumps` FOREIGN KEY (`fk_PetrolPumpsID`) REFERENCES `NOC`.`PetrolPumps` (`PetrolPumpsID`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `NOC`.`UserTokens` -- ----------------------------------------------------- DROP TABLE IF EXISTS `NOC`.`UserTokens` ; CREATE TABLE IF NOT EXISTS `NOC`.`UserTokens` ( `UserTokensID` INT NOT NULL AUTO_INCREMENT, `BillBookID` VARCHAR(45) NOT NULL, `Token` VARCHAR(45) NOT NULL, `fk_PetrolPumpsID` INT NOT NULL, `UserName` VARCHAR(1000) NOT NULL, `PhoneNumber` INT NOT NULL, `FuelType` VARCHAR(45) NOT NULL, `VehicleType` VARCHAR(45) NOT NULL, `VehicleID` VARCHAR(45) NOT NULL, PRIMARY KEY (`UserTokensID`), INDEX `fk_PetrolPumpsID_idx` (`fk_PetrolPumpsID` ASC), UNIQUE INDEX `UserTokensID_UNIQUE` (`UserTokensID` ASC), CONSTRAINT `fk_PetrolPumpsID` FOREIGN KEY (`fk_PetrolPumpsID`) REFERENCES `NOC`.`PetrolPumps` (`PetrolPumpsID`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; -- ----------------------------------------------------- -- Data for table `NOC`.`PetrolPumps` -- ----------------------------------------------------- START TRANSACTION; USE `NOC`; INSERT INTO `NOC`.`PetrolPumps` (`PetrolPumpsID`, `Name`, `Capacity`, `Location`, `GeoLocation`, `Owner`) VALUES (2, 'Namaste Fuel Center', 20000, 'Satdobato', NULL, 'Ram Gopal'); INSERT INTO `NOC`.`PetrolPumps` (`PetrolPumpsID`, `Name`, `Capacity`, `Location`, `GeoLocation`, `Owner`) VALUES (3, 'Koteshwor Fuel Center', 30000, 'Halchowk', NULL, 'Shyam Basyal'); INSERT INTO `NOC`.`PetrolPumps` (`PetrolPumpsID`, `Name`, `Capacity`, `Location`, `GeoLocation`, `Owner`) VALUES (4, 'Nata petrol pump', 10000, 'Gongabu', NULL, 'Sita Nepal'); INSERT INTO `NOC`.`PetrolPumps` (`PetrolPumpsID`, `Name`, `Capacity`, `Location`, `GeoLocation`, `Owner`) VALUES (1, 'Hello Petrol Pump', 10000, '', NULL, 'Hari Jai'); COMMIT; -- ----------------------------------------------------- -- Data for table `NOC`.`UserTokens` -- ----------------------------------------------------- START TRANSACTION; USE `NOC`; INSERT INTO `NOC`.`UserTokens` (`UserTokensID`, `BillBookID`, `Token`, `fk_PetrolPumpsID`, `UserName`, `PhoneNumber`, `FuelType`, `VehicleType`, `VehicleID`) VALUES (1, '23424324', '323452', 1, 'Shaym Bhakt Tripathi', 984957465, 'Petrol', 'car', 'ba 2 kha 3423'); INSERT INTO `NOC`.`UserTokens` (`UserTokensID`, `BillBookID`, `Token`, `fk_PetrolPumpsID`, `UserName`, `PhoneNumber`, `FuelType`, `VehicleType`, `VehicleID`) VALUES (2, '3423423423', '233333', 1, 'Ram Gopal ', 985235689, 'Diesel', 'car', 'ba 4 kha 3422'); INSERT INTO `NOC`.`UserTokens` (`UserTokensID`, `BillBookID`, `Token`, `fk_PetrolPumpsID`, `UserName`, `PhoneNumber`, `FuelType`, `VehicleType`, `VehicleID`) VALUES (3, '342532', '46456', 2, 'Laxmi Sni', 984568458, 'Petrol', 'Scoter', 'ba 32 kha 3453'); INSERT INTO `NOC`.`UserTokens` (`UserTokensID`, `BillBookID`, `Token`, `fk_PetrolPumpsID`, `UserName`, `PhoneNumber`, `FuelType`, `VehicleType`, `VehicleID`) VALUES (4, '23453245', '453563', 3, 'Hira lal', 984568452, 'Petrol', 'Bike', 'ga 34 kha 342'); INSERT INTO `NOC`.`UserTokens` (`UserTokensID`, `BillBookID`, `Token`, `fk_PetrolPumpsID`, `UserName`, `PhoneNumber`, `FuelType`, `VehicleType`, `VehicleID`) VALUES (5, '546345', '45643', 1, 'Nitesh Kumar', 342423523, 'Petrol', 'Bike', 'ma 2 kha 3432'); INSERT INTO `NOC`.`UserTokens` (`UserTokensID`, `BillBookID`, `Token`, `fk_PetrolPumpsID`, `UserName`, `PhoneNumber`, `FuelType`, `VehicleType`, `VehicleID`) VALUES (6, '34522435', '45564', 2, 'Hera Kumar', 984323432, 'Diesel', 'car', 'ba 4 kha 43543'); COMMIT;
CREATE TABLE "Tasks" ( "id" serial NOT NULL, "activity" VARCHAR(255) NOT NULL, CONSTRAINT "Users_pk" PRIMARY KEY ("id") ) WITH ( OIDS=FALSE );
/* Создание процедуры выполнения тестового кода */ CREATE PROCEDURE /*PREFIX*/CODE_TEST ( ACCOUNT_ID VARCHAR(32), IN_MESSAGE_ID VARCHAR(32) ) AS DECLARE CONTACT VARCHAR(100); DECLARE CODE VARCHAR(100); BEGIN SELECT IM.CONTACT, CM.CODE FROM /*PREFIX*/IN_MESSAGES IM LEFT JOIN /*PREFIX*/CODE_MESSAGES CM ON CM.CODE_MESSAGE_ID=IM.CODE_MESSAGE_ID WHERE IN_MESSAGE_ID=:IN_MESSAGE_ID INTO :CONTACT, :CODE; IF ((CONTACT IS NOT NULL) AND (CODE IS NOT NULL)) THEN BEGIN INSERT INTO /*PREFIX*/OUT_MESSAGES (OUT_MESSAGE_ID,CREATOR_ID,RECIPIENT_ID,DATE_CREATE, TEXT_OUT,DATE_OUT,TYPE_MESSAGE,CONTACT,DESCRIPTION, PRIORITY,LOCKED) VALUES (/*PREFIX*/GET_UNIQUE_ID(),:ACCOUNT_ID,NULL,CURRENT_TIMESTAMP, 'Это ответ через очередь на запрос: '||:CODE,NULL,0,:CONTACT,NULL,0,NULL); END END -- /* Фиксация изменений */ COMMIT
-- PROPAGANDAS NO SITE DE DIVULGACAO DAS FESTAS -- BANDAS QUE VAO TOCAR SELECT BANDA, HORA, DATA FROM SHOW_BANDA -- DJ QUE VAO TOCAR SELECT DJ, HORA, DATA FROM SHOW_DJ -- BEBIDAS DISPONIVEIS NA FESTA SELECT NOME FROM BEBIDA WHERE NOME IS NOT NULL -- COMIDAS DISPONIVEIS NA FESTA (NAO EXIBIR OS VALORES NULL) SELECT NOME FROM COMIDA WHERE NOME IS NOT NULL --- CLIENTES --- --CLIENTE E TOTAL GASTO SELECT cliente.nome, cliente.cpf, comanda.valor_total FROM ( SELECT nome, cpf FROM cliente) cliente JOIN ( SELECT valor_total, cpf_cliente FROM comanda) comanda ON comanda.cpf_cliente = cliente.cpf --CLIENTE E TOTAL GASTO EM DIA ESPECIFICO (TROCAR DATA, POSSIBILIDADE DE FAZER QUERY DINAMICA) SELECT cliente.nome, cliente.cpf, comanda.valor_total FROM ( SELECT nome, cpf FROM cliente) cliente JOIN ( SELECT valor_total, cpf_cliente FROM comanda WHERE dia_festa = '2018-12-01') comanda ON comanda.cpf_cliente = cliente.cpf --LISTAR TODAS AS FANTASIAS ALUGADAS SELECT fantasia.nome FROM ( SELECT nome, codigo_barras FROM fantasia) fantasia JOIN ( SELECT aluguel.codigo_fantasia FROM ( SELECT codigo_fantasia, codigo FROM aluguel) aluguel JOIN ( SELECT codigo FROM comanda) comanda ON comanda.codigo = aluguel.codigo ) aluguel_comanda ON fantasia.codigo_barras = aluguel_comanda.codigo_fantasia -- LISTAR TODAS AS FANTASIAS ALUGADAS E O RESPECTIVO CLIENTE SELECT fantasia.nome, aluguel_comanda_cliente.nome FROM ( SELECT nome, codigo_barras FROM fantasia) fantasia JOIN ( SELECT aluguel.codigo_fantasia, comanda_cliente.nome FROM ( SELECT codigo_fantasia, codigo FROM aluguel) aluguel JOIN ( SELECT comanda.codigo, cliente.nome FROM ( SELECT codigo, cpf_cliente FROM comanda) comanda JOIN ( SELECT nome, cpf FROM cliente) cliente ON cliente.cpf = comanda.cpf_cliente) comanda_cliente ON comanda_cliente.codigo = aluguel.codigo) aluguel_comanda_cliente ON fantasia.codigo_barras = aluguel_comanda_cliente.codigo_fantasia --VALOR TOTAL DAS COMANDAS DE CADA FESTA SELECT festa.dia AS dia, festa.tipo AS tipo, SUM(comanda.valor_total) AS valor_total FROM ( SELECT dia, tipo FROM festa) festa JOIN ( SELECT dia_festa, valor_total FROM comanda) comanda ON comanda.dia_festa = festa.dia GROUP BY dia, tipo --- BEBIDAS --- --VE BEBIDA QUE MAIS VENDEU, PEGA O NOME, RESOLVE PARA EMPATE SELECT bebida.nome, cod_max.vendas FROM (SELECT venda.codigo_barras, venda.vendas FROM ( SELECT MAX(VENDAS) as vendas FROM ( SELECT COUNT(codigo_barras) AS vendas,codigo_barras FROM venda_bebida group by codigo_barras) venda) maximo INNER JOIN ( SELECT COUNT(codigo_barras) AS vendas,codigo_barras FROM venda_bebida group by codigo_barras) venda ON venda.vendas = maximo.vendas) cod_max JOIN ( SELECT nome, codigo_barras FROM bebida ) bebida ON cod_max.codigo_barras = bebida.codigo_barras --VALOR TOTAL DE VENDAS DE BEBIDA EM UM DETERMINADO BAR, EM DETERMINADA FESTA SELECT festa.dia AS dia, festa.tipo AS tipo, SUM(venda_bebida.valor_total) AS valor_total FROM ( SELECT dia, tipo FROM festa WHERE dia = '2018-12-01') festa JOIN ( SELECT dia, valor_total, nro_balcao FROM venda_bebida WHERE nro_balcao = '1') venda_bebida ON venda_bebida.dia = festa.dia GROUP BY festa.dia, tipo --QUANTO CADA BEBIDA VENDEU E QUANTAS VEZES FOI VENDIDA SELECT bebida.nome, venda.vendas FROM ( SELECT nome, codigo_barras FROM bebida) bebida JOIN ( SELECT COUNT(codigo_barras) AS vendas,codigo_barras FROM venda_bebida group by codigo_barras) venda on venda.codigo_barras = bebida.codigo_barras --- PROPRIETARIOS --- --LISTAR PROPRIETARIOS E SEUS FOOD TRUCKS SELECT proprietario.nome AS Prorietario, f.nome AS Food_Truck FROM ( SELECT cpf, nome FROM proprietario) proprietario LEFT JOIN ( SELECT proprietario, nome FROM food_truck) f ON proprietario.cpf = f.proprietario --- FUNCIONÁRIOS ---
ALTER TABLE event RENAME COLUMN image_base_64 TO image_base64; ALTER TABLE event_image RENAME COLUMN image_base_64 TO image_base64; ALTER TABLE game RENAME COLUMN image_base_64 TO image_base64; ALTER TABLE "group" RENAME COLUMN image_base_64 TO image_base64; ALTER TABLE "user" RENAME COLUMN image_base_64 TO image_base64; ALTER TABLE stock_profile_image RENAME COLUMN image_base_64 TO image_base64;
-- John Gnanasekaran -- Lab3 -- createview.sql -- Create a view called ManyFollowers CREATE VIEW ManyFollowers(userId, numberOfFollowers) AS SELECT f.userId, Count(f.userID) FROM chirpFollowers f, chirpUsers u -- Dont count followers if their name is 'Voldemort' or 'Malfoy' WHERE u.userName <> 'Malfoy' AND u.userName <> 'Voldemort' AND f.userId = u.userId -- Group by each of the follower IDs GROUP BY f.userId -- Only include if the user has at least 3 followers HAVING count(f.userID) >= 3;
CREATE TABLE `compose_namespace` ( `id` BIGINT(20) UNSIGNED NOT NULL, `name` VARCHAR(64) NOT NULL COMMENT 'Name', `slug` VARCHAR(64) NOT NULL COMMENT 'URL slug', `enabled` BOOLEAN NOT NULL COMMENT 'Is namespace enabled?', `meta` JSON NOT NULL COMMENT 'Meta data', `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` DATETIME DEFAULT NULL, `deleted_at` DATETIME DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE DATABASE IF NOT EXISTS `db_empresa` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; USE `db_empresa`; -- MySQL dump 10.13 Distrib 8.0.26, for Win64 (x86_64) -- -- Host: localhost Database: db_empresa -- ------------------------------------------------------ -- Server version 8.0.26 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!50503 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `clientes` -- DROP TABLE IF EXISTS `clientes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `clientes` ( `id_clientes` int NOT NULL AUTO_INCREMENT, `nit` varchar(9) DEFAULT NULL, `nombres` varchar(60) DEFAULT NULL, `apellidos` varchar(60) DEFAULT NULL, `direccion` varchar(100) DEFAULT NULL, `telefono` varchar(8) DEFAULT NULL, `fecha_nacimiento` date DEFAULT NULL, `id_puesto` smallint NOT NULL, PRIMARY KEY (`id_clientes`), KEY `id_puesto` (`id_puesto`), CONSTRAINT `id_puesto` FOREIGN KEY (`id_puesto`) REFERENCES `puestos` (`id_puesto`) ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `clientes` -- LOCK TABLES `clientes` WRITE; /*!40000 ALTER TABLE `clientes` DISABLE KEYS */; INSERT INTO `clientes` VALUES (1,'119416','Manfred','Sirin ','Guatemala','565656','1997-02-02',2),(2,'767095','Jose','Ramirez','Guatemala','515919','1994-02-02',2),(3,'9898','Manuel','Lopez','Guatemala','58015779','1997-02-02',2),(4,'1000','Paco','Perez','Mixco','35224357','1997-01-01',1),(5,'959595','keynes','Sirin','Guatemala','35224357','1997-02-02',1),(7,'1111','Daniel','Casillas','Antigua Guatemala','999999','1990-01-01',1),(8,'55555','Gerson','Ajtun','chimal','11111','1994-02-02',1),(10,'55555','vicor','lopez','tejar','11111','1994-02-02',1),(11,'55555','LUCAS','lopez','tejar','2111','1994-02-02',1),(12,'55555','LUCAS','lopez','tejar','2111','1994-02-02',1),(13,'4258','Ma','Est','Chimaltenango','425823','1999-02-02',1); /*!40000 ALTER TABLE `clientes` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `empleados` -- DROP TABLE IF EXISTS `empleados`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `empleados` ( `id_empleado` int NOT NULL AUTO_INCREMENT, `codigo` varchar(20) DEFAULT NULL, `nombres` varchar(60) DEFAULT NULL, `apellidos` varchar(60) DEFAULT NULL, `direccion` varchar(100) DEFAULT NULL, `telefono` varchar(8) DEFAULT NULL, `fecha_nacimiento` date DEFAULT NULL, `id_puesto` smallint DEFAULT NULL, PRIMARY KEY (`id_empleado`), KEY `id_puesto_puesto_empleados_idx` (`id_puesto`), CONSTRAINT `id_puesto_puesto_empleados` FOREIGN KEY (`id_puesto`) REFERENCES `puestos` (`id_puesto`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `empleados` -- LOCK TABLES `empleados` WRITE; /*!40000 ALTER TABLE `empleados` DISABLE KEYS */; INSERT INTO `empleados` VALUES (1,'A80','Felipe','Fernandez','Guatemala','580157','1999-01-01',1),(2,'A85','Ana','Gonzalez','Mixco','58015779','1994-08-24',2); /*!40000 ALTER TABLE `empleados` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `puestos` -- DROP TABLE IF EXISTS `puestos`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `puestos` ( `id_puesto` smallint NOT NULL AUTO_INCREMENT, `puesto` varchar(40) DEFAULT NULL, PRIMARY KEY (`id_puesto`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `puestos` -- LOCK TABLES `puestos` WRITE; /*!40000 ALTER TABLE `puestos` DISABLE KEYS */; INSERT INTO `puestos` VALUES (1,'programador'),(2,'adminstrador'); /*!40000 ALTER TABLE `puestos` 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 2021-09-01 22:22:04
/* Name: Amount of user registrations by date Data source: 4 Created By: Admin Last Update At: 2016-02-11T20:30:52.941901+00:00 */ SELECT COUNT(*) AS Registrations, FROM (SELECT post_prop23 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 1=1 /*post_page_event = "0" /*PageView Calls*/ AND post_prop23 = "User Registration" /* Counting registrations */ AND DATE(date_time) >= DATE('{{startdate}}') AND DATE(date_time) <= DATE('{{enddate}}') )L
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jul 12, 2021 at 01:46 AM -- Server version: 10.1.38-MariaDB -- PHP Version: 5.6.40 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: `travsim` -- -- -------------------------------------------------------- -- -- Table structure for table `orders` -- CREATE TABLE `orders` ( `simID` int(11) NOT NULL, `customerID` int(11) NOT NULL, `deliveryAddress` varchar(50) NOT NULL, `orderID` int(11) NOT NULL, `status` varchar(50) NOT NULL DEFAULT 'Pending', `createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `orders` -- INSERT INTO `orders` (`simID`, `customerID`, `deliveryAddress`, `orderID`, `status`, `createdAt`) VALUES (1, 1, '59 South Road', 1, 'Processing', '2021-07-09 12:08:58'), (2, 2, '60 North Ave', 2, 'Processing', '2021-07-09 14:11:39'), (3, 3, '61 South Ave', 3, 'Processing', '2021-07-10 17:01:50'), (4, 4, '62 West Ave', 4, 'Pending', '2021-07-11 06:56:49'), (5, 5, '01 Main Road', 5, 'Pending', '2021-07-11 06:59:07'), (6, 6, '02 Second Road', 6, 'Pending', '2021-07-11 07:00:27'), (7, 7, '03 Third Road', 7, 'Pending', '2021-07-11 08:03:13'), (8, 8, '04 Fourth Road', 8, 'Pending', '2021-07-11 08:04:04'), (9, 9, '05 Fifth Road', 9, 'Pending', '2021-07-11 08:11:58'), (10, 10, '06 Sixth Road', 10, 'Pending', '2021-07-11 09:31:50'), (11, 11, '07 Seventh Road', 11, 'Pending', '2021-07-11 09:35:18'), (12, 12, '08 Eighth Road', 12, 'Pending', '2021-07-11 09:37:08'), (13, 13, '09 Ninth Road', 13, 'Pending', '2021-07-11 09:38:36'), (14, 14, '10 My Str', 14, 'Pending', '2021-07-11 09:51:55'), (15, 15, '11 Your Str', 15, 'Pending', '2021-07-11 09:53:02'), (16, 16, '12 Theirs Str', 16, 'Pending', '2021-07-11 10:04:34'); -- -------------------------------------------------------- -- -- Table structure for table `sim_cards` -- CREATE TABLE `sim_cards` ( `simID` int(11) NOT NULL, `name` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `sim_cards` -- INSERT INTO `sim_cards` (`simID`, `name`) VALUES (1, 'Unique Name'), (2, 'Unique namw 2'); -- -- Indexes for dumped tables -- -- -- Indexes for table `orders` -- ALTER TABLE `orders` ADD PRIMARY KEY (`orderID`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `orders` -- ALTER TABLE `orders` MODIFY `orderID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; 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 table test (sub varchar(255), service varchar(255),start_ts timestamp,end_ts timestamp,status varchar(255)); insert into test values ('Ally','CRM','8/3/2015'::timestamp,null,'Active'); insert into test values ('Ally','Salesforce','10/10/2015'::timestamp,null,'Active'); insert into test values ('Alan','CRM','9/1/2015'::timestamp,'10/31/2015'::timestamp,'Expired'); insert into test values ('Scott','CRM','9/10/2015'::timestamp,'12/31/2015'::timestamp,'Suspended'); insert into test values ('Stanley','Salesforce','8/2/2015'::timestamp,'12/31/2015'::timestamp,'Active'); WITH months(mon) AS ( SELECT DATE_TRUNC('month',ts::DATE) as month FROM (SELECT '01/01/2015'::TIMESTAMP as tm UNION SELECT '01/01/2016'::TIMESTAMP as tm) as t TIMESERIES ts as '1 Month' OVER (ORDER BY tm)) select mon,count(case when service = 'CRM' then 1 else 0 end) as CRM FROM (select * from test JOIN months ON (months.mon between test.start_ts and COALESCE(end_ts,'01/01/2016'::DATE))) foo group by mon; WITH months(mon) AS ( SELECT DATE_TRUNC('month',ts::DATE) as month FROM (SELECT '01/01/2015'::TIMESTAMP as tm UNION SELECT '01/01/2016'::TIMESTAMP as tm) as t TIMESERIES ts as '1 Month' OVER (ORDER BY tm)) select mon,service, count(*) as CRM FROM (select * from test JOIN months ON (months.mon between DATE_TRUNC('month',test.start_ts) and COALESCE(end_ts,'01/01/2016'::DATE))) foo group by mon,service ORDER BY service,mon; SELECT st,service ,TS_FIRST_VALUE(start_ts),TS_LAST_VALUE(end_ts) FROM test TIMESERIES st AS '1 month' OVER (partition by service order by start_ts) select TIME_SLICE(start_ts,1,'month'),service,count(*) OVER (partition by service order by month(start_ts)) from test; select MONTH(start_ts) sm,MONTH(COALESCE(end_ts,now())) em,service from test;
CREATE DATABASE notice; CREATE TABLE notice_details( notice_id SERIAL PRIMARY KEY, notice_poster VARCHAR(100), notice_text VARCHAR(255), hostel_name VARCHAR(10), expiry_dare DATE date_fetched DATE );
/* Navicat MySQL Data Transfer Source Server : localhost Source Server Version : 50712 Source Host : localhost:3306 Source Database : picas Target Server Type : MYSQL Target Server Version : 50712 File Encoding : 65001 Date: 2017-03-21 17:50:28 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for sys_log -- ---------------------------- DROP TABLE IF EXISTS `sys_log`; CREATE TABLE `sys_log` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_date` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, `modify_date` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, `account` varchar(255) DEFAULT NULL, `action` varchar(255) DEFAULT NULL, `ip` varchar(255) DEFAULT NULL, `log_time` datetime DEFAULT NULL, `parameters` varchar(255) DEFAULT NULL, `res` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of sys_log -- ---------------------------- -- ---------------------------- -- Table structure for sys_resource -- ---------------------------- DROP TABLE IF EXISTS `sys_resource`; CREATE TABLE `sys_resource` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, `modify_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, `resource_type` int(11) NOT NULL DEFAULT '0' COMMENT '资源类型 - 0: 菜单 1: 按钮', `name` varchar(200) NOT NULL, `href` varchar(200) DEFAULT NULL, `order_no` int(11) DEFAULT NULL, `description` varchar(200) DEFAULT NULL, `parent_id` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `FK3fekum3ead5klp7y4lckn5ohi` (`parent_id`), CONSTRAINT `FK3fekum3ead5klp7y4lckn5ohi` FOREIGN KEY (`parent_id`) REFERENCES `sys_resource` (`id`) ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of sys_resource -- ---------------------------- INSERT INTO `sys_resource` VALUES ('1', '2017-03-15 17:07:45', '2017-03-15 17:07:46', '0', '系统管理', '#', '0', '系统管理', null); INSERT INTO `sys_resource` VALUES ('2', '2017-03-16 15:34:37', '2017-03-16 15:34:37', '0', '权限管理', '#', '0', '权限管理', '1'); INSERT INTO `sys_resource` VALUES ('3', '2017-03-09 16:52:22', '2017-03-20 17:10:25', '0', '用户管理', '/admin/user/list', '0', '用户管理', '2'); INSERT INTO `sys_resource` VALUES ('4', '2017-03-10 16:15:22', '2017-03-10 16:15:25', '0', '角色管理', '/admin/role/list', '0', '角色管理', '2'); INSERT INTO `sys_resource` VALUES ('5', '2017-03-15 09:55:29', '2017-03-15 09:55:29', '0', '菜单管理', '/admin/menu/list', '0', '菜单管理', '2'); INSERT INTO `sys_resource` VALUES ('6', '2017-03-15 14:31:17', '2017-03-15 14:31:17', '0', '测试1', '#', '0', '测试1', '1'); INSERT INTO `sys_resource` VALUES ('7', '2017-03-16 09:43:36', '2017-03-16 09:43:36', '0', '测试2', '#', '0', '测试2', '6'); INSERT INTO `sys_resource` VALUES ('10', '2017-03-16 09:45:18', '2017-03-16 09:45:19', '0', '测试3', '#', '0', '测试3', '6'); INSERT INTO `sys_resource` VALUES ('11', '2017-03-20 15:58:35', '2017-03-20 15:58:35', '0', '功能管理', '/admin/permission/list', '0', '管理系统的操作功能点', '2'); INSERT INTO `sys_resource` VALUES ('22', '2017-03-16 14:56:07', '2017-03-16 14:56:07', '1', '新增角色', '/admin/role/save', '0', '新增角色', '4'); INSERT INTO `sys_resource` VALUES ('23', '2017-03-16 15:36:09', '2017-03-16 15:36:09', '1', '编辑角色', '/admin/role/update', '0', '编辑角色', '4'); INSERT INTO `sys_resource` VALUES ('24', '2017-03-16 15:36:32', '2017-03-16 15:36:32', '1', '删除角色', '/admin/role/delete', '0', '删除角色', '4'); INSERT INTO `sys_resource` VALUES ('25', '2017-03-20 15:59:08', '2017-03-20 15:59:09', '1', '新增菜单', '/admin/menu/save', '0', '新增菜单', '5'); INSERT INTO `sys_resource` VALUES ('26', '2017-03-17 17:23:05', '2017-03-17 17:23:05', '1', '编辑菜单', '/admin/menu/update', '0', '编辑菜单', '5'); INSERT INTO `sys_resource` VALUES ('27', '2017-03-16 15:37:41', '2017-03-16 15:37:41', '1', '删除菜单', '/admin/menu/delete', '0', '删除菜单', '5'); INSERT INTO `sys_resource` VALUES ('28', '2017-03-16 15:39:57', '2017-03-16 15:39:58', '1', '新增操作', '/admin/permission/save', '0', '新增操作', '11'); INSERT INTO `sys_resource` VALUES ('29', '2017-03-16 15:38:19', '2017-03-16 15:38:19', '1', '编辑操作', '/admin/permission/update', '0', '编辑操作', '11'); INSERT INTO `sys_resource` VALUES ('30', '2017-03-16 15:38:40', '2017-03-16 15:38:40', '1', '删除操作', '/admin/permission/delete', '0', '删除操作', '11'); INSERT INTO `sys_resource` VALUES ('31', '2017-03-21 14:35:01', '2017-03-21 14:35:01', '1', '新增用户', '/admin/user/save', '0', '', '3'); INSERT INTO `sys_resource` VALUES ('32', '2017-03-21 14:35:17', '2017-03-21 14:35:17', '1', '编辑用户', '/admin/user/update', '0', '', '3'); INSERT INTO `sys_resource` VALUES ('33', '2017-03-21 14:35:31', '2017-03-21 14:35:31', '1', '删除用户', '/admin/user/delete', '0', '', '3'); INSERT INTO `sys_resource` VALUES ('34', '2017-03-21 15:03:45', '2017-03-21 15:03:45', '1', 'a1', '/admin/a1', '0', '', '7'); -- ---------------------------- -- Table structure for sys_role -- ---------------------------- DROP TABLE IF EXISTS `sys_role`; CREATE TABLE `sys_role` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modify_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, `name` varchar(255) NOT NULL, `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态: 0-启用 1-禁用', `description` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of sys_role -- ---------------------------- INSERT INTO `sys_role` VALUES ('1', '2017-03-15 15:40:03', '2017-03-15 15:40:04', '系统管理员', '0', '系统管理员,拥有系统超级权限'); INSERT INTO `sys_role` VALUES ('4', '2017-03-15 16:04:10', '2017-03-15 16:04:11', '角色1', '0', '角色1'); INSERT INTO `sys_role` VALUES ('5', '2017-03-15 15:56:44', '2017-03-15 15:56:44', '角色3', '0', '角色3'); INSERT INTO `sys_role` VALUES ('6', '2017-03-15 16:34:12', '2017-03-15 16:34:13', '角色2', '0', '角色2'); INSERT INTO `sys_role` VALUES ('7', '2017-03-15 16:04:07', '2017-03-15 16:04:08', '角色4', '0', '角色4'); INSERT INTO `sys_role` VALUES ('8', '2017-03-16 14:55:08', '2017-03-16 14:55:08', '角色5', '0', '角色3'); INSERT INTO `sys_role` VALUES ('9', '2017-03-16 14:56:35', '2017-03-16 14:56:35', '角色6', '0', '角色6'); INSERT INTO `sys_role` VALUES ('10', '2017-03-21 11:56:38', '2017-03-21 11:56:38', '角色7', '0', '角色7'); INSERT INTO `sys_role` VALUES ('11', '2017-03-21 14:53:36', '2017-03-21 14:53:37', '角色8', '0', '角色8'); -- ---------------------------- -- Table structure for sys_role_resource -- ---------------------------- DROP TABLE IF EXISTS `sys_role_resource`; CREATE TABLE `sys_role_resource` ( `role_id` bigint(20) NOT NULL, `resource_id` bigint(20) NOT NULL, PRIMARY KEY (`role_id`,`resource_id`), KEY `FKkj7e3cva1e2s3nsd0yghpbsnk` (`resource_id`), CONSTRAINT `FK7urjh5xeujvp29nihwbs5b9kr` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`) ON UPDATE NO ACTION, CONSTRAINT `FKkj7e3cva1e2s3nsd0yghpbsnk` FOREIGN KEY (`resource_id`) REFERENCES `sys_resource` (`id`) ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of sys_role_resource -- ---------------------------- INSERT INTO `sys_role_resource` VALUES ('1', '1'); INSERT INTO `sys_role_resource` VALUES ('4', '1'); INSERT INTO `sys_role_resource` VALUES ('5', '1'); INSERT INTO `sys_role_resource` VALUES ('6', '1'); INSERT INTO `sys_role_resource` VALUES ('7', '1'); INSERT INTO `sys_role_resource` VALUES ('8', '1'); INSERT INTO `sys_role_resource` VALUES ('9', '1'); INSERT INTO `sys_role_resource` VALUES ('1', '2'); INSERT INTO `sys_role_resource` VALUES ('1', '3'); INSERT INTO `sys_role_resource` VALUES ('1', '4'); INSERT INTO `sys_role_resource` VALUES ('1', '5'); INSERT INTO `sys_role_resource` VALUES ('4', '6'); INSERT INTO `sys_role_resource` VALUES ('5', '6'); INSERT INTO `sys_role_resource` VALUES ('6', '6'); INSERT INTO `sys_role_resource` VALUES ('7', '6'); INSERT INTO `sys_role_resource` VALUES ('8', '6'); INSERT INTO `sys_role_resource` VALUES ('9', '6'); INSERT INTO `sys_role_resource` VALUES ('6', '7'); INSERT INTO `sys_role_resource` VALUES ('8', '7'); INSERT INTO `sys_role_resource` VALUES ('9', '7'); INSERT INTO `sys_role_resource` VALUES ('6', '10'); INSERT INTO `sys_role_resource` VALUES ('8', '10'); INSERT INTO `sys_role_resource` VALUES ('9', '10'); INSERT INTO `sys_role_resource` VALUES ('1', '11'); INSERT INTO `sys_role_resource` VALUES ('1', '22'); INSERT INTO `sys_role_resource` VALUES ('1', '23'); INSERT INTO `sys_role_resource` VALUES ('1', '24'); INSERT INTO `sys_role_resource` VALUES ('1', '25'); INSERT INTO `sys_role_resource` VALUES ('1', '26'); INSERT INTO `sys_role_resource` VALUES ('1', '27'); INSERT INTO `sys_role_resource` VALUES ('1', '28'); INSERT INTO `sys_role_resource` VALUES ('1', '29'); INSERT INTO `sys_role_resource` VALUES ('1', '30'); INSERT INTO `sys_role_resource` VALUES ('1', '31'); INSERT INTO `sys_role_resource` VALUES ('1', '32'); INSERT INTO `sys_role_resource` VALUES ('1', '33'); -- ---------------------------- -- Table structure for sys_user -- ---------------------------- DROP TABLE IF EXISTS `sys_user`; CREATE TABLE `sys_user` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_date` datetime NOT NULL, `modify_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, `username` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `status` int(11) NOT NULL COMMENT '用户状态 - 0: 启用 1禁用', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of sys_user -- ---------------------------- INSERT INTO `sys_user` VALUES ('1', '2017-02-23 15:34:52', '2017-03-21 17:06:12', 'admin', 'admin', '874904507@qq.com', 'e3ceb5881a0a1fdaad01296d7554868d', '0'); -- ---------------------------- -- Table structure for sys_user_role -- ---------------------------- DROP TABLE IF EXISTS `sys_user_role`; CREATE TABLE `sys_user_role` ( `user_id` bigint(20) NOT NULL, `role_id` bigint(20) NOT NULL, PRIMARY KEY (`user_id`,`role_id`), KEY `FKhh52n8vd4ny9ff4x9fb8v65qx` (`role_id`), CONSTRAINT `FKb40xxfch70f5qnyfw8yme1n1s` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`id`) ON UPDATE NO ACTION, CONSTRAINT `FKhh52n8vd4ny9ff4x9fb8v65qx` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`) ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of sys_user_role -- ---------------------------- INSERT INTO `sys_user_role` VALUES ('1', '1');
Create Procedure mERP_sp_GetRecdRptProcessCfgInfo AS Select IsNull(RecdID,0) from tbl_merp_RecdRptTrackerConfigAbs where IsNull(Status,0) = 0
--SET SHOWPLAN_TEXT OFF; SET STATISTICS IO ON; SELECT ADEP, ARSC, SUBSTRING(PART,1,8) MOLD, COALESCE(AVMAJG, AWMAJG) MAJG, NWPLNT, NWFSYY, NWFSPP, SUM(CASE ACTN WHEN 'CPG' THEN PQTY ELSE 0 END) CPG, SUM(CASE ACTN WHEN 'CPS' THEN PQTY ELSE 0 END) CPS FROM FANALYSISP.DBO.FFPDGLR1 INNER JOIN FANALYSIS.LGDAT.RPRH ON NWBTID = BTID LEFT OUTER JOIN FANALYSIS.LGDAT.STKMM ON AVPART = PART LEFT OUTER JOIN FANALYSIS.LGDAT.STKMP ON AWPART = PART WHERE /* ( ( NWFSYY = 16 AND NWFSPP >= 3 ) OR ( NWFSYY =17 AND NWFSPP < 3 ) ) */ NWFSYY >= 16 AND ACTN IN ('CPG','CPS') GROUP BY ADEP, ARSC, SUBSTRING(PART,1,8), COALESCE(AVMAJG, AWMAJG), NWPLNT, NWFSYY, NWFSPP
--MODULE CHALLENGE --Create table SELECT ce.emp_no, ce.first_name, ce.last_name, titles.title, salaries.from_date, salaries.salary INTO number_of_titles_retiring FROM salaries RIGHT JOIN titles ON (salaries.emp_no = titles.emp_no) INNER JOIN current_emp AS ce ON (ce.emp_no = salaries.emp_no); --Exclude the rows of data containing duplicate titles SELECT notr.emp_no, notr.first_name, notr.last_name, COUNT(*) AS CNT FROM number_of_titles_retiring as notr GROUP BY notr.emp_no, notr.first_name, notr.last_name HAVING COUNT(*) > 1; --Delete duplicate rows WITH cte as (SELECT emp_no, first_name, last_name, from_date, title, ROW_NUMBER() OVER (PARTITION BY (first_name, last_name) ORDER BY from_date DESC) rn FROM number_of_titles_retiring ) SELECT emp_no, first_name, last_name, from_date, title INTO updated_number_of_titles_retiring FROM cte tp WHERE rn = 1 ORDER BY emp_no --Who’s Ready for a Mentor? SELECT emp.emp_no, emp.first_name, emp.last_name, emp.hire_date, tit.to_date, tit.title, emp.birth_date INTO ready_to_mentor FROM employees as emp LEFT JOIN titles as tit ON (emp.emp_no = tit.emp_no) LEFT JOIN dept_emp as de ON emp.emp_no = de.emp_no WHERE (tit.to_date = '9999-01-01') AND (emp.birth_date BETWEEN '1965-01-01' AND '1965-12-31') ORDER BY emp_no
/* 업로드 파일 데이터를 추가 9-1. 등록된 '게시물1'에 첨부된 파일리스트를 출력하는 쿼리문을 작성하세요. 9-2. 'asdf' 회원이 'A 카페'에 등록한 첨부 파일 리스트를 출력하는 쿼리문을 작성하세요. */ SELECT upload_filename FROM upload WHERE upload_board_no = 1; SELECT upload_filename FROM upload JOIN board on upload_board_no = board_no WHERE board_writer = 'asdf' and board_cafe_name='강아지 키우기';
DROP TABLE IF EXISTS gender_sought; CREATE TABLE gender_sought( value SMALLINT PRIMARY KEY, property VARCHAR(30) NOT NULL ); INSERT INTO gender_sought (value, property) VALUES (1, 'Male'); INSERT INTO gender_sought (value, property) VALUES (2, 'Female');
-- (a) select a.num_sucursal as 'sucursal', a.ciudad, a.calle, a.cp, a.num_tel1 as 'Numero telefonico 1', a.num_tel2 as 'Numero telefonico 2' , a.num_tel3 as 'Numero telefonico 3', concat(b.nombre,' ',b.ap_paterno,' ',b.ap_materno) as 'director' from sucursales a join(personal b join directores c on b.num_empl=c.num_empl) on a.num_sucursal=c.num_sucursal where ciudad='Glasgow'; -- (b) select count(*) as 'numero de sucursales en Glasgow' from sucursales where ciudad='Glasgow'; -- (c) contando al director de la empresa como un empleado (select a.nombre,a.ap_paterno,a.ap_materno, a.cat_laboral, a.salario from personal a join directores b on a.num_empl = b.num_empl where b.num_sucursal='B003') union all (select c.nombre,c.ap_paterno,c.ap_materno, c.cat_laboral, c.salario from personal c join empleados d on c.num_empl = d.num_empl where d.num_sucursal='B003' ) order by ap_paterno; -- (d) select count(*) as'Numero de trabajadores es la sucursal B003' , sum(salario)as'Total de salarios' from ( (select a.nombre,a.ap_paterno,a.ap_materno, a.cat_laboral, a.salario from personal a join directores b on a.num_empl = b.num_empl where b.num_sucursal='B003') union all (select c.nombre,c.ap_paterno,c.ap_materno, c.cat_laboral, c.salario from personal c join empleados d on c.num_empl = d.num_empl where d.num_sucursal='B003' ) ) as s; -- (e) select count(*) as'Numero de trabajadores es la sucursal B003' , sum(salario)as'Total de salarios' from ( (select a.nombre,a.ap_paterno,a.ap_materno, a.cat_laboral, a.salario from personal a join directores b on a.num_empl = b.num_empl where b.num_sucursal='B003') union all (select c.nombre,c.ap_paterno,c.ap_materno, c.cat_laboral, c.salario from personal c join empleados d on c.num_empl = d.num_empl where d.num_sucursal='B003' ) ) as s; select e.cat_laboral as 'categoiria laboral', count(e.num_empl) as 'numero de empleados' from empleados e join sucursales s on e.num_sucursal=s.num_sucursal;
select *from Towns order by Name; select *from Departments order by Name ; select * from Employees order by Salary desc;
Create Function MakeDayEnd (@Date as datetime) Returns DateTime As Begin Set @Date = DateAdd(hh, 23, @Date) Set @Date = DateAdd(mi, 59, @Date) Set @Date = DateAdd(ss, 59, @Date) Return @Date End
-- fans -- select origin by metal SELECT origin ,SUM(fans) as nb_fans FROM metal_bands GROUP BY origin ORDER BY nb_fans DESC;
-- Jun 26, 2008 9:57:54 AM EST -- Default comment for updating dictionary UPDATE AD_Tab SET TabLevel=1,Updated=TO_TIMESTAMP('2008-06-26 09:57:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53030 ; -- Jun 26, 2008 9:58:19 AM EST -- Default comment for updating dictionary UPDATE AD_Tab SET TabLevel=1,Updated=TO_TIMESTAMP('2008-06-26 09:58:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53033 ; -- Jun 26, 2008 9:58:28 AM EST -- Default comment for updating dictionary UPDATE AD_Tab SET TabLevel=1,Updated=TO_TIMESTAMP('2008-06-26 09:58:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53031 ; -- Jun 26, 2008 9:58:36 AM EST -- Default comment for updating dictionary UPDATE AD_Tab SET TabLevel=1,Updated=TO_TIMESTAMP('2008-06-26 09:58:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53034 ; -- Jun 26, 2008 9:58:43 AM EST -- Default comment for updating dictionary UPDATE AD_Tab SET AD_Column_ID=3668,Updated=TO_TIMESTAMP('2008-06-26 09:58:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53034 ; -- Jun 26, 2008 10:00:40 AM EST -- Default comment for updating dictionary UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=53523 ; -- Jun 26, 2008 10:00:40 AM EST -- Default comment for updating dictionary UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=53522 ; -- Jun 26, 2008 10:00:40 AM EST -- Default comment for updating dictionary UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=53525 ; -- Jun 26, 2008 10:00:40 AM EST -- Default comment for updating dictionary UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=53524 ; -- Jun 26, 2008 10:03:16 AM EST -- Default comment for updating dictionary UPDATE AD_Field SET IsSameLine='N',Updated=TO_TIMESTAMP('2008-06-26 10:03:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53526 ;
SELECT webapi_person_create ( '{ "dni":39642511, "name":"Martin", "surname":"Torrents", "nationality":"Argentino", "birthday":"26/04/1996", "gender":"Masculino" }' ); SELECT webapi_contact_information_create ( '{ "person_id":39642511, "mobile_phone":"11-5988-0377", "phone":"11-3980-1282", "email":"martin.torrents35@gmail.com", "address":"vidal 3424" }' );
use dwd; create table if not exists dwd.dwd_order_fees(apply_no string comment '订单编号' , fee_summary_product_term string comment '产品期限' , fee_summary_is_same_bank string comment '是否同行' , fee_summary_premium_summary double comment '汇总保费' , fee_summary_premium_payment_party string comment '保费缴纳方' , fee_summary_remove_insurance_time string comment '解保时间' , fee_summary_net_income_amount double comment '大道净收入(元)' , fee_summary_service_fee_amount double comment '大道服务费' , fee_summary_service_payment_party string comment '服务费缴纳方' , fee_summary_total_amount double comment '缴费金额合计(元)' , fee_summary_payment_way string comment '收费方式' , fee_summary_has_invoice string comment '有无专票(0无1有)' , fee_summary_price_tag string comment '价格标签' , fee_summary_remark string comment '费用备注' , fee_summary_create_user_id string comment '创建人id' , fee_summary_update_user_id string comment '更新人id' , fee_summary_create_time string comment '记录创建时间' , fee_summary_update_time string comment '记录更新时间' , fee_summary_rev bigint comment '版本号' , fee_summary_delete_flag string comment '记录删除标识(1删除0有效记录)' , fee_summary_turnover_amount double comment '周转金额' , fee_summary_borrowing_amount double comment '借款金额' , fee_summary_ransom_borrow_amount double comment '赎楼金额' , fee_summary_own_fund_amount double comment '卖方自有资金' , fee_summary_refund_source string comment '还款来源' , fee_summary_borrowing_value_date string comment '借款起息日' , fee_summary_borrowing_due_date string comment '借款到期日' , fee_summary_platform_due_date string comment '平台到期日' , fee_summary_platform_value_date string comment '平台起息日' , fee_summary_show_due_date string comment '展示到期日' , fee_summary_fund_use_date_num bigint comment '资金实质使用天数' , fee_summary_contract_rate double comment '合同费率' , fee_summary_contract_rate_total double comment '合同费率合计' , fee_summary_floor_price_rate double comment '底价费率' , fee_summary_floor_price_rate_total double comment '底价费率合计' , fee_summary_fixed_term bigint comment '固定期限' , fee_summary_product_term_and_charge_way string comment '产品期限及收费方式选择' , fee_summary_rabate_rate double comment '返佣率' , fee_summary_rate double comment '费率' , fee_summary_approve_amount double comment '审批金额(真融宝)' , fee_summary_pre_ransom_borrow_amount double comment '预计借款(赎楼)' , fee_summary_pre_use_amount_date string comment '预计用款时间' , fee_summary_guarantee_amount double comment '保障金额(元)' , fee_summary_down_payment_amount double comment '买方首付款金额(元)' , fee_summary_risk_grade string comment '风险等级' , fee_summary_end_bearing string comment '头尾计息(0否1是)' , fee_summary_use_amount_date string comment '用款时间' , fee_summary_random_pay_mode string comment '赎楼款支付方式' , fee_summary_tail_pay_mode string comment '尾款支付方式' , fee_summary_tail_account_type string comment '尾款收款账户类型' , fee_summary_seller_account_type string comment '卖方收款账户类型' , fee_summary_tail_amount double comment '尾款金额' , fee_summary_expect_use_time string comment '客户预计用款时间' , fee_summary_price_discount string comment '定价折扣' , fee_summary_risk_coefficient string comment '风险系数' , fee_summary_expect_cust_pay_day string comment '预计借款回款日(客户)' , cust_charge_base_yushou double comment '逾收基础收费(元)' , cust_charge_return_commission_yushou double comment '逾收返佣(元)' , cust_charge_append_service_charge_yushou double comment '逾收附加服务费(元)' , cust_charge_collection_charge_yushou double comment '逾收代收费用(元)' , cust_charge_overdue_penalty_yushou double comment '逾收过期罚款(元)' , cust_charge_total_yushou double comment '逾收合计(上述之和)' , cust_charge_create_user_id_yushou string comment '逾收创建人id' , cust_charge_update_user_id_yushou string comment '逾收更新人id' , cust_charge_create_time_yushou string comment '逾收记录创建时间' , cust_charge_update_time_yushou string comment '逾收记录更新时间' , cust_charge_base_yingshou double comment '应收基础收费(元)' , cust_charge_return_commission_yingshou double comment '应收返佣(元)' , cust_charge_append_service_charge_yingshou double comment '应收附加服务费(元)' , cust_charge_collection_charge_yingshou double comment '应收代收费用' , cust_charge_overdue_penalty_yingshou double comment '应收过期罚款(元)' , cust_charge_total_yingshou double comment '应收合计(上述之和)' , cust_charge_create_user_id_yingshou string comment '应收创建人id' , cust_charge_update_user_id_yingshou string comment '应收更新人id' , cust_charge_create_time_yingshou string comment '应收记录创建时间' , cust_charge_update_time_yingshou string comment '应收记录更新时间' , cust_charge_base_yb_tuifei double comment '应补退费基础收费(元)' , cust_charge_return_commission_yb_tuifei double comment '应补退费返佣(元)' , cust_charge_append_service_charge_yb_tuifei double comment '应补退费附加服务费(元)' , cust_charge_collection_charge_yb_tuifei double comment '应补退费代收费用' , cust_charge_overdue_penalty_yb_tuifei double comment '应补退费过期罚款(元)' , cust_charge_total_yb_tuifei double comment '应补退费合计(上述之和)' , cust_charge_create_user_id_yb_tuifei string comment '应补退费创建人id' , cust_charge_update_user_id_yb_tuifei string comment '应补退费更新人id' , cust_charge_create_time_yb_tuifei string comment '应补退费记录创建时间' , cust_charge_update_time_yb_tuifei string comment '应补退费记录更新时间' , cust_charge_base_sb_tuifei double comment '实补基础收费(元)' , cust_charge_return_commission_sb_tuifei double comment '实补返佣(元)' , cust_charge_append_service_charge_sb_tuifei double comment '实补附加服务费(元)' , cust_charge_collection_charge_sb_tuifei double comment '实补代收费用' , cust_charge_overdue_penalty_sb_tuifei double comment '实补过期罚款(元)' , cust_charge_total_sb_tuifei double comment '实补合计(上述之和)' , cust_charge_create_user_id_sb_tuifei string comment '实补创建人id' , cust_charge_update_user_id_sb_tuifei string comment '实补更新人id' , cust_charge_create_time_sb_tuifei string comment '实补记录创建时间' , cust_charge_update_time_sb_tuifei string comment '实补记录更新时间' , return_capital double comment '本金(元)' , return_loan_interest double comment '借款利率(元)' , return_platform_charge double comment '平台费(元)' , return_penalty_advanced_refund double comment '罚息_提前还款(元)' , return_penalty_overdue double comment '罚息_逾期(元)' , return_penalty_show_time double comment '罚息_展期(元)' , return_create_user_id string comment '创建人id' , return_update_user_id string comment '更新人id' , return_create_time string comment '记录创建时间' , return_update_time string comment '记录更新时间' ) row format delimited fields terminated by '\t' location '/user/hive/warehouse/ods_dwd_dwd_order_fees'; create table if not exists dwd.dwd_order_record_options(record_id string comment '事项id' , record_apply_no string comment '订单编号' , record_house_no string comment '事项房产编号' , record_create_user_id string comment '事项创建人id' , record_update_user_id string comment '事项更新人id' , record_rev bigint comment '事项版本号' , record_matter_key string comment '事项的key' , record_matter_name string comment '事项的名字' , proc_task_key_ string comment '流程任务定义kEY' , proc_task_name_ string comment '流程任务名称' , record_relate_type string comment '事项关联类型' , record_relate_id string comment '事项任务关联流程ID' , record_status_ string comment '事项任务状态' , record_read_ string comment '事项是否已读 0未读1已读' , record_create_time string comment '事项创建时间' , record_handle_time string comment '事项处理时间' , record_handle_user_id string comment '事项处理人' , record_handle_user_name string comment '事项处理人名字' , proc_qualfieds_ string comment '流程有审批资格用户id串' , proc_qualfied_names_ string comment '流程有审批资格用户名称串' , proc_auditor_ string comment '流程执行人id' , proc_auditor_name_ string comment '流程执行人名' , proc_opinion_ string comment '流程审批意见' , proc_status_ string comment '流程审批状态。START-发起流程AWAITING_CHECK-待审批AGREE-同意AGAINST-反对RETURN-驳回ABANDON-弃权RETRIEVE-追回' , record_assignee_id_ string comment '事项捞单人' , record_accept_time string comment '事项到达时间' , record_due_time string comment '事项到期时间' , record_remark string comment '事项任务备注' , record_data_ string comment '事项数据' , record_from_key string comment '事项表单来源的key(事项产生器的key)' , record_from_name string comment '事项表单来源的名字' , record_operator_location string comment '事项操作者经纬度' , record_operator_address string comment '事项操作人所在地址' , record_operator_device string comment '事项处理设备 例如Computer Tablet' , record_next_matter_key string comment '事项下一办理事项' , record_next_handle_time string comment '事项下一事项办理时间' , record_node_remark string comment '事项备注信息' , proc_id_ string comment '意见id' , proc_def_id_ string comment '流程定义id' , proc_sup_inst_id_ string comment '父流程实例id' , proc_inst_id_ string comment '流程实例id' , proc_task_id_ string comment '流程任务id' , proc_token_ string comment '流程任务令牌' , proc_form_def_id_ string comment '流程表单定义id' , proc_form_name_ string comment '流程表单名' , proc_create_time_ string comment '流程执行开始时间' , proc_assign_time_ string comment '流程任务分配用户时间' , proc_complete_time_ string comment '流程结束时间' , proc_dur_ms_ bigint comment '流程持续时间(MS)' , proc_files_ string comment '附件' , proc_interpose_ bigint comment '是否干预' , proc_support_mobile_ string comment '支持手机端' ) row format delimited fields terminated by '\t' location '/user/hive/warehouse/ods_dwd_dwd_order_record_options'; create table if not exists dwd.dwd_orders(apply_no string comment '订单编号' , create_time string comment '订单创建时间' , update_time string comment '订单更新时间' , apply_time string comment '订单申请时间' , house_no string comment '房产信息编号关联房产信息' , product_id string comment '产品ID' , product_name string comment '产品名字' , service_type string comment '业务类型(加盟商业务JMS)' , partner_bank_id string comment '合作银行id' , partner_bank_name string comment '合作银行名称' , partner_insurance_id string comment '合作保险公司id' , partner_insurance_name string comment '合作保险公司名称' , new_loan_bank_name string comment '新贷款银行名称' , new_loan_bank_code string comment '新贷款银行编号' , city_no string comment '城市编码' , city_name string comment '城市名称' , channel string comment '录单渠道' , sales_user_id string comment '渠道经理用户ID' , sales_user_name string comment '渠道经理姓名' , branch_id string comment '大道分公司编号' , branch_name string comment '大道分公司名' , sales_branch_id string comment '市场部机构编号' , flow_instance_id string comment '流程实例id' , apply_status string comment '订单状态' , order_create_user_id string comment '订单创建人id' , order_create_username string comment '订单创建人名' , order_update_user_id string comment '订单更新人id' , order_update_username string comment '订单更新人' , seller_user string comment '卖家姓名' , seller_phone string comment '卖家电话' , order_seller_card_no string comment '卖方身份证号' , seller_card_type string comment '证件类型' , buyer_name string comment '买家姓名' , buyer_phone string comment '买家电话' , order_emark string comment '订单备注' , thirdparty_name string comment '第三方公司名字' , thirdparty_no string comment '第三方申请编号' , preliminary_result string comment '预审结果' , follow_up_userid string comment '跟进人员ID' , follow_up_username string comment '跟进人员名称' , relate_type string comment '订单关联生成关系' , relate_apply_no string comment '关联的订单号' , group_apply_no string comment '关联在一起的订单同属一个分组' , man_check_first string comment '是否先审批(Y先审批后面签N先面签后审批)' , project_tag string comment '项目标识' , rob_user_id string comment '抢单用户id' , rob_time string comment '抢单时间' , rob_user_name string comment '抢单用户名称' , green_channel string comment '绿色通道(0不是1是)' , matter_sort bigint comment '事项排序字段' , query_part_type string comment '查询阶段类型0待面签1待放款2已放款' , version string comment '流程版本号' , matter_version bigint comment '事项的流程版本' , fee_summary_is_same_bank string comment '是否同行' , fee_summary_premium_summary double comment '汇总保费' , fee_summary_premium_payment_party string comment '保费缴纳方' , fee_summary_remove_insurance_time string comment '解保时间' , fee_summary_net_income_amount double comment '大道净收入(元)' , fee_summary_service_fee_amount double comment '大道服务费' , fee_summary_service_payment_party string comment '服务费缴纳方' , fee_summary_total_amount double comment '缴费金额合计(元)' , fee_summary_payment_way string comment '收费方式' , fee_summary_has_invoice string comment '有无专票(0无1有)' , fee_summary_price_tag string comment '价格标签' , fee_summary_remark string comment '产品费用备注' , fee_summary_create_user_id string comment '创建人id' , fee_summary_create_username string comment '产品费用创建人' , fee_summary_update_user_id string comment '更新人id' , fee_summary_update_username string comment '产品费用更新人' , fee_summary_turnover_amount double comment '周转金额' , fee_summary_borrowing_amount double comment '借款金额' , fee_summary_ransom_borrow_amount double comment '赎楼金额' , fee_summary_own_fund_amount double comment '卖方自有资金' , fee_summary_refund_source string comment '还款来源' , fee_summary_borrowing_value_date string comment '借款起息日' , fee_summary_borrowing_due_date string comment '借款到期日' , fee_summary_platform_due_date string comment '平台到期日' , fee_summary_platform_value_date string comment '平台起息日' , fee_summary_show_due_date string comment '展示到期日' , fee_summary_fund_use_date_num bigint comment '资金实质使用天数' , fee_summary_contract_rate double comment '合同费率' , fee_summary_contract_rate_total double comment '合同费率合计' , fee_summary_floor_price_rate double comment '底价费率' , fee_summary_floor_price_rate_total double comment '底价费率合计' , fee_summary_fixed_term bigint comment '固定期限' , fee_summary_product_term_and_charge_way string comment '产品期限及收费方式选择' , fee_summary_rabate_rate double comment '返佣率' , fee_summary_rate double comment '费率' , fee_summary_approve_amount double comment '审批金额(真融宝)' , fee_summary_pre_ransom_borrow_amount double comment '预计借款(赎楼)' , fee_summary_pre_use_amount_date string comment '预计用款时间' , fee_summary_guarantee_amount double comment '保障金额(元)' , fee_summary_down_payment_amount double comment '买方首付款金额(元)' , fee_summary_risk_grade string comment '风险等级' , fee_summary_end_bearing string comment '头尾计息(0否1是)' , fee_summary_use_amount_date string comment '用款时间' , fee_summary_random_pay_mode string comment '赎楼款支付方式' , fee_summary_tail_pay_mode string comment '尾款支付方式' , fee_summary_tail_account_type string comment '尾款收款账户类型' , fee_summary_seller_account_type string comment '卖方收款账户类型' , fee_summary_tail_amount double comment '尾款金额' , fee_summary_expect_use_time string comment '客户预计用款时间' , fee_summary_price_discount string comment '定价折扣' , fee_summary_risk_coefficient string comment '风险系数' , fee_summary_expect_cust_pay_day string comment '预计借款回款日(客户)' , fee_summary_product_term string comment '产品期限' , house_area string comment '所在区域' , house_address string comment '房产地址(坐落)' , is_loan_flag string comment '有无原贷款信息标识有Y没N' , ori_loan_bank_name string comment '原贷款银行名称' , ori_loan_bank_code string comment '原贷款银行编号' , ori_repay_method string comment '还款扣款方式预存自动扣款AUT柜台办理即时扣款DSK柜台办理系统批量扣款BAT' , busi_deduct_principal_balance double comment '商贷本金余额(元)' , pre_fine_amount double comment '预计罚息(元)' , deduct_date_interval string comment '扣款时间段' , ori_bank_user string comment '银行联系人' , ori_bank_phone string comment '联系方式' , glk_bank_name string comment '供楼卡开户行名称' , glk_bank_code string comment '供楼卡开户行编号' , glk_account_user_name string comment '供楼卡户名' , glk_account_user_no string comment '供楼卡户主编号' , glk_account_no string comment '供楼卡卡号' , fund_loan_flag string comment '是否有公积金贷款标识有Y没N' , fund_deduct_balance double comment '公积金贷款本金余额(元)' , fund_repay_user string comment '公积金还款联系人' , fund_repay_user_phone string comment '公积金还款联系人联系电话' , pre_ransom_date string comment '预计赎楼时间' , loan_remark string comment '原贷款备注' , first_mortgage_amount double comment '一押本金余额(元)' , has_second_mortgage string comment '是否为二押(Y是N否)' , is_prestore string comment '是否预存' , prestore_day string comment '预存天数' , ransom_repayment_start_date timestamp comment '赎楼还款开始日期' , ransom_repayment_end_date timestamp comment '赎楼还款结束日期' , is_relation_loan string comment '是否有关联贷款Y是N否' , loan_balance_total double comment '贷款余额合计(元)商贷余额+公积金贷款余额+关联贷款余额' , relation_loan_balance double comment '关联贷款余额(元)' , pre_provident_fund_loan_amount double comment '预计公积金贷款金额' , amount_regulation_code string comment '资金监管协议编号' , ori_borrower_type string comment '原贷款借款人类型(个人公司)' , ori_loan_payee string comment '原贷款借款人' , ori_other_non_bank string comment '其他非银机构' , new_house_no string comment '房产信息编号关联房产信息' , new_bank_email string comment '银行联系邮箱' , new_bank_address string comment '银行地址' , new_bank_user string comment '银行联系人' , new_bank_phone string comment '联系方式' , new_loan_terms string comment '贷款期数' , new_term_unit string comment '期限单位;D天;M月;Y年' , new_seller_card_no string comment '借款人身份证号码' , new_seller_name string comment '借款人姓名' , new_biz_loan_amount double comment '商业贷款金额(元)' , new_loan_rate double comment '贷款利率' , new_rate_multiply double comment '利率倍数' , new_repay_method_loan string comment '还款方式等额本金DEBJ等额利息DELX' , new_is_release string comment '状态类型01-可放款' , new_is_regulation_flag string comment '是否有监管有Y没N' , new_first_regulation_bank_name string comment '首期监管款银行' , new_first_regulation_bank_code string comment '首期监管款银行编号' , new_first_regulation_bank_account string comment '首期监管款账户' , new_first_regulation_amount double comment '首期监管款金额(元)' , new_serial_no string comment '额度协议编号' , new_currency string comment '币种' , new_business_sum double comment '名义金额' , new_contract_no string comment '合同流水号zyb' , new_borrow_cont_no string comment '借款合同编号' , new_max_mortgage_no string comment '最高额抵押合同编号' , new_start_time string comment '超始日' , new_end_time string comment 'ENDTIME' , new_provident_fund_loan_amount double comment '公积金贷款金额' , new_have_new_loan string comment '有无新贷款信息' , new_is_need_mortgage string comment '是否需我司办理按揭' , new_is_pay_type_check string comment '新贷款是否已核实回款来源' , new_loan_type string comment '贷款类型(对应字典dklx)' , new_natural_rate_code string comment '基准利率代码' , new_natural_float_type string comment '利率浮动方式(对应字典llfdfs)' , new_provident_fund_center string comment '贷款公积金中心' , natural_float_value double comment '利率浮动值' , new_loan_customer string comment '客户经理' , new_loan_customer_tel string comment '客户经理联系方式' , new_loan_fund_center string comment '贷款公积金中心' , new_loan_guaranty string comment '担保方式' , new_fund_rate double comment '公积金贷款利率' , new_fund_loan_terms string comment '公积金贷款期限' , new_fund_term_unit string comment '公积金期限单位;D天;M月;Y年' , new_has_fund_supervision string comment '是否已做资金监管?(Y是N否)' , new_supervision_time string comment '预计监管时间' , new_supervision_agreement_get_time string comment '监管协议领取时间' , new_borrower_type string comment '新贷款借款人类型(1个人2公司)' , new_transfer_loan_cause string comment '转贷动机(1利率2还款方式3期限4额度)' , new_third_type string comment '第三方类型(个人公司)' , new_is_have_fund_loan string comment '是否有公积金贷款(Y是N否)' , new_third_payee string comment '新贷款借款人' , new_other_non_bank string comment '其他非银机构' , new_agree_loan_type string comment '同贷类型;字典AgreeLoanType' , new_agree_loan_source string comment '同贷来源;字典AgreeLoanSource' , new_agree_loan_other_remark string comment '同贷其他来源备注' , new_revolving_credit_flag string comment '是否循环授信贷款1表示是0表示否' , new_apply_withdraw_amount double comment '申请取款金额(元)' , channel_name string comment '渠道名称' , channel_type string comment '渠道类型' , channel_contact string comment '联络人' , channel_phone string comment '渠道电话' , channel_rebate_man string comment '返佣人' , channel_rebate_bank_id string comment '返佣开户行id' , channel_rebate_bank string comment '返佣开户行' , channel_rebate_card_no string comment '返佣账号' , channel_tag string comment '渠道标签' , channel_rebate_account_type string comment '返佣账户类型(对应字典项fyzhlx)' , channel_rebate_type string comment '返佣类型' , chanel_remark string comment '渠道备注' , channel_tag_v3 string comment '渠道标签_v3' , deal_no string comment '交易合同编号' , deal_trading_price double comment '成交价(元)' , deal_earnest_money double comment '交易定金(元)' , deal_first_payment_paid double comment '已付首付款(元)' , deal_first_payment_unpaid double comment '未付首付款(元)' , deal_handing_room_deposit double comment '交房押金(元)' , deal_remark string comment '交易信息备注' , deal_actual_trading_price double comment '实际成交价' , deal_create_user_id string comment '交易创建人id' , deal_create_username string comment '交易创建人名' , deal_update_user_id string comment '更新人id' , deal_update_username string comment '交易更新人名' , deal_down_payment double comment '首付款金额' , deal_transfer_price double comment '过户(网签)价格' , con_source_funds string comment '资金来源' , con_funds_time string comment '确认资金到账时间' , con_funds_cost string comment '确认资金到账金额' , con_plat_date string comment '确认到账平台起息日' , con_plat_expire string comment '确认资金到账平台到期日' , con_payee_acct string comment '确认资金到账收款方' , con_payee_acct_no string comment '确认资金到账收款卡号' , con_payee_acct_name string comment '确认资金到账收款户名' , con_funds_deal string comment '确认资金到账交易明细id' , con_exec_times bigint comment '确认资金到账任务执行次数' , con_payee_bank string comment '确认资金到账收款开户行' , con_plat_arrival string comment '平台款是否到账' , con_plat_source_funds string comment '平台款资金来源' , con_plat_arrival_time string comment '平台款到账时间' , con_plat_recei_acct_no string comment '平台收款账户' , con_plat_recei_acct_name string comment '平台收款账户户名' , con_plat_recei_bank_name string comment '平台收款账户开户行' , con_plat_interest_date string comment '平台起息日' , con_plat_rest_date string comment '平台到期日' , con_plat_arriva_money double comment '平台款到账金额' , con_plat_arrival_deal string comment '平台款到账交易明细id' , con_ad_pay_time string comment '赎楼前垫资回款时间' , con_ad_pay_cost double comment '赎楼前垫资回款金额' , con_ad_pay_deal string comment '赎楼前垫资回款交易明细id' , con_transfer_deal string comment '资金划拨申请交易明细id' , con_advance_cost double comment '垫资金额' , con_fact_pay_source string comment '实际回款来源' , con_loan_pay_day string comment '借款回款日' , con_re_arrival_deal string comment '回款到账交易明细id' , con_cust_pay_day string comment '客户回款日' , con_cust_re_source string comment '客户回款来源' , con_cust_exec_times bigint comment '客户回款执行次数' , con_cust_re_deal string comment '客户回款交易明细id' , con_should_re_capital double comment '应还本金(平台)' , con_fact_re_capital double comment '实还本金' , con_should_re_interest double comment '应还利息' , con_fact_re_interest double comment '实际还利息' , con_should_re_penalty double comment '应还罚息' , con_penalty_overdue double comment '罚息—逾期(元)' , con_penalty_show_time double comment '罚息—展期(元)' , con_penalty_advanced_refund double comment '罚息—提前还款(元)' , con_fact_re_penalty double comment '实还罚息' , con_should_plat_cost double comment '应还平台费' , con_fact_plat_cost double comment '实还平台费' , con_should_re_sum double comment '应还合计' , con_fact_re_sum double comment '实还合计' , con_re_deal string comment '归还申请交易明细id' , con_plat_rece_path string comment '平台回款路径' , con_principal_trans_id string comment '本息划拨申请交易id' , con_trans_flow_id string comment '划拨流程实例id' , con_return_flow_id string comment '归还流程实例id' , con_parent_flow_id string comment '父流程实例id' , con_cust_should_re_capital double comment '本息划应还本金' , con_cust_fact_re_capital double comment '本息划拨实还本金' , con_cust_should_re_interest double comment '本息划拨应还利息' , con_cust_fact_re_interest double comment '本息划拨实还利息' , con_cust_should_re_penalty double comment '本息划拨应还罚息' , con_cust_fact_re_penalty double comment '本息划拨实还罚息' , con_cust_should_plat_cost double comment '本息划拨应还平台费' , con_cust_fact_plat_cost double comment '本息划拨实还平台费' , con_cust_should_re_sum double comment '本息划拨应还合计' , con_cust_fact_re_sum double comment '本息划拨实还合计' , con_plat_recei_acct string comment '平台收款方' , con_payee_acct_last string comment '确认资金到账上一次收款方' , con_deal_time string comment '交易时间' , con_bank_number string comment '银行流水号' , con_count_head_tail string comment '费用算头尾方式(suanTouBuSuanWei算头不算尾suanTouSuanWei算头算尾)' , con_is_need_internal string comment '是否需要内部转款(资金归还场景的内部转款)' , con_internal_trans_id string comment '内部转款的交易id' , ransom_house_no string comment '赎楼房产信息编号关联房产信息' , ransom_is_hold_cert string comment '业主是否持证' , ransom_is_already_ransom string comment '是否已预约赎楼' , ransom_borrow_amount double comment '赎楼借款金额' , ransom_own_fund_amount double comment '卖方自有资金' , ransom_cut_amount double comment '赎楼扣款金额' , ransom_cut_time string comment '赎楼扣款时间' , ransom_loan_rate string comment '赎楼贷款利率' , ransom_loan_terms string comment '赎楼贷款期限(月)' , ransom_repay_method string comment '赎楼贷款还款方式' , ransom_borrow_cont_no string comment '赎楼贷款借款合同编号' , ransom_bank_user string comment '赎楼贷款银行联系人' , ransom_bank_phone string comment '赎楼贷款联系方式' , ransom_seller_name string comment '赎楼贷款借款人姓名' , ransom_seller_card_no string comment '赎楼贷款身份证号码' , ransom_remark string comment '赎楼备注' , ransom_has_ransom_floor string comment '是否有赎楼(Y/N)' , ransom_has_qzjzxcl string comment '是否需要取证及注销材料(Y/N)' , ransom_qzjzxcl_phone string comment '取注销资料电话' , ransom_qzjzxcl_bank string comment '取注销资料银行总行' , ransom_qzjzxcl_bank_code string comment '取注销资料银行总行编码' , ransom_qzjzxcl_branch_bank string comment '取注销资料银行分行' , ransom_qzjzxcl_branch_bank_code string comment '取注销资料银行分行编码' , ransom_predict_qzjzxcl_time string comment '预计取注销资料时间' , ransom_qzjzxcl_time string comment '取注销资料时间' , ransom_qzjzxcl_linkman string comment '取注销资料联系人' , ransom_flag string comment '赎楼状态' , ransom_fail_reason string comment '赎楼失败原因' , ransom_pre_ransom_next_time string comment '预计下次赎楼时间' , ransom_amount_back_flag string comment '赎楼资金是否划回' , ransom_amout_back double comment '赎楼划回金额' , ransom_get_cancel_material_address string comment '取注销(后)资料地点' , ransom_is_company_cancel string comment '是否由我司办理注销抵押(Y是N否)' , ransom_is_company_get_material string comment '是否由我司领取注销抵押(后)资料' ) row format delimited fields terminated by '\t' location '/user/hive/warehouse/ods_dwd_dwd_orders'; create table if not exists dwd.order_credit_risks(id string comment '主键id' , apply_no string comment '订单编号' , customer_no string comment '客户编号' , customer_name string comment '客户姓名' , credit_type string comment '征信类型' , parse_time string comment '解析时间' , parse_ret_time string comment '解析完成时间' , credit_channel string comment '征信获取方式' , report_no string comment '征信报告编号' , report_from string comment '征信报告来源' , parse_way string comment '解析方式' , credit_status string comment '征信状态' , task_id string comment '唯一任务标识(半刻查询结果使用)' , cache_flag string comment '是否走了缓存,未向机构发起解析请求(Y:本次解析走缓存N:本次解析未走缓存)' , operate_user_id string comment '操作人员id' , operate_user_name string comment '操作人员姓名' , manual_credit_query_date string comment '征信查询日期' , manual_credit_name string comment '姓名' , manual_is_sensitive_career string comment '是否为敏感职业' , manual_cert_type string comment '证件类型' , manual_cert_no string comment '证件号码' , manual_query_times_month3 bigint comment '近3月查询次数' , manual_query_times_month12 bigint comment '近12月查询次数' , manual_m2_overdue_has string comment '近3月有无M2以上逾期' , manual_m2_overdue_name string comment '近3月M2以上逾期信贷名称' , manual_m4_overdue_has string comment '近12月有无M4以上逾期' , manual_m4_overdue_name string comment '近12月M4以上逾期信贷名称' , manual_month12_overdue_time bigint comment '近12月逾期次数' , manual_month12_overdue_name string comment '近12月逾期信贷名称' , manual_month6_overdue_time bigint comment '近6月逾期次数' , manual_month6_overdue_name string comment '近6月逾期信贷名称' , manual_dgz_has string comment '近24月有无“D/G/Z”' , manual_dgz_name string comment '近24月“D/G/Z”信贷名称' , manual_loan_status_json string comment '贷款状态列表JSON:贷款名称,贷款账户状态,五级分类情况' , manual_loan_end_date_json string comment '贷款到期列表JSON:贷款名称,到期日,本金余额' , manual_account_info_json string comment '准/贷记卡账户信息列表JSON:名称,账户状态,当前预期次数' , manual_guarantee_info_json string comment '担保信息列表JSON:编号,本金余额,五级分类' , manual_new_loan_has string comment '有无新增无抵/质押贷款' , manual_new_loan_count bigint comment '新增无抵/质押贷款合计笔数' , manual_new_loan_amount double comment '新增无抵/质押贷款合计金额' , manual_card_use_amount double comment '(准)贷记卡使用金额' , manual_card_credit_line double comment '(准)贷记卡总授信金额' , manual_overdraft70_percent double comment '是否超过70百分比' , manual_credit_total_amount double comment '无抵/质押贷款余额' , manual_loan_use_limit double comment '贷记卡使用额度' , manual_loan_overdue_amount double comment '准贷记卡透支余额' , manual_remark string comment '备注' , create_user_id string comment '创建人id' , update_user_id string comment '更新人id' , create_time string comment '记录创建时间' , update_time string comment '记录更新时间' , credit_num bigint comment '上传数量' , credit_modify_time string comment '最后上传时间' , credit_operate_user string comment '最后上传征信操作人' , business_work_unit string comment '工商工作单位' , business_query_time string comment '工商查询时间' , business_is_self_employed string comment '工商是否为自雇人士' , business_self_employed_type string comment '工商自雇人士类型' , business_query_result string comment '工商查询结果' , business_query_user_id string comment '工商查询人id' , business_query_user_name string comment '工商查询姓名' , business_business_remark string comment '工商备注' , business_create_user_id string comment '工商创建人id' , business_update_user_id string comment '工商更新人id' , business_create_time string comment '工商记录创建时间' , business_update_time string comment '工商记录更新时间' , business_flag string comment '工商请求结果-Y:请求成功;N:请求失败' , business_type_json string comment '工商会将查询参数保存在这里' ) row format delimited fields terminated by '\t' location '/user/hive/warehouse/ods_dwd_order_credit_risks'; create table if not exists dwd.order_houses(id string comment 'ID' , house_api string comment '房产信息类型' , house_apply_no string comment '订单编号' , house_no string comment '房产编号' , house_cert_type string comment '房产证类型' , house_cert_no string comment '产证编号' , house_new_house_cert_no string comment '新房产证编号' , house_type string comment '房产用途' , house_area string comment '所在区域' , house_address string comment '房产地址(坐落)' , house_acreage string comment '房屋面积' , house_register_price double comment '登记价(元)' , house_register_date string comment '登记日期' , house_completion_date string comment '竣工日期' , house_land_expiry string comment '土地使用期限' , house_land_right_no string comment '丘权号' , house_remark string comment '备注' , house_property_owner_info string comment '产权人相关信息' , house_create_user_id string comment '创建人id' , house_update_user_id string comment '更新人id' , house_create_time string comment '记录创建时间' , house_update_time string comment '记录更新时间' , house_age string comment '房龄' , house_housing_status string comment '房屋现状(对应字典表fwxz)' , house_property string comment '房屋性质' , house_type_other string comment '房产用途其他' , house_location string comment '房产证地址(省份、直辖市、自治区 (广东省,深圳市,南山区)逗号分隔)' , house_location_province string comment '省' , house_location_city string comment '市' , house_area_code string comment '区域编码' , house_interior_house_acreage string comment '套内建筑面积' , house_borrower_equity double comment '借款人产权份额' , house_owner_type string comment '共有情况' , house_owner_number bigint comment '共有产权人数' , house_mortgage_date string comment '抵押日期' , house_mortgage_struct string comment '抵押物房屋结构' , house_mortgage_type string comment '抵押物房屋类型' , house_mortgage_status string comment '抵押状态' , house_rent_status string comment '出租情况' , house_right_property string comment '权利性质' , house_right_type string comment '权利类型' , house_total_floor bigint comment '总层数' , house_prop_buy_time string comment '购房日期' , house_project_name string comment '楼盘名称' , house_is_only_house string comment '' , house_fxt_area_code string comment '房讯通区域编码' , house_fxt_area_name string comment '房讯通区域名称' , house_village_name string comment '' , house_building_no string comment '' , house_floor_no string comment '' , house_room_no string comment '' , house_build_year string comment '' , house_land_type string comment '土地类型' , house_is_second_mortgage string comment '是否在我司二押' , house_mold string comment '房产类型' , house_loan_agency_type string comment '贷款机构类型' , house_loan_agency_name string comment '贷款机构名称' , house_mortgage_right_amount string comment '抵押债权金额' , house_other_estate_type string comment '其他房产类型' , house_comprehensive_average_price double comment '综合评估均价' , house_comprehensive_evaluation_price double comment '综合评估总价' , house_in_reserve_house string comment '是否备用房' , land_parcel_no string comment '地号(宗地号)' , land_useright_gain_way string comment '使用权取得方式' , land_use string comment '土地用途' , land_remark string comment '备注' , land_create_user_id string comment '创建人id' , land_update_user_id string comment '更新人id' , land_create_time string comment '记录创建时间' , land_update_time string comment '记录更新时间' , land_useright_gain_way_other string comment '使用权取得方式其他' , land_type_other string comment '地类其他' , land_type string comment '地类 地类 地类' , land_area_use double comment '使用权面积' , land_share_area double comment '分摊面积' , land_house_location string comment '房屋坐落' , land_end_date string comment '终止日期' , land_alone_area double comment '独用面积' , estimate_price_source string comment '价格来源' , estimate_query_time string comment '查询时间' , estimate_market_average_price double comment '市场均价(元)' , estimate_query_user_id string comment '查询人id' , estimate_query_user_name string comment '查询姓名' , estimate_remark string comment '备注' , estimate_create_user_id string comment '创建人id' , estimate_update_user_id string comment '更新人id' , estimate_create_time string comment '记录创建时间' , estimate_update_time string comment '记录更新时间' , estimate_rev bigint comment '版本号' , estimate_sourceType string comment '征信来源' , estimate_total_price double comment '查评估总价1' , estimate_manual_total_price double comment '人工录入评估总价2' , estimate_average_price double comment '查评估均价' , estimate_liveness string comment '活跃度' , estimate_average_price2 double comment '查评估均价2' , estimate_total_price2 double comment '查评估总价2' , estimate_comprehensive_evaluation_price double comment '综合评估价' , estimate_comprehensive_average_price double comment '综合均价' , estimate_total_price3 double comment '云房总价' , estimate_average_price3 double comment '云房均价' , estimate_old_or_new string comment '新老单标记' , estimate_system_source string comment '系统来源' , estimate_query_condition string comment '查询条件' , estimate_price double comment '均价(元/m2)' , estimate_query_way string comment '查询方式(线上/线下)' , estimate_query_result string comment '查询结果状态' , estimate_unique_id string comment '查询条件' , archive_query_time string comment '查询时间' , archive_query_result string comment '查档结果' , archive_query_user_id string comment '查档人id' , archive_query_user_name string comment '查档人姓名' , archive_remark string comment '备注' , archive_create_user_id string comment '创建人id' , archive_update_user_id string comment '更新人id' , archive_create_time timestamp comment '记录创建时间' , archive_update_time string comment '记录更新时间' ) row format delimited fields terminated by '\t' location '/user/hive/warehouse/ods_dwd_order_houses'; create table if not exists dwd.order_insurances(id string comment '主键id' , apply_no string comment '订单编号' , insurance_no string comment '保单号' , insurance_type string comment '保险类型' , insurance_name string comment '保险名称' , insurer_name string comment '投保人姓名' , insurer_cert_id string comment '投保人证件号码' , insurer_phone string comment '投保人联系电话' , insurer_mail string comment '投保人电子邮件' , insurer_adress string comment '投保人联系地址' , insured_name string comment '被保险人姓名' , insured_cret_id string comment '被保险人证件号码' , insured_phone string comment '被保险人联系电话' , insured_mail string comment '被保险人电子邮件' , premium_amount double comment '保费' , insurance_amount double comment '保险金额' , payment_way string comment '收费方式' , payment_party string comment '保费缴纳方' , insurance_period string comment '保险期限/履约期' , preliminary_pass_time string comment '预审通过时间' , receive_policy_time string comment '接收报单时间' , underwrite_pass_time string comment '核保通过时间' , premium_payment_time string comment '保费缴纳时间' , remark string comment '备注' , create_user_id string comment '创建人id' , update_user_id string comment '更新人id' , create_time string comment '记录创建时间' , update_time string comment '记录更新时间' , rev bigint comment '版本号' , delete_flag string comment '记录删除标识(1:删除;0:有效记录)' , is_pass string comment '是否核保通过' , robot_status string comment '机器人操作状态(successfailure)' ) row format delimited fields terminated by '\t' location '/user/hive/warehouse/ods_dwd_order_insurances'; create table if not exists dwd.order_projects(id string comment '主键id' , apply_no string comment '业务申请编号' , account_type string comment '资料托管类型 身份证托管:SFZ 银行卡托管:YHK 房地产证:FDCZ 其他要件托管:QT' , account_name string comment '类型名' , account_no string comment '类型号' , card_type string comment '托管银行卡类型供楼卡:GLK 按揭回款卡:AJHKK 首期款回款卡:SQKHKK' , bank_code string comment '银行编码' , bank_name string comment '银行名称' , reback_date string comment '托管证件归还日期' , remark string comment '备注' , create_user_id string comment '创建人id' , update_user_id string comment '更新人id' , create_time string comment '记录创建时间' , update_time string comment '记录更新时间' , is_trust_flag string comment '是否托管' , is_close_flag string comment '是否关闭网银' , storage_time string comment '入库时间' , storage_operator string comment '入库交接人' , storage_operator_id string comment '入库交接人id' , storage_receiver string comment '入库签收人' , storage_receiver_id string comment '入库签收人id' , storageout_time string comment '出库时间' , storageout_operator string comment '出库交接人' , storageout_operator_id string comment '出库交接人id' , storageout_receiver string comment '出库签收人' , storageout_receiver_id string comment '出库签收人id' , usb_key string comment 'U盾,Y 有,N 无' , test_account_id string comment '要件测试托管资料主键' , test_time string comment '要件测试时间' , test_channel string comment '要件测试途径(POS:POS机、DSK:柜台、ATM:自助柜员机、OTE:其它)' , test_result string comment '要件测试结果(Y正常;N异常)' , test_handle_user_id string comment '要件测试办理人员id' , handle_user_name string comment '要件测试办理人员姓名' , test_remark string comment '要件测试备注' , test_create_user_id string comment '要件测试创建人id' , test_update_user_id string comment '要件测试更新人id' , test_create_time string comment '要件测试记录创建时间' , test_update_time string comment '要件测试记录更新时间' ) row format delimited fields terminated by '\t' location '/user/hive/warehouse/ods_dwd_order_projects';
DROP TABLE cs_credit_line CASCADE CONSTRAINTS; DROP SEQUENCE seq_cs_credit_line; CREATE TABLE cs_credit_line ( credit_line_id NUMBER PRIMARY KEY, customer_id NUMBER(8), credit_limit NUMBER(10,2) NOT NULL CHECK (credit_limit > 0), creation_date DATE NOT NULL, valid_from DATE NOT NULL, valid_to DATE NOT NULL, last_change_date DATE NOT NULL, CONSTRAINT fk_cs_customer_id FOREIGN KEY (customer_id) REFERENCES customers(customer_id) ); COMMENT ON COLUMN cs_credit_line.credit_line_id IS 'primary key for table'; COMMENT ON COLUMN cs_credit_line.customer_id IS 'Customer if for Credit line'; COMMENT ON COLUMN cs_credit_line.credit_limit IS 'The amount of credit available to the customer'; COMMENT ON COLUMN cs_credit_line.creation_date IS 'Creation date of the credit line'; COMMENT ON COLUMN cs_credit_line.valid_from IS 'Credit line valid from date'; COMMENT ON COLUMN cs_credit_line.valid_to IS 'Credit line valid to date'; COMMENT ON COLUMN cs_credit_line.last_change_date IS 'Date of the last change of credit line amount'; CREATE SEQUENCE seq_cs_credit_line START WITH 1 INCREMENT BY 1;
create table if not exists cars ( id serial primary key, year integer, model text, trim text ); insert into cars (year,model,trim) values(2016,'WRX', 'Limited'); insert into cars (year,model,trim) values(2017,'WRX', 'Limited'); insert into cars (year,model,trim) values(2018,'WRX', 'Limited'); insert into cars (year,model,trim) values(2016,'WRX', 'Base'); insert into cars (year,model,trim) values(2017,'WRX', 'Base'); insert into cars (year,model,trim) values(2018,'WRX', 'Base'); insert into cars (year,model,trim) values(2016,'WRX', 'Premium'); insert into cars (year,model,trim) values(2017,'WRX', 'Premium'); insert into cars (year,model,trim) values(2018,'WRX', 'Premium'); insert into cars (year,model,trim) values(2016,'Outback', '2.5i'); insert into cars (year,model,trim) values(2017,'Outback', '2.5i'); insert into cars (year,model,trim) values(2018,'Outback', '2.5i'); insert into cars (year,model,trim) values(2016,'Outback', '2.5i Limited'); insert into cars (year,model,trim) values(2017,'Outback', '2.5i Limited'); insert into cars (year,model,trim) values(2018,'Outback', '2.5i Limited'); insert into cars (year,model,trim) values(2016,'Outback', '2.5i Premium'); insert into cars (year,model,trim) values(2017,'Outback', '2.5i Premium'); insert into cars (year,model,trim) values(2018,'Outback', '2.5i Premium'); insert into cars (year,model,trim) values(2016,'Outback', '3.6R Limited'); insert into cars (year,model,trim) values(2017,'Outback', '3.6R Limited'); insert into cars (year,model,trim) values(2018,'Outback', '3.6R Limited'); insert into cars (year,model,trim) values(2017,'Legacy', '2.5i'); insert into cars (year,model,trim) values(2018,'Legacy', '2.5i'); insert into cars (year,model,trim) values(2016,'Legacy', '2.5i Limited'); insert into cars (year,model,trim) values(2017,'Legacy', '2.5i Limited'); insert into cars (year,model,trim) values(2018,'Legacy', '2.5i Limited'); insert into cars (year,model,trim) values(2016,'Legacy', '2.5i Premium'); insert into cars (year,model,trim) values(2017,'Legacy', '2.5i Premium'); insert into cars (year,model,trim) values(2018,'Legacy', '2.5i Premium'); insert into cars (year,model,trim) values(2016,'Legacy', '3.6R Limited'); insert into cars (year,model,trim) values(2017,'Legacy', '3.6R Limited'); insert into cars (year,model,trim) values(2018,'Legacy', '3.6R Limited'); insert into cars (year,model,trim) values(2016,'Legacy', '2.5i');
DROP TABLE IF EXISTS `article`; CREATE TABLE `article` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `author` varchar(255) DEFAULT NULL, `content` varchar(255) DEFAULT NULL, `create_time` TIMESTAMP , `title` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ); #初始化qutarz数据表:quartz-2.3.0.jar!\org\quartz\impl\jdbcjobstore\tables_mysql_innodb.sql DROP TABLE IF EXISTS `t_user`; CREATE TABLE `t_user` ( `user_id` bigint(20) NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL, `userpwd` varchar(255) DEFAULT NULL, PRIMARY KEY (`user_id`) USING BTREE ); DROP TABLE IF EXISTS `purchase_plan_item`; CREATE TABLE `purchase_plan_item` ( `user_id` bigint(20) NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL, `userpwd` varchar(255) DEFAULT NULL, PRIMARY KEY (`user_id`) USING BTREE );
SELECT 'April 2018' SELECT sum(sunday_hours), sum(monday_hours), sum(tuesday_hours), sum(wednesday_hours), sum(thursday_hours), sum(friday_hours), sum(saturday_hours) FROM studio_hours WHERE month = 'April'; SELECT 'May 2018' SELECT sum(sunday_hours), sum(monday_hours), sum(tuesday_hours), sum(wednesday_hours), sum(thursday_hours), sum(friday_hours), sum(saturday_hours) FROM studio_hours WHERE month = 'May'; SELECT 'June 2018' SELECT sum(sunday_hours), sum(monday_hours), sum(tuesday_hours), sum(wednesday_hours), sum(thursday_hours), sum(friday_hours), sum(saturday_hours) FROM studio_hours WHERE month = 'June'; SELECT 'July 2018' SELECT sum(sunday_hours), sum(monday_hours), sum(tuesday_hours), sum(wednesday_hours), sum(thursday_hours), sum(friday_hours), sum(saturday_hours) FROM studio_hours WHERE month = 'July';
SELECT * FROM pg_settings where name like '%checkpoint%' or name like '%wal%' or name like '%bgwriter%'; SELECT total_checkpoints, seconds_since_start / total_checkpoints / 60 AS minutes_between_checkpoints FROM (SELECT EXTRACT(EPOCH FROM (now() - pg_postmaster_start_time())) AS seconds_since_start, (checkpoints_timed+checkpoints_req) AS total_checkpoints FROM pg_stat_bgwriter ) AS sub; select * from pg_stat_bgwriter;
-- Name: Nijii Daniels -- File: TSQL Exercise 05 -- Date: August 02, 2020 -- 1. Create an appropriate table schema. -- 2. Insert the CSV data into the table you just created. Drop TABLE IF EXISTS dbo.pres Create table dbo.pres (ID varchar(20), LastName varchar(50), FirstName varchar(50), MiddleName varchar(50), OrderofPres varchar(50), DOB varchar(50), DeathDate varchar(50), BirthPlace varchar(50), BirthState varchar(50), HomeState varchar(50), Party varchar(50), DateTookOffice varchar(50), DateLeftOffice varchar(50), AssassinationAtt varchar(50), Assassinated varchar(50), Religion varchar(50), ImageP varchar(50)); Bulk insert dbo.pres from 'C:\Users\User\Desktop\Quantico06\ISTA420\Pres.txt' with (datafiletype = 'char', fieldterminator = ',', rowterminator = '\n'); -- 3. Delete the column that contains the path to the images. Alter Table dbo.pres drop column ImageP; -- 4. Delete the first record from your table using the output clause. This is the header. Alter Table dbo.pres add constraint IDC unique (IDC) -- 5. Bring the data up to date by updating the last row. Use the output clause. Update dbo.pres set DateLeftOffice = '1/20/2017' where FirstName = 'Barack'; -- 6. Bring the data up to date by adding a new row. Use the output clause. Insert into dbo.pres (ID, LastName, FirstName, MiddleName, OrderofPres, DOB, DeathDate, BirthPlace, BirthState, HomeState, Party, DateTookOffice, DateLeftOffice, AssassinationAtt, Assassinated, Religion) values (45, 'Trump', 'Donald', 'John', 45, '6/14/1946', Null, 'Queens', 'New York', 'New York', 'Republican', '1/20/2017', Null, Null, Null, 'Presbyterian'); -- 7. How many presidents from each state belonged to the various political parties? Aggregate by party -- and state. Note that this will in effect be a pivot table. -- 8. Create a report showing the number of days each president was in office. select DATEDIFF('DateLeftOffice' - 'DateTookOffice') as DateDiff1 from dbo.pres -- 9. Create a report showing the age (in years) of each present when he took office. -- 10. See if there is any correlation between a president's party and reported religion, or lack of reported -- religion.
# patch_44_45_a.sql # # title: update schema version # # description: # Update schema_version in meta table to 45 UPDATE meta SET meta_value='45' WHERE meta_key='schema_version'; # patch identifier INSERT INTO meta (meta_key, meta_value) VALUES ('patch', 'patch_44_45_a.sql|schema_version');
CREATE TABLE migrations ( migration VARCHAR(255) NOT NULL, batch INT(11) NOT NULL ); CREATE TABLE password_resets ( email VARCHAR(255) NOT NULL, token VARCHAR(255) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL ); CREATE INDEX password_resets_email_index ON password_resets (email); CREATE INDEX password_resets_token_index ON password_resets (token); CREATE TABLE users ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP, remember_token VARCHAR(100) ); CREATE UNIQUE INDEX users_email_unique ON users (email); CREATE TABLE roles ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255), level INT(11) DEFAULT '1' NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP ); CREATE UNIQUE INDEX roles_slug_unique ON roles (slug); CREATE TABLE permission_role ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, permission_id INT(10) unsigned NOT NULL, role_id INT(10) unsigned NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP, CONSTRAINT permission_role_permission_id_foreign FOREIGN KEY (permission_id) REFERENCES permissions (id) ON DELETE CASCADE, CONSTRAINT permission_role_role_id_foreign FOREIGN KEY (role_id) REFERENCES roles (id) ON DELETE CASCADE ); CREATE INDEX permission_role_permission_id_index ON permission_role (permission_id); CREATE INDEX permission_role_role_id_index ON permission_role (role_id); CREATE TABLE permission_user ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, permission_id INT(10) unsigned NOT NULL, user_id INT(10) unsigned NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP, CONSTRAINT permission_user_permission_id_foreign FOREIGN KEY (permission_id) REFERENCES permissions (id) ON DELETE CASCADE, CONSTRAINT permission_user_user_id_foreign FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ); CREATE INDEX permission_user_permission_id_index ON permission_user (permission_id); CREATE INDEX permission_user_user_id_index ON permission_user (user_id); CREATE TABLE permissions ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255), model VARCHAR(255), created_at TIMESTAMP, updated_at TIMESTAMP ); CREATE UNIQUE INDEX permissions_slug_unique ON permissions (slug); CREATE TABLE role_user ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, role_id INT(10) unsigned NOT NULL, user_id INT(10) unsigned NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP, CONSTRAINT role_user_role_id_foreign FOREIGN KEY (role_id) REFERENCES roles (id) ON DELETE CASCADE, CONSTRAINT role_user_user_id_foreign FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ); CREATE INDEX role_user_role_id_index ON role_user (role_id); CREATE INDEX role_user_user_id_index ON role_user (user_id); CREATE TABLE competencia_user ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, user_id INT(10) unsigned NOT NULL, competencia_id INT(10) unsigned NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP, CONSTRAINT competencia_user_user_id_foreign FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, CONSTRAINT competencia_user_competencia_id_foreign FOREIGN KEY (competencia_id) REFERENCES competencias (id) ON DELETE CASCADE ); CREATE INDEX competencia_user_competencia_id_foreign ON competencia_user (competencia_id); CREATE INDEX competencia_user_user_id_foreign ON competencia_user (user_id); CREATE TABLE competencias ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, nombre VARCHAR(255) NOT NULL, descripcion TEXT NOT NULL, org_partidos ENUM('admin_competencia', 'admin_equipo') NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP ); CREATE UNIQUE INDEX competencias_nombre_unique ON competencias (nombre); CREATE TABLE equipo_user ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, user_id INT(10) unsigned NOT NULL, equipo_id INT(10) unsigned NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP, CONSTRAINT equipo_user_user_id_foreign FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, CONSTRAINT equipo_user_equipo_id_foreign FOREIGN KEY (equipo_id) REFERENCES equipos (id) ON DELETE CASCADE ); CREATE INDEX equipo_user_equipo_id_foreign ON equipo_user (equipo_id); CREATE INDEX equipo_user_user_id_foreign ON equipo_user (user_id); CREATE TABLE equipos ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, nombre VARCHAR(255) NOT NULL, apodo VARCHAR(255) NOT NULL, fundado DATE NOT NULL, fundadores VARCHAR(255) NOT NULL, descripcion TEXT NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP ); CREATE TABLE localidades ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, nombre VARCHAR(255) NOT NULL, provincia_id INT(10) unsigned NOT NULL, CONSTRAINT localidades_provincia_id_foreign FOREIGN KEY (provincia_id) REFERENCES provincias (id) ); CREATE INDEX localidades_provincia_id_foreign ON localidades (provincia_id); CREATE TABLE paises ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, nombre VARCHAR(255) NOT NULL ); CREATE TABLE provincias ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, nombre VARCHAR(255) NOT NULL, pais_id INT(10) unsigned NOT NULL, CONSTRAINT provincias_pais_id_foreign FOREIGN KEY (pais_id) REFERENCES paises (id) ); CREATE INDEX provincias_pais_id_foreign ON provincias (pais_id); CREATE TABLE scaffoldinterfaces ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, package VARCHAR(255) NOT NULL, migration VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, controller VARCHAR(255) NOT NULL, views VARCHAR(255) NOT NULL, tablename VARCHAR(255) NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP ); CREATE TABLE torneos ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, fecha_inicio DATE NOT NULL, descripcion TEXT NOT NULL, estado ENUM('activo', 'inactivo') NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP ); CREATE TABLE estadios ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, nombre VARCHAR(255) NOT NULL, alias VARCHAR(255) NOT NULL, capasidad INT(11) NOT NULL, iluminado TINYINT(1) NOT NULL, arquitectos VARCHAR(255) NOT NULL, dueños VARCHAR(255) NOT NULL, inauguracion DATE NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP ); CREATE UNIQUE INDEX estadios_nombre_unique ON estadios (nombre); CREATE TABLE direcciones ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, calle VARCHAR(255) NOT NULL, altura VARCHAR(255) NOT NULL, piso INT(11), dpto VARCHAR(255), estadio_id INT(10) unsigned NOT NULL, pais_id INT(10) unsigned, provincia_id INT(10) unsigned, localidad_id INT(10) unsigned, created_at TIMESTAMP, updated_at TIMESTAMP, CONSTRAINT direcciones_estadio_id_foreign FOREIGN KEY (estadio_id) REFERENCES estadios (id) ON DELETE CASCADE, CONSTRAINT direcciones_pais_id_foreign FOREIGN KEY (pais_id) REFERENCES paises (id), CONSTRAINT direcciones_provincia_id_foreign FOREIGN KEY (provincia_id) REFERENCES provincias (id), CONSTRAINT direcciones_localidad_id_foreign FOREIGN KEY (localidad_id) REFERENCES localidades (id) ); CREATE INDEX direcciones_estadio_id_foreign ON direcciones (estadio_id); CREATE INDEX direcciones_localidad_id_foreign ON direcciones (localidad_id); CREATE INDEX direcciones_pais_id_foreign ON direcciones (pais_id); CREATE INDEX direcciones_provincia_id_foreign ON direcciones (provincia_id); CREATE TABLE equipo_estadio ( id INT(10) unsigned PRIMARY KEY NOT NULL AUTO_INCREMENT, estadio_id INT(10) unsigned NOT NULL, equipo_id INT(10) unsigned NOT NULL, created_at TIMESTAMP, updated_at TIMESTAMP, CONSTRAINT equipo_estadio_estadio_id_foreign FOREIGN KEY (estadio_id) REFERENCES estadios (id) ON DELETE CASCADE, CONSTRAINT equipo_estadio_equipo_id_foreign FOREIGN KEY (equipo_id) REFERENCES equipos (id) ON DELETE CASCADE ); CREATE INDEX equipo_estadio_equipo_id_index ON equipo_estadio (equipo_id); CREATE INDEX equipo_estadio_estadio_id_index ON equipo_estadio (estadio_id);
ALTER TABLE `m_product_loan` ADD COLUMN `can_define_fixed_emi_amount` TINYINT(1) NOT NULL DEFAULT '0', ADD COLUMN `instalment_amount_in_multiples_of` DECIMAL(19,6) NULL DEFAULT NULL;
select city.cityname , count (distinct search_m.cid ) as MAU , count (distinct pay_m.orderid) as order_m , concat(round(count (distinct pay_m.orderid)/count (distinct search_m.cid )*100,2),'%') as conversion_m , count (distinct bnbpay_m.orderid ) as bnborder_m , count (distinct hotelpay_m.orderid) as hotelorder_m from --MAU (select distinct d ,cid ,get_json_object(value,'$.cityid') as cityid from bnb_hive_db.bnb_tracelog where d >= '2018-06-22' and d <= '2018-07-21' and key = 'bnb_inn_list_app_basic')search_m left outer join --月民宿客栈订单 (select substring(b1.createdtime, 0, 10) as d , a1.orderid , b1.clientid as cid , c1.cityid from ods_htl_bnborderdb.order_item a1 left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d='2018-07-22' left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d='2018-07-22' where substring(b1.createdtime,0,10) >='2018-06-22' and substring(b1.createdtime,0,10) <='2018-07-21' and a1.d='2018-07-22' and (a1.statusid like '12%' or a1.statusid like '20%' or a1.statusid like '22%' or a1.statusid like '23%') union all select to_date(orderdate) as d , orderid , clientid as cid , cityid from dwhtl.edw_htl_order_all_orderdate where to_date(orderdate) >='2018-06-22' and to_date(orderdate) <='2018-07-21' and subchannel='h5_kezhan' and d >='2018-06-22' and d <='2018-07-21' and orderstatus not in ('W')) pay_m on pay_m.d = search_m.d and pay_m.cid=search_m.cid and pay_m.cityid=search_m.cityid left outer join --月民宿订单 (select substring(b1.createdtime, 0, 10) as d , a1.orderid , b1.clientid as cid , c1.cityid from ods_htl_bnborderdb.order_item a1 left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d='2018-07-22' left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d='2018-07-22' where substring(b1.createdtime,0,10) >='2018-06-22' and substring(b1.createdtime,0,10) <='2018-07-21' and a1.d='2018-07-22' and (a1.statusid like '12%' or a1.statusid like '20%' or a1.statusid like '22%' or a1.statusid like '23%')) bnbpay_m on bnbpay_m.d = search_m.d and bnbpay_m.cid=search_m.cid and bnbpay_m.cityid=search_m.cityid left outer join --月客栈订单 (select to_date(orderdate) as d , orderid , clientid as cid , cityid from dwhtl.edw_htl_order_all_orderdate where to_date(orderdate) >='2018-06-22' and to_date(orderdate) <='2018-07-21' and subchannel='h5_kezhan' and d >='2018-06-22' and d <='2018-07-21' and orderstatus not in ('W')) hotelpay_m on hotelpay_m.d = search_m.d and hotelpay_m.cid=search_m.cid and hotelpay_m.cityid=search_m.cityid left outer join ods_htl_groupwormholedb.bnb_city city on search_m.cityid = city.cityid and city.d = '2018-07-22' group by city.cityname; union all select '汇总' as cityname , count (distinct search_m.cid ) as MAU , count (distinct pay_m.orderid) as order_w , concat(round(count (distinct pay_m.orderid)/count (distinct search_m.cid )*100,2),'%') as conversion_m , count (distinct bnbpay_m.orderid ) as bnborder_m , count (distinct hotelpay_m.orderid) as hotelorder_m from --月汇总MAU (select distinct d ,cid from bnb_hive_db.bnb_tracelog where d >= '2018-06-22' and d <= '2018-07-21' and key = 'bnb_inn_list_app_basic')search_m left outer join --月汇总民宿客栈订单 (select substring(b1.createdtime, 0, 10) as d , a1.orderid , b1.clientid as cid from ods_htl_bnborderdb.order_item a1 left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d='2018-07-22' left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d='2018-07-22' where substring(b1.createdtime,0,10) >= '2018-06-22' and substring(b1.createdtime,0,10) <= '2018-07-21' and a1.d='2018-07-22' and (a1.statusid like '12%' or a1.statusid like '20%' or a1.statusid like '22%' or a1.statusid like '23%') union all select to_date(orderdate) as d , orderid , clientid as cid from dwhtl.edw_htl_order_all_orderdate where to_date(orderdate) >= '2018-06-22' and to_date(orderdate) <= '2018-07-21' and subchannel='h5_kezhan' and d >= '2018-06-22' and d <= '2018-07-21' and orderstatus not in ('W')) pay_m on pay_m.d = search_m.d and pay_m.cid=search_m.cid left outer join --月汇总民宿订单 (select substring(b1.createdtime, 0, 10) as d , a1.orderid , b1.clientid as cid from ods_htl_bnborderdb.order_item a1 left join ods_htl_bnborderdb.order_header_v2 b1 on a1.orderid=b1.orderid and b1.d='2018-07-22' left join ods_htl_bnborderdb.order_item_space c1 on c1.orderitemid=a1.orderitemid and c1.d='2018-07-22' where substring(b1.createdtime,0,10) >='2018-06-22' and substring(b1.createdtime,0,10) <='2018-07-21' and a1.d='2018-07-22' and (a1.statusid like '12%' or a1.statusid like '20%' or a1.statusid like '22%' or a1.statusid like '23%')) bnbpay_m on bnbpay_m.d = search_m.d and bnbpay_m.cid=search_m.cid left outer join --月汇总客栈订单 (select to_date(orderdate) as d , orderid , clientid as cid from dwhtl.edw_htl_order_all_orderdate where to_date(orderdate) >='2018-06-22' and to_date(orderdate) <='2018-07-21' and subchannel='h5_kezhan' and d >= '2018-06-22' and d <= '2018-07-21' and orderstatus not in ('W')) hotelpay_m on hotelpay_m.d = search_m.d and hotelpay_m.cid=search_m.cid group by '汇总'
Create Procedure sp_Update_AmendStkTfrOut (@StkTfrID Int, @StkTfrIDRef Int, @DocumentIDRef nvarchar(255)) As Update StockTransferOutAbstract Set STOIDRef = @StkTfrIDRef, STODOCIDRef = @DocumentIDRef Where DocSerial = @StkTfrID
-- create database demo_ds_0 drop database if exists `demo_ds_0`; create database `demo_ds_0`;
DROP DATABASE IF EXISTS social_network; CREATE DATABASE social_network CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; use social_network; create table post( id int not null primary key auto_increment, content text, time timestamp not null default current_timestamp , image text )engine=InnoDB; create table comments( id int not null primary key auto_increment, content text, postId int, foreign key (postId) references post(id) on delete cascade )engine=InnoDB; insert into post (content) values ('Evo danas pada kiša opet :('), ('Jedem jagode.'); insert into comments (content, postId) values ('Vani je bas lose vrijeme' , 1);
create table SnapshotEventEntry ( aggregateIdentifier varchar2(255) not null, sequenceNumber number(19,0) not null, type varchar2(255) not null, eventIdentifier varchar2(255) not null, metaData blob, payload blob not null, payloadRevision varchar2(255), payloadType varchar2(255) not null, timeStamp varchar2(255) not null ); alter table SnapshotEventEntry add constraint PK_SnapshotEventEntry primary key (aggregateIdentifier, sequenceNumber, type); --//@UNDO drop table SnapshotEventEntry;
create database HockeyLiga; create table Confederacy{ confederacy_id serial primary key, name VARCHAR(50) not null }; create table Club{ club_id serial primary key, name VARCHAR(50) not null, rating int, confederacy_id int references confederacy(confederacy_id) on delete no action on update cascade }; create table Sponsor{ sponsor_id serial primary key, name VARCHAR(50) not null }; create table Match{ match_id serial primary key, playdata timestamp with timezone, count1 int not null, club_id1 int references club(club_id) on delete no action on update cascade, count2 int not null, club_id2 int references club(club_id) on delete no action on update cascade, sold int not null }; create table Coach{ coach_id serial primary key, club_id int references club(club_id) on delete no action on update cascade, name VARCHAR(50) not null, lastname VARCHAR(50) not null }; create table Player{ player_id serial primary key, club_id int references club(club_id) on delete no action on update cascade, name VARCHAR(50) not null, lastname VARCHAR(50) not null, efficiency int };
/* Navicat MySQL Data Transfer Source Server : zx Source Server Version : 50636 Source Host : localhost:3306 Source Database : test1 Target Server Type : MYSQL Target Server Version : 50636 File Encoding : 65001 Date: 2017-11-01 14:53:08 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `course` -- ---------------------------- DROP TABLE IF EXISTS `course`; CREATE TABLE `course` ( `id` bigint(11) NOT NULL AUTO_INCREMENT, `name` varchar(30) DEFAULT NULL, `teacher` varchar(30) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of course -- ---------------------------- INSERT INTO `course` VALUES ('1', '数据库', '陈建利'); -- ---------------------------- -- Table structure for `users` -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id', `userName` varchar(32) DEFAULT NULL COMMENT '用户名', `passWord` varchar(32) DEFAULT NULL COMMENT '密码', `user_sex` varchar(32) DEFAULT NULL, `nick_name` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of users -- ---------------------------- INSERT INTO `users` VALUES ('29', 'bb', 'b123456', 'WOMAN', null); INSERT INTO `users` VALUES ('30', 'cc', 'b123456', 'WOMAN', null); INSERT INTO `users` VALUES ('31', 'aa', 'a123456', 'MAN', null); INSERT INTO `users` VALUES ('32', 'bb', 'b123456', 'WOMAN', null); INSERT INTO `users` VALUES ('33', 'cc', 'b123456', 'WOMAN', null); INSERT INTO `users` VALUES ('34', 'aa', 'a123456', 'MAN', null); INSERT INTO `users` VALUES ('35', 'bb', 'b123456', 'WOMAN', null); INSERT INTO `users` VALUES ('36', 'cc', 'b123456', 'WOMAN', null);
CREATE TABLE IF NOT EXISTS `bmp180` ( `reading_id` int(255) NOT NULL AUTO_INCREMENT, `temperature_c` double NOT NULL, `temperature_f` double NOT NULL, `barometric_pressure` varchar(20) NOT NULL, `altitude` varchar(20) NOT NULL, `dateMeasured` date NOT NULL, `hourMeasured` datetime NOT NULL, `timeBlock` int(128) NOT NULL, PRIMARY KEY (`reading_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `dht22` ( `dht_id` int(255) NOT NULL AUTO_INCREMENT, `reading_id` int(20) NOT NULL, `temperature_c` double NOT NULL, `temperature_f` double NOT NULL, `humidity` varchar(20) NOT NULL, `dateMeasured` date NOT NULL, `hourMeasured` datetime NOT NULL, `timeBlock` int(128) NOT NULL, PRIMARY KEY (`dht_id`), FOREIGN KEY (`reading_id`) REFERENCES bmp180(`reading_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- Group 9 - Comparative Efectiveness Research use Group9db; -- Patient master import Load data local infile 'data/Patient_Master.csv' Into table Patient_Master Fields terminated by ',' Enclosed by '"' Lines terminated by '\n' Ignore 1 rows; -- Patient_Comorb import Load data local infile 'data/Patient_Comorb.csv' Into table Patient_Comorb Fields terminated by ',' Enclosed by '"' Lines terminated by '\n' Ignore 1 rows; -- Encounter_Master import Load data local infile 'data/Encounter_Master.csv' Into table Encounter_Master Fields terminated by ',' Enclosed by '"' Lines terminated by '\n' Ignore 1 rows; -- Encounter_Outcome import Load data local infile 'data/Encounter_Outcome.csv' Into table Encounter_Outcome Fields terminated by ',' Enclosed by '"' Lines terminated by '\n' Ignore 1 rows; -- Encounter_Prescription import Load data local infile 'data/Encounter_Prescription.csv' Into table Encounter_Prescription Fields terminated by ',' Enclosed by '"' Lines terminated by '\n' Ignore 1 rows; -- Outcome_Meta import Load data local infile 'data/Outcome_Meta.csv' Into table Outcome_Meta Fields terminated by ',' Enclosed by '"' Lines terminated by '\n' Ignore 1 rows; -- Variable_Meta import Load data local infile 'data/Variable_Meta.csv' Into table Variable_Meta Fields terminated by ',' Enclosed by '"' Lines terminated by '\n' Ignore 1 rows; Load data local infile 'data/Cohort_Patient.csv' Into table Cohort_Patient Fields terminated by ',' Enclosed by '"' Lines terminated by '\n' Ignore 1 rows;
drop table Members CASCADE CONSTRAINTS; drop table Librarians CASCADE CONSTRAINTS; drop table Branches CASCADE CONSTRAINTS; drop table Rental_Due_On CASCADE CONSTRAINTS; drop table Book_Copy CASCADE CONSTRAINTS; drop table Renews CASCADE CONSTRAINTS; drop table Makes_Reservation CASCADE CONSTRAINTS; drop table Makes_Rental CASCADE CONSTRAINTS; drop table Has_Books CASCADE CONSTRAINTS; drop table Reservation_For CASCADE CONSTRAINTS; -- All deleted tables are below -- drop table Adds_Or_Modifies CASCADE CONSTRAINTS; -- drop table Deletes CASCADE CONSTRAINTS; -- drop table Time_Period CASCADE CONSTRAINTS; -- drop table Reserved_On CASCADE CONSTRAINTS; -- drop table Returns CASCADE CONSTRAINTS; My Database does not have this table -- Members table and data is fine is fine CREATE TABLE Members ( member_id CHAR(8), address VARCHAR(50), first_name VARCHAR(10), last_name VARCHAR(10), phone_number CHAR(10), owing REAL, username VARCHAR(255) UNIQUE NOT NULL, --The NOT NULL ensures that the username is not left blank and 255 ensures that email can be used as a username password VARCHAR(12), permissions int NOT NULL CHECK(permissions >= 0 and permissions <= 2), PRIMARY KEY (member_id), CHECK (owing >= 0 AND LENGTH(username) >= 4 AND LENGTH(password) >= 8) ); insert into Members values('00000001', '111 Alpha Drive Vancouver BC, V5Y 1S1', 'Annie', 'Appleseed','7781111111', 000000, 'aapple@apple.com', 'applepie00', 2); insert into Members values('00000002', '222 Beta Drive Vancouver BC, V5Y 1S2', 'Billy', 'Bedford', '7782222222', 000000, 'bbedfo', 'bedframe11', 2); insert into Members values('00000003', '333 Gamma Drive Vancouver BC, V5Y 1S3', 'Connie', 'Chang', '7783333333', 000124, 'cchang', 'changeling22', 1); insert into Members values('00000004', '444 Delta Drive Vancouver BC, V5Y 1S4', 'Douglas', 'Dobson', '7784444444', 000000, 'ddobs', 'dougie33', 1); insert into Members values('00000005', '555 Beta Drive Vancouver BC, V5Y 1S5', 'Ellie', 'Everett', '7785555555', 000025, 'eever', 'neverever44', 0); insert into Members values('00000006', '666 Epsilon Drive Vancouver BC, V5Y 1S6', 'Fanny', 'Frampton', '7781111111', 000000, 'ffanny', 'fanman55', 2); insert into Members values('00000007', '777 Zeta Drive Vancouver BC, V5Y 1S7', 'Gary', 'Gordon', '7782222222', 000000, 'ggordo', 'garment66', 2); insert into Members values('00000008', '888 Eta Drive Vancouver BC, V5Y 1S8', 'Harry', 'Hilton', '7782222222', 000000, 'hhilt', 'hillside77', 2); -- Librarians table and data is fine. We are not using it though. We will keep it so that if the TA asks anything about the DBA entering employees, then we can talk about this one. CREATE TABLE Librarians ( member_id CHAR(8), employee_id CHAR(8), PRIMARY KEY (member_id, employee_id), FOREIGN KEY (member_id) REFERENCES Members ON DELETE CASCADE ); insert into Librarians values('00000001', '10000001'); insert into Librarians values('00000002', '10000002'); insert into Librarians values('00000006', '10000006'); insert into Librarians values('00000007', '10000007'); insert into Librarians values('00000008', '10000008'); -- Branches table and data is fine too CREATE TABLE Branches ( branch_id CHAR(4), name CHAR(30), city CHAR(20), province CHAR(5), PRIMARY KEY (branch_id) ); insert into Branches values('0001', 'Grouse Public Library', 'Vancouver', 'BC'); insert into Branches values('0002', 'Seymour Public Library', 'Vancouver', 'BC'); insert into Branches values('0003', 'Cypress Public Library', 'Vancouver', 'BC'); insert into Branches values('0004', 'Cathedral Public Library', 'Vancouver', 'BC'); insert into Branches values('0005', 'Coliseum Public Library', 'Vancouver', 'BC'); -- I am not sure the Time_Period table is actually required. We could just shift the fields of this table into the rental_due_on table -- CREATE TABLE Time_Period -- ( -- start_date DATE, -- due_date DATE, -- PRIMARY KEY (start_date, due_date) -- ); -- insert into Time_Period -- values('19-Oct-13', '01-Nov-13'); -- insert into Time_Period -- values('20-Oct-13', '02-Nov-13'); -- insert into Time_Period -- values('21-Oct-13', '03-Nov-13'); -- insert into Time_Period -- values('22-Oct-13', '04-Nov-13'); -- insert into Time_Period -- values('23-Oct-13', '05-Nov-13'); CREATE TABLE Has_Books ( isbn CHAR(13), branch_id CHAR(4), publisher CHAR(35), title CHAR(40), author CHAR(20), PRIMARY KEY (isbn, branch_id), FOREIGN KEY (branch_id) REFERENCES branches ON DELETE CASCADE ); insert into Has_Books values('9780672327231', '0001', 'Apple Publishing', 'Win In 20 Days', 'Jimmy Johnson'); insert into Has_Books values('9780672327231', '0005', 'Apple Publishing', 'Win In 20 Days', 'Jimmy Johnson'); insert into Has_Books values('9780672327232', '0002', 'Banana Publishing', 'Lose In 10 Days', 'Kimberly Kant'); insert into Has_Books values('9780672327454', '0003', 'Carrot Publishing', 'How To Win Or Lose', 'Loretta Louis'); insert into Has_Books values('9780672327243', '0004', 'Durian Publishing', 'Winning Is Not Everything', 'Marlene Mayall'); insert into Has_Books values('9780672327433', '0001', 'Eggplant Publishing', 'Winning Really Is Everything', 'Nigella Ness'); insert into Has_Books values('9780672327433', '0002', 'Eggplant Publishing', 'Winning Really Is Everything', 'Nigella Ness'); insert into Has_Books values('9780672327433', '0003', 'Eggplant Publishing', 'Winning Really Is Everything', 'Nigella Ness'); insert into Has_Books values('9780672327433', '0004', 'Eggplant Publishing', 'Winning Really Is Everything', 'Nigella Ness'); insert into Has_Books values('9780672327433', '0005', 'Eggplant Publishing', 'Winning Really Is Everything', 'Nigella Ness'); insert into Has_Books values('9780672327232', '0001', 'Banana Publishing', 'Lose In 10 Days', 'Kimberly Kant'); insert into Has_Books values('9780672327454', '0001', 'Carrot Publishing', 'How To Win Or Lose', 'Loretta Louis'); insert into Has_Books values('9780672327243', '0001', 'Durian Publishing', 'Winning Is Not Everything', 'Marlene Mayall'); insert into Has_Books values('9780672327243', '0002', 'Durian Publishing', 'Winning Is Not Everything', 'Marlene Mayall'); -- Book_Copy Table and Data is correct as well is correct. I thought the Primary Key was just (ISBN, branch_id) but I was wrong. This one is correct. I am just going to add more data. CREATE TABLE Book_Copy ( copy_id CHAR(4), isbn CHAR(13), branch_id CHAR(4), PRIMARY KEY (copy_id, isbn, branch_id), FOREIGN KEY (isbn, branch_id) REFERENCES Has_Books ON DELETE CASCADE ); insert into Book_Copy values('0001', '9780672327231', '0001'); -- Need to ensure that copy#1 for ISBN #9780672327231 in branch #1 and copy#1 for ISBN #9780672327231 in branch #2 works fine insert into Book_Copy values('0002', '9780672327231', '0001'); insert into Book_Copy values('0001', '9780672327231', '0005'); -- insert into Book_Copy values('0002', '9780672327232', '0001'); insert into Book_Copy values('0002', '9780672327232', '0002'); insert into Book_Copy values('0001', '9780672327454', '0003'); insert into Book_Copy values('0004', '9780672327243', '0004'); insert into Book_Copy values('0012', '9780672327433', '0005'); CREATE TABLE Rental_Due_On ( copy_id CHAR(4), isbn CHAR(13), branch_id CHAR(4), start_date DATE, due_date DATE, rental_id CHAR(10) NOT NULL, PRIMARY KEY (rental_id), -- FOREIGN KEY (start_date, due_date) REFERENCES Time_Period ON DELETE CASCADE, //Deleted Time_Period table and so, this is not required anymore FOREIGN KEY (copy_id, isbn, branch_id) REFERENCES Book_Copy ON DELETE CASCADE ); insert into Rental_Due_On values('0001', '9780672327231', '0001', '19-Oct-13', '01-Nov-13', '0000000001'); insert into Rental_Due_On values('0002', '9780672327232', '0001', '19-Oct-13', '01-Nov-13', '0000000006'); insert into Rental_Due_On values('0002', '9780672327232', '0002', '20-Oct-13', '02-Nov-13', '0000000002'); insert into Rental_Due_On values('0001', '9780672327454', '0003', '21-Oct-13', '03-Nov-13', '0000000003'); insert into Rental_Due_On values('0004', '9780672327243', '0004', '22-Oct-13', '04-Nov-13', '0000000004'); insert into Rental_Due_On values('0012', '9780672327433', '0005', '23-Oct-13', '05-Nov-13', '0000000005'); -- This table can actually be combined with Rental_Due_On. But, I am leaving it here so that we can demonstrate ON DELETE CASCADE. CREATE TABLE Makes_Rental ( member_id CHAR(8), rental_id CHAR(10), PRIMARY KEY (member_id, rental_id), FOREIGN KEY (member_id) REFERENCES Members ON DELETE CASCADE, FOREIGN KEY (rental_id) REFERENCES Rental_Due_On ON DELETE CASCADE ); insert into Makes_Rental values('00000001', '0000000001'); insert into Makes_Rental values('00000001', '0000000006'); insert into Makes_Rental values('00000002', '0000000002'); insert into Makes_Rental values('00000003', '0000000003'); insert into Makes_Rental values('00000004', '0000000004'); insert into Makes_Rental values('00000005', '0000000005'); -- This table and the data is fine. We are not actually using the data and stuff CREATE TABLE Renews ( member_id CHAR(8), rental_id CHAR(10), PRIMARY KEY (member_id, rental_id), FOREIGN KEY (member_id) REFERENCES Members ON DELETE CASCADE, FOREIGN KEY (rental_id) REFERENCES Rental_Due_On ON DELETE CASCADE ); insert into Renews values('00000001', '0000000001'); insert into Renews values('00000002', '0000000002'); insert into Renews values('00000003', '0000000003'); insert into Renews values('00000004', '0000000004'); insert into Renews values('00000005', '0000000005'); -- This is the table whose primary key will be used as a foreign key in makes_reservation CREATE TABLE Reservation_For ( reservation_id CHAR(10), isbn CHAR(13), branch_id CHAR(4), PRIMARY KEY (reservation_id), FOREIGN KEY (isbn, branch_id) REFERENCES Has_Books ); insert into Reservation_For values('0000000001', '9780672327231', '0001'); insert into Reservation_For values('0000000006', '9780672327232', '0001'); insert into Reservation_For values('0000000002', '9780672327232', '0002'); insert into Reservation_For values('0000000003', '9780672327454', '0003'); insert into Reservation_For values('0000000004', '9780672327243', '0004'); insert into Reservation_For values('0000000005', '9780672327433', '0005'); -- Table for Reservations only CREATE TABLE Makes_Reservation ( member_id CHAR(8), reservation_id CHAR(10), PRIMARY KEY (member_id, reservation_id), FOREIGN KEY (member_id) REFERENCES Members ON DELETE CASCADE, FOREIGN KEY (reservation_id) REFERENCES Reservation_For ON DELETE CASCADE ); insert into Makes_Reservation values('00000001', '0000000001'); insert into Makes_Reservation values('00000001', '0000000006'); insert into Makes_Reservation values('00000002', '0000000002'); insert into Makes_Reservation values('00000003', '0000000003'); insert into Makes_Reservation values('00000004', '0000000004'); insert into Makes_Reservation values('00000005', '0000000005'); -- CREATE TABLE Adds_Or_Modifies -- ( -- member_id CHAR(8), -- employee_id CHAR(8), -- isbn CHAR(13), -- branch_id CHAR(4), -- PRIMARY KEY (member_id, employee_id), -- FOREIGN KEY (member_id, employee_id) REFERENCES Librarians ON DELETE CASCADE, -- FOREIGN KEY (isbn, branch_id) REFERENCES Has_Books ON DELETE CASCADE -- ); -- insert into Adds_Or_Modifies -- values('00000001', '10000001', '9780672327231', '0001'); -- insert into Adds_Or_Modifies -- values('00000008', '10000008', '9780672327232', '0002'); -- insert into Adds_Or_Modifies -- values('00000002', '10000002', '9780672327454', '0003'); -- insert into Adds_Or_Modifies -- values('00000006', '10000006', '9780672327243', '0004'); -- insert into Adds_Or_Modifies -- values('00000007', '10000007', '9780672327433', '0005'); -- CREATE TABLE Deletes -- ( -- member_id CHAR(8), -- employee_id CHAR(8), -- isbn CHAR(13), -- branch_id CHAR(4), -- PRIMARY KEY (member_id, employee_id), -- FOREIGN KEY (member_id, employee_id) REFERENCES Librarians ON DELETE -- CASCADE, -- FOREIGN KEY (isbn, branch_id) REFERENCES Has_Books ON DELETE CASCADE -- ); -- insert into Deletes -- values('00000001', '10000001', '9780672327231', '0001'); -- insert into Deletes -- values('00000008', '10000008', '9780672327232', '0002'); -- insert into Deletes -- values('00000002', '10000002', '9780672327454', '0003'); -- insert into Deletes -- values('00000006', '10000006', '9780672327243', '0004'); -- insert into Deletes -- values('00000007', '10000007', '9780672327433', '0005'); -- This table is not doing much. It is not referencing to which books have been or not been reserved. Either, we discard this one or add its fields to another table -- CREATE TABLE Reserved_On -- ( -- member_id CHAR(8), -- start_date DATE, -- due_date DATE, -- PRIMARY KEY (start_date, due_date, member_id), -- FOREIGN KEY (member_id) REFERENCES Members ON DELETE CASCADE, -- FOREIGN KEY (start_date, due_date) REFERENCES Time_Period ON DELETE CASCADE -- ); -- insert into Reserved_On -- values('00000001', '19-Oct-13', '01-Nov-13'); -- insert into Reserved_On -- values('00000002', '20-Oct-13', '02-Nov-13'); -- insert into Reserved_On -- values('00000003', '21-Oct-13', '03-Nov-13'); -- insert into Reserved_On -- values('00000004', '22-Oct-13', '04-Nov-13'); -- insert into Reserved_On -- values('00000005', '23-Oct-13', '05-Nov-13'); -- CREATE TABLE Returns -- ( -- rental_id CHAR(10), -- returned_date DATE, -- copy_id CHAR(4), -- isbn CHAR(13), -- branch_id CHAR(4), -- PRIMARY KEY (rental_id, returned_date), -- FOREIGN KEY (copy_id, isbn, branch_id) REFERENCES Book_Copy ON DELETE CASCADE -- ); -- insert into Returns -- values('0000000002', '01-Nov-13', '0002', '9780672327232', '0002'); -- insert into Returns -- values('0000000003', '01-Nov-13', '0001', '9780672327454', '0003'); -- insert into Returns -- values('0000000004', '02-Nov-13', '0004', '9780672327243', '0004'); -- insert into Returns -- values('0000000005', '02-Nov-13', '0012', '9780672327433', '0005');
/* Add the userAvatar attribute for ldap */ alter table baseauthenticationconfiguration add column USER_AVATAR varchar(1024);
CREATE Procedure sp_acc_cancel_ARV (@DocumentID int,@CancellationRemarks nVarchar(4000) = NULL) as Update ARVAbstract Set Status = (isnull(Status,0) | 192), CancellationRemarks = @CancellationRemarks where Documentid = @DocumentID
USE sakila SELECT first_name, last_name, film_id FROM actor INNER JOIN film_actor USING (actor_id) LIMIT 20; SELECT first_name, last_name, film_id FROM actor, film_actor WHERE actor.actor_id = film_actor.actor_id LIMIT 20; SELECT first_name, last_name, film_id FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id LIMIT 20; SELECT first_name, last_name, film_id FROM actor, film_actor LIMIT 20; SELECT COUNT(*) FROM actor, film_actor; SELECT first_name, last_name, film_id FROM actor INNER JOIN film_actor;
-- MySQL dump 10.13 Distrib 5.1.33, for Win32 (ia32) -- -- Host: localhost Database: redfins -- ------------------------------------------------------ -- Server version 5.1.33-community /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `bankac` -- DROP TABLE IF EXISTS `bankac`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bankac` ( `tid` int(11) NOT NULL, `ac` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `bankac` -- LOCK TABLES `bankac` WRITE; /*!40000 ALTER TABLE `bankac` DISABLE KEYS */; INSERT INTO `bankac` VALUES (4,'10080831280'),(6,'1020555584913'),(7,'1020555927228'),(3,'1090831280'),(1,'10987939092'),(2,'29612.0'); /*!40000 ALTER TABLE `bankac` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cap` -- DROP TABLE IF EXISTS `cap`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cap` ( `atmno` varchar(30) DEFAULT NULL, `name` varchar(30) DEFAULT NULL, `doe` varchar(20) DEFAULT NULL, `pin` varchar(20) DEFAULT NULL, `ac` bigint(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cap` -- LOCK TABLES `cap` WRITE; /*!40000 ALTER TABLE `cap` DISABLE KEYS */; INSERT INTO `cap` VALUES ('10002900389020','shaurya','02-2016','b†¾P…«',10987939092),('1098734094202','shaurya','01-2013','ÂOçé`',29612),('100998120561287','shaurya','01-2016','¯|“',1020555584913),('75816587872','shaurya','01-2018','b†¾P…«',1020555927228),('1345676478896060','shaurya','02-2017','©ØÞ» ',1090831280); /*!40000 ALTER TABLE `cap` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `capc` -- DROP TABLE IF EXISTS `capc`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `capc` ( `value` varchar(30) DEFAULT NULL, `Addr` varchar(30) DEFAULT NULL, `inde` int(9) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `capc` -- LOCK TABLES `capc` WRITE; /*!40000 ALTER TABLE `capc` DISABLE KEYS */; INSERT INTO `capc` VALUES ('warrok','C:\\Users\\user\\Pictures\\\0.png',NULL),('denty','C:\\Users\\user\\Pictures\\1.png',1),('starken','C:\\Users\\user\\Pictures\\2.png',2),('disbud','C:\\Users\\user\\Pictures\\3.png',3),('veiler','C:\\Users\\user\\Pictures\\4.png',4),('holistic','C:\\Users\\user\\Pictures\\5.png',5),('woziha','C:\\Users\\user\\Pictures\\6.png',6),('bijew','C:\\Users\\user\\Pictures\\7.png',7),('squiffed','C:\\Users\\user\\Pictures\\8.png',8),('braded','C:\\Users\\user\\Pictures\\9.png',9),('ingerob','C:\\Users\\user\\Pictures\\10.png',10); /*!40000 ALTER TABLE `capc` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cl` -- DROP TABLE IF EXISTS `cl`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cl` ( `cl` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cl` -- LOCK TABLES `cl` WRITE; /*!40000 ALTER TABLE `cl` DISABLE KEYS */; INSERT INTO `cl` VALUES (2); /*!40000 ALTER TABLE `cl` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `date` -- DROP TABLE IF EXISTS `date`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `date` ( `d1` date DEFAULT NULL, `d2` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `date` -- LOCK TABLES `date` WRITE; /*!40000 ALTER TABLE `date` DISABLE KEYS */; INSERT INTO `date` VALUES ('2014-02-27','2014-02-13'); /*!40000 ALTER TABLE `date` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `deduct` -- DROP TABLE IF EXISTS `deduct`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deduct` ( `pf` decimal(7,3) DEFAULT NULL, `hra` decimal(7,3) DEFAULT NULL, `da` decimal(7,3) DEFAULT NULL, `insurance` decimal(7,3) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `deduct` -- LOCK TABLES `deduct` WRITE; /*!40000 ALTER TABLE `deduct` DISABLE KEYS */; INSERT INTO `deduct` VALUES ('20.000','12.000','90.000','10.000'); /*!40000 ALTER TABLE `deduct` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `dept` -- DROP TABLE IF EXISTS `dept`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dept` ( `depart` varchar(30) NOT NULL, PRIMARY KEY (`depart`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `dept` -- LOCK TABLES `dept` WRITE; /*!40000 ALTER TABLE `dept` DISABLE KEYS */; INSERT INTO `dept` VALUES ('Account'),('Administration'),('Teaching'); /*!40000 ALTER TABLE `dept` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `detect` -- DROP TABLE IF EXISTS `detect`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `detect` ( `eid` int(11) DEFAULT NULL, `ltime` time DEFAULT NULL, `Ldate` date DEFAULT NULL, `status` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `detect` -- LOCK TABLES `detect` WRITE; /*!40000 ALTER TABLE `detect` DISABLE KEYS */; INSERT INTO `detect` VALUES (1,'17:11:16','2014-01-21','Access Granted'),(1,'22:30:48','2014-01-22','Access Granted'),(1,'15:57:35','2014-01-23','Access Granted'),(1,'16:13:14','2014-01-23','Access Granted'); /*!40000 ALTER TABLE `detect` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `dummy` -- DROP TABLE IF EXISTS `dummy`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dummy` ( `name` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `dummy` -- LOCK TABLES `dummy` WRITE; /*!40000 ALTER TABLE `dummy` DISABLE KEYS */; /*!40000 ALTER TABLE `dummy` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `earning` -- DROP TABLE IF EXISTS `earning`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `earning` ( `tid` int(11) NOT NULL, `lta` decimal(7,3) DEFAULT NULL, `ma` decimal(7,3) DEFAULT NULL, `ca` decimal(7,3) DEFAULT NULL, `cca` decimal(7,3) DEFAULT NULL, PRIMARY KEY (`tid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `earning` -- LOCK TABLES `earning` WRITE; /*!40000 ALTER TABLE `earning` DISABLE KEYS */; /*!40000 ALTER TABLE `earning` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `led` -- DROP TABLE IF EXISTS `led`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `led` ( `tid` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `led` -- LOCK TABLES `led` WRITE; /*!40000 ALTER TABLE `led` DISABLE KEYS */; INSERT INTO `led` VALUES (2),(3); /*!40000 ALTER TABLE `led` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `leve` -- DROP TABLE IF EXISTS `leve`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `leve` ( `tid` int(11) DEFAULT NULL, `tname` varchar(36) DEFAULT NULL, `dfrom_mm_dd_yy` date DEFAULT NULL, `dto_mm_dd_yy` date DEFAULT NULL, `typel` char(20) DEFAULT NULL, `hfday` char(10) DEFAULT NULL, UNIQUE KEY `tid` (`tid`,`dfrom_mm_dd_yy`,`dto_mm_dd_yy`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `leve` -- LOCK TABLES `leve` WRITE; /*!40000 ALTER TABLE `leve` DISABLE KEYS */; INSERT INTO `leve` VALUES (2,'Piyush dfg','2014-01-15','2014-01-31','CASUAL','full day'),(3,'Pushpraj Singh','2014-01-15','2014-01-31','CASUAL','full day'),(1,'shaurya dsgwre','2014-01-21','2014-01-29','CASUAL','full day'),(1,'shaurya dsgwre','2014-02-13','2014-02-27','CASUAL','full day'),(2,'Piyush dfg','2014-02-13','2014-02-27','CASUAL','full day'); /*!40000 ALTER TABLE `leve` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `login` -- DROP TABLE IF EXISTS `login`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `login` ( `tid` int(11) NOT NULL, `ename` varchar(45) DEFAULT NULL, `epass` varchar(45) DEFAULT NULL, PRIMARY KEY (`tid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `login` -- LOCK TABLES `login` WRITE; /*!40000 ALTER TABLE `login` DISABLE KEYS */; INSERT INTO `login` VALUES (1,'shaurya','pratap'); /*!40000 ALTER TABLE `login` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `maximum` -- DROP TABLE IF EXISTS `maximum`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `maximum` ( `i` int(11) DEFAULT NULL, `i2` varchar(40) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `maximum` -- LOCK TABLES `maximum` WRITE; /*!40000 ALTER TABLE `maximum` DISABLE KEYS */; /*!40000 ALTER TABLE `maximum` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `pf1` -- DROP TABLE IF EXISTS `pf1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `pf1` ( `tid` int(11) DEFAULT NULL, `pf` decimal(12,4) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `pf1` -- LOCK TABLES `pf1` WRITE; /*!40000 ALTER TABLE `pf1` DISABLE KEYS */; INSERT INTO `pf1` VALUES (1,'7220.0000'),(2,'7600.0000'),(2,'7600.0000'),(2,'7600.0000'),(1,'7220.0000'),(1,'7220.0000'),(2,'7600.0000'),(1,'7220.0000'),(1,'7220.0000'),(1,'7220.0000'),(1,'7220.0000'),(2,'7600.0000'),(1,'7220.0000'),(6,'7600.0000'),(3,'7600.0000'),(3,'7600.0000'),(7,'7600.0000'),(1,'7220.0000'); /*!40000 ALTER TABLE `pf1` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `picture` -- DROP TABLE IF EXISTS `picture`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `picture` ( `eid` int(11) DEFAULT NULL, `Adr` blob ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `picture` -- LOCK TABLES `picture` WRITE; /*!40000 ALTER TABLE `picture` DISABLE KEYS */; INSERT INTO `picture` VALUES (1,'C:\\Users\\USER2\\Pictures\\logo.png'),(2,'C:\\Users\\Public\\aa.jpg'),(3,'C:\\Users\\Public\\IMAGG\\pppp.PNG'),(4,'null'),(5,'C:\\Users\\user\\Desktop\\Untitled-2 copy.jpg'),(6,'C:\\Users\\user\\Desktop\\Imagg\\\reload copy.png'),(6,'null'),(7,'null'),(8,'C:\\Users\\user\\Downloads\\2_4_1_3_eng.png'); /*!40000 ALTER TABLE `picture` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `post` -- DROP TABLE IF EXISTS `post`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `post` ( `post` varchar(40) NOT NULL DEFAULT '', PRIMARY KEY (`post`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `post` -- LOCK TABLES `post` WRITE; /*!40000 ALTER TABLE `post` DISABLE KEYS */; INSERT INTO `post` VALUES ('Accountant'),('Junior(Sec.) Teacher'),('Primary(Sec.) Teacher'),('Principal'),('Senior(Sec.) Teacher'); /*!40000 ALTER TABLE `post` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `salary` -- DROP TABLE IF EXISTS `salary`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `salary` ( `Tid` int(11) NOT NULL, `bsal` decimal(10,2) DEFAULT NULL, `lta` decimal(10,2) DEFAULT NULL, `ma` decimal(10,2) DEFAULT NULL, `ca` decimal(10,2) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `salary` -- LOCK TABLES `salary` WRITE; /*!40000 ALTER TABLE `salary` DISABLE KEYS */; INSERT INTO `salary` VALUES (1,'19000.00','100.00','100.00','100.00'),(2,'20000.00','12.00','100.00','100.00'),(3,'20000.00','10.00','10.00','10.00'),(4,'4545.00','10000.00','2000.00','0.00'),(6,'20000.00','10.00','10.00','10.00'),(7,'20000.00','12.00','10.00','12.00'); /*!40000 ALTER TABLE `salary` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `saldet` -- DROP TABLE IF EXISTS `saldet`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `saldet` ( `tid` int(11) DEFAULT NULL, `bl` decimal(12,4) DEFAULT NULL, `month` varchar(30) DEFAULT NULL, `year` varchar(30) DEFAULT NULL, `status` varchar(39) DEFAULT NULL, UNIQUE KEY `tid` (`tid`,`month`,`year`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `saldet` -- LOCK TABLES `saldet` WRITE; /*!40000 ALTER TABLE `saldet` DISABLE KEYS */; INSERT INTO `saldet` VALUES (4,'19453.9000','12','2013','DELAYED'),(3,'22096.6667','1','2014','PAID'),(1,'21313.3333','1','2014','PAID'),(2,'29612.0000','1','2014','PAID'),(6,'29430.0000','1','2014','PAID'),(7,'39396.0000','1','2014','PAID'); /*!40000 ALTER TABLE `saldet` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `schoolinfo` -- DROP TABLE IF EXISTS `schoolinfo`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `schoolinfo` ( `schna` blob, `schad` blob, `pincode` int(11) DEFAULT NULL, `schlweb` blob ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `schoolinfo` -- LOCK TABLES `schoolinfo` WRITE; /*!40000 ALTER TABLE `schoolinfo` DISABLE KEYS */; INSERT INTO `schoolinfo` VALUES ('R.R MORARKA PUBLIC SCHOOL','Dwarikesh Nagar,Dist.Bijnor,U.P(West)',234567,'www.rrmps.com'); /*!40000 ALTER TABLE `schoolinfo` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `substi` -- DROP TABLE IF EXISTS `substi`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `substi` ( `tid` int(11) DEFAULT NULL, `period` varchar(20) DEFAULT NULL, `Subs` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `substi` -- LOCK TABLES `substi` WRITE; /*!40000 ALTER TABLE `substi` DISABLE KEYS */; /*!40000 ALTER TABLE `substi` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `td` -- DROP TABLE IF EXISTS `td`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `td` ( `tid` int(11) NOT NULL, `Fname` varchar(30) DEFAULT NULL, `Lname` varchar(30) DEFAULT NULL, `DOb` date DEFAULT NULL, `Ad` blob, `Gender` set('M','F') DEFAULT NULL, `Q1` blob, `Q2` blob, `Q3` blob, `Q4` blob, `Q5` blob, `Phn` bigint(20) DEFAULT NULL, `Exper` varchar(30) DEFAULT NULL, `Presc` blob, `house` set('Patel','Vivekanand','Baghat','Tagore') DEFAULT NULL, `st` varchar(20) DEFAULT NULL, `sm` varchar(20) DEFAULT NULL, `post` varchar(40) DEFAULT NULL, `dep` varchar(40) DEFAULT NULL, PRIMARY KEY (`tid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `td` -- LOCK TABLES `td` WRITE; /*!40000 ALTER TABLE `td` DISABLE KEYS */; INSERT INTO `td` VALUES (5,'srishti','singh','1960-07-20','s\ns\ns\ns','F','df f','l','l','l','l',1,'1','as','Vivekanand','null','Non-Married','Principal','Account'),(6,'Aditiya','Chauhan','1960-10-07','','M','','','','','',67571231,'0','R.K Public School','Vivekanand','Teaching','Non-Married','Primary(Sec.) Teacher','Teaching'),(7,'Anita','chauhan','1960-00-01','Punjabi Colony,\nNagina,\nBijnor','F','Adarsh gramidrgh Inter coolege','Adarsh gramidrgh Inter coolege','Vardhman college','Vardhman college','',7417496969,'18','Holi Child','Vivekanand','Teaching','Married','Accountant','Account'),(8,'hgfc','','1960-00-01','','M','','','','','',72225555555,'2','st.mary','Tagore','Teaching','Married','Senior(Sec.) Teacher','Teaching'); /*!40000 ALTER TABLE `td` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tdetail` -- DROP TABLE IF EXISTS `tdetail`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tdetail` ( `tid` int(11) NOT NULL, `Fname` varchar(30) DEFAULT NULL, `Lname` varchar(30) DEFAULT NULL, `DOb` date DEFAULT NULL, `Ad` blob, `Gender` set('M','F') DEFAULT NULL, `Q1` blob, `Q2` blob, `Q3` blob, `Q4` blob, `Q5` blob, `Phn` bigint(20) DEFAULT NULL, `Exper` varchar(30) DEFAULT NULL, `Presc` blob, `clal` varchar(20) DEFAULT NULL, `house` set('Patel','Vivekanand','Baghat','Tagore') DEFAULT NULL, PRIMARY KEY (`tid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tdetail` -- LOCK TABLES `tdetail` WRITE; /*!40000 ALTER TABLE `tdetail` DISABLE KEYS */; INSERT INTO `tdetail` VALUES (1,'shaurya','Pratap singh','1960-00-01','edf','M','d','d','gf','ghj','hgt',99876,'fv','gngh',NULL,'Tagore'); /*!40000 ALTER TABLE `tdetail` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `timetable` -- DROP TABLE IF EXISTS `timetable`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `timetable` ( `tid` int(11) DEFAULT NULL, `tname` varchar(30) DEFAULT NULL, `Day` varchar(10) DEFAULT NULL, `Period` int(11) DEFAULT NULL, `class` varchar(20) DEFAULT NULL, UNIQUE KEY `tid` (`tid`,`Period`,`Day`), UNIQUE KEY `tid_2` (`tid`,`Period`,`Day`), UNIQUE KEY `tid_3` (`tid`,`Period`,`Day`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `timetable` -- LOCK TABLES `timetable` WRITE; /*!40000 ALTER TABLE `timetable` DISABLE KEYS */; INSERT INTO `timetable` VALUES (1,'shaurya dsgwre','Monday',1,'null'),(1,'shaurya dsgwre','Monday',2,'Free'),(1,'shaurya dsgwre','Monday',3,'Free'),(1,'shaurya dsgwre','Monday',4,'Free'),(1,'shaurya dsgwre','Monday',5,'12'),(1,'shaurya dsgwre','Monday',6,'11'),(1,'shaurya dsgwre','Monday',7,'11'),(1,'shaurya dsgwre','Monday',8,'Free'),(2,'Piyush dfg','Monday',1,'null'),(2,'Piyush dfg','Monday',2,'11'),(2,'Piyush dfg','Monday',3,'11'),(2,'Piyush dfg','Monday',4,'11'),(2,'Piyush dfg','Monday',5,'11'),(2,'Piyush dfg','Monday',6,'11'),(2,'Piyush dfg','Monday',7,'Free'),(2,'Piyush dfg','Monday',8,'Free'),(1,'shaurya','WednesDay',1,'null'),(1,'shaurya','WednesDay',2,'11'),(1,'shaurya','WednesDay',3,'11'),(1,'shaurya','WednesDay',4,'Free'); /*!40000 ALTER TABLE `timetable` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `timeu` -- DROP TABLE IF EXISTS `timeu`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `timeu` ( `tid` int(11) DEFAULT NULL, `tname` varchar(30) DEFAULT NULL, `Day` varchar(10) DEFAULT NULL, `Period` int(11) DEFAULT NULL, `class` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `timeu` -- LOCK TABLES `timeu` WRITE; /*!40000 ALTER TABLE `timeu` DISABLE KEYS */; INSERT INTO `timeu` VALUES (1,'shaurya dsgwre','Monday',1,'null'),(1,'shaurya dsgwre','Monday',2,'Free'),(1,'shaurya dsgwre','Monday',3,'Free'),(1,'shaurya dsgwre','Monday',4,'Free'),(1,'shaurya dsgwre','Monday',5,'12'),(1,'shaurya dsgwre','Monday',6,'11'),(1,'shaurya dsgwre','Monday',7,'11'),(1,'shaurya dsgwre','Monday',8,'Free'),(2,'Piyush dfg','Monday',1,'null'),(2,'Piyush dfg','Monday',2,'11'),(2,'Piyush dfg','Monday',3,'11'),(2,'Piyush dfg','Monday',4,'11'),(2,'Piyush dfg','Monday',5,'11'),(2,'Piyush dfg','Monday',6,'11'),(2,'Piyush dfg','Monday',7,'Free'),(2,'Piyush dfg','Monday',8,'Free'),(1,'shaurya','WednesDay',1,'null'),(1,'shaurya','WednesDay',2,'11'),(1,'shaurya','WednesDay',3,'11'),(1,'shaurya','WednesDay',4,'Free'); /*!40000 ALTER TABLE `timeu` 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 2014-01-23 14:45:51
DROP TABLE IF EXISTS cats; CREATE TABLE cats ( id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, age INTEGER NOT NULL, favorite_food TEXT ); DROP TABLE IF EXISTS games; CREATE TABLE games ( id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, title TEXT NOT NULL, game_system TEXT NOT NULL, genre TEXT NOT NULL ); DROP TABLE IF EXISTS movies; CREATE TABLE movies ( id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, title TEXT NOT NULL, director TEXT NOT NULL, genre TEXT NOT NULL ); DROP TABLE IF EXISTS books; CREATE TABLE books ( id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, title TEXT NOT NULL, author TEXT NOT NULL, genre TEXT NOT NULL ); DROP TABLE IF EXISTS music; CREATE TABLE music ( id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, artist TEXT NOT NULL, album TEXT NOT NULL, song TEXT NOT NULL );
1. 인라인뷰를 사용해서 Student테이블과 department 테이블을 사용해서 학과별로 학생들의 최대키와 몸무게 학과 이름을 출력하세요 select * from student; select * from department; select d.dname, s."MAX_HEIGHT", s."MAX_WEIGHT" from (select deptno, max(height) "MAX_HEIGHT", max(weight) "MAX_WEIGHT" from student join department on deptno1 = deptno or deptno2 = deptno group by deptno) s join department d on s.deptno = d.deptno; ------------------------------------------------------------------- DNAME MAX_HEIGTH MAX_WEIGHT ------------------------------------------------------------------- Computer Engineering 182 72 ------------------------------------------------------------------- 2.student 테이블과 department테이블을 사용하여 학과이름,학과별 최대키 학과별로 가장키가 큰학생들의 이름과 키를 인라인뷰를 사용하여 출력하시요 select s1."DNAME", s1."MAX_HEIGHT", s2.name, s2.height from (select d.deptno "DEPTNO", d.dname "DNAME", s."MAX_HEIGHT" "MAX_HEIGHT" from (select deptno, max(height) "MAX_HEIGHT" from student join department on deptno1 = deptno or deptno2 = deptno group by deptno) s join department d on s.deptno = d.deptno) s1 join student s2 on (s2.deptno1 = s1."DEPTNO" or s2.deptno2 = s1."DEPTNO") and s2.height = s1."MAX_HEIGHT"; ------------------------------------------------------------------------------ DNAME MAX_HEIGTH NAME HEIGHT ------------------------------------------------------------------------------- Software Engineering 182 Sandra Bullock 182 ------------------------------------------------------------------------------- 3.student 테이블에서 학생의키가 동일 학년의 평균키보다 큰학생들의 학년과 이름과 키,해당학년의 평균키를 출력하세요(학년컬럼으로 오름차순) select s1.grade, s1.name, s1.height, s."AVG_HEIGHT" from (select grade, round(avg(height)) "AVG_HEIGHT" from student group by grade) s join student s1 on s1.grade = s. grade and s1.height > s."AVG_HEIGHT" order by 1; ------------------------------------------------------------ GRADE NAME HEIGHT AVG_HEIGHT ------------------------------------------------------------ 1 Sean Connery 175 170.4 ------------------------------------------------------------ 4.professor 테이블을 조회하여 교수들의 급여순위와 교수이름,급여를출력하세요 급여순위는 급여가 많은 사람부터 1~5위까지 출력하세요. 결과1> select rownum "Ranking", p.name, p.pay from (select name, pay from professor order by pay desc) p where rownum >=1 and rownum <=5; -------------------------------- Ranking NAME PAY -------------------------------- 1 2 3 4 5 -------------------------------- 결과2> select p1."Rangking", p1.name, p1.pay from (select rownum "Rangking", p.name, p.pay from (select name, pay from professor order by pay desc) p) p1 where p1."Rangking" >=3 and p1."Rangking" <=5; -------------------------------- Ranking NAME PAY -------------------------------- 3 4 5 --------------------------------
-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Hôte : 127.0.0.1:3306 -- Généré le : jeu. 21 déc. 2017 à 08:40 -- Version du serveur : 5.7.19 -- Version de PHP : 7.1.9 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 */; -- -- Base de données : `ipssi-php-oop` -- -- -------------------------------------------------------- -- -- Structure de la table `meeting` -- DROP TABLE IF EXISTS `meeting`; CREATE TABLE IF NOT EXISTS `meeting` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nameMeeting` varchar(255) NOT NULL, `date_debut` date DEFAULT NULL, `date_fin` date DEFAULT NULL, `descriptionMeeting` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -- -- Déchargement des données de la table `meeting` -- INSERT INTO `meeting` (`id`, `nameMeeting`, `date_debut`, `date_fin`, `descriptionMeeting`) VALUES (1, 'Meeting PHP', '2017-05-12', '2017-06-25', 'Description du meeting PHP. Depuis PHP 5.4, il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire.\r\nDepuis PHP 5.5, il est possible de faire reference a un tableau litteral. Description du meeting PHP. Depuis PHP 5.4, il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire. Depuis PHP 5.5, il est possible de faire reference a un tableau litteral.'), (2, 'Meeting Wordpress', '2018-06-15', '2018-09-29', 'Description du meeting Wordpress. Il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire. Il est possible de faire reference a un tableau litteral. Description du meeting PHP. Depuis PHP 5.4, il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire. Depuis PHP 5.5, il est possible de faire reference a un tableau litteral.'), (3, 'Meeting Html-CSS', '2016-09-16', '2017-11-22', 'Description du meeting Html/ CSS. Cependant, il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire.\r\nPuis il est possible de faire reference a un tableau litteral. Description du meeting PHP. Depuis PHP 5.4, il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire. Html/CSSl est possible de faire reference a un tableau litteral.'), (4, 'Meeting Java', '2018-05-23', '2018-10-28', 'Description du meeting JAVA. Cependant, il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire. Puis il est possible de faire reference a un tableau litteral. Description du meeting PHP. Depuis PHP 5.4, il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire. Html/CSSl est possible de faire reference a un tableau litteral.'), (5, 'Meeting Boostrap', '2017-10-01', '2017-12-30', 'Description du meeting Boostrap. Cependant, il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire. Puis il est possible de faire reference a un tableau litteral. Description du meeting PHP. Depuis PHP 5.4, il est possible de faire reference a un tableau resultant d\'une fonction ou d\'une methode directement. Avant, cela n\'etait possible qu\'en utilisant une variable temporaire. Html/CSSl est possible de faire reference a un tableau litteral.'); 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 tables --############################################################# -- drop table uba_als create table dbo.uba_als ( ID BIGINT not null, entity NVARCHAR(64) not null, attribute NVARCHAR(32) not null, state NVARCHAR(32) not null, roleName NVARCHAR(32) not null, actions INT not null ); -- drop table uba_els create table dbo.uba_els ( ID BIGINT not null, code NVARCHAR(32) null, description NVARCHAR(255) not null, disabled NUMERIC(1) not null default 0, entityMask NVARCHAR(128) not null, methodMask NVARCHAR(128) not null, ruleType VARCHAR(32) not null default 'A', ruleRole BIGINT not null ); -- drop table uba_role create table dbo.uba_role ( ID BIGINT not null, name NVARCHAR(128) not null, description NVARCHAR(256) not null, sessionTimeout INT not null default 30, allowedAppMethods NVARCHAR(2000) null ); -- drop table uba_subject create table dbo.uba_subject ( ID BIGINT not null, code NVARCHAR(128) not null, name NVARCHAR(128) not null, sType NVARCHAR(1) not null, mi_unityEntity NVARCHAR(64) not null ); -- drop table uba_user create table dbo.uba_user ( ID BIGINT not null, name NVARCHAR(128) not null, description NVARCHAR(255) null, uPasswordHashHexa NVARCHAR(64) null, disabled NUMERIC(1) not null default 0, isPending NUMERIC(1) not null default 0, trustedIP NVARCHAR(255) null, uData NVARCHAR(2000) null, lastPasswordChangeDate DATETIME not null default GETUTCDATE() ); -- drop table uba_userrole create table dbo.uba_userrole ( ID BIGINT not null, userID BIGINT not null, roleID BIGINT not null ); create table dbo.uba_audit ( ID BIGINT not null, entity NVARCHAR(32) not null, entityinfo_id BIGINT not null, actionType NVARCHAR(32) not null, actionUser NVARCHAR(128) not null, actionTime DATETIME not null, remoteIP NVARCHAR(40) null, targetUser NVARCHAR(128) null, targetRole NVARCHAR(128) null, fromValue NVARCHAR(MAX) null, toValue NVARCHAR(MAX) null ); create table dbo.ubs_settings ( ID BIGINT not null, settingKey NVARCHAR(150) not null, name NVARCHAR(150) not null, description NVARCHAR(1024) null, type NVARCHAR(32) null, settingValue NVARCHAR(2000) null, defaultValue NVARCHAR(150) null ); -- Create primary keys --############################################################# alter table dbo.uba_als add constraint PK_uba_als PRIMARY KEY CLUSTERED(ID); alter table dbo.uba_els add constraint PK_uba_els PRIMARY KEY CLUSTERED(ID); alter table dbo.uba_role add constraint PK_uba_role PRIMARY KEY CLUSTERED(ID); alter table dbo.uba_subject add constraint PK_uba_subject PRIMARY KEY CLUSTERED(ID); alter table dbo.uba_user add constraint PK_uba_user PRIMARY KEY CLUSTERED(ID); alter table dbo.uba_userrole add constraint PK_uba_userrole PRIMARY KEY CLUSTERED(ID); alter table dbo.uba_audit add constraint PK_uba_audit PRIMARY KEY CLUSTERED(ID); alter table dbo.ubs_settings add constraint PK_ubs_settings PRIMARY KEY CLUSTERED(ID);
SELECT im_m.*, im_u.* FROM im_message im_m, im_friend_dnexus im_f_d, im_user im_u WHERE im_f_d._self = im_m._to AND im_f_d._another = im_m._from AND im_m._to = 'zhangsan' AND im_m._from = 'lisi' AND im_m._createTime > im_f_d._lastReadTime AND im_u._userid = im_m._from --查询我与对方的未读消息 SELECT im_f_g.* FROM im_friend_group im_f_g LEFT JOIN im_user im_u ON im_f_g._pertain = im_u._userid WHERE im_u._userid = 'zhangsan'--我的id --查询我的分组 SELECT im_u.* FROM im_friend_dnexus im_f_d LEFT JOIN im_friend_group im_f_g ON im_f_d._groupId = im_f_g._id LEFT JOIN im_user im_u ON im_f_d._another = im_u._userid WHERE im_f_g._pertain = 'zhangsan' --我的id AND im_f_g._id = 'jiaren'--对应分组 --查询分组查询该组的所有好友 SELECT im_c_g.* FROM im_chat_member im_c_m LEFT JOIN im_chat_group im_c_g ON im_c_m._chatGroupId = im_c_g._id WHERE im_c_m._memberId = 'lisi'--我的id --查询我的所有群组聊天 SELECT im_m.*, im_u.* FROM im_chat_member im_c_m LEFT JOIN im_chat_group im_c_g ON im_c_m._chatGroupId = im_c_g._id LEFT JOIN im_message im_m ON im_m._to = im_c_g._id LEFT JOIN im_user im_u ON im_u._userid = im_m._from WHERE im_c_m._memberId = 'lisi'--我的id AND im_m._type = 'chatgroup'--消息类型 AND im_m._createTime > im_c_m._lastReadTime AND im_c_g._id = 'zhufang' --群组id --查询我在该群组的未读取的消息 SELECT im_m.*, im_u.* FROM im_message im_m, im_user im_u WHERE im_u._userid = im_m._from AND im_m._createTime < 200 AND im_m._type = 'chat' AND im_m._from = 'lisi' --聊天对象 AND im_m._to = 'zhangsan' --自己 GROUP BY im_m._createTime desc LIMIT 0,20 --和对方的聊天记录 SELECT im_m.*, im_u.* FROM im_message im_m, im_chat_member im_c_m, im_user im_u WHERE im_m._to = im_c_m._chatGroupId AND im_u._userid = im_c_m._memberId AND im_m._createTime < 2000 AND im_m._to = 'zhufang'--群id AND im_m._type = 'chatgroup' GROUP BY im_m._createTime DESC LIMIT 0,20; --获取群组的历史信息
SELECT id, 1/(1+exp(-1*( CASE WHEN wt IS NULL THEN 0.432664037 WHEN wt < 3.18000007 THEN 0.432664037 ELSE -0.354515553 END + CASE WHEN gear IS NULL THEN -0.351138353 WHEN gear < 3.5 THEN -0.351138353 ELSE 0.294480026 END + CASE WHEN wt IS NULL THEN 0.316431433 WHEN wt < 3.01250005 THEN 0.316431433 ELSE -0.252407461 END + CASE WHEN gear IS NULL THEN -0.28817305 WHEN gear < 3.5 THEN -0.28817305 ELSE 0.207338616 END + CASE WHEN wt IS NULL THEN 0.238736823 WHEN wt < 3.01250005 THEN 0.238736823 ELSE -0.205021918 END + CASE WHEN gear IS NULL THEN -0.249552786 WHEN gear < 3.5 THEN -0.249552786 ELSE 0.158202112 END + CASE WHEN wt IS NULL THEN 0.190222457 WHEN wt < 3.01250005 THEN 0.190222457 ELSE -0.170426115 END + CASE WHEN gear IS NULL THEN -0.221233815 WHEN gear < 3.5 THEN -0.221233815 ELSE 0.125863954 END + CASE WHEN qsec IS NULL THEN 0.197545245 WHEN qsec < 17.0349998 THEN 0.197545245 ELSE -0.14508976 END + CASE WHEN drat IS NULL THEN -0.1180714 WHEN drat < 4 THEN -0.1180714 ELSE 0.210712895 END + log(0.40625/(1-0.40625))))) AS score -- FROM `mtcars` FROM mtcars
-- phpMyAdmin SQL Dump -- version 5.1.1 -- https://www.phpmyadmin.net/ -- -- ホスト: localhost:8889 -- 生成日時: 2021 年 10 月 08 日 13:11 -- サーバのバージョン: 5.7.34 -- PHP のバージョン: 7.4.21 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 */; -- -- データベース: `gs_db` -- -- -------------------------------------------------------- -- -- テーブルの構造 `gs_user_table` -- CREATE TABLE `gs_user_table` ( `id` int(12) NOT NULL, `name` varchar(64) NOT NULL, `lid` varchar(128) NOT NULL, `lpw` varchar(64) NOT NULL, `kanri_flg` int(11) NOT NULL, `life_flg` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- テーブルのデータのダンプ `gs_user_table` -- INSERT INTO `gs_user_table` (`id`, `name`, `lid`, `lpw`, `kanri_flg`, `life_flg`) VALUES (9, '', '23232323', '9999', 1, 0), (10, '', 'spspspspsp', '99911111', 1, 0), (11, '', 'spspspspsp', '99911111', 1, 0), (12, '', 'spspspspsp', '99911111', 1, 0), (13, '', 'spspspspsp', '99911111', 1, 0), (14, '', '-', '99911111', 1, 0), (15, '', '-', '99911111', 1, 0), (16, '', 'packman_defence', '9999', 0, 0), (17, '', 'spspspspsp', '5555555', 1, 0), (18, '', '9999999', '999911111', 0, 0); -- -- ダンプしたテーブルのインデックス -- -- -- テーブルのインデックス `gs_user_table` -- ALTER TABLE `gs_user_table` ADD PRIMARY KEY (`id`); -- -- ダンプしたテーブルの AUTO_INCREMENT -- -- -- テーブルの AUTO_INCREMENT `gs_user_table` -- ALTER TABLE `gs_user_table` MODIFY `id` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23; 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 */;