blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
3
276
src_encoding
stringclasses
33 values
length_bytes
int64
23
9.61M
score
float64
2.52
5.28
int_score
int64
3
5
detected_licenses
listlengths
0
44
license_type
stringclasses
2 values
text
stringlengths
23
9.43M
download_success
bool
1 class
94113e02e49641af1c82c8884b490adaeb47442e
SQL
Armaniimus/portfolio_05-nov-2018
/projectFiles/projecten/Y1_P4_over-de-rhein/Database/Create_groen.sql
UTF-8
2,760
3.40625
3
[]
no_license
DROP DATABASE if EXISTS Project_over_de_rhein; CREATE DATABASE Project_over_de_rhein; USE Project_over_de_rhein; CREATE TABLE opdrachten( Opdrachtnummer INT AUTO_INCREMENT NOT NULL, Werkinstuctie VARCHAR(500) NOT NULL, Datum_uitvoering DATE NOT NULL, Kabelleverancier VARCHAR(80) NOT NULL, Waarnemingen VARCHAR(300) NOT NULL, Handtekening LONGBLOB NOT NULL, Aantal_bedrijfsuren Decimal(8,2) NOT NULL, Afleg_Redenen VARCHAR(300) NOT NULL, PRIMARY KEY (Opdrachtnummer) ); INSERT INTO opdrachten (Werkinstuctie, Datum_uitvoering, Kabelleverancier, Waarnemingen, Handtekening, Aantal_bedrijfsuren, Afleg_Redenen) VALUES ('W_instr 1', CURRENT_TIMESTAMP, 'Kabelleverancier 1', 'waarneming 1', 'Handtekening 1', 5.2, 'Afleg_Redenen 1'), ('W_instr 2', CURRENT_TIMESTAMP, 'Kabelleverancier 2', 'waarneming 2', 'Handtekening 2', 5.2, 'Afleg_Redenen 2'), ('W_instr 3', CURRENT_TIMESTAMP, 'Kabelleverancier 3', 'waarneming 3', 'Handtekening 3', 5.2, 'Afleg_Redenen 3'), ('W_instr 4', CURRENT_TIMESTAMP, 'Kabelleverancier 4', 'waarneming 4', 'Handtekening 4', 5.2, 'Afleg_Redenen 4'); CREATE TABLE Kabelchecklisten( KabelID INT AUTO_INCREMENT NOT NULL, Opdrachtnummer INT NOT NULL, Draadbreuk_6D INT NOT NULL, Draadbreuk_30D INT NOT NULL, Beschadiging_buitenzijde INT NOT NULL, Beschadiging_Roest_Corrosie INT NOT NULL, Verminderde_Kabeldiameter INT NOT NULL, Positie_Meetpunten INT NOT NULL, Beschadiging_Totaal INT NOT NULL, Type_Beschadiging_Roest INT NOT NULL, PRIMARY KEY (KabelID), FOREIGN KEY (Opdrachtnummer) REFERENCES opdrachten(Opdrachtnummer) ); INSERT INTO Kabelchecklisten(Opdrachtnummer, Draadbreuk_6D, Draadbreuk_30D, Beschadiging_buitenzijde, Beschadiging_Roest_Corrosie, Verminderde_Kabeldiameter, Positie_Meetpunten, Beschadiging_Totaal, Type_Beschadiging_Roest) VALUES (1,1,11,1,1,1,1,1,9), (1,1,24,5,6,1,1,4,9), (2,2,22,2,2,2,2,2,9), (2,9,23,8,2,2,5,4,9), (3,3,31,3,3,3,3,3,9), (4,4,44,4,4,4,4,4,9), (4,1,44,2,8,5,4,9,9), (4,3,24,1,3,5,7,9,2), (4,5,43,2,8,5,2,8,1); CREATE TABLE hijskraan( Hijskraan_Serienummer VARCHAR(50) NOT NULL UNIQUE, Hijskraan_fabrikaat VARCHAR(100) NOT NULL, Hijskraan_model_type VARCHAR(250) NOT NULL, Hijskraan_bedrijfsnummer VARCHAR(50) NOT NULL, Hijskraan_bouwjaar DATETIME NOT NULL, Type_kraan VARCHAR(19) NOT NULL, PRIMARY KEY (Hijskraan_Serienummer) ); CREATE TABLE Onderwagen( Onderwagen_identieficatienummer VARCHAR(50) NOT NULL UNIQUE, Onderwagen_fabrikaat VARCHAR(100) NOT NULL, Onderwagen_model_type VARCHAR(250) NOT NULL, Onderwagen_bedrijfsnummer VARCHAR(50) NOT NULL, Onderwagen_uitvoering VARCHAR(25) NOT NULL, PRIMARY KEY (Onderwagen_identieficatienummer) );
true
f4752f225f3faeb29e61bf2ae05723ebbf239673
SQL
tatsu245/SystemDesign
/tt_match_manager.sql
UTF-8
5,301
3.203125
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.11, for osx10.13 (x86_64) -- -- Host: localhost Database: tt_match_manager -- ------------------------------------------------------ -- Server version 8.0.11 /*!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 */; SET NAMES utf8mb4 ; /*!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 `Player` -- DROP TABLE IF EXISTS `Player`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `Player` ( `player_id` int(11) NOT NULL AUTO_INCREMENT, `player_name` varchar(50) DEFAULT NULL, `birthday` date DEFAULT NULL, `tall` double DEFAULT NULL, `weight` double DEFAULT NULL, `user_id` varchar(50) DEFAULT NULL, `team` varchar(100) DEFAULT NULL, PRIMARY KEY (`player_id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Player` -- LOCK TABLES `Player` WRITE; /*!40000 ALTER TABLE `Player` DISABLE KEYS */; INSERT INTO `Player` VALUES (1,'デビッド・ベッカム','1975-05-02',183,74,NULL,'ACミラン'),(2,'デビッド・ベッカム','1975-05-02',183,74,'ft','ACミラン'); /*!40000 ALTER TABLE `Player` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `Result` -- DROP TABLE IF EXISTS `Result`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `Result` ( `result_id` int(11) NOT NULL AUTO_INCREMENT, `player_name` varchar(50) DEFAULT NULL, `result_date` date DEFAULT NULL, `tournament_name` varchar(50) DEFAULT NULL, `count` varchar(50) DEFAULT NULL, `match_place` varchar(50) DEFAULT NULL, `opponent_name` varchar(50) DEFAULT NULL, `match_form` varchar(50) DEFAULT NULL, PRIMARY KEY (`result_id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Result` -- LOCK TABLES `Result` WRITE; /*!40000 ALTER TABLE `Result` DISABLE KEYS */; INSERT INTO `Result` VALUES (1,'デビッド・ベッカム','2018-07-22','小金井夏季市民大会','11-9','準決勝','ネイマール・ダ・シウバ','シングルス'); /*!40000 ALTER TABLE `Result` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `Tournament` -- DROP TABLE IF EXISTS `Tournament`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `Tournament` ( `tournament_id` int(11) NOT NULL AUTO_INCREMENT, `tournament_name` varchar(50) DEFAULT NULL, `start_date` date DEFAULT NULL, `end_date` date DEFAULT NULL, `place` varchar(100) DEFAULT NULL, `user_id` varchar(50) DEFAULT NULL, `participant` varchar(100) DEFAULT NULL, PRIMARY KEY (`tournament_id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Tournament` -- LOCK TABLES `Tournament` WRITE; /*!40000 ALTER TABLE `Tournament` DISABLE KEYS */; INSERT INTO `Tournament` VALUES (1,NULL,'2018-04-15','2018-04-15','小平市民総合体育館',NULL,'一般'),(2,NULL,'2018-04-22','2018-07-22','小平市民総合体育館',NULL,'一般'),(3,NULL,'2018-07-08','2018-07-08','小平市民総合体育館',NULL,'一般'),(4,'小金井夏季市民大会','2018-07-22','2018-07-29','小平市民総合体育館','ft','一般'); /*!40000 ALTER TABLE `Tournament` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `User` -- DROP TABLE IF EXISTS `User`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `User` ( `user_id` varchar(50) NOT NULL, `user_name` varchar(50) DEFAULT NULL, `student_number` varchar(10) DEFAULT NULL, `password` varchar(50) DEFAULT NULL, PRIMARY KEY (`user_id`), UNIQUE KEY `password` (`password`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `User` -- LOCK TABLES `User` WRITE; /*!40000 ALTER TABLE `User` DISABLE KEYS */; INSERT INTO `User` VALUES ('','','',''),('ft','古田龍将','e165413','mallow'),('na','市川なつみ','23416023','nmm777'),('test','古田龍将','e165413','test'); /*!40000 ALTER TABLE `User` 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 2018-07-26 19:51:04
true
7bae9db24f4ab2286d0e08fe93a850e87b74d6a1
SQL
grvgoel81/leetcode
/friend-requests-ii-who-has-the-most-friends.sql
UTF-8
237
3.28125
3
[]
no_license
SELECT id, COUNT(*) AS num FROM ( SELECT requester_id AS id, accepter_id FROM request_accepted UNION ALL SELECT accepter_id AS id, requester_id FROM request_accepted ) t GROUP BY id ORDER BY num desc LIMIT 1
true
1b0db8c71aff27c6bf8bd6483128e42c19c5aa3a
SQL
karinabarinova/uchat
/server/data/sql/auth.sql
UTF-8
505
3.5625
4
[]
no_license
-- Auth DROP TABLE IF EXISTS auth; CREATE TABLE IF NOT EXISTS auth ( id INTEGER PRIMARY KEY, user_id INTEGER NOT NULL, token TEXT, creation_date INTEGER DEFAULT NULL, FOREIGN KEY (user_id) REFERENCES user (user_id) ); CREATE TRIGGER AutoGenerateDATETIME_auth AFTER INSERT ON auth FOR EACH ROW WHEN (NEW.creation_date IS NULL) BEGIN UPDATE auth SET creation_date = (strftime('%s', CURRENT_TIMESTAMP)) WHERE rowid = NEW.rowid; END;
true
d2cb2339f4d6ce03bb182da37afe413044cf990c
SQL
fabricechatel/bam-app
/src/config/database/createbase.sql
UTF-8
10,620
3.296875
3
[]
no_license
drop schema bamdb; create schema if not exists bamdb; use bamdb; drop table if exists ADRESSE; drop table if exists ARTICLE; drop table if exists CARACTERISTIQUE; drop table if exists CATEGORIE; drop table if exists CLIENT; drop table if exists COMMANDE; drop table if exists COMMENTAIRE; drop table if exists FICHE; drop table if exists LIENS_CATEGORIE_ARTICLE; drop table if exists LIENS_CLIENT_ADRESSE; drop table if exists LIENS_COMMANDE_ADRESSE; drop table if exists LIENS_PANIER_ARTICLE; drop table if exists LIENS_PROMOTIONS_ARTICLES; drop table if exists LIENS_SPECS_ARTICLE; drop table if exists LIENS_SPECS_CATEGORIE; drop table if exists LIGNE_COMMANDE; drop table if exists LISTE_DE_SOUHAITS; drop table if exists MESSAGE; drop table if exists PANIER; drop table if exists PROMOTION; drop table if exists ROLE; drop table if exists UTILISATEUR; drop table if exists UTILISATEUR_ROLES; /*==============================================================*/ /* Table : ADRESSE */ /*==============================================================*/ create table ADRESSE ( ID_ADRESSE int not null, NUMERO varchar(16) not null, VOIE varchar(128) not null, CODE_POSTAL varchar(16) not null, VILLE varchar(64) not null, primary key (ID_ADRESSE) ); /*==============================================================*/ /* Table : ARTICLE */ /*==============================================================*/ create table ARTICLE ( ID_ARTICLE int not null, LIBELLE varchar(128), REFARTICLE varchar(64) not null, PRIX decimal not null, QUANTITESTOCK int not null, VISIBLE bool, primary key (ID_ARTICLE) ); /*==============================================================*/ /* Table : CARACTERISTIQUE */ /*==============================================================*/ create table CARACTERISTIQUE ( ID_CARACTERISTIQUE int not null, ATTRIBUT varchar(128), VALEUR varchar(128) not null, primary key (ID_CARACTERISTIQUE) ); /*==============================================================*/ /* Table : CATEGORIE */ /*==============================================================*/ create table CATEGORIE ( ID_CATEGORIE int not null, IDPARENT int not null, LIBELLE_CATEGORIE varchar(128), ACTIVE bool, primary key (ID_CATEGORIE) ); /*==============================================================*/ /* Table : CLIENT */ /*==============================================================*/ create table CLIENT ( ID_CLIENT int not null, ID_UTILISATEUR int not null, EMAIL varchar(128) not null, NOM varchar(64) not null, PRENOM varchar(64) not null, CIVILITE varchar(8) not null, ACTIF bool, primary key (ID_CLIENT) ); /*==============================================================*/ /* Table : COMMANDE */ /*==============================================================*/ create table COMMANDE ( ID_COMMANDE int not null, ID_CLIENT int not null, NUMEROCOMMANDE varchar(64) not null, MONTANT_TOTAL decimal not null, DATE_PAIEMENT datetime not null, IS_CANCELLED bool not null, primary key (ID_COMMANDE) ); /*==============================================================*/ /* Table : COMMENTAIRE */ /*==============================================================*/ create table COMMENTAIRE ( ID_COMMENTAIRE int not null, ID_ARTICLE int not null, ID_CLIENT int not null, NOTE decimal, DATE datetime, VISIBLE bool, primary key (ID_COMMENTAIRE) ); /*==============================================================*/ /* Table : FICHE */ /*==============================================================*/ create table FICHE ( ID_FICHE int not null, ID_ARTICLE int not null, NOM varchar(64), REFFICHE varchar(32), DESCRIPTION varchar(1024) not null, IMAGE varchar(256), IS_PUBLISHED bool, primary key (ID_FICHE) ); /*==============================================================*/ /* Table : LIENS_CATEGORIE_ARTICLE */ /*==============================================================*/ create table LIENS_CATEGORIE_ARTICLE ( ID_ARTICLE int not null, ID_CATEGORIE int not null, primary key (ID_ARTICLE, ID_CATEGORIE) ); /*==============================================================*/ /* Table : LIENS_CLIENT_ADRESSE */ /*==============================================================*/ create table LIENS_CLIENT_ADRESSE ( ID_CLIENT int not null, ID_ADRESSE int not null, primary key (ID_CLIENT, ID_ADRESSE) ); /*==============================================================*/ /* Table : LIENS_COMMANDE_ADRESSE */ /*==============================================================*/ create table LIENS_COMMANDE_ADRESSE ( ID_COMMANDE int not null, ID_ADRESSE int not null, ISFACTURATION bool, primary key (ID_COMMANDE, ID_ADRESSE) ); /*==============================================================*/ /* Table : LIENS_PANIER_ARTICLE */ /*==============================================================*/ create table LIENS_PANIER_ARTICLE ( IDPANIER int not null, ID_ARTICLE int not null, QUANTITEPANIER int, primary key (IDPANIER, ID_ARTICLE) ); /*==============================================================*/ /* Table : LIENS_PROMOTIONS_ARTICLES */ /*==============================================================*/ create table LIENS_PROMOTIONS_ARTICLES ( ID_ARTICLE int not null, ID_PROMOTION int not null, primary key (ID_ARTICLE, ID_PROMOTION) ); /*==============================================================*/ /* Table : LIENS_SPECS_ARTICLE */ /*==============================================================*/ create table LIENS_SPECS_ARTICLE ( ID_CARACTERISTIQUE int not null, ID_ARTICLE int not null, primary key (ID_CARACTERISTIQUE, ID_ARTICLE) ); /*==============================================================*/ /* Table : LIENS_SPECS_CATEGORIE */ /*==============================================================*/ create table LIENS_SPECS_CATEGORIE ( ID_CARACTERISTIQUE int not null, ID_CATEGORIE int not null, primary key (ID_CARACTERISTIQUE, ID_CATEGORIE) ); /*==============================================================*/ /* Table : LIGNE_COMMANDE */ /*==============================================================*/ create table LIGNE_COMMANDE ( ID_COMMANDE int not null, ID_ARTICLE int not null, QUANTITECOMMANDE int, PRIX decimal, STATUT varchar(16), primary key (ID_COMMANDE, ID_ARTICLE) ); /*==============================================================*/ /* Table : LISTE_DE_SOUHAITS */ /*==============================================================*/ create table LISTE_DE_SOUHAITS ( ID_ARTICLE int not null, ID_CLIENT int not null, primary key (ID_ARTICLE, ID_CLIENT) ); /*==============================================================*/ /* Table : MESSAGE */ /*==============================================================*/ create table MESSAGE ( ID_MESSAGE int not null, ID_SENDER int not null, ID_RECEIVER int not null, INTITULE varchar(64) not null, CORPS_MESSAGE varchar(1024) not null, DATE_MESSAGE datetime not null, LU bool, primary key (ID_MESSAGE) ); /*==============================================================*/ /* Table : PANIER */ /*==============================================================*/ create table PANIER ( IDPANIER int not null, ID_CLIENT int, REFINTERNAUTE varchar(64) not null, primary key (IDPANIER) ); /*==============================================================*/ /* Table : PROMOTION */ /*==============================================================*/ create table PROMOTION ( ID_PROMOTION int not null, NOM varchar(64), POURCENTAGE int not null, ACTIVE bool, primary key (ID_PROMOTION) ); /*==============================================================*/ /* Table : ROLE */ /*==============================================================*/ create table ROLE ( NOMROLE varchar(64) not null, ENABLED bool not null, primary key (NOMROLE) ); /*==============================================================*/ /* Table : UTILISATEUR */ /*==============================================================*/ create table UTILISATEUR ( ID_UTILISATEUR int not null, LOGIN varchar(64) not null, MDP varchar(64) not null, ACTIF bool, primary key (ID_UTILISATEUR) ); /*==============================================================*/ /* Table : UTILISATEUR_ROLES */ /*==============================================================*/ create table UTILISATEUR_ROLES ( IDUTILISATEURROLE int not null, NOMROLE varchar(64) not null, ID_UTILISATEUR int not null, ENABLED bool not null, primary key (IDUTILISATEURROLE) );
true
16699f32cc4678bf93643aad766ddee3d493421a
SQL
Alphaquest2005/MRManager
/WaterNut - Enterprise/Update Warehouse Errors.sql
UTF-8
9,467
2.765625
3
[]
no_license
update xcuda_Item set WarehouseError = null where WarehouseError = 'Cant find in Warehouse HSCode' update xcuda_Item set WarehouseError = 'impossible to find the given line in warehouse', DoNotEX = 1 where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where number = '25008' and LineNumber =3) update xcuda_Item set WarehouseError = null, DoNotEX = null where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where Number = '12922' ) and LineNumber =6) update xcuda_Item set WarehouseError = 'impossible to find the given line in warehouse' where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where Number = '24997') update xcuda_Item set WarehouseError = 'Delay Extenstion' where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where Number = '18336') update xcuda_Item set WarehouseError = 'Customs Release', DoNotEX = 1 where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where Number = '12922' and lineNumber = 70) update xcuda_Item set WarehouseError = 'Server Error' where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where Commodity_code = '70194000') update xcuda_Item set WarehouseError = 'Invalid HSCode' where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where Commodity_code = '4093000') update xcuda_Item set WarehouseError = 'Not Enough Product available in Warehouse' where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where number = '32490' and LineNumber =16) update xcuda_Item set WarehouseError = 'Quantities' where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where number = '16475' and LineNumber =45) update xcuda_Item set WarehouseError = 'Quantities' where Item_id in (SELECT AsycudaDocumentItem.Item_Id FROM AsycudaDocumentItem INNER JOIN AsycudaDocument ON AsycudaDocumentItem.AsycudaDocumentId = AsycudaDocument.ASYCUDA_Id WHERE --(AsycudaDocumentItem.InvalidHSCode = 1) AND ((AsycudaDocumentItem.ItemQuantity <> AsycudaDocumentItem.PiQuantity) or (AsycudaDocumentItem.ItemQuantity = 0)) AND (AsycudaDocument.DocumentType = 'IM7') and (AsycudaDocument.Cnumber = '9670') and (isnull(AsycudaDocument.cancelled,0) <> 1 )) --and (isnull(AsycudaDocument.DoNotAllocate,0) = 0 )) update xcuda_Item set WarehouseError = 'Cant find in Warehouse HSCode' where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where number = '18909' and Commodity_code = '61099010') update xcuda_Item set WarehouseError = 'Cancel verification' where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where number = '3633' and LineNumber = 17) update xcuda_Item set WarehouseError = 'Cancel verification' where Item_id in (SELECT AsycudaDocumentItem.Item_Id FROM AsycudaDocumentItem INNER JOIN AsycudaDocument ON AsycudaDocumentItem.AsycudaDocumentId = AsycudaDocument.ASYCUDA_Id WHERE --(AsycudaDocumentItem.InvalidHSCode = 1) AND ((AsycudaDocumentItem.ItemQuantity <> AsycudaDocumentItem.PiQuantity) or (AsycudaDocumentItem.ItemQuantity = 0)) AND (AsycudaDocument.DocumentType = 'IM7') and (AsycudaDocument.Cnumber = '388') and (isnull(AsycudaDocument.cancelled,0) <> 1 )) --and (isnull(AsycudaDocument.DoNotAllocate,0) = 0 )) update xcuda_Item set WarehouseError = 'Weight Issue' where Item_id in (SELECT xcuda_Item.Item_Id FROM xcuda_Item INNER JOIN xcuda_HScode ON xcuda_Item.Item_Id = xcuda_HScode.Item_Id INNER JOIN xcuda_Registration ON xcuda_Item.ASYCUDA_Id = xcuda_Registration.ASYCUDA_Id where number = '15622' and LineNumber = 7) select * from asycudadocumentitem where warehouseerror is not null and itemquantity <> piquantity /*and (isnull(AsycudaDocument.DoNotAllocate,0) = 0 )*/ SELECT AsycudaDocumentItem.Item_Id, AsycudaDocumentItem.AsycudaDocumentId, AsycudaDocumentItem.EntryDataDetailsId, AsycudaDocumentItem.LineNumber, AsycudaDocumentItem.IsAssessed, AsycudaDocumentItem.DoNotAllocate, AsycudaDocumentItem.DoNotEX, AsycudaDocumentItem.AttributeOnlyAllocation, AsycudaDocumentItem.Description_of_goods, AsycudaDocumentItem.Commercial_Description, AsycudaDocumentItem.Gross_weight_itm, AsycudaDocumentItem.Net_weight_itm, AsycudaDocumentItem.Item_price, AsycudaDocumentItem.ItemQuantity, AsycudaDocumentItem.PiQuantity, AsycudaDocumentItem.Suppplementary_unit_code, AsycudaDocumentItem.ItemNumber, AsycudaDocumentItem.TariffCode, AsycudaDocumentItem.TariffCodeLicenseRequired, AsycudaDocumentItem.TariffCategoryLicenseRequired, AsycudaDocumentItem.TariffCodeDescription, AsycudaDocumentItem.DutyLiability, AsycudaDocumentItem.Total_CIF_itm, AsycudaDocumentItem.Freight, AsycudaDocumentItem.Statistical_value, AsycudaDocumentItem.DPQtyAllocated, AsycudaDocumentItem.DFQtyAllocated, AsycudaDocumentItem.ImportComplete, AsycudaDocumentItem.CNumber, AsycudaDocumentItem.RegistrationDate, AsycudaDocumentItem.Number_of_packages, AsycudaDocumentItem.Country_of_origin_code, AsycudaDocumentItem.PiWeight, AsycudaDocumentItem.Currency_rate, AsycudaDocumentItem.Currency_code, AsycudaDocumentItem.InvalidHSCode, AsycudaDocumentItem.WarehouseError FROM AsycudaDocumentItem INNER JOIN AsycudaDocument ON AsycudaDocumentItem.AsycudaDocumentId = AsycudaDocument.ASYCUDA_Id INNER JOIN ApplicationSettings ON AsycudaDocumentItem.RegistrationDate <= ApplicationSettings.OpeningStockDate WHERE (AsycudaDocumentItem.ItemQuantity <> AsycudaDocumentItem.PiQuantity OR AsycudaDocumentItem.ItemQuantity = 0) AND (AsycudaDocument.DocumentType = 'IM7') AND (AsycudaDocument.CNumber IS NOT NULL) AND (ISNULL(AsycudaDocument.Cancelled, 0) <> 1) ORDER BY AsycudaDocumentItem.RegistrationDate update xcuda_Item set WarehouseError = 'Zero Quantity' where Item_id in (select tarification_id from xcuda_Supplementary_unit where Suppplementary_unit_quantity = 0 and IsFirstRow = 1) select * FROM AsycudaDocumentItem INNER JOIN AsycudaDocument ON AsycudaDocumentItem.AsycudaDocumentId = AsycudaDocument.ASYCUDA_Id where Item_id in (select tarification_id from xcuda_Supplementary_unit where Suppplementary_unit_quantity = 0 and IsFirstRow = 1) AND (AsycudaDocument.DocumentType = 'IM7') and (AsycudaDocument.Cnumber is not null) and (isnull(AsycudaDocument.cancelled,0) <> 1 ) SELECT AsycudaDocumentItem.CNumber, AsycudaDocumentItem.RegistrationDate, AsycudaDocumentItem.LineNumber, AsycudaDocumentItem.ItemNumber, AsycudaDocumentItem.Description_of_goods, AsycudaDocumentItem.Commercial_Description, AsycudaDocumentItem.Item_price, AsycudaDocumentItem.ItemQuantity, AsycudaDocumentItem.PiQuantity, AsycudaDocumentItem.TariffCode, AsycudaDocumentItem.PiWeight, AsycudaDocumentItem.Currency_rate, AsycudaDocumentItem.Currency_code, AsycudaDocumentItem.InvalidHSCode, AsycudaDocumentItem.WarehouseError FROM AsycudaDocumentItem INNER JOIN AsycudaDocument ON AsycudaDocumentItem.AsycudaDocumentId = AsycudaDocument.ASYCUDA_Id INNER JOIN ApplicationSettings ON AsycudaDocumentItem.RegistrationDate <= ApplicationSettings.OpeningStockDate WHERE (AsycudaDocumentItem.ItemQuantity > AsycudaDocumentItem.PiQuantity OR AsycudaDocumentItem.ItemQuantity = 0) AND (AsycudaDocument.DocumentType = 'IM7') AND (AsycudaDocument.CNumber IS NOT NULL) AND (ISNULL(AsycudaDocument.Cancelled, 0) <> 1) ORDER BY AsycudaDocumentItem.RegistrationDate
true
4acdd10215ad3f9c249953243e4ef884d2670473
SQL
Meosit/MentalAid
/additional/sql/2 user_data.sql
UTF-8
1,317
2.578125
3
[]
no_license
USE `mentalaid`; -- admin@12345 (administrator) INSERT INTO `user` (`id`, `email`, `username`, `pass_hash`, `role`) VALUES (1, 'mksn13@gmail.com', 'admin', '$2a$12$6BskHBTZfhDGOcYLZNOCZui5a7apSqHBzL9zidWANGax9ShKtM1nu', 1); -- Neskwi@54321 (user) INSERT INTO `user` (`email`, `username`, `pass_hash`) VALUES ('some1@email.com', 'Neskwi', '$2a$12$v.i376fH5F8NAtzoxKh3WOGl/U5K0tJnnCQsttEl2fugrL4.h0WHK'); -- lolwo@qwerty (user) INSERT INTO `user` (`email`, `username`, `pass_hash`) VALUES ('some2@email.com', 'lolwo', '$2a$12$MBfnsQujCtfMot8rBbSAWuhhKEKNqUP5/QJm4EvpRxp9kH6dSzDFC'); -- DYADOR@asdfg (user, banned) INSERT INTO `user` (`email`, `username`, `pass_hash`, `status`) VALUES ('some3@email.com', 'DYADOR', '$2a$12$brZ/7vgV/tO2YDtisFuj4uFn1stf9fbHDsHTIY14ZBlHla7fgGn/a', 0); -- appleWow@54321 (user) INSERT INTO `user` (`email`, `username`, `pass_hash`) VALUES ('some4@email.com', 'appleWow', '$2a$12$v.i376fH5F8NAtzoxKh3WOGl/U5K0tJnnCQsttEl2fugrL4.h0WHK'); -- NearYou@zxcvb (user) INSERT INTO `user` (`email`, `username`, `pass_hash`) VALUES ('some5@email.com', 'NearYou', '$2a$12$eH7ubmvMyFQVo2NmFdfWlOBiekWmn/VuFkBJ1iDavLhEBLdiaIjGm'); -- Nuclear@Keepo (user) INSERT INTO `user` (`email`, `username`, `pass_hash`) VALUES ('some6@email.com', 'Nuclear', '$2a$12$wtFOk1nXdw4fcJtc6i/V9eLMjNYzKuzdq3.KKviZSk0m63/TCz5NK'); -- Grifon@Kappa (user, deleted) INSERT INTO `user` (`email`, `username`, `pass_hash`, `status`) VALUES ('some7@email.com', 'Grifon', '$2a$12$hnMr9iCQcPwxpfnNfWD48Ol99I4KlfTG4qz354MskJoSV9L7Mtt0C', -1);
true
3735da61f5f2be03e42a7ffaedb49f2c864157cf
SQL
imonweb/Php_Shopping_Cart
/php_shopping_cart.sql
UTF-8
1,702
3.1875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.7.7 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Apr 19, 2018 at 11:54 PM -- Server version: 5.7.20 -- PHP Version: 7.0.27 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `php_shopping_cart` -- -- -------------------------------------------------------- -- -- Table structure for table `tbl_product` -- CREATE TABLE `tbl_product` ( `id` int(11) UNSIGNED NOT NULL, `name` varchar(255) NOT NULL DEFAULT '', `image` varchar(255) NOT NULL DEFAULT '', `price` double(10,2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_product` -- INSERT INTO `tbl_product` (`id`, `name`, `image`, `price`) VALUES (1, 'iPhone 6S', 'iPhone6S.png', 700.00), (2, 'iPhone 7', 'iPhone7.png', 800.00), (3, 'iPhone 8', 'iPhone8.png', 900.00), (4, 'iPhone X', 'iPhoneX.png', 1000.00); -- -- Indexes for dumped tables -- -- -- Indexes for table `tbl_product` -- ALTER TABLE `tbl_product` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tbl_product` -- ALTER TABLE `tbl_product` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
b40a69d032f0dc60bce49dc413a33d96e2ef77f4
SQL
royiwanhamonanganpasaribu/Try_CI_3
/application/assets/database/spk-jabatan.sql
UTF-8
2,599
3.046875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.6.6 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Sep 05, 2017 at 04:05 AM -- Server version: 5.7.17-log -- PHP Version: 5.6.30 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `spk-jabatan` -- -- -------------------------------------------------------- -- -- Table structure for table `karyawan` -- CREATE TABLE `karyawan` ( `nik` int(12) NOT NULL, `nama` varchar(22) NOT NULL, `jk` varchar(22) NOT NULL, `alamat` varchar(22) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `karyawan` -- INSERT INTO `karyawan` (`nik`, `nama`, `jk`, `alamat`) VALUES (33, 'Dodo', 'Laki-laki', '333'), (22, 'Agusta', 'Laki-laki', '22'), (44, 'Roy', 'Laki-laki', '44'); -- -------------------------------------------------------- -- -- Table structure for table `kriteria` -- CREATE TABLE `kriteria` ( `id_kriteria` varchar(22) NOT NULL, `nama_kriteria` varchar(55) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `kriteria` -- INSERT INTO `kriteria` (`id_kriteria`, `nama_kriteria`) VALUES ('001', 'Bertanggung Jawab'), ('002', 'Pekerjaan yang diselesaikan'), ('003', 'Tepat Waktu'); -- -------------------------------------------------------- -- -- Table structure for table `login` -- CREATE TABLE `login` ( `username` varchar(22) NOT NULL, `password` varchar(22) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `login` -- INSERT INTO `login` (`username`, `password`) VALUES ('admin', 'admin'); -- -------------------------------------------------------- -- -- Table structure for table `nilai` -- CREATE TABLE `nilai` ( `nik` int(22) NOT NULL, `nama` varchar(22) NOT NULL, `absensi` int(22) NOT NULL, `atitut` int(22) NOT NULL, `loyalitas` int(2) NOT NULL, `disiplin` int(2) NOT NULL, `skil` int(2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `nilai` -- INSERT INTO `nilai` (`nik`, `nama`, `absensi`, `atitut`, `loyalitas`, `disiplin`, `skil`) VALUES (33, 'Dodo', 33, 33, 33, 33, 33), (44, 'Roy', 44, 44, 44, 44, 44); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
5bdc9f8ff83e081e1d3c09a5954f442dd0760e9e
SQL
ogz00/Micro-Wallet-Leo-Oguz
/microwallet/src/main/resources/schema.sql
UTF-8
2,420
3.65625
4
[]
no_license
create table if not exists db_wallet.app_role ( id bigserial constraint app_role_pkey primary key, created_at timestamp, updated_at timestamp, updated_by varchar(255), version bigint, description varchar(255) not null, role_name varchar(255) not null ); create table if not exists db_wallet.player ( id bigserial not null constraint player_pkey primary key, created_at timestamp, updated_at timestamp, updated_by varchar(255), version bigint, country varchar(255) not null, full_name varchar(255) not null, password varchar(255) not null, username varchar(255) not null constraint uk_o39xn8lmj05iew7d2tgw836jy unique ); create table if not exists db_wallet.player_role ( player_id bigserial not null constraint player_role_player_id_fk references db_wallet.player on update cascade, role_id bigserial not null constraint player_role_app_role_id_fk references db_wallet.app_role on update cascade ); create table if not exists db_wallet.currency ( id bigserial not null constraint currency_pkey primary key, created_at timestamp, updated_at timestamp, updated_by varchar(255), version bigint, name varchar(255) not null unique, code varchar(255) not null unique ); create table if not exists db_wallet.wallet ( id bigserial not null constraint wallet_pkey primary key, created_at timestamp, updated_at timestamp, updated_by varchar(255), version bigint, player_id bigserial not null constraint wallet_player_id_fk references db_wallet.player on update cascade, currency_id bigserial not null constraint wallet_currency_id_fk references db_wallet.currency on update cascade ); create table if not exists db_wallet.transaction ( id bigserial not null constraint transaction_pkey primary key, created_at timestamp, updated_at timestamp, updated_by varchar(255), version bigint, supplied_id bigint, amount decimal, opening_balance decimal, wallet_id bigserial not null constraint transaction_wallet_id_fk references db_wallet.wallet on update cascade );
true
e04b4b20a14dafda60883dbd90d26d85e2440c17
SQL
jarryll/mvc-tweedr
/tables.sql
UTF-8
216
2.875
3
[]
no_license
CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY, username TEXT NOT NULL, password TEXT NOT NULL); CREATE TABLE IF NOT EXISTS tweeds (id SERIAL PRIMARY KEY, tweed TEXT, user_id INTEGER REFERENCES users (id));
true
6d9427ada20e06878348670422ed8d4b1403263b
SQL
phuongit0301/learnlaravel5
/learnlaravel5.sql
UTF-8
7,696
2.90625
3
[ "MIT" ]
permissive
-- MySQL dump 10.13 Distrib 5.5.46, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: learnlaravel5 -- ------------------------------------------------------ -- Server version 5.5.46-0ubuntu0.14.04.2 /*!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 `migrations` -- DROP TABLE IF EXISTS `migrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `migrations` ( `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `migrations` -- LOCK TABLES `migrations` WRITE; /*!40000 ALTER TABLE `migrations` DISABLE KEYS */; INSERT INTO `migrations` VALUES ('2014_10_12_000000_create_users_table',1),('2014_10_12_100000_create_password_resets_table',1),('2015_11_20_080242_create_roles_table',1),('2015_11_20_080302_create_permissions_table',1),('2015_11_20_080314_create_permission_role_table',1),('2015_11_20_080334_create_role_user_table',1); /*!40000 ALTER TABLE `migrations` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `password_resets` -- DROP TABLE IF EXISTS `password_resets`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', KEY `password_resets_email_index` (`email`), KEY `password_resets_token_index` (`token`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `password_resets` -- LOCK TABLES `password_resets` WRITE; /*!40000 ALTER TABLE `password_resets` DISABLE KEYS */; /*!40000 ALTER TABLE `password_resets` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `permission_role` -- DROP TABLE IF EXISTS `permission_role`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `permission_role` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `permission_id` int(11) NOT NULL, `role_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `permission_role` -- LOCK TABLES `permission_role` WRITE; /*!40000 ALTER TABLE `permission_role` DISABLE KEYS */; INSERT INTO `permission_role` VALUES (1,1,1),(2,1,2),(3,2,1); /*!40000 ALTER TABLE `permission_role` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `permissions` -- DROP TABLE IF EXISTS `permissions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `permissions` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `permission_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `permission_slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `permission_description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `permissions` -- LOCK TABLES `permissions` WRITE; /*!40000 ALTER TABLE `permissions` DISABLE KEYS */; INSERT INTO `permissions` VALUES (1,'admin permission','admin','this is permission admin'),(2,'user permission','user','this is permission user'); /*!40000 ALTER TABLE `permissions` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `role_user` -- DROP TABLE IF EXISTS `role_user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `role_user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `role_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `role_user` -- LOCK TABLES `role_user` WRITE; /*!40000 ALTER TABLE `role_user` DISABLE KEYS */; INSERT INTO `role_user` VALUES (1,1,1),(2,2,2),(3,2,1); /*!40000 ALTER TABLE `role_user` 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` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `role_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `role_slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!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,'admin','admin'),(2,'editor','editor'); /*!40000 ALTER TABLE `roles` 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(10) unsigned NOT NULL AUTO_INCREMENT, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(60) COLLATE utf8_unicode_ci NOT NULL, `first_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `last_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `users` -- LOCK TABLES `users` WRITE; /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` VALUES (1,'admin@gmail.com','$2y$10$TMe.0rzsDBQ4rVk/Q9nGfO9compG8DWHBkQj11V4/OLyKDF9dZsLm','admin','admin',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00',NULL),(2,'user@gmail.com','$2y$10$nN4HhLRmYUq1ghPaC2GT2.omGp42pfN0cGRlT8x2hW4Qttn5ftNMa','user','user',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00',NULL); /*!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 2015-11-20 17:16:26
true
a132ea5f90e69142bc65f9ad8c30b6af1ef9700a
SQL
syrus-ru/amficom
/AMFICOM/v2/database/schema/configuration/type/equipmenttype.sql
UTF-8
543
3.328125
3
[]
no_license
CREATE TABLE EquipmentType ( id NUMBER(20, 0), created DATE NOT NULL, modified DATE NOT NULL, creator_id NUMBER(20, 0) NOT NULL, modifier_id NUMBER(20, 0) NOT NULL, -- codename VARCHAR2(32) NOT NULL, description VARCHAR2(256), -- CONSTRAINT eqptype_pk PRIMARY KEY (id) ENABLE, CONSTRAINT eqptype_creator_fk FOREIGN KEY (creator_id) REFERENCES Users (id) ON DELETE CASCADE ENABLE, CONSTRAINT eqptype_modifier_fk FOREIGN KEY (modifier_id) REFERENCES Users (id) ON DELETE CASCADE ENABLE ); CREATE SEQUENCE equipmenttype_seq ORDER;
true
e7109c85e12f9442233212ff6e2cf9b1c38f1e63
SQL
yanleping/nlp
/src/main/resources/doc/sql/init.sql
UTF-8
1,242
3.484375
3
[]
no_license
drop table if exists article; drop table if exists similarity; /*==============================================================*/ /* Table: article */ /*==============================================================*/ create table article ( id bigint not null auto_increment comment 'id', wid bigint comment '文章id', author varchar(200) comment '作者', title varchar(500) comment '标题', digest varchar(1000) comment '文章缩略', content text comment '文章内容', word_count int comment '文章字数', create_time datetime comment '创建时间', primary key (id) ); /*==============================================================*/ /* Table: similarity */ /*==============================================================*/ create table similarity ( id bigint not null comment 'id', current_work_id bigint comment '当前文章id', target_work_id bigint comment '目标文章id', similarity decimal(20) comment '相似度', primary key (id) );
true
729df4d6b4f6bf51faacc1592e2588c3791c7400
SQL
consrg/web2project-documentation
/locales/en/documentation.inc
UTF-8
3,666
3.25
3
[]
no_license
## ## DO NOT MODIFY THIS FILE BY HAND! ## 'Show project documentation as PDF', '(None)', 'A list of valid special pages can be found at <a href=\"%s\" title=\"%s\">%s</a>.', 'Alternative text', 'Are you sure you want to delete this page ?', 'Big', 'Bold', 'Bulleted list', 'Cancel', 'Categories', 'Category', 'Category talk', 'Choose a picture', 'Clean', 'Code', 'Code Block / Code', 'Code block', 'Delete page', 'Description', 'Destination filename', 'Dimension', 'Documentation', 'Documentation Module Configuration', 'Documentation page', 'Edit', 'Edit page', 'Export the project documentation as PDF', 'File', 'File Name', 'File Type', 'File list', 'File talk', 'Filename contains forbidden characters', 'First Level Heading', 'General Options', 'Go to start page', 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5', 'Heading 6', 'Help', 'Help talk', 'Home', 'Image', 'Insert an internal link', 'Invalid extension', 'Italic', 'KB', 'Language', 'Link', 'List item', 'MIME type', 'Media', 'Name', 'New page', 'No such special page', 'Normal', 'Numeric list', 'Page', 'Page label', 'Page title', 'Pages in category', 'Pages index', 'Paragraph', 'Picture', 'Preview', 'Project', 'Quotes', 'Reference', 'References', 'Return to <a href=\"%s\" title=\"%s\">%s</a>.', 'Second Level Heading', 'Show this page as PDF', 'Size', 'Small', 'Source', 'Source filename', 'Special', 'Special pages', 'Special pages for all users', 'Start page ?', 'Start upload [s]', 'Starting number', 'Stroke through', 'Summary', 'Syntax', 'Table of Contents', 'Talk', 'Template', 'Template talk', 'Templates used by this page', 'The following categories exist in the documentation.', 'There are %d pages in this category', 'This page was last modified on %s.', 'Time format'=>'%d %B %Y at %H:%I', 'Title', 'To include the image in a page, use a link in the form <b>[[Image:File.jpg]]</b>, <b>[[Image:File.png|alt text]]</b> or <b>[[Media:File.ogg]]</b> for directly linking to the file.', 'UPLOAD_ERR_CANT_WRITE'=>'Failed to write file to disk', 'UPLOAD_ERR_EXTENSION'=>'A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.', 'UPLOAD_ERR_FORM_SIZE'=>'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form. ', 'UPLOAD_ERR_INI_SIZE'=>'The uploaded file exceeds the upload_max_filesize directive', 'UPLOAD_ERR_NO_FILE'=>'No file was uploaded. ', 'UPLOAD_ERR_NO_TMP_DIR'=>'Missing a temporary folder.', 'UPLOAD_ERR_PARTIAL'=>'The uploaded file was only partially uploaded.', 'UPLOAD_ERR_UNKNOWN'=>'Unknown error', 'Underline', 'Upload a new file', 'Upload fail', 'Upload file', 'Upload the file', 'Use the form below to upload files, to view or search previously uploaded images go to the <a href=\"%s\" title=\"%s\">list of uploaded files</a>, uploads and deletions are also logged in the <a href=\"%s\" title=\"%s\">upload log</a>.', 'User', 'User talk', 'View', 'View source', 'Web2Project', 'Web2Project talk', 'Wiki default language', 'Wiki talk', 'Wiki text parser', 'You must select a project first', 'Your text to link here...', 'Your title here...', 'back', 'cannot be opened', 'cannot be written to', 'delete this page', 'documentation', 'edit', 'edit this page', 'file size', 'first %d', 'has been successfully updated', 'hide', 'is not writable', 'last %d', 'link', 'new page', 'next %d', 'pages with this category', 'pixel', 'previous %d', 'required', 'save', 'show', 'submit', 'text', 'view source', 'wikipageValidContent', 'wikipageValidName', 'wikipageValidProject', 'wikipageValidTitle',
true
e3b2f31d41507627f3f6fbd56d3e5d05797d1718
SQL
finlie/SQL
/queries.sql
UTF-8
1,537
4.25
4
[]
no_license
-- Show all albums select * from album; -- Show all albums made between 1975 and 1990. select * from album where release_year>=1975 and release_year <= 1990; -- Show all albums whose names start with Super D SELECT * FROM album WHERE title LIKE "Super D%"; -- Show all albums that have no release year. select * from album where release_year is null; -- Show all track titles from Super Funky Album. select track.title from track, album where track.album_id = album.id and album.title = "Super Funky Album"; -- Same query as above, but rename the column from title to Track_Title in the output. select track.title as "Track Title" from track, album where track.album_id = album.id and album.title = "Super Funky Album"; -- Select all album titles by Han Solo select album.title from album, artist_album, artist where artist_album.album_id = album.id and artist_album.artist_id = artist.id and artist.name = "Han Solo"; -- Select the average year all albums were released. select AVG(release_year) from album; -- Select the average year all albums by Leia and the Ewoks were released select AVG(release_year) from album, artist_album, artist where artist_album.artist_id = artist.id and artist_album.album_id = album.id and artist.name = "Leia and the Ewoks"; -- Select the number of artists. select count(*) from artist; -- Select the number of tracks on Super Dubstep Album SELECT COUNT(*) FROM track, album WHERE track.album_id = album.id AND album.title = "Super Dubstep Album";
true
a81b28fce4e11ae0a10588631d13813ba59d80f1
SQL
ZiyangJiao/JavaDev
/calender/cal/api/sql.sql
UTF-8
351
2.8125
3
[]
no_license
<?php $sql_event = " SELECT EventID, EventTitle, EventContent, EventStartTime, EventEndTime, Tag, GroupUsernames FROM Events WHERE UserID = ? AND ((EventEndTime IS NOT NULL AND EventEndTime > ? AND EventEndTime < ?) OR (EventStartTime > ? AND EventStartTime < ?)); "; ?>
true
ebcf590a6804d6c00daec8410e58b7d9cbff1004
SQL
ksatola/data-science-postgrad
/session15/2_spatial_lab_sql_developer/task_6.sql
UTF-8
211
2.859375
3
[]
no_license
create table ksatola_t6 as SELECT c.city, c.state_abrv, c.location FROM us_interstates i, us_cities c WHERE i.interstate = 'I4' AND sdo_nn(c.location, i.geom, 'sdo_num_res=5') = 'TRUE'; select * from ksatola_t6
true
f65a28a32acdef9abe9c87d7e85245c81c94c0a6
SQL
Ernestas-wq/13_ProjectCMS
/schema/minicmsdb_pages.sql
UTF-8
2,906
3.0625
3
[]
no_license
CREATE DATABASE IF NOT EXISTS `minicmsdb` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; USE `minicmsdb`; -- MySQL dump 10.13 Distrib 8.0.22, for Win64 (x86_64) -- -- Host: 127.0.0.1 Database: minicmsdb -- ------------------------------------------------------ -- Server version 8.0.18 /*!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 `pages` -- DROP TABLE IF EXISTS `pages`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `pages` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `contents` varchar(1000) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UNIQ_2074E5752B36786B` (`title`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `pages` -- LOCK TABLES `pages` WRITE; /*!40000 ALTER TABLE `pages` DISABLE KEYS */; INSERT INTO `pages` VALUES (1,'home','Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, magni. Iusto delectus ipsum voluptates repellat. Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, magni. Iusto delectus ipsum voluptates repellat. Facere magni quisquam inventore nihil ullam cum modi dolore, tenetur soluta nisi quam fugit molestias! Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, magni. Iusto delectus ipsum voluptates repellat. Facere magni quisquam inventore nihil ullam cum modi dolore, tenetur soluta nisi quam fugit molestias! Facere magni quisquam inventore nihil ullam cum modi dolore, tenetur soluta nisi quam fugit molestias! Mememnto!'),(2,'about','contents of about'); /*!40000 ALTER TABLE `pages` 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-01-18 18:39:00
true
ad256a1b6f6e975f2f906639499675e5cde15ece
SQL
RekGRpth/pg_micromanage
/sql/sorting.sql
UTF-8
7,305
3.578125
4
[]
no_license
CREATE TABLE a (a int); INSERT INTO A VALUES (5); INSERT INTO A VALUES (11); INSERT INTO A VALUES (7); SELECT * FROM run_select(''); -- todo, figure out why this first one fails -- sort nodes aren't allowed to project, and a var doesn't make sense there SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } } col: { target: 1 ascending: false } } target: { var: { table: 1 column: "a" } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- sort nodes aren't allowed to project SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } } col: { target: 1 ascending: false } } target: { leftRef: { target: 1 } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- sort nodes also cannot select (use quals) SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } } col: { target: 1 ascending: false } } qual: { leftRef: { target: 1 } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- SELECT a FROM a ORDER BY a DESC; SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } } col: { target: 1 ascending: false } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- SELECT a FROM a ORDER BY a ASC; SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } } col: { target: 1 ascending: true } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- SELECT a FROM a ORDER BY ; -- sort nodes need at least one col! SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); TRUNCATE a; ALTER TABLE a ADD COLUMN b int; INSERT INTO a VALUES (1, 7); INSERT INTO a VALUES (1, 10); INSERT INTO a VALUES (5, 2); INSERT INTO a VALUES (5, 9); INSERT INTO a VALUES (7, 9); INSERT INTO a VALUES (1, 9); INSERT INTO a VALUES (3, 1); -- SELECT a, b FROM a ORDER BY a ASC, b DESC; SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } target: { var: { table: 1 column: "b" } } } col: { target: 1 ascending: true } col: { target: 2 ascending: false } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- SELECT a, b FROM a ORDER BY b ASC, a DESC; SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } target: { var: { table: 1 column: "b" } } } col: { target: 2 ascending: true } col: { target: 1 ascending: false } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- SELECT a FROM a ORDER BY b ASC, a DESC; -- TODO: this is expressable in SQL but not yet in pg_micromanage, it involves -- resjunk target entries SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } } col: { target: 2 ascending: true } col: { target: 1 ascending: false } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- SELECT a, b FROM a WHERE a.a = 1 ORDER BY b ASC, a DESC; -- inner plans still support quals SELECT encode_protobuf($$ plan: { sort: { subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } target: { var: { table: 1 column: "b" } } qual: { op: { name: "=" arg: { var: { table: 1 column: "a" } } arg: { const: { uint: 1 } } } } } col: { target: 2 ascending: true } col: { target: 1 ascending: false } } } rtable: { name: "a" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- stacking nodes should also work! -- SELECT a.a FROM a INNER JOIN b ON (a.b = b.b) ORDER BY a.a ASC; CREATE TABLE b (b int, c int); INSERT INTO b VALUES (3, 5); INSERT INTO b VALUES (7, 5); INSERT INTO b VALUES (7, 6); INSERT INTO b VALUES (1, 6); INSERT INTO b VALUES (9, 3); SELECT encode_protobuf($$ plan: { sort: { col: { target: 1 ascending: true } subplan: { join: { kind: NESTED type: INNER joinqual: { op: { name: "=" arg: { leftRef: { target: 2 } } arg: { rightRef: { target: 1 } } } } left: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } target: { var: { table: 1 column: "b" } } } right: { sscan: { table: 2 } target: { var: { table: 2 column: "b" } } } } target: { leftRef: { target: 1 } } target: { leftRef: { target: 2 } } } } } rtable: { name: "a" } rtable: { name: "b" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); SELECT a.a, a.b FROM a INNER JOIN b ON (a.b = b.b) ORDER BY a.a ASC; -- the other direction too, try to join the results of a sort SELECT encode_protobuf($$ plan: { join: { kind: NESTED type: INNER joinqual: { op: { name: "=" arg: { leftRef: { target: 2 } } arg: { rightRef: { target: 1 } } } } left: { sort: { col: { target: 1 ascending: true } subplan: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } target: { var: { table: 1 column: "b" } } } } } right: { sscan: { table: 2 } target: { var: { table: 2 column: "b" } } } } target: { leftRef: { target: 1 } } target: { leftRef: { target: 2 } } } rtable: { name: "a" } rtable: { name: "b" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); -- force it to do the same thing as us, so it returns tuples in the same order SET enable_mergejoin TO false; SET enable_hashjoin TO false; SELECT sub.a, sub.b FROM (SELECT a, b FROM a ORDER BY a.a) AS sub INNER JOIN b ON (sub.b = b.b); -- and just one more, the same test except the sortnode is in the right tree SELECT encode_protobuf($$ plan: { join: { kind: NESTED type: INNER joinqual: { op: { name: "=" arg: { leftRef: { target: 2 } } arg: { rightRef: { target: 1 } } } } left: { sscan: { table: 1 } target: { var: { table: 1 column: "a" } } target: { var: { table: 1 column: "b" } } } right: { # more efficient than it looks! It rewinds just like materialize would # I mean, still pointlesss but at least the rescan does not sort every time sort: { col: { target: 1 ascending: true } subplan: { sscan: { table: 2 } target: { var: { table: 2 column: "b" } } } } } } target: { leftRef: { target: 1 } } target: { leftRef: { target: 2 } } } rtable: { name: "a" } rtable: { name: "b" } $$) AS buf \gset SELECT * FROM run_select(:'buf'); DROP TABLE a; DROP TABLE b;
true
efffe5fdd8ef2a1c81732c9a6dd4cea338081d0b
SQL
paulina-11/mysql
/03-modificar-tablas/modificar-tablas.sql
UTF-8
260
2.515625
3
[]
no_license
-- renombrar tablas ALTER TABLE usuarios RENAME TO users; -- cambiar nombre de columna ALTER TABLE usuarios CHANGE direccion dir VARCHAR(50); -- agregar columnas ALTER TABLE usuarios ADD edad INT NOT NULL; -- BORRAR COLUMNAS ALTER TABLE usuarios DROP edad;
true
3d8a59b2e7440967409b775b3d27c62cd7228b6c
SQL
CrafterKolyan/mmp-practicum-sql-fall-2019
/task1/Goldobina_1_2.sql
UTF-8
163
2.765625
3
[]
no_license
SELECT monthly_income_amt FROM srcdt.cd_customers WHERE year(valid_from_dttm) <= 2014 AND year(valid_to_dttm) >= 2014 ORDER BY monthly_income_amt DESC LIMIT 10;
true
262d4ec106d3538585db0da6fa62c8eee10d1283
SQL
shawnlu96/Top_Trumps
/_sqlscripts/schema_create.sql
UTF-8
834
3.875
4
[]
no_license
--create schema toptrumps; --creates the schema that shall be used if default public schema is taken create table games ( game_id int primary key, winner_player int not null check (0<winner_player and winner_player<6), --we can have maximum 5 players draws int not null, --assume at least 0 draws rounds int not null --assume at least 0 rounds ) create table players ( player_id int check (0<player_id and player_id<6), --we can have maximum 5 players game_id int references games on delete cascade on update cascade, --referential integrity for game ids rounds_won int not null, --assume at least 0 rounds won by each player primary key (player_id, game_id) --composite primary key ) insert into games values (0,1,0,0); --initial insert values insert into players values (1,0,0); insert into players values (2,0,0);
true
86cc0865d021bd8c8fbd1c9848e75ce0493ad70d
SQL
HirokiShun/ProgramacionWeb
/Procedures.sql
UTF-8
9,322
3.265625
3
[]
no_license
USE PW; DELIMITER $$ CREATE PROCEDURE CrearUsuario_SP( IN NombreP VARCHAR(50), IN ApellidosP VARCHAR(50), IN FNaP DATE, IN CorreoEP VARCHAR(30), IN ImgPerfilP BLOB, IN NomUP VARCHAR(30), IN PassP VARCHAR(30), IN FRegP DATE ) BEGIN IF ImgPerfilP IS NULL THEN INSERT INTO usuarios ( Nombre, Apellidos, FechaNac, CorreoElec, NomUsuario, Contraseña, FechaReg ) VALUES ( NombreP, ApellidosP, FNaP, CorreoEP, NomUP, PassP, FRegP ); ELSE INSERT INTO usuarios ( Nombre, Apellidos, FechaNac, CorreoElec, ImgPerfil, NomUsuario, Contraseña, FechaReg ) VALUES ( NombreP, ApellidosP, FNaP, CorreoEP, ImgPerfP, NomUP, PassP, FRegP ); END IF; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE Preguntar_SP( IN TituloP VARCHAR(50), IN CategoriaP INT, IN DescripcionP VARCHAR(200), IN ImgPregP BLOB, IN FCreaP DATE, IN AutorP INT ) BEGIN IF ImgPregP IS NULL THEN INSERT INTO pregunta ( Titulo, Categoria, Descripcion, Imagen, FechDeCrea, Autor ) VALUES ( TituloP, CategoriaP, DescripcionP, ImgPregP, FCreaP, AutorP ); ELSE INSERT INTO pregunta ( Titulo, Categoria, Descripcion, Imagen, FechaCrea, Autor ) VALUES ( TituloP, CategoriaP, DescripcionP, ImgPregP, FCreaP, AutorP ); END IF; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE AgregCat_SP( IN CategoriaP VARCHAR(50) ) BEGIN INSERT INTO categorias ( Categoria ) VALUES ( CategoriaP ); END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE Link_RespPreg_SP( IN IDRespP INT, IN IDPregP INT ) BEGIN INSERT INTO resp_preg ( Respuesta, Pregunta ) VALUES ( IDRespP, IDPregP ); END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE Responder_SP( IN RespuestaP VARCHAR(500), IN ImgRespP BLOB, IN CorrectaP TINYINT, IN AutorP INT, IN PreguntaP INT ) BEGIN IF ImgRespP IS NULL THEN INSERT INTO respuesta ( Respuesta, Correcta, Autor ) VALUES ( RespuestaP, CorrectaP, AutorP ); ELSE INSERT INTO respuesta ( Respuesta, Imagen, Correcta, Autor ) VALUES ( RespuestaP, ImgRespP, CorrectaP, AutorP ); END IF; #CALL Link_RespPreg_SP(LAST_INSERT_ID(),PreguntaP); END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE BanUs_SP( IN IDUser INT ) BEGIN UPDATE usuarios SET Estado = 0 WHERE ID = IDUser; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE ElPreg_SP ( IN IDPreg INT ) BEGIN UPDATE pregunta SET Estado = 0 WHERE ID = IDPreg; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE ElResp_SP ( IN IDResp INT ) BEGIN UPDATE respuesta SET Estado = 0 WHERE ID = IDResp; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE Votar_SP ( IN IDResp INT, IN IDUser INT, IN Fav_Cont TINYINT ) BEGIN INSERT INTO votos_rel ( Respuesta, Votante, Voto ) VALUES ( IDResp, IDUser, Fav_Cont ); END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE SubImgUs_SP ( IN IDUser INT, IN ImgArch BLOB ) BEGIN UPDATE usuarios SET ImgPerfil = ImgArch WHERE ID = IDUser; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE SubImgPreg_SP ( IN IDPreg INT, IN ImgArch BLOB ) BEGIN UPDATE pregunta SET Imagen = ImgArch WHERE ID = IDPreg; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE SubImgResp_SP ( IN IDResp INT, IN ImgArch BLOB ) BEGIN UPDATE respuesta SET Imagen = ImgArch WHERE ID = IDPreg; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE GetAnswerByID( IN AnswID INT ) BEGIN SELECT respuesta.Respuesta, respuesta.Imagen, respuesta.Correcta, respuesta.Votos, respuesta.Autor, respuesta.Estado FROM respuesta WHERE respuesta.Estado=1; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE GetQuestions_SP() BEGIN SELECT pregunta.ID, pregunta.Titulo, pregunta.Autor, pregunta.Categoria, pregunta.Descripcion, pregunta.FechDeCrea, pregunta.Imagen FROM pregunta WHERE pregunta.Estado=1; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE GetAnswers_SP() BEGIN SELECT respuesta.ID, respuesta.Respuesta, respuesta.Imagen, respuesta.Correcta, respuesta.Votos, respuesta.Autor, respuesta.Estado FROM respuesta WHERE respuesta.Estado=1; END DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE GetCategories_SP() BEGIN SELECT categorias.ID,categorias.Categoria FROM categorias; END DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE GetQuestByID( IN QuestID INT ) BEGIN SELECT pregunta.ID, pregunta.Titulo, pregunta.Autor, pregunta.Categoria, pregunta.Descripcion, pregunta.FechDeCrea, pregunta.Imagen FROM pregunta WHERE pregunta.ID=QuestID; END$$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE ValidateUser_SP( IN NUser VARCHAR(30), IN PassW VARCHAR(30) ) BEGIN SELECT NomUsuario, Contraseña FROM usuarios WHERE NomUsuario = NUser AND Contraseña = PassW; END DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ CREATE PROCEDURE GetUserByID( IN UsrID INT ) BEGIN SELECT ID, Nombre, Apellidos, FechaNac, CorreoElec, ImgPerfil, NomUsuario, Contraseña, FechaReg, Estado FROM usuarios WHERE ID= UsrID; END DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ DELIMITER ; #------------------------------------------------------------------------------------------------------------------------------------------- DELIMITER $$ DELIMITER ;
true
c567fe831930a7c2a6ad93c1c5cebf6bcc1faef9
SQL
n10o/memolize
/dbflute_mdb/playsql/replace-schema-10-basic.sql
UTF-8
546
3.953125
4
[ "Apache-2.0" ]
permissive
SET SESSION FOREIGN_KEY_CHECKS=0; /* Create Tables */ CREATE TABLE INFO ( INFO_ID bigint NOT NULL AUTO_INCREMENT, MEMBER_ID bigint NOT NULL, INFO_NAME varchar(256) NOT NULL, PRIMARY KEY (INFO_ID) ); CREATE TABLE MEMBER ( MEMBER_ID bigint NOT NULL AUTO_INCREMENT, NAME varchar(64) NOT NULL, PASSWORD varchar(128) NOT NULL, PRIMARY KEY (MEMBER_ID) ); /* Create Foreign Keys */ ALTER TABLE INFO ADD FOREIGN KEY (MEMBER_ID) REFERENCES MEMBER (MEMBER_ID) ON UPDATE RESTRICT ON DELETE RESTRICT ;
true
50226d5034faf174ed6162ad14a0694714b5fdf3
SQL
dewasugiarta/Digital-Sign
/permohonan_ssl.sql
UTF-8
3,903
3.015625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.6.6deb5 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: May 15, 2018 at 03:33 PM -- Server version: 5.7.22-0ubuntu18.04.1 -- PHP Version: 7.2.5-0ubuntu0.18.04.1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `permohonan_ssl` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `nama` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `opd` -- CREATE TABLE `opd` ( `id_opd` int(11) NOT NULL, `nama_opd` varchar(255) NOT NULL, `alamat_opd` varchar(255) NOT NULL, `kepala_opd` varchar(255) NOT NULL, `telepon_opd` varchar(20) NOT NULL, `email_opd` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `pengajuan` -- CREATE TABLE `pengajuan` ( `id` int(11) NOT NULL, `iduser` varchar(255) NOT NULL, `nama` varchar(255) NOT NULL, `nip` varchar(255) NOT NULL, `nik` varchar(255) NOT NULL, `pangkat_golongan` varchar(255) NOT NULL, `jabatan` varchar(255) NOT NULL, `instansi` varchar(255) NOT NULL, `kota` varchar(255) NOT NULL, `provinsi` varchar(255) NOT NULL, `id_opd` int(11) NOT NULL, `email` varchar(255) NOT NULL, `tanggal` date NOT NULL, `ktp` varchar(255) NOT NULL, `surat` varchar(255) NOT NULL, `kegunaan` varchar(255) NOT NULL, `sistem` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `iduser` varchar(255) NOT NULL, `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `nama` varchar(255) NOT NULL, `nik` varchar(255) NOT NULL, `pangkat_golongan` varchar(255) NOT NULL, `jabatan` varchar(255) NOT NULL, `instansi` varchar(255) NOT NULL, `id_opd` int(11) NOT NULL, `email` varchar(255) NOT NULL, `telepon` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`username`), ADD UNIQUE KEY `username` (`username`); -- -- Indexes for table `opd` -- ALTER TABLE `opd` ADD PRIMARY KEY (`id_opd`); -- -- Indexes for table `pengajuan` -- ALTER TABLE `pengajuan` ADD PRIMARY KEY (`id`), ADD KEY `iduser` (`iduser`), ADD KEY `id_opd` (`id_opd`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`iduser`), ADD KEY `id_opd` (`id_opd`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `opd` -- ALTER TABLE `opd` MODIFY `id_opd` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `pengajuan` -- ALTER TABLE `pengajuan` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- Constraints for dumped tables -- -- -- Constraints for table `pengajuan` -- ALTER TABLE `pengajuan` ADD CONSTRAINT `pengajuan_ibfk_1` FOREIGN KEY (`iduser`) REFERENCES `user` (`iduser`), ADD CONSTRAINT `pengajuan_ibfk_2` FOREIGN KEY (`id_opd`) REFERENCES `opd` (`id_opd`); -- -- Constraints for table `user` -- ALTER TABLE `user` ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`id_opd`) REFERENCES `opd` (`id_opd`); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
f90e7a58201e67cb1bdee98df7944abd8c46e012
SQL
dwatson78/database
/updatescripts/from_380alpha/createMrgundo.sql
UTF-8
2,128
3.546875
4
[]
no_license
CREATE TABLE mrgundo ( mrgundo_base_schema TEXT, mrgundo_base_table TEXT, mrgundo_base_id INTEGER, mrgundo_schema TEXT, mrgundo_table TEXT, mrgundo_pkey_col TEXT, mrgundo_pkey_id INTEGER, mrgundo_col TEXT, mrgundo_value TEXT, mrgundo_type TEXT, UNIQUE ( mrgundo_schema, mrgundo_table, mrgundo_pkey_col, mrgundo_pkey_id, mrgundo_col ) ); GRANT ALL ON TABLE mrgundo TO xtrole; COMMENT ON TABLE mrgundo IS 'This table keeps track of the original values of changes made while merging two records. It is a generalization of mrghist and trgthist, which are specific to merging contacts. The schema, table, and pkey_id columns uniquely identify the record that was changed while the _base_ columns identify the merge target. The _base_ columns are required to allow finding all of the records that pertain to a particular merge (e.g. find changes to the comment table that pertain to a crmacct merge).'; COMMENT ON COLUMN mrgundo.mrgundo_base_schema IS 'The schema in which the merge target resides.'; COMMENT ON COLUMN mrgundo.mrgundo_base_table IS 'The table in which the merge target resides.'; COMMENT ON COLUMN mrgundo.mrgundo_base_id IS 'The internal id of the merge target record.'; COMMENT ON COLUMN mrgundo.mrgundo_schema IS 'The name of the schema in which the modified table resides.'; COMMENT ON COLUMN mrgundo.mrgundo_table IS 'The name of the table that was modified during a merge.'; COMMENT ON COLUMN mrgundo.mrgundo_pkey_col IS 'The name of the primary key column in the modified table. This could be derived during the undo processing but it is simpler just to store it during the merge.'; COMMENT ON COLUMN mrgundo.mrgundo_pkey_id IS 'The primary key of the modified record.'; COMMENT ON COLUMN mrgundo.mrgundo_col IS 'The column that was modified.'; COMMENT ON COLUMN mrgundo.mrgundo_value IS 'The value of the column before the change.'; COMMENT ON COLUMN mrgundo.mrgundo_type IS 'The data type of the modified column. This could be derived during the undo processing but it is simpler just to store it during the merge.';
true
1217173bda234e67ece1618f370425ed10ee5860
SQL
p9madhavi/Madhavi
/SQL/SubQueries.sql
UTF-8
2,060
4.28125
4
[]
no_license
SELECT last_name, hire_date FROM employees WHERE department_id = ( SELECT DEPARTMENT_ID FROM DEPARTMENTS WHERE DEPARTMENT_NAME = 'Executive' ); SELECT last_name, hire_date FROM employees WHERE department_id in ( SELECT DEPARTMENT_ID FROM DEPARTMENTS WHERE DEPARTMENT_NAME LIKE '%ing' ); -------- 1 ----- select last_name,hire_date from employees where department_id= (select department_id from employees where last_name='&&Enter_Name') AND LAST_NAME<>'&Enter_Name'; -------- 2 ---- select employee_id,last_name,salary from employees where salary >( select avg(salary) from employees) order by salary ; -------- 3 ----- select employee_id,last_name from employees where DEPARTMENT_ID IN (select department_id from employees where last_name like '%u%'); ------ 4 ------ select last_name,job_id,department_id from employees where department_id IN( select department_id from departments where location_id = 1700); ----- 5 ------ select last_name ,salary from employees where manager_id=( select employee_id from employees where last_name = 'king'); ------ 6 ----- select department_id,last_name,job_id from employees where department_id IN ( select department_id from departments where department_name = 'Executive'); ------ 7 ------ select last_name from employees where salary > ANY ( select salary from employees where department_id= 60 ); ----- 8 ------- select last_name,employee_id,salary from employees where department_id IN ( select department_id from employees where last_name LIKE '%u%' ) AND salary>( select avg(salary) from employees ) ORDER BY salary ;
true
5ddd0d6b3135620fb5d793002c92742a6ffdf4a2
SQL
NordMan10/urfuSite
/student.sql
UTF-8
6,277
3.4375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- Хост: 127.0.0.1:3306 -- Время создания: Янв 14 2019 г., 06:54 -- Версия сервера: 5.7.16 -- Версия PHP: 5.6.29 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- База данных: `student` -- -- -------------------------------------------------------- -- -- Структура таблицы `abiturients` -- CREATE TABLE `abiturients` ( `abiturient_id` int(11) NOT NULL, `abiturient_fullname` text NOT NULL, `abiturient_exam_type` text NOT NULL, `abiturient_reg_id` int(11) NOT NULL, `abiturient_private_score` int(11) NOT NULL, `abiturient_choose_speciality_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `abiturients` -- INSERT INTO `abiturients` (`abiturient_id`, `abiturient_fullname`, `abiturient_exam_type`, `abiturient_reg_id`, `abiturient_private_score`, `abiturient_choose_speciality_id`) VALUES (1, 'Быков Павел Андреевич', 'КТ', 123456, 10, 1), (2, 'Иванов Иван Иванович', 'ЕГЭ', 234567, 5, 3), (3, 'Сидоров Сидор Сидорович', 'ЕГЭ', 345678, 0, 2), (4, 'Николаев Николай Николаевич', 'КТ', 456789, 6, 1), (5, 'Петров Петр Петрович', 'КТ', 567890, 3, 1); -- -------------------------------------------------------- -- -- Структура таблицы `choose_specialities` -- CREATE TABLE `choose_specialities` ( `id` int(11) NOT NULL, `speciality_id` int(11) NOT NULL, `student_reg_id` int(11) NOT NULL, `total_score` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `choose_specialities` -- INSERT INTO `choose_specialities` (`id`, `speciality_id`, `student_reg_id`, `total_score`) VALUES (1, 1, 123456, 220), (2, 2, 123456, 202), (3, 3, 123456, 202), (4, 1, 234567, 220), (5, 2, 345678, 210), (6, 2, 456789, 257); -- -------------------------------------------------------- -- -- Структура таблицы `exam` -- CREATE TABLE `exam` ( `exam_id` int(11) NOT NULL, `abiturient_reg_id` int(11) NOT NULL, `subject_id` int(11) NOT NULL, `score` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `exam` -- INSERT INTO `exam` (`exam_id`, `abiturient_reg_id`, `subject_id`, `score`) VALUES (1, 123456, 1, 90), (2, 123456, 2, 70), (3, 123456, 3, 70), (4, 123456, 4, 63), (5, 234567, 1, 90), (6, 234567, 2, 70), (7, 234567, 3, 70), (8, 345678, 1, 60), (9, 345678, 2, 70), (10, 345678, 4, 80), (11, 456789, 1, 55), (12, 456789, 2, 90), (13, 456789, 4, 96); -- -------------------------------------------------------- -- -- Структура таблицы `likes` -- CREATE TABLE `likes` ( `likes` int(11) DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `likes` -- INSERT INTO `likes` (`likes`) VALUES (1); -- -------------------------------------------------------- -- -- Структура таблицы `specialities` -- CREATE TABLE `specialities` ( `speciality_id` int(11) NOT NULL, `speciality_name` text NOT NULL, `subject1_id` int(11) NOT NULL, `subject2_id` int(11) NOT NULL, `subject3_id` int(11) NOT NULL, `subject1_min` int(11) NOT NULL, `subject2_min` int(11) NOT NULL, `subject3_min` int(11) NOT NULL, `budget` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `specialities` -- INSERT INTO `specialities` (`speciality_id`, `speciality_name`, `subject1_id`, `subject2_id`, `subject3_id`, `subject1_min`, `subject2_min`, `subject3_min`, `budget`) VALUES (1, '01.01.01 Информатика и вычислительная техника', 1, 2, 3, 36, 55, 55, 60), (2, '09.09.09 Ядерная физика', 1, 2, 4, 36, 55, 55, 20), (3, '08.08.08 Прикладная математика', 1, 2, 4, 36, 60, 60, 10); -- -------------------------------------------------------- -- -- Структура таблицы `subjects` -- CREATE TABLE `subjects` ( `subject_id` int(11) NOT NULL, `subject_name` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `subjects` -- INSERT INTO `subjects` (`subject_id`, `subject_name`) VALUES (1, 'Русский язык'), (2, 'Математика'), (3, 'Информатика'), (4, 'Физика'), (5, 'Химия'), (6, 'История'); -- -- Индексы сохранённых таблиц -- -- -- Индексы таблицы `abiturients` -- ALTER TABLE `abiturients` ADD PRIMARY KEY (`abiturient_id`); -- -- Индексы таблицы `choose_specialities` -- ALTER TABLE `choose_specialities` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `exam` -- ALTER TABLE `exam` ADD PRIMARY KEY (`exam_id`); -- -- Индексы таблицы `specialities` -- ALTER TABLE `specialities` ADD PRIMARY KEY (`speciality_id`); -- -- Индексы таблицы `subjects` -- ALTER TABLE `subjects` ADD PRIMARY KEY (`subject_id`); -- -- AUTO_INCREMENT для сохранённых таблиц -- -- -- AUTO_INCREMENT для таблицы `abiturients` -- ALTER TABLE `abiturients` MODIFY `abiturient_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT для таблицы `choose_specialities` -- ALTER TABLE `choose_specialities` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT для таблицы `exam` -- ALTER TABLE `exam` MODIFY `exam_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; -- -- AUTO_INCREMENT для таблицы `specialities` -- ALTER TABLE `specialities` MODIFY `speciality_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT для таблицы `subjects` -- ALTER TABLE `subjects` MODIFY `subject_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
ffd58df94f58a5ab6b19a82a053e297fa8de9148
SQL
karthik1211/oru-source-service
/database/release/1.0/ORU_SOURCE_SVC/ddl/create/trigger/006_platform_user_header_updt.sql
UTF-8
182
2.65625
3
[]
no_license
DELIMITER // CREATE TRIGGER platform_user_header_updt BEFORE UPDATE ON platform_user_header FOR EACH ROW BEGIN SET NEW.update_timestamp = CURRENT_TIMESTAMP(); END // DELIMITER ;
true
6bc3250fa76ef7c6480636ba7cf722193e555139
SQL
nelsonmestevao/slides
/intro-to-programming/databases/migrations.sql
UTF-8
1,939
3.953125
4
[]
no_license
CREATE TABLE regions ( region_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, region_name text NOT NULL ); CREATE TABLE countries ( country_id text NOT NULL, country_name text NOT NULL, region_id INTEGER NOT NULL, PRIMARY KEY (country_id ASC), FOREIGN KEY (region_id) REFERENCES regions (region_id) ON DELETE CASCADE ON UPDATE CASCADE ); CREATE TABLE locations ( location_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, street_address text, postal_code text, city text NOT NULL, state_province text, country_id INTEGER NOT NULL, FOREIGN KEY (country_id) REFERENCES countries (country_id) ON DELETE CASCADE ON UPDATE CASCADE ); CREATE TABLE departments ( department_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, department_name text NOT NULL, location_id INTEGER NOT NULL, FOREIGN KEY (location_id) REFERENCES locations (location_id) ON DELETE CASCADE ON UPDATE CASCADE ); CREATE TABLE jobs ( job_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, job_title text NOT NULL, min_salary double NOT NULL, max_salary double NOT NULL ); CREATE TABLE employees ( employee_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, first_name text, last_name text NOT NULL, email text NOT NULL, phone_number text, hire_date text NOT NULL, job_id INTEGER NOT NULL, salary double NOT NULL, manager_id INTEGER, department_id INTEGER NOT NULL, FOREIGN KEY (job_id) REFERENCES jobs (job_id) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (department_id) REFERENCES departments (department_id) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (manager_id) REFERENCES employees (employee_id) ON DELETE CASCADE ON UPDATE CASCADE ); CREATE TABLE dependents ( dependent_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, first_name text NOT NULL, last_name text NOT NULL, relationship text NOT NULL, employee_id INTEGER NOT NULL, FOREIGN KEY (employee_id) REFERENCES employees (employee_id) ON DELETE CASCADE ON UPDATE CASCADE );
true
2da9a5773cfd1be47a39b0da23b21ed9d248d50c
SQL
biblelamp/SQLExercises
/LightComp/elza_access_point_union.sql
UTF-8
773
3
3
[]
no_license
SELECT ap.access_point_id, ap.uuid FROM ap_state s JOIN ap_access_point ap ON s.access_point_id = ap.access_point_id WHERE s.create_change_id > 3 OR s.delete_change_id > 3 UNION SELECT ap.access_point_id, ap.uuid FROM ap_part p JOIN ap_access_point ap ON p.access_point_id = ap.access_point_id WHERE p.create_change_id > 3 OR p.delete_change_id > 3 UNION SELECT ap.access_point_id, ap.uuid FROM ap_item i JOIN ap_part p ON i.part_id = p.part_id JOIN ap_access_point ap ON p.access_point_id = ap.access_point_id WHERE i.create_change_id > 3 OR i.delete_change_id > 3 UNION SELECT ap.access_point_id, ap.uuid FROM ap_binding_state b JOIN ap_access_point ap ON b.access_point_id = ap.access_point_id WHERE b.create_change_id > 3 OR b.delete_change_id > 3
true
e611725d0ed671957b16457b3e5b3efacf233966
SQL
spencerking/CSE40746-Final-Project
/schema/crt_transaction.sql
UTF-8
393
3.171875
3
[]
no_license
CREATE TABLE transaction ( transaction_id NUMBER(16) PRIMARY KEY, buyer_id NUMBER(16) NOT NULL, seller_id NUMBER(16) NOT NULL, item_id NUMBER(16) NOT NULL, transaction_date DATE NOT NULL, status NUMBER(1) NOT NULL, FOREIGN KEY (buyer_id) REFERENCES domer(user_id), FOREIGN KEY (seller_id) REFERENCES domer(user_id), FOREIGN KEY (item_id) REFERENCES item(item_id) ON DELETE CASCADE ) ;
true
be95d27d9030670a18c3fec2736f3e8f39ee50a7
SQL
silence-do-good/stress-test-Postgres-and-MySQL
/dump/low/day23/select1026.sql
UTF-8
178
2.65625
3
[]
no_license
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o WHERE timestamp>'2017-11-22T10:26:00Z' AND timestamp<'2017-11-23T10:26:00Z' AND temperature>=30 AND temperature<=33
true
0ed8639f67d86c22348e9643114658b0ea7fbb6e
SQL
moreaupierrick/ProjetEntrepot
/workbench/dumpV2.sql
UTF-8
5,567
2.8125
3
[]
no_license
CREATE DATABASE IF NOT EXISTS `datawarehouse_accidents` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `datawarehouse_accidents`; -- MySQL dump 10.13 Distrib 5.6.23, for Win64 (x86_64) -- -- Host: localhost Database: datawarehouse_accidents -- ------------------------------------------------------ -- Server version 5.6.24-enterprise-commercial-advanced-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 `accident` -- DROP TABLE IF EXISTS `accident`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accident` ( `numac` int(11) NOT NULL, `com` int(11) NOT NULL, `catr` int(11) NOT NULL, `catv` int(11) NOT NULL, `nbMort` int(11) NOT NULL, `nbBlesseGrave` int(11) NOT NULL, `nbBlesseLeger` int(11) NOT NULL, `nbIndemes` int(11) NOT NULL, PRIMARY KEY (`numac`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `accident` -- LOCK TABLES `accident` WRITE; /*!40000 ALTER TABLE `accident` DISABLE KEYS */; /*!40000 ALTER TABLE `accident` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cp` -- DROP TABLE IF EXISTS `cp`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cp` ( `cp` int(11) NOT NULL, `dep` int(11) NOT NULL, PRIMARY KEY (`cp`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cp` -- LOCK TABLES `cp` WRITE; /*!40000 ALTER TABLE `cp` DISABLE KEYS */; INSERT INTO `cp` VALUES (91000,91),(91130,91); /*!40000 ALTER TABLE `cp` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `route` -- DROP TABLE IF EXISTS `route`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `route` ( `catr` int(11) NOT NULL, `type` varchar(200) NOT NULL, PRIMARY KEY (`catr`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `route` -- LOCK TABLES `route` WRITE; /*!40000 ALTER TABLE `route` DISABLE KEYS */; INSERT INTO `route` VALUES (1,'Autoroute'),(2,'Route nationale'),(3,'Route Departementale'),(4,'Voie Communale'),(5,'Hors Reseau Public'),(6,'Parking'),(9,'Autre'); /*!40000 ALTER TABLE `route` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `vehicule` -- DROP TABLE IF EXISTS `vehicule`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `vehicule` ( `catv` int(11) NOT NULL, `type` varchar(200) NOT NULL, PRIMARY KEY (`catv`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `vehicule` -- LOCK TABLES `vehicule` WRITE; /*!40000 ALTER TABLE `vehicule` DISABLE KEYS */; INSERT INTO `vehicule` VALUES (1,'Bicyclette'),(2,'Cyclomoteur < 50cm3'),(3,'Voiturette'),(4,'Scooter Immatriculé'),(5,'Motocyclette'),(6,'Side-car'),(7,'VL Seul'),(8,'VL + Caravane'),(9,'VL + Remorque'),(10,'Vehicule Utilitaire'),(11,'Vehicule Utilitaire + Caravane'),(12,'Vehicule Utilitaire + Remorque'),(13,'Poids Lourd Seul'),(14,'Poids Lourds > 7,5T'),(15,'Poids Lourds + Remorque'),(16,'Tracteur'),(17,'Tracteur + Semi-remorque'),(18,'Transport en commun'),(19,'Tramway'),(20,'Engin special'),(21,'Tracteur agricole'),(30,'Scooter < 50cm3'),(31,'Moto < 125cm3'),(32,'Scooter < 125cm3'),(33,'Moto > 125cm3'),(34,'Scooter > 125cm3'),(35,'Quad leger'),(36,'Quad Lourd'),(37,'Autobus'),(38,'Autocar'),(39,'Train'),(40,'Tramway'),(90,'Autre'); /*!40000 ALTER TABLE `vehicule` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ville` -- DROP TABLE IF EXISTS `ville`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ville` ( `cp` int(11) NOT NULL, `com` varchar(200) NOT NULL DEFAULT '', `dpt` int(11) NOT NULL, PRIMARY KEY (`com`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ville` -- LOCK TABLES `ville` WRITE; /*!40000 ALTER TABLE `ville` DISABLE KEYS */; /*!40000 ALTER TABLE `ville` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2015-05-12 11:17:44
true
e0b0bbd6a02242ccee055ce5cf0bb72cbf4d0da3
SQL
abhiwalia15/CSE-Lab-Manual
/V Semester/Database-Management-System/Problem 1/query4.sql
UTF-8
289
3.859375
4
[ "MIT" ]
permissive
-- Find the names of faculty members who teach in every room in which some class is taught. SELECT DISTINCT F.fname FROM Faculty F WHERE NOT EXISTS ( SELECT * FROM Class C WHERE (C.room) NOT IN ( SELECT C1.room FROM Class C1 WHERE C1.fid = F.fid ) ) ;
true
d5e496603439e02d65ba041d5bd68e1f96ab58e8
SQL
chongtianfeiyu/sql
/vdc_account.sql
UTF-8
592
2.984375
3
[]
no_license
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; CREATE DATABASE IF NOT EXISTS `vdc_account` DEFAULT CHARSET=utf8; CREATE TABLE `vdc_account`.`normal_account` ( `accountid` int(10) unsigned NOT NULL DEFAULT 0, `appointtime` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '账号被accountserver预定时间,此时间内不能分配给其它accountserver使用', PRIMARY KEY(`accountid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `vdc_account`.`beautiful_eight_account` ( `accountid` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY(`accountid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
true
d41f5b434363e3b4c4941659f1496d6dc0f59ef2
SQL
hungthanh95/spring_reddit_clone
/Databases/2_updated_database.sql
UTF-8
631
3.484375
3
[]
no_license
alter table user modify password varchar(255) not null; alter table post modify post_name varchar(255) not null; alter table subreddit modify name varchar(255) not null; alter table subreddit modify description varchar(255) not null; alter table comment modify text varchar(255) not null; alter table post add constraint post_subreddit_subreddit_id_fk foreign key (subreddit_id) references subreddit (subreddit_id); alter table subreddit add constraint subreddit_user_user_id_fk foreign key (user_id) references user (user_id); alter table token add constraint token_user_user_id_fk foreign key (user_id) references user (user_id);
true
38d35579798f6fe07b3a1829b89f923e0e3ae78e
SQL
cseppan/EMFarchive_EMF
/deploy/db/cost/functions/run_sum.sql
UTF-8
1,324
3.140625
3
[]
no_license
CREATE OR REPLACE FUNCTION public.run_sum(numeric, text, text) RETURNS numeric AS $BODY$ if {![info exists GD(sum.$2.$3)]} { set GD(sum.$2.$3) 0.00 } if {[argisnull 1]} { return $GD(sum.$2.$3) } else { return [set GD(sum.$2.$3) [expr $GD(sum.$2.$3) + $1]] } $BODY$ LANGUAGE 'pltcl' VOLATILE COST 100; ALTER FUNCTION public.run_sum(numeric, text, text) OWNER TO emf; CREATE OR REPLACE FUNCTION public.run_sum(numeric, text) RETURNS numeric AS 'select run_sum($1,$2,statement_timestamp()::text)' LANGUAGE 'sql' IMMUTABLE STRICT COST 100; ALTER FUNCTION public.run_sum(numeric, text) OWNER TO emf; CREATE OR REPLACE FUNCTION public.run_sum(numeric, numeric, text, text) RETURNS numeric AS $BODY$ if {![info exists GD(sum.$3.$4)]} { set GD(sum.$3.$4) $1 } if {[argisnull 1]} { return $GD(sum.$3.$4) } else { return [set GD(sum.$3.$4) [expr $GD(sum.$3.$4) + $2]] } $BODY$ LANGUAGE pltcl VOLATILE COST 100; ALTER FUNCTION public.run_sum(numeric, numeric, text, text) OWNER TO emf; CREATE OR REPLACE FUNCTION public.run_sum(numeric, numeric, text) RETURNS numeric AS 'select run_sum($1,$2,$3,statement_timestamp()::text)' LANGUAGE sql IMMUTABLE STRICT COST 100; ALTER FUNCTION public.run_sum(numeric, numeric, text) OWNER TO emf;
true
b9aa84848e03e79ee1afca31dbc786751a9a00ba
SQL
mazdik/mazdik.github.io
/blog/notes/SQL/sum_join.sql
UTF-8
1,679
3.734375
4
[]
no_license
-- 1 способ select summa1-summa2 as summa from (select nvl(sum(s.pay_sum),0) summa1, max(l.in_document) docrn1 from bankdocs b, doclinks l, bankdocspec s, dictoper d where b.rn = l.out_document and l.in_document = 318090915 and b.rn = s.prn and exists (select null from doclinks where in_document = b.rn and out_unitcode = 'EconomicOperations') and b.type_oper = d.rn and d.factret_sign <> 1 ) sql1 LEFT OUTER JOIN ( select nvl(sum(s.pay_sum),0) summa2, max(l.in_document) docrn2 from bankdocs b, doclinks l, bankdocspec s, dictoper d where b.rn = l.out_document and l.in_document = 318090915 and b.rn = s.prn and exists (select null from doclinks where in_document = b.rn and out_unitcode = 'EconomicOperations') and b.type_oper = d.rn and d.factret_sign=1) sql2 ON sql1.docrn1=sql2.docrn2 -- 2 способ select (select nvl(sum(s.pay_sum),0) summa1 from bankdocs b, doclinks l, bankdocspec s, dictoper d where b.rn = l.out_document and l.in_document = 318090915 and b.rn = s.prn and exists (select null from doclinks where in_document = b.rn and out_unitcode = 'EconomicOperations') and b.type_oper = d.rn and d.factret_sign <> 1) - (select nvl(sum(s.pay_sum),0) summa2 from bankdocs b, doclinks l, bankdocspec s, dictoper d where b.rn = l.out_document and l.in_document = 318090915 and b.rn = s.prn and exists (select null from doclinks where in_document = b.rn and out_unitcode = 'EconomicOperations') and b.type_oper = d.rn and d.factret_sign = 1) as summa from dual;
true
ed0f97a4d8058375cf4ee03612b1b62c0f2ce0ea
SQL
nikhilmurthy/CPTS-421-423
/Scripts/sp-v9/spSelAllFaculty.sql
UTF-8
252
3.15625
3
[]
no_license
DROP PROCEDURE IF EXISTS spSelAllFaculty; DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `spSelAllFaculty`() BEGIN select email, first_name, last_name, phone, user_id from user where is_faculty = 1 order by first_name asc; END$$ DELIMITER ;
true
f3778e0426cc0518838894a4b72542fdfea697cc
SQL
s4zuk3/hadesspa
/sql/hades_v3.sql
UTF-8
3,579
3.71875
4
[]
no_license
/*==============================================================*/ /* table: cliente */ /*==============================================================*/ create table cliente ( id_cliente int not null, nombre_cliente varchar(30), descripcion varchar(400), primary key (id_cliente) ); /*==============================================================*/ /* table: cotizacion */ /*==============================================================*/ create table cotizacion ( id_cotizacion int not null, id_usuario int, fecha date, primary key (id_cotizacion) ); /*==============================================================*/ /* table: factura */ /*==============================================================*/ create table factura ( id_factura int not null, id_ot int, id_cliente int, fecha_emision date, estado_factura int, monto_factura int, primary key (id_factura) ); /*==============================================================*/ /* table: oc */ /*==============================================================*/ create table oc ( id_oc int not null, fecha_creacion_oc date, estado_oc int, monto_oc int, primary key (id_oc) ); /*==============================================================*/ /* table: oc_ot */ /*==============================================================*/ create table oc_ot ( id_ot int not null, id_oc int not null, primary key (id_ot, id_oc) ); /*==============================================================*/ /* table: ot */ /*==============================================================*/ create table ot ( id_ot int not null, id_cotizacion int, estado_ot int, fecha_creacion_ot date, primary key (id_ot) ); /*==============================================================*/ /* table: usuario */ /*==============================================================*/ create table usuario ( id_usuario int not null, contrasena varchar(30), nombre varchar(30), token varchar(100), cargo char(15), primary key (id_usuario), key ak_id_usuario (id_usuario) ); alter table cotizacion add constraint fk_crea foreign key (id_usuario) references usuario (id_usuario) on delete restrict on update restrict; alter table factura add constraint fk_finalizada_mediante foreign key (id_ot) references ot (id_ot) on delete restrict on update restrict; alter table factura add constraint fk_pagan foreign key (id_cliente) references cliente (id_cliente) on delete restrict on update restrict; alter table oc_ot add constraint fk_necesita foreign key (id_ot) references ot (id_ot) on delete restrict on update restrict; alter table oc_ot add constraint fk_necesita2 foreign key (id_oc) references oc (id_oc) on delete restrict on update restrict; alter table ot add constraint fk_genera foreign key (id_cotizacion) references cotizacion (id_cotizacion) on delete restrict on update restrict;
true
dbcbd46555b9e79799771898d41009a106f8ce3c
SQL
ucarlos/CSC-4370-PHP-e-commerce
/db/project4.sql
UTF-8
1,902
3.59375
4
[ "MIT" ]
permissive
/* ----------------------------------------------------------------------------- * Created by Ulysses Carlos for CSC 4370 Project 4 -- 12/11/2019 * * Note * Please make sure that you import? this file using whatever system you * have. As I have XAMPP, it's as simple as opening /localhost/phpmyadmin * and importing both this file and db_populate (IN THIS ORDER). * * ----------------------------------------------------------------------------- */ create database Project; use Project; create table if not exists users ( id int(8) not null auto_increment, user_name varchar(30) not null, first_name varchar(30) not null, last_name varchar(30) not null, email varchar(60) not null, password varchar(40) not null, primary key (id), unique key email (email) ); create table if not exists inventory ( id int(8) not null auto_increment, item_name varchar(50) not null, price int(4) not null, quantity int(2) not null, owner_id int(8) not null, primary key (id) ); create table if not exists user_order ( id int(8) not null auto_increment, item_name varchar(50) not null, price int(4) not null, orderer_name varchar(50) not null, quantity int(8) not null, orderer_id int(8) not null, primary key (id) ); create table if not exists planes( id int(8) not null auto_increment, name varchar(30) not null, capacity int(3) not null, owner varchar(40) not null, primary key (id) ); create table if not exists flight( id int(8) not null auto_increment, class_name varchar(30) not null, capacity int(2) not null, plane_type varchar(30) not null, price int(3), primary key (id) ); create table if not exists parking_lots( id int(8) not null auto_increment, name varchar(30) not null, capacity int(2) not null, price int(3), primary key (id) );
true
2d08ba55d03d50bc797e1882141fd32a27fc36a3
SQL
joses166/URI_ONLINE_JUDGE
/POSTGRESQL/uri_2738.sql
UTF-8
200
3.34375
3
[]
no_license
SELECT c.name, ( ( ( s.math * 2 ) + ( s.specific * 3 ) + ( s.project_plan * 5 ) ) / 10 )::NUMERIC( 7, 2 ) AS "avg" FROM candidate c INNER JOIN score s ON(c.id = s.candidate_id) ORDER BY 2 DESC;
true
1c1895300249edc442b7bb98a5e5b5e82fce03bc
SQL
fumlefinger/afleveringdokumentation
/blackjack.sql
UTF-8
1,594
3.125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- trest -- Vært: 127.0.0.1 -- Genereringstid: 09. 11 2017 kl. 10:55:06 -- Serverversion: 10.1.26-MariaDB -- PHP-version: 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 */; -- -- Database: `blackjack` -- -- -------------------------------------------------------- -- -- Struktur-dump for tabellen `brugere` -- CREATE TABLE `brugere` ( `id` int(10) NOT NULL, `brugernavn` varchar(255) NOT NULL, `kodeord` varchar(255) NOT NULL, `valuta` int(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Data dump for tabellen `brugere` -- INSERT INTO `brugere` (`id`, `brugernavn`, `kodeord`, `valuta`) VALUES (1, 'fumlefinger', '12301230', 510), (2, 'Pikihande', 'Hej1meddig', 500); -- -- Begrænsninger for dumpede tabeller -- -- -- Indeks for tabel `brugere` -- ALTER TABLE `brugere` ADD UNIQUE KEY `id` (`id`); -- -- Brug ikke AUTO_INCREMENT for slettede tabeller -- -- -- Tilføj AUTO_INCREMENT i tabel `brugere` -- ALTER TABLE `brugere` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
b0ddcec5d54ebcc659d831da6c35b6e3e1067d56
SQL
vitoria2002campos/AtividadesMysql
/banco_de_dados_relacional_Mysql/atividade01- 18_08_21.sql
UTF-8
801
3.109375
3
[]
no_license
-- create database db_rhempresa; use db_rhempresa; create table funcionaries( id bigint auto_increment, nome varchar (255) not null, cpf bigint not null, salario float, cep varchar (255), cargo varchar (255), primary key (id) ); insert into funcionaries( nome,cpf,salario,cep,cargo)values ("Roberta",976290490-72, 1000,"69313-135"," estagiaria administrativa"), ("Regina",649200050-16, 4000,"75523-290","desenvolvedora web"), ("Caio",302624550-05, 4500,"58307-030","auxiliar administrativo"), ("Rosa",621370460-40, 4500,"45603-730","desenvolvedora web"), ("Matheus",873351410-01, 1800,"76901-228","Motoboy") ; select * from funcionaries where salario >2000; select * from funcionaries where salario < 2000; update funcionaries set salario = 5000 where id = 3; select * from funcionaries
true
eed4d04d48ea02ed5a7f2137742fa5b0d4dcc09c
SQL
acumos/common-dataservice
/cmn-data-svc/cmn-data-svc-server/db-scripts/cds-mysql-upgrade-1.16-to-1.17.sql
UTF-8
2,006
3.46875
3
[ "Apache-2.0", "CC-BY-4.0" ]
permissive
-- ===============LICENSE_START======================================================= -- Acumos Apache-2.0 -- =================================================================================== -- Copyright (C) 2017-2018 AT&T Intellectual Property & Tech Mahindra. All rights reserved. -- =================================================================================== -- This Acumos software file is distributed by AT&T and Tech Mahindra -- under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- This file is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- ===============LICENSE_END========================================================= -- Script to upgrade database used by the Common Data Service -- FROM version 1.16.x TO version 1.17.x. -- No database name is set to allow flexible deployment. -- 1 CREATE TABLE C_DOCUMENT ( DOCUMENT_ID CHAR(36) NOT NULL PRIMARY KEY, NAME VARCHAR(100) NOT NULL, URI VARCHAR(512) NOT NULL, VERSION VARCHAR(25), SIZE INT NOT NULL, USER_ID CHAR(36) NOT NULL, CREATED_DATE TIMESTAMP NOT NULL DEFAULT 0, MODIFIED_DATE TIMESTAMP NOT NULL, CONSTRAINT C_DOCUMENT_C_USER FOREIGN KEY (USER_ID) REFERENCES C_USER (USER_ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 2 CREATE TABLE C_SOL_REV_DOC_MAP ( REVISION_ID CHAR(36) NOT NULL, ACCESS_TYPE_CD CHAR(2) NOT NULL, DOCUMENT_ID CHAR(36) NOT NULL, PRIMARY KEY (REVISION_ID, ACCESS_TYPE_CD, DOCUMENT_ID), CONSTRAINT C_REV_DOC_MAP_C_SOLUTION_REV FOREIGN KEY (REVISION_ID) REFERENCES C_SOLUTION_REV (REVISION_ID), CONSTRAINT C_REV_DOC_MAP_C_REV_DOC FOREIGN KEY (DOCUMENT_ID) REFERENCES C_DOCUMENT (DOCUMENT_ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
true
7f499bbe32f3ecb08f5ad6a2f00a3b64006c2861
SQL
aulbytj/SQL-ZOO-
/1.SELECT_basics.sql
UTF-8
1,416
3.828125
4
[]
no_license
-- Introducing the world table of countries -- world -- name continent area population gdp -- Afghanistan Asia 652230 25500100 20343000000 -- Albania Europe 28748 2831741 12960000000 -- Algeria Africa 2381741 37100000 188681000000 -- Andorra Europe 468 78115 3712000000 -- Angola Africa 1246700 20609294 100990000000 -- The example uses a WHERE clause to show the population of 'France'. -- Note that strings (pieces of text that are data) should be in 'single quotes'; -- Modify it to show the population of Germany SELECT population FROM world WHERE name = 'Germany'; -- Checking a list The word IN allows us to check if an item is in a list. -- The example shows the name and population for the countries 'Brazil', 'Russia', 'India' and 'China'. -- Show the name and the population for 'Sweden', 'Norway' and 'Denmark'. SELECT name, population FROM world WHERE name IN ('Sweden', 'Norway', 'Denmark'); -- Which countries are not too small and not too big? BETWEEN allows range checking -- (range specified is inclusive of boundary values). The example below shows countries -- with an area of 250,000-300,000 sq. km. Modify it to show the country and the area for -- countries with an area between 200,000 and 250,000. SELECT name, area FROM world WHERE area BETWEEN 200000 AND 250000
true
c4809e328c584fc929b66c8f01e376598d0460f6
SQL
darkirui/IQCareMigration-1
/Four2One/Four2One/Scripts/DBUpdate/PharmacyModule/GetDrugsAvailableInDispensingStore.sql
UTF-8
893
3.859375
4
[ "Apache-2.0" ]
permissive
CREATE PROC sp_PharmacyModule_GetDrugsAvailableInDispensingStore AS BEGIN SET NOCOUNT ON; WITH AvailableDrugs AS( SELECT d.Id , d.DrugName , e.DoseForm , SUM(a.Quantity) - SUM(f.Quantity) Quantity FROM DrugIssued a INNER JOIN DrugDestination b ON a.DrugDestinationId = b.Id INNER JOIN DrugBatch c ON a.DrugBatchId = c.Id INNER JOIN ClinicalDrug d ON c.ClinicalDrugId = d.Id INNER JOIN DoseFormGroup e ON d.DoseFormGroupId = e.Id LEFT JOIN (SELECT DrugBatchId, Quantity FROM DrugAdjusted f WHERE DeleteFlag = 0 AND DrugStoreId = 1) f ON a.DrugBatchId = f.DrugBatchId WHERE b.IsDispensingStore = 1 AND c.ExpiryDate > GETDATE() AND a.DeleteFlag = 0 GROUP BY d.Id , d.DrugName , e.DoseForm) SELECT a.Id Drug_Pk , a.DrugName , CONCAT(a.Id,'~', a.DrugName,'~',b.DoseForm) val FROM ClinicalDrug a INNER JOIN AvailableDrugs b ON a.Id = b.Id END
true
f16116230cb81a2c0bc9a523b08fbc314b92da73
SQL
victor7937/JWDFinal
/src/main/resources/dump/dump_footwear.sql
UTF-8
8,272
2.84375
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.23, for Linux (x86_64) -- -- Host: 127.0.0.1 Database: footware_db -- ------------------------------------------------------ -- Server version 8.0.23 /*!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 utf8mb4 */; /*!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 `brands` -- DROP TABLE IF EXISTS `brands`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `brands` ( `b_id` int NOT NULL AUTO_INCREMENT, `b_name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`b_id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `categories` -- DROP TABLE IF EXISTS `categories`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `categories` ( `c_id` int NOT NULL AUTO_INCREMENT, `c_name_en` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `c_name_ru` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`c_id`), UNIQUE KEY `categories_c_name_uindex` (`c_name_en`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `colors` -- DROP TABLE IF EXISTS `colors`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `colors` ( `cl_id` int NOT NULL AUTO_INCREMENT, `cl_name_en` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `cl_name_ru` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`cl_id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `customers` -- DROP TABLE IF EXISTS `customers`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `customers` ( `cu_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `cu_email` varchar(70) COLLATE utf8_unicode_ci NOT NULL, `cu_password` varchar(40) COLLATE utf8_unicode_ci NOT NULL, `cu_phone` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `cu_country` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `cu_city` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `cu_address` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `cu_role` enum('user','admin') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'user', PRIMARY KEY (`cu_email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `customers` -- -- -- Table structure for table `footwear_images` -- DROP TABLE IF EXISTS `footwear_images`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `footwear_images` ( `img_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `img_art` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`img_name`), KEY `footwear_images_footwears_f_art_fk` (`img_art`), CONSTRAINT `footwear_images_footwears_f_art_fk` FOREIGN KEY (`img_art`) REFERENCES `footwears` (`f_art`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `footwear_items` -- DROP TABLE IF EXISTS `footwear_items`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `footwear_items` ( `fi_id` int NOT NULL AUTO_INCREMENT, `fi_art` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `fi_size` decimal(3,1) NOT NULL, `fi_status` enum('STOCK','SOLVED') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'STOCK', PRIMARY KEY (`fi_id`), KEY `footwear_items_footwears_f_art_fk` (`fi_art`), CONSTRAINT `footwear_items_footwears_f_art_fk` FOREIGN KEY (`fi_art`) REFERENCES `footwears` (`f_art`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `footwears` -- DROP TABLE IF EXISTS `footwears`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `footwears` ( `f_art` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `f_name` varchar(35) COLLATE utf8_unicode_ci NOT NULL, `f_price` decimal(6,2) DEFAULT NULL, `f_category` int NOT NULL, `f_for` enum('HIM','HER') COLLATE utf8_unicode_ci NOT NULL, `f_color` int DEFAULT NULL, `f_brand` int NOT NULL, `f_description_en` text COLLATE utf8_unicode_ci, `f_description_ru` text COLLATE utf8_unicode_ci, PRIMARY KEY (`f_art`), KEY `footwears_categories_c_id_fk` (`f_category`), KEY `footwears_colors_fk` (`f_color`), KEY `footwears_brands_b_id_fk` (`f_brand`), KEY `footwears_f_for_index` (`f_for`), CONSTRAINT `footwears_brands_b_id_fk` FOREIGN KEY (`f_brand`) REFERENCES `brands` (`b_id`) ON UPDATE CASCADE, CONSTRAINT `footwears_categories_c_id_fk` FOREIGN KEY (`f_category`) REFERENCES `categories` (`c_id`) ON UPDATE CASCADE, CONSTRAINT `footwears_colors_fk` FOREIGN KEY (`f_color`) REFERENCES `colors` (`cl_id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `orders` -- DROP TABLE IF EXISTS `orders`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `orders` ( `ord_id` int NOT NULL AUTO_INCREMENT, `ord_customer_email` varchar(70) COLLATE utf8_unicode_ci NOT NULL, `ord_status` enum('WAITING','APPROVED','DECLINE','COMPLETE') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'WAITING', `ord_price` decimal(7,2) NOT NULL DEFAULT '0.00', `ord_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`ord_id`), KEY `orders_customers_cu_email_fk` (`ord_customer_email`), CONSTRAINT `orders_customers_cu_email_fk` FOREIGN KEY (`ord_customer_email`) REFERENCES `customers` (`cu_email`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `orders_items` -- DROP TABLE IF EXISTS `orders_items`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `orders_items` ( `oi_order_id` int NOT NULL, `oi_item_id` int NOT NULL, PRIMARY KEY (`oi_item_id`,`oi_order_id`), KEY `orders_items_orders_ord_id_fk` (`oi_order_id`), CONSTRAINT `orders_items_footwear_items_fi_id_fk` FOREIGN KEY (`oi_item_id`) REFERENCES `footwear_items` (`fi_id`), CONSTRAINT `orders_items_orders_ord_id_fk` FOREIGN KEY (`oi_order_id`) REFERENCES `orders` (`ord_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!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-04-19 0:53:45
true
d975ebd59cbf18bf896ab9acd7e56e830cef1f32
SQL
ChaselRain/mybatis
/test.sql
UTF-8
1,894
3.265625
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : localMySQL Source Server Version : 50634 Source Host : localhost:3306 Source Database : test Target Server Type : MYSQL Target Server Version : 50634 File Encoding : 65001 Date: 2018-03-15 13:30:58 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for t_muser -- ---------------------------- DROP TABLE IF EXISTS `t_muser`; CREATE TABLE `t_muser` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `age` int(11) NOT NULL, `name` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_muser -- ---------------------------- INSERT INTO `t_muser` VALUES ('1', '23', 'admin'); INSERT INTO `t_muser` VALUES ('2', '56', '李思'); INSERT INTO `t_muser` VALUES ('3', '71', '凯德'); INSERT INTO `t_muser` VALUES ('4', '34', '一二三四五六'); -- ---------------------------- -- Table structure for t_user -- ---------------------------- DROP TABLE IF EXISTS `t_user`; CREATE TABLE `t_user` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `age` int(11) DEFAULT NULL, `address` varchar(255) DEFAULT NULL, `class_id` bigint(20) NOT NULL, PRIMARY KEY (`id`), KEY `class_id` (`class_id`), CONSTRAINT `class_id` FOREIGN KEY (`class_id`) REFERENCES `class` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of t_user -- ---------------------------- INSERT INTO `t_user` VALUES ('1', '张三', '23', '湖南衡阳', '1'); INSERT INTO `t_user` VALUES ('2', '历史', '89', '上海浦东', '2'); INSERT INTO `t_user` VALUES ('3', '王力宏', '35', '中国台湾', '3'); INSERT INTO `t_user` VALUES ('4', 'admin', '99', '中国北京', '4');
true
ba3cdfd52c3721dd2d09d633d35d34fecce52dd8
SQL
krishna-dahifale/demo2
/my updated project/ofs_trainee.sql
UTF-8
2,365
3.015625
3
[]
no_license
CREATE DATABASE IF NOT EXISTS `ofs` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `ofs`; -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: localhost Database: ofs -- ------------------------------------------------------ -- Server version 5.7.18-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 `trainee` -- DROP TABLE IF EXISTS `trainee`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `trainee` ( `trainee_id` int(5) NOT NULL, `username` int(5) NOT NULL, `password` varchar(20) NOT NULL, `first_name` varchar(20) NOT NULL, `last_name` varchar(20) NOT NULL, `email_id` varchar(20) NOT NULL, `dob` date DEFAULT NULL, `contact_no` bigint(15) NOT NULL, `h_qualification` varchar(10) DEFAULT NULL, `d_o_joining` date DEFAULT NULL, `status` varchar(15) NOT NULL, PRIMARY KEY (`trainee_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `trainee` -- LOCK TABLES `trainee` WRITE; /*!40000 ALTER TABLE `trainee` DISABLE KEYS */; INSERT INTO `trainee` VALUES (0,4587,'JHGF','krishna','Dahifale','HJKLKJ@GMAIL.COM','1994-12-22',9870380865,'BE','2017-05-26','ACTIVE'); /*!40000 ALTER TABLE `trainee` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2017-05-31 12:04:23
true
c6f4f5e6a101b4f155e8d0ad2a6bbe8ed3a66de9
SQL
zekiriabd/Java
/MecroECommerce/Customers/src/main/resources/data.sql
UTF-8
362
2.65625
3
[]
no_license
DROP TABLE IF EXISTS customer; CREATE TABLE customer ( id INT AUTO_INCREMENT PRIMARY KEY, firstName VARCHAR(250) NOT NULL, lastName VARCHAR(250) NOT NULL, email VARCHAR(250) NOT NULL ); INSERT INTO customer (firstName,lastName,email) VALUES('customer1','customer11','customer1@gmail.com'),('customer2','customer22','customer2@gmail.com'),('customer3','customer33','customer3@gmail.com');
true
14124771f480425eb4069d99d27837110cfc4893
SQL
adisteinfeld/Moneyz
/app/src/main/assets/dataB.db
UTF-8
19,829
2.6875
3
[]
no_license
CREATE TABLE Countries( country VARCHAR(40) NOT NULL PRIMARY KEY ,currency VARCHAR(6) NOT NULL ,rate BIGINT NOT NULL ); INSERT INTO Countries(country,currency,rate) VALUES ('Afghanistan','AFN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Akrotiri and Dhekelia (UK)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Aland Islands (Finland)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Albania','ALL',0); INSERT INTO Countries(country,currency,rate) VALUES ('Algeria','DZD',0); INSERT INTO Countries(country,currency,rate) VALUES ('American Samoa (USA)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Andorra','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Angola','AOA',0); INSERT INTO Countries(country,currency,rate) VALUES ('Anguilla (UK)','XCD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Antigua and Barbuda','XCD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Argentina','ARS',0); INSERT INTO Countries(country,currency,rate) VALUES ('Armenia','AMD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Aruba (Netherlands)','AWG',0); INSERT INTO Countries(country,currency,rate) VALUES ('Ascension Island (UK)','SHP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Australia','AUD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Austria','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Azerbaijan','AZN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Bahamas','BSD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Bahrain','BHD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Bangladesh','BDT',0); INSERT INTO Countries(country,currency,rate) VALUES ('Barbados','BBD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Belarus','BYN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Belgium','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Belize','BZD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Benin','XOF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Bermuda (UK)','BMD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Bhutan','BTN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Bolivia','BOB',0); INSERT INTO Countries(country,currency,rate) VALUES ('Bonaire (Netherlands)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Bosnia and Herzegovina','BAM',0); INSERT INTO Countries(country,currency,rate) VALUES ('Botswana','BWP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Brazil','BRL',0); INSERT INTO Countries(country,currency,rate) VALUES ('British Indian Ocean Territory (UK)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('British Virgin Islands (UK)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Brunei','BND',0); INSERT INTO Countries(country,currency,rate) VALUES ('Bulgaria','BGN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Burkina Faso','XOF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Burundi','BIF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Cabo Verde','CVE',0); INSERT INTO Countries(country,currency,rate) VALUES ('Cambodia','KHR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Cameroon','XAF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Canada','CAD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Caribbean Netherlands (Netherlands)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Cayman Islands (UK)','KYD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Central African Republic','XAF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Chad','XAF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Chatham Islands (New Zealand)','NZD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Chile','CLP',0); INSERT INTO Countries(country,currency,rate) VALUES ('China','CNY',0); INSERT INTO Countries(country,currency,rate) VALUES ('Christmas Island (Australia)','AUD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Cocos (Keeling) Islands (Australia)','AUD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Colombia','COP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Comoros','KMF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Congo, Democratic Republic of the','CDF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Congo, Republic of the','XAF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Cook Islands (New Zealand)','none',0); INSERT INTO Countries(country,currency,rate) VALUES ('Costa Rica','CRC',0); INSERT INTO Countries(country,currency,rate) VALUES ('Cote d''Ivoire','XOF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Croatia','HRK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Cuba','CUP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Curacao (Netherlands)','ANG',0); INSERT INTO Countries(country,currency,rate) VALUES ('Cyprus','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Czechia','CZK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Denmark','DKK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Djibouti','DJF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Dominica','XCD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Dominican Republic','DOP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Ecuador','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Egypt','EGP',0); INSERT INTO Countries(country,currency,rate) VALUES ('El Salvador','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Equatorial Guinea','XAF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Eritrea','ERN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Estonia','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Eswatini (formerly Swaziland)','SZL',0); INSERT INTO Countries(country,currency,rate) VALUES ('Ethiopia','ETB',0); INSERT INTO Countries(country,currency,rate) VALUES ('Falkland Islands (UK)','FKP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Faroe Islands (Denmark)','none',0); INSERT INTO Countries(country,currency,rate) VALUES ('Fiji','FJD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Finland','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('France','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('French Guiana (France)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('French Polynesia (France)','XPF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Gabon','XAF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Gambia','GMD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Georgia','GEL',0); INSERT INTO Countries(country,currency,rate) VALUES ('Germany','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Ghana','GHS',0); INSERT INTO Countries(country,currency,rate) VALUES ('Gibraltar (UK)','GIP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Greece','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Greenland (Denmark)','DKK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Grenada','XCD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Guadeloupe (France)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Guam (USA)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Guatemala','GTQ',0); INSERT INTO Countries(country,currency,rate) VALUES ('Guernsey (UK)','GGP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Guinea','GNF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Guinea-Bissau','XOF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Guyana','GYD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Haiti','HTG',0); INSERT INTO Countries(country,currency,rate) VALUES ('Honduras','HNL',0); INSERT INTO Countries(country,currency,rate) VALUES ('Hong Kong (China)','HKD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Hungary','HUF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Iceland','ISK',0); INSERT INTO Countries(country,currency,rate) VALUES ('India','INR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Indonesia','IDR',0); INSERT INTO Countries(country,currency,rate) VALUES ('International Monetary Fund (IMF)','XDR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Iran','IRR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Iraq','IQD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Ireland','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Isle of Man (UK)','IMP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Israel','ILS',0); INSERT INTO Countries(country,currency,rate) VALUES ('Italy','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Jamaica','JMD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Japan','JPY',0); INSERT INTO Countries(country,currency,rate) VALUES ('Jersey (UK)','JEP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Jordan','JOD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Kazakhstan','KZT',0); INSERT INTO Countries(country,currency,rate) VALUES ('Kenya','KES',0); INSERT INTO Countries(country,currency,rate) VALUES ('Kiribati','AUD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Kosovo','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Kuwait','KWD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Kyrgyzstan','KGS',0); INSERT INTO Countries(country,currency,rate) VALUES ('Laos','LAK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Latvia','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Lebanon','LBP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Lesotho','LSL',0); INSERT INTO Countries(country,currency,rate) VALUES ('Liberia','LRD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Libya','LYD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Liechtenstein','CHF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Lithuania','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Luxembourg','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Macau (China)','MOP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Madagascar','MGA',0); INSERT INTO Countries(country,currency,rate) VALUES ('Malawi','MWK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Malaysia','MYR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Maldives','MVR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Mali','XOF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Malta','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Marshall Islands','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Martinique (France)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Mauritania','MRU',0); INSERT INTO Countries(country,currency,rate) VALUES ('Mauritius','MUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Mayotte (France)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Mexico','MXN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Micronesia','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Moldova','MDL',0); INSERT INTO Countries(country,currency,rate) VALUES ('Monaco','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Mongolia','MNT',0); INSERT INTO Countries(country,currency,rate) VALUES ('Montenegro','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Montserrat (UK)','XCD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Morocco','MAD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Mozambique','MZN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Myanmar (formerly Burma)','MMK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Namibia','NAD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Nauru','AUD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Nepal','NPR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Netherlands','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('New Caledonia (France)','XPF',0); INSERT INTO Countries(country,currency,rate) VALUES ('New Zealand','NZD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Nicaragua','NIO',0); INSERT INTO Countries(country,currency,rate) VALUES ('Niger','XOF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Nigeria','NGN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Niue (New Zealand)','NZD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Norfolk Island (Australia)','AUD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Northern Mariana Islands (USA)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('North Korea','KPW',0); INSERT INTO Countries(country,currency,rate) VALUES ('North Macedonia (formerly Macedonia)','MKD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Norway','NOK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Oman','OMR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Pakistan','PKR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Palau','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Palestine','ILS',0); INSERT INTO Countries(country,currency,rate) VALUES ('Panama','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Papua New Guinea','PGK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Paraguay','PYG',0); INSERT INTO Countries(country,currency,rate) VALUES ('Peru','PEN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Philippines','PHP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Pitcairn Islands (UK)','NZD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Poland','PLN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Portugal','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Puerto Rico (USA)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Qatar','QAR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Reunion (France)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Romania','RON',0); INSERT INTO Countries(country,currency,rate) VALUES ('Russia','RUB',0); INSERT INTO Countries(country,currency,rate) VALUES ('Rwanda','RWF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Saba (Netherlands)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Saint Barthelemy (France)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Saint Helena (UK)','SHP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Saint Kitts and Nevis','XCD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Saint Lucia','XCD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Saint Martin (France)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Saint Pierre and Miquelon (France)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Saint Vincent and the Grenadines','XCD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Samoa','WST',0); INSERT INTO Countries(country,currency,rate) VALUES ('San Marino','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Sao Tome and Principe','STN',0); INSERT INTO Countries(country,currency,rate) VALUES ('Saudi Arabia','SAR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Senegal','XOF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Serbia','RSD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Seychelles','SCR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Sierra Leone','SLL',0); INSERT INTO Countries(country,currency,rate) VALUES ('Singapore','SGD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Sint Eustatius (Netherlands)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Sint Maarten (Netherlands)','ANG',0); INSERT INTO Countries(country,currency,rate) VALUES ('Slovakia','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Slovenia','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Solomon Islands','SBD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Somalia','SOS',0); INSERT INTO Countries(country,currency,rate) VALUES ('South Africa','ZAR',0); INSERT INTO Countries(country,currency,rate) VALUES ('South Georgia Island (UK)','GBP',0); INSERT INTO Countries(country,currency,rate) VALUES ('South Korea','KRW',0); INSERT INTO Countries(country,currency,rate) VALUES ('South Sudan','SSP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Spain','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Sri Lanka','LKR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Sudan','SDG',0); INSERT INTO Countries(country,currency,rate) VALUES ('Suriname','SRD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Svalbard and Jan Mayen (Norway)','NOK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Sweden','SEK',0); INSERT INTO Countries(country,currency,rate) VALUES ('Switzerland','CHF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Syria','SYP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Taiwan','TWD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Tajikistan','TJS',0); INSERT INTO Countries(country,currency,rate) VALUES ('Tanzania','TZS',0); INSERT INTO Countries(country,currency,rate) VALUES ('Thailand','THB',0); INSERT INTO Countries(country,currency,rate) VALUES ('Timor-Leste','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Togo','XOF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Tokelau (New Zealand)','NZD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Tonga','TOP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Trinidad and Tobago','TTD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Tristan da Cunha (UK)','GBP',0); INSERT INTO Countries(country,currency,rate) VALUES ('Tunisia','TND',0); INSERT INTO Countries(country,currency,rate) VALUES ('Turkey','TRY',0); INSERT INTO Countries(country,currency,rate) VALUES ('Turkmenistan','TMT',0); INSERT INTO Countries(country,currency,rate) VALUES ('Turks and Caicos Islands (UK)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Tuvalu','AUD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Uganda','UGX',0); INSERT INTO Countries(country,currency,rate) VALUES ('Ukraine','UAH',0); INSERT INTO Countries(country,currency,rate) VALUES ('United Arab Emirates','AED',0); INSERT INTO Countries(country,currency,rate) VALUES ('United Kingdom','GBP',0); INSERT INTO Countries(country,currency,rate) VALUES ('United States of America','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Uruguay','UYU',0); INSERT INTO Countries(country,currency,rate) VALUES ('US Virgin Islands (USA)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Uzbekistan','UZS',0); INSERT INTO Countries(country,currency,rate) VALUES ('Vanuatu','VUV',0); INSERT INTO Countries(country,currency,rate) VALUES ('Vatican City (Holy See)','EUR',0); INSERT INTO Countries(country,currency,rate) VALUES ('Venezuela','VES',0); INSERT INTO Countries(country,currency,rate) VALUES ('Vietnam','VND',0); INSERT INTO Countries(country,currency,rate) VALUES ('Wake Island (USA)','USD',0); INSERT INTO Countries(country,currency,rate) VALUES ('Wallis and Futuna (France)','XPF',0); INSERT INTO Countries(country,currency,rate) VALUES ('Yemen','YER',0); INSERT INTO Countries(country,currency,rate) VALUES ('Zambia','ZMW',0); INSERT INTO Countries(country,currency,rate) VALUES ('Zimbabwe','USD',0);
true
4a6ddc99fc8145e4d6f39ff6e6be537340043614
SQL
inigo10rodri/MySQL
/Evaluacion 3/Oracle/TriggersOracle/trigger4.sql
UTF-8
240
2.78125
3
[]
no_license
create or replace trigger borrar_detalle before delete on detalle for each row begin update venta_productos set unidades_vendidas = unidades_vendidas - :old.cantidad where id_prod = :old.id_producto; end;
true
03292a58b719948923326316fee4f204961d3926
SQL
zt3f/InPUTj-SQL
/src/DatabaseTransactionExamples/sql/xpath/query1.sql
UTF-8
716
3.6875
4
[ "MIT" ]
permissive
/* Querying the database about which experiments have a problem * feature design with a structural parameter that has the ID * "WSN" and a numeric subparameter which in turn has the ID * "UpperBoundTDMASize" and a value greater than 80 */ SELECT experiment, design, upper_bound_tdma_size[1] FROM (SELECT experiment.id AS experiment, design.id AS design, xpath( '/in:Design/in:SValue[@id="WSN"]/in:NValue[@id="UpperBoundTDMASize"][@value>80]/@value', content, ARRAY[ARRAY['in', 'http://TheInPUT.org/Design']]) AS upper_bound_tdma_size FROM input.experiment, input.design WHERE problem_features = design.id) AS problem_feature_design WHERE array_length(upper_bound_tdma_size, 1) > 0
true
e081cc1ad7039e8d6d3584fd877397974b436b63
SQL
DeepSingh93/Grockart
/grockart/grockart/assets/database/CSCI5308_10_DEVINT_tbl_groupOrder.sql
UTF-8
2,286
2.984375
3
[ "MIT" ]
permissive
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: db-5308.cs.dal.ca Database: CSCI5308_10_DEVINT -- ------------------------------------------------------ -- Server version 5.5.5-10.0.35-MariaDB /*!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 `tbl_groupOrder` -- DROP TABLE IF EXISTS `tbl_groupOrder`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tbl_groupOrder` ( `gID` int(11) NOT NULL AUTO_INCREMENT, `oID` int(11) NOT NULL, `uID` int(11) NOT NULL, `goSID` int(11) NOT NULL, PRIMARY KEY (`gID`), KEY `fkIdx_206` (`oID`), KEY `fkIdx_210` (`uID`), KEY `fkIdx_223` (`goSID`), CONSTRAINT `FK_206` FOREIGN KEY (`oID`) REFERENCES `tbl_order` (`oID`), CONSTRAINT `FK_210` FOREIGN KEY (`uID`) REFERENCES `tbl_Login` (`uID`), CONSTRAINT `FK_223` FOREIGN KEY (`goSID`) REFERENCES `tbl_groupOrderStatus` (`goSID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tbl_groupOrder` -- LOCK TABLES `tbl_groupOrder` WRITE; /*!40000 ALTER TABLE `tbl_groupOrder` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_groupOrder` 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 2018-08-03 18:54:19
true
d09618b53a168e02b8e1731e7b50391c34efd5c6
SQL
HuangChenning/oracle_dba_scripts
/oracle脚本/GCS_GES.sql
UTF-8
230
3.1875
3
[]
no_license
select s.statistic_name stat, owner, object_name obj, sum(value) val from v$segment_statistics s where s.statistic_name like 'global%' and s.value > 0 group by s.statistic_name, owner, object_name order by val desc;
true
a5be6c1079670781c90d95a8f26cedc91324c12e
SQL
blacker50/PM2
/WebContent/mysql/update/pm2.sql
UTF-8
7,337
3.140625
3
[ "MIT" ]
permissive
/* Navicat MySQL Data Transfer Source Server : 127.0.0.1_3306 Source Server Version : 50087 Source Host : 127.0.0.1:3306 Source Database : pm Target Server Type : MYSQL Target Server Version : 50087 File Encoding : 65001 Date: 2017-03-22 17:00:46 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for admin -- ---------------------------- DROP TABLE IF EXISTS `admin`; CREATE TABLE `admin` ( `id` int(11) NOT NULL auto_increment, `guid` varchar(36) default NULL, `name` varchar(10) default NULL, `password` varchar(15) default NULL, `isdelete` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of admin -- ---------------------------- INSERT INTO `admin` VALUES ('3', '4ec20c16-08d3-11e7-82ca-71fea84e8cd3', 'Cxx3', '66', null); INSERT INTO `admin` VALUES ('7', '09c296b3-0d83-11e7-9cc0-dabf2ea8c2d1', 'linlinlin', 'ytu', null); INSERT INTO `admin` VALUES ('8', '881c4e54-0d83-11e7-9cc0-dabf2ea8c2d1', 'yty', '7', null); INSERT INTO `admin` VALUES ('9', 'aea1c2c1-0d83-11e7-9cc0-dabf2ea8c2d1', 'yty655', '7', null); INSERT INTO `admin` VALUES ('11', 'c64e1136-0ebf-11e7-9cc0-dabf2ea8c2d1', 'yty000', '7', null); -- ---------------------------- -- Table structure for dorm -- ---------------------------- DROP TABLE IF EXISTS `dorm`; CREATE TABLE `dorm` ( `guid` varchar(36) default NULL, `id` varchar(15) NOT NULL, `building` char(1) default NULL, `num_id` int(11) default NULL, `name` varchar(15) default NULL, `phone` varchar(15) default NULL, `balance` double default NULL, `isdelete` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of dorm -- ---------------------------- INSERT INTO `dorm` VALUES ('4ef63892-08d3-11e7-82ca-71fea84e8cd3', 'A311', 'A', '311', 'Lin', '13423455533', '0', null); INSERT INTO `dorm` VALUES ('4ef63d14-08d3-11e7-82ca-71fea84e8cd3', 'B322', 'B', '322', 'Jack', '15323347853', '1.1', null); -- ---------------------------- -- Table structure for meter_reader -- ---------------------------- DROP TABLE IF EXISTS `meter_reader`; CREATE TABLE `meter_reader` ( `id` int(11) NOT NULL auto_increment, `guid` varchar(36) default NULL, `name` varchar(10) default NULL, `password` varchar(15) default NULL, `phone` varchar(15) default NULL, `isdelete` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of meter_reader -- ---------------------------- INSERT INTO `meter_reader` VALUES ('1', '4f1e4492-08d3-11e7-82ca-71fea84e8cd3', '小夏', '1', '15113991910', null); -- ---------------------------- -- Table structure for meter_reading_problem -- ---------------------------- DROP TABLE IF EXISTS `meter_reading_problem`; CREATE TABLE `meter_reading_problem` ( `id` int(11) NOT NULL auto_increment, `guid` varchar(36) default NULL, `dorm_id` varchar(15) default NULL, `mreader_id` int(11) default NULL, `problem` varchar(50) default NULL, `isdelete` int(11) default NULL, PRIMARY KEY (`id`), KEY `dorm_id` (`dorm_id`), KEY `mreader_id` (`mreader_id`), CONSTRAINT `meter_reading_problem_ibfk_1` FOREIGN KEY (`dorm_id`) REFERENCES `dorm` (`id`), CONSTRAINT `meter_reading_problem_ibfk_2` FOREIGN KEY (`mreader_id`) REFERENCES `meter_reader` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of meter_reading_problem -- ---------------------------- -- ---------------------------- -- Table structure for meter_reading_result -- ---------------------------- DROP TABLE IF EXISTS `meter_reading_result`; CREATE TABLE `meter_reading_result` ( `id` int(11) NOT NULL auto_increment, `guid` varchar(36) default NULL, `dorm_id` varchar(15) default NULL, `last_read_date` date default NULL, `this_read_date` date default NULL, `is_exception` tinyint(1) default '0', `is_read` tinyint(1) default '0', `mreader_id` int(11) default NULL, `isdelete` int(11) default NULL, PRIMARY KEY (`id`), KEY `dorm_id` (`dorm_id`), KEY `mreader_id` (`mreader_id`), CONSTRAINT `meter_reading_result_ibfk_1` FOREIGN KEY (`dorm_id`) REFERENCES `dorm` (`id`), CONSTRAINT `meter_reading_result_ibfk_2` FOREIGN KEY (`mreader_id`) REFERENCES `meter_reader` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of meter_reading_result -- ---------------------------- -- ---------------------------- -- Table structure for meter_reading_task -- ---------------------------- DROP TABLE IF EXISTS `meter_reading_task`; CREATE TABLE `meter_reading_task` ( `id` int(11) NOT NULL auto_increment, `guid` varchar(36) default NULL, `dorm_id` varchar(15) default NULL, `mread_month` date default NULL, `mreader_id` int(11) default NULL, `isdelete` int(11) default NULL, PRIMARY KEY (`id`), KEY `dorm_id` (`dorm_id`), KEY `mreader_id` (`mreader_id`), CONSTRAINT `meter_reading_task_ibfk_1` FOREIGN KEY (`dorm_id`) REFERENCES `dorm` (`id`), CONSTRAINT `meter_reading_task_ibfk_2` FOREIGN KEY (`mreader_id`) REFERENCES `meter_reader` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of meter_reading_task -- ---------------------------- -- ---------------------------- -- Table structure for power_toll -- ---------------------------- DROP TABLE IF EXISTS `power_toll`; CREATE TABLE `power_toll` ( `id` int(11) NOT NULL auto_increment, `guid` varchar(36) default NULL, `dorm_id` varchar(15) default NULL, `account_date` date default NULL, `pay_date` date default NULL, `should_pay` double default NULL, `actual_pay` double default NULL, `pay_state` tinyint(1) default '0', `isdelete` int(11) default NULL, PRIMARY KEY (`id`), KEY `dorm_id` (`dorm_id`), CONSTRAINT `power_toll_ibfk_1` FOREIGN KEY (`dorm_id`) REFERENCES `dorm` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of power_toll -- ---------------------------- -- ---------------------------- -- Table structure for power_used -- ---------------------------- DROP TABLE IF EXISTS `power_used`; CREATE TABLE `power_used` ( `id` int(11) NOT NULL auto_increment, `guid` varchar(36) default NULL, `dorm_id` varchar(15) default NULL, `mread_date` date default NULL, `basic_power` double default NULL, `power_read` double default NULL, `power_use` double default NULL, `isdelete` int(11) default NULL, PRIMARY KEY (`id`), KEY `dorm_id` (`dorm_id`), CONSTRAINT `power_used_ibfk_1` FOREIGN KEY (`dorm_id`) REFERENCES `dorm` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of power_used -- ---------------------------- -- ---------------------------- -- Table structure for traiff_param -- ---------------------------- DROP TABLE IF EXISTS `traiff_param`; CREATE TABLE `traiff_param` ( `id` int(11) NOT NULL auto_increment, `guid` varchar(36) default NULL, `issue_date` date default NULL, `unit_price` double default NULL, `isdelete` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of traiff_param -- ----------------------------
true
ca712a688b01b93ef98e419b6cf5356dcc7e7f8d
SQL
Shivani48/studybuddy
/studdybuddy.sql
UTF-8
3,027
3.359375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Apr 02, 2019 at 06:44 AM -- Server version: 10.1.38-MariaDB -- PHP Version: 7.3.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `studdybuddy` -- -- -------------------------------------------------------- -- -- Table structure for table `requestdetails` -- CREATE TABLE `requestdetails` ( `id` int(11) NOT NULL, `emailfrom` varchar(30) NOT NULL, `emailfor` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `requestdetails` -- INSERT INTO `requestdetails` (`id`, `emailfrom`, `emailfor`) VALUES (1, 'hinu', '3'), (2, 'hinu', '1'), (3, 'hinu', '4'), (4, 'hinu', '3'), (5, 'hinu', '1'), (6, 'hinu', '4'), (7, 'hinu', '2'), (8, 'rinny', '2'), (9, 'rinny', '4'), (10, 'rinny', '4'), (11, 'zimple@gmail.com', '2'), (12, 'zimple@gmail.com', '3'), (13, 'zimple@gmail.com', '4'), (14, 'bhavana', '1'); -- -------------------------------------------------------- -- -- Table structure for table `usertable` -- CREATE TABLE `usertable` ( `id` int(11) NOT NULL, `name` varchar(30) NOT NULL, `university` varchar(50) NOT NULL, `major` varchar(50) NOT NULL, `level` varchar(30) NOT NULL, `phone` int(10) NOT NULL, `zipcode` int(5) NOT NULL, `email` varchar(30) NOT NULL, `password` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `usertable` -- INSERT INTO `usertable` (`id`, `name`, `university`, `major`, `level`, `phone`, `zipcode`, `email`, `password`) VALUES (1, 'zimple', 'bu', 'Accounting (BS)', 'Freshman', 1236547890, 13905, 'zimple@gmail.com', '1234'), (2, 'Hinal', 'BU', 'Biomedical Engineering (BS)', 'Masters', 1236459781, 13905, 'hinu', '1234'), (3, 'Rinny', 'BU', 'Chemistry (BA, BS)', 'PhD', 1236459781, 13905, 'rinny', '1234'), (4, 'Bhavana', 'BU', 'Electrical Engineering (BS)', 'Senior', 1236459781, 13905, 'bhavana', '1234'); -- -- Indexes for dumped tables -- -- -- Indexes for table `requestdetails` -- ALTER TABLE `requestdetails` ADD PRIMARY KEY (`id`); -- -- Indexes for table `usertable` -- ALTER TABLE `usertable` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `email` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `requestdetails` -- ALTER TABLE `requestdetails` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `usertable` -- ALTER TABLE `usertable` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
05e7be50d58ab9251b18c2f182ee02eea5909446
SQL
serakoc/AFPA
/BDD/crée la base de donnée/exercice2-manipulerbdd.sql
UTF-8
5,519
3.359375
3
[]
no_license
DROP DATABASE if EXISTS ex02; CREATE DATABASE ex02; USE ex02; CREATE TABLE Client ( num_client INT AUTO_INCREMENT NOT NULL, adresse_client VARCHAR(50) NOT NULL, nom_client VARCHAR(30) NOT NULL, prenom_client VARCHAR(30) NOT NULL, PRIMARY KEY (num_client) ); CREATE TABLE Station ( num_station INT NOT NULL AUTO_INCREMENT, nom_station VARCHAR(50) NOT NULL, PRIMARY KEY (num_station) ); CREATE TABLE Hotel ( capacite_hotel INT NOT NULL, categorie_hotel INT NOT NULL, nom_hotel VARCHAR(20) NOT NULL, adresse_hotel VARCHAR(50) NOT NULL, num_station INT, num_hotel INT AUTO_INCREMENT, PRIMARY KEY(num_hotel), FOREIGN KEY (num_station) REFERENCES Station(num_station) ); CREATE TABLE Chambre ( capacite_chambre INT NOT NULL, degre_confort INT NOT NULL, exposition VARCHAR(10), type_chambre VARCHAR(10), num_hotel INT, num_chambre INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (num_chambre), FOREIGN KEY (num_hotel) REFERENCES Hotel(num_hotel) ); CREATE TABLE Reservation ( num_chambre INT NOT NULL, num_client INT AUTO_INCREMENT, date_debut DATE NOT NULL, date_fin DATE NOT NULL, date_reservation DATETIME NOT NULL, montant_arrhes INT, prix_total INT NOT NULL, PRIMARY KEY(num_client), FOREIGN KEY (num_client) REFERENCES Client(num_client), FOREIGN KEY (num_chambre) REFERENCES Chambre(num_chambre) ); /* -------------------- sta1*/ INSERT INTO Station(nom_station) VALUES ('sta1'); INSERT INTO Hotel(capacite_hotel, categorie_hotel, nom_hotel, adresse_hotel) VALUES (5,5,'st1h1','france'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Hotel(capacite_hotel, categorie_hotel, nom_hotel, adresse_hotel) VALUES (4,4,'st1h2','france'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Hotel(capacite_hotel, categorie_hotel, nom_hotel, adresse_hotel) VALUES (3,4,'st1h3','france'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); /* ----------------------- sta2*/ INSERT INTO Station(nom_station) VALUES ('sta2'); INSERT INTO Hotel(capacite_hotel, categorie_hotel, nom_hotel, adresse_hotel) VALUES (5,5,'st2h1','france'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Hotel(capacite_hotel, categorie_hotel, nom_hotel, adresse_hotel) VALUES (4,4,'st2h2','france'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Hotel(capacite_hotel, categorie_hotel, nom_hotel, adresse_hotel) VALUES (3,4,'st2h3','france'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); /*-------------------------- sta3 */ INSERT INTO Station(nom_station) VALUES ('sta3'); INSERT INTO Hotel(capacite_hotel, categorie_hotel, nom_hotel, adresse_hotel) VALUES (5,5,'st3h1','france'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Hotel(capacite_hotel, categorie_hotel, nom_hotel, adresse_hotel) VALUES (4,4,'st1h2','france'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Hotel(capacite_hotel, categorie_hotel, nom_hotel, adresse_hotel) VALUES (3,4,'st3h3','france'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort'); INSERT INTO Chambre(capacite_chambre, degre_confort, exposition, type_chambre) VALUES (5,5,'sud','confort');
true
f66a4fe4eb0286da16903ef5aaab9e1fd40923c5
SQL
geoHeil/tuWienBusinessIntelligence
/ue2/task2/etl/customer.sql
UTF-8
735
3.015625
3
[]
no_license
INSERT INTO BI_OLAP_4.DM_Customer SELECT customerid, concat(FirstName, ' ', (CASE WHEN MiddleName IS NOT NULL AND MiddleName <> '' THEN concat(MiddleName, (CASE WHEN MiddleName LIKE '%.' THEN '' ELSE '.' END), ' ') ELSE '' END), LastName, (CASE WHEN Suffix IS NOT NULL AND suffix <> '' THEN concat(', ', Suffix) ELSE '' END)) AS Name, Birthdate AS BirthDate, timestampdiff(YEAR, timestamp(Birthdate), STR_TO_DATE('2016-01-01', '%Y-%m-%d')) AS Age, ( CASE WHEN gender = 'M' THEN 'Male' ELSE 'Female' END ) AS Gender, EmailAddress AS Email, Phone FROM BI_OLTP_4.TB_Customer;
true
97a73100e868a0f9360b44d0166a95e742454f43
SQL
cavin12400/purchase
/DATABASE/views/purchase_searcher.sql
UTF-8
1,836
3
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.7.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Mar 04, 2018 at 12:38 PM -- Server version: 10.1.25-MariaDB -- PHP Version: 7.1.7 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: `inventory` -- -- -------------------------------------------------------- -- -- Structure for view `purchase_searcher` -- CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `purchase_searcher` AS select `tbl_purchase_order`.`purchase_id` AS `purchase_id`,group_concat(`tbl_supplier`.`supplier_name` separator ', ') AS `supplier_name`,`tbl_purchase_order`.`Date_Ordered` AS `Date_Ordered`,group_concat(`tbl_product`.`product_name` separator ', ') AS `product_name`,`tbl_purchase_order`.`total_amount` AS `total_amount`,`tbl_purchase_order`.`total_payment` AS `total_payment`,`tbl_purchase_order`.`total_balance` AS `total_balance` from (((`tbl_purchase_detail` join `tbl_purchase_order` on((`tbl_purchase_detail`.`purchase_id` = `tbl_purchase_order`.`purchase_id`))) join `tbl_supplier` on((`tbl_purchase_detail`.`supplier_id` = `tbl_supplier`.`supplier_id`))) join `tbl_product` on((`tbl_purchase_detail`.`product_id` = `tbl_product`.`product_id`))) group by `tbl_purchase_order`.`purchase_id` ; -- -- VIEW `purchase_searcher` -- Data: None -- COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
e7cb5f22910c6694c77e30750beed0e5ae4d28b4
SQL
franbardin/BDD
/MySQL/Clase7.sql
UTF-8
529
3.40625
3
[]
no_license
-- 3 SELECT c.customer_id, c.first_name, c.last_name FROM rental r1, customer c WHERE NOT EXISTS (SELECT * FROM rental r2 WHERE r1.customer_id = r2.customer_id AND r1.rental_id <> r2.rental_id) AND r1.customer_id = c.customer_id ORDER BY 1; -- 4 SELECT c.customer_id, c.first_name, c.last_name FROM rental r1, customer c WHERE EXISTS (SELECT * FROM rental r2 WHERE r1.customer_id = r2.customer_id AND r1.rental_id <> r2.rental_id) AND r1.customer_id = c.customer_id ORDER BY 1; -- 5
true
58cbfe5a0a4b104297c5668347cb16fc934f3b99
SQL
Sunil2011/growsari1
/data/db/re-dash-queries/49.Store Sub Categories Sale.sql
UTF-8
902
4.75
5
[]
no_license
SELECT s.name AS store_name, a.username AS username, s.customer_name, c.name, no_of_orders, SUM(oi.net_amount) AS sales FROM `store` AS `s` INNER JOIN `account` AS `a` ON `a`.`id` = `s`.`account_id` LEFT JOIN (SELECT s1.id, count(oii.id) AS no_of_orders FROM `store` s1 JOIN store_warehouse_shipper sws1 ON sws1.store_id = s1.id JOIN `order` oii ON oii.associate_id = sws1.id GROUP BY s1.id) ox ON ox.id = s.id LEFT JOIN `store_warehouse_shipper` AS `sws` ON `sws`.`store_id` = `s`.`id` LEFT JOIN `order` AS `o` ON `o`.`associate_id` = `sws`.`id` LEFT JOIN `order_item` AS `oi` ON `oi`.`order_id` = `o`.`id` LEFT JOIN `product` AS `p` ON `oi`.`product_id` = `p`.`id` LEFT JOIN `category` AS `c` ON `p`.`category_id` = `c`.`id` WHERE `o`.`id` IS NOT NULL GROUP BY `p`.`category_id`, `s`.`id` ORDER BY `s`.`id` DESC, sales DESC
true
5aaa8ed3b7131f08105692ce9acb2da4939fb587
SQL
scoricov/childprotect.com
/share/schema.main.sql
UTF-8
2,259
3.578125
4
[ "MIT" ]
permissive
# **************************************** # # # # childprotect.com main database schema # # # # **************************************** # DROP TABLE IF EXISTS `token_deleted`; DROP TABLE IF EXISTS `token`; DROP TABLE IF EXISTS `user_confirm`; DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( id INT UNSIGNED AUTO_INCREMENT not null, email VARCHAR(255) NOT NULL, pwd BINARY(16), name VARCHAR(255), url VARCHAR(255) NOT NULL, flag tinyint unsigned NOT NULL DEFAULT 0, api_key CHAR(16) NOT NULL, tokens_submitted INT UNSIGNED NOT NULL DEFAULT 0, tokens_deleted INT UNSIGNED NOT NULL DEFAULT 0, last_login_time datetime default null, last_login_host VARCHAR(255) default null, created_time datetime DEFAULT NULL, modified_time datetime DEFAULT NULL, deleted tinyint UNSIGNED DEFAULT 0, PRIMARY KEY(id), INDEX(email), INDEX(deleted) ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE TABLE `user_confirm` ( `user_id` int unsigned not null, `action` tinyint unsigned not null default 0, `hash` BINARY(16) not null, `created_time` datetime NOT NULL, PRIMARY KEY(`user_id`, `action`), FOREIGN KEY(`user_id`) REFERENCES `user`(`id`) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB; CREATE TABLE `token` ( id INT UNSIGNED AUTO_INCREMENT NOT NULL, footprint BINARY(24) NOT NULL, submitted DATE NOT NULL, user_id INT UNSIGNED NOT NULL, PRIMARY KEY(id), UNIQUE INDEX(footprint), INDEX(submitted), FOREIGN KEY(`user_id`) REFERENCES `user`(`id`) ON UPDATE RESTRICT ON DELETE RESTRICT ) ENGINE=InnoDB; CREATE TABLE `token_deleted` ( token_id INT UNSIGNED NOT NULL, user_id INT UNSIGNED NOT NULL, deleted DATE NOT NULL, PRIMARY KEY(token_id, user_id), FOREIGN KEY(`token_id`) REFERENCES `token`(`id`) ON UPDATE RESTRICT ON DELETE CASCADE, FOREIGN KEY(`user_id`) REFERENCES `user`(`id`) ON UPDATE RESTRICT ON DELETE CASCADE ) ENGINE=InnoDB;
true
8cba74a6188c19832c16301e16f0a67d8644c080
SQL
radtek/abs3
/sql/mmfo/barsaq/Table/ibank_acc.sql
WINDOWS-1251
3,698
3.453125
3
[]
no_license
PROMPT ===================================================================================== PROMPT *** Run *** ========== Scripts /Sql/BARSAQ/Table/IBANK_ACC.sql =========*** Run *** = PROMPT ===================================================================================== PROMPT *** Create table IBANK_ACC *** begin execute immediate ' CREATE TABLE BARSAQ.IBANK_ACC ( KF VARCHAR2(6), ACC NUMBER(*,0), CONSTRAINT PK_IBANKACC PRIMARY KEY (KF, ACC) ENABLE ) ORGANIZATION INDEX NOCOMPRESS PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING TABLESPACE BRSDYND PCTTHRESHOLD 50'; exception when others then if sqlcode=-955 then null; else raise; end if; end; / COMMENT ON TABLE BARSAQ.IBANK_ACC IS ' IBANK'; COMMENT ON COLUMN BARSAQ.IBANK_ACC.KF IS ' , '; COMMENT ON COLUMN BARSAQ.IBANK_ACC.ACC IS 'ACC '; PROMPT *** Create constraint CC_IBANKACC_KF_NN *** begin execute immediate ' ALTER TABLE BARSAQ.IBANK_ACC MODIFY (KF CONSTRAINT CC_IBANKACC_KF_NN NOT NULL ENABLE)'; exception when others then if sqlcode=-2260 or sqlcode=-2261 or sqlcode=-2264 or sqlcode=-2275 or sqlcode=-1442 then null; else raise; end if; end; / PROMPT *** Create constraint CC_IBANKACC_ACC_NN *** begin execute immediate ' ALTER TABLE BARSAQ.IBANK_ACC MODIFY (ACC CONSTRAINT CC_IBANKACC_ACC_NN NOT NULL ENABLE)'; exception when others then if sqlcode=-2260 or sqlcode=-2261 or sqlcode=-2264 or sqlcode=-2275 or sqlcode=-1442 then null; else raise; end if; end; / /* PROMPT *** Create constraint PK_IBANKACC *** begin execute immediate ' ALTER TABLE BARSAQ.IBANK_ACC ADD CONSTRAINT PK_IBANKACC PRIMARY KEY (KF, ACC) USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE BRSDYND ENABLE'; exception when others then if sqlcode=-2260 or sqlcode=-2261 or sqlcode=-2264 or sqlcode=-2275 or sqlcode=-1442 then null; else raise; end if; end; / */ PROMPT *** Create constraint FK_IBANKACC_BANKS *** begin execute immediate ' ALTER TABLE BARSAQ.IBANK_ACC ADD CONSTRAINT FK_IBANKACC_BANKS FOREIGN KEY (KF) REFERENCES BARS.BANKS$BASE (MFO) ENABLE NOVALIDATE'; exception when others then if sqlcode=-2260 or sqlcode=-2261 or sqlcode=-2264 or sqlcode=-2275 or sqlcode=-1442 then null; else raise; end if; end; / PROMPT *** Create index PK_IBANKACC *** begin execute immediate ' CREATE UNIQUE INDEX BARSAQ.PK_IBANKACC ON BARSAQ.IBANK_ACC (KF, ACC) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE BRSDYND '; exception when others then if sqlcode=-955 then null; else raise; end if; end; / begin execute immediate 'alter table BARSAQ.IBANK_ACC add acc_corp2 INTEGER'; exception when others then if sqlcode=-1430 then null; else raise; end if; end; / begin execute immediate 'alter table BARSAQ.IBANK_ACC add visa_count NUMBER'; exception when others then if sqlcode=-1430 then null; else raise; end if; end; / -- Add comments to the columns comment on column BARSAQ.IBANK_ACC.acc_corp2 is 'ACC Corp2'; PROMPT *** Create grants IBANK_ACC *** grant SELECT on IBANK_ACC to BARSREADER_ROLE; PROMPT ===================================================================================== PROMPT *** End *** ========== Scripts /Sql/BARSAQ/Table/IBANK_ACC.sql =========*** End *** = PROMPT =====================================================================================
true
5b66b4ebdb7febc6428dd2d15d13c491e69774ed
SQL
RJ-SMTR/od-matrix
/sql/vw_onibus_utilisation.sql
UTF-8
4,718
4.25
4
[ "MIT" ]
permissive
-- this table likely wont work with multiple days WITH H3Table AS ( -- H3 table SELECT tile_id, resolution, parent_id, ST_GEOGFROMTEXT(geometry) AS geometry FROM `rj-smtr.br_rj_riodejaneiro_geo.h3_res8` ), ticketing_onibus AS ( SELECT * FROM pytest.vw_ticketing_origin_destination WHERE origin_tile_id IS NOT NULL AND destination_tile_id IS NOT NULL AND origin_mode = 'Ônibus' ), onibus_gps AS ( -- Onibus GPS table, bus GPS joined with h3 geometry (this should be done in view later) SELECT onibus_oneday.as_at, onibus_oneday.onibus_id, onibus_oneday.line, onibus_oneday.tile_id, onibus_oneday.h3_time_enter, onibus_oneday.h3_time_exit, capacity_sitting, capacity_standing, capacity_total, h3t1.geometry AS tile_geometry FROM pytest.onibus_oneday LEFT JOIN H3Table AS h3t1 ON h3t1.tile_id = onibus_oneday.tile_id ), onibus_boarding AS ( -- Working table, join gps data with ticketing data, match tap with GPS ping SELECT onibus_gps.as_at, onibus_gps.onibus_id, onibus_gps.line, onibus_gps.tile_id, onibus_gps.h3_time_enter, onibus_gps.h3_time_exit, capacity_sitting, capacity_standing, capacity_total, card_id, origin_time, destination_tile_id, tile_geometry, geometry AS destination_tile_geometry FROM onibus_gps LEFT JOIN ticketing_onibus ON origin_code = CAST(RIGHT(onibus_gps.onibus_id,5) AS INT) AND ticketing_onibus.as_at = onibus_gps.as_at AND origin_time BETWEEN onibus_gps.h3_time_enter AND onibus_gps.h3_time_exit LEFT JOIN H3Table ON H3Table.tile_id = ticketing_onibus.destination_tile_id ), distance_table AS ( -- Match all gps pings that occur 2hrs after boarding with each tap for a given bus. Calculate distance. SELECT ROW_NUMBER() OVER (PARTITION BY B.onibus_id, card_id, origin_time ORDER BY B.h3_time_enter) AS n, B.as_at, B.onibus_id, B.line, B.tile_id, B.h3_time_enter, B.h3_time_exit, -- B.tile_geometry, B.capacity_sitting, B.capacity_standing, B.capacity_total, card_id, origin_time, destination_tile_id, ( ST_DISTANCE(B.tile_geometry, destination_tile_geometry) + ST_MAXDISTANCE(B.tile_geometry, destination_tile_geometry) ) / 2 AS distance_avg, -- this calcs the average distance MIN( ( -- this calcs the minimum distance for a given tap ST_DISTANCE(B.tile_geometry, destination_tile_geometry) + ST_MAXDISTANCE(B.tile_geometry, destination_tile_geometry) ) / 2 ) OVER (PARTITION BY B.onibus_id, card_id, origin_time) AS distance_min FROM onibus_gps B INNER JOIN onibus_boarding A ON A.as_at = B.as_at AND A.onibus_id = B.onibus_id AND B.h3_time_exit > origin_time AND B.h3_time_enter < TIME_ADD(origin_time, INTERVAL 2 HOUR) ORDER BY h3_time_enter ), min_distance AS ( -- min distance row for each tap, to identify where along the route the user got off SELECT as_at, onibus_id, line, card_id, origin_time, MIN(n) AS max_row FROM distance_table WHERE distance_min = distance_avg -- keep only the minimum distance rows, identified by the row number GROUP BY as_at, onibus_id, line, card_id, origin_time ORDER BY card_id ) SELECT distance_table.as_at, distance_table.onibus_id, distance_table.line, tile_id, h3_time_enter, h3_time_exit, EXTRACT(HOUR FROM h3_time_enter) AS h3_hour_enter, COUNT(*) AS n_passengers, AVG(capacity_sitting) AS capacity_sitting, AVG(capacity_standing) AS capacity_standing, AVG(capacity_total) AS average_capacity_total, COUNT(*) / AVG(capacity_total) AS utilisation_total, AVG(perc_group_total) AS unaccounted_proportion, COUNT(*) / (1 - AVG(perc_group_total)) AS n_passengers_adjusted, ( COUNT(*) / (1 - AVG(perc_group_total)) ) / AVG(capacity_total) AS utilisation_total_adjusted FROM distance_table LEFT JOIN min_distance ON distance_table.as_at = min_distance.as_at AND distance_table.onibus_id = min_distance.onibus_id AND distance_table.card_id = min_distance.card_id AND distance_table.origin_time = min_distance.origin_time LEFT JOIN pytest.vw_onibus_unaccounted_trips ON vw_onibus_unaccounted_trips.as_at = distance_table.as_at AND vw_onibus_unaccounted_trips.onibus_id = distance_table.onibus_id AND vw_onibus_unaccounted_trips.onibus_line = distance_table.line AND vw_onibus_unaccounted_trips.origin_hour = EXTRACT(HOUR FROM h3_time_enter) WHERE distance_table.n <= max_row AND vw_onibus_unaccounted_trips.accounted_unaccounted = 'Unexplained' GROUP BY distance_table.as_at, distance_table.onibus_id, distance_table.line, tile_id, h3_time_enter, h3_time_exit ORDER BY onibus_id, h3_time_enter
true
5ec0a79fdc7f42d1c91019dec54420d164a2f9b8
SQL
EwdAger/hnust_score
/hnust_score.sql
UTF-8
1,710
3.15625
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50721 Source Host : localhost:3306 Source Database : hnust_score Target Server Type : MYSQL Target Server Version : 50721 File Encoding : 65001 Date: 2019-04-20 12:56:15 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for score_info -- ---------------------------- DROP TABLE IF EXISTS `score_info`; CREATE TABLE `score_info` ( `id` varchar(40) NOT NULL, `stu_id` varchar(30) NOT NULL, `stu_name` varchar(30) NOT NULL, `term` varchar(30) NOT NULL, `course_name` varchar(60) NOT NULL, `course_nature` varchar(30) DEFAULT NULL, `course_credit` varchar(30) DEFAULT NULL, `course_time` varchar(30) DEFAULT NULL, `score` varchar(30) NOT NULL, `crawl_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for student_info -- ---------------------------- DROP TABLE IF EXISTS `student_info`; CREATE TABLE `student_info` ( `id` varchar(40) NOT NULL, `stu_id` varchar(30) NOT NULL, `stu_name` varchar(30) NOT NULL, `class_name` varchar(30) NOT NULL, `term` varchar(30) NOT NULL, `fail_nums` varchar(10) DEFAULT NULL, `avg_nums` varchar(10) DEFAULT NULL, `credit_nums` varchar(10) DEFAULT NULL, `avg_credit_nums` varchar(10) DEFAULT NULL, `avg_credit_point_nums` varchar(10) DEFAULT NULL, `term_rank` varchar(10) DEFAULT NULL, `crawl_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
true
b5716066914752810679b71507d3b6d64961b2f5
SQL
mlg-/mass-health-data
/questions.sql
UTF-8
1,067
4.0625
4
[]
no_license
-- What 3 towns have the highest population of citizens that are 65 years and older? SELECT name, seniors_pop FROM town_health_records WHERE name != 'Massachusetts Total' ORDER BY seniors_pop DESC LIMIT 3; -- What 3 towns have the highest population of citizens that are 19 years and younger? SELECT name, children_pop FROM town_health_records WHERE name != 'Massachusetts Total' ORDER BY children_pop DESC LIMIT 3; -- What 5 towns have the lowest per capita income? SELECT name, income_per_capita FROM town_health_records ORDER BY income_per_capita ASC LIMIT 5; -- Omitting Boston, Becket, and Beverly, what town has the highest percentage of teen births? SELECT name, teen_births FROM town_health_records WHERE name != 'Boston' AND name != 'Becket' AND name != 'Beverly' AND teen_births IS NOT NULL ORDER BY teen_births DESC LIMIT 1; -- Omitting Boston, what town has the highest number of infant mortalities? SELECT name, infant_mortality FROM town_health_records WHERE name != 'Boston' AND infant_mortality IS NOT NULL ORDER BY infant_mortality DESC LIMIT 1;
true
8c2027975d8203c76a351cbaf3ac0eb75d981186
SQL
fast01/chaosframework
/ChaosMDSLite/src/main/java/it/infn/chaos/mds/da/MysqlDatabaseSchemaUpdate_2.sql
UTF-8
633
2.765625
3
[ "Apache-2.0" ]
permissive
CREATE TABLE `chaosms`.`unit_server_cu_instance` ( `unit_server_alias` VARCHAR(64) NOT NULL, `cu_id` VARCHAR(64) NOT NULL, `cu_type` VARCHAR(64) NOT NULL, `cu_param` VARCHAR(256) NULL, `driver_init` MEDIUMTEXT NULL, `state` VARCHAR(64) NOT NULL, `auto_load` VARCHAR(1) NULL DEFAULT 0, PRIMARY KEY (`unit_server_alias`, `cu_id`), CONSTRAINT `fk_unit_server_cu_instance_1` FOREIGN KEY (`unit_server_alias`) REFERENCES `chaosms`.`unit_server` (`unit_server_alias`) ON DELETE CASCADE ON UPDATE RESTRICT); ALTER TABLE `chaosms`.`unit_server_cu_instance` ADD UNIQUE INDEX `cu_id_UNIQUE` (`cu_id` ASC);
true
0152825afce770e3667dac5c5b8e2b8f14d03c9a
SQL
https-github-com-peadrakw-p1/ispsafe
/ispsafe/ispsafe.sql
UTF-8
19,297
3.015625
3
[]
no_license
-- MySQL dump 10.11 -- -- Host: localhost Database: ispsafe -- ------------------------------------------------------ -- Server version 5.0.75-0ubuntu10.2 /*!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 `nas` -- DROP TABLE IF EXISTS `nas`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `nas` ( `id` int(10) NOT NULL auto_increment, `nasname` varchar(128) NOT NULL, `shortname` varchar(32) default NULL, `type` varchar(30) default 'other', `ports` int(5) default NULL, `secret` varchar(60) NOT NULL default 'secret', `community` varchar(50) default NULL, `description` varchar(200) default 'RADIUS Client', PRIMARY KEY (`id`), KEY `nasname` (`nasname`) ) ENGINE=MyISAM AUTO_INCREMENT=99 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `nas` -- LOCK TABLES `nas` WRITE; /*!40000 ALTER TABLE `nas` DISABLE KEYS */; /*!40000 ALTER TABLE `nas` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `radacct` -- DROP TABLE IF EXISTS `radacct`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `radacct` ( `RadAcctId` bigint(21) NOT NULL auto_increment, `AcctSessionId` varchar(32) NOT NULL default '', `AcctUniqueId` varchar(32) NOT NULL default '', `UserName` varchar(64) NOT NULL default '', `Realm` varchar(64) default '', `NASIPAddress` varchar(15) NOT NULL default '', `NASPortId` varchar(15) default NULL, `NASPortType` varchar(32) default NULL, `AcctStartTime` datetime NOT NULL default '0000-00-00 00:00:00', `AcctStopTime` datetime default '0000-00-00 00:00:00', `AcctSessionTime` int(12) default NULL, `AcctAuthentic` varchar(32) default NULL, `ConnectInfo_start` varchar(50) default NULL, `ConnectInfo_stop` varchar(50) default NULL, `AcctInputOctets` bigint(12) default NULL, `AcctOutputOctets` bigint(12) default NULL, `CalledStationId` varchar(50) NOT NULL default '', `CallingStationId` varchar(50) NOT NULL default '', `AcctTerminateCause` varchar(32) NOT NULL default '', `ServiceType` varchar(32) default NULL, `FramedProtocol` varchar(32) default NULL, `FramedIPAddress` varchar(15) NOT NULL default '', `AcctStartDelay` int(12) default NULL, `AcctStopDelay` int(12) default NULL, `XAscendSessionSvrKey` int(10) NOT NULL, PRIMARY KEY (`RadAcctId`), KEY `UserName` (`UserName`), KEY `FramedIPAddress` (`FramedIPAddress`), KEY `AcctSessionId` (`AcctSessionId`), KEY `AcctUniqueId` (`AcctUniqueId`), KEY `AcctStartTime` (`AcctStartTime`), KEY `AcctStopTime` (`AcctStopTime`), KEY `NASIPAddress` (`NASIPAddress`) ) ENGINE=MyISAM AUTO_INCREMENT=4199446 DEFAULT CHARSET=latin1 PACK_KEYS=0; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `radacct` -- LOCK TABLES `radacct` WRITE; /*!40000 ALTER TABLE `radacct` DISABLE KEYS */; /*!40000 ALTER TABLE `radacct` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `radcheck` -- DROP TABLE IF EXISTS `radcheck`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `radcheck` ( `id` int(11) unsigned NOT NULL auto_increment, `UserName` varchar(64) NOT NULL default '', `Attribute` varchar(32) NOT NULL default '', `op` char(2) NOT NULL default '==', `Value` varchar(253) NOT NULL default '', PRIMARY KEY (`id`), KEY `UserName` (`UserName`(32)) ) ENGINE=MyISAM AUTO_INCREMENT=6429 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `radcheck` -- LOCK TABLES `radcheck` WRITE; /*!40000 ALTER TABLE `radcheck` DISABLE KEYS */; /*!40000 ALTER TABLE `radcheck` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `radgroupcheck` -- DROP TABLE IF EXISTS `radgroupcheck`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `radgroupcheck` ( `id` int(11) unsigned NOT NULL auto_increment, `GroupName` varchar(64) NOT NULL default '', `Attribute` varchar(32) NOT NULL default '', `op` char(2) NOT NULL default '==', `Value` varchar(253) NOT NULL default '', PRIMARY KEY (`id`), KEY `GroupName` (`GroupName`(32)) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `radgroupcheck` -- LOCK TABLES `radgroupcheck` WRITE; /*!40000 ALTER TABLE `radgroupcheck` DISABLE KEYS */; /*!40000 ALTER TABLE `radgroupcheck` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `radgroupreply` -- DROP TABLE IF EXISTS `radgroupreply`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `radgroupreply` ( `id` int(11) unsigned NOT NULL auto_increment, `GroupName` varchar(64) NOT NULL default '', `Attribute` varchar(32) NOT NULL default '', `op` char(2) NOT NULL default '=', `Value` varchar(253) NOT NULL default '', PRIMARY KEY (`id`), KEY `GroupName` (`GroupName`(32)) ) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `radgroupreply` -- LOCK TABLES `radgroupreply` WRITE; /*!40000 ALTER TABLE `radgroupreply` DISABLE KEYS */; /*!40000 ALTER TABLE `radgroupreply` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `radpostauth` -- DROP TABLE IF EXISTS `radpostauth`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `radpostauth` ( `id` int(11) NOT NULL auto_increment, `username` varchar(64) NOT NULL, `pass` varchar(64) NOT NULL default '', `reply` varchar(32) NOT NULL default '', `authdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=7598454 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `radpostauth` -- LOCK TABLES `radpostauth` WRITE; /*!40000 ALTER TABLE `radpostauth` DISABLE KEYS */; /*!40000 ALTER TABLE `radpostauth` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `radreply` -- DROP TABLE IF EXISTS `radreply`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `radreply` ( `id` int(11) unsigned NOT NULL auto_increment, `UserName` varchar(64) NOT NULL default '', `Attribute` varchar(32) NOT NULL default '', `op` char(2) NOT NULL default '=', `Value` varchar(253) NOT NULL default '', PRIMARY KEY (`id`), KEY `UserName` (`UserName`(32)) ) ENGINE=MyISAM AUTO_INCREMENT=4060 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `radreply` -- LOCK TABLES `radreply` WRITE; /*!40000 ALTER TABLE `radreply` DISABLE KEYS */; /*!40000 ALTER TABLE `radreply` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_TecClientes` -- DROP TABLE IF EXISTS `tbl_TecClientes`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_TecClientes` ( `id` int(5) NOT NULL auto_increment, `usuario` varchar(30) default NULL, `senha` varchar(30) default NULL, `dominio` varchar(30) default NULL, `pop` varchar(30) default NULL, `ap` int(3) default NULL, `ip` varchar(15) default NULL, `mascara` varchar(15) default '255.255.255.255', `mac` varchar(17) default NULL, `banda` varchar(40) default '128k/256k 256k/512k 160k/192k 8/8', `status` enum('ATIVO','BLOQUEADO') default 'ATIVO', `motivoBloqueio` longtext, `wpaPsk` varchar(50) default NULL, `eqptoPwd` varchar(50) default NULL, `loginFinanceiro` varchar(50) default NULL, `emailContato` varchar(300) default NULL, `nome` varchar(100) default NULL, `endereco` varchar(100) default NULL, `numero` varchar(5) default NULL, `bairro` varchar(30) default NULL, `cidade` varchar(50) default NULL, `uf` varchar(2) default NULL, `cep` varchar(9) default NULL, `cnpj` varchar(50) default NULL, `cpf` varchar(50) default NULL, `rg` varchar(50) default NULL, `ie` varchar(50) default NULL, `telefone` varchar(20) default NULL, `celular` varchar(20) default NULL, `funcionario` varchar(20) default NULL, `dataUltMod` datetime default NULL, `observacoes` longtext, PRIMARY KEY (`id`), UNIQUE KEY `usuario` (`usuario`), UNIQUE KEY `ip` (`ip`) ) ENGINE=MyISAM AUTO_INCREMENT=1230 DEFAULT CHARSET=latin1 COMMENT='Dados Tcnicos dos Clientes'; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_TecClientes` -- LOCK TABLES `tbl_TecClientes` WRITE; /*!40000 ALTER TABLE `tbl_TecClientes` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_TecClientes` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_ap` -- DROP TABLE IF EXISTS `tbl_ap`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_ap` ( `id` int(11) NOT NULL auto_increment, `estacao` varchar(50) NOT NULL, `accesspoint` varchar(50) NOT NULL, `ip` varchar(15) NOT NULL, `snmp` varchar(50) NOT NULL, `pop` varchar(5) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=67 DEFAULT CHARSET=latin1 COMMENT='Tabela de Acess Points'; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_ap` -- LOCK TABLES `tbl_ap` WRITE; /*!40000 ALTER TABLE `tbl_ap` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_ap` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_ativacao` -- DROP TABLE IF EXISTS `tbl_ativacao`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_ativacao` ( `id` int(5) NOT NULL auto_increment, `loginFinanceiro` varchar(50) default 'NAO_INFORMADO', `emailContato` varchar(200) default NULL, `usuario` varchar(30) default NULL, `senha` varchar(30) default NULL, `banda` varchar(40) NOT NULL default '128k/256k 256k/512k 160k/192k 8/8', `nome` varchar(100) NOT NULL, `endereco` varchar(100) NOT NULL, `numero` varchar(5) default NULL, `bairro` varchar(30) default NULL, `cep` varchar(9) NOT NULL, `cnpj` varchar(25) default NULL, `cpf` varchar(15) default NULL, `rg` varchar(15) default NULL, `ie` varchar(25) default NULL, `telefone` varchar(20) NOT NULL, `celular` varchar(20) default NULL, `observacoes` blob, `mac` varchar(20) default NULL, `ap` varchar(5) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=881 DEFAULT CHARSET=latin1 COMMENT='Tabela temporria de Ativao de Clientes Wireless'; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_ativacao` -- LOCK TABLES `tbl_ativacao` WRITE; /*!40000 ALTER TABLE `tbl_ativacao` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_ativacao` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_banda` -- DROP TABLE IF EXISTS `tbl_banda`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_banda` ( `band_id` int(3) NOT NULL auto_increment, `band_plano` varchar(20) NOT NULL, `band_configuracao` varchar(50) NOT NULL, `band_observacoes` blob NOT NULL, PRIMARY KEY (`band_id`), UNIQUE KEY `band_plano` (`band_plano`) ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_banda` -- LOCK TABLES `tbl_banda` WRITE; /*!40000 ALTER TABLE `tbl_banda` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_banda` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_bloqueio` -- DROP TABLE IF EXISTS `tbl_bloqueio`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_bloqueio` ( `id` int(11) NOT NULL auto_increment, `dataBloqueio` date NOT NULL, `cliente` varchar(20) NOT NULL, `motivo` enum('ADMINISTRATIVO','FINANCEIRO','CANCELAMENTO') NOT NULL, `status` enum('AGUARDANDO','RETIRADO','AGENDADO','RETIRAR') NOT NULL default 'AGUARDANDO', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=837 DEFAULT CHARSET=latin1 COMMENT='Registro de Bloqueios de Clientes'; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_bloqueio` -- LOCK TABLES `tbl_bloqueio` WRITE; /*!40000 ALTER TABLE `tbl_bloqueio` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_bloqueio` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_derruba` -- DROP TABLE IF EXISTS `tbl_derruba`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_derruba` ( `login` varchar(50) NOT NULL, PRIMARY KEY (`login`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_derruba` -- LOCK TABLES `tbl_derruba` WRITE; /*!40000 ALTER TABLE `tbl_derruba` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_derruba` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_modificacoes` -- DROP TABLE IF EXISTS `tbl_modificacoes`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_modificacoes` ( `id` int(10) NOT NULL auto_increment, `data` datetime NOT NULL, `usuarioSistema` varchar(20) NOT NULL, `loginCliente` varchar(20) NOT NULL, `antes` longtext NOT NULL, `depois` longtext NOT NULL, `concluido` enum('S','N') NOT NULL default 'N', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=5599 DEFAULT CHARSET=latin1 COMMENT='Tabela com histórico de modificações dos Clientes'; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_modificacoes` -- LOCK TABLES `tbl_modificacoes` WRITE; /*!40000 ALTER TABLE `tbl_modificacoes` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_modificacoes` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_paginas` -- DROP TABLE IF EXISTS `tbl_paginas`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_paginas` ( `id` int(3) NOT NULL auto_increment, `pagina` varchar(50) NOT NULL, `nivel` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `pagina` (`pagina`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_paginas` -- LOCK TABLES `tbl_paginas` WRITE; /*!40000 ALTER TABLE `tbl_paginas` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_paginas` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_permissao` -- DROP TABLE IF EXISTS `tbl_permissao`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_permissao` ( `id` int(5) NOT NULL auto_increment, `usuario` int(5) NOT NULL, `pop` int(5) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=latin1 COMMENT='Tabela de Permissões de usuários para visualizarem clientes'; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_permissao` -- LOCK TABLES `tbl_permissao` WRITE; /*!40000 ALTER TABLE `tbl_permissao` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_permissao` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_pop` -- DROP TABLE IF EXISTS `tbl_pop`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_pop` ( `id` int(3) NOT NULL auto_increment, `dominio` varchar(30) NOT NULL, `pop` varchar(30) NOT NULL, `ip` varchar(15) default NULL, `snmp` varchar(25) default NULL, PRIMARY KEY (`id`), UNIQUE KEY `dominio` (`dominio`) ) ENGINE=MyISAM AUTO_INCREMENT=34 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_pop` -- LOCK TABLES `tbl_pop` WRITE; /*!40000 ALTER TABLE `tbl_pop` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_pop` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_sinal` -- DROP TABLE IF EXISTS `tbl_sinal`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_sinal` ( `id` int(10) NOT NULL auto_increment, `cliente` int(5) NOT NULL, `data` datetime NOT NULL, `sinal` int(10) NOT NULL, PRIMARY KEY (`id`), KEY `cliente` (`cliente`) ) ENGINE=MyISAM AUTO_INCREMENT=31445593 DEFAULT CHARSET=latin1 COMMENT='Tabela de monitoramento de sinal dos clientes'; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_sinal` -- LOCK TABLES `tbl_sinal` WRITE; /*!40000 ALTER TABLE `tbl_sinal` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_sinal` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tbl_usuario` -- DROP TABLE IF EXISTS `tbl_usuario`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `tbl_usuario` ( `id` int(5) NOT NULL auto_increment, `login` varchar(20) NOT NULL, `senha` varchar(25) NOT NULL, `nome` varchar(200) NOT NULL, `nivel` int(5) NOT NULL, `acesso` varchar(18) NOT NULL, `grupo` varchar(30) NOT NULL default 'read', `status` enum('ATIVO','REMOVIDO') NOT NULL default 'ATIVO', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=43 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `tbl_usuario` -- LOCK TABLES `tbl_usuario` WRITE; /*!40000 ALTER TABLE `tbl_usuario` DISABLE KEYS */; INSERT INTO `tbl_usuario` VALUES (42,'ispsafe','ispsafe','Usuario Administrativo ISP Safe',1,'0.0.0.0/0','full','ATIVO'); /*!40000 ALTER TABLE `tbl_usuario` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `usergroup` -- DROP TABLE IF EXISTS `usergroup`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `usergroup` ( `UserName` varchar(64) NOT NULL default '', `GroupName` varchar(64) NOT NULL default '', `priority` int(11) NOT NULL default '1', KEY `UserName` (`UserName`(32)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `usergroup` -- LOCK TABLES `usergroup` WRITE; /*!40000 ALTER TABLE `usergroup` DISABLE KEYS */; /*!40000 ALTER TABLE `usergroup` ENABLE KEYS */; UNLOCK TABLES; -- -- Dumping routines for database 'ispsafe' -- DELIMITER ;; DELIMITER ; /*!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 2009-11-12 10:33:21
true
506008797a0e2a59326a3585f1139cad67a91e68
SQL
hulkike/explain-plan
/database/explain-plan-04.sql
UTF-8
2,409
3.8125
4
[]
no_license
-- Relación muchos a mucho con indices -- explain plan 4 query 1 -- enlace: https://explain.depesz.com/s/M33f -- costo: 20.55 explain (analyse true, costs true, timing true, buffers true, verbose true) select p.nombre, df.cantidad, df.precio_venta, (df.cantidad * df.precio_venta) as total from public.ex4_factura f inner join public.ex4_detalle_factura df on f.numero_factura = df.numero_factura and f.anio = df.anio inner join public.ex4_producto p on df.codigo_barras = p.codigo_barras where f.numero_factura = 1000 ; -- Relación muchos a mucho con indices -- explain plan 4 query 2 -- enlace: https://explain.depesz.com/s/3e9S -- costo: 20.55 explain (analyse true, costs true, timing true, buffers true, verbose true) select p.nombre, df.cantidad, df.precio_venta, (df.cantidad * df.precio_venta) as total from public.ex4_factura f, public.ex4_detalle_factura df, public.ex4_producto p where f.numero_factura = df.numero_factura and f.anio = df.anio and df.codigo_barras = p.codigo_barras and f.numero_factura = 1000 ; -- Relación muchos a mucho con indices -- explain plan 4 query 3 -- enlace: https://explain.depesz.com/s/Gb25 -- costo: 20.51 explain (analyse true, costs true, timing true, buffers true, verbose true) select count(*) from ex4_producto; -- Relación muchos a mucho con indices -- explain plan 4 query 4 -- enlace: -- costo: 19.51 explain (analyse true, costs true, timing true, buffers true, verbose true) select count(*) from ex4_factura; -- Relación muchos a mucho con indices -- explain plan 4 query 5 -- enlace: https://explain.depesz.com/s/vbKK -- costo: 209.01 explain (analyse true, costs true, timing true, buffers true, verbose true) select count(*) from ex4_detalle_factura; -- Relación muchos a mucho con indices -- explain plan 4 query 6 -- enlace: https://explain.depesz.com/s/Jz9V -- costo: 554.22 explain (analyse true, costs true, timing true, buffers true, verbose true) select * from ex4_detalle_factura df order by df.numero_factura desc; -- Relación muchos a mucho con indices -- explain plan 4 query 7 -- enlace: https://explain.depesz.com/s/Rzw -- costo: 271.33 explain (analyse true, costs true, timing true, buffers true, verbose true) select distinct(df.numero_factura) from ex4_detalle_factura df order by df.numero_factura asc; -- Relación muchos a mucho con indices -- explain plan 7 query -- enlace: -- costo:
true
a14c373224325d4bc1d6e338c53c8643dacd106b
SQL
sachinsamson47/Portfolio
/Covid/covid_on_smokers.sql
UTF-8
9,740
4.15625
4
[]
no_license
/* Covid 19 Data Exploration - Looking at the effect of covid on smokers Skills used: Joins, CTE's, Temp Tables, Windows Functions, Aggregate Functions, Creating Views, Converting Data Types */ SELECT * FROM data WHERE continent IS NOT NULL ORDER BY 3,4 --Looking at total deaths by country SELECT Max(Cast(total_deaths AS INT)) AS deaths, location FROM data WHERE continent IS NOT NULL GROUP BY location ORDER BY 1 DESC --Checking total deaths by percentage of male smokers SELECT Max(Cast(male_smokers AS DECIMAL(10, 5))) AS smokers, location, Max(Cast(total_deaths AS INT)) AS deaths FROM data WHERE continent IS NOT NULL GROUP BY location ORDER BY 3 DESC --Checking total deaths by percentage of male smokers where more than 50% of males smoke SELECT Max(Cast(male_smokers AS DECIMAL(10, 5))) AS smokers, location, Max(Cast(total_deaths AS INT)) AS deaths FROM data WHERE continent IS NOT NULL GROUP BY location HAVING Max(Cast(male_smokers AS DECIMAL(10, 5))) > 50 ORDER BY 3 DESC --To see a more accurate representation of effects of covid on smokers we need to look at both male and female smokers --After a quick websrape from wikipedia a table of sex ratio(dbo.sexratio) is joined in SELECT * FROM sexratio SELECT Max(Cast(male_smokers AS DECIMAL(10, 5))) AS male_smoker_percent, location, Max(Cast(total_deaths AS INT)) AS deaths, Max(population) AS population, Max(Cast(female_smokers AS DECIMAL(10, 5))) AS female_smoker_percent, Max(sex_ratio) AS sexratio FROM data JOIN dbo.sexratio ON data.location = sexratio.country WHERE continent IS NOT NULL GROUP BY location HAVING Max(Cast(male_smokers AS DECIMAL(10, 5))) > 50 ORDER BY 4 DESC --Now lets try to calculate The Gender Populations SELECT Max(Cast(male_smokers AS DECIMAL(10, 5))) AS male_smoker_percent, location, Max(Cast(total_deaths AS INT)) AS deaths, Max(population) AS population, Max(Cast(female_smokers AS DECIMAL(10, 5))) AS female_smoker_percent, Max(sex_ratio) AS sexratio, Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) AS males, Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max( population) ) AS females FROM data JOIN dbo.sexratio ON data.location = sexratio.country WHERE continent IS NOT NULL GROUP BY location ORDER BY 4 DESC --Lets round everything so it looks neat SELECT Max(Cast(male_smokers AS DECIMAL(10, 2))) AS male_smoker_percent, location, Max(Cast(total_deaths AS INT)) AS deaths, Max(population) AS population, Max(Cast(female_smokers AS DECIMAL(10, 2))) AS female_smoker_percent, Max(sex_ratio) AS sexratio, Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS males, Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS females FROM data JOIN dbo.sexratio ON data.location = sexratio.country WHERE continent IS NOT NULL GROUP BY location ORDER BY 4 DESC --Calculating The number of male and female smokers SELECT Max(Cast(male_smokers AS DECIMAL(10, 2))) AS male_smoker_percent, location, Max(Cast(total_deaths AS INT)) AS deaths, Max(population) AS population, Max(Cast(female_smokers AS DECIMAL(10, 2))) AS female_smoker_percent, Max(sex_ratio) AS sexratio, Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS males, Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS females, Round((Max(Cast(male_smokers AS DECIMAL(10, 2)))*Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) AS male_smokers, Round((Max(Cast(female_smokers AS DECIMAL(10, 2)))*Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) AS female_smokers FROM data JOIN dbo.sexratio ON data.location = sexratio.country WHERE continent IS NOT NULL GROUP BY location ORDER BY 4 DESC --Calcualting percentage of smokers by country SELECT Max(Cast(male_smokers AS DECIMAL(10, 2))) AS male_smoker_percent, location, Max(Cast(total_deaths AS INT)) AS deaths, Max(population) AS population, Max(Cast(female_smokers AS DECIMAL(10, 2))) AS female_smoker_percent, Max(sex_ratio) AS sexratio, Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS males, Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS females, Round((Max(Cast(male_smokers AS DECIMAL(10, 2)))*Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) AS male_smokers, Round((Max(Cast(female_smokers AS DECIMAL(10, 2)))*Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) AS female_smokers, Round(((Round((Max(Cast(male_smokers AS DECIMAL(10, 2)))*Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) + Round((Max(Cast(female_smokers AS DECIMAL(10, 2)))*Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0))/(Max(population)))*100,2) AS Percentage_of_smokers FROM data JOIN dbo.sexratio ON data.location = sexratio.country WHERE continent IS NOT NULL GROUP BY location ORDER BY 4 DESC --Lets add death percentage to the table SELECT Max(Cast(male_smokers AS DECIMAL(10, 2))) AS male_smoker_percent, location, Max(Cast(total_deaths AS INT)) AS deaths, Max(population) AS population, Max(Cast(female_smokers AS DECIMAL(10, 2))) AS female_smoker_percent, Max(sex_ratio) AS sexratio, Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS males, Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS females, Round((Max(Cast(male_smokers AS DECIMAL(10, 2)))*Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) AS male_smokers, Round((Max(Cast(female_smokers AS DECIMAL(10, 2)))*Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) AS female_smokers, Round(((Round((Max(Cast(male_smokers AS DECIMAL(10, 2)))*Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) + Round((Max(Cast(female_smokers AS DECIMAL(10, 2)))*Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0))/(Max(population)))*100,2) AS Percentage_of_smokers, Round(((Max(Cast(total_deaths AS INT)))/Max(population))*100,4) AS Death_percentage FROM data JOIN dbo.sexratio ON data.location = sexratio.country WHERE continent IS NOT NULL GROUP BY location ORDER BY 11 DESC,12 DESC --Saving the table as a view CREATE VIEW smoker_stats AS SELECT Max(Cast(male_smokers AS DECIMAL(10, 2))) AS male_smoker_percent, location, Max(Cast(total_deaths AS INT)) AS deaths, Max(population) AS population, Max(Cast(female_smokers AS DECIMAL(10, 2))) AS female_smoker_percent, Max(sex_ratio) AS sexratio, Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS males, Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0) AS females, Round((Max(Cast(male_smokers AS DECIMAL(10, 2)))*Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) AS male_smokers, Round((Max(Cast(female_smokers AS DECIMAL(10, 2)))*Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) AS female_smokers, Round(((Round((Max(Cast(male_smokers AS DECIMAL(10, 2)))*Round(( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0) + Round((Max(Cast(female_smokers AS DECIMAL(10, 2)))*Round(Max(population) - ( Max(sex_ratio) / ( Max(sex_ratio) + 1 ) * Max(population) ), 0))/100,0))/(Max(population)))*100,2) AS Percentage_of_smokers, Round(((Max(Cast(total_deaths AS INT)))/Max(population))*100,4) AS Death_percentage FROM data JOIN dbo.sexratio ON data.location = sexratio.country WHERE continent IS NOT NULL GROUP BY location --ORDER BY 11 DESC,12 DESC select * from smoker_stats
true
7ecb1aba1bda09d161eed12c5f83a0cf82f372c9
SQL
CDFriend/vexdb_miner
/schema/matches.sql
UTF-8
1,141
3.640625
4
[]
no_license
-- Matches -- ~~~~~~~~~ -- -- Data on all matches in the current VRC season. CREATE TABLE data_matches ( event_sku STRING NOT NULL, -- SKU for the event the match happened during red1 STRING NOT NULL, -- First red player in the match red2 STRING NOT NULL, -- Second red player in the match red3 STRING, -- Third red player in the match (apparently that happens sometimes) red_sit STRING, -- Red player sitting out, if an alliance match blue1 STRING NOT NULL, -- First blue player in the match blue2 STRING NOT NULL, -- Second blue player in the match blue3 STRING, -- Third blue player in the match, if applicable blue_sit STRING, -- Blue player sitting out if an alliance match red_score INTEGER NOT NULL, -- Final score for red blue_score INTEGER NOT NULL, -- Final score for blue date_time STRING NOT NULL -- Scheduled date/time for the match (ISO 8601) ); CREATE INDEX ind_eventsmatches ON data_matches(event_sku);
true
9deb0fe9a0c23d3dd73c1ddf40ef15e802cdcb96
SQL
kawakita666/BroMoney
/gg/bf2game_mafia.sql
UTF-8
33,979
3.125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 2.6.4-pl2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Dec 10, 2005 at 06:03 PM -- Server version: 4.0.25 -- PHP Version: 4.3.11 -- -- Database: `bf2game_mafia` -- -- -------------------------------------------------------- -- -- Table structure for table `airport` -- CREATE TABLE `airport` ( `id` int(11) NOT NULL auto_increment, `owner` varchar(40) NOT NULL default '', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `travel_prices` varchar(100) NOT NULL default '100-100-100-100-100-100', `profit` varchar(100) NOT NULL default '0-0-0-0-0-0', PRIMARY KEY (`id`), KEY `id` (`id`) ) TYPE=MyISAM AUTO_INCREMENT=7 ; -- -- Dumping data for table `airport` -- INSERT INTO `airport` VALUES (1, 'Tiffer', 'England', '100-167-175-100-143-146', '0-2839-7700-1900-858-1022'); INSERT INTO `airport` VALUES (2, 'Tiffer', 'Japan', '100-100-100-100-100-100', '2300-0-300-100-0-300'); INSERT INTO `airport` VALUES (3, 'Tiffer', 'France', '1000-1000-1000-1000-1000-1000', '45800-3000-0-400-2200-2200'); INSERT INTO `airport` VALUES (4, 'Tiffer', 'Usa', '100-100-100-100-100-95', '3300-300-100-0-100-570'); INSERT INTO `airport` VALUES (5, 'Tiffer', 'China', '1000-1000-1000-1000-1000-1000', '3500-1300-1250-1100-0-1300'); INSERT INTO `airport` VALUES (6, 'Tiffer', 'Canada', '1000-1000-1000-1000-1000-1000', '9100-100-4000-2300-3300-0'); -- -------------------------------------------------------- -- -- Table structure for table `attempts` -- CREATE TABLE `attempts` ( `id` int(11) NOT NULL auto_increment, `username` char(40) NOT NULL default '', `target` char(40) NOT NULL default '', `outcome` enum('Dead','Survived') NOT NULL default 'Dead', `date` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=19 ; -- -- Dumping data for table `attempts` -- -- -------------------------------------------------------- -- -- Table structure for table `auctions` -- CREATE TABLE `auctions` ( `id` int(11) NOT NULL auto_increment, `username` varchar(40) NOT NULL default '', `min_starting` int(11) NOT NULL default '0', `current_bid` int(11) NOT NULL default '0', `winning` varchar(40) NOT NULL default '', `winning_bid` int(11) NOT NULL default '0', `item_type` varchar(100) NOT NULL default '', `time` varchar(100) NOT NULL default '', `item_id` varchar(100) NOT NULL default '', `an` enum('0','1') NOT NULL default '0', `pvt` enum('0','1') NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=7 ; -- -- Dumping data for table `auctions` -- -- -------------------------------------------------------- -- -- Table structure for table `ban` -- CREATE TABLE `ban` ( `id` int(11) NOT NULL auto_increment, `username` varchar(40) NOT NULL default '', `by` varchar(40) NOT NULL default '', `type` enum('0','1') NOT NULL default '0', `reason` text NOT NULL, `length` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=17 ; -- -- Dumping data for table `ban` -- -- -------------------------------------------------------- -- -- Table structure for table `bank` -- CREATE TABLE `bank` ( `id` int(11) NOT NULL auto_increment, `owner` char(40) NOT NULL default '', `send_intrest` int(11) NOT NULL default '0', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `profit` int(100) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `bank` -- -- -------------------------------------------------------- -- -- Table structure for table `bar` -- CREATE TABLE `bar` ( `id` int(11) NOT NULL auto_increment, `owner` char(40) NOT NULL default '', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `profit` int(50) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=7 ; -- -- Dumping data for table `bar` -- INSERT INTO `bar` VALUES (1, 'Tiffer', 'England', 0); INSERT INTO `bar` VALUES (2, 'Tiffer', 'Japan', 0); INSERT INTO `bar` VALUES (3, 'Tiffer', 'France', 0); INSERT INTO `bar` VALUES (4, 'Tiffer', 'Usa', 0); INSERT INTO `bar` VALUES (5, 'Tiffer', 'China', 0); INSERT INTO `bar` VALUES (6, 'Tiffer', 'Canada', 0); -- -------------------------------------------------------- -- -- Table structure for table `bf` -- CREATE TABLE `bf` ( `id` int(11) NOT NULL auto_increment, `owner` varchar(40) NOT NULL default '', `stock` int(100) NOT NULL default '0', `producing` enum('Yes','No') NOT NULL default 'Yes', `price` int(100) NOT NULL default '100', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `profit` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=7 ; -- -- Dumping data for table `bf` -- INSERT INTO `bf` VALUES (1, 'Tiffer', 1000, 'Yes', 4500, 'England', '0'); INSERT INTO `bf` VALUES (2, 'Tiffer', 13999, 'Yes', 4500, 'Japan', '0'); INSERT INTO `bf` VALUES (3, 'Tiffer', 7000, 'Yes', 101, 'France', '202000'); INSERT INTO `bf` VALUES (4, 'Tiffer', 7000, 'Yes', 101, 'Usa', '4040'); INSERT INTO `bf` VALUES (5, 'Tiffer', 7000, 'Yes', 200, 'China', '0'); INSERT INTO `bf` VALUES (6, 'Tiffer', 7000, 'Yes', 1000, 'Canada', '1000'); -- -------------------------------------------------------- -- -- Table structure for table `bidders` -- CREATE TABLE `bidders` ( `id` int(11) NOT NULL auto_increment, `bidder` char(40) NOT NULL default '', `amount` int(11) NOT NULL default '0', `auction_id` int(11) NOT NULL default '0', `time` datetime NOT NULL default '0000-00-00 00:00:00', `an` enum('0','1') NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=3 ; -- -- Dumping data for table `bidders` -- -- -------------------------------------------------------- -- -- Table structure for table `car_sell` -- CREATE TABLE `car_sell` ( `id` int(11) NOT NULL auto_increment, `owner` char(40) NOT NULL default '', `car_id` int(50) NOT NULL default '0', `price` int(50) NOT NULL default '0', `date` datetime NOT NULL default '0000-00-00 00:00:00', `car_type` char(40) NOT NULL default '', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=2 ; -- -- Dumping data for table `car_sell` -- -- -------------------------------------------------------- -- -- Table structure for table `casino` -- CREATE TABLE `casino` ( `id` int(11) NOT NULL auto_increment, `casino` varchar(100) NOT NULL default '', `owner` varchar(100) NOT NULL default '', `maxbet` varchar(100) NOT NULL default '0', `minoffer` varchar(100) NOT NULL default '0', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `earnings` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=29 ; -- -- Dumping data for table `casino` -- INSERT INTO `casino` VALUES (8, 'Roulette', 'Tiffer', '0', '0', 'England', ''); INSERT INTO `casino` VALUES (9, 'Roulette', 'Tiffer', '0', '0', 'Japan', ''); INSERT INTO `casino` VALUES (16, 'Roulette', 'Tiffer', '0', '0', 'France', ''); INSERT INTO `casino` VALUES (20, 'Roulette', 'Tiffer', '0', '0', 'Usa', ''); INSERT INTO `casino` VALUES (21, 'Roulette', 'Tiffer', '0', '0', 'China', ''); INSERT INTO `casino` VALUES (28, 'Roulette', 'Tiffer', '0', '0', 'Canada', ''); -- -------------------------------------------------------- -- -- Table structure for table `casinos` -- CREATE TABLE `casinos` ( `id` int(11) NOT NULL auto_increment, `owner` varchar(40) NOT NULL default '', `casino` enum('Slots','Roulette','RPS','Race') NOT NULL default 'Slots', `profit` varchar(100) NOT NULL default '', `max` int(11) NOT NULL default '0', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=19 ; -- -- Dumping data for table `casinos` -- INSERT INTO `casinos` VALUES (1, 'tiffer', 'Slots', '-349999001', 50000000, 'England'); INSERT INTO `casinos` VALUES (2, 'Tiffer', 'Slots', '79999724', 999999, 'Japan'); INSERT INTO `casinos` VALUES (3, 'Tiffer', 'Slots', '214', 10, 'France'); INSERT INTO `casinos` VALUES (4, 'Tiffer', 'Slots', '8609', 10000, 'Usa'); INSERT INTO `casinos` VALUES (5, 'Tiffer', 'Slots', '103', 60000, 'China'); INSERT INTO `casinos` VALUES (6, 'Tiffer', 'Slots', '2885', 100, 'Canada'); INSERT INTO `casinos` VALUES (8, 'Tiffer', 'RPS', '1700', 100, 'Japan'); INSERT INTO `casinos` VALUES (7, 'Tiffer', 'RPS', '477043865', 30000000, 'England'); INSERT INTO `casinos` VALUES (9, 'Tiffer', 'RPS', '1', 1, 'Usa'); INSERT INTO `casinos` VALUES (10, 'Tiffer', 'RPS', '1844', 100, 'France'); INSERT INTO `casinos` VALUES (11, 'Tiffer', 'RPS', '400001', 60000, 'China'); INSERT INTO `casinos` VALUES (12, 'Tiffer', 'RPS', '112035', 100000, 'Canada'); INSERT INTO `casinos` VALUES (13, 'Tiffer', 'Race', '28427971', 50000, 'England'); INSERT INTO `casinos` VALUES (14, 'Tiffer', 'Race', '401', 100, 'Japan'); INSERT INTO `casinos` VALUES (15, 'Tiffer', 'Race', '827', 100, 'France'); INSERT INTO `casinos` VALUES (16, 'Tiffer', 'Race', '1395', 100, 'Usa'); INSERT INTO `casinos` VALUES (17, 'Tiffer', 'Race', '1747', 60000, 'China'); INSERT INTO `casinos` VALUES (18, 'Tiffer', 'Race', '572', 100, 'Canada'); -- -------------------------------------------------------- -- -- Table structure for table `chat` -- CREATE TABLE `chat` ( `id` int(32) NOT NULL auto_increment, `user` varchar(100) NOT NULL default '', `chat` varchar(100) NOT NULL default '', `timeh` varchar(20) NOT NULL default '', `timem` varchar(20) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `chat` -- -- -------------------------------------------------------- -- -- Table structure for table `crews` -- CREATE TABLE `crews` ( `id` int(11) NOT NULL auto_increment, `owner` varchar(40) NOT NULL default '', `size` int(11) NOT NULL default '0', `name` varchar(60) NOT NULL default '', `quote` text NOT NULL, `music` tinytext NOT NULL, `picture` tinytext NOT NULL, `recruiting` enum('1','2') NOT NULL default '1', `rhm` varchar(40) NOT NULL default '0', `bank` int(50) NOT NULL default '0', `income` varchar(100) NOT NULL default '0-0-0', `payout` varchar(100) NOT NULL default '', `bullets` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=7 ; -- -- Dumping data for table `crews` -- -- -------------------------------------------------------- -- -- Table structure for table `dealership` -- CREATE TABLE `dealership` ( `id` int(11) NOT NULL auto_increment, `owner` char(40) NOT NULL default '', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `profit` int(50) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `dealership` -- -- -------------------------------------------------------- -- -- Table structure for table `donaters` -- CREATE TABLE `donaters` ( `donater_id` int(11) NOT NULL auto_increment, `username` varchar(40) NOT NULL default '', `donater_pass` varchar(40) NOT NULL default '', `amount` int(50) NOT NULL default '0', `package` enum('None','1','2','3','4') NOT NULL default 'None', `on` varchar(100) NOT NULL default '', PRIMARY KEY (`donater_id`) ) TYPE=MyISAM AUTO_INCREMENT=3 ; -- -- Dumping data for table `donaters` -- -- -------------------------------------------------------- -- -- Table structure for table `friends` -- CREATE TABLE `friends` ( `id` int(11) NOT NULL auto_increment, `username` char(40) NOT NULL default '', `person` char(40) NOT NULL default '', `type` enum('Friend','Blocked') NOT NULL default 'Friend', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=9 ; -- -- Dumping data for table `friends` -- -- -------------------------------------------------------- -- -- Table structure for table `garage` -- CREATE TABLE `garage` ( `id` int(11) NOT NULL auto_increment, `owner` varchar(40) NOT NULL default '', `car` varchar(100) NOT NULL default '', `damage` varchar(100) NOT NULL default '', `origion` varchar(100) NOT NULL default '', `location` varchar(100) NOT NULL default '', `upgrades` varchar(100) NOT NULL default '0-0-0-0-0-0-0-0', `status` enum('0','1','2','3','4') NOT NULL default '0', `worth` int(32) NOT NULL default '0', `shiptime` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=343 ; -- -- Dumping data for table `garage` -- -- -------------------------------------------------------- -- -- Table structure for table `get_away` -- CREATE TABLE `get_away` ( `id` int(11) NOT NULL auto_increment, `leader` char(40) NOT NULL default '', `person` char(40) NOT NULL default '', `weapon` enum('None','Sig Sauer P229','Jackhammer automatic shotgun','Heckler und Koch MP-5k','Browning M2HB') NOT NULL default 'None', `car` int(50) NOT NULL default '0', `share` enum('1','2') NOT NULL default '1', `person_ready` char(40) NOT NULL default '', `invite_get` char(40) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=13 ; -- -- Dumping data for table `get_away` -- -- -------------------------------------------------------- -- -- Table structure for table `hitlist` -- CREATE TABLE `hitlist` ( `id` int(32) NOT NULL auto_increment, `paid` varchar(32) NOT NULL default '', `target` varchar(32) NOT NULL default '', `reason` varchar(120) NOT NULL default '', `amount` int(32) NOT NULL default '0', `anonymous` enum('1','2') NOT NULL default '1', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=10 ; -- -- Dumping data for table `hitlist` -- -- -------------------------------------------------------- -- -- Table structure for table `inbox` -- CREATE TABLE `inbox` ( `id` int(11) NOT NULL auto_increment, `to` varchar(40) NOT NULL default '', `from` varchar(40) NOT NULL default '', `message` text NOT NULL, `date` datetime NOT NULL default '0000-00-00 00:00:00', `read` enum('0','1') NOT NULL default '0', `saved` int(2) NOT NULL default '0', `event_id` int(11) NOT NULL default '0', `witness` enum('0','1') NOT NULL default '0', `witness_per` varchar(40) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=230 ; -- -- Dumping data for table `inbox` -- -- -------------------------------------------------------- -- -- Table structure for table `items` -- CREATE TABLE `items` ( `id` int(11) NOT NULL auto_increment, `item` varchar(100) NOT NULL default '', `value` int(11) NOT NULL default '0', `owner` varchar(40) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=191 ; -- -- Dumping data for table `items` -- -- -------------------------------------------------------- -- -- Table structure for table `jail` -- CREATE TABLE `jail` ( `id` int(11) NOT NULL auto_increment, `username` varchar(40) NOT NULL default '', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `time_left` varchar(100) NOT NULL default '', `reason` varchar(100) NOT NULL default '', `bust_able` enum('0','1') NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1300 ; -- -- Dumping data for table `jail` -- -- -------------------------------------------------------- -- -- Table structure for table `lotto` -- CREATE TABLE `lotto` ( `id` int(11) NOT NULL auto_increment, `owner` char(40) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `lotto` -- -- -------------------------------------------------------- -- -- Table structure for table `lotto_info` -- CREATE TABLE `lotto_info` ( `id` int(11) NOT NULL auto_increment, `price` int(11) NOT NULL default '0', `time_to` int(100) NOT NULL default '0', `jackpot` int(100) NOT NULL default '0', `lotto_num` int(50) NOT NULL default '0', `winning_ticket` int(50) NOT NULL default '0', `winner` char(40) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `lotto_info` -- -- -------------------------------------------------------- -- -- Table structure for table `married` -- CREATE TABLE `married` ( `id` int(32) NOT NULL auto_increment, `starter` varchar(100) NOT NULL default '', `other` varchar(100) NOT NULL default '', `done` enum('0','1') NOT NULL default '0', `ring` varchar(40) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `married` -- -- -------------------------------------------------------- -- -- Table structure for table `matches` -- CREATE TABLE `matches` ( `id` int(11) NOT NULL auto_increment, `username` char(40) NOT NULL default '', `bet` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=47 ; -- -- Dumping data for table `matches` -- -- -------------------------------------------------------- -- -- Table structure for table `oc` -- CREATE TABLE `oc` ( `id` int(11) NOT NULL auto_increment, `leader` varchar(40) NOT NULL default '', `we` varchar(40) NOT NULL default '', `ee` varchar(40) NOT NULL default '', `driver` varchar(40) NOT NULL default '', `weapons` varchar(100) NOT NULL default '0-0-0-0-0', `explosives` varchar(100) NOT NULL default '0-0-0-0-0', `car` int(11) NOT NULL default '0', `we_inv` varchar(40) NOT NULL default '0', `ee_inv` varchar(40) NOT NULL default '0', `driver_inv` varchar(40) NOT NULL default '0', `share` enum('1','2') NOT NULL default '1', `we_ready` varchar(10) NOT NULL default '', `ee_ready` varchar(10) NOT NULL default '', `driver_ready` varchar(10) NOT NULL default '', `location` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=6 ; -- -- Dumping data for table `oc` -- -- -------------------------------------------------------- -- -- Table structure for table `paper` -- CREATE TABLE `paper` ( `id` int(11) NOT NULL auto_increment, `edition` int(11) NOT NULL default '0', `news` text NOT NULL, `title` varchar(100) NOT NULL default '', `by` varchar(40) NOT NULL default '', `date` datetime NOT NULL default '0000-00-00 00:00:00', `align` enum('Left','Right') NOT NULL default 'Left', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `paper` -- -- -------------------------------------------------------- -- -- Table structure for table `polls` -- CREATE TABLE `polls` ( `id` int(11) NOT NULL auto_increment, `title` text NOT NULL, `op1` varchar(40) NOT NULL default '', `op2` varchar(40) NOT NULL default '', `op3` varchar(40) NOT NULL default '', `op4` varchar(40) NOT NULL default '', `op5` varchar(40) NOT NULL default '', `v1` int(6) NOT NULL default '0', `v2` int(6) NOT NULL default '0', `v3` int(6) NOT NULL default '0', `v4` int(6) NOT NULL default '0', `v5` int(6) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `polls` -- -- -------------------------------------------------------- -- -- Table structure for table `replys` -- CREATE TABLE `replys` ( `id` int(11) NOT NULL auto_increment, `username` varchar(100) NOT NULL default '', `text` text NOT NULL, `forum` enum('main','crew') NOT NULL default 'main', `idto` varchar(100) NOT NULL default '', `made` datetime NOT NULL default '0000-00-00 00:00:00', `crew` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `replys` -- -- -------------------------------------------------------- -- -- Table structure for table `rest` -- CREATE TABLE `rest` ( `id` int(11) NOT NULL auto_increment, `owner` varchar(40) NOT NULL default '', `prices` varchar(100) NOT NULL default '0-0-0-0-0-0-0-0-0', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `profit` int(50) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `rest` -- -- -------------------------------------------------------- -- -- Table structure for table `safe` -- CREATE TABLE `safe` ( `id` int(11) NOT NULL auto_increment, `username` varchar(40) NOT NULL default '', `time` varchar(100) NOT NULL default '', `location` varchar(40) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=2 ; -- -- Dumping data for table `safe` -- -- -------------------------------------------------------- -- -- Table structure for table `search` -- CREATE TABLE `search` ( `id` int(11) NOT NULL auto_increment, `username` varchar(40) NOT NULL default '', `target` varchar(40) NOT NULL default '', `time` varchar(100) NOT NULL default '', `status` enum('0','1','2') NOT NULL default '0', `location` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=126 ; -- -- Dumping data for table `search` -- -- -------------------------------------------------------- -- -- Table structure for table `shop` -- CREATE TABLE `shop` ( `id` int(11) NOT NULL auto_increment, `owner` char(40) NOT NULL default '', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `profit` int(40) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=7 ; -- -- Dumping data for table `shop` -- -- -------------------------------------------------------- -- -- Table structure for table `site_stats` -- CREATE TABLE `site_stats` ( `id` int(11) NOT NULL auto_increment, `online` int(11) NOT NULL default '0', `CS` enum('0','1') NOT NULL default '0', `bullets` varchar(100) NOT NULL default '', `terr` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `site_stats` -- -- -------------------------------------------------------- -- -- Table structure for table `street` -- CREATE TABLE `street` ( `id` int(11) NOT NULL auto_increment, `leader` varchar(40) NOT NULL default '', `leader_car` varchar(40) NOT NULL default '', `prize` enum('Car','Money') NOT NULL default 'Car', `prize_win` int(11) NOT NULL default '0', `op_car` int(11) NOT NULL default '0', `op_ready` varchar(10) NOT NULL default '', `op_username` varchar(40) NOT NULL default '', `op_invite` varchar(40) NOT NULL default '', `location` varchar(40) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=29 ; -- -- Dumping data for table `street` -- -- -------------------------------------------------------- -- -- Table structure for table `swiss` -- CREATE TABLE `swiss` ( `id` int(32) NOT NULL auto_increment, `account` int(32) NOT NULL default '0', `pin` int(32) NOT NULL default '0', `money` int(32) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=28 ; -- -- Dumping data for table `swiss` -- -- -------------------------------------------------------- -- -- Table structure for table `ticket` -- CREATE TABLE `ticket` ( `id` int(32) NOT NULL auto_increment, `title` varchar(100) NOT NULL default '', `description` varchar(250) NOT NULL default '', `answer` varchar(250) NOT NULL default '', `open` int(32) NOT NULL default '0', `started` varchar(100) NOT NULL default '', `bug` enum('0','1') NOT NULL default '0', `on` datetime NOT NULL default '0000-00-00 00:00:00', `answered_by` varchar(40) NOT NULL default '0', `status` enum('Pending','Fixed') NOT NULL default 'Pending', `cat` enum('Crimes','Casinos','Money','Street Races','OC','Getaway','Other') NOT NULL default 'Crimes', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=67 ; -- -- Dumping data for table `ticket` -- -- -------------------------------------------------------- -- -- Table structure for table `topics` -- CREATE TABLE `topics` ( `id` int(11) NOT NULL auto_increment, `username` varchar(100) NOT NULL default '', `title` varchar(100) NOT NULL default '', `topictext` text NOT NULL, `forum` enum('main','crew') NOT NULL default 'main', `locked` enum('0','1') NOT NULL default '0', `sticky` enum('0','1') NOT NULL default '0', `lastreply` varchar(100) NOT NULL default '', `made` datetime NOT NULL default '0000-00-00 00:00:00', `crew` varchar(100) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=16 ; -- -- Dumping data for table `topics` -- -- -------------------------------------------------------- -- -- Table structure for table `transfers` -- CREATE TABLE `transfers` ( `id` int(11) NOT NULL auto_increment, `to` char(40) NOT NULL default '', `from` char(40) NOT NULL default '', `amount` int(100) NOT NULL default '0', `date` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=151 ; -- -- Dumping data for table `transfers` -- -- -------------------------------------------------------- -- -- Table structure for table `turf` -- CREATE TABLE `turf` ( `id` int(11) NOT NULL auto_increment, `location` char(40) NOT NULL default '', `owner` char(60) NOT NULL default '', `profit` int(11) NOT NULL default '0', `damage` int(3) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -- -- Dumping data for table `turf` -- -- -------------------------------------------------------- -- -- Table structure for table `updates` -- CREATE TABLE `updates` ( `id` int(32) NOT NULL auto_increment, `username` varchar(100) NOT NULL default '', `update` text NOT NULL, `time` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=2 ; -- -- Dumping data for table `updates` -- INSERT INTO `updates` VALUES (1, 'Tiffer', 'This Site Has Not Yet Been Finishes U Can Play Around With It As You Like But when time comes there will be a reset', '2005-07-14 04:21:09'); -- -------------------------------------------------------- -- -- Table structure for table `user_info` -- CREATE TABLE `user_info` ( `id` int(11) NOT NULL auto_increment, `username` varchar(40) NOT NULL default '', `crimes` int(100) NOT NULL default '0', `gtas` int(100) NOT NULL default '0', `busts` int(100) NOT NULL default '0', `get_aways` int(11) NOT NULL default '0', `food_crimes` int(40) NOT NULL default '0', `ocs` int(11) NOT NULL default '0', `kill_skill` int(11) NOT NULL default '0', `wl` varchar(40) NOT NULL default '0:0', `exp` int(3) NOT NULL default '0', `level` int(11) NOT NULL default '0', `last_train` varchar(100) NOT NULL default '', `jewl` varchar(40) NOT NULL default '', `foot` varchar(40) NOT NULL default '', `jail_able` enum('0','1') NOT NULL default '0', `last_bribe` varchar(100) NOT NULL default '', `jail_untill` varchar(100) NOT NULL default '', `lang` enum('English','Dutch') NOT NULL default 'English', `respect` int(11) NOT NULL default '0', `respect_rec` varchar(11) NOT NULL default '0', `last_respect` varchar(100) NOT NULL default '', `mem_gym` enum('0','1') NOT NULL default '0', `dealing` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=333 ; -- -- Dumping data for table `user_info` -- INSERT INTO `user_info` VALUES (1, 'Tiffer', 4, 4, 0, 0, 0, 0, 0, '0:0', 0, 0, '', '', '', '0', '', '', 'English', 0, '0', '1134828645', '0', 0); INSERT INTO `user_info` VALUES (0, 'admin', 0, 0, 0, 0, 0, 0, 0, '0:0', 0, 0, '', '', '', '0', '', '', 'English', 0, '0', '', '0', 0); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `username` varchar(40) NOT NULL default '', `password` varchar(60) NOT NULL default '', `activated` enum('0','1') NOT NULL default '1', `money` varchar(100) NOT NULL default '500', `online` varchar(100) NOT NULL default '', `crimechance` varchar(100) NOT NULL default '0-0-0-0-0-0-0', `lastcrime` varchar(100) NOT NULL default '', `rankpoints` varchar(100) NOT NULL default '0', `userlevel` enum('0','1','2') NOT NULL default '0', `lasttop` varchar(100) NOT NULL default '', `status` enum('Alive','Dead','Banned') NOT NULL default 'Alive', `regged` datetime NOT NULL default '0000-00-00 00:00:00', `rank` enum('Scum','Wannabe','Goon','Hired Thug','Criminal','Hitman','Wanted Criminal','Hired Gunner','Assassin','Boss','Don','Enemy of the State','Global Dominator','Legend','Legendary Legend') NOT NULL default 'Scum', `layout` varchar(100) NOT NULL default '17', `email` varchar(100) NOT NULL default '', `quote` text NOT NULL, `image` varchar(100) NOT NULL default 'images/default.jpg', `location` enum('England','Japan','France','Usa','China','Canada') NOT NULL default 'England', `bullets` int(11) NOT NULL default '0', `gtachance` varchar(100) NOT NULL default '0-0-0', `lastgta` varchar(100) NOT NULL default '', `lasttravel` varchar(100) NOT NULL default '', `bank` int(40) NOT NULL default '0', `banktime` varchar(100) NOT NULL default '', `last_race` varchar(100) NOT NULL default '', `street` enum('0','1') NOT NULL default '0', `music` mediumtext NOT NULL, `crew` varchar(60) NOT NULL default '0', `get_away_time` varchar(100) NOT NULL default '', `get_away` enum('0','1') NOT NULL default '0', `health` int(3) NOT NULL default '100', `energy` int(3) NOT NULL default '2147483647', `last_ext` varchar(100) NOT NULL default '', `lasttran` varchar(100) NOT NULL default '', `drugprices` varchar(100) NOT NULL default '100-100-100-100-100', `drugs` varchar(100) NOT NULL default '0-0-0-0-0', `l_ip` varchar(15) NOT NULL default '127.0.0.1', `r_ip` varchar(15) NOT NULL default '', `crew_invite` int(11) NOT NULL default '0', `referral` int(11) NOT NULL default '0', `weapon` enum('None','Sig Sauer P229','Jackhammer automatic shotgun','Heckler und Koch MP-5k','FN SCAR','Browning M2HB') NOT NULL default 'None', `mission` int(11) NOT NULL default '1', `points` int(11) NOT NULL default '0', `lpv` varchar(32) NOT NULL default '', `page` varchar(10) NOT NULL default '', `editor` enum('0','1') NOT NULL default '0', `helper` enum('0','1') NOT NULL default '0', `food_chance` varchar(100) NOT NULL default '0-0-0', `last_food` varchar(100) NOT NULL default '', `last_order` varchar(100) NOT NULL default '', `freinds` varchar(40) NOT NULL default 'None', `protection` enum('None','Doberman','Body Guard','Armoured Car','House','Safehouse') NOT NULL default 'None', `plane` enum('None','Fokker','Boeing 777','LV-AZF','PR-GOC','F-HSUN') NOT NULL default 'None', `married` varchar(100) NOT NULL default '0', `oc` enum('0','1') NOT NULL default '0', `last_oc` varchar(100) NOT NULL default '', `atm` enum('False','True') NOT NULL default 'False', `last_bank` varchar(100) NOT NULL default '', `last_attempted` varchar(100) NOT NULL default '', `last_kill` varchar(100) NOT NULL default '', `ver_code` varchar(20) NOT NULL default '456', `last_script_check` varchar(100) NOT NULL default '', `global` enum('0','1') NOT NULL default '0', `poll` varchar(100) NOT NULL default '', `clicks` int(11) NOT NULL default '0', `click_rate` varchar(100) NOT NULL default '', `tut` enum('0','1') NOT NULL default '0', `drugs_from` varchar(40) NOT NULL default '', `total_drugs_mission` int(11) NOT NULL default '0', `city` enum('Cambridgeshire','Hull','Leeds','Leicester','Liverpool','London','Chiba','Fujiyoshida','Kawasaki','Sapporo','Yokohama','Nagoya','New York','Arizona','Texas','Utah','Vermont','Washington DC','Alberton','Benoni','Cape Town','Carltonville','East London','Johannesburg','Acapulco','Aguascalientes','Lake Chapala','San Carlos','Monterrey','Tuxtla') NOT NULL default 'Cambridgeshire', `notes` text NOT NULL, `last_chase` varchar(100) NOT NULL default '', `choice` varchar(40) NOT NULL default '0', `bar` enum('1','2') NOT NULL default '1', `backfire` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=234 ; -- -- Dumping data for table `users` -- INSERT INTO `users` VALUES (1, 'Tiffer', '62885267', '1', '1E+15', '1134238201', '99-99-99-99-99-99', '1134233939', '10000049', '2', '1134233952', 'Alive', '2005-12-10 02:09:22', 'Legendary Legend', '0', 'c-pullen@hotmail.co.uk', 'No quote', 'images/default.jpg', 'England', 100000999, '41-40-40', '1134234069', '1134233206', 0, '0', '', '0', '', 'Staff Members', '', '0', 9999999, 2147483647, '', '', '90-298-165-29-3307', '0-0-0-0-0', '62.255.32.14', '62.255.32.14', 0, 0, 'FN SCAR', 3, 2147483647, '1134227422', 'chat', '1', '1', '85-85-85', '', '1134280875', 'None', 'Safehouse', 'F-HSUN', '', '1', '', 'True', '', '', '', '456', '', '1', '', 0, '1134227510', '0', '', 0, 'Cambridgeshire', '', '', '0', '2', 2147483647); INSERT INTO `users` VALUES (0, 'admin', '14646636565965', '1', '999999999999999', '', '99-99-99-99-99-99-99', '', '999999', '2', '', 'Alive', '2005-12-10 02:15:39', 'Legendary Legend', '0', 'c-pullen@hotmail.co.uk', 'ADMIN', 'images/default.jpg', 'England', 2147483647, '99-99-99', '', '', 0, '', '', '1', '', '0', '', '1', 2147483647, 2147483647, '', '', '0-0-0-0-0', '0-0-0-0-0', '0.0.0.0.0.0.', '0.0.0.0.0.0', 1, 1, 'FN SCAR', 3, 999999, '', '', '0', '0', '0-0-0', '', '', 'None', 'Safehouse', 'F-HSUN', '', '1', '', 'True', '', '', '', '456', '', '1', '', 0, '', '1', '', 0, 'Cambridgeshire', '', '', '0', '2', 2147483647);
true
e295ab157b09f86c4a452698d0bfaf4883f32ace
SQL
ganeshbabuNN/Databases
/RDMS/Oracle Database/Listing 21_12.sql
UTF-8
221
2.59375
3
[]
no_license
create or replace Function calcourseamt (code number) return number as netincomeamt number; begin select sum(netincome) into netincomeamt from batch where coursecode = code; return (netincomeamt); end calcourseamt; /
true
180be54482e042fcddb062c18009739e7ed95fff
SQL
Pulsemedic/Application_Engineering_Design
/DBMS Final Exam - Hospital Management System/SQL Queries/SET 4 - FUNCTIONS.sql
UTF-8
755
3.796875
4
[]
no_license
/*Fuctions*/ select count(*) as Total_Count from patient where admitDate >= '2010-01-01'; select avg(amount) as Average from bill where patientID = 18; select patientID as ID, amount as Amount from bill where abs(amount-9000) <= 1000; select max(patientName) from patient; select strcmp(p.patientName, d.doctorName) as Result from Patient p INNER JOIN Doctor d ON p.patientID = d.patientID; select * from patient where admitDate = (cast(curdate() as Date)); select version(), connection_id(), database(), schema(); select curdate(), now(); select year('2015-12-12') as year, quarter('2012-01-01'), hour('12:08:10'); select upper(patientName) as Upper_Name, ucase(patientName) as Name, lower(patientName) as Lower_Name from patient LIMIT 10;
true
6e5df5b509522bf9af2261c979cafeebc5c13fa8
SQL
lizziechoi/plp-reports
/one_off/reflections.sql
UTF-8
196
2.65625
3
[ "MIT" ]
permissive
SELECT * FROM reflection_log_entries as entries JOIN users as students ON entries.student_id = students.id JOIN reflection_log_prompts as prompts ON prompts.id = entries.reflection_log_prompt_id ;
true
0944ddf62345a8a23d85e37ddb3cae522e189e60
SQL
NeboLej/TradeCompanyProject
/TradeCompany_DataBase/TradeCompany_DataBase/Stored Procedures/GetProductsByOrderId.sql
UTF-8
494
3.5625
4
[]
no_license
CREATE PROCEDURE [TradeCompany_DataBase].[GetProductsByOrderId] @OrderId int as select ol.ProductID, p.[Name], p.MeasureUnit, ol.Amount, ol.Price, pg.[Name] as ProductGroupName from TradeCompany_DataBase.OrderLists ol inner join TradeCompany_DataBase.Products p on p.ID = ol.ProductID inner join TradeCompany_DataBase.Product_ProductGroups ppg on ppg.ProductID = ol.ProductID inner join TradeCompany_DataBase.ProductGroups pg on pg.ID =ppg.ProductGroupID where OrderId = @OrderId
true
3df8ca8e0afa302fb4da1a4edf78aa0a031109c0
SQL
silence-do-good/stress-test-Postgres-and-MySQL
/dump/high/day20/select2313.sql
UTF-8
178
2.671875
3
[]
no_license
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o WHERE timestamp>'2017-11-19T23:13:00Z' AND timestamp<'2017-11-20T23:13:00Z' AND temperature>=17 AND temperature<=99
true
f014837827f09dfa17a1f6bf5510ab2fd172f07e
SQL
vita1ity/ebs
/db/project.sql
UTF-8
1,172
2.921875
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : f Source Server Version : 50619 Source Host : localhost:3306 Source Database : project Target Server Type : MYSQL Target Server Version : 50619 File Encoding : 65001 Date: 2014-12-27 17:10:10 */ CREATE DATABASE project; USE project; SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `user` -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `userId` bigint(20) NOT NULL AUTO_INCREMENT, `password` varchar(255) DEFAULT NULL, `role` varchar(255) DEFAULT NULL, `username` varchar(255) DEFAULT NULL, PRIMARY KEY (`userId`) ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of user -- ---------------------------- INSERT INTO `user` VALUES ('1', 'a4a88c0872bf652bb9ed803ece5fd6e82354838a9bf59ab4babb1dab322154e1', 'Admin', 'admin'); INSERT INTO `user` VALUES ('9', 'f4fbf4100c1016610107c9a2aef52212a0016e8defdc2e978f291353d369b224', 'Corporate', 'corporate'); INSERT INTO `user` VALUES ('11', 'd712fd0707024d055968b3a316f3469b53af73a2f1b475d19141b6f76276b4fc', 'Supplier', 'supplier'); INSERT INTO `user` VALUES ('16', 'fca21f8b0e337f4eab80b998ca9301d3478d00a84250dddc4dba48638b42de0b', 'Employee', 'employee');
true
52738cca1d9417ae77db41bf552f3f1ca027e143
SQL
BobbyXBanks/burger
/db/schema.sql
UTF-8
330
2.90625
3
[]
no_license
CREATE DATABASE burgers_db; USE burgers_db; -- Created the table "schools" CREATE TABLE burgers ( id int AUTO_INCREMENT, -- keep burgername as string name VARCHAR(255) NOT NULL, -- devoured needs to be boolean default false devoured BOOLEAN NOT NULL DEFAULT FALSE, -- serve id as primary key PRIMARY KEY(id) );
true
8b8adb80904c94f01713ace13242a17a9afcfd50
SQL
Integrador-SWG/Sistema-SWG
/7-Codificación del Sistema/swg/bd/vieja/swg.sql
UTF-8
19,446
3.375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.1.12 -- http://www.phpmyadmin.net -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 21-08-2014 a las 23:20:17 -- Versión del servidor: 5.6.16 -- Versión de PHP: 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 */; -- -- Base de datos: `swg` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `altaproductos` -- CREATE TABLE IF NOT EXISTS `altaproductos` ( `idaltaproductos` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador unico e irrepetible que se le asignará a cada alta de producto que se registre en la base de datos del sistema (SWG).', `fecha` datetime NOT NULL COMMENT 'Fecha en la que se efectuo el registro dentro de la base de datos del sistema.', `estatus` tinyint(1) NOT NULL COMMENT 'Estado visible de las altas realizadas', `idempleados` int(11) NOT NULL COMMENT 'Personal de la empresa responsable del registro efectuado en la base de datops del sistema.', `idproductos` int(11) NOT NULL COMMENT 'Nombre del producto registrado en la base de datos.', PRIMARY KEY (`idaltaproductos`), KEY `fk_altapro_empleados` (`idempleados`), KEY `fk_altapro_productos` (`idproductos`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; -- -- Volcado de datos para la tabla `altaproductos` -- INSERT INTO `altaproductos` (`idaltaproductos`, `fecha`, `estatus`, `idempleados`, `idproductos`) VALUES (1, '2014-08-19 23:21:08', 1, 1, 1), (2, '2014-08-20 02:25:39', 1, 1, 2), (3, '2014-08-20 20:17:17', 1, 1, 3), (4, '2014-08-21 19:15:15', 1, 1, 4), (5, '2014-08-21 19:24:42', 1, 1, 5), (6, '2014-08-21 19:34:32', 1, 1, 6); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cliente` -- CREATE TABLE IF NOT EXISTS `cliente` ( `idcliente` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador único e irrepetible que se le asignará a cada cliente que se registre en la base de datos del sistema (SWG).', `nombre` varchar(45) NOT NULL COMMENT 'Nombre del cliente objeto de registro en la base de datos del sistema.\n', `apellido` varchar(45) NOT NULL COMMENT 'Apellidos del cliente objeto de registro en la base de datos del sistema.', `telefono` varchar(45) NOT NULL COMMENT 'Número telefonico de contacto del cliente registrado en la base de datos del sistema.', `correo` varchar(45) NOT NULL COMMENT 'Correo electrónico para notificaciones y contacto de cada cliente que se registre en la base de datos del sistema (SWG).', `estatus` tinyint(1) NOT NULL COMMENT 'Situación o estad oque guardara cada cliente dentro de la base de datos del sisitema.', `idusuario` int(11) NOT NULL, PRIMARY KEY (`idcliente`), KEY `fk_cliente_usuario` (`idusuario`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Volcado de datos para la tabla `cliente` -- INSERT INTO `cliente` (`idcliente`, `nombre`, `apellido`, `telefono`, `correo`, `estatus`, `idusuario`) VALUES (1, 'Armando', 'Gonzalez', '1234567890', 'armando@gmail.com', 1, 3); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `compra` -- CREATE TABLE IF NOT EXISTS `compra` ( `idcompra` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador único e irrepetible que se le asignará a cada registro de compra ingresado en la base de datos del sistema (SWG).', `fecha` datetime NOT NULL COMMENT 'Fecha y hora en la que se realizo dicho registro en la base de datos del sistema.', `cantidad` double NOT NULL COMMENT 'Importe de la compra registrada.', `iva` double NOT NULL COMMENT 'Impuesto al valor agregado de la compra registrada.', `total` double NOT NULL COMMENT 'Importe neto de la compra registrada despues de impuestos y descuentos.', `estatus` tinyint(1) NOT NULL COMMENT 'Estado en el que se encuentra la compra registrada.', `idcliente` int(11) NOT NULL COMMENT 'Nombre del cliente que realizo la compra.', `idproductos` int(11) NOT NULL COMMENT 'Nombre del o los productos objeto de la compra.', PRIMARY KEY (`idcompra`), KEY `fk_compra_cliente` (`idcliente`), KEY `fk_compra_productos` (`idproductos`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `confvista` -- CREATE TABLE IF NOT EXISTS `confvista` ( `idconfvista` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador unico e irrepetible que se le asignará a cada configuración de la vista de cada empresa que se registre en la base de datos del sistema (SWG).', `nombre` varchar(45) NOT NULL COMMENT 'Diseño(s) con el nombre comercial de cada empresa registrada en la base de datos del sistema (SWG) para su personalización.', `slide1` varchar(200) DEFAULT NULL COMMENT 'Campo para almacenar la url de la imagenes del Slide 1', `info1` varchar(50) DEFAULT NULL COMMENT 'Proporciona informacion rapida acerca de la imagen del slide1', `slide2` varchar(200) DEFAULT NULL COMMENT 'Campo para almacenar la url de la imagenes del Slide 2', `info2` varchar(50) DEFAULT NULL COMMENT 'Proporciona informacion rapida acerca de la imagen del slide2', `slide3` varchar(200) DEFAULT NULL COMMENT 'Campo para almacenar la url de la imagenes del Slide 3', `info3` varchar(50) DEFAULT NULL COMMENT 'Proporciona informacion rapida acerca de la imagen del slide 3', `estatus` tinyint(1) NOT NULL COMMENT 'Estado de cada diseño registrado en la base de datos del sistema para cada una de las empresas registradas en la base de datos puede ser activo o inactivo.\n\n', PRIMARY KEY (`idconfvista`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Volcado de datos para la tabla `confvista` -- INSERT INTO `confvista` (`idconfvista`, `nombre`, `slide1`, `info1`, `slide2`, `info2`, `slide3`, `info3`, `estatus`) VALUES (1, 'Esquivel''s SA DE CV', '264527_slide1.png', 'Informacion 1', '272614_slide2.png', 'Informacion 2', '638489_slide3.png', 'Informacion 3', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cuentas` -- CREATE TABLE IF NOT EXISTS `cuentas` ( `idcuentas` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador unico e irrepetible que se le asignará a cada registro de las cuentas de cada empresa que se ingrese en la base de datos del sistema (SWG).', `banco` varchar(45) NOT NULL COMMENT 'Nombre de la institución bancaria donde aperturto la cuenta la empresa registrada en la base de datos.', `nombre` varchar(45) NOT NULL COMMENT 'Nombre con el que se encuentra registrada en la institución bancaria la cuenta registrada en la base de datos.', `cuenta` varchar(45) NOT NULL COMMENT 'Número de cuenta proporcionado por la institución financiera.', `estatus` tinyint(1) NOT NULL COMMENT 'Situación de la cuenta registrada dentro de la base de datos del sistema.', `idempresa` int(11) NOT NULL COMMENT 'Nombre de la empresa a la que pertenece el registro de la cuenta en la base de datos del sistema.', PRIMARY KEY (`idcuentas`), KEY `fk_cuentas_empresa` (`idempresa`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Volcado de datos para la tabla `cuentas` -- INSERT INTO `cuentas` (`idcuentas`, `banco`, `nombre`, `cuenta`, `estatus`, `idempresa`) VALUES (1, 'HSBC', 'Esquivel', '1234567890', 1, 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `direccioncliente` -- CREATE TABLE IF NOT EXISTS `direccioncliente` ( `iddireccioncliente` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador único e irrepetible que se le asignará a cada dirección que se registre en la base de datos del sistema (SWG).', `direccion` varchar(60) NOT NULL COMMENT 'Direccion general del domiciolio del cliente.', `cp` varchar(45) NOT NULL COMMENT 'Codigo Postal pertenceciente al domicilio del cliente que se registre en la base de datos del sistema.', `estado` varchar(45) NOT NULL COMMENT 'Estado pertenceciente al domicilio del cliente que se registre en la base de datos del sistema.', `referencia` text COMMENT 'Rasgo identificador del domicilio del cliente a registrar en la base de datos del sistema.', `estatus` tinyint(1) NOT NULL COMMENT 'Estado o situación que guarda el registro del domicilio existente en la base de datos del sisitema.', `idcliente` int(11) NOT NULL COMMENT 'Nombre del cliente al que pertenece el domicilio registrado.', PRIMARY KEY (`iddireccioncliente`), KEY `fk_dircliente_cliente` (`idcliente`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Volcado de datos para la tabla `direccioncliente` -- INSERT INTO `direccioncliente` (`iddireccioncliente`, `direccion`, `cp`, `estado`, `referencia`, `estatus`, `idcliente`) VALUES (1, 'Playa del Carmen', '77231', 'Q.Roo', 'Juan Contreras Pat', 1, 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `empleados` -- CREATE TABLE IF NOT EXISTS `empleados` ( `idempleados` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador unico e irrepetible que se le asignará a cada empleado que se registre en la base de datos del sistema (SWG).', `nombre` varchar(45) NOT NULL COMMENT 'Nombre(s) del empleado que se registre en la base de datos del sistema (SWG).', `apellido` varchar(45) NOT NULL COMMENT 'Apellidos del empleado que se registre en la base de datos del sistema (SWG).', `telefono` varchar(45) NOT NULL COMMENT 'Número telefonico personal del empleado que se registre en la base de datos del sistema (SWG).', `estatus` tinyint(1) NOT NULL COMMENT 'Situación o estado en el que se podra encontrar el empleado para poder accesar al sistema SWG.', `idempresa` int(11) NOT NULL COMMENT 'Empresa a la que pertenece el empleado que se registra en la base de datos del sistema.', `idusuario` int(11) NOT NULL COMMENT 'identificador de usuario al que pertenece cada empleado', PRIMARY KEY (`idempleados`), KEY `fk_empleado_empresa` (`idempresa`), KEY `fk_empleado_usuario` (`idusuario`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Volcado de datos para la tabla `empleados` -- INSERT INTO `empleados` (`idempleados`, `nombre`, `apellido`, `telefono`, `estatus`, `idempresa`, `idusuario`) VALUES (1, 'Root', 'Gerente', '9912455123', 1, 1, 1), (2, 'Angel', 'Lopez Pulido', '9982320028', 1, 1, 2); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `empresa` -- CREATE TABLE IF NOT EXISTS `empresa` ( `idempresa` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador único e irrepetible que se le asignará a cada empresa que se registre en la base de datos del sistema (SWG).', `direccion` varchar(45) NOT NULL COMMENT 'Dirección fiscal y/o de ubicación de la empresa que se registre en la base de datos del sistema (SWG).', `correo` varchar(45) NOT NULL COMMENT 'Correo electrónico para notificaciones y contacto de cada empresa que se registre en la base de datos del sistema (SWG).', `idconfvista` int(11) NOT NULL COMMENT 'Llave foránea que se relaciona con la tabla confvista de la base de datos, para mostrar la configuración personalizada de las vistas de cada empresa registrada en la base de datos del sistema (SWG).', PRIMARY KEY (`idempresa`), KEY `fk_empresa_confvista` (`idconfvista`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Volcado de datos para la tabla `empresa` -- INSERT INTO `empresa` (`idempresa`, `direccion`, `correo`, `idconfvista`) VALUES (1, 'Av. 20 Noviembre', 'swg@gmail.com', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `nivel` -- CREATE TABLE IF NOT EXISTS `nivel` ( `idnivel` varchar(20) NOT NULL COMMENT 'Número identificador unico e irrepetible que se le asignará a cada nivel de usuario que se registre en la base de datos del sistema (SWG).', `estatus` tinyint(1) NOT NULL COMMENT 'Situación que guardara el registro del nivel cread oen la base de datos.', PRIMARY KEY (`idnivel`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `nivel` -- INSERT INTO `nivel` (`idnivel`, `estatus`) VALUES ('administrador', 1), ('cliente', 1), ('empleado', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `productos` -- CREATE TABLE IF NOT EXISTS `productos` ( `idproductos` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador único e irrepetible que se le asignará a cada producto que se registre en la base de datos del sistema (SWG).', `nombre` varchar(25) NOT NULL COMMENT 'Nombre del producto registrado en la base de datos del sisitema.', `descripcion` text NOT NULL COMMENT 'Breve descripción de cada producto registrado en la base de datos del sistema.', `cantidad` int(11) NOT NULL COMMENT 'Número de piezas de cada producto registradas en la base de datos del sisitema.', `precio` double NOT NULL COMMENT 'Precio unitario de venta de cada producto registrado en la base de datos del sisitema.', `imagen` varchar(200) NOT NULL COMMENT 'Almacena la url de la imagen del producto', `estatus` tinyint(1) NOT NULL COMMENT 'Estado o situación que guarda cada registro de producto en la base de datos del sistema.', `idproveedor` int(11) NOT NULL COMMENT 'Nombre del proveedor que distribuye cada producto registrado en la base de datos del sisitema.', PRIMARY KEY (`idproductos`), KEY `idproveedor` (`idproveedor`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; -- -- Volcado de datos para la tabla `productos` -- INSERT INTO `productos` (`idproductos`, `nombre`, `descripcion`, `cantidad`, `precio`, `imagen`, `estatus`, `idproveedor`) VALUES (1, 'Mancuernas', 'Mancuernas Roker 6.0 Kg', 12, 270, '304901_mancuerna.jpg', 1, 1), (2, 'Short MEN''S UA COMBINE', 'Short para deporte caballero', 4, 561.24, '613342_shortentrenamiento.jpg', 1, 1), (3, 'Barea', 'es un producto', 100, 32.1, '42298_logo.png', 1, 1), (4, 'Lapiz', 'Lapiz colo', 23, 234, '463196_batman.jpg', 1, 1), (5, 'Prueba', 'prueba1', 1, 23, '327179_superman.jpg', 1, 1), (6, 'Mujer', 'mujer des', 29, 34.2, '483551_669525_short2.jpg', 1, 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `proveedor` -- CREATE TABLE IF NOT EXISTS `proveedor` ( `idproveedor` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Número identificador unico e irrepetible que se le asignará a cada proveedor que se registre en la base de datos del sistema (SWG).', `nombre` varchar(45) NOT NULL COMMENT 'Nombre o razon social del proveedor que se registre en la base de datos del sistema (SWG).', `direccion` varchar(80) NOT NULL COMMENT 'Dirección fiscal y/o de ubicación del proveedor que se registre en la base de datos del sistema (SWG).', `telefono` varchar(45) NOT NULL COMMENT 'Número telefonico de contacto del proveedor que se registre en la base de datos del sistema (SWG).', `telefono1` varchar(45) DEFAULT NULL COMMENT 'Número telefonico opcional para contactar al proveedor que se registre en la base de datos del sistema (SWG).', `correo` varchar(45) NOT NULL COMMENT 'Correo electrónico para notificaciones y contacto de cada proveedor que se registre en la base de datos del sistema (SWG).', `estatus` tinyint(1) NOT NULL COMMENT 'Estado que guarda el registro de cada proveedor dentro de la base de datos del sistema.', PRIMARY KEY (`idproveedor`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Volcado de datos para la tabla `proveedor` -- INSERT INTO `proveedor` (`idproveedor`, `nombre`, `direccion`, `telefono`, `telefono1`, `correo`, `estatus`) VALUES (1, 'Cocacola', 'Calle 20 MZ 4 L 09', '9886567892', '1234743456', 'cocacola@cocacola.com.mx', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuario` -- CREATE TABLE IF NOT EXISTS `usuario` ( `idusuario` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Numero identificador unico e irrepetible que se le asignara cada usuario', `user` varchar(45) NOT NULL COMMENT 'Nombres de usuario para poder ingresar al sistema.', `pass` varchar(45) NOT NULL COMMENT 'Contraseña de autentificación para ingreso del sistema.', `estatus` tinyint(1) NOT NULL COMMENT 'Estado los usuarios.', `idnivel` varchar(20) NOT NULL COMMENT 'Clave foranea del nivel que tiene cada usuario.', PRIMARY KEY (`idusuario`), KEY `fk_usuario_nivel` (`idnivel`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; -- -- Volcado de datos para la tabla `usuario` -- INSERT INTO `usuario` (`idusuario`, `user`, `pass`, `estatus`, `idnivel`) VALUES (1, 'root', '123', 1, 'administrador'), (2, 'anghellp', '12', 1, 'empleado'), (3, 'armando', 'armando123', 1, 'cliente'); -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `altaproductos` -- ALTER TABLE `altaproductos` ADD CONSTRAINT `fk_altapro_empleados` FOREIGN KEY (`idempleados`) REFERENCES `empleados` (`idempleados`) ON UPDATE CASCADE, ADD CONSTRAINT `fk_altapro_productos` FOREIGN KEY (`idproductos`) REFERENCES `productos` (`idproductos`) ON UPDATE CASCADE; -- -- Filtros para la tabla `cliente` -- ALTER TABLE `cliente` ADD CONSTRAINT `fk_cliente_usuario` FOREIGN KEY (`idusuario`) REFERENCES `usuario` (`idusuario`) ON UPDATE CASCADE; -- -- Filtros para la tabla `compra` -- ALTER TABLE `compra` ADD CONSTRAINT `fk_compra_cliente` FOREIGN KEY (`idcliente`) REFERENCES `cliente` (`idcliente`) ON UPDATE CASCADE, ADD CONSTRAINT `fk_compra_productos` FOREIGN KEY (`idproductos`) REFERENCES `productos` (`idproductos`) ON UPDATE CASCADE; -- -- Filtros para la tabla `cuentas` -- ALTER TABLE `cuentas` ADD CONSTRAINT `fk_cuentas_empresa` FOREIGN KEY (`idempresa`) REFERENCES `empresa` (`idempresa`) ON UPDATE CASCADE; -- -- Filtros para la tabla `direccioncliente` -- ALTER TABLE `direccioncliente` ADD CONSTRAINT `fk_dircliente_cliente` FOREIGN KEY (`idcliente`) REFERENCES `cliente` (`idcliente`) ON UPDATE CASCADE; -- -- Filtros para la tabla `empleados` -- ALTER TABLE `empleados` ADD CONSTRAINT `fk_empleado_empresa` FOREIGN KEY (`idempresa`) REFERENCES `empresa` (`idempresa`) ON UPDATE CASCADE, ADD CONSTRAINT `fk_empleado_usuario` FOREIGN KEY (`idusuario`) REFERENCES `usuario` (`idusuario`) ON UPDATE CASCADE; -- -- Filtros para la tabla `empresa` -- ALTER TABLE `empresa` ADD CONSTRAINT `fk_empresa_confvista` FOREIGN KEY (`idconfvista`) REFERENCES `confvista` (`idconfvista`) ON UPDATE CASCADE; -- -- Filtros para la tabla `productos` -- ALTER TABLE `productos` ADD CONSTRAINT `fk_productos_proveedor` FOREIGN KEY (`idproveedor`) REFERENCES `proveedor` (`idproveedor`) ON UPDATE CASCADE; -- -- Filtros para la tabla `usuario` -- ALTER TABLE `usuario` ADD CONSTRAINT `fk_usuario_nivel` FOREIGN KEY (`idnivel`) REFERENCES `nivel` (`idnivel`) ON UPDATE CASCADE; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
e784f6251955b2e9e3f04f81c5f1649b1dfafe60
SQL
gcoronelc/SISTUNI-PLSQL-005
/TRABAJOS/TALAVERA/fcSCRIPTs Guillermo Talavera/fcFUNC.sql
UTF-8
5,666
3.046875
3
[]
no_license
CREATE OR REPLACE FUNCTION funCRUDUPDATE(v_obj varchar2, v_nombre varchar2, v_nombre_cambio varchar2) RETURN varchar2 IS result_update varchar2(150) := ''; cmd varchar2(150) := ''; BEGIN IF (v_obj = 'entrenador') THEN cmd := 'UPDATE FUTBOLCLUB.' || UPPER(v_obj) || 'ES' || ' SET nombre_entrenador = ' || v_nombre_cambio || ' WHERE nombre_entrenador = ' || v_nombre || ';COMMIT;'; ELSIF (v_obj = 'posicion') THEN cmd := 'UPDATE FUTBOLCLUB.' || UPPER(v_obj) || ' SET nombre_posicion = ' || v_nombre_cambio || ' WHERE nombre_entrenador = ' || v_nombre || ';COMMIT;'; ELSIF (v_obj = 'clubes') THEN cmd := 'UPDATE FUTBOLCLUB.' || UPPER(v_obj) || ' SET nomclub = ' || v_nombre_cambio || ' WHERE nombre_entrenador = ' || v_nombre || ';COMMIT;'; ELSIF (v_obj = 'puestos') THEN cmd := 'UPDATE FUTBOLCLUB.' || UPPER(v_obj) || ' SET nombre_puesto = ' || v_nombre_cambio || 'WHERE nombre_entrenador = ' || v_nombre || ';COMMIT;'; ELSE cmd := 'UPDATE FUTBOLCLUB.JUGADORES' || ' SET nombres_apellidos = ' || v_nombre_cambio || ' WHERE nombre_entrenador = ' || v_nombre || ';COMMIT;'; END IF; result_update := cmd; RETURN result_update; END; / ---------------------------------------------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION funCRUDINSERT(v_obj varchar2, v_nombre varchar2) RETURN varchar2 IS containsert number := 0; result_insert varchar2(150) := ''; cmd varchar2(150) := ''; BEGIN IF (v_obj = 'entrenador') THEN cmd := 'SELECT COUNT(*) INTO ' || containsert || ' FROM FUTBOLCLUB.' || UPPER(v_obj) || 'ES;' || 'INSERT INTO ' || 'FUTBOLCLUB.' || UPPER(v_obj) || 'ES' || ' VALUES (' || TO_CHAR(containsert + 1) || ',' || v_nombre || '); COMMIT;'; ELSIF (v_obj = 'posicion') THEN cmd := 'SELECT COUNT(*) INTO ' || containsert || ' FROM FUTBOLCLUB.' || UPPER(v_obj) || ';' || 'INSERT INTO ' || 'FUTBOLCLUB.' || UPPER(v_obj) || ' VALUES (' || TO_CHAR(containsert + 1) || ',' || v_nombre || '); COMMIT;'; ELSIF (v_obj = 'clubes') THEN cmd := 'SELECT COUNT(*) INTO ' || containsert || ' FROM FUTBOLCLUB.' || UPPER(v_obj) || ';' || 'INSERT INTO ' || 'FUTBOLCLUB.' || UPPER(v_obj) || ' VALUES (' || TO_CHAR(containsert + 1) || ',' || v_nombre || '); COMMIT;'; ELSIF (v_obj = 'puestos') THEN cmd := 'SELECT COUNT(*) INTO ' || containsert || ' FROM FUTBOLCLUB.' || UPPER(v_obj) || ';' || 'INSERT INTO ' || 'FUTBOLCLUB.' || UPPER(v_obj) || ' VALUES (' || TO_CHAR(containsert + 1) || ',' || v_nombre || '); COMMIT;'; ELSE cmd := 'SELECT COUNT(*) INTO ' || containsert || ' FROM FUTBOLCLUB.' || UPPER(v_obj) || ';' || 'INSERT INTO ' || 'FUTBOLCLUB.' || UPPER(v_obj) || ' VALUES (' || TO_CHAR(containsert + 1) || ',' || v_nombre || '); COMMIT;'; END IF; result_insert := cmd; RETURN result_insert; END; / ----------------------------------------------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION funCRUDDELETE(v_obj varchar2, v_nombre varchar2) RETURN varchar2 IS result_delete varchar2(150) := ''; cmd varchar2(150) := ''; BEGIN IF (v_obj = 'entrenador') THEN cmd := 'DELETE FROM FUTBOLCLUB.' || UPPER(v_obj) || 'ES ' || 'WHERE nombre_entrenador = ' || v_nombre || ';COMMIT;'; ELSIF (v_obj = 'posicion') THEN cmd := 'DELETE FROM FUTBOLCLUB.' || UPPER(v_obj) || ' WHERE nombre_posicion = ' || v_nombre || ';COMMIT;'; ELSIF (v_obj = 'clubes') THEN cmd := 'DELETE FROM FUTBOLCLUB.' || UPPER(v_obj) || ' WHERE nomclub = ' || v_nombre || ';COMMIT;'; ELSIF (v_obj = 'puestos') THEN cmd := 'DELETE FROM FUTBOLCLUB.' || UPPER(v_obj) || ' WHERE nombre_puestos = ' || v_nombre || ';COMMIT;'; ELSE cmd := 'DELETE FROM FUTBOLCLUB.' || UPPER(v_obj) || ' WHERE nombres_apellidos = ' || v_nombre || ';COMMIT;'; END IF; result_delete := cmd; RETURN result_delete; END; / ---------------------------------------------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION funCRUDFIND(v_obj varchar2, v_nombre varchar2) RETURN varchar2 IS result_find varchar2(150) := ''; cmd varchar2(150) := ''; BEGIN IF (v_obj = 'entrenador') THEN cmd := 'SELECT * FUTBOLCLUB.' || UPPER(v_obj) || 'ES ' || 'WHERE nombre_entrenador = ' || v_nombre || ';'; ELSIF (v_obj = 'posicion') THEN cmd := 'SELECT * FUTBOLCLUB.' || UPPER(v_obj) || ' WHERE nombre_posicion = ' || v_nombre || ';'; ELSIF (v_obj = 'clubes') THEN cmd := 'SELECT * FUTBOLCLUB.' || UPPER(v_obj) || ' WHERE nomclub = ' || v_nombre || ';'; ELSIF (v_obj = 'puestos') THEN cmd := 'SELECT * FUTBOLCLUB.' || UPPER(v_obj) || ' WHERE nombre_puestos = ' || v_nombre || ';'; ELSE cmd := 'SELECT * FUTBOLCLUB.' || UPPER(v_obj) || ' WHERE nombres_apellidos = ' || v_nombre || ';'; END IF; result_find := cmd; RETURN result_find; END; /
true
fe08437eeb99ee0ea8370880d7be9823f33a1662
SQL
tgh12/incubator-kylin
/query/src/test/resources/query/h2/query09.sql
UTF-8
208
3.25
3
[ "Apache-2.0" ]
permissive
select count(*) from (select test_cal_dt.week_beg_dt from test_kylin_fact inner JOIN edw.test_cal_dt as test_cal_dt ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt group by test_cal_dt.week_beg_dt) t
true
068d3045a81d41d92e13270cd5e0781a13f8e187
SQL
cjaramilloalmaximoti/copiaLigitios
/Reclutamiento/Codigo/BD/RespaldoSemReclutamiento001/Reclutamiento004AG.sql
UTF-8
2,245
3.171875
3
[]
no_license
DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `ObtProspectos`( IN `pNombre` VARCHAR(100), IN `pApellido` VARCHAR(100), IN `pActivo` INT, IN `pIdEmpresa` INT ) BEGIN Declare pDesde tinyint; Declare pHasta tinyint; if(pActivo = -1) then SET pDesde = 0; SET pHasta = 1; else SET pDesde = pActivo; SET pHasta = pActivo; end if; SELECT IdProspecto, Nombre, Apellidos, FechaNacimiento, RFC, Email, TelefonoMovil, TelefonoOtro, Direccion, CV, Foto, Salario, IdSexo, IdCiudad, IdEstadoCivil, IdProfesion, Activo FROM prospecto where Nombre like concat('%', IFNULL(pNombre, ''), '%') and Apellido like concat('%', IFNULL(pApellido, ''), '%') and Activo between pDesde and pHasta AND IdEmpresa = pIdEmpresa; END$$ DELIMITER ; insert into Forma(ClaveCodigo, Nombre, EsOpcionMenu, Estatus, IdFormaPadre, TextoLink, Accion, Controlador , EsDropdown, Orden, IdUsuarioCreacion,FechaCreacion, IdUsuarioUltimoModifico,FechaModificacion , OrigenOperacion, Descripcion, IdEmpresa, EsSuperAdministrador ) values( 'Prospecto' , 'Prospecto' , 1, 1 , 2 , 'Prospectos' , 'Prospecto_Index' , 'Prospecto' , 0, 4, 1, now(), 1, now(), 1, '(Administracion) Forma correspondiente a Prospectos', 1, 0 ); SET @id_forma = (select idForma from Forma where(ClaveCodigo='Prospecto')); insert into FormaRol( IdForma, IdRol, Privilegios, IdUsuarioCreacion, FechaCreacion, IdUsuarioUltimoModifico, FechaModificacion, OrigenOperacion, IdEmpresa ) values( @id_forma, 2, 15, 1, now(), 1, now(), 1 , 1); insert into FormaPermiso( IdForma , IdPermiso, IdUsuarioCreacion, FechaCreacion, IdUsuarioUltimoModifico, FechaModificacion, OrigenOperacion, IdEmpresa, NombrePermiso ) values( @id_forma, 1, 1, now(), 1,now(), 1, 1, 'Consultar' ),( @id_forma, 2, 1, now(), 1,now(), 1, 1, 'Agregar' ), ( @id_forma, 3, 1, now(), 1,now(), 1, 1, 'Actualizar' ),( @id_forma, 4, 1, now(), 1,now(), 1, 1, 'Eliminar' ); INSERT INTO `registroScript`(`NumeroScript`, `NombreScript`, `NombreQuienRealizo`, `Fecha`, `DescripcionScript`) VALUES (4,'Reclutamiento004AG','Alejandro Gutierrez','20180227','Procedimiento ObtProspecto, Agregar Menu Prospecto.');
true
eda6bef1f14ca538de4220f1334a48cc50c8fa0d
SQL
jsostaric/PHPAkademija2020
/PHPAcademyHomework4/script.sql
UTF-8
8,502
3.84375
4
[]
no_license
drop database if exists homework; create database homework character set utf8mb4 collate utf8mb4_unicode_ci; use homework; #mysql -uroot -p --default_character_set=utf8mb4 < c:\xampp\htdocs\PHPAcademyHomework4\script.sql drop trigger if exists trigger_insert_members; create table genres( id int not null primary key auto_increment, name varchar(255) not null ); create table cities( id int not null primary key auto_increment, post_code int not null, name varchar(255) not null ); create table media( id int not null primary key auto_increment, name varchar(255) not null ); create table movies( id int not null primary key auto_increment, title varchar(255) not null, media int not null ); create table members( id int not null primary key auto_increment, first_name varchar(255) not null, last_name varchar(255) not null, address varchar(255) not null, is_active int default 1, cities int not null ); create table genres_movies( id int not null primary key auto_increment, genres int not null, movies int not null ); create table members_movies( id int not null primary key auto_increment, members int not null, movies int not null, day_of_rent datetime not null, day_of_return datetime ); create trigger trigger_insert_members before insert on members for each row set new.first_name = upper(new.first_name); #add foreign keys alter table movies add foreign key(media) references media(id) on delete cascade; alter table genres_movies add foreign key(genres) references genres(id) on delete cascade; alter table genres_movies add foreign key(movies) references movies(id) on delete cascade; alter table members add foreign key(cities) references cities(id) on delete cascade; alter table members_movies add foreign key(members) references members(id); alter table members_movies add foreign key(movies) references movies(id); #inserts insert into genres(name) values('Action'), ('Adventure'), ('Drama'), ('Fantasy'), ('War'), ('Mystery'), ('Thriller'), ('Comedy'), ('Sci-fi'), ('Crime'), ('Romance'), ('Horror'); insert into media(name) values('CD'), ('DVD'), ('VHS'), ('Betamax'); insert into cities(post_code, name) values(31000, 'Osijek'), (32000, 'Vukovar'), (10000, 'Zagreb'), (48000, 'Koprivnica'), (44000, 'Sisak'), (40000, 'Čakovec'), (51000, 'Rijeka'), (21000, 'Split'), (31400, 'Đakovo'), (23000, 'Zadar'); insert into movies(title, media) values('Casablanca', 3), ('Avengers', 2), ('Serenity', 2), ('Seven Samurai', 1), ('Pulp Fiction', 1), ('Fifth Element', 3), ('Big Fish', 1), ('Cowboy Bebop', 3), ('The Good, The Bad and The Ugly', 2), ('Shawshank Redemption', 2), ('Pink Panther', 3), ('Going Postal', 1), ('Escape From New York', 3); insert into members(first_name, last_name, address, cities) values('Ana', 'Anić', 'Fiktivna adresa 35', 6), ('Bruno', 'Brunić', 'adresa broj 15', 2), ('Cecilija', 'Celić', 'ulica strahova 22', 4), ('Ivan', 'Ivić', 'Radićeva 57', 8), ('Pero', 'Perić', 'Gundulićeva 42', 6), ('Doonie', 'Darko', 'Jelačićeva 50', 10), ('Malcolm', 'Reynolds', 'Strossmayerova 5', 1), ('Cohen', 'The Barbarian', 'Trg Grgura Ninskog 2', 3), ('Rincewind', 'The Wizard', 'Dravska 221', 5), ('Arthur', 'Dent', 'Restoran na kraju univerzuma bb', 7), ('Marko', 'Marić', 'Striborova 15', 3), ('Sam', 'Verner', 'Rooseveltova 105', 2); insert into genres_movies(genres, movies) values(1,1), (1,2), (3,13), (11,12), (5,3), (5,5), (7,4), (12,4), (1,11), (5,6), (5,8), (4,7), (4,9), (10,10); insert into members_movies(members, movies, day_of_rent, day_of_return) values( 2,1,now(), FROM_UNIXTIME( UNIX_TIMESTAMP(now()) + FLOOR(0 + (RAND() * 604800))) ), ( 5,3,now(), FROM_UNIXTIME( UNIX_TIMESTAMP(now()) + FLOOR(0 + (RAND() * 604800))) ), ( 7,9,now(), FROM_UNIXTIME( UNIX_TIMESTAMP(now()) + FLOOR(0 + (RAND() * 604800))) ), ( 12,5,now(), FROM_UNIXTIME( UNIX_TIMESTAMP(now()) + FLOOR(0 + (RAND() * 604800))) ), ( 8,8,now(), FROM_UNIXTIME( UNIX_TIMESTAMP(now()) + FLOOR(0 + (RAND() * 604800))) ); #statements #10 select, 5 update, 5 delete #use 5 joins and 5 built-in functions # show member with name Cohen select * from members where first_name = 'Cohen'; #show fullname of memebers in city of Zagreb select concat(a.first_name, ' ', a.last_name) as fullname, b.name from members a inner join cities b on a.cities=b.id where b.name = 'Zagreb'; #how many members rented movies in city of Vukovar select count(d.name) from movies a inner join members_movies b on a.id=b.movies inner join members c on c.id=b.members inner join cities d on d.id=c.cities where d.name = 'Vukovar'; #show title, member, when was last movie returned and how long did it take to return it select a.title, c.first_name, c.last_name,b.day_of_return, datediff(b.day_of_return, b.day_of_rent) as numberOfDays from movies a inner join members_movies b on a.id=b.movies inner join members c on c.id=b.members order by day_of_return desc limit 1; # what is average time of movies rental in days select avg(datediff(day_of_return, day_of_rent)) as AverageDaysOfRental from members_movies; # how many movies are on specific media select b.name, count(a.id) as NumberOfMovies from movies a right join media b on a.media=b.id group by b.name desc; #show movies with their genres select a.title, group_concat(c.name) as genre from movies a right join genres_movies b on a.id=b.movies inner join genres c on c.id=b.genres group by a.title; #how many movies are in every genre select a.name, count(c.id) as moviesInGenres from genres a left join genres_movies b on a.id=b.genres left join movies c on c.id=b.movies group by a.id; #memebers that did not rent movie select a.first_name, a.last_name from members a left join members_movies b on a.id=b.members left join movies c on c.id=b.movies where c.title is null; #show members and movies they rented and are active members select a.title, concat(c.first_name, ' ', c.last_name) as fullname, b.day_of_rent as dayOfRent from movies a inner join members_movies b on a.id=b.movies inner join members c on c.id=b.members where c.is_active != 0; #updates update members set is_active = 0 where id in(1,3,4,6,9,10,11); update cities set post_code = 49000, name = 'Krapina' where id = (select id from cities where name='Sisak'); update movies set title = replace(title, 'Seven Samurai', 'Ran'); update cities set name = upper(name); update movies set media = 4 where title = 'Pink Panther'; #deletes delete from media where name = 'Betamax'; delete from movies where id = 11; delete from members_movies where members = (select id from members where id = 12); delete from members where first_name = 'Rincewind' and last_name = 'The Wizard'; delete from members where is_active = 0;
true
d74e33feb38d9cba88f8fbf91ca97d1f9192f2de
SQL
jerrica-mj/bootcampX
/1_queries/2_total_students_in_cohorts.sql
UTF-8
275
3.703125
4
[]
no_license
-- Select the total number of students who were in the first 3 cohorts. SELECT count(*) FROM students -- WHERE cohort_id <= 3; --> this is less flexible, more redundant for multiple cohorts WHERE cohort_id IN (1,2,3); -- Expected Output: -- count ------- -- 48 (1 row)
true
5fc9d7c6af267a9ffa06ecd2a0ec6e9fab06e325
SQL
DigitalGizmo/tomcat-centures-src
/database/scratch/ohAassociation_fromScratch.sql
UTF-8
498
2.84375
3
[]
no_license
USE centuriesForum; /*DROP TABLE OhAssociation; */ CREATE TABLE OhAssociation ( ID INT NOT NULL IDENTITY (1,1), assocTypeID INT DEFAULT 0 NOT NULL, associateID INT DEFAULT 0 NOT NULL, assocWithID INT DEFAULT 0 NOT NULL, ordinal SMALLINT DEFAULT 0 NOT NULL, CONSTRAINT OhAssociation_PK PRIMARY KEY(ID) ); /* SQL server instert syntax different, do it by hand for now INSERT INTO OhAssociation VALUES (1, 1, 1, 1, 2), (2, 1, 1, 2, 1), (3, 1, 2, 3, 1); */
true
ea967716dd81f48bb4251520c916addcc18b33dc
SQL
FCPhoenix/php-create-delete-update-delete-search-app
/database/script.sql
UTF-8
379
2.78125
3
[]
no_license
CREATE DATABASE phpApp; use phpApp; CREATE TABLE student( id INT(11) PRIMARY KEY AUTO_INCREMENT, age INT(10) DEFAULT NULL, specialty VARCHAR(255) DEFAULT NULL, name VARCHAR(25) NOT NULL, surname VARCHAR(25) NOT NULL, gender VARCHAR(6) DEFAULT NULL, matriculation_number VARCHAR(25) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); DESCRIBE student;
true
4ef08bbd7347bc525150f0030b71c451dc04279c
SQL
cvranjith/misc
/mick/all.sql
UTF-8
143
2.546875
3
[]
no_license
SELECT OWNER,RPAD(OBJECT_NAME,30,' ') ||' - '|| OBJECT_TYPE OBJECT FROM ALL_OBJECTS WHERE OBJECT_NAME LIKE REPLACE(upper('%&OB%'),' ','%') /
true
fc2aab538ffde0a6fb493ae7ee4ba454c3ec7639
SQL
flomader/azure-databricks-storage
/notebooks/directconnect_oauthsp_sql.sql
UTF-8
1,589
3.296875
3
[]
no_license
-- Databricks notebook source -- MAGIC %md -- MAGIC %md -- MAGIC ## Azure DataLake Gen2 -- MAGIC -- MAGIC Pre-requisites: -- MAGIC 1. [Create Service Principle](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal) -- MAGIC 1. Service Principle has [**Storage Data Blob Owner/Contributor/Reader role**](https://docs.microsoft.com/en-us/azure/storage/common/storage-auth-aad-rbac-portal#rbac-roles-for-blobs-and-queues) OR [**appropriate ACL permissions (R/W/E) on ADLA Gen2**](https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-access-control#access-control-lists-on-files-and-directories) is granted -- MAGIC 2. **Databricks Runtime 5.2** or above -- MAGIC 3. ADLS Gen2 storage account in the **same region** as your Azure Databricks workspace -- COMMAND ---------- -- Set spark configuration SET fs.azure.account.auth.type=OAuth SET fs.azure.account.oauth.provider.type=org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider SET fs.azure.account.oauth2.client.id=<SERVICE_PRINCIPLE_CLIENT_ID> SET fs.azure.account.oauth2.client.secret=<SERVICE_PRINCIPLE_SECRET> SET fs.azure.account.oauth2.client.endpoint=https://login.microsoftonline.com/<DIRECTORY_TENANT_ID>/oauth2/token -- COMMAND ---------- -- Create a table over a CSV file in ADLS Gen2 -- You'll need data.csv at root of container/filesystem CREATE TABLE MyTable USING CSV OPTIONS ('header'='true') LOCATION 'abfss://<STORAGE_CONTAINER>@<STORAGE_ACCOUNT>.dfs.core.windows.net/data.csv'; -- COMMAND ---------- -- Query table SELECT * FROM MyTable;
true
e1bff2e74e6199424f0d03f2b12af68acc942a9c
SQL
Ingrid-Deukoue/sql-challenge
/Queries/employee_database.sql
UTF-8
1,493
4.125
4
[]
no_license
CREATE TABLE employees ( emp_no int NOT NULL, emp_title_id varchar(60), birth_date date NOT NULL, first_name varchar(255) NOT NULL, last_name varchar(255) NOT NULL, sex varchar(1) NOT NULL, hire_date date NOT NULL, CONSTRAINT pk_Employees PRIMARY KEY ( emp_no) ); select * from employees CREATE TABLE departments ( dept_no varchar(255) NOT NULL, dept_name varchar(255) NOT NULL, CONSTRAINT pk_departments PRIMARY KEY ( dept_no) ) select * from departments CREATE TABLE salaries ( emp_no int NOT NULL, salary int NOT NULL, CONSTRAINT fk_salaries_emp_no FOREIGN KEY(emp_no) REFERENCES employees (emp_no) ); select * from salaries CREATE TABLE titles ( title_id varchar(60) NOT NULL, title varchar(255) NOT NULL, CONSTRAINT fk_titles_title_id FOREIGN KEY(title_id) REFERENCES employees(emp_title_id) ) ; select * from titles CREATE TABLE dept_emp ( emp_no int NOT NULL, dept_no varchar(255) NOT NULL, CONSTRAINT fk_Dept_employee_emp_no FOREIGN KEY(emp_no) REFERENCES employees(emp_no), CONSTRAINT fk_Dept_employee_dept_no FOREIGN KEY(dept_no) REFERENCES Departments (dept_no) ); select * from dept_emp create table dept_manager( dept_no varchar(255) NOT NULL, emp_no int NOT NULL, CONSTRAINT fk_dept_manager_dept_no FOREIGN KEY(dept_no) REFERENCES departments (dept_no), CONSTRAINT fk_dept_manager_emp_no FOREIGN KEY(emp_no) REFERENCES employees (emp_no) ); select * from dept_manager
true
653fcf7d0e4f9d1a90dfa9788fa092327ca85daa
SQL
harakonan/misc-codes
/SQL/SQL_Puzzle_2nd_Ed/p20/SELECT1.sql
UTF-8
219
2.96875
3
[]
no_license
SELECT DISTINCT test_name FROM TestResults T1 WHERE NOT EXISTS (SELECT * FROM TestResults T2 WHERE T1.test_name = T2.test_name AND T2.comp_date IS NULL);
true
44c26f20d4dc63536386fe86e95734043f7f8c76
SQL
ualbertalib/coral-api
/sql/GetRights_sp.sql
UTF-8
3,446
3.734375
4
[]
no_license
use coral_licensing_prod; DROP PROCEDURE IF EXISTS coral_licensing_prod.GetRights; DELIMITER // CREATE PROCEDURE `GetRights`(IN target varchar(256), IN targetType varchar(10)) BEGIN DECLARE v_eclassId, v_coursePackId, v_linkId, v_printId, v_documentId INT; declare v_eclassTxt, v_coursePackTxt, v_linkTxt, v_printTxt VARCHAR(512); DECLARE v_ourLink VARCHAR(256); select expressionTypeID INTO v_eclassId from ExpressionType where shortName = 'Course Management Systems'; select expressionTypeID INTO v_coursePackId from ExpressionType where shortName = 'Course Packs'; select expressionTypeID INTO v_linkId from ExpressionType where shortName = 'Linking'; select expressionTypeID INTO v_printId from ExpressionType where shortName = 'Classroom Print Copies'; -- try to cross resrence SFXTarget to Coral db document id if targetType = "SFX" THEN select distinct documentID into v_documentId from XloadLink where SFXTarget = target AND documentId is NOT NULL; select max(OURLink) into v_ourLink from XloadLink where SFXTarget = target AND documentId = v_documentId; ELSE select documentID into v_documentId from XloadLink where coralName = target; select OURLink into v_ourLink from XloadLink where coralName = target; END IF; select Qualifier.shortName into v_eclassTxt from Qualifier, ExpressionQualifierProfile, Expression where Expression.documentID = v_documentId and Expression.expressionTypeID = v_eclassId and ExpressionQualifierProfile.expressionID = Expression.expressionID and ExpressionQualifierProfile.qualifierID = Qualifier.qualifierID; select Qualifier.shortName into v_coursePackTxt from Qualifier, ExpressionQualifierProfile, Expression where Expression.documentID = v_documentId and Expression.expressionTypeID = v_coursePackId and ExpressionQualifierProfile.expressionID = Expression.expressionID and ExpressionQualifierProfile.qualifierID = Qualifier.qualifierID; select Qualifier.shortName into v_linkTxt from Qualifier, ExpressionQualifierProfile, Expression where Expression.documentID = v_documentId and Expression.expressionTypeID = v_linkId and ExpressionQualifierProfile.expressionID = Expression.expressionID and ExpressionQualifierProfile.qualifierID = Qualifier.qualifierID; select Qualifier.shortName into v_printTxt from Qualifier, ExpressionQualifierProfile, Expression where Expression.documentID = v_documentId and Expression.expressionTypeID = v_printId and ExpressionQualifierProfile.expressionID = Expression.expressionID and ExpressionQualifierProfile.qualifierID = Qualifier.qualifierID; IF v_documentId is not NULL THEN select 1 as "recFound", (select IFNULL(v_eclassTxt, "") REGEXP '^<font color=green><b>Yes|^Permitted|^<font color=red><b>Yes') as "eClass", (select IFNULL(v_coursePackTxt, "") REGEXP '^<font color=green><b>Yes|^Permitted|^<font color=red><b>Yes') as "CoursePack", (select IFNULL(v_linkTxt, "Permitted") REGEXP '^<font color=green><b>Yes|^Permitted|^<font color=red><b>Yes') as "Link", (select IFNULL(v_printTxt, "") REGEXP '^<font color=green><b>Yes|^Permitted|^<font color=red><b>Yes') as "Print", v_ourLink as "OURLink"; ELSE select 0 as "recFound", 0 as "eClass", 0 as "CoursePack", 0 as "Link", 0 as "Print", v_ourLink as "OURLink"; END IF; END //
true
249a862c444e94ad3952cc7c4c20690a1a175dad
SQL
holnone/StJames_Golf
/doc/teamMatches.sql
UTF-8
2,359
3.078125
3
[]
no_license
select w.week_id, w.wk_date, w.team_match_1_id, t1.team_nbr, t2.team_nbr, w.team_match_2_id, t3.team_nbr, t4.team_nbr, w.team_match_3_id, t5.team_nbr, t6.team_nbr, w.team_match_4_id, t7.team_nbr, t8.team_nbr, w.team_match_5_id, t9.team_nbr, t10.team_nbr, w.team_match_6_id, t11.team_nbr, t12.team_nbr from `STJ_WEEK` w inner join `STJ_TEAM_MATCH` tm1 on tm1.team_match_id = w.team_match_1_id inner join `STJ_TEAM_SCORE` ts1 on tm1.team_score_id_1 = ts1.team_score_id inner join `STJ_TEAM_SCORE` ts2 on tm1.team_score_id_2 = ts2.team_score_id inner join `STJ_TEAM` t1 on ts1.team_id = t1.team_id inner join `STJ_TEAM` t2 on ts2.team_id = t2.team_id inner join `STJ_TEAM_MATCH` tm2 on tm2.team_match_id = w.team_match_2_id inner join `STJ_TEAM_SCORE` ts3 on tm2.team_score_id_1 = ts3.team_score_id inner join `STJ_TEAM_SCORE` ts4 on tm2.team_score_id_2 = ts4.team_score_id inner join `STJ_TEAM` t3 on ts3.team_id = t3.team_id inner join `STJ_TEAM` t4 on ts4.team_id = t4.team_id inner join `STJ_TEAM_MATCH` tm3 on tm3.team_match_id = w.team_match_3_id inner join `STJ_TEAM_SCORE` ts5 on tm3.team_score_id_1 = ts5.team_score_id inner join `STJ_TEAM_SCORE` ts6 on tm3.team_score_id_2 = ts6.team_score_id inner join `STJ_TEAM` t5 on ts5.team_id = t5.team_id inner join `STJ_TEAM` t6 on ts6.team_id = t6.team_id inner join `STJ_TEAM_MATCH` tm4 on tm4.team_match_id = w.team_match_4_id inner join `STJ_TEAM_SCORE` ts7 on tm4.team_score_id_1 = ts7.team_score_id inner join `STJ_TEAM_SCORE` ts8 on tm4.team_score_id_2 = ts8.team_score_id inner join `STJ_TEAM` t7 on ts7.team_id = t7.team_id inner join `STJ_TEAM` t8 on ts8.team_id = t8.team_id inner join `STJ_TEAM_MATCH` tm5 on tm5.team_match_id = w.team_match_5_id inner join `STJ_TEAM_SCORE` ts9 on tm5.team_score_id_1 = ts9.team_score_id inner join `STJ_TEAM_SCORE` ts10 on tm5.team_score_id_2 = ts10.team_score_id inner join `STJ_TEAM` t9 on ts9.team_id = t9.team_id inner join `STJ_TEAM` t10 on ts10.team_id = t10.team_id inner join `STJ_TEAM_MATCH` tm6 on tm6.team_match_id = w.team_match_6_id inner join `STJ_TEAM_SCORE` ts11 on tm6.team_score_id_1 = ts11.team_score_id inner join `STJ_TEAM_SCORE` ts12 on tm6.team_score_id_2 = ts12.team_score_id inner join `STJ_TEAM` t11 on ts11.team_id = t11.team_id inner join `STJ_TEAM` t12 on ts12.team_id = t12.team_id where w.wk_date > '2014-08-00' order by w.wk_date
true
d469f86554e0904e656f53b3d8e31353d95c0d10
SQL
rogeriomfneto/django_labjef
/sql/create.sql
UTF-8
4,355
3.8125
4
[]
no_license
-- Dropa tudo /* DO $$ DECLARE r RECORD; BEGIN FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE'; END LOOP; END $$; */ CREATE TABLE pessoa ( id_pessoa INT NOT NULL PRIMARY KEY, cpf VARCHAR(11) NOT NULL, nome VARCHAR(255) NOT NULL, endereco VARCHAR(255) NOT NULL, nascimento DATE NOT NULL, UNIQUE (cpf) ); CREATE TABLE usuario ( id_usuario INT NOT NULL references pessoa(id_pessoa), area_de_pesquisa VARCHAR(255), instituicao VARCHAR(255), login VARCHAR(255) NOT NULL, senha VARCHAR(255) NOT NULL, id_tutor INT references usuario(id_usuario), UNIQUE (id_usuario) ); CREATE TABLE paciente ( id_paciente INT NOT NULL references pessoa(id_pessoa), UNIQUE (id_paciente) ); CREATE TABLE perfil ( id_perfil INT NOT NULL PRIMARY KEY, codigo VARCHAR(255) NOT NULL, tipo VARCHAR(255), UNIQUE (codigo) ); --Relacionamento possui CREATE TABLE possui ( id_usuario INT NOT NULL references usuario(id_usuario), id_perfil INT NOT NULL references perfil(id_perfil), UNIQUE (id_usuario, id_perfil) ); CREATE TABLE servico ( id_servico INT NOT NULL PRIMARY KEY, nome VARCHAR(255) NOT NULL, classe VARCHAR(255) NOT NULL CHECK (classe IN ('visualização', 'inserção', 'alteração', 'remoção')), UNIQUE (nome, classe) ); --Relacionamento pertence CREATE TABLE pertence ( id_servico INT NOT NULL references servico(id_servico), id_perfil INT NOT NULL references perfil(id_perfil), UNIQUE (id_servico, id_perfil) ); --Relacionamento tutelamento CREATE TABLE tutelamento ( id_usuario_tutelado INT NOT NULL references usuario(id_usuario), id_tutor INT NOT NULL references usuario(id_usuario), id_servico INT NOT NULL references servico(id_servico), id_perfil INT NOT NULL references perfil(id_perfil), data_de_inicio DATE NOT NULL, data_de_termino DATE, UNIQUE (id_usuario_tutelado, id_tutor, id_servico, id_perfil) ); CREATE TABLE exame ( id_exame INT NOT NULL PRIMARY KEY, tipo VARCHAR(255) NOT NULL, virus VARCHAR(255) NOT NULL, UNIQUE (tipo, virus) ); --Relacionamento gerencia CREATE TABLE gerencia ( id_servico INT NOT NULL references servico(id_servico), id_exame INT NOT NULL references exame(id_exame), UNIQUE (id_servico, id_exame) ); --Relacionamento realiza CREATE TABLE realiza ( id_paciente INT NOT NULL references paciente(id_paciente), id_exame INT NOT NULL references exame(id_exame), codigo_amostra VARCHAR(255), data_de_solicitacao TIMESTAMP, data_de_realizacao TIMESTAMP, UNIQUE (id_paciente, id_exame, data_de_realizacao) ); --Agregado amostra CREATE TABLE amostra ( id_paciente INT NOT NULL references paciente(id_paciente), id_exame INT NOT NULL references exame(id_exame), codigo_amostra VARCHAR(255) NOT NULL, metodo_de_coleta VARCHAR(255) NOT NULL, material VARCHAR(255) NOT NULL, UNIQUE (id_paciente, id_exame, codigo_amostra) ); -- Relacionamento realizou (para o hist�rico de servi�os) CREATE TABLE realizou ( id_usuario INT NOT NULL references usuario(id_usuario), id_servico INT NOT NULL references servico(id_servico), id_exame INT NOT NULL references exame(id_exame), data_realizacao TIMESTAMP NOT NULL, UNIQUE (id_usuario, id_servico, id_exame) ); ALTER TABLE possui ADD id_possui int ; UPDATE possui SET id_possui = id_usuario where id_usuario = 0 ALTER TABLE possui ADD PRIMARY KEY (id_possui); ALTER TABLE pertence ADD id_pertence int ; UPDATE pertence SET id_pertence = id_servico*10 + id_perfil where id_servico >= 0; ALTER TABLE pertence ADD PRIMARY KEY (id_pertence); ALTER TABLE pertence ADD id_pertence int ; UPDATE pertence SET id_pertence = id_servico*10 + id_perfil where id_servico >= 0; ALTER TABLE pertence ADD PRIMARY KEY (id_pertence); ALTER TABLE gerencia ADD id_gerencia int ; UPDATE gerencia SET id_gerencia = id_servico*10 + id_exame where id_exame >= 0; ALTER TABLE gerencia ADD PRIMARY KEY (id_gerencia); -- As permiss�es de acesso e modifica��o foram feitas com esse comando :) GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "10284632";
true
2bc903f915e55d506d43dfa7c03e5cfc0971853f
SQL
tapsaism/statsgoon
/statsgoon-sql/publish/d_date_season.sql
UTF-8
414
2.984375
3
[]
no_license
create view publish.D_DATE_SEASON AS SELECT DISTINCT filedate as date, CASE WHEN filedate >= 20161004 AND filedate <= 20170409 THEN '2016-2017'::text WHEN filedate >= 20170410 AND filedate <= 20170631 THEN '2016-2017 playoffs'::text WHEN filedate >= 20171004 and filedate <= 20180631 THEN '2017-2018'::text ELSE 'preseason'::text END AS season FROM staging.hockeygm_stats_all where filedate IS NOT NULL;
true
56a429ab3cd27f2845856da4d32788e6df59934b
SQL
1538402109/storage_platform
/sql/t_receivables_detail.sql
UTF-8
1,915
2.921875
3
[]
no_license
/* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 80012 Source Host : localhost:3306 Source Schema : jtpsi Target Server Type : MySQL Target Server Version : 80012 File Encoding : 65001 Date: 18/05/2021 23:23:39 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for t_receivables_detail -- ---------------------------- DROP TABLE IF EXISTS `t_receivables_detail`; CREATE TABLE `t_receivables_detail` ( `id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `act_money` decimal(19, 2) NOT NULL, `balance_money` decimal(19, 2) NOT NULL, `ca_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `ca_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `biz_date` datetime NULL DEFAULT NULL, `date_created` datetime NULL DEFAULT NULL, `ref_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `ref_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `rv_money` decimal(19, 2) NOT NULL, `data_org` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `company_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of t_receivables_detail -- ---------------------------- INSERT INTO `t_receivables_detail` VALUES ('04D71E39-B812-11E4-8FC9-782BCBD7746B', 0.00, 7000.00, '04B53C5E-B812-11E4-8FC9-782BCBD7746B', 'customer', '2015-01-01 00:00:00', '2015-02-19 16:33:45', '04B53C5E-B812-11E4-8FC9-782BCBD7746B', '应收账款期初建账', 7000.00, '01010001', '4D74E1E4-A129-11E4-9B6A-782BCBD7746B'); SET FOREIGN_KEY_CHECKS = 1;
true