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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cddb2d51a93ed4c8f1da3635b87a9c9d8e9ebfec
|
SQL
|
navikt/veilarboppfolging
|
/src/main/resources/db/migration/V1_5__mal.sql
|
UTF-8
| 301
| 2.859375
| 3
|
[
"MIT"
] |
permissive
|
ALTER TABLE SITUASJON ADD GJELDENDE_MAL NUMBER;
CREATE TABLE MAL (
ID NUMBER NOT NULL,
AKTORID VARCHAR(20) NOT NULL,
MAL VARCHAR(500),
ENDRET_AV VARCHAR(20),
DATO TIMESTAMP,
PRIMARY KEY (ID),
FOREIGN KEY (AKTORID) REFERENCES SITUASJON (AKTORID)
);
CREATE SEQUENCE MAL_SEQ START WITH 1;
| true
|
df9d976bb7c2457dc92714102d283288650b894d
|
SQL
|
drobinson4y/django-djequis
|
/djequis/adp/sql/CreateDivTable.sql
|
UTF-8
| 196
| 2.859375
| 3
|
[
"MIT"
] |
permissive
|
CREATE TABLE cx_sandbox:div_table (
div char(4) NOT NULL,
txt char(24),
head_id integer,
active_date date,
inactive_date date
);
CREATE UNIQUE INDEX cx_sandbox:tdiv_div ON div_table (div);
| true
|
ac1cf4cb1f050cf509d355cdb5cbdfb0805077ac
|
SQL
|
cezarparra/projeto-gamelandia-una
|
/project-gamelandia-simple/db/DESJAVAGAME_04_11_2018/desjavagame_tb_client_user_permission.sql
|
UTF-8
| 2,582
| 2.875
| 3
|
[] |
no_license
|
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: localhost Database: desjavagame
-- ------------------------------------------------------
-- Server version 5.7.22-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 `tb_client_user_permission`
--
DROP TABLE IF EXISTS `tb_client_user_permission`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_client_user_permission` (
`client_permission_id` int(11) NOT NULL,
`client_user_id` int(11) NOT NULL,
PRIMARY KEY (`client_permission_id`,`client_user_id`),
KEY `fk_tb_permission_has_tb_user_client_tb_user1_idx` (`client_user_id`),
KEY `fk_tb_permission_has_tb_user_client_tb_permission1_idx` (`client_permission_id`),
CONSTRAINT `fk_tb_permission_has_tb_client_tb_user1` FOREIGN KEY (`client_user_id`) REFERENCES `cliente` (`ID_CLIENTE`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_tb_permission_has_tb_user_client_tb_permission1` FOREIGN KEY (`client_permission_id`) REFERENCES `tb_permission` (`pk_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_client_user_permission`
--
LOCK TABLES `tb_client_user_permission` WRITE;
/*!40000 ALTER TABLE `tb_client_user_permission` DISABLE KEYS */;
INSERT INTO `tb_client_user_permission` VALUES (2,45),(2,48);
/*!40000 ALTER TABLE `tb_client_user_permission` 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-11-04 22:10:08
| true
|
dacd0b9bb9b0b3c07bd5f8442d06f0833c9304ce
|
SQL
|
Amandeepanmol/HackerRank_SQL
|
/Asian_Population.sql
|
UTF-8
| 369
| 3.140625
| 3
|
[] |
no_license
|
Asian Population
-------------------
Ist way:
---------
SELECT SUM(P.POPULATION) FROM CITY AS P INNER JOIN COUNTRY AS C ON P.COUNTRYCODE=C.CODE WHERE C.CONTINENT='Asia'; /*using Alice */
IInd way:
----------
SELECT SUM(CITY.POPULATION) FROM CITY,COUNTRY WHERE CITY.COUNTRYCODE=COUNTRY.CODE AND COUNTRY.CONTINENT='Asia'; /* using table name in place of Alice */
| true
|
1058fad3585ae4d7765492f5678fd821182282a5
|
SQL
|
heiheisoftware/spreader
|
/spreader-backend/db/old-2012/update-2012-04-23/update.sql
|
UTF-8
| 1,220
| 3.8125
| 4
|
[] |
no_license
|
create table tb_keyword
(
id bigint not null auto_increment,
name varchar(50),
category_id bigint comment 'null未分类,-1无需分类',
tag bit(0) not null default 0 comment '是否是手工建的关键字',
create_time timestamp,
executable bit(0) not null default true comment '执行状态,false表示被锁定',
allowtag bit(0) default true comment '是否可做标签关键字,true可以做标签',
primary key (id)
)
auto_increment = 800000
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_bin;
alter table tb_keyword comment '关键字表';
create unique index uk_keyword_name on tb_keyword
(
name
);
insert into tb_keyword
select id,name,null,false,current_timestamp(),true,true from tb_category;
truncate table tb_category;
DROP INDEX uk_category_user ON tb_user_tag;
alter table tb_user_tag drop column category_id;
ALTER TABLE tb_user_tag ADD tag_id bigint;
ALTER TABLE tb_user_tag ADD INDEX idx_tag_user (uid,tag_id);
update tb_user_tag ut
set tag_id = (select id from tb_keyword k where ut.tag = k.name);
drop table tb_content_category;
| true
|
dc9387148839463fd82ecadef404bfc00edadaf2
|
SQL
|
jimmy-wims/monSite
|
/monsite.sql
|
UTF-8
| 4,910
| 3.4375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1:3306
-- Généré le : mar. 13 oct. 2020 à 16:50
-- Version du serveur : 5.7.26
-- Version de PHP : 7.3.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `monsite`
--
-- --------------------------------------------------------
--
-- Structure de la table `competence`
--
DROP TABLE IF EXISTS `competence`;
CREATE TABLE IF NOT EXISTS `competence` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nom` int(11) NOT NULL,
`domaine_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `domaine` (`domaine_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `doctrine_migration_versions`
--
DROP TABLE IF EXISTS `doctrine_migration_versions`;
CREATE TABLE IF NOT EXISTS `doctrine_migration_versions` (
`version` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`executed_at` datetime DEFAULT NULL,
`execution_time` int(11) DEFAULT NULL,
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `doctrine_migration_versions`
--
INSERT INTO `doctrine_migration_versions` (`version`, `executed_at`, `execution_time`) VALUES
('DoctrineMigrations\\Version20200927195221', '2020-09-27 19:53:24', 97),
('DoctrineMigrations\\Version20200927195956', '2020-09-27 20:01:53', 147),
('DoctrineMigrations\\Version20200928153021', '2020-09-28 15:32:06', 135),
('DoctrineMigrations\\Version20201006141044', '2020-10-06 14:11:26', 135);
-- --------------------------------------------------------
--
-- Structure de la table `domaine`
--
DROP TABLE IF EXISTS `domaine`;
CREATE TABLE IF NOT EXISTS `domaine` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nom` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `domaine`
--
INSERT INTO `domaine` (`id`, `nom`) VALUES
(1, 'Programmation'),
(2, 'Web'),
(3, 'Base de données'),
(4, 'Frameworks/Librairies'),
(5, 'IDEs'),
(6, 'Outils de programmation');
-- --------------------------------------------------------
--
-- Structure de la table `langage`
--
DROP TABLE IF EXISTS `langage`;
CREATE TABLE IF NOT EXISTS `langage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nom` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `langage`
--
INSERT INTO `langage` (`id`, `nom`) VALUES
(1, 'Java'),
(2, 'C'),
(3, 'HTML');
-- --------------------------------------------------------
--
-- Structure de la table `projet`
--
DROP TABLE IF EXISTS `projet`;
CREATE TABLE IF NOT EXISTS `projet` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`langage_id` int(11) NOT NULL,
`nom` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
`lien` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `IDX_50159CA9957BB53C` (`langage_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Déchargement des données de la table `projet`
--
INSERT INTO `projet` (`id`, `langage_id`, `nom`, `description`, `lien`, `image`) VALUES
(1, 1, 'Space Invaders', 'Reproduction du célèbre jeu Space Invaders en langage java. Le but de ce jeu est de tuer les extraterrestres avec un vaisseau. Pour la création de ce projet nous avions accès à différentes ressources, notamment les fichiers concernant l\'interface. Projet réalisé avec Samir BOUKRI.', 'https://github.com/jimmy-wims/SpaceInvaders.git', 'spaceInvaders.jpg'),
(2, 2, 'Casse-briques', 'Création du jeu Casse-briques en langage C. Le but de ce jeu est de casser les briques en faisant rebondir une balle sur une raquette. Pour la création de ce projet j\'ai utilisé la librairie SDL2 permettant de créer une interface graphique 2D.', 'https://github.com/jimmy-wims/CasseBriques.git', 'casseBriques');
--
-- Contraintes pour les tables déchargées
--
--
-- Contraintes pour la table `projet`
--
ALTER TABLE `projet`
ADD CONSTRAINT `FK_50159CA9957BB53C` FOREIGN KEY (`langage_id`) REFERENCES `langage` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
70f40b2c06bd46a0010428029ca563ebbf45cd48
|
SQL
|
sriyabhat/BootcampX
|
/0_selects/4_incomple_assignments.sql
|
UTF-8
| 559
| 4.21875
| 4
|
[] |
no_license
|
SELECT (SELECT COUNT(1) FROM assignments) - COUNT(A.id) AS nb_incomplete_submissions
FROM students S
JOIN assignment_submissions A
ON S.id = A.student_id
WHERE S.name = 'Ibrahim Schimme'
SELECT AVG(total_students) as average_students
FROM (SELECT count(students) AS total_students
FROM students
JOIN cohorts on cohorts.id = cohort_id
GROUP BY cohorts) as totals_table;
SELECT assignments.name
FROM assignments
WHERE id NOT IN(
SELECT A.assignment_id
FROM students S
JOIN assignment_submissions A
ON S.id = A.student_id
WHERE S.name = 'Ibrahim Schimmel'
)
| true
|
78ef999b723b4997fcc266e82b0dcda04a1e6d4e
|
SQL
|
marielavlz/burger
|
/db/schema.sql
|
UTF-8
| 320
| 3.203125
| 3
|
[] |
no_license
|
-- Create burgers_db
DROP DATABASE IF EXISTS burgers_db;
CREATE DATABASE burgers_db;
USE burgers_db;
-- Create burgers
CREATE TABLE burgers
(
id INT(10) UNIQUE NOT NULL AUTO_INCREMENT,
burger_name VARCHAR(255) NOT NULL,
devoured BOOLEAN DEFAULT false,
date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
| true
|
1c3a4f8c0e9f1eb9ed9f3ff043ca22711bed8a9c
|
SQL
|
liwen666/lw_code
|
/tempcode/src/main/java/commons/execscript/sql/spf/common/common_220_.sql
|
GB18030
| 827
| 2.703125
| 3
|
[] |
no_license
|
declare
n_count number;
BEGIN
select count(1) into n_count from kpi_t_setinputstep where name = 'żЧ۽' and type = '3' ;
if n_count > 0 then
EXECUTE IMMEDIATE Q'{delete kpi_t_setinputstep where name = 'żЧ۽' and type = '3'}' ;
end if;
EXECUTE IMMEDIATE Q'{ update kpi_t_setinputstep set name = 'żЧĿ' where name = 'żЧĿ'}' ;
EXECUTE IMMEDIATE Q'{ INSERT INTO KPI_T_SETINPUTSTEP (STATUS,DATAKEY,NEEDUPDATE,ORDERID,FINYEAR,GUID,CODE,NAME,TYPE)
VALUES ('1','23E40EFB9316406780EAA967A5B63221',NULL,24,'2015','ABF8104524CD4682A13EC1F4C757D64','result','żЧ۽','3')}' ;
END;
--Ч_WTF_20160708_α--żЧ
| true
|
ad7dcbdc7b37252c9636cab338efc0e0ade7a6d4
|
SQL
|
9uilherme/microservice-with-spring-boot
|
/src/main/resources/data.sql
|
UTF-8
| 703
| 3.46875
| 3
|
[] |
no_license
|
create sequence if not exists hibernate_sequence start with 1 increment by 1;
create table if not exists user (id integer not null, birth_date timestamp, name varchar(255), primary key (id));
insert into user values (1, sysdate(), 'Zombie');
insert into user values (2, sysdate(), 'The Cranberries');
insert into user values (3, sysdate(), 'Shakira');
create table if not exists post (id integer not null, description varchar(255), user_id integer, primary key (id));
alter table post add constraint fk_user_id foreign key (user_id) references user;
insert into post values (1000, 'first post', 3);
insert into post values (1001, 'second post', 3);
insert into post values (1002, 'first post', 1);
| true
|
9fe8590801671b9f3a368032fce735bae8898434
|
SQL
|
avin05/Cricket-team-data-management-system
|
/bowler.sql
|
UTF-8
| 749
| 3.25
| 3
|
[] |
no_license
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `bowler`()
BEGIN
update final_bowl_stats
set tot_overs = (select sum(overs) from bowler_stats where player_id = final_bowl_stats.player_id),
tot_runs = (select sum(runs) from bowler_stats where player_id = final_bowl_stats.player_id),
tot_dot = (select sum(dots) from bowler_stats where player_id = final_bowl_stats.player_id),
tot_maidens = (select sum(maidens) from bowler_stats where player_id = final_bowl_stats.player_id),
tot_wickets = (select sum(wickets) from bowler_stats where player_id = final_bowl_stats.player_id),
Feconomy = (select avg(economy) from bowler_stats where player_id = final_bowl_stats.player_id)
where player_id in (select player_id from bowler_stats group by player_id);
END
| true
|
3eae7de26e7276e8fecd68c5e92f77af7105da92
|
SQL
|
bj-/Scripts
|
/SQL/MS SQL/Systech/Sleep And Strees signals.sql
|
WINDOWS-1251
| 1,240
| 3.84375
| 4
|
[] |
no_license
|
SELECT p.Lastname AS [],
p.firstname AS [],
p.MiddleName AS [],
CONCAT(p.Lastname, ' ', p.firstname, ' ', p.MiddleName) AS []
, DRS.*
from
(
SELECT
ds.[UsersGuid]
-- ,[ServersGuid]
-- ,[VehiclesGuid]
-- ,[SubVehiclesGuid]
-- ,[PlayType]
-- ,[Volume]
-- ,[Duration]
-- ,[Played]
-- ,[SignalDestination]
-- ,[SignalValidity]
,sum( ((ds.PlayType -2)* -1) ) AS [ ]--* (( ds.SignalDestination -2)* -1)) mc
,sum( ((ds.PlayType -2)* -1) * ( ds.SignalDestination -1)) [ ]
,sum( (ds.PlayType -1) ) [ ] -- * (( ds.SignalDestination -2)* -1))
,sum( (ds.PlayType -1) * ( ds.SignalDestination -1)) [ ]
FROM [DriversSignals] ds
where ds.Played between '2016-04-01 00:00:00.0000000' and '2016-07-30 00:00:00.0000000'
group by ds.[UsersGuid]
)
DRS right outer join Users u on DRS.UsersGuid = u.Guid
inner join Persons p on u.Personsguid = p.Guid
where
u.RolesGuid = '00000000-0000-0000-0000-000000000003'
/*
where
DRS.UsersGuid = u.Guid
and u.Personsguid = p.Guid
*/
order by p.Lastname
| true
|
bd067fd4c31e6e893af0293f59f6fb30dcdc2be7
|
SQL
|
blackstar58/SQL-queries
|
/customer_review.sql
|
UTF-8
| 3,043
| 3.609375
| 4
|
[] |
no_license
|
SELECT sum(customer_id)
FROM
ae_indexer_full_today_v2 ldb JOIN
eric_arenas.wpcids cids ON
(ldb.customer_id = cids.wpcid)
WHERE ds = '20170411' and length(ypid)>0 and tier in ('20','21','22')
group by customer_id
select
count(distinct(r.ypid))
from
digdata.top_helpful_reviews r
where
r.ds=20170511 and
r.ypid in
(select
distinct( p.ypid)
from
default.ae_indexer_full_today_v2 p
where p.ds=20170511 and
p.tier>19 and
p.tier<81 and
p.ratable=0);
_c0
95148 - All Tiers
_c0
16982 - Tiers
_c0
22364
select
count(distinct(r.ypid))
from
default.ratings_mv r
where
r.ds=20170513 and
r.ypid in
(select
distinct(p.ypid)
from
default.ae_indexer_full_today_v2 p
where
p.ds=20170513 and
p.tier in ('20','21','22')
) and
r.highlight_priority is not null;
set hive.cli.print.header=true;
select
count(distinct(customer_id))
from
default.ae_indexer_full_today_v2 p
where
p.ds=20170513 and
p.ypid in
(select
distinct(r.ypid)
from
default.ratings_mv r
where
r.ds=20170513 and
r.highlight_priority is not null
p.tier in ('20','21','22')
) and
p.tier in ('20','21','22')
insert overwrite directory 'hdfs://nameservice1/user/as7639/hive/name_search.out'
set hive.cli.print.header=true;
select
mm,
normalization_map['v'],
normalization_map['cstm'],
split(coalesce(normalization_map['sct'], 'null'), ',')[0],
normalization_map['pn'],
count(normalization_map['en'])
from
normalized_traffic_events
where
yyyy >= 2016 and yyyy= <= 2017 and
normalization_map['v'] = 2 and
normalization_map['moi'] = 7 and
normalization_map['ptid'] ='www.yellowpages.com' and
normalization_map['tq'] = 0 and
normalization_map['t'] ='listing'
group by
mm,
normalization_map['en'],
normalization_map['v'],
normalization_map['cstm'],
split(coalesce(normalization_map['sct'], 'null'), ',')[0],
normalization_map['pn']
nselect count(distinct (normalization_map['rid'])), normalization_map['v'] from normalized_traffic_events where normalization_map['en']='YP:: Search' and normalization_map['tq']=0 AND normalization_map['ptid']='www.yellowpages.com' AND mm=03 AND dd=01 AND yyyy=2017 group by normalization_map['v'];
| true
|
9269a573051472fbefa32376f3ed047d4eada35e
|
SQL
|
thangduong3010/PL-SQL
|
/opp6code/ch28_code.sql
|
UTF-8
| 4,314
| 3.546875
| 4
|
[] |
no_license
|
/*
Oracle PL/SQL Programming 5th Edition
www.stevenfeuerstein.com/books
Objection creation and example scripts for Chapter 28
You will find below all non-trivial code snippets from the above chapter
that are NOT contained in their own files (as specified in the chapter),
plus any DDL object creation scripts required to get a clean compile
on the snippets.
Any references to Oracle's standard HR tables (employees, departments,
locations, regions, etc.) will NOT include the DDL creation scripts
in this file. Instead, run the hr_schema_install.sql script and all
those tables and related elements will be defined.
*/
/*
gcc -m64 extprocsh.c -fPIC -G -o extprocsh.so
c:\MinGW\bin\gcc extprocsh.c -shared -o extprocsh.dll
*/
CREATE OR REPLACE LIBRARY extprocshell_lib
AS '/u01/app/oracle/local/lib/extprocsh.so'
/
CREATE OR REPLACE LIBRARY extprocshell_lib
AS 'c:\oracle\local\lib\extprocsh.dll'
/
CREATE OR REPLACE FUNCTION shell (cmd IN VARCHAR2)
RETURN PLS_INTEGER
AS
LANGUAGE C
LIBRARY extprocshell_lib
NAME "extprocshell"
PARAMETERS (cmd string, RETURN int);
/
DECLARE
result PLS_INTEGER;
BEGIN
result := shell ('cmd');
END;
/
/*
### regular listener (to connect to the database)
LISTENER =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
SID_LIST_LISTENER =
(SID_DESC =
(GLOBAL_DBNAME = global_name)
(ORACLE_HOME = oracle_home_directory)
(SID_NAME = SID)
)
#### external procedure listener
EXTPROC_LISTENER =
(ADDRESS = (PROTOCOL = IPC)(KEY = extprocKey))
SID_LIST_EXTPROC_LISTENER =
(SID_DESC =
(SID_NAME = extprocSID)
(ORACLE_HOME = oracle_home_directory)
(ENVS="EXTPROC_DLLS=shared_object_file_list,other_envt_vars")
(PROGRAM = extproc)
)
*/
/*
(ENVS="EXTPROC_DLLS=ONLY:/u01/app/oracle/local/lib/extprocsh.so:/u01/app/oracle/
local/lib/RawdataToPrinter.so")
(ENVS="EXTPROC_DLLS=ONLY:c:\oracle\admin\local\lib\extprocsh.dll:c:\oracle\admin\
local\lib\RawDataToPrinter.dll")
(ENVS="EXTPROC_DLLS=shared_object_file_list,LD_LIBRARY_PATH=/usr/local/lib")
*/
/*
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = extprocKey))
(CONNECT_DATA = (SID = extprocSID) (PRESENTATION = RO))
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION_LIST =
(LOAD_BALANCE = TRUE)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = PNPKEY))
(CONNECT_DATA = (SID = PLSExtProc_001)(PRESENTATION = RO))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = ipc)(key = PNPKEY))
(CONNECT_DATA = (SID = PLSExtProc_002)(PRESENTATION = RO))
)
)
*/
CREATE LIBRARY extprocshell_lib AS '${ORACLE_HOME}/lib/extprocsh.so'
/
CREATE LIBRARY extprocshell_lib AS '%{ORACLE_HOME}%\bin\extprocsh.dll'
/
CREATE OR REPLACE FUNCTION shell (cmd IN VARCHAR2)
RETURN PLS_INTEGER
AS
LANGUAGE C
LIBRARY extprocshell_lib
NAME "extprocsh"
PARAMETERS (cmd string, cmd INDICATOR, RETURN INDICATOR, RETURN int);
/
CREATE OR REPLACE FUNCTION shell (cmd IN VARCHAR2)
RETURN PLS_INTEGER
AS
LANGUAGE C
LIBRARY extprocshell_lib
NAME "extprocsh"
PARAMETERS (cmd string, cmd INDICATOR, RETURN INDICATOR);
/
/*
1 #include <ociextp.h>
2
3 int extprocsh(char *cmd, short cmdInd, short *retInd)
4 {
5 if (cmdInd == OCI_IND_NOTNULL)
6 {
7 *retInd = (short)OCI_IND_NOTNULL;
8 return system(cmd);
9 } else
10 {
11 *retInd = (short)OCI_IND_NULL;
12 return 0;
13 }
14 }
gcc -m64 extprocsh.c -fPIC -G -I$ORACLE_HOME/rdbms/public -o extprocsh.so
c:\MinGW\bin\gcc -Ic:\oracle\product\10.2.0\db_1\oci\include extprocsh.c
-shared -o extprocsh.dll
*/
CREATE OR REPLACE PROCEDURE shell2 (name_of_agent IN VARCHAR2, cmd VARCHAR2)
AS
LANGUAGE C
LIBRARY extprocshell_lib
NAME "extprocsh2"
AGENT IN (name_of_agent)
WITH CONTEXT
PARAMETERS (CONTEXT, name_of_agent string, cmd string, cmd INDICATOR);
/
/*
void extprocsh2(OCIExtProcContext *ctx, char *agent, char *cmd, short cmdInd)
{
extprocsh(ctx, cmd, cmdInd);
}
*/
| true
|
182eddc3d3f69804b0a65d964abeb8a6b2669f59
|
SQL
|
romanus007/dz-na-04.04.2020
|
/user1.sql
|
UTF-8
| 9,611
| 3.359375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Хост: localhost
-- Время создания: Апр 04 2020 г., 10:57
-- Версия сервера: 5.7.27-0ubuntu0.16.04.1
-- Версия PHP: 7.0.33-0ubuntu0.16.04.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- База данных: `user1`
--
-- --------------------------------------------------------
--
-- Структура таблицы `albums`
--
CREATE TABLE `albums` (
`album_id` int(11) NOT NULL,
`album_title` varchar(30) NOT NULL,
`album_year` varchar(30) NOT NULL,
`album_tracks` varchar(10) DEFAULT NULL,
`artist_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Дамп данных таблицы `albums`
--
INSERT INTO `albums` (`album_id`, `album_title`, `album_year`, `album_tracks`, `artist_id`) VALUES
(1, 'Come on Over', '2003', '7', 2),
(2, 'Millennium', '2005', '5', 3),
(3, 'Saturday Night Fever', '2002', '4', 5),
(4, 'Rumours', '1998', '8', 4),
(5, 'Dangerous', '1995', '9', 6),
(6, 'Music Box', '2010', '10', 1);
-- --------------------------------------------------------
--
-- Структура таблицы `albums_songs`
--
CREATE TABLE `albums_songs` (
`album_song_id` int(11) NOT NULL,
`album_id` int(11) DEFAULT NULL,
`song_id` int(11) DEFAULT NULL,
`track_number` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Дамп данных таблицы `albums_songs`
--
INSERT INTO `albums_songs` (`album_song_id`, `album_id`, `song_id`, `track_number`) VALUES
(1, 1, 2, '3'),
(2, 2, 1, '4'),
(3, 3, 5, '1'),
(4, 5, 4, '3'),
(5, 6, 3, '2'),
(6, 4, 6, '1');
-- --------------------------------------------------------
--
-- Структура таблицы `artists`
--
CREATE TABLE `artists` (
`artist_id` int(11) NOT NULL,
`artist_site_url` varchar(200) DEFAULT NULL,
`genre_id` int(11) DEFAULT NULL,
`country_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Дамп данных таблицы `artists`
--
INSERT INTO `artists` (`artist_id`, `artist_site_url`, `genre_id`, `country_id`) VALUES
(1, 'https://www.ivanov.ru', 1, 2),
(2, 'https://www.petrov.ru', 2, 1),
(3, 'https://www.sidorov.ru', 4, 3),
(4, 'https://www.popov.ru', 3, 5),
(5, 'https://www.sokolov.ru', 5, 4),
(6, 'https://www.smirnov.ru', 6, 6);
-- --------------------------------------------------------
--
-- Структура таблицы `countries`
--
CREATE TABLE `countries` (
`country_id` int(11) NOT NULL,
`country_name` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Дамп данных таблицы `countries`
--
INSERT INTO `countries` (`country_id`, `country_name`) VALUES
(1, 'Brazil'),
(2, 'Egypt'),
(3, 'England'),
(4, 'Japan'),
(5, 'Poland'),
(6, 'Russia');
-- --------------------------------------------------------
--
-- Структура таблицы `genres`
--
CREATE TABLE `genres` (
`genre_id` int(11) NOT NULL,
`genre_name` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Дамп данных таблицы `genres`
--
INSERT INTO `genres` (`genre_id`, `genre_name`) VALUES
(1, 'Rock Music'),
(2, 'Techno'),
(3, 'Jazz'),
(4, 'Dubstep'),
(5, 'Pop Music'),
(6, 'Electro');
-- --------------------------------------------------------
--
-- Структура таблицы `groups`
--
CREATE TABLE `groups` (
`group_id` int(11) NOT NULL,
`group_name` varchar(30) NOT NULL,
`artist_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Дамп данных таблицы `groups`
--
INSERT INTO `groups` (`group_id`, `group_name`, `artist_id`) VALUES
(1, 'Nirvana', 1),
(2, 'The Beatles', 4),
(3, 'Thirty Seconds to Mars', 3),
(4, 'Linkin Park', 5),
(5, 'The Rolling Stones', 6),
(6, 'ABBA', 2);
-- --------------------------------------------------------
--
-- Структура таблицы `persons`
--
CREATE TABLE `persons` (
`person_id` int(11) NOT NULL,
`first_name` varchar(30) NOT NULL,
`second_name` varchar(30) NOT NULL,
`birthday` varchar(30) DEFAULT NULL,
`sex` varchar(30) NOT NULL,
`artist_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Дамп данных таблицы `persons`
--
INSERT INTO `persons` (`person_id`, `first_name`, `second_name`, `birthday`, `sex`, `artist_id`) VALUES
(1, 'Ivan', 'Ivanov', '11.02.2001', 'male', 1),
(2, 'Petr', 'Petrov', '09.03.1998', 'male', 2),
(3, 'Andrew', 'Sidorov', '13.04.1986', 'male', 3),
(4, 'Aleksey', 'Popov', '17.05.1993', 'male', 4),
(5, 'Anton', 'Sokolov', '18.07.1996', 'male', 5),
(6, 'Vladimir', 'Smirnov', '28.02.1991', 'male', 6);
-- --------------------------------------------------------
--
-- Структура таблицы `songs`
--
CREATE TABLE `songs` (
`song_id` int(11) NOT NULL,
`song_title` varchar(30) NOT NULL,
`song_duration` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Дамп данных таблицы `songs`
--
INSERT INTO `songs` (`song_id`, `song_title`, `song_duration`) VALUES
(1, 'Dont Speak', '1 minute 40 second'),
(2, 'Happy Nation', '1 minute 30 second'),
(3, 'Mother Love', '1 minute 20 second'),
(4, 'Losing My Religion', '1 minute 50 second'),
(5, 'Wonderwall', '2 minute 10 second'),
(6, 'Ordinary World', '2 minute 20 second');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `albums`
--
ALTER TABLE `albums`
ADD PRIMARY KEY (`album_id`),
ADD KEY `artist_id` (`artist_id`);
--
-- Индексы таблицы `albums_songs`
--
ALTER TABLE `albums_songs`
ADD PRIMARY KEY (`album_song_id`),
ADD KEY `album_id` (`album_id`),
ADD KEY `song_id` (`song_id`);
--
-- Индексы таблицы `artists`
--
ALTER TABLE `artists`
ADD PRIMARY KEY (`artist_id`),
ADD KEY `genre_id` (`genre_id`),
ADD KEY `country_id` (`country_id`);
--
-- Индексы таблицы `countries`
--
ALTER TABLE `countries`
ADD PRIMARY KEY (`country_id`);
--
-- Индексы таблицы `genres`
--
ALTER TABLE `genres`
ADD PRIMARY KEY (`genre_id`);
--
-- Индексы таблицы `groups`
--
ALTER TABLE `groups`
ADD PRIMARY KEY (`group_id`),
ADD KEY `artist_id` (`artist_id`);
--
-- Индексы таблицы `persons`
--
ALTER TABLE `persons`
ADD PRIMARY KEY (`person_id`),
ADD KEY `artist_id` (`artist_id`);
--
-- Индексы таблицы `songs`
--
ALTER TABLE `songs`
ADD PRIMARY KEY (`song_id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `albums`
--
ALTER TABLE `albums`
MODIFY `album_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT для таблицы `albums_songs`
--
ALTER TABLE `albums_songs`
MODIFY `album_song_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT для таблицы `artists`
--
ALTER TABLE `artists`
MODIFY `artist_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT для таблицы `countries`
--
ALTER TABLE `countries`
MODIFY `country_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT для таблицы `genres`
--
ALTER TABLE `genres`
MODIFY `genre_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT для таблицы `groups`
--
ALTER TABLE `groups`
MODIFY `group_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT для таблицы `persons`
--
ALTER TABLE `persons`
MODIFY `person_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT для таблицы `songs`
--
ALTER TABLE `songs`
MODIFY `song_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- Ограничения внешнего ключа сохраненных таблиц
--
--
-- Ограничения внешнего ключа таблицы `albums`
--
ALTER TABLE `albums`
ADD CONSTRAINT `albums_ibfk_1` FOREIGN KEY (`artist_id`) REFERENCES `artists` (`artist_id`);
--
-- Ограничения внешнего ключа таблицы `albums_songs`
--
ALTER TABLE `albums_songs`
ADD CONSTRAINT `albums_songs_ibfk_1` FOREIGN KEY (`album_id`) REFERENCES `albums` (`album_id`),
ADD CONSTRAINT `albums_songs_ibfk_2` FOREIGN KEY (`song_id`) REFERENCES `songs` (`song_id`);
--
-- Ограничения внешнего ключа таблицы `artists`
--
ALTER TABLE `artists`
ADD CONSTRAINT `artists_ibfk_1` FOREIGN KEY (`genre_id`) REFERENCES `genres` (`genre_id`),
ADD CONSTRAINT `artists_ibfk_2` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`);
--
-- Ограничения внешнего ключа таблицы `groups`
--
ALTER TABLE `groups`
ADD CONSTRAINT `groups_ibfk_1` FOREIGN KEY (`artist_id`) REFERENCES `artists` (`artist_id`);
--
-- Ограничения внешнего ключа таблицы `persons`
--
ALTER TABLE `persons`
ADD CONSTRAINT `persons_ibfk_1` FOREIGN KEY (`artist_id`) REFERENCES `artists` (`artist_id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
d7732bad32bdff124c79f398ff6ec7f0ca4a4748
|
SQL
|
ljq199612/book
|
/IT/sql反模式/code/Metadata-Tribbles/anti/check-constraint.sql
|
UTF-8
| 233
| 2.6875
| 3
|
[] |
no_license
|
CREATE TABLE Bugs_2009 (
-- other columns
date_reported DATE CHECK (EXTRACT(YEAR FROM date_reported) = 2009)
);
CREATE TABLE Bugs_2010 (
-- other columns
date_reported DATE CHECK (EXTRACT(YEAR FROM date_reported) = 2010)
);
| true
|
95d3b327747d6ad08c6aaf5fbc4d9383d3e70fd6
|
SQL
|
serjivanoff/test_task
|
/src/main/resources/db/initDB_hsql.sql
|
UTF-8
| 797
| 3.90625
| 4
|
[] |
no_license
|
DROP TABLE phones IF EXISTS;
DROP TABLE clients IF EXISTS;
DROP SEQUENCE global_seq IF EXISTS;
CREATE SEQUENCE global_seq AS INTEGER START WITH 1000;
CREATE TABLE clients
(
id INTEGER GENERATED BY DEFAULT AS SEQUENCE GLOBAL_SEQ PRIMARY KEY,
first_name VARCHAR(255) NOT NULL,
middle_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL
);
CREATE TABLE phones
(
id INTEGER GENERATED BY DEFAULT AS SEQUENCE GLOBAL_SEQ PRIMARY KEY,
number VARCHAR(255) NOT NULL,
description VARCHAR(255) NOT NULL,
comments VARCHAR(255),
client_id INTEGER NOT NULL,
FOREIGN KEY ( client_id ) REFERENCES clients (id) ON DELETE CASCADE
);
CREATE UNIQUE INDEX phones_unique_client_number_idx ON phones (client_id, number)
| true
|
76fae8fb37514df817ff94e061d8baacc1b7c522
|
SQL
|
asamaei/SQL
|
/Pr1.sql
|
UTF-8
| 1,805
| 4.21875
| 4
|
[] |
no_license
|
#Questions
#Display the employee_id, last name and salary of employees earning in the range of $8000 to $15,000. Sort the output by top salaries first and then by last name.
Select employee_id,last_name,salary from employees where (salary between 8000 and 15000) order by salary,last_name
#Modify previous query (#1) so that additional condition is to display only if they work as Programmers or Sales Representatives. Same sorting as before.
Select employee_id,last_name,salary from employees where (salary between 8000 and 15000) and job_id IN ('SA_REP','IT_PROG') order by salary,last_name
#Modify previous query (#2) so that displays same job titles but for people who earn outside the given salary range. Same sorting as before.
Select employee_id,last_name,salary from employees where (salary not between 8000 and 15000) and job_id IN ('SA_REP','IT_PROG') order by salary,last_name
#Display the last name, job_id and salary of employees hired before 1998 List the most recently hired employees first.
SELECT last_name , job_id , salary
FROM employees
WHERE hire_date< '1-JAN-98'
Order by hire_date desc;
#Modify previous query (#4) so that displays only employees earning more than $10,000.List the output by job title alphabetically and then by highest paid employees.
SELECT last_name , job_id , salary
FROM employees
WHERE hire_date< '1-JAN-98' and salary > 10000
Order by job_id, hire_date desc;
#Display the job titles and full names of employees whose first name contains an ‘e’ or ‘E’ anywhere. The output should look like:
Job Title Full name
--------------------------------------
AD_VP Neena Kochhar
… more rows
SELECT job_id as "Job Title", first_name || last_name as "Full Name"
FROM employees
WHERE first_name like '%e%' or first_name like '%E%'
| true
|
2f4ea1c97a6cc61e55f14f5cc843ab30bb0d8ca4
|
SQL
|
Pedalves/WebDataTools
|
/WebCrawler/resources/schema.sql
|
UTF-8
| 465
| 3.453125
| 3
|
[] |
no_license
|
----------------------------------
-- Web Crawler
----------------------------------
CREATE TABLE IF NOT EXISTS url(
url_input TEXT PRIMARY KEY
);
CREATE TABLE IF NOT EXISTS site(
url_input TEXT,
site_name TEXT,
content TEXT DEFAULT NULL,
parent TEXT DEFAULT NULL,
PRIMARY KEY(url_input, site_name) ON CONFLICT REPLACE,
FOREIGN KEY(url_input) REFERENCES url(url_input) ON DELETE CASCADE
);
| true
|
e36d86be04142759f7a9b49d6074c333fcfac078
|
SQL
|
jlcchu/GITHUB
|
/常用SQL/24.临时空间.sql
|
GB18030
| 1,073
| 3.59375
| 4
|
[] |
no_license
|
/*ʹʱռ*/
SELECT S.sid || ',' || S.serial# sid_serial,
S.username,
T.blocks * TBS.block_size / 1024 / 1024 mb_used,
T.tablespace,
T.sqladdr address,
Q.hash_value,
Q.sql_text
FROM v$sort_usage T, v$session S, v$sqlarea Q, dba_tablespaces TBS
WHERE T.session_addr = S.saddr
AND T.sqladdr = Q.address(+)
AND T.tablespace = TBS.tablespace_name
ORDER BY S.sid;
/*Ựʹʱռ*/
SELECT S.sid || ',' || S.serial# sid_serial,
S.username,
S.osuser,
P.spid,
S.module,
S.program,
SUM(T.blocks) * TBS.block_size / 1024 / 1024 mb_used,
T.tablespace,
COUNT(*) sort_ops
FROM v$sort_usage T, v$session S, dba_tablespaces TBS, v$process P
WHERE T.session_addr = S.saddr
AND S.paddr = P.addr
AND T.tablespace = TBS.tablespace_name
GROUP BY S.sid,
S.serial#,
S.username,
S.osuser,
P.spid,
S.module,
S.program,
TBS.block_size,
T.tablespace
ORDER BY sid_serial;
| true
|
010c6ce0eb4b767c5bd88e41ccc2fd16ae1b628a
|
SQL
|
chenjs916/zan
|
/zan.sql
|
UTF-8
| 986
| 2.703125
| 3
|
[] |
no_license
|
/*
Navicat MySQL Data Transfer
Source Server : host
Source Server Version : 50525
Source Host : localhost:3306
Source Database : zan
Target Server Type : MYSQL
Target Server Version : 50525
File Encoding : 65001
Date: 2014-06-26 18:13:22
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for pic
-- ----------------------------
DROP TABLE IF EXISTS `pic`;
CREATE TABLE `pic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ding` int(11) DEFAULT '0',
`cai` int(11) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for pic_ip
-- ----------------------------
DROP TABLE IF EXISTS `pic_ip`;
CREATE TABLE `pic_ip` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`vid` int(11) DEFAULT NULL,
`ip` varchar(40) DEFAULT NULL,
`action` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=46 DEFAULT CHARSET=utf8;
| true
|
56fe2d3bf13f3f29a0bd4e28c9fab661c1fa3ddc
|
SQL
|
bluelephant72/Managing-Software-Projects-Sprint-1
|
/SQL Samples/Create database.sql
|
UTF-8
| 1,643
| 4.40625
| 4
|
[] |
no_license
|
/* This script will create the database used for the ordering system
Note that running this will delete all data in the database!
To run from phpMyAdmin, choose the "SQL" tab at the top */
-- Create the database if it doesn't exist
DROP DATABASE IF EXISTS php_srep_ordering;
CREATE DATABASE php_srep_ordering;
USE php_srep_ordering;
-- Now create the tables
CREATE TABLE customer (
cust_id int AUTO_INCREMENT,
first_name varchar(255),
last_name varchar(255),
address varchar(255),
phone varchar(255),
PRIMARY KEY (cust_id)
);
CREATE TABLE employee (
emp_id int AUTO_INCREMENT,
first_name varchar(255),
last_name varchar(255),
address varchar(255),
phone varchar(255),
PRIMARY KEY (emp_id)
);
CREATE TABLE `order` (
order_num int AUTO_INCREMENT,
order_date datetime,
cust_id int,
emp_id int,
PRIMARY KEY (order_num),
FOREIGN KEY (cust_id) REFERENCES customer(cust_id),
FOREIGN KEY (emp_id) REFERENCES employee(emp_id)
);
CREATE TABLE product_category (
category_id int AUTO_INCREMENT,
name varchar(255),
description varchar(8192),
PRIMARY KEY (category_id)
);
CREATE TABLE product (
product_id int AUTO_INCREMENT,
name varchar(255),
description varchar(8192),
price decimal(12,2),
stock_count int,
category_id int,
PRIMARY KEY (product_id),
FOREIGN KEY (category_id) REFERENCES product_category(category_id)
);
CREATE TABLE order_detail (
order_num int,
product_id int,
quantity int,
sale_price decimal(12,2),
PRIMARY KEY (order_num, product_id),
FOREIGN KEY (order_num) REFERENCES `order`(order_num),
FOREIGN KEY (product_id) REFERENCES product(product_id)
);
| true
|
906ed8e647892e8e78f1c71fb0b2c84bdf223389
|
SQL
|
bhanueve/IITM3
|
/dbms/w3_pa_1.sql
|
UTF-8
| 465
| 3.84375
| 4
|
[] |
no_license
|
create view host_teams_new as
select host_team_id, count(*)
from matches
group by host_team_id;
create view guest_teams_new as
select guest_team_id, count(*)
from matches
group by guest_team_id;
create view team_ids as
select host_team_id
from host_teams_new as ht inner join guest_teams_new as gt on ht.host_team_id = gt.guest_team_id
where ht.count + gt.count > 3;
select teams.name
from teams inner join team_ids on teams.team_id = team_ids.host_team_id;
| true
|
bd1b965df4f05d39b39ba6287e1bcf43885f95c8
|
SQL
|
sid10on10/fastadb-indexer
|
/schema/Fastadb-Schema-1.0.0-PostgreSQL.sql
|
UTF-8
| 3,162
| 3.46875
| 3
|
[] |
no_license
|
--
-- Created by SQL::Translator::Producer::PostgreSQL
-- Created on Wed Feb 14 13:06:25 2018
--
--
-- Table: division
--
DROP TABLE division CASCADE;
CREATE TABLE division (
division_id bigserial NOT NULL,
division character varying(256) NOT NULL,
PRIMARY KEY (division_id),
CONSTRAINT division_uniq UNIQUE (division)
);
--
-- Table: mol_type
--
DROP TABLE mol_type CASCADE;
CREATE TABLE mol_type (
mol_type_id bigserial NOT NULL,
type character varying(256) NOT NULL,
PRIMARY KEY (mol_type_id),
CONSTRAINT mol_type_uniq UNIQUE (type)
);
--
-- Table: seq
--
DROP TABLE seq CASCADE;
CREATE TABLE seq (
seq_id bigserial NOT NULL,
seq text NOT NULL,
md5 character(32) NOT NULL,
sha1 character(40) NOT NULL,
sha256 character(64) NOT NULL,
sha512 character(128) NOT NULL,
size bigint NOT NULL,
circular integer DEFAULT 0 NOT NULL,
PRIMARY KEY (seq_id),
CONSTRAINT seq_sha256_uniq UNIQUE (sha256)
);
CREATE INDEX md5_idx on seq (md5);
CREATE INDEX sha1_idx on seq (sha1);
CREATE INDEX sha512_idx on seq (sha512);
--
-- Table: species
--
DROP TABLE species CASCADE;
CREATE TABLE species (
species_id bigserial NOT NULL,
species character varying(256) NOT NULL,
assembly character varying(256) NOT NULL,
PRIMARY KEY (species_id),
CONSTRAINT species_uniq UNIQUE (species, assembly)
);
--
-- Table: release
--
DROP TABLE release CASCADE;
CREATE TABLE release (
release_id bigserial NOT NULL,
release bigint NOT NULL,
division_id bigint NOT NULL,
species_id bigint NOT NULL,
PRIMARY KEY (release_id),
CONSTRAINT release_uniq UNIQUE (release, division_id, species_id)
);
CREATE INDEX release_idx_division_id on release (division_id);
CREATE INDEX release_idx_species_id on release (species_id);
--
-- Table: molecule
--
DROP TABLE molecule CASCADE;
CREATE TABLE molecule (
molecule_id bigserial NOT NULL,
seq_id bigint NOT NULL,
release_id bigint NOT NULL,
id character varying(128) NOT NULL,
first_seen integer NOT NULL,
mol_type_id bigint NOT NULL,
version smallint,
PRIMARY KEY (molecule_id),
CONSTRAINT molecule_uniq UNIQUE (id, mol_type_id)
);
CREATE INDEX molecule_idx_mol_type_id on molecule (mol_type_id);
CREATE INDEX molecule_idx_release_id on molecule (release_id);
CREATE INDEX molecule_idx_seq_id on molecule (seq_id);
--
-- Foreign Key Definitions
--
ALTER TABLE release ADD CONSTRAINT release_fk_division_id FOREIGN KEY (division_id)
REFERENCES division (division_id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
ALTER TABLE release ADD CONSTRAINT release_fk_species_id FOREIGN KEY (species_id)
REFERENCES species (species_id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
ALTER TABLE molecule ADD CONSTRAINT molecule_fk_mol_type_id FOREIGN KEY (mol_type_id)
REFERENCES mol_type (mol_type_id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
ALTER TABLE molecule ADD CONSTRAINT molecule_fk_release_id FOREIGN KEY (release_id)
REFERENCES release (release_id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
ALTER TABLE molecule ADD CONSTRAINT molecule_fk_seq_id FOREIGN KEY (seq_id)
REFERENCES seq (seq_id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
| true
|
d50836764036bc56846ae232af3f65864055a666
|
SQL
|
nastyakorotkova/import_transactions
|
/02-t_dict.sql
|
UTF-8
| 380
| 2.9375
| 3
|
[] |
no_license
|
declare
vn integer := 0;
begin
select count(1) into vn from dual where exists (select 1 from user_objects where object_type = 'TABLE' and object_name = 'T_DICT');
if vn = 0 then
execute immediate '
create table T_DICT
(
keyid INTEGER not null,
dt DATE not null,
amount FLOAT not null,
state INTEGER default 0
)';
end if;
end;
/
| true
|
e765e1c5551fb5295088c2412b7b625df33a5d97
|
SQL
|
clairblacketer/Phenotype_Data_Acquisition
|
/ExtractScripts/N3C_extract_V1_0_omop_oracle.sql
|
UTF-8
| 14,913
| 3.921875
| 4
|
[] |
no_license
|
--OMOP v5.3.1 extraction code for N3C
--Written by Kristin Kostka, OHDSI
--Code written for Oracle
--This extract purposefully excludes the following OMOP tables: PERSON, OBSERVATION_PERIOD, VISIT_OCCURRENCE, CONDITION_OCCURRENCE, DRUG_EXPOSURE, PROCEDURE_OCCURRENCE, MEASUREMENT, OBSERVATION, LOCATION, CARE_SITE, PROVIDER,
--Currently this script extracts the derived tables for DRUG_ERA, DOSE_ERA, CONDITION_ERA as well (could be modified we run these in Palantir instead)
--Assumptions:
-- 1. You have already built the N3C_COHORT table (with that name) prior to running this extract
-- 2. You are extracting data with a lookback period to 1-1-2018
-- To run, you will need to find and replace @cdm_database_schema with your local OMOP schema details
--PERSON
--OUTPUT_FILE: PERSON.csv
SELECT
PERSON_ID,
GENDER_CONCEPT_ID,
YEAR_OF_BIRTH,
MONTH_OF_BIRTH,
RACE_CONCEPT_ID,
ETHNICITY_CONCEPT_ID,
LOCATION_ID,
PROVIDER_ID,
CARE_SITE_ID,
PERSON_SOURCE_VALUE,
GENDER_SOURCE_VALUE,
RACE_SOURCE_VALUE,
RACE_SOURCE_CONCPT_ID,
ETHNICITY_SOURCE_VALUE,
ETHNICITY_SOURCE_CONCEPT_ID,
FROM @cdm_database_schema.PERSON p
JOIN @cdm_database_schema.N3C_COHORT n
ON p.PERSON.PERSON_ID = n.N3C_COHORT.PERSON_ID;
--OBSERVATION_PERIOD
--OUTPUT_FILE: OBSERVATION_PERIOD.csv
SELECT
OBSERVATION_PERIOD_ID,
PERSON_ID,
TO_CHAR(OBSERVATION_PERIOD_START_DATE, 'YYYY-MM-DD HH24:MI:SS') as OBSERVATION_PERIOD_START_DATE,
TO_CHAR(OBSERVATION_PERIOD_END_DATE, 'YYYY-MM-DD HH24:MI:SS') as OBSERVATION_PERIOD_END_DATE,
PERIOD_TYPE_CONCEPT_ID,
FROM @cdm_database_schema.OBSERVATION_PERIOD p
JOIN @cdm_database_schema.N3C_COHORT n
ON p.PERSON_ID = n.PERSON_ID;
--VISIT_OCCURRENCE
--OUTPUT_FILE: VISIT_OCCURRENCE.csv
SELECT
VISIT_OCCURRENCE_ID,
PERSON_ID,
VISIT_CONCEPT_ID,
TO_CHAR(VISIT_START_DATE, 'YYYY-MM-DD HH24:MI:SS') as VISIT_START_DATE,
TO_CHAR(VISIT_START_DATETIME, 'YYYY-MM-DD HH24:MI:SS') as VISIT_START_DATETIME,
TO_CHAR(VISIT_END_DATE, 'YYYY-MM-DD HH24:MI:SS') as VISIT_END_DATE,
TO_CHAR(VISIT_END_DATETIME, 'YYYY-MM-DD HH24:MI:SS') as VISIT_END_DATETIME,
VISIT_TYPE_CONCEPT_ID,
PROVIDER_ID,
CARE_SITE_ID,
VISIT_SOURCE_VALUE,
VISIT_SOURCE_CONCEPT_ID,
ADMITTING_SOURCE_CONCEPT_ID,
ADMITTING_SOURCE_VALUE,
DISCHARGE_TO_CONCEPT_ID,
DISCHARGE_TO_SOURCE_VALUE,
PRECEDING_VISIT_OCCURRENCE_ID,
FROM @cdm_database_schema.VISIT_OCCURRENCE v
JOIN @cdm_database_schema.N3C_COHORT n
ON v.PERSON_ID = n.PERSON_ID
WHERE v.VISIT_START_DATE >= '01-JAN-2018';
--CONDITION_OCCURRENCE
--OUTPUT_FILE: CONDITION_OCCURRENCE.csv
SELECT
CONDITION_OCCURRENCE_ID,
PERSON_ID,
CONDITION_CONCEPT_ID,
TO_CHAR(CONDITION_START_DATE, 'YYYY-MM-DD HH24:MI:SS') as CONDITION_START_DATE,
TO_CHAR(CONDITION_START_DATETIME, 'YYYY-MM-DD HH24:MI:SS') as CONDITION_START_DATETIME,
TO_CHAR(CONDITION_END_DATE, 'YYYY-MM-DD HH24:MI:SS') as CONDITION_END_DATE,
TO_CHAR(CONDITON_END_DATETIME, 'YYYY-MM-DD HH24:MI:SS') as CONDITION_END_DATETIME,
CONDITION_TYPE_CONCEPT_ID,
CONDITION_STATUS_CONCEPT_ID,
STOP_REASON,
VISIT_OCCURRENCE_ID,
VISIT_DETAIL_ID,
CONDITION_SOURCE_VALUE,
CONDITION_SOURCE_CONCEPT_ID,
CONDITON_STATUS_SOURCE_VALUE,
FROM @cdm_database_schema.CONDITION_OCCURRENCE co
JOIN @cdm_database_schema.N3C_COHORT n
ON CO.person_id = n.person_id
WHERE co.CONDITION_START_DATE >= '01-JAN-2018'; --changed from report_date
--DRUG_EXPOSURE
--OUTPUT_FILE: DRUG_EXPOSURE.csv
SELECT
DRUG_EXPOSURE_ID,
PERSON_ID,
DRUG_CONCEPT_ID,
TO_CHAR(DRUG_EXPOSURE_START_DATE, 'YYYY-MM-DD HH24:MI:SS') as DRUG_EXPOSURE_START_DATE,
TO CHAR(DRUG_EXPOSURE_START_DATETIME, 'YYYY-MM-DD HH24:MI:SS') as DRUG_EXPOSURE_START_DATETIME,
TO CHAR(DRUG_EXPOSURE_END_DATE, 'YYYY-MM-DD HH24:MI:SS') as DRUG_EXPOSURE_END_DATE,
TO CHAR(DRUG_EXPOSURE_END_DATETIME, 'YYYY-MM-DD HH24:MI:SS') as DRUG_EXPOSURE_END_DATETIME,
DRUG_TYPE_CONCEPT_ID,
STOP_REASON,
REFILLS,
QUANTITY,
DAYS_SUPPLY,
SIG,
ROUTE_CONCEPT_ID,
LOT_NUMBER,
PROVIDER_ID,
VISIT_OCCURRENCE_ID,
VISIT_DETAIL_ID,
DRUG_SOURCE_VALUE,
DRUG_SOURCE_CONCEPT_ID,
ROUTE_SOURCE_VALUE,
DOSE_UNIT_SOURCE_VALUE,
FROM @cdm_database_schema.DRUG_EXPOSURE de
JOIN @cdm_database_schema.N3C_COHORT n
ON de.PERSON_ID = n.PERSON_ID
WHERE de.DRUG_EXPOSURE_START_DATE >= '01-JAN-2018';
--PROCEDURE_OCCURRENCE
--OUTPUT_FILE: PROCEDURE_OCCURRENCE.csv
SELECT
PROCEDURE_OCCURRENCE_ID,
PERSON_ID,
PROCEDURE_CONCEPT_ID,
TO_CHAR(PROCEDURE_DATE, 'YYYY-MM-DD HH24:MI:SS') as PROCEDURE_DATE,
TO_CHAR(PROCEDURE_DATETIME, 'YYYY-MM-DD HH24:MI:SS') as PROCEDURE_DATETIME,
PROCEDURE_TYPE_CONCEPT_ID,
MODIFIER_CONCEPT_ID,
QUANTITY,
PROVIDER_ID,
VISIT_OCCURRENCE_ID,
VISIT_DETAIL_ID,
PROCEDURE_SOURCE_VALUE,
PROCEDURE_SOURCE_CONCEPT_ID,
MODIFIER_SOURCE_VALUE
FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po
JOIN @cdm_database_schema.N3C_COHORT n
ON PO.PERSON_ID = N.PERSON_ID
WHERE po.PROCEDURE_DATE >= '01-JAN-2018';
--MEASUREMENT
--OUTPUT_FILE: MEASUREMENT.csv
SELECT
MEASUREMENT_ID,
PERSON_ID,
MEASUREMENT_CONCEPT_ID,
TO_CHAR(MEASUREMENT_DATE, 'YYYY-MM-DD HH24:MI:SS') as MEASUREMENT_DATE,
TO_CHAR(MEASUREMENT_DATETIME, 'YYYY-MM-DD HH24:MI:SS') as MEASUREMENT_DATETIME,
MEASUREMENT_TIME,
MEASUREMENT_TYPE_CONCEPT_ID,
OPERATOR_CONCEPT_ID,
VALUE_AS_NUMBER,
VALUE_AS_CONCEPT_ID,
UNIT_CONCEPT_ID,
RANGE_LOW,
RANGE_HIGH,
PROVIDER_ID,
VISIT_OCCURRENCE_ID,
VISIT_DETAIL_ID,
MEASUREMENT_SOURCE_VALUE,
MEASUREMENT_SOURCE_CONCEPT_ID,
UNIT_SOURCE_VALUE,
VALUE_SOURCE_VALUE
FROM @cdm_database_schema.MEASURMENT m
JOIN N3C_COHORT n
ON M.PERSON_ID = N.PERSON_ID
WHERE m.MEASUREMENT_DATE >= '01-JAN-2018';
--OBSERVATION
--OUTPUT_FILE: OBSERVATION.csv
SELECT
OBSERVATION_ID,
PERSON_ID,
OBSERVATION_CONCEPT_ID,
TO_CHAR(OBSERVATION_DATE, 'YYYY-MM-DD HH24:MI:SS') as OBSERVATION_DATE,
TO_CHAR(OBSERVATION_DATETIME, 'YYYY-MM-DD HH24:MI:SS') as OBSERVATION_DATETIME,
OBSERVATION_TYPE_CONCEPT_ID,
VALUE_AS_NUMBER,
VALUE_AS_STRING,
VALUE_AS_CONCEPT_ID,
QUALIFIER_CONCEPT_ID,
UNIT_CONCEPT_ID,
PROVIDER_ID,
VISIT_OCCURRENCE_ID,
VISIT_DETAIL_ID,
OBSERVATION_SOURCE_VALUE,
OBSERVATION_SOURCE_CONCEPT_ID,
UNIT_SOURCE_VALUE,
QUALIFIER_SOURCE_VALUE
FROM @cdm_database_schema.OBSERVATION o
JOIN @cdm_database_schema.N3C_COHORT n
ON O.PERSON_ID = N.PERSON_ID
WHERE o.OBSERVATION_DATE >= '01-JAN-2018';
--LOCATION
--OUTPUT_FILE: LOCATION.csv
SELECT
LOCATION_ID,
null as ADDRESS_1, -- to avoid identifying information
null as ADDRESS_2, -- to avoid identifying information
CITY,
STATE,
ZIP,
COUNTY,
LOCATION_SOURCE_VALUE,
FROM @cdm_database_schema.LOCATION l
JOIN (
SELECT DISTINCT cs.LOCATION_ID
FROM @cdm_database_schema.VISIT_OCCURRENCE vo
JOIN @cdm_database_schema.N3C_COHORT n
ON vo.person_id = n.person_id
JOIN @cdm_database_schema.CARE_SITE cs
ON vo.care_site_id = cs.care_site_id
UNION
SELECT DISTINCT p.LOCATION_ID
FROM @cdm_database_schema.PERSON p
JOIN @cdm_database_schema.N3C_COHORT n
ON p.person_id = n.person_id
) a
ON l.location_id = a.location_id
;
--CARE_SITE
--OUTPUT_FILE: CARE_SITE.csv
SELECT
CARE_SITE_ID,
CARE_SITE_NAME,
PLACE_OF_SERVICE_CONCEPT_ID,
LOCATION_ID,
CARE_SITE_SOURCE_VALUE,
PLACE_OF_SERVICE_SOURCE_VALUE,
FROM @cdm_database_schema.CARE_SITE cs
JOIN (
SELECT DISTINCT CARE_SITE_ID
FROM @cdm_database_schema.VISIT_OCCURRENCE vo
JOIN @cdm_database_schema.N3C_COHORT n
ON vo.person_id = n.person_id
) a
ON cs.CARE_SITE_ID = a.CARE_SITE_ID
;
--PROVIDER
--OUTPUT_FILE: PROVIDER.csv
SELECT
PROVIDER_ID,
null as PROVIDER_NAME, -- to avoid accidentally identifying sites
null as NPI, -- to avoid accidentally identifying sites
null as DEA, -- to avoid accidentally identifying sites
SPECIALTY_CONCEPT_ID,
CARE_SITE_ID,
null as YEAR_OF_BIRTH,
GENDER_CONCEPT_ID,
null as PROVIDER_SOURCE_VALUE, -- to avoid accidentally identifying sites
SPECIALTY_SOURCE_VALUE,
SPECIALTY_SOURCE_CONCEPT_ID,
GENDER_SOURCE_VALUE,
GENDER_SOURCE_CONCEPT_ID
FROM @cdm_database_schema.PROVIDER pr
JOIN (
SELECT DISTINCT PROVIDER_ID
FROM @cdm_database_schema.VISIT_OCCURRENCE vo
JOIN @cdm_database_schema.N3C_COHORT n
ON vo.PERSON_ID = n.PERSON_ID
UNION
SELECT DISTINCT PROVIDER_ID
FROM @cdm_database_schema.DRUG_EXPOSURE de
JOIN @cdm_database_schema.N3C_COHORT n
ON de.PERSON_ID = n.PERSON_ID
UNION
SELECT DISTINCT PROVIDER_ID
FROM @cdm_database_schema.MEASUREMENT m
JOIN @cdm_database_schema.N3C_COHORT n
ON m.PERSON_ID = n.PERSON_ID
UNION
SELECT DISTINCT PROVIDER_ID
FROM @cdm_database_schema.PROCEDURE_OCCURRENCE po
JOIN @cdm_database_schema.N3C_COHORT n
ON po.PERSON_ID = n.PERSON_ID
UNION
SELECT DISTINCT PROVIDER_ID
FROM @cdm_database_schema.OBSERVATION o
JOIN @cdm_database_schema.N3C_COHORT n
ON o.PERSON_ID = n.PERSON_ID
) a
ON pr.PROVIDER_ID = a.PROVIDER_ID
;
--Note: it has yet to be decided if Era tables will be constructured downstream in Palantir platform.
-- If it is decided that eras will be reconstructed, these three tables will be omitted.
--DRUG_ERA
--OUTPUT_FILE: DRUG_ERA.csv
SELECT
DRUG_ERA_ID,
PERSON_ID,
DRUG_CONCEPT_ID,
TO_CHAR(DRUG_ERA_START_DATE, 'YYYY-MM-DD HH24:MI:SS') as DRUG_ERA_START_DATE,
TO_CHAR(DRUG_ERA_END_DATE, 'YYYY-MM-DD HH24:MI:SS') as DRUG_ERA_END_DATE,
DRUG_EXPOSURE_COUNT,
GAP_DAYS
FROM @cdm_database_schema.DRUG_ERA dre
JOIN @cdm_database_schema.N3C_COHORT n
ON DRE.PERSON_ID = N.PERSON_ID
WHERE DRUG_ERA_START_DATE >= '01-JAN-2018';
--DOSE_ERA
--OUTPUT_FILE: DOSE_ERA.csv
SELECT
DOSE_ERA_ID,
PERSON_ID,
DRUG_CONCEPT_ID,
UNIT_CONCEPT_ID,
DOSE_VALUE,
TO_CHAR(DOSE_ERA_START_DATE, 'YYYY-MM-DD HH24:MI:SS') as DOSE_ERA_START_DATE,
TO_CHAR(DOSE_ERA_END_DATE, 'YYYY-MM-DD HH24:MI:SS') as DOSE_ERA_END_DATE,
FROM @cdm_database_schema.DOSE_ERA do JOIN @cdm_database_schema.N3C_COHORT n ON DO.PERSON_ID = N.PERSON_ID
WHERE DOSE_ERA_START_DATE >= '01-JAN-2018';
--CONDITION_ERA
--OUTPUT_FILE: CONDITION_ERA.csv
SELECT
CONDITION_ERA_ID,
PERSON_ID,
CONDITION_CONCEPT_ID,
TO_CHAR(CONDITON_ERA_START_DATE, 'YYYY-MM-DD HH24:MI:SS') as CONDITION_ERA_START_DATE,
TO_CHAR(CONDITION_ERA_END_DATE, 'YYYY-MM-DD HH24:MI:SS') as CONDITION_ERA_END_DATE,
CONDITION_OCCURRENCE_COUNT
FROM @cdm_database_schema.CONDITION_ERA ce JOIN @cdm_database_schema.N3C_COHORT n ON CE.PERSON_ID = N.PERSON_ID
WHERE CONDITION_ERA_START_DATE >= '01-JAN-2018';
--DATA_COUNTS TABLE
--OUTPUT_FILE: DATA_COUNTS.csv
SELECT * from
(select
'PERSON' as TABLE_NAME,
(select count(*) from PERSON JOIN N3C_COHORT ON PERSON.PERSON_ID = N3C_COHORT.PERSON_ID) as ROW_COUNT
from DUAL
UNION
select
'OBSERVATION_PERIOD' as TABLE_NAME,
(select count(*) from OBSERVATION_PERIOD JOIN N3C_COHORT ON OBSERVATION_PERIOD.PERSON_ID = N3C_COHORT.PERSON_ID AND OBSERVATION_PERIOD_START_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL
UNION
select
'VISIT_OCCURRENCE' as TABLE_NAME,
(select count(*) from VISIT_OCCURRENCE JOIN N3C_COHORT ON VISIT_OCCURRENCE.PERSON_ID = N3C_COHORT.PERSON_ID AND VISIT_START_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL
UNION
select
'CONDITION_OCCURRENCE' as TABLE_NAME,
(select count(*) from CONDITION_OCCURRENCE JOIN N3C_COHORT ON CONDITION_OCCURRENCE.PERSON_ID = N3C_COHORT.PERSON_ID AND CONDITION_START_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL
UNION
select
'DRUG_EXPOSURE' as TABLE_NAME,
(select count(*) from DRUG_EXPOSURE JOIN N3C_COHORT ON DRUG_EXPOSURE.PERSON_ID = N3C_COHORT.PERSON_ID AND DRUG_EXPOSURE_START_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL
UNION
select
'PROCEDURE_OCCURRENCE' as TABLE_NAME,
(select count(*) from PROCEDURE_OCCURRENCE JOIN N3C_COHORT ON PROCEDURE_OCCURRENCE.PERSON_ID = N3C_COHORT.PERSON_ID AND PROCEDURE_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL
UNION
select
'MEASUREMENT' as TABLE_NAME,
(select count(*) from MEASUREMENT JOIN N3C_COHORT ON MEASUREMENT.PERSON_ID = N3C_COHORT.PERSON_ID AND MEASUREMENT_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL
UNION
select
'OBSERVATION' as TABLE_NAME,
(select count(*) from OBSERVATION JOIN N3C_COHORT ON OBSERVATION.PERSON_ID = N3C_COHORT.PERSON_ID AND OBSERVATION_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL
UNION
--OMOP does not have PERSON_ID for Location, Care Site and Provider tables so we need to determine the applicability of this check
--We could re-engineer the cohort table to include the JOIN variables
select
'LOCATION' as TABLE_NAME,
(select count(*) from LOCATION) as ROW_COUNT
from DUAL
UNION
select
'CARE_SITE' as TABLE_NAME,
(select count(*) from CARE_SITE) as ROW_COUNT
from DUAL
UNION
select
'PROVIDER' as TABLE_NAME,
(select count(*) from PROVIDER) as ROW_COUNT
from DUAL
UNION
select
'DRUG_ERA' as TABLE_NAME,
(select count(*) from DRUG_ERA JOIN N3C_COHORT ON DRUG_ERA.PERSON_ID = N3C_COHORT.PERSON_ID AND DRUG_ERA_START_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL
UNION
select
'DOSE_ERA' as TABLE_NAME,
(select count(*) from DOSE_ERA JOIN N3C_COHORT ON DOSE_ERA.PERSON_ID = N3C_COHORT.PERSON_ID AND DOSE_ERA_START_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL
UNION
select
'CONDITION_ERA' as TABLE_NAME,
(select count(*) from CONDITION_ERA JOIN N3C_COHORT ON CONDITION_ERA.PERSON_ID = N3C_COHORT.PERSON_ID AND CONDITION_ERA_START_DATE >= '01-JAN-2018') as ROW_COUNT
from DUAL);
--MANIFEST TABLE: CHANGE PER YOUR SITE'S SPECS
--OUTPUT_FILE: MANIFEST.csv
select
'OHDSI' as SITE_ABBREV,
'Jane Doe' as CONTACT_NAME,
'jane_doe@OHDSI.edu' as CONTACT_EMAIL,
'OMOP' as CDM_NAME,
'5.3.1' as CDM_VERSION,
'Y' as N3C_PHENOTYPE_YN,
'1.3' as N3C_PHENOTYPE_VERSION,
TO_CHAR(sysdate, 'YYYY-MM-DD HH24:MI:SS') as RUN_DATE,
TO_CHAR(sysdate -2, 'YYYY-MM-DD HH24:MI:SS') as UPDATE_DATE, --change integer based on your site's data latency
TO_CHAR(sysdate +3, 'YYYY-MM-DD HH24:MI:SS') as NEXT_SUBMISSION_DATE --change integer based on your site's load frequency
from dual;
| true
|
e3347b85d30b83cf03f5d42ccf95dfe5cba0602f
|
SQL
|
ANamelessWolf/avalon
|
/shimazu/documentation/SQL/[10][TABLE]avances.sql
|
UTF-8
| 852
| 3.140625
| 3
|
[
"MIT"
] |
permissive
|
CREATE TABLE IF NOT EXISTS `cdmx_obras`.`avances` (
`clv_avance` INT NOT NULL AUTO_INCREMENT,
`id_captura` INT NOT NULL,
`clv_partida` INT NOT NULL,
`avance_programado` DOUBLE NOT NULL DEFAULT -1,
`avance_fisico` DOUBLE NOT NULL DEFAULT -1,
`avance_financiero` DOUBLE NOT NULL DEFAULT -1,
PRIMARY KEY (`clv_avance`),
UNIQUE INDEX `clv_avance_UNIQUE` (`clv_avance` ASC),
INDEX `fk_avances_historicos_idx` (`id_captura` ASC),
INDEX `fk_avances_partidas_idx` (`clv_partida` ASC),
CONSTRAINT `fk_avances_historicos`
FOREIGN KEY (`id_captura`)
REFERENCES `cdmx_obras`.`historicos` (`id_captura`)
ON DELETE CASCADE
ON UPDATE NO ACTION,
CONSTRAINT `fk_avances_partidas`
FOREIGN KEY (`clv_partida`)
REFERENCES `cdmx_obras`.`partidas` (`clv_partida`)
ON DELETE CASCADE
ON UPDATE NO ACTION)
ENGINE = InnoDB
| true
|
25766fe244f728bfbe9ad87f6e02df90d06129be
|
SQL
|
moonserk/uneftnetgrafautomat
|
/sql/dp/unbroken_begin.sql
|
WINDOWS-1251
| 1,191
| 3.25
| 3
|
[] |
no_license
|
select
nvl(count(v.well_name),0) AS "",
nvl(sum(v.or_bs),0) AS ""
from fo_hist_oil_day v
where v.REGION_NAME = ' ""'
and trunc(v.dt) = trunc(to_date('##.##.####', 'dd.mm.yyyy'),'mm')
and v.state_rem = ''
and v.dt between trunc(to_date('##.##.####', 'dd.mm.yyyy')-2,'mm') and trunc(to_date('##.##.####', 'dd.mm.yyyy'),'mm')
union all
select
nvl(count(v.well_name),0) AS "",
nvl(sum(v.or_bs),0) AS ""
from fo_hist_oil_day v
where v.REGION_NAME = ' ""'
and trunc(v.dt) = trunc(to_date('##.##.####', 'dd.mm.yyyy'),'mm')
and v.state_rem = ''
and v.dt between trunc(to_date('##.##.####', 'dd.mm.yyyy')-2,'mm') and trunc(to_date('##.##.####', 'dd.mm.yyyy'),'mm')
union all
select
nvl(count(v.well_name),0) AS "",
nvl(sum(v.or_bs),0) AS ""
from fo_hist_oil_day v
where v.REGION_NAME = ' ""'
and trunc(v.dt) = trunc(to_date('##.##.####', 'dd.mm.yyyy'),'mm')
and v.state_rem = ''
and v.dt between trunc(to_date('##.##.####', 'dd.mm.yyyy')-2,'mm') and trunc(to_date('##.##.####', 'dd.mm.yyyy'),'mm')
| true
|
c914b948294c1284e270d39cb64142104f6690c3
|
SQL
|
jonorton66/sql
|
/CycleTimes.sql
|
UTF-8
| 733
| 3.578125
| 4
|
[] |
no_license
|
--:CONNECT 192.168.230.228 -U qa -P qa
SELECT DISTINCT AA.PR_Production_Order, AA.PR_Blend_Code, AA.PR_Sec_Out_Prev_Time
FROM sl_PR_Data AA
INNER JOIN
(SELECT DISTINCT PR_Production_Order, MAX(PR_Sec_Out_Prev_Time) AS MaxCycleTime
FROM sl_PR_Data
GROUP BY PR_Production_Order) groupedAA
ON AA.PR_Production_Order = groupedAA.PR_Production_Order
AND AA.PR_Sec_Out_Prev_Time = groupedAA.MaxCycleTime
--WHERE AA.PR_OB_Name = 'PR_SEC_OUT' AND AA.PR_Production_Order >= '7149' AND AA.PR_Production_Order <= '9999'
WHERE AA.PR_OB_Name = 'PR_SEC_OUT' AND AA.PR_DateTime >= '2017-01-01' AND AA.PR_DateTime <= '2017-05-31' AND AA.PR_Production_Order <= '9999' AND PR_Blend_Code = '632'
ORDER BY AA.PR_Production_Order ASC
| true
|
8aa52ed7f19a53cc0db8f03bcb150462888a885c
|
SQL
|
albrimpaqarizi/PHP-Simple-Project
|
/mydb.sql
|
UTF-8
| 4,217
| 3.03125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 01, 2019 at 07:02 PM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `mydb`
--
-- --------------------------------------------------------
--
-- Table structure for table `contact`
--
CREATE TABLE `contact` (
`contactID` int(11) NOT NULL,
`fullname` varchar(255) NOT NULL,
`email` varchar(255) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`comments` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `contact`
--
INSERT INTO `contact` (`contactID`, `fullname`, `email`, `country`, `comments`) VALUES
(2, 'Albrim Paqarizi', 'albrimpa@outlook.com', ' albania,kosovo ', 'test1');
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`postID` int(11) NOT NULL,
`title` varchar(50) DEFAULT NULL,
`description` text DEFAULT NULL,
`imagee` longblob DEFAULT NULL,
`created_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `posts`
--
INSERT INTO `posts` (`postID`, `title`, `description`, `imagee`, `created_at`) VALUES
(1, 'BMW M7', 'There are many variations of passages of Ipsum available, but the majority have suffered alteration in some form, by injected humour', 0x626d772e6a706567, '2019-06-18 23:36:22'),
(2, 'Lamborghini Urus', 'Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur.', 0x6c616d626f726768696e692e6a7067, '2019-06-18 23:49:01'),
(3, 'Mercedes Benz', ' The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using \'Content here, content here', 0x6d657263656465732d732d636c6173732e6a706567, '2019-06-18 23:53:16'),
(4, 'Audi R8', ' It was popularised in the 1960s with the release of Letraset sheets containing', 0x617564692e6a7067, '2019-06-18 23:54:58'),
(5, 'Ford TT', 'There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form', 0x666f72642e6a7067, '2019-06-18 23:55:41');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(6) UNSIGNED NOT NULL,
`firstname` varchar(30) NOT NULL,
`lastname` varchar(30) NOT NULL,
`bday` date DEFAULT NULL,
`gender` varchar(30) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`rolet` varchar(30) DEFAULT NULL,
`password` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `firstname`, `lastname`, `bday`, `gender`, `email`, `rolet`, `password`) VALUES
(1, 'Albrim', 'Paqarizi', '1998-01-10', 'male', 'albrimpa@gmail.com', 'admin', '54b8b90ad6a3802c2cca7c2d08b2ebd0'),
(3, 'filan', 'fisteku', '1999-11-11', 'male', 'filan@gmail.com', 'guest', '54206b04a0f71b5a6e77dcf484d4d90f');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `contact`
--
ALTER TABLE `contact`
ADD PRIMARY KEY (`contactID`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`postID`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `contact`
--
ALTER TABLE `contact`
MODIFY `contactID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `postID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(6) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
9363ea977f079cdc3fedfff7136c0d21ba8dc26a
|
SQL
|
binary-machinery/ochoba_data_mining
|
/sql/user_queries.sql
|
UTF-8
| 1,551
| 3.921875
| 4
|
[] |
no_license
|
-- user count
select count(*) from users;
-- an amount of "Дерьмак"-like names (local recurring meme)
select count(*) from users
where lower(name) like '%дерьмак%';
-- unique "Дерьмак"-like names
select distinct name from users
where lower(name) like '%дерьмак%';
-- sort by rating
select karma, name, entries_count, comments_count
from users
order by karma desc;
-- user count with negative rating
select count(*)
from users
where karma < 0;
-- sort by rating (negative)
select karma, name, entries_count, comments_count
from users
order by karma;
-- sort by subscriber count
select subscribers_count, name, karma, entries_count, comments_count from users
order by subscribers_count desc;
-- sort by entries count
select entries_count, name, karma
from users
order by entries_count desc;
-- sort by comments count
select comments_count, name, karma
from users
order by comments_count desc;
-- sort by favourites count
select favorites_count, name, karma from users
order by favorites_count desc;
-- sort by rating efficiency
select karma / (entries_count + comments_count) karma_efficiency, name, karma, entries_count, comments_count
from users
where entries_count + comments_count != 0
order by karma_efficiency desc;
-- verified accounts
select count(*) from users
where is_verified = true;
select name, created, karma, entries_count, comments_count from users
where is_verified = true
order by id;
-- error count by error code
select status_code, count(*) from user_errors
group by status_code;
| true
|
595174bc89f01fd9606eecc525edeb780e52eb1d
|
SQL
|
AkishinoShiame/OpenFreePay
|
/server/s-services/sql/market.sql
|
UTF-8
| 458
| 2.765625
| 3
|
[] |
no_license
|
DROP TABLE market;
CREATE TABLE market(
order_id int not null primary key AUTO_INCREMENT, #會在我的出價用到
date date not null default now(),
user_id int not null,
src_point_type text not null,
dest_point_type text not null,
revision_times int not null default 0,
src_bid_points double not null,
dest_ask_points double not null,
username varchar(100) not null,
status bool not null default false #訂單狀態
);
| true
|
9ce63e5ee968cdfc307acffa798299e07b91daf7
|
SQL
|
java8-course/sql
|
/src/main/resources/db/h2/V1__Create_schema.sql
|
UTF-8
| 1,535
| 3.953125
| 4
|
[] |
no_license
|
DROP SCHEMA IF EXISTS test_schema;
CREATE SCHEMA test_schema;
SET SCHEMA test_schema;
CREATE SEQUENCE person_seq START WITH 1000;
CREATE TABLE person (
person_id INTEGER NOT NULL,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
age INTEGER NOT NULL,
PRIMARY KEY (person_id),
UNIQUE (email)
);
CREATE SEQUENCE employee_seq START WITH 1000;
CREATE TABLE employee (
employee_id INTEGER PRIMARY KEY,
person_id INTEGER NOT NULL,
FOREIGN KEY (person_id) REFERENCES person (person_id)
);
CREATE TABLE position (
position_code VARCHAR(64) PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description VARCHAR(255)
);
CREATE TABLE employer (
employer_code VARCHAR(64) PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description VARCHAR(255)
);
CREATE TABLE job_history (
employee_id INTEGER NOT NULL,
-- position_code VARCHAR(64),
employer_code VARCHAR(64) NOT NULL,
duration INTEGER,
-- FOREIGN KEY (position_code) REFERENCES position(position_code),
FOREIGN KEY (employer_code) REFERENCES employer (employer_code),
FOREIGN KEY (employee_id) REFERENCES employee (employee_id)
);
ALTER TABLE job_history
ADD COLUMN position_code VARCHAR(64) NOT NULL;
ALTER TABLE job_history
ADD /*CONSTRAINT job_history_to_position_fk*/
FOREIGN KEY (position_code) REFERENCES position (position_code)
ON DELETE RESTRICT;
CREATE TABLE subscription (
email VARCHAR(255) PRIMARY KEY,
name VARCHAR(255) NOT NULL
);
| true
|
9cdc736013fb52642a8329c10a8af84f7d190a15
|
SQL
|
codeinmyself/Velocity
|
/J2EE/src/main/java/xmu/mystore/ordersmgt/zjq/Mapper/create.sql
|
UTF-8
| 3,436
| 3.125
| 3
|
[] |
no_license
|
/*
Navicat MySQL Data Transfer
Source Server : mysql6
Source Server Version : 50717
Source Host : localhost:3306
Source Database : mystore
Target Server Type : MYSQL
Target Server Version : 50717
File Encoding : 65001
Date: 2017-06-02 13:00:31
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for 142539_goods
-- ----------------------------
DROP TABLE IF EXISTS `142539_goods`;
CREATE TABLE `142539_goods` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(40) NOT NULL,
`serial_code` varchar(40) NOT NULL,
`weight` double(12,0) unsigned zerofill DEFAULT NULL,
`stock_count` int(11) unsigned zerofill DEFAULT '00000000000',
`pre_sale_number` int(11) unsigned zerofill DEFAULT '00000000000',
`store_id` varchar(40) DEFAULT NULL,
`mid_user_price` double(12,0) unsigned zerofill DEFAULT '000000000000',
`market_price` double(12,0) unsigned zerofill DEFAULT '000000000000',
`real_price` double(12,0) unsigned zerofill DEFAULT '000000000000',
`redeem_point` int(11) DEFAULT '0',
`category_id` bigint(11) DEFAULT NULL,
`brand_id` bigint(11) DEFAULT NULL,
`stand_id` bigint(11) DEFAULT NULL,
`add_time` datetime DEFAULT NULL,
`last_modified_time` datetime DEFAULT NULL,
`description` longtext,
`image_path` varchar(999) DEFAULT NULL,
`is_dividable` tinyint(1) DEFAULT '0',
`default_express` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `serialCode` (`serial_code`)
) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for 142539_order_goods
-- ----------------------------
DROP TABLE IF EXISTS `142539_order_goods`;
CREATE TABLE `142539_order_goods` (
`id` bigint(20) DEFAULT NULL,
`order_id` bigint(20) DEFAULT NULL,
`goods_id` bigint(20) DEFAULT NULL,
`goods_name` varchar(55) DEFAULT NULL,
`goods_number` int(11) DEFAULT NULL,
`goods_price` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for 142539_order_info
-- ----------------------------
DROP TABLE IF EXISTS `142539_order_info`;
CREATE TABLE `142539_order_info` (
`order_id` bigint(20) DEFAULT NULL,
`order_sn` varchar(255) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`order_status` int(11) DEFAULT NULL,
`consignee` varchar(55) DEFAULT NULL,
`address` varchar(200) DEFAULT NULL,
`zipcode` varchar(55) DEFAULT NULL,
`telephone` varchar(30) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`goods_price` double DEFAULT NULL,
`order_price` double DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL,
`total_weight` double DEFAULT NULL,
`signature_characters` varchar(255) DEFAULT NULL,
`add_time` int(11) DEFAULT NULL,
`pay_time` int(11) DEFAULT NULL,
`make_time` int(11) DEFAULT NULL,
`shipped_time` int(11) DEFAULT NULL,
`receive_time` int(11) DEFAULT NULL,
`cancel_time` int(11) DEFAULT NULL,
`expressCode` varchar(100) DEFAULT NULL,
`isUrgency` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for 142539_users
-- ----------------------------
DROP TABLE IF EXISTS `142539_users`;
CREATE TABLE `142539_users` (
`user_id` bigint(20) DEFAULT NULL,
`user_name` varchar(20) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
`mobile_phone` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| true
|
6c08b0889979823effc6a8fccddf82620fd36ae7
|
SQL
|
jzero00/dbSql
|
/상품관리.sql
|
UHC
| 378
| 2.53125
| 3
|
[] |
no_license
|
SELECT prod_id, prod_name, prod_lgu, prod_buyer, prod_cost, prod_price, prod_sale, prod_outline, prod_detail
FROM lprod, prod
WHERE lprod.LPROD_GU = prod.PROD_LGU (+);
SELECT *
FROM prod;
SELECT prod_name
FROM lprod,prod
WHERE lprod_nm = 'ǻǰ'
AND lprod.LPROD_GU = prod.PROD_LGU (+);
SELECT lprod_nm
FROM lprod;
| true
|
12fc7ec40427e91e38c8d27beafb9b5fb59cf137
|
SQL
|
lrana-227/RBootCamp
|
/cw/0-7SQL/20/03-Stu_GregariousAggregates/Unsolved/gregarious_aggregates.sql
|
UTF-8
| 573
| 3.890625
| 4
|
[] |
no_license
|
-- 1. What is the average cost to rent a film in the stores?
SELECT ROUND(AVG(rental_rate),2) as "Average Rental Rate" from film;
-- 2. What is the average rental cost of films by rating? On average, what is the cheapest rating of films to rent? Most expensive?
SELECT RATING, AVG(RENTAL_RATE) AS "AVERAGE Rental/Rating" from film
GROUP BY RATING
-- 3. How much would it cost to replace all the films in the database?
-- 4. How much would it cost to replace all the films in each ratings category?
-- 5. How long is the longest movie in the database? The shortest?
| true
|
4e53fda9b4c33e318c4bf3c2171a361f704afa03
|
SQL
|
iownredport/DatabaseProject
|
/Project/Patterns/Pattern3.sql
|
UTF-8
| 462
| 3.96875
| 4
|
[] |
no_license
|
select not exists (select count(*),d,j from(
select a.item as d, b.item as j
from sells a, sells b, beers
where a.item != b.item and a.barname = b.barname and (a.price > b.price) and beers.beer = a.item
group by a.item, b.item
union all
select a.item as d, b.item as j
from sells a, sells b, beers
where a.item != b.item and a.barname = b.barname and (a.price < b.price) and beers.beer = b.item
group by a.item, b.item)
as p
group by d,j
having count(*) >1)
| true
|
ba6760dbcfcbd2a4fecc8855fe4b2fce9ea47bae
|
SQL
|
aryanugroho/e-commerce
|
/src/main/resources/script.sql
|
UTF-8
| 791
| 3.390625
| 3
|
[] |
no_license
|
-- ETL
set @cnt = 0;
insert into Atributo
select (@cnt:=@cnt+1) as id, a.nome as valor from atributo a;
set @cnt = 0;
insert into Categoria
select (@cnt:=@cnt+1), c.nome from categoria c order by c.hierarquia;
select (@cnt:=@cnt+1), c.hierarquia from categoria c
where c.hierarquia is not null;
select * from categoriaatributo ca
join atributo a on a.id = ca.Atributo_Id
join categoria c on c.id = ca.Categoria_Id;
set @cnt = 0;
insert into Produto
select (@cnt:=@cnt+1), now(), p.descricao, '', p.nome, 1 from produto p;
select * from Produto;
insert into ProdutoCategoria
select pp.id, cc.id from produto p
join categoria c on p.Categoria_Id = c.id
join Categoria cc on c.nome = cc.nome
join Produto pp on pp.nome = p.nome;
select * from ProdutoCategoria;
select * from produto;
| true
|
56265be41d70f877150e936012e96194143e16a7
|
SQL
|
Theuspercy/EsportsManagementSystem
|
/db/myguests.sql
|
UTF-8
| 2,370
| 3.109375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 28, 2021 at 04:43 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 7.4.13
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `esports_management`
--
-- --------------------------------------------------------
--
-- Table structure for table `myguests`
--
CREATE TABLE `myguests` (
`id` int(6) UNSIGNED NOT NULL,
`firstname` varchar(30) NOT NULL,
`lastname` varchar(30) NOT NULL,
`email` varchar(50) DEFAULT NULL,
`reg_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `myguests`
--
INSERT INTO `myguests` (`id`, `firstname`, `lastname`, `email`, `reg_date`) VALUES
(4, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(5, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(6, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(8, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(10, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(11, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(12, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(13, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(14, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(15, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(16, 'Randy', 'Cuizon', 'Randy23', '2021-01-26 07:00:40'),
(18, 'Tim', 'Cuizon', 'timon@gmail.com', '2021-01-26 08:26:55'),
(19, 'Walters', 'Cuizon', 'Walters0128', '2021-01-26 08:37:38');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `myguests`
--
ALTER TABLE `myguests`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `myguests`
--
ALTER TABLE `myguests`
MODIFY `id` int(6) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
900fdd47304e609ed01930f218af0008bb6b1712
|
SQL
|
lcoln/lt.cncoders.tech.docker
|
/mysql/sql/init_tag.sql
|
UTF-8
| 410
| 3.296875
| 3
|
[] |
no_license
|
use lt;
CREATE TABLE IF NOT EXISTS `tag` (
`t_id` int NOT NULL AUTO_INCREMENT,
`t_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL,
`t_create_time` bigint NOT NULL,
`t_update_time` bigint NOT NULL,
`t_delete_time` bigint NOT NULL DEFAULT '0',
PRIMARY KEY (`t_id`),
KEY `tag_t_id_IDX` (`t_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
| true
|
d281d64ece4c6b5998c32d414dfa96e04bfa0d17
|
SQL
|
TomXD7/TiendaST
|
/asdasda.sql
|
UTF-8
| 336
| 3.84375
| 4
|
[] |
no_license
|
use northwind;
select a.ProductID, a.ProductName, round(sum((b.Quantity * b.UnitPrice)),2) as Total
from products a, orderdetails b
where a.ProductID = b.ProductID
group by a.ProductID order by Total desc limit 3;
SELECT ProductId, SUM(UnitPrice*Quantity) AS Monto FROM orderdetails GROUP BY ProductId ORDER BY Monto DESC LIMIT 3;
| true
|
2ce6f21226a70e06eb4506d0708ce084f2669222
|
SQL
|
minggow/avarua
|
/opensource/cronhub/cronhub-web/src/main/webapp/download/cronhub.sql
|
UTF-8
| 4,636
| 3.53125
| 4
|
[
"Apache-2.0"
] |
permissive
|
CREATE TABLE `tb_schedule_user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`user_id` varchar(50) NOT NULL COMMENT '用户id',
`user_name` varchar(50) NOT NULL COMMENT '用户名',
`user_type` tinyint(2) NOT NULL COMMENT '1:管理员',
`department` varchar(50) NOT NULL DEFAULT '' COMMENT '部门',
`phone` varchar(50) NOT NULL DEFAULT '' COMMENT '电话',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
CREATE TABLE `tb_task` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`daemon_id` bigint(20) unsigned NOT NULL COMMENT '执行此任务daemon执行器的id',
`user_id` varchar(100) NOT NULL DEFAULT '' COMMENT '用户id',
`cron_exp` varchar(16) NOT NULL COMMENT 'crontab表达式',
`shell_cmd` varchar(1000) NOT NULL COMMENT '运行的命令,原始命令,未替换参数前',
`must_replace_cmd` tinyint(1) NOT NULL COMMENT 'bool.是否需要替换`撇号中的命令为执行结果',
`run_mode` tinyint(1) NOT NULL COMMENT '0--被动模式,1--主动模式',
`run_start_reportaddress` varchar(500) DEFAULT NULL COMMENT 'cmd命令开始执行的汇报地址',
`run_end_reportaddress` varchar(500) DEFAULT NULL COMMENT 'cmd命令结束执行的汇报地址',
`is_process_node` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0--不是流程中的一个节点,1--是流程中的一个节点',
`is_process_chain` tinyint(1) DEFAULT '0' COMMENT '0--不是流程链task,1--是流程链task',
`process_tasks` text COMMENT '流程链模式下的子链条task id集合',
`comment` text NOT NULL COMMENT '简介',
`operate_uid` bigint(20) DEFAULT '-1' COMMENT '操作人的id号',
`update_time` datetime DEFAULT NULL COMMENT '修改日期',
`is_redo` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0--不重新执行此任务,1--重新执行此任务',
`end_redo_times` int(11) NOT NULL DEFAULT '0' COMMENT '截止重新执行次数',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=98 DEFAULT CHARSET=utf8;
CREATE TABLE `tb_task_done` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`task_id` bigint(20) NOT NULL,
`real_cmd` varchar(1000) DEFAULT NULL,
`exit_code` int(10) NOT NULL,
`complete_success` tinyint(1) DEFAULT NULL,
`start_datetime` datetime NOT NULL,
`end_datetime` datetime NOT NULL,
`exec_type` int(10) NOT NULL,
`exec_return_str` longtext,
`current_redo_times` int(11) DEFAULT NULL,
`on_processing` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=507 DEFAULT CHARSET=utf8;
CREATE TABLE `tb_task_record_done` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`task_id` bigint(20) NOT NULL COMMENT '该task任务是哪个task id执行的结果',
`real_cmd` varchar(1000) DEFAULT NULL COMMENT '被替换参数为现场时间后后真实的命令',
`exit_code` int(10) NOT NULL COMMENT '完成的返回值。0--成功,其他都--失败',
`complete_success` tinyint(1) DEFAULT NULL COMMENT '完成的返回状态。1--成功,0--失败',
`start_datetime` datetime NOT NULL COMMENT '任务开始时间(如果是自动重执行时,每次执行不修改起始时间)',
`end_datetime` datetime NOT NULL COMMENT '任务结束时间',
`exec_type` int(10) NOT NULL COMMENT '执行类型,0--crontab执行,1--手动重执行,2--自动重执行,3--当场执行等',
`exec_return_str` longtext COMMENT '执行后的外部进程字符串返回结果。',
`current_redo_times` int(11) DEFAULT NULL COMMENT '当前第几次自动重试执行',
`on_processing` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'bool是否正在执行中,0--没有正在执行,1--正在手动/自动执行',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1839 DEFAULT CHARSET=utf8;
CREATE TABLE `tb_task_record_undo` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`task_id` bigint(20) NOT NULL COMMENT '该任务执行者的task_id号码',
`real_cmd` varchar(1000) DEFAULT NULL COMMENT '被替换参数为现场时间后后真实的命令',
`run_status` int(4) NOT NULL COMMENT '运行状态---0 进行中...',
`start_datetime` datetime NOT NULL COMMENT '执行开始时间',
`exec_type` int(10) NOT NULL COMMENT '执行类型,0--crontab执行,1--手动重执行...',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=12683 DEFAULT CHARSET=utf8;
CREATE TABLE `tb_task_undo` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`task_id` bigint(20) NOT NULL,
`real_cmd` varchar(1000) DEFAULT NULL,
`run_status` int(4) NOT NULL,
`start_datetime` datetime NOT NULL,
`exec_type` int(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
| true
|
e93f8df85b9a9d62b58359334003ab760e8af8cf
|
SQL
|
dambergautam/firefox-bookmarks
|
/build/export_query.sql
|
UTF-8
| 228
| 3.234375
| 3
|
[] |
no_license
|
SELECT
a.id, a.parent, a.type, a.title, b.url, b.preview_image_url
FROM
moz_bookmarks AS a LEFT JOIN moz_places AS b ON a.fk = b.id
WHERE
a.title IS NOT NULL AND TRIM(a.title) <> ''
ORDER BY
a.type, a.parent, a.position;
| true
|
93c69569f6ca5b72b950dadbb96a7c7dbfefecb9
|
SQL
|
J-T-McC/query-builder
|
/tests/stubs/seeds/projects.sql
|
UTF-8
| 1,046
| 2.609375
| 3
|
[] |
no_license
|
-- delete vs truncate to accommodate sqlite
DELETE FROM `projects`;
INSERT INTO `projects` VALUES (1, 'Project 1 - user 1', 1);
INSERT INTO `projects` VALUES (2, 'Project 2 - user 1', 1);
INSERT INTO `projects` VALUES (3, 'Project 3 - user 1', 1);
INSERT INTO `projects` VALUES (4, 'Project 4 - user 1', 1);
INSERT INTO `projects` VALUES (5, 'Project 1 - user 2', 2);
INSERT INTO `projects` VALUES (6, 'Project 2 - user 2', 2);
INSERT INTO `projects` VALUES (7, 'Project 3 - user 2', 2);
INSERT INTO `projects` VALUES (8, 'Project 4 - user 2', 2);
INSERT INTO `projects` VALUES (9, 'Project 1 - user 3', 3);
INSERT INTO `projects` VALUES (10, 'Project 2 - user 3', 3);
INSERT INTO `projects` VALUES (11, 'Project 3 - user 3', 3);
INSERT INTO `projects` VALUES (12, 'Project 4 - user 3', 3);
INSERT INTO `projects` VALUES (13, 'Project 1 - user 4', 4);
INSERT INTO `projects` VALUES (14, 'Project 2 - user 4', 4);
INSERT INTO `projects` VALUES (15, 'Project 3 - user 4', 4);
INSERT INTO `projects` VALUES (16, 'Project 4 - user 4', 4);
| true
|
b2a1ef6b4b17d04efa1e1ef12b66028c4dbab2a2
|
SQL
|
molker/CSC3210-GroupProject
|
/football_db.sql
|
UTF-8
| 3,193
| 3.484375
| 3
|
[] |
no_license
|
# Authors: Matthew Olker, Spencer Peters, Chad Sigmon, Rahul
# Class: CSC3210
# DROP TABLE IF EXISTS `divisions`;
CREATE TABLE `divisions` (
DIV_CODE int(11) NOT NULL UNIQUE,
DIV_NAME varchar(40) NOT NULL,
PRIMARY KEY(DIV_CODE)
);
# Inserts
DROP TABLE IF EXISTS `teams`;
CREATE TABLE `teams` (
TEAM_CODE int(11) NOT NULL UNIQUE,
DIV_CODE int(11) NOT NULL,
TEAM_NAME varchar(25) NOT NULL,
TEAM_STATE char(2) NOT NULL,
TEAM_CITY varchar(20) NOT NULL,
TEAM_WINS int(3) NOT NULL,
TEAM_LOSSES int(3) NOT NULL,
TEAM_TIES int(3) NOT NULL,
TEAM_SALARY int(16) NOT NULL,
PRIMARY KEY(TEAM_CODE),
FOREIGN KEY(DIV_CODE) REFERENCES `divisions` (DIV_CODE) ON UPDATE CASCADE
);
# Inserts
DROP TABLE IF EXISTS `schedules`;
CREATE TABLE `schedules` (
SCHED_CODE int(11) NOT NULL UNIQUE,
TEAM_CODE int(11) NOT NULL,
HOME_TEAM varchar(25),
AWAY_TEAM varchar(25),
PRIMARY KEY(SCHED_CODE),
FOREIGN KEY(TEAM_CODE) REFERENCES `teams` (TEAM_CODE) ON UPDATE CASCADE
);
# Inserts
DROP TABLE IF EXISTS `sponsors`;
CREATE TABLE `sponsors` (
SPON_CODE int(11) NOT NULL UNIQUE,
TEAM_CODE int(11) NOT NULL,
SPON_NAME varchar(25) NOT NULL,
SPON_STARTDATE date NOT NULL,
SPON_ENDDATE date,
SPON_RANK int(3) NOT NULL,
PRIMARY KEY(SPON_CODE),
FOREIGN KEY(TEAM_CODE) REFERENCES `teams` (TEAM_CODE) ON UPDATE CASCADE
);
# Inserts
DROP TABLE IF EXISTS `members`;
CREATE TABLE `members` (
MEMBER_NUM int(11) NOT NULL UNIQUE,
TEAM_CODE int(11) NOT NULL,
MEMBER_FNAME varchar(25) NOT NULL,
MEMBER_LNAME varchar(25) NOT NULL,
MEMBER_ADDRESS varchar(25) NOT NULL,
MEMBER_STATE varchar(2) NOT NULL,
MEMBER_PHONE varchar(11) NOT NULL,
PRIMARY KEY(MEMBER_NUM),
FOREIGN KEY(TEAM_CODE) REFERENCES `teams` (TEAM_CODE) ON UPDATE CASCADE
);
# Inserts
DROP TABLE IF EXISTS `coaches`;
CREATE TABLE `coaches` (
MEMBER_NUM int(11) NOT NULL REFERENCES `members`,
COACH_REPORTSTO int(11),
COACH_ROLE varchar(20) NOT NULL,
PRIMARY KEY(MEMBER_NUM),
FOREIGN KEY(MEMBER_NUM) REFERENCES `members` (MEMBER_NUM)
);
# Inserts
DROP TABLE IF EXISTS `players`;
CREATE TABLE `players` (
MEMBER_NUM int(11) NOT NULL UNIQUE REFERENCES `members`,
PLAYER_DOB DATE NOT NULL,
PLAYER_HEIGHT int(3) NOT NULL,
PLAYER_WEIGHT int(3) NOT NULL,
PLAYER_COLLEGE varchar(40) NOT NULL,
PLAYER_POSITION varchar(40) NOT NULL,
PLAYER_NUM int(3) NOT NULL,
PLAYER_TERM int(2) NOT NULL,
PRIMARY KEY(MEMBER_NUM),
FOREIGN KEY(MEMBER_NUM) REFERENCES `members` (MEMBER_NUM)
);
# Inserts
DROP TABLE IF EXISTS `owners`;
CREATE TABLE `owners` (
MEMBER_NUM int(11) NOT NULL UNIQUE REFERENCES `members`,
OWNER_HIREDATE date NOT NULL,
OWNER_STARTDATE date NOT NULL,
OWNER_BUYPRICE int(12) NOT NULL,
OWNER_TEAMNAME varchar(25) NOT NULL,
PRIMARY KEY(MEMBER_NUM),
FOREIGN KEY(MEMBER_NUM) REFERENCES `members` (MEMBER_NUM)
);
# Inserts
DROP TABLE IF EXISTS `statistics`;
CREATE TABLE `statistics` (
STAT_CODE int(11) NOT NULL UNIQUE,
MEMBER_NUM int(3) NOT NULL REFERENCES `players`,
STAT_RECEIVINGYD int(4),
STAT_RUSHINGYD int(4),
STAT_TDS int(3),
STAT_TACKLES int(3),
STAT_SACKS int(3),
STAT_PASSYD int(4),
STAT_QBR int(3),
PRIMARY KEY(STAT_CODE),
FOREIGN KEY(MEMBER_NUM) REFERENCES `players` (MEMBER_NUM)
);
# Inserts
| true
|
dcc8b038b26ea6e68d2ce9f4e3adc54e00fc18e3
|
SQL
|
leterman/BD
|
/INSERT.sql
|
UTF-8
| 1,037
| 2.875
| 3
|
[] |
no_license
|
INSERT INTO albums(album_name, year)
VALUES ('Mr. Bad Guy', 1985), ('Happier Than Ever', 2021), ('Revival', 2018), ('Imagine', 1971),
('The One', 1992), ('Tim', 2018), ('Bleach', 1989), ('Horn Concertos', 1953);
INSERT INTO artists(name)
VALUES ('Freddie Mercury'), ('Billie Eilish'), ('Eminem'), ('John Lennon'), ('Elton John'), ('Avicii'),
('Kurt Cobain'), ('Mozart');
INSERT INTO genre(name)
VALUES ('Pop'), ('Hip-hop'), ('Classical music'), ('Rock'), ('Electronic music');
INSERT INTO playlist(name, year)
VALUES ('Wierd', 2019), ('Slow', 2019), ('Modern', 2020), ('Crypto', 1978), ('Fast', 2021),
('Random', 2005), ('Sweet', 1996), ('Resentful', 1975);
INSERT INTO tracks(track_name, album_id, track_length)
VALUES ('Forever Queen', 1, 718), ('You and me', 2, 289), ('My Revange', 3, 190), ('Yesterday', 3, 193), ('Imagine', 4, 134), ('One', 5, 210),
('No Matter What', 6, 312), ('Crazy', 7, 411), ('Tubthumping', 8, 184), ('My Ice Ice Baby', 7, 210), ('Love Your Smile', 6, 308),
('Together Again', 4, 410), ('Lullaby', 5, 430), ('Easy', 4, 210), ('Good Riddance', 1, 625);
| true
|
1183662d8b4df39a88da4e12beb8f300d632181d
|
SQL
|
brendagutman/data-analyst-job-titles-brendagutman
|
/Script/DATitles.sql
|
UTF-8
| 6,277
| 4.59375
| 5
|
[] |
no_license
|
-- 1 Q. How many rows are in the data_analyst_jobs table?
-- 1 A. 1793
SELECT count(*)
FROM data_analyst_jobs
-- 2 Q. Write a query to look at just the first 10 rows. What company is associated with the job posting on the 10th row?
-- 2 A. ExxonMobil
SELECT company
FROM data_analyst_jobs
LIMIT 10
-- 3 Q. How many postings are in Tennessee? How many are there in either Tennessee or Kentucky?
-- 3 A. TN --> 21 , TN+KY --> 27
SELECT location, COUNT(location)
FROM data_analyst_jobs
WHERE location = 'TN' OR location = 'KY'
GROUP BY location
--Another way
SELECT location, COUNT(location)
FROM data_analyst_jobs
WHERE location IN('TN','KY')
GROUP BY location
-- 4 Q. How many postings in Tennessee have a star rating above 4?
-- 4 A. 3
SELECT COUNT(star_rating)
FROM data_analyst_jobs
WHERE location = 'TN' AND star_rating > 4;
-- 5 Q. How many postings in the dataset have a review count between 500 and 1000?
-- 5 A. Non-inclusive: 150 Inclusive: 151
SELECT COUNT(review_count)
FROM data_analyst_jobs
WHERE review_count BETWEEN 500 AND 1000
/* 6 Q. Show the average star rating for companies in each state. The output should show the state as state and
the average rating for the state as avg_rating. Which state shows the highest average rating?*/
-- 6 A. Nebraska 4.2 avg_stars
SELECT location AS state , ROUND(AVG(star_rating),2) AS avg_rating
FROM data_analyst_jobs
WHERE star_rating IS NOT NULL
GROUP BY location
ORDER BY avg_rating DESC
--Another way
SELECT location as state, ROUND(AVG(star_rating), 2) as avg_stars
FROM (SELECT DISTINCT company, location, star_rating
FROM data_analyst_jobs
WHERE location IS NOT NULL and star_rating IS NOT NULL) sub
GROUP BY location
ORDER BY avg_stars DESC;
-- 7 Q. Select unique job titles from the data_analyst_jobs table. How many are there?
-- 7 A. 881SELECT company, ROUND(AVG(star_rating),2) AS avg_star_rating, (SELECT COUNT(DISTINCT(company))
FROM data_analyst_jobs
SELECT COUNT(DISTINCT(title))
FROM data_analyst_jobs
-- 8 Q. How many unique job titles are there for California companies?
-- 8 A. 230
SELECT COUNT(DISTINCT(title))
FROM data_analyst_jobs
WHERE location = 'CA'
/* 9 Q. Find the name of each company and its average star rating for all companies that have more than 5000
reviews across all locations. How many companies are there with more that 5000 reviews across all locations?*/
-- 9 A. 40
SELECT company, avg_star_rating, (SELECT COUNT(DISTINCT(company))
FROM data_analyst_jobs
WHERE review_count >= 5000 AND company IS NOT NULL)
FROM
(SELECT company, ROUND(AVG(star_rating),2) AS avg_star_rating
FROM data_analyst_jobs
WHERE review_count >= 5000 AND company IS NOT NULL
GROUP BY company) AS sub
GROUP BY 1,2
ORDER BY avg_star_rating DESC
--Another way?
SELECT company, ROUND(AVG(star_rating),2) AS avg_star_rating, (SELECT COUNT(DISTINCT(company))
FROM data_analyst_jobs
WHERE review_count >= 5000 AND company IS NOT NULL)
FROM data_analyst_jobs
WHERE review_count >= 5000 AND company IS NOT NULL
GROUP BY company
ORDER BY avg_star_rating DESC
--Another way?
SELECT company,
AVG(star_rating) as avg_rating
FROM data_analyst_jobs
GROUP BY company
HAVING SUM(review_count) >= 5000
ORDER BY avg_rating DESC;
-- Another way
SELECT DISTINCT company, ROUND(star_rating, 1) as star_rating
FROM data_analyst_jobs
WHERE review_count > 5000 AND company IS NOT NULL
ORDER BY star_rating DESC, company;
/* 10 Q. Add the code to order the query in #9 from highest to lowest average star rating. Which company
with more than 5000 reviews across all locations in the dataset has the highest star rating? What is that rating?*/
-- 10 A. American Express 4.2
SELECT company, avg_star_rating, (SELECT COUNT(DISTINCT(company))
FROM data_analyst_jobs
WHERE review_count >= 5000 AND company IS NOT NULL)
FROM
(SELECT company, ROUND(AVG(star_rating),2) AS avg_star_rating, SUM(review_count) AS sum_review_count
FROM data_analyst_jobs
WHERE review_count >= 5000 AND company IS NOT NULL
GROUP BY company) AS sub
GROUP BY 1,2
ORDER BY avg_star_rating desc
-- 11 Q. Find all the job titles that contain the word ‘Analyst’. How many different job titles are there?
-- 11 A. 1669 all 774 distinct
SELECT COUNT(DISTINCT(title))
FROM data_analyst_jobs
WHERE title ILIKE '%Analyst%'
--Another way
SELECT DISTINCT title, (SELECT COUNT(DISTINCT title) as title_count FROM data_analyst_jobs WHERE title ILIKE '%analyst%')
FROM data_analyst_jobs
WHERE title ILIKE '%analyst%';
-- Another way
SELECT title
FROM data_analyst_jobs
WHERE UPPER(title) LIKE '%ANALYST%';
--Another way
SELECT title, (SELECT COUNT(*) as title_count FROM data_analyst_jobs WHERE title ILIKE '%analyst%')
FROM data_analyst_jobs
WHERE title ILIKE '%analyst%';
/* 12 Q. How many different job titles do not contain either the word ‘Analyst’ or the word ‘Analytics’?
What word do these positions have in common?*/
-- 12 A. 4, Tableau
SELECT DISTINCT(title)
FROM data_analyst_jobs
WHERE title NOT ILIKE '%Analyst%' AND title NOT ILIKE '%Analytics%'
--Another way
SELECT SUM(title_count) over(),title as job_title
From (
SELECT Count(Distinct title) AS title_count, title
FROM data_analyst_jobs
WHERE title NOT ILIKE '%analyst%' AND title NOT ILIKE '%analytics%'
Group By title
) as sub
/* BONUS Qa: You want to understand which jobs requiring SQL are hard to fill. Find the number
of jobs by industry (domain)that require SQL and have been posted longer than 3 weeks.*/
--Qb. Disregard any postings where the domain is NULL.
--Qc. Order your results so that the domain with the greatest number of hard to fill jobs is at the top.
--Qd. Which three industries are in the top 4 on this list? How many jobs have been listed for more than 3 weeks for each of the top 4?
-- BONUS A. Internet and Software 62, Banks and Financial Services 61, Consulting and Buisiness Services 57, Healthcare 52
SELECT domain, COUNT(title) AS num_jobs
FROM data_analyst_jobs
WHERE skill ILIKE '%SQL%' AND days_since_posting > 21 AND domain IS NOT NULL
GROUP BY domain
ORDER BY num_jobs DESC
| true
|
364f78b95440229799c55b2c44d93bb3c172621d
|
SQL
|
katkemper/CS4750-dog-shelter
|
/dog_shelters.sql
|
UTF-8
| 52,005
| 3.421875
| 3
|
[
"MIT"
] |
permissive
|
CREATE TABLE potential_adopter(AdopterID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (AdopterID), first_name VARCHAR(255),
last_name VARCHAR(255),
gender VARCHAR(255),
age int CHECK (age >= 18), location VARCHAR(255),
email VARCHAR(255),
living_style VARCHAR(255),
number_of_kids int, number_of_adults int, activeness_level VARCHAR(255),
max_age int, max_price int, hypoallergenic BOOLEAN, additional_information VARCHAR(255));
CREATE TABLE dog_shelter(DogShelterID int NOT NULL AUTO_INCREMENT,
name varchar(255),
location varchar(255),
email varchar(255),
phone_number varchar(255),
PRIMARY KEY(DogShelterID));
CREATE TABLE dog(DogID int NOT NULL AUTO_INCREMENT,
Preferred_environment VARCHAR(255),
Dog_breed VARCHAR(255),
dog_size VARCHAR(255),
color VARCHAR(255),
activeness_level VARCHAR(255),
age int, name VARCHAR(255),
dog_shelter VARCHAR(255),
current_location VARCHAR(255),
shots_uptodate BOOLEAN, gender VARCHAR(255),
hypoallergenic BOOLEAN, fee int, ok_with_kids BOOLEAN, ok_with_other_pets BOOLEAN, description VARCHAR(255),
PRIMARY KEY(DogID));
CREATE TABLE communicate
(AdopterID int NOT NULL,
DogShelterID int NOT NULL,
PRIMARY KEY(AdopterID, DogShelterID),
FOREIGN KEY (AdopterID) REFERENCES potential_adopter (AdopterID) ON DELETE CASCADE);
CREATE TABLE interested_in
(AdopterID int NOT NULL,
DogID int NOT NULL,
PRIMARY KEY(AdopterID, DogID),
FOREIGN KEY (DogID) REFERENCES dog (DogID) ON DELETE CASCADE,
FOREIGN KEY (AdopterID) REFERENCES potential_adopter (AdopterID) ON DELETE CASCADE);
CREATE TABLE resides
(DogID int NOT NULL,
DogShelterID int, PRIMARY KEY(DogID),
FOREIGN KEY (DogID) REFERENCES dog (DogID) ON DELETE CASCADE);
CREATE TABLE potential_adopter_dog_breed
(AdopterID int NOT NULL,
Dog_breed VARCHAR(255),
PRIMARY KEY(AdopterID, Dog_Breed),
FOREIGN KEY (AdopterID) REFERENCES potential_adopter (AdopterID) ON DELETE CASCADE);
CREATE TABLE potential_adopter_color
(AdopterID int NOT NULL,
PRIMARY KEY(AdopterID, dog_color),
dog_color VARCHAR(255),
FOREIGN KEY (AdopterID) REFERENCES potential_adopter (AdopterID) ON DELETE CASCADE);
CREATE TABLE potential_adopter_dog_Size
(AdopterID int NOT NULL,
PRIMARY KEY(AdopterID, dog_size),
dog_size VARCHAR(255),
FOREIGN KEY (AdopterID) REFERENCES potential_adopter (AdopterID) ON DELETE CASCADE);
CREATE TABLE dog_underlying_conditions
(DogID int NOT NULL,
underlying_conditions VARCHAR(255),
PRIMARY KEY(DogID, underlying_conditions),
FOREIGN KEY (DogID) REFERENCES dog (DogID) ON DELETE CASCADE);
/* insert into potential_adopter */
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)
VALUES("Cathy", "Nguyen", "F", 21, "Charlottesville", "cathysemail@virginia.edu", "City apartment", 0, 1, "low", 20, 10000, 1, "I have a cat at home it would have to get along with");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Catherine", "Le", "F", 50, "Ashburn", "dogloveraddress@vt.edu", "Single family home", 3, 2, "any", 100, 5000, 1, "Nope");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("John", "Doe", "M", 54, "000 Fake Address", "johndoe@gmail.com", "Farmhouse", 2, 2, "high", 10, 200, 0, "Must be ok with other animals");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Kelly", "Chen", "F", 20, "123 Main Street", "fakeemail@virginia.edu", "Suburban home", 0, 3, "low", 20, 10000, 0, "None");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Cristiano", "Ronaldo", "M", 35, "Los Angeles", "therealcristianoronaldo@gmail.com", "Family home", 4, 2, "high", 25,10000000, 0, "I have a big backyard");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Kat", "Kemper", "F", 20, "Charlottesville", "kat@virginia.edu", "City apartment", 0, 2, "low", 5, 500, 0, "None");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES ("Anna", "Brower", "F", 21, "Charlottesville", "annab@gmail.com", "Suburban", 0, 3, "High", 10, 350, 0, "None");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES ("Max", "Smith", "M", 50, "Chicago", "maxwell@gmail.com", "City apartment", 5, 1, "medium", 2, 250, 0, "I have two cats");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Renee", "Park", "F", 41, "Lovettsville", "rfpark@yahoo@com", "Single family home", 0, 1, "low", 20, 200, 1, " ");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Frank", "Senato", "M", 35, "Charlottesville", "frankieps3@gmail.edu", "City apartment", 2, 1, "low", 10, 100, 1, " ");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Quincy", "Ray", "F", 21, "Ashburn", "qaray@neu.edu", "suburban home", 0, 1, "low", 20, 300, 1, "I go to school virtually so I can take care of a dog");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Patrick", "Leonard", "M", 21, "Charlottesville", "patrickpj@virginia.edu", "City apartment", 0, 2, "low", 20, 10000, 1, "We have a large dog who gets along well with big dogs");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Jason", "Mandoza", "M", 27, "Farmville", "DJasonmandoza@yahoo.com", "shared house", 5, 0, "low", 20, 150, 1, "I have a cat");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Tim", "French", "M", 22, "Charlottesville", "tjf8921@virginia.edu", "House", 0,8, "low", 5, 150, 0, " ");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Shreyas", "Mehta", "M", 20, "Charlottesville", "shreyascville@virginia.edu", "City apartment", 0, 4, "low", 2, 100, 0, "I have a 3 roommates who have dogs");
INSERT INTO potential_adopter(first_name, last_name, gender, age, location, email, living_style, number_of_kids, number_of_adults, activeness_level, max_age, max_price, hypoallergenic, additional_information)VALUES("Lindsay", "Bowden", "F", 20, "Charlottesville", "lindsyd@virginia.edu", "House", 0, 4, "low", 20, 10000, 1, "I live in a sorority house so she would have to be social");
/* Table 2: dog_shelter */
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("Friends of Dogs No Kill Shelter", "Charlottesville", "FDNKS@gmail.com", "1234555555");
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("Charlottesville Dog Shelter", "Charlottesville", "cvilledogs@gmail.com", "8309298444");
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("Dogs in DC", "Washington D.C.", "dogsindc@gmail.com", "7049390401");
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("Paws for Applause", "Fairfax", "pawsshelter@gmail.com", "8002255989");
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("One Loudoun Dog Shelter", "Ashburn", "OLDS@gmail.com", "5713948395");
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("Blacksburg Dogs", "Blacksburg", "blacksburgdogs@gmail.com", "1123824943");
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("Happy Pups Shelter", "Reston", "happypups@gmail.com", "5612873894");
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("Rich Dogs", "Richmond", "richdogs@gmail.com", "2321892834");
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("Sunny Sands Shelter", "Virginia Beach", "sunnysands@gmail.com", "1374828394");
INSERT INTO dog_shelter(name, location, email, phone_number)
VALUES ("Jim’s Dog Shelter", " Charlottesville", "jim.ryan@gmail.com", "2290384923");
/* Table 3: dog */
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Apartment", "Pomeranian", "small", "white", "high", 2, "Bella", "Charlottesville Dog Shelter", "Charlottesville", 0, "F", 0, 100, 0, 0, "very high energy");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Japanese Chin", "small", "black and white", "medium", 11, "Panda", "Dogs in DC", "Washington D.C.", 1, "M", 0, 50, 1, 0, "friendly dog looking for a home!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Labrador", "large", "brown", "high", 9, "Buddy", "Friends of Dogs No Kill Shelter", "Charlottesville", 1, "M", 0, 80, 1, 1, "loves to play fetch");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES(" Farmhouse", "Beagle", "small", "white with brown spots", "high", 1, "Benny", "Dogs in DC", "Washington D.C.", 1, "M", 0, 90, 0,1, " loving beagle looking for a forever home");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("City", "Poodle", "medium", "black", "low", 3, "Princess", "Friends of Dogs No Kill Shelter", "Charlottesville", 0, "F", 1, 200, 1,1, "looking for her castle to stay in!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Suburban", "Greyhound", "large", "white", "high",2, "Bunny", "Dogs in DC", "Washington D.C", 1, "F", 0, 200, 1,1, "loves kids and loves long walks ");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Suburban", "Chihuahua", "small", "black", "low", 14, "Jim", "Dogs in DC", "Washington D.C.", 1, "M", 0, 250, 1, 1, "very friendly and great with kids!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("City", "French Bulldog", "small", "grey", "medium", 1, "Frank", "Charlottesville Dog Shelter", "Charlottesville", 0, "M", 0, 150, 1,0, "looking for a loving home!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Shiba Inu", "medium", "tan and white", "medium", 5, "Toast", "One Loudoun Dog Shelter", "Ashburn", 0, "M", 0, 100, 1, 0, "loves playing fetch!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Suburban", "Bulldog", "medium", "brown and white", "low", 8, "Bobby", "Rich Dogs", "Richmond", 1, "M", 0, 200, 1, 1, "loves belly rubs!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Golden Retriever", "large", "yellow", "high", 3, "Goldie", "Happy Pups Shelter", "Reston", 1, "F", 1, 250, 1, 1, "loves to swim!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Suburban", "Mixed", "medium", "brown", "medium", 7, "Lola", "Sunny Sands Shelter", "Virginia Beach", 1, "F", 0, 50, 1, 1, "need to watch her diet");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "German Shepherd", "large", "black and brown", "high", 6, "Sammie", "Jim’s Dog Shelter", "Charlottesville", 1, "M", 0, 300, 1,1, "looking for a home!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Bichon Frise", "medium", "white", "low", 2, "Alfie", "Jim’s Dog Shelter", "Charlottesville", 1, "M", 1, 400, 1, 0, "very fluffy!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Golden Retriever", "large", "yellow", "medium", 7, "Wasabi", "Paws for Applause", "Fairfax", 1, "M", 0, 200, 0, 0, "anxious with kids and other pets");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Apartment", "Shih Tzu", "small", "grey and white", "low", 2, "Lisa", "Blacksburg Dogs", "Blacksburg", 1, "F", 1, 100, 1, 1, "loves eating chicken");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Chow chow", "large", "brown", "medium", 5, "Mia", "One Loudoun Dog Shelter", "Ashburn",1, "F", 0, 300, 1, 1, "very fluffy");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Suburban", "beagle", "medium", "brown and white", "low", 5, "Kayla", "Sunny Sands Shelter", "Virginia Beach", 1, "F", 0, 200, 0, 1, "needs specialized diet");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Cocker Spaniel", "medium", "brown", "medium", 4, "Mickey", "Paws for Applause", "Fairfax", 1, "M", 0, 100, 1, 1, "Minnie’s brother");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Cocker Spaniel", "medium", "brown and white", "medium", 4, "Minnie", "Paws for Applause", "Fairfax", 1, "F", 0, 100, 1, 1, "Mickey’s sister");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Shar Pei", "large", "brown", "low", 12, "Jack", "Blacksburg Dogs", "Blacksburg", 1, "M", 0, 150, 1,1, "a very chill dog");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Samoyed", "large", "white", "medium", 1, "Snow", "Jim’s Dog Shelter", "Charlottesville", 0, "F", 0, 500, 1, 0, "fluffy");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Mixed", "small", "black", "high", 9, "Love", "Happy Pups Shelter", "Reston", 1, "F", 0, 60, 1, 1, "very friendly and playful");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Husky", "large", "black and white", "high", 3, "Fido", "One Loudoun Dog Shelter", "Ashburn", 1, "M", 0, 300, 0, 0, "chases animals around");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Dachshund", "small", "black and brown", "medium", 5, "Sausage", "Sunny Sands Shelter", "Virginia Beach", 1, "F", 0, 250, 1, 1, "will steal treats");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Rottweiler", "large", "black and brown", "high", 3, "Spike", "Happy Pups Shelter", "Reston", 1, "M", 0, 200, 1, 1, "very friendly and looking for a home!");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural or suburban", "Lab-Pitt mix", "large", "yellow", "low", 4, "Luke Bryan", "Happy Pups Shelter", "Reston", 0, "F", 1, 150, 1, 1, "Very timid, big softie");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural or suburban", "Pitt bull", "large", "brindle", "medium", 1, "Toby", "One Loudoun Dog Shelter", "Ashburn", 0, "M", 0, 100, 1, 1, "Came from hard background, scared of other dogs");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural or suburban", "Staffordshire Terrier", "large", "Brown", "medium", 1, "George", "One Loudoun Dog Shelter", "Ashburn", 0, "M", 0, 100, 1, 1, "Needs big backyard");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural or suburban", "Lab mix", "medium", "Brown", "medium", 1, "Luna", "Rich Dogs", "Richmond", 0, "F", 0, 100, 1, 1, "Best friends with Beca");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Beagle mix", "medium", "Brown", "medium", 1, "Beca", "Rich Dogs", "Richmond", 0, "F", 0, 100, 1, 1, "Best friends with Luna");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Lab mix", "medium", "Brown", "medium", 1, "Beamer", "Dogs in DC", "Washington D.C.", 0, "M", 0, 100, 1, 1, "Great with kids, dogs, and cats");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural", "Shepherd mix", "large", "Brown", "medium", 1, "Boomer", "Charlottesville Dog Shelter", "Charlottesville", 0, "M", 0, 100, 1, 1, "Great with kids, dogs, and cats");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural", "German Shepherd", "large", "Brown", "large", 1, "Sage", "Blacksburg Dogs", "Blacksburg",0, "M", 0, 100, 1, 1, "Not good with men");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural", "Shepherd mix", "medium", "Brown", "large", 1, "Stella", "Blacksburg Dogs", "Blacksburg", 0, "F", 0, 150, 1, 1, " ");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural", "Hound mix", "medium", "Brown", "medium", 1, "Rose", "Happy Pups Shelter", "Reston", 0, "F", 0, 150, 1, 1, " ");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Mix", "medium", "Brown", "medium", 1, "Darrell", "Charlottesville Dog Shelter", "Charlottesville", 0, "M", 0, 200, 1, 1, "Great with other dogs! ");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Lab", "medium", "Black", "medium", 1, "Jake", "Charlottesville Dog Shelter", "Charlottesville", 0, "M", 0, 200, 1, 1, "Scared of other dogs ");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Lab", "medium", "Yellow", "medium", 1, "Iris", "Charlottesville Dog Shelter", "Charlottesville", 0, "F", 0, 200, 1, 1, "Great with small dogs");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Lab mix", "medium", "Brown", "medium", 1, "Rettenah", "Sunny Sands Shelter", "Virginia Beach", 0, "F", 0, 300, 1, 1, "Blind");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Lab mix", "medium", "Yellow", "medium", 1, "Buddy", "Rich Dogs", "Richmond", 0, "M", 0, 300, 1, 1, "");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Beagle mix", "medium", "Brown", "medium", 1, "Underdog", "Dogs in DC", "Washington D.C.", 0, "M", 0, 300, 1, 1, "");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural", "Doberman", "Large", "Black", "high", 9, "Dino", "Jim’s Dog Shelter", "Charlottesville", 0, "M", 0, 300, 1, 0, "");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural", "Lab", "Large", "Black", "high", 4, "Jimmy", "Jim’s Dog Shelter", "Charlottesville", 0, "M", 0, 300, 1, 0, "");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Rural", "Husky mix", "Large", "Black and white", "high", 4, "Maya", "Friends of Dogs No Kill Shelter", "Charlottesville", 0, "F", 0, 300, 1, 0, "");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Terrier mix", "Large", "Brown and black", "medium", 3, "Shadow", "Dogs in DC", "Washington D.C.", 0, "M", 0, 300, 1, 1, "");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Lab", "Large", "Brown", "medium", 2, "Aspen", "Friends of Dogs No Kill Shelter", "Charlottesville", 0, "M", 0, 100, 1, 1, "");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Lab mix", "medium", "yellow", "medium", 6, "Paul", "Jim’s Dog Shelter", "Charlottesville", 0, "M", 0, 100, 1, 1, "");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Shepherd mix", "large", "black and brown", "medium", 6, "Maxim", "Friends of Dogs No Kill Shelter", "Charlottesville", 0, "M", 0, 100, 1, 1, "");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)
VALUES("Any", "Rottweiler-Lab mix", "medium", "black and brown", "medium", 6, "Rosie", "Paws for Applause", "Fairfax", 0, "F", 0, 150, 1, 1, "");
/* Table 4: communicate --communicate(AdopterID, DogShelterID)
INSERT INTO communicate
VALUES (12345, 343281);
INSERT INTO communicate
VALUES (33333, 343283);
INSERT INTO communicate
VALUES (98760, 877241);
INSERT INTO communicate
VALUES(23456, 343281);
INSERT INTO communicate
VALUES(90877, 343281);
INSERT INTO communicate
VALUES(12346,877241);
INSERT INTO communicate
VALUES(39209, 877241);
INSERT INTO communicate
VALUES(39202, 343281);
INSERT INTO communicate
VALUES(14300, 866491);
INSERT INTO communicate
VALUES(55355, 432464);
*/
/* Table 5: interested_in (AdopterID, DogID)
INSERT INTO interested_in
VALUES (12345, 1000001);
INSERT INTO interested_in
VALUES (33333, 1382043);
INSERT INTO interested_in
VALUES(98760, 1382043);
INSERT INTO interested_in
VALUES(23456, 1000001);
INSERT INTO interested_in
VALUES(90877, 4444445);
INSERT INTO interested_in
VALUES(12346, 2134525);
INSERT INTO interested_in
VALUES(39209,1382043);
INSERT INTO interested_in
VALUES(39202,3828392);
INSERT INTO interested_in
VALUES(14300,9000281);
INSERT INTO interested_in
VALUES(55355, 2318390);
*/
/* Table 6: Resides(DogID, DogShelterID)
INSERT INTO resides VALUES(34892345, 259384);
INSERT INTO resides VALUES(23532358,343281);
INSERT INTO resides VALUES(9038523,432464);
INSERT INTO resides VALUES(9028192,877241);
INSERT INTO resides VALUES(9000281, 343281);
INSERT INTO resides VALUES(8937293,746247);
INSERT INTO resides VALUES(8902859,877241);
INSERT INTO resides VALUES(8839482, 259384);
INSERT INTO resides VALUES(8339412,877241);
INSERT INTO resides VALUES(8009012,833192);
INSERT INTO resides VALUES(7867687, 343281);
INSERT INTO resides VALUES(7429842, 545242);
INSERT INTO resides VALUES(6730928, 259384);
INSERT INTO resides VALUES(6673823, 545242);
INSERT INTO resides VALUES(6642242,833192);
INSERT INTO resides VALUES(5637281, 259384);
INSERT INTO resides VALUES(5467281, 343281);
INSERT INTO resides VALUES(4534354, 545242);
INSERT INTO resides VALUES(4482931,746247);
INSERT INTO resides VALUES(4473829, 545242);
INSERT INTO resides VALUES(4444445,343283);
INSERT INTO resides VALUES(4245321,833192);
INSERT INTO resides VALUES(3828392,343283);
INSERT INTO resides VALUES(3726183, 554837);
INSERT INTO resides VALUES(3582930, 545242);
INSERT INTO resides VALUES(3453829,877241);
INSERT INTO resides VALUES(3423101, 554837);
INSERT INTO resides VALUES(3392053, 343281);
INSERT INTO resides VALUES(3335353, 343281);
INSERT INTO resides VALUES(3283753,877241);
INSERT INTO resides VALUES(3243578,833192);
INSERT INTO resides VALUES(2318390,866491);
INSERT INTO resides VALUES(2291201,877241);
INSERT INTO resides VALUES(2210982, 554837);
INSERT INTO resides VALUES(2134525,833192);
INSERT INTO resides VALUES(1938293,866491);
INSERT INTO resides VALUES(1920395,866491);
INSERT INTO resides VALUES(1912118, 259384);
INSERT INTO resides VALUES(1912111,343283);
INSERT INTO resides VALUES(1829321, 259384);
INSERT INTO resides VALUES(1424645,746247);
INSERT INTO resides VALUES(1424644,833192);
INSERT INTO resides VALUES(1382043, 554837);
INSERT INTO resides VALUES(1294028, 343281);
INSERT INTO resides VALUES(1291823, 554837);
INSERT INTO resides VALUES(1239189, 259384);
INSERT INTO resides VALUES(1207648,877241);
INSERT INTO resides VALUES(1010101,877241);
INSERT INTO resides VALUES(1001212, 343281);
*/
/* Table 7: potential_adopter_dog_breed(AdopterID, Dog_breed)
INSERT INTO potential_adopter_dog_breed
VALUES(12345,"any");
INSERT INTO potential_adopter_dog_breed
VALUES(33333, "any");
INSERT INTO potential_adopter_dog_breed
VALUES(98760, "Shepherds");
INSERT INTO potential_adopter_dog_breed
VALUES(23456, "any");
INSERT INTO potential_adopter_dog_breed
VALUES(90877, "any");
INSERT INTO potential_adopter_dog_breed
VALUES(12346, "any");
INSERT INTO potential_adopter_dog_breed
VALUES(39209, "Lab");
INSERT INTO potential_adopter_dog_breed
VALUES(06843, "French bulldog");
INSERT INTO potential_adopter_dog_breed
VALUES(06843, "Dalmatian");
INSERT INTO potential_adopter_dog_breed
VALUES(22356, "Terrier");
INSERT INTO potential_adopter_dog_breed
VALUES(14300, "any");
INSERT INTO potential_adopter_dog_breed
VALUES(77733, "lab");
INSERT INTO potential_adopter_dog_breed
VALUES(77733, "poodle");
INSERT INTO potential_adopter_dog_breed
VALUES(69900, "lab");
INSERT INTO potential_adopter_dog_breed
VALUES(55355, "any");
INSERT INTO potential_adopter_dog_breed
VALUES(22123, "any");
INSERT INTO potential_adopter_dog_breed
VALUES(44543, "any");
*/
/*Table 8: potential_adopter_color(AdopterID, dog_color)
INSERT INTO potential_adopter_color
VALUES(12345, "any");
INSERT INTO potential_adopter_color
VALUES(33333, "any");
INSERT INTO potential_adopter_color
VALUES(98760, "any");
INSERT INTO potential_adopter_color
VALUES(23456, "any");
INSERT INTO potential_adopter_color
VALUES(90877, "any");
INSERT INTO potential_adopter_color
VALUES(12346, "black");
INSERT INTO potential_adopter_color
VALUES(12346, "white");
INSERT INTO potential_adopter_color
VALUES(39209, "brown");
INSERT INTO potential_adopter_color
VALUES(39202, "white");
INSERT INTO potential_adopter_color
VALUES(06843, "any");
INSERT INTO potential_adopter_color
VALUES(22356, "any");
INSERT INTO potential_adopter_color
VALUES(14300, "black");
INSERT INTO potential_adopter_color
VALUES(77733, "any");
INSERT INTO potential_adopter_color
VALUES(69900, "any");
INSERT INTO potential_adopter_color
VALUES(55355, "yellow");
INSERT INTO potential_adopter_color
VALUES(55355, "brown");
INSERT INTO potential_adopter_color
VALUES(22123, "brown");
INSERT INTO potential_adopter_color
VALUES(44543, "white");
/*Table 9: potential_adopter_dog_Size(AdopterID, dog_Size)
INSERT INTO potential_adopter_dog_Size
VALUES(12345, "small");
INSERT INTO potential_adopter_dog_Size
VALUES(12345, "medium");
INSERT INTO potential_adopter_dog_Size
VALUES(33333, "medium");
INSERT INTO potential_adopter_dog_Size
VALUES(33333, "big");
INSERT INTO potential_adopter_dog_Size
VALUES(98760, "large");
INSERT INTO potential_adopter_dog_Size
VALUES(23456, "small");
INSERT INTO potential_adopter_dog_Size
VALUES(12346, "medium");
INSERT INTO potential_adopter_dog_Size
VALUES(39209, "large");
INSERT INTO potential_adopter_dog_Size
VALUES(39202, "small");
INSERT INTO potential_adopter_dog_Size
VALUES(06843, "medium");
INSERT INTO potential_adopter_dog_Size
VALUES(22356, "small");
INSERT INTO potential_adopter_dog_Size
VALUES(22356, "medium");
INSERT INTO potential_adopter_dog_Size
VALUES(77733, "big");
INSERT INTO potential_adopter_dog_Size
VALUES(69900, "medium");
INSERT INTO potential_adopter_dog_Size
VALUES(69900, "small");
INSERT INTO potential_adopter_dog_Size
VALUES(55355, "medium");
INSERT INTO potential_adopter_dog_Size
VALUES(55355, "big");
INSERT INTO potential_adopter_dog_Size
VALUES(22123, "medium");
INSERT INTO potential_adopter_dog_Size
VALUES(22123, "small");
INSERT INTO potential_adopter_dog_Size
VALUES(44543, "small");
INSERT INTO potential_adopter_dog_Size
VALUES(44543, "medium");
*/
/* Table 10: dog_underlying_conditions(DogID, underlying_conditions)
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1010101, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1000001, "Knee problem");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1382043, "heart palpitations");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1382043, "Bad hips");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1001212, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(2134525, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(4444445, "Blind");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3828392, "Missing an eye");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3828392, "Overweight");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(7429842, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(8009012, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(2291201, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1912118, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(2210982, "Diabetes");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1239189, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1938293, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3335353, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1294028, "Deaf");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(4482931, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1829321, "Overweight");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1424644, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1424645, "Diabetes");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(8339412, "Blind");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(4245321, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(6642242, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3392053, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(23532358, "Overweight");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(34892345, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1912111, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(6673823, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(8839482, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(4473829, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3582930, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(9038523, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1291823, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1207648, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(9028192, "Diabetes");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3453829, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3283753, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(5467281, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(6730928, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3726183, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(4534354, "Blind");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(7867687, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(1920395, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3243578, "Deaf");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(5637281, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(8937293, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(3423101, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(2318390, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(8902859, "None");
INSERT INTO dog(preferred_environment, dog_breed, dog_size, color, activeness_level, age, name, dog_shelter, current_location,shots_uptodate, gender, hypoallergenic, fee, ok_with_kids, ok_with_other_pets, description)_underlying_conditions
VALUES(9000281, "None");
*/
| true
|
bbd11914523b2c09170f9a89ba68095111e0cacd
|
SQL
|
darcyknox/cosc344
|
/lab04/q05.sql
|
UTF-8
| 101
| 2.625
| 3
|
[] |
no_license
|
SELECT DISTINCT FNAME, LNAME
FROM employee, works_on
WHERE HOURS < 18 AND ESSN = SSN
ORDER BY FNAME;
| true
|
8f345124ce610ddcb3c1e0fe4b1b1f3abd078234
|
SQL
|
saifulsahim/E-Health
|
/DB/ehealth (3).sql
|
UTF-8
| 9,486
| 3.078125
| 3
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.8.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 24, 2018 at 03:24 PM
-- Server version: 10.1.32-MariaDB
-- PHP Version: 7.2.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `ehealth`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_admin`
--
CREATE TABLE `tbl_admin` (
`admin_id` int(11) NOT NULL,
`admin_name` varchar(255) NOT NULL,
`admin_email` varchar(255) NOT NULL,
`admin_password` varchar(255) NOT NULL,
`admin_status` tinyint(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_admin`
--
INSERT INTO `tbl_admin` (`admin_id`, `admin_name`, `admin_email`, `admin_password`, `admin_status`) VALUES
(1, 'Saiful', 'sahim@gmail.com', '$2y$10$iEv26Oh1eZdfwyMdMqS3Bupc3ahwFyV2/hZ7BHbrcsiZnnLPF.4xG', 1),
(2, 'Sahim', 'sahim@gmail.com', '', 1),
(3, 'Fahim', 'fahim@gmail.com', '$2y$10$4sy0UQWB478FEVysnn3Idu5NhdsceXy/glfAUgOI4JJdJm.B6LjqG', 1),
(7, 'Saiful', 'ssahim@gmail.com', '$2y$10$9TTLncqXmHRZsDkARPazReQsesyngHZIwyoVgVyo6uxZLIkGsQHbK', 1),
(8, 'Nayan Pal', 'nayan@gmail.com', '$2y$10$mC1fcPrFyvhM75Zcx/a1Ge1wKcvW5gKrTTwsth1YL29Zc/QObRUTu', 1),
(9, 'Saifullll Allam', 'ssssahim@gmail.com', '789', 1),
(10, 'Saiful', 'ssaiful@gmail.com', '$2y$10$skKi4TME85T8HALTpOntO.5mMieAot8FwudzMnmhMNsqS3z/sJjle', 2),
(11, 'Amit', 'amit@gmail.com', '$2y$10$yV19a5AQNDgSxZOIyOQto.aV0UPyAp.BVXVPMZUgvzZWoCT7rqVX2', 1),
(12, 'Sahim', 'sahim12@gmail.com', '$2y$10$/U5BPh5cBRrp2OVi2hBi7O/WLiCDw9sdnegtTfgr/R6Uy8kB6JkfO', 1),
(13, 'admin', 'admin@gmail.com', '1234', 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_ambulance`
--
CREATE TABLE `tbl_ambulance` (
`amb_id` int(11) NOT NULL,
`amb_name` varchar(255) NOT NULL,
`amb_contact` varchar(255) NOT NULL,
`amb_loc` text NOT NULL,
`amb_status` tinyint(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_ambulance`
--
INSERT INTO `tbl_ambulance` (`amb_id`, `amb_name`, `amb_contact`, `amb_loc`, `amb_status`) VALUES
(2, 'ICU Ambulance', '01672412645', 'Chawkbazar ewagrhes', 2),
(3, 'CMH', '01756128527', 'Dhaka', 2),
(4, 'Green Ambulance Service', '015656128527', 'Chittagong', 1),
(5, 'Medinova Medical Service Ltd.', '018656128527', 'GEC', 2);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_cabin`
--
CREATE TABLE `tbl_cabin` (
`cabin_id` int(11) NOT NULL,
`cabin_capacity` int(50) NOT NULL,
`cabin_desc` text NOT NULL,
`cabin_charge` int(100) NOT NULL,
`cabin_status` tinyint(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_cabin`
--
INSERT INTO `tbl_cabin` (`cabin_id`, `cabin_capacity`, `cabin_desc`, `cabin_charge`, `cabin_status`) VALUES
(1, 5, 'AC', 2000, 2),
(2, 5, 'Non AC', 5000, 2),
(3, 6, 'General', 4000, 1),
(4, 5, 'AC', 6000, 1),
(5, 7, 'Non AC', 3000, 1),
(6, 15, 'General', 1000, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_dept`
--
CREATE TABLE `tbl_dept` (
`dept_id` int(11) NOT NULL,
`dept_name` varchar(255) NOT NULL,
`dept_desc` text NOT NULL,
`dept_status` tinyint(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_dept`
--
INSERT INTO `tbl_dept` (`dept_id`, `dept_name`, `dept_desc`, `dept_status`) VALUES
(1, 'Pathology', 'Medicine', 1),
(2, 'Neurology', 'SD', 1),
(3, 'Cardiology', 'Cardiology', 1),
(4, 'Orthopedics', 'Orthopedics', 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_doctor`
--
CREATE TABLE `tbl_doctor` (
`doc_id` int(11) NOT NULL,
`doc_name` varchar(255) NOT NULL,
`doc_image` text NOT NULL,
`doc_email` varchar(255) NOT NULL,
`doc_mobile_no` varchar(16) NOT NULL,
`doc_qualification` varchar(255) NOT NULL,
`doc_designation` varchar(255) NOT NULL,
`doc_category` varchar(255) NOT NULL,
`doc_birth_date` date NOT NULL,
`doc_join_date` date NOT NULL,
`doc_chamber` varchar(255) NOT NULL,
`doc_fee` int(100) NOT NULL,
`doc_status` tinyint(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_doctor`
--
INSERT INTO `tbl_doctor` (`doc_id`, `doc_name`, `doc_image`, `doc_email`, `doc_mobile_no`, `doc_qualification`, `doc_designation`, `doc_category`, `doc_birth_date`, `doc_join_date`, `doc_chamber`, `doc_fee`, `doc_status`) VALUES
(24, 'Fahim', 'uploads/g2.jpg', 'sahim@gmail.com', '01672412645', 'FCPS', 'Associate Professor', '2', '2018-06-27', '2016-06-27', 'Agrabad', 700, 1),
(25, 'Amir', 'uploads/td3.jpg', 'amit@gmail.com', '01672412645', 'MBBS ,FCPS', 'Associate Professor', '3', '2015-06-27', '2018-06-19', 'DewanHat', 1000, 1),
(26, 'As', 'uploads/xperia.jpg', 'amit@gmail.com', '01672412645', 'FCPS', 'MBBS', '2', '2015-06-27', '2018-06-21', 'Anderkilla', 1000, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_donor`
--
CREATE TABLE `tbl_donor` (
`donor_id` int(11) NOT NULL,
`donor_name` varchar(255) NOT NULL,
`donor_blood_group` varchar(11) NOT NULL,
`donor_email` varchar(255) NOT NULL,
`donor_mobile_no` varchar(16) NOT NULL,
`donor_address` varchar(255) NOT NULL,
`donor_status` tinyint(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_donor`
--
INSERT INTO `tbl_donor` (`donor_id`, `donor_name`, `donor_blood_group`, `donor_email`, `donor_mobile_no`, `donor_address`, `donor_status`) VALUES
(1, 'Sahim Alam', 'AB+', 'sahim@gmail.com', '01672412645', 'Sahim', 1),
(2, 'Saiful', 'B-', 'sahim1345678@gmail.com', '01853132102', 'Kajir Dewri', 2),
(4, 'Sahim', 'O+', 'sahim@gmail.com', '1672412645', 'Agrabad', 2),
(5, 'Fahim', 'A-', 'fahim@gmail.com', '1853132102', 'Agrabad', 1),
(6, 'Saiful', 'A+', 'sahim@gmail.com', '01672412645', 'Agrabad', 2),
(7, 'Saiful alam', 'A+', 'sahim@gmail.com', '01672412645', 'Agrabad', 1),
(9, 'Sahim', 'B-', 'sahim1345678@gmail.com', '01672412645', 'Chawkbazar', 2),
(10, 'Sahim', 'A+', 'sahim1345678@gmail.com', '01853132102', 'Agrabad', 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_hospital`
--
CREATE TABLE `tbl_hospital` (
`hospital_id` int(11) NOT NULL,
`doc_id` int(11) NOT NULL,
`cabin_id` int(11) NOT NULL,
`hospital_name` varchar(255) NOT NULL,
`hospital_desc` text NOT NULL,
`hospital_contact` varchar(16) NOT NULL,
`hospital_location` text NOT NULL,
`hospital_status` tinyint(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_hospital`
--
INSERT INTO `tbl_hospital` (`hospital_id`, `doc_id`, `cabin_id`, `hospital_name`, `hospital_desc`, `hospital_contact`, `hospital_location`, `hospital_status`) VALUES
(17, 26, 6, 'Sqaure', 'fsd', '01672412645', 'asfd', 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_test`
--
CREATE TABLE `tbl_test` (
`test_id` int(11) NOT NULL,
`doc_id` int(11) NOT NULL,
`test_name` varchar(100) NOT NULL,
`test_price` int(100) NOT NULL,
`test_desc` text NOT NULL,
`test_status` tinyint(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `tbl_test`
--
INSERT INTO `tbl_test` (`test_id`, `doc_id`, `test_name`, `test_price`, `test_desc`, `test_status`) VALUES
(19, 24, 'Blood Test', 500, 'Ad', 1),
(20, 26, 'ECG', 2000, 'asd', 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tbl_admin`
--
ALTER TABLE `tbl_admin`
ADD PRIMARY KEY (`admin_id`);
--
-- Indexes for table `tbl_ambulance`
--
ALTER TABLE `tbl_ambulance`
ADD PRIMARY KEY (`amb_id`);
--
-- Indexes for table `tbl_cabin`
--
ALTER TABLE `tbl_cabin`
ADD PRIMARY KEY (`cabin_id`);
--
-- Indexes for table `tbl_dept`
--
ALTER TABLE `tbl_dept`
ADD PRIMARY KEY (`dept_id`);
--
-- Indexes for table `tbl_doctor`
--
ALTER TABLE `tbl_doctor`
ADD PRIMARY KEY (`doc_id`);
--
-- Indexes for table `tbl_donor`
--
ALTER TABLE `tbl_donor`
ADD PRIMARY KEY (`donor_id`);
--
-- Indexes for table `tbl_hospital`
--
ALTER TABLE `tbl_hospital`
ADD PRIMARY KEY (`hospital_id`);
--
-- Indexes for table `tbl_test`
--
ALTER TABLE `tbl_test`
ADD PRIMARY KEY (`test_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tbl_admin`
--
ALTER TABLE `tbl_admin`
MODIFY `admin_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `tbl_ambulance`
--
ALTER TABLE `tbl_ambulance`
MODIFY `amb_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `tbl_cabin`
--
ALTER TABLE `tbl_cabin`
MODIFY `cabin_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `tbl_dept`
--
ALTER TABLE `tbl_dept`
MODIFY `dept_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tbl_doctor`
--
ALTER TABLE `tbl_doctor`
MODIFY `doc_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT for table `tbl_donor`
--
ALTER TABLE `tbl_donor`
MODIFY `donor_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `tbl_hospital`
--
ALTER TABLE `tbl_hospital`
MODIFY `hospital_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT for table `tbl_test`
--
ALTER TABLE `tbl_test`
MODIFY `test_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
f8e26a65a2ab0b3ad1bf09aa01d6d1ff1ed4c047
|
SQL
|
daidvrk/graphql-go-postgres
|
/migrations/1_create_skills_table.up.sql
|
UTF-8
| 323
| 2.75
| 3
|
[] |
no_license
|
CREATE TABLE IF NOT EXISTS skills
(
id serial PRIMARY KEY,
category varchar(100) NOT NULL,
name varchar(150) NOT NULL,
exp int NOT NULL,
member_id int NOT NULL
);
INSERT INTO skills
VALUES
('1', 'IT', 'PHP', '7', '1'),
('2', 'IT', 'JAVA', '10', '2'),
('3', 'Design', 'DD', '2', '1');
| true
|
36bee58ae9937de7716b86a24a785f2a3676d437
|
SQL
|
LaRotta/friendFinder
|
/app/db/schema.sql
|
UTF-8
| 1,107
| 3.1875
| 3
|
[] |
no_license
|
DROP DATABASE IF EXISTS friends_db;
CREATE DATABASE friends_db;
USE friends_db;
CREATE TABLE friends (
id INTEGER(11) AUTO_INCREMENT NOT NULL,
name VARCHAR(255),
photoImg NVARCHAR(255),
score INTEGER,
PRIMARY KEY (id)
);
INSERT INTO friends (name, photoImg, score) VALUES ("omar cubillos", "https://cdn.images.dailystar.co.uk/dynamic/58/photos/112000/620x/Lionel-Messi-611696.jpg", 1445125413);
INSERT INTO friends (name, photoImg, score) VALUES ("omar cubillos", "https://cdn.images.dailystar.co.uk/dynamic/58/photos/112000/620x/Lionel-Messi-611696.jpg", 2142213223);
INSERT INTO friends (name, photoImg, score) VALUES ("omar cubillos", "https://cdn.images.dailystar.co.uk/dynamic/58/photos/112000/620x/Lionel-Messi-611696.jpg", 1534113252);
INSERT INTO friends (name, photoImg, score) VALUES ("omar cubillos", "https://cdn.images.dailystar.co.uk/dynamic/58/photos/112000/620x/Lionel-Messi-611696.jpg", 1251322132);
INSERT INTO friends (name, photoImg, score) VALUES ("omar cubillos", "https://cdn.images.dailystar.co.uk/dynamic/58/photos/112000/620x/Lionel-Messi-611696.jpg", 2122413255);
SELECT *
FROM friends;
| true
|
3307c563e8ce640e0823e40b892b8332addc8f06
|
SQL
|
teamwhileloop/ucsc-results-center
|
/sql/trigger_updateOverallGPA.sql
|
UTF-8
| 2,576
| 3.484375
| 3
|
[
"MIT"
] |
permissive
|
DELIMITER //
DROP TRIGGER IF EXISTS `updateOverallGPA`//
CREATE TRIGGER `updateOverallGPA`
BEFORE UPDATE ON `undergraduate`
FOR EACH ROW
BEGIN
DECLARE calculatedGpa FLOAT;
IF (OLD.updated_date = NEW.updated_date) THEN
SET calculatedGpa = (
(coalesce(NEW.y1s1_gpa, 0) * coalesce(NEW.y1s1_credits, 0)) +
(coalesce(NEW.y1s2_gpa, 0) * coalesce(NEW.y1s2_credits, 0)) +
(coalesce(NEW.y2s1_gpa, 0) * coalesce(NEW.y2s1_credits, 0)) +
(coalesce(NEW.y2s2_gpa, 0) * coalesce(NEW.y2s2_credits, 0)) +
(coalesce(NEW.y3s1_gpa, 0) * coalesce(NEW.y3s1_credits, 0)) +
(coalesce(NEW.y3s2_gpa, 0) * coalesce(NEW.y3s2_credits, 0)) +
(coalesce(NEW.y4s1_gpa, 0) * coalesce(NEW.y4s1_credits, 0)) +
(coalesce(NEW.y4s2_gpa, 0) * coalesce(NEW.y4s2_credits, 0))
) / (
coalesce(NEW.y1s1_credits, 0) +
coalesce(NEW.y1s2_credits, 0) +
coalesce(NEW.y2s1_credits, 0) +
coalesce(NEW.y2s2_credits, 0) +
coalesce(NEW.y3s1_credits, 0) +
coalesce(NEW.y3s2_credits, 0) +
coalesce(NEW.y4s1_credits, 0) +
coalesce(NEW.y4s2_credits, 0)
);
SET NEW.gpa = calculatedGpa;
SET NEW.credits = (
coalesce(NEW.y1s1_credits, 0) +
coalesce(NEW.y1s2_credits, 0) +
coalesce(NEW.y2s1_credits, 0) +
coalesce(NEW.y2s2_credits, 0) +
coalesce(NEW.y3s1_credits, 0) +
coalesce(NEW.y3s2_credits, 0) +
coalesce(NEW.y4s1_credits, 0) +
coalesce(NEW.y4s2_credits, 0)
);
SET NEW.credits_non_gpa = (
coalesce(NEW.y1s1_credits_non_gpa, 0) +
coalesce(NEW.y1s2_credits_non_gpa, 0) +
coalesce(NEW.y2s1_credits_non_gpa, 0) +
coalesce(NEW.y2s2_credits_non_gpa, 0) +
coalesce(NEW.y3s1_credits_non_gpa, 0) +
coalesce(NEW.y3s2_credits_non_gpa, 0) +
coalesce(NEW.y4s1_credits_non_gpa, 0) +
coalesce(NEW.y4s2_credits_non_gpa, 0)
);
SET NEW.updated_date = NOW();
IF (OLD.gpa != calculatedGpa) THEN
SET NEW.gpa_diff = calculatedGpa - coalesce(OLD.gpa, 0);
END IF;
IF (OLD.rank != NEW.rank) THEN
SET NEW.rank_diff = coalesce(NEW.RANK, 0) - coalesce(OLD.rank, 0);
END IF;
END IF;
END//
DELIMITER ;
| true
|
888dad49146d50c019ba4759b536358be05905c0
|
SQL
|
karadsik7/oracle_study
|
/example/ch02_insert.sql
|
UHC
| 1,208
| 3.578125
| 4
|
[] |
no_license
|
create table teacher(
id number primary key,
nickname VARCHAR2(20),
name varchar2(20) not null,
gender char(1) not null
);
desc teacher;
--[insert]
insert into teacher(id, nickname, name, gender) values(1, 'flynn', '嵿', 'm');
select * from teacher;
--ǽ : ڽ ̺ ϼ
insert into teacher(nickname, gender, name, id) values('jang', 'm', '', 2);
select * from teacher;
-- - primary key
--÷ ϸ ÷ ؾϰ
insert into teacher values(2, 'hong', 'ȫ浿', 'm');
insert into teacher values(3, 'hong', 'ȫ浿', 'm');
-- - not null
insert into teacher(id, nickname, gender) values(4, 'lim', 'm');
insert into teacher(id, name, gender) values(4, 'Ӳ', 'm');
--ڷ
insert into teacher values(5, 'lee', '̼', 'male');
insert into teacher values(5, 'lee', '̼', 'm');
--ǽ : ̺
insert into teacher(id, nickname, name, gender) values(6, 'gang', '', 'm');
insert into teacher values(7, 'sejong', '', 'm');
| true
|
8bf562c701dac7d354086019bdd914db57417f68
|
SQL
|
306529917/ycdemo
|
/C0-S2-Ply-demo/WebContent/我的课件/1期课程/Oracle/DML基础课堂练习1.sql
|
UTF-8
| 522
| 2.515625
| 3
|
[] |
no_license
|
-- 查询部门名称为 SALES 的部门
-- 查询名字立面带 K 的员工,显示其姓名,工资,入职时间
-- 查询10部门的所有工资小于2000,以及所有的销售员,显示其编号,姓名,主管领导的编号
-- 新增“市场部”,地址“北京”,使用 SEQ_DEMO 的序列生产部门编号
-- 修改“市场部”的地址为“上海”
-- 修改“市场部”的地址为“广州”,完成操作后使用命令撤销该操作
-- 删除“市场部”
| true
|
a61a2f8a38cf14a41b51d52f53ec1cd369761b4b
|
SQL
|
gpipperr/OraDBASQLScripts
|
/awr_tablespace_history.sql
|
UTF-8
| 1,077
| 3.1875
| 3
|
[] |
no_license
|
--==============================================================================
-- GPI - Gunther Pippèrr
-- Desc: get the historical Size of a tablespace from the AWR
-- Date: November 2013
--
--==============================================================================
prompt
prompt !!!!You need the Tuning Pack for this feature!!!!
prompt
set verify off
set linesize 130 pagesize 300
select to_char (sp.begin_interval_time, 'dd.mm.yyyy') "tag"
, tbstat.tsname tsname
, max (round ( ( tbus.tablespace_usedsize * tbs.block_size) / ( 1024 * 1024) , 1)) belegt_mb
, max (round ( ( tbus.tablespace_size * tbs.block_size) / ( 1024 * 1024) , 1)) groesse_mb
from dba_hist_snapshot sp
, dba_tablespaces tbs
, dba_hist_tbspc_space_usage tbus
, dba_hist_tablespace_stat tbstat
where tbus.tablespace_id = tbstat.ts#
and tbus.snap_id = sp.snap_id
and tbstat.tsname = tbs.tablespace_name
group by to_char (sp.begin_interval_time, 'dd.mm.yyyy'), tbstat.tsname
order by tbstat.tsname, "tag"
/
| true
|
c536f9a4940fd52cb58b5d8f9cefe72ef9cf479c
|
SQL
|
evillique/ClickHouse
|
/tests/queries/0_stateless/02187_insert_values_with_mv.sql
|
UTF-8
| 1,824
| 3.5625
| 4
|
[
"Apache-2.0"
] |
permissive
|
CREATE TABLE IF NOT EXISTS a (a Int64) ENGINE=Memory;
CREATE TABLE IF NOT EXISTS b (a Int64) ENGINE=Memory;
CREATE MATERIALIZED VIEW IF NOT EXISTS mv1 TO b AS Select sleepEachRow(0.05) as a FROM a;
CREATE MATERIALIZED VIEW IF NOT EXISTS mv2 TO b AS Select sleepEachRow(0.05) as a FROM a;
CREATE MATERIALIZED VIEW IF NOT EXISTS mv3 TO b AS Select sleepEachRow(0.05) as a FROM a;
CREATE MATERIALIZED VIEW IF NOT EXISTS mv4 TO b AS Select sleepEachRow(0.05) as a FROM a;
CREATE MATERIALIZED VIEW IF NOT EXISTS mv5 TO b AS Select sleepEachRow(0.05) as a FROM a;
-- INSERT USING VALUES
INSERT INTO a VALUES (1);
-- INSERT USING TABLE
INSERT INTO a SELECT * FROM system.one;
SYSTEM FLUSH LOGS;
SELECT 'VALUES', query_duration_ms >= 250
FROM system.query_log
WHERE
current_database = currentDatabase()
AND event_date >= yesterday()
AND query LIKE '-- INSERT USING VALUES%'
AND type = 'QueryFinish'
LIMIT 1;
SELECT 'TABLE', query_duration_ms >= 250
FROM system.query_log
WHERE
current_database = currentDatabase()
AND event_date >= yesterday()
AND query LIKE '-- INSERT USING VALUES%'
AND type = 'QueryFinish'
LIMIT 1;
WITH
(
SELECT initial_query_id
FROM system.query_log
WHERE
current_database = currentDatabase()
AND event_date >= yesterday()
AND query LIKE '-- INSERT USING VALUES%'
LIMIT 1
) AS q_id
SELECT 'VALUES', view_duration_ms >= 50
FROM system.query_views_log
WHERE initial_query_id = q_id;
WITH
(
SELECT initial_query_id
FROM system.query_log
WHERE
current_database = currentDatabase()
AND event_date >= yesterday()
AND query LIKE '-- INSERT USING TABLE%'
LIMIT 1
) AS q_id
SELECT 'TABLE', view_duration_ms >= 50
FROM system.query_views_log
WHERE initial_query_id = q_id;
| true
|
58a4899b6ceb48743eb1993df43f388704cda3d3
|
SQL
|
jansforte/oracle
|
/workshop pl/Data/Ejercicio 8.sql
|
UTF-8
| 4,451
| 3.796875
| 4
|
[
"MIT"
] |
permissive
|
--
--
--JOHAN SEBASTIAN FUENTES ORTEGA
--DATE: 24/04/2021
--
-- ----------------------------------------------------------
/*Paquete de acceso a datos – departamento*/
CREATE OR REPLACE PACKAGE acceso
IS
--retorna los datos del departamento
FUNCTION fGetDept(p_deptno dept.deptno%TYPE)
RETURN dept%ROWTYPE;
--inserto datos en el departamento
FUNCTION fPutDept(p_deptno dept.deptno%TYPE,
p_dname dept.dname%TYPE,
p_loc dept.loc%TYPE)
RETURN NUMBER;
--borro datos del departamento
FUNCTION fDelDept(p_deptno dept.deptno%TYPE)
RETURN NUMBER;
--actualizo datos del departamento
FUNCTION fUpdDept(p_deptno dept.deptno%TYPE,
p_dname dept.dname%TYPE,
p_loc dept.loc%TYPE)
RETURN NUMBER;
END acceso;
/
CREATE OR REPLACE PACKAGE BODY acceso
IS
FUNCTION fGetDept(p_deptno dept.deptno%TYPE)
RETURN dept%ROWTYPE
IS
v_dept dept%ROWTYPE;
BEGIN
SELECT * INTO v_dept
FROM dept d
WHERE d.deptno = p_deptno;
RETURN v_dept;
EXCEPTION
WHEN No_Data_Found THEN
Dbms_Output.put_line(SQLCODE || ' - ' || SQLERRM);
RETURN NULL;
WHEN OTHERS THEN
Dbms_Output.put_line(SQLCODE || ' - ' || SQLERRM);
RETURN NULL;
END fGetDept;
FUNCTION fPutDept(p_deptno dept.deptno%TYPE,
p_dname dept.dname%TYPE,
p_loc dept.loc%TYPE)
RETURN NUMBER
IS
BEGIN
INSERT INTO dept (deptno, dname, loc)
VALUES (p_deptno, p_dname, p_loc);
RETURN SQL%ROWCOUNT;
EXCEPTION
WHEN OTHERS THEN
Dbms_Output.put_line(SQLCODE || ' - ' || SQLERRM);
RETURN -1;
END fPutDept;
FUNCTION fDelDept(p_deptno dept.deptno%TYPE)
RETURN NUMBER
IS
BEGIN
DELETE dept
WHERE deptno = p_deptno;
RETURN SQL%ROWCOUNT;
EXCEPTION
WHEN OTHERS THEN
Dbms_Output.put_line(SQLCODE || ' - ' || SQLERRM);
RETURN -1;
END fDelDept;
FUNCTION fUpdDept(p_deptno dept.deptno%TYPE,
p_dname dept.dname%TYPE,
p_loc dept.loc%TYPE)
RETURN NUMBER
IS
sql_str VARCHAR2(1000);
sql_p1 VARCHAR2(100);
sql_p2 VARCHAR2(100);
BEGIN
SELECT Decode(p_dname, NULL, 'dname', ''''||p_dname||'''') INTO sql_p1
FROM dual;
SELECT Decode(p_loc, NULL, 'loc', ''''||p_loc|| '''') INTO sql_p2
FROM dual;
sql_str := 'UPDATE dept SET dname = '||sql_p1||', loc = '||sql_p2||
' WHERE deptno = '|| p_deptno;
EXECUTE IMMEDIATE sql_str;
RETURN SQL%ROWCOUNT;
EXCEPTION
WHEN OTHERS THEN
Dbms_Output.put_line(SQLCODE || ' - ' || SQLERRM);
RETURN -1;
END fUpdDept;
END acceso;
/
BEGIN
Dbms_Output.put_line('Departamento 10 : '|| acceso.fGetDept(10).deptno ||'-'||acceso.fGetDept(10).dname||
'-'||acceso.fGetDept(10).loc);
Dbms_Output.put_line('Departamento 20 : '|| acceso.fGetDept(20).deptno ||'-'||acceso.fGetDept(20).dname||
'-'||acceso.fGetDept(20).loc);
Dbms_Output.put_line('Departamento 30 : '|| acceso.fGetDept(30).deptno ||'-'||acceso.fGetDept(30).dname||
'-'||acceso.fGetDept(30).loc);
Dbms_Output.put_line('Insertando 50,I+D,TULUA : '||acceso.fPutDept (50,'I+D','TULUA'));
Dbms_Output.put_line('Borrando 40 : '||acceso.fDelDept (40));
Dbms_Output.put_line('Actualizando 10 : '||acceso.fUpdDept (10,'NEO',NULL));
Dbms_Output.put_line('Actualizando 20 : '||acceso.fUpdDept (20,NULL,'CALI'));
Dbms_Output.put_line('Actualizando 30 : '||acceso.fUpdDept (30,'EDUC','ARMENIA'));
Dbms_Output.put_line('Departamento 10 : '|| acceso.fGetDept(10).deptno ||'-'||acceso.fGetDept(10).dname||
'-'||acceso.fGetDept(10).loc);
Dbms_Output.put_line('Departamento 20 : '|| acceso.fGetDept(20).deptno ||'-'||acceso.fGetDept(20).dname||
'-'||acceso.fGetDept(20).loc);
Dbms_Output.put_line('Departamento 30 : '|| acceso.fGetDept(30).deptno ||'-'||acceso.fGetDept(30).dname||
'-'||acceso.fGetDept(30).loc);
END;
| true
|
325c94143248ac026f0dad69ea39eb4b04a2eb82
|
SQL
|
regiamariana/JavaScript-FrontEnd
|
/ex_01/sstop-base/sstop.sql
|
UTF-8
| 608
| 3.875
| 4
|
[
"MIT"
] |
permissive
|
CREATE DATABASE RoteiroSstop;
USE RoteiroSstop;
CREATE TABLE Estilos
(
IdEstilo INT PRIMARY KEY IDENTITY
,Nome VARCHAR(200) NOT NULL UNIQUE
);
CREATE TABLE Artistas
(
IdArtista INT PRIMARY KEY IDENTITY
,Nome VARCHAR(200) UNIQUE
,IdEstilo INT FOREIGN KEY REFERENCES Estilos (IdEstilo)
);
SELECT * FROM Estilos;
INSERT INTO Estilos VALUES ('Folk');
INSERT INTO Artistas VALUES ('Stu Larsen', 4);
SELECT * FROM ARTISTAS;
SELECT A.IdArtista, A.Nome, A.IdEstilo, E.Nome AS NomeEstilo FROM Artistas A INNER JOIN Estilos E ON A.IdEstilo = E.IdEstilo;
select * from Estilos
| true
|
3f55a32f81fcf8793545f9af84ce79743b9a4992
|
SQL
|
pujui/orderSystem
|
/backup/ordersystem.sql
|
UTF-8
| 10,668
| 3.0625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- 主機: localhost
-- 建立日期: 2016 年 10 月 19 日 20:51
-- 伺服器版本: 5.5.52-0ubuntu0.14.04.1
-- PHP 版本: 5.5.9-1ubuntu4.20
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 */;
--
-- 資料庫: `ordersystem`
--
-- --------------------------------------------------------
--
-- 資料表結構 `extramenu`
--
CREATE TABLE IF NOT EXISTS `extramenu` (
`extraId` int(1) unsigned NOT NULL AUTO_INCREMENT,
`className` varchar(30) NOT NULL,
`name` varchar(30) NOT NULL,
`selected` smallint(1) NOT NULL COMMENT '1預設值',
`price` int(11) NOT NULL,
PRIMARY KEY (`extraId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='額外選項' AUTO_INCREMENT=36 ;
--
-- 資料表的匯出資料 `extramenu`
--
INSERT INTO `extramenu` (`extraId`, `className`, `name`, `selected`, `price`) VALUES
(1, 'ice', '正常', 1, 0),
(2, 'ice', '多冰', 0, 0),
(3, 'ice', '少冰', 0, 0),
(4, 'ice', '微冰', 0, 0),
(5, 'ice', '去冰', 0, 0),
(6, 'ice', '', 0, 0),
(7, 'ice', '', 0, 0),
(8, 'ice', '', 0, 0),
(9, 'ice', '', 0, 0),
(10, 'ice', '', 0, 0),
(11, 'sugar', '正常', 1, 0),
(12, 'sugar', '半糖', 0, 0),
(13, 'sugar', '少糖', 0, 0),
(14, 'sugar', '微糖', 0, 0),
(15, 'sugar', '無糖', 0, 0),
(16, 'sugar', '', 0, 0),
(17, 'sugar', '', 0, 0),
(18, 'sugar', '', 0, 0),
(19, 'sugar', '', 0, 0),
(20, 'sugar', '', 0, 0),
(21, 'extra', '少蜂蜜', 0, 0),
(22, 'extra', '去蜂蜜', 0, 0),
(23, 'extra', '加蜂蜜', 0, 0),
(24, 'extra', '酸一點', 0, 0),
(25, 'extra', '全奶+10', 0, 10),
(26, 'extra', '加牛奶+10', 0, 10),
(27, 'extra', '加布丁+15', 0, 15),
(28, 'extra', '去布丁', 0, 0),
(29, 'extra', '去牛奶-10', 0, -10),
(30, 'extra', '去牛奶-5', 0, -5),
(31, 'extra', '', 0, 0),
(32, 'extra', '', 0, 0),
(33, 'extra', '', 0, 0),
(34, 'extra', '', 0, 0),
(35, 'extra', '', 0, 0);
-- --------------------------------------------------------
--
-- 資料表結構 `menu`
--
CREATE TABLE IF NOT EXISTS `menu` (
`menuId` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜單ID',
`name` varchar(200) NOT NULL COMMENT '產品名稱',
`firstClass` varchar(100) NOT NULL COMMENT '第一層分類',
`supportStatus` int(1) unsigned NOT NULL COMMENT '產品支援狀態',
`isCancel` smallint(1) NOT NULL COMMENT '是否取消販賣',
`updateTime` datetime NOT NULL,
`createTime` datetime NOT NULL,
`classPrice1` int(11) NOT NULL,
`className1` varchar(30) NOT NULL,
`classPrice2` int(11) NOT NULL,
`className2` varchar(30) NOT NULL,
`classPrice3` int(11) NOT NULL,
`className3` varchar(30) NOT NULL,
`classPrice4` int(11) NOT NULL,
`className4` varchar(30) NOT NULL,
`classPrice5` int(11) NOT NULL,
`className5` varchar(30) NOT NULL,
`classPrice6` int(11) NOT NULL,
`className6` varchar(30) NOT NULL,
`classPrice7` int(11) NOT NULL,
`className7` varchar(30) NOT NULL,
`classPrice8` int(11) NOT NULL,
`className8` varchar(30) NOT NULL,
`classPrice9` int(11) NOT NULL,
`className9` varchar(30) NOT NULL,
`classPrice10` int(11) NOT NULL,
`className10` varchar(30) NOT NULL,
PRIMARY KEY (`menuId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜單內容' AUTO_INCREMENT=18 ;
--
-- 資料表的匯出資料 `menu`
--
INSERT INTO `menu` (`menuId`, `name`, `firstClass`, `supportStatus`, `isCancel`, `updateTime`, `createTime`, `classPrice1`, `className1`, `classPrice2`, `className2`, `classPrice3`, `className3`, `classPrice4`, `className4`, `classPrice5`, `className5`, `classPrice6`, `className6`, `classPrice7`, `className7`, `classPrice8`, `className8`, `classPrice9`, `className9`, `classPrice10`, `className10`) VALUES
(1, '西瓜汁', '新鮮現打果汁', 0, 0, '2016-10-19 17:48:11', '2016-10-17 09:17:38', 30, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(2, '蜂蜜檸檬', '檸檬', 0, 0, '2016-10-19 17:47:43', '2016-10-17 09:18:08', 35, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(3, '金桔檸檬', '檸檬', 0, 0, '2016-10-19 17:47:55', '2016-10-17 09:18:52', 35, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(4, '西瓜牛奶', '牛奶', 0, 0, '2016-10-19 17:43:49', '2016-10-17 09:19:06', 40, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(5, '木瓜牛奶', '牛奶', 0, 0, '2016-10-19 17:44:24', '2016-10-17 09:19:49', 40, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(6, '酪梨牛奶', '牛奶', 0, 0, '2016-10-19 17:44:37', '2016-10-17 09:20:43', 65, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(7, '蘋果蔓越莓', '新鮮現打果汁', 0, 0, '2016-10-19 17:48:37', '2016-10-17 09:22:16', 50, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(8, '蘋果奇異果', '新鮮現打果汁', 0, 0, '2016-10-19 17:49:05', '2016-10-17 09:22:40', 50, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(9, '蘋果牛奶', '牛奶', 0, 0, '2016-10-19 17:44:58', '2016-10-17 09:23:11', 40, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(10, '藍莓牛奶', '牛奶', 0, 0, '2016-10-19 17:45:15', '2016-10-17 09:23:24', 70, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(11, '香蕉牛奶', '牛奶', 0, 0, '2016-10-19 17:45:34', '2016-10-17 09:23:37', 40, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(12, '奇異果汁', '新鮮現打果汁', 0, 0, '2016-10-19 17:49:39', '2016-10-17 09:23:55', 35, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(13, '柳橙奇異果', '新鮮現打果汁', 0, 0, '2016-10-19 17:50:08', '2016-10-17 09:24:26', 50, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(14, '蘋果柳橙', '新鮮現打果汁', 0, 0, '2016-10-19 17:50:31', '2016-10-17 09:24:45', 50, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(15, '鳳梨蘋果牛奶', '牛奶', 0, 0, '2016-10-19 17:47:03', '2016-10-19 17:47:03', 40, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(16, '芭樂汁', '新鮮現打果汁', 0, 0, '2016-10-19 17:51:32', '2016-10-19 17:51:32', 40, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, ''),
(17, '柳丁原汁', '新鮮現打果汁', 0, 0, '2016-10-19 17:52:00', '2016-10-19 17:52:00', 60, '(', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '');
-- --------------------------------------------------------
--
-- 資料表結構 `orderdetail`
--
CREATE TABLE IF NOT EXISTS `orderdetail` (
`orderDetailId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`orderId` int(10) unsigned NOT NULL,
`menuId` int(11) NOT NULL,
`price` int(1) NOT NULL COMMENT '價錢',
`itemCount` int(1) unsigned NOT NULL,
`itemTotal` int(1) unsigned NOT NULL,
`status` smallint(1) unsigned NOT NULL COMMENT '處理狀態 0 未處理, 1已處理完畢',
`createTime` datetime NOT NULL,
`updateTime` datetime NOT NULL,
`memo` varchar(200) NOT NULL COMMENT '備註',
PRIMARY KEY (`orderDetailId`),
KEY `orderId` (`orderId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='訂單明細' AUTO_INCREMENT=4 ;
--
-- 資料表的匯出資料 `orderdetail`
--
INSERT INTO `orderdetail` (`orderDetailId`, `orderId`, `menuId`, `price`, `itemCount`, `itemTotal`, `status`, `createTime`, `updateTime`, `memo`) VALUES
(1, 1, 4, 30, 3, 90, 0, '2016-10-19 17:15:07', '0000-00-00 00:00:00', '西瓜牛奶 半糖多冰 去牛奶-10'),
(2, 2, 6, 75, 1, 75, 0, '2016-10-19 17:59:05', '0000-00-00 00:00:00', '酪梨牛奶 半糖微冰 全奶+10'),
(3, 3, 6, 75, 4, 300, 0, '2016-10-19 18:10:34', '0000-00-00 00:00:00', '酪梨牛奶 正常正常 全奶+10');
-- --------------------------------------------------------
--
-- 資料表結構 `orderlist`
--
CREATE TABLE IF NOT EXISTS `orderlist` (
`orderId` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '訂單號碼',
`todayOrderNo` varchar(13) NOT NULL COMMENT '20160821O0001',
`creater` int(10) unsigned NOT NULL COMMENT '建立者',
`priceTotal` int(1) NOT NULL COMMENT '總價錢',
`createTime` datetime NOT NULL,
`updateTime` datetime NOT NULL,
`status` smallint(1) NOT NULL COMMENT '處理狀態 0取消訂單, 1訂單成立',
PRIMARY KEY (`orderId`),
KEY `createTime` (`createTime`),
KEY `todayOrderNo` (`todayOrderNo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='訂單列表' AUTO_INCREMENT=4 ;
--
-- 資料表的匯出資料 `orderlist`
--
INSERT INTO `orderlist` (`orderId`, `todayOrderNo`, `creater`, `priceTotal`, `createTime`, `updateTime`, `status`) VALUES
(1, '20161019O0001', 1, 90, '2016-10-19 17:15:07', '0000-00-00 00:00:00', 1),
(2, '20161019O0002', 1, 75, '2016-10-19 17:59:05', '0000-00-00 00:00:00', 1),
(3, '20161019O0003', 1, 300, '2016-10-19 18:10:34', '0000-00-00 00:00:00', 1);
-- --------------------------------------------------------
--
-- 資料表結構 `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`userId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`account` varchar(50) NOT NULL COMMENT '帳號',
`name` varchar(100) NOT NULL COMMENT '姓名',
`password` varchar(100) NOT NULL COMMENT '密碼',
`privateKey` varchar(100) NOT NULL COMMENT '私用key',
`createTime` datetime NOT NULL COMMENT '建立時間',
`isActive` smallint(1) NOT NULL COMMENT '-1 刪除, 0 未啟用, 1 啟用, 2 管理者',
`updateTime` datetime NOT NULL COMMENT '最後活動時間',
PRIMARY KEY (`userId`),
UNIQUE KEY `account` (`account`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='使用者資料表' AUTO_INCREMENT=5 ;
--
-- 資料表的匯出資料 `user`
--
INSERT INTO `user` (`userId`, `account`, `name`, `password`, `privateKey`, `createTime`, `isActive`, `updateTime`) VALUES
(1, 'root001', 'root', '20e5629ef82a8b4486f4081a98cff52a79e28c5c', 'asdfqwe', '2016-10-17 00:00:00', 2, '2016-10-17 09:10:18'),
(2, 'EP001', 'employee', '90390fd6538309165393a13e485e08f98bba9160', 'asdfqwe', '2016-10-17 09:13:38', 1, '2016-10-17 09:13:38'),
(3, 'wqd', 'qwe', '4e33a6e1a4008ea404095bb31c55761383b2d36a', 'asdfqwe', '2016-10-17 14:28:31', 0, '2016-10-17 14:28:37'),
(4, '4324', '4324', 'aa16e46a2cacaa37e11091b6706db21c09a92169', 'asdfqwe', '2016-10-17 14:31:16', 0, '2016-10-17 14:31:16');
/*!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
|
dfd90c952bf494b1d90895dcef6579612b6c4899
|
SQL
|
Rumbie-Mudzie7/SQL-Zoo
|
/numeric_examples.sql
|
UTF-8
| 2,431
| 4.53125
| 5
|
[
"MIT"
] |
permissive
|
-- 1. Show the the percentage who STRONGLY AGREE.
SELECT
A_STRONGLY_AGREE
FROM
nss
WHERE
question = 'Q01'
AND
institution = 'Edinburgh Napier University'
AND
nss.subject = '(8) Computer Science';
-- 2. Show the institution and subject where the score is at least 100 for question 15.
SELECT
nss.institution, nss.subject
FROM
nss
WHERE
question = 'Q15' AND score >= 100;
-- 3. Show the institution and score where the score for '(8) Computer Science' is less than 50 for question 'Q15'.
SELECT
nss.institution, nss.score
FROM
nss
WHERE
nss.subject = '(8) Computer Science' AND score < 50 AND question = 'Q15';
/* 4. Show the subject and total number of students who responded to question 22 for each of the subjects
'(8) Computer Science' and '(H) Creative Arts and Design'. */
SELECT
nss.subject, SUM(response)
FROM
nss
WHERE
question = 'Q22'
AND
nss.subject IN ('(H) Creative Arts and Design', '(8) Computer Science')
GROUP BY
nss.subject;
/* 5. Show the subject and total number of students who A_STRONGLY_AGREE to question 22 for each of the subjects
'(8) Computer Science' and '(H) Creative Arts and Design'. */
SELECT
nss.subject, SUM(A_STRONGLY_AGREE * response / 100) AS total_students
FROM
nss
WHERE
question = 'Q22'
AND
nss.subject IN ('(8) Computer Science', '(H) Creative Arts and Design')
GROUP BY
nss.subject;
/* 6. Show the percentage of students who A_STRONGLY_AGREE to question 22 for the subject
'(8) Computer Science' show the same figure for the subject '(H) Creative Arts and Design'. */
SELECT
nss.subject, ROUND(SUM(A_STRONGLY_AGREE / 100 * response) / SUM(response) * 100)
FROM
nss
WHERE
question = 'Q22'
AND
nss.subject IN ('(8) Computer Science', '(H) Creative Arts and Design')
GROUP BY
nss.subject;
-- 7. Show the average scores for question 'Q22' for each institution that include 'Manchester' in the name.
SELECT
institution, ROUND(SUM(score / 100 * response) / SUM(response) * 100)
FROM
nss
WHERE
question = 'Q22' AND (institution LIKE '%Manchester%')
GROUP BY
institution;
-- 8. Show the institution, the total sample size and the number of computing students for institutions in Manchester for 'Q01'.
SELECT
institution, SUM(sample),
SUM(CASE WHEN subject = '(8) Computer Science'
THEN sample
ELSE 0
END)
FROM
nss
WHERE
question = 'Q01' AND (institution LIKE '%Manchester%')
GROUP BY
institution;
| true
|
60313c2f51925a47061f6eab2fba926ad54104e2
|
SQL
|
pa-ulander/arbetsprov
|
/arbetsprov/arbetsprov.sql
|
UTF-8
| 2,621
| 3.171875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 3.4.10.1
-- http://www.phpmyadmin.net
--
-- Värd: localhost
-- Skapad: 24 aug 2012 kl 08:37
-- Serverversion: 5.1.36
-- PHP-version: 5.3.3
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Databas: `arbetsprov`
--
-- --------------------------------------------------------
--
-- Tabellstruktur `programs`
--
CREATE TABLE IF NOT EXISTS `programs` (
`pkey` int(11) NOT NULL AUTO_INCREMENT,
`date` datetime NOT NULL,
`start_time` time NOT NULL,
`leadtext` text NOT NULL,
`name` varchar(100) NOT NULL,
`b-line` varchar(100) NOT NULL,
`synopsis` text NOT NULL,
`url` varchar(150) NOT NULL,
PRIMARY KEY (`pkey`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=35 ;
--
-- Dumpning av Data i tabell `programs`
--
INSERT INTO `programs` (`pkey`, `date`, `start_time`, `leadtext`, `name`, `b-line`, `synopsis`, `url`) VALUES
(1, '2009-04-16 21:30:00', '17:00:00', 'Franz är en något udda barnflicka. Hon kommer från den tuffa New York-stadsdelen Queens och är en kvinna med starka åsikter, ett ansikte som skulle platsa på Vogues omslag, samt en röst som kan spräcka glas!', 'Program 1', 'Tysk thrillerserie', 'Maxwell ringer Frank och säger att han gjorde ett stort misstag för några månader sen. Fran blir alldeles till sig och hoppas att han ska förklara sin kärlek till henne. Istället handlar det bara om en skattedetalj. Fran flyttar ut och Sylvia tar över jobbet. Del 16:25', 'http://www.domain.tld/programname'),
(2, '2007-08-13 12:16:00', '21:00:00', 'Om familjerna Persson,Horton, Brady, Black, Kiriakis och deras vänner, grannar och rivaler i Salem, USA. Familjen Horton består bl a av Alice, sonen Mickey och barnbarnen Jennifer och Mike. Familjen Brady består bl a av Shawn och Caroline, som är familjens överhuvuden, samt Bo, Carrie, Samantha Sami, Marlena, Roamn och John. Intriger, romanser och spänning präglar denna serier som startade i USA 1965 och har därmed varit under inspelning i 40 år.', 'Program 2', 'Drama från 2003', 'Bröderna Persson berättar historier om hur de träffade varandra och reaktionen från Teds nya flickvän får nio av tio på knäpphetsskalan. Del 5:24', 'http://www.domain.tld/programname');
/*!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
|
7d0fc1cdbb9dcb3e7959ef1c4ffc7f1e19ba985a
|
SQL
|
magdielmercado/cancino
|
/base de datos/schema.sql
|
UTF-8
| 9,517
| 3.40625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 28-11-2017 a las 03:58:13
-- Versión del servidor: 10.1.9-MariaDB
-- Versión de PHP: 5.6.15
DROP DATABASE cancino;
CREATE DATABASE cancino;
USE cancino;
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 */;
--
-- Base de datos: `tickets`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `area`
CREATE TABLE puesto (
idpuesto integer primary key AUTO_INCREMENT,
nombrepuesto varchar (30) not null
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into puesto (nombrepuesto) values
('Director'),
('Gerente'),
('Subgerente'),
('Contador responsable'),
('Colaborador');
--
CREATE TABLE `area` (
`id` int(11) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `clientes`
CREATE TABLE cliente(
rfccliente varchar (13) PRIMARY KEY NOT NULL,
nombrecliente varchar (120) NOT NULL,
contactocliente varchar (50) NOT NULL,
telefonocliente varchar (18) NOT NULL,
correocliente varchar (35) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*CREATE TABLE `clientes` (
`id` int(11) NOT NULL,
`business` varchar(80) NOT NULL,
`fullname` varchar(80) NOT NULL,
`email` varchar(50) NOT NULL,
`ruc` varchar(50) NOT NULL,
`created_at` datetime NOT NULL,
`ban` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
*/
-- --------------------------------------------------------
INSERT INTO cliente(rfccliente,nombrecliente,contactocliente,telefonocliente,correocliente) values
('HIAA0811871T4','outsorsing','Pedro','9212667426','hector.ivan.alvarado@pemex'),
('HIAA0811871T5','outsorsing','hector','9212667426','hector.ivan.alvarado@pemex'),
('HIAA0811871T6','outsorsing','juan','9212667426','hector.ivan.alvarado@pemex'),
('HIAA0811871T7','outsorsing','mag','9212667426','hector.ivan.alvarado@pemex'),
('HIAA0811871T8','outsorsing','jorge','9212667426','hector.ivan.alvarado@pemex');
--
-- Estructura de tabla para la tabla `configuration`
--
CREATE TABLE `configuration` (
`id` int(11) NOT NULL,
`label` varchar(100) NOT NULL,
`name` varchar(100) NOT NULL,
`val` text,
`cfg_id` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `configuration`
--
INSERT INTO `configuration` (`id`, `label`, `name`, `val`, `cfg_id`) VALUES
(1, 'Nombre del Sitio Web', 'website', 'Fiscal 1.0', 1),
(2, 'Correo Electronico', 'email', 'jontiveros490@gmail.com', 1),
(3, 'URL Base', 'url_base', 'http://localhost/project/abisoft/ticketly-pro/', 1),
(4, 'Favicon', 'favicon', 'favicon.png', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `kind`
--
CREATE TABLE `kind` (
`id` int(11) NOT NULL,
`name` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `kind`
--
INSERT INTO `kind` (`id`, `name`) VALUES
(1, 'Otro');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `status`
--
CREATE TABLE `status` (
`id` int(11) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`created_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `status`
--
INSERT INTO `status` (`id`, `name`, `created_at`) VALUES
(1, 'Registrado', '2017-11-27 20:57:15'),
(2, 'Asignado', '2017-11-27 20:57:15'),
(3, 'Con Incidencia', '2017-11-27 20:57:15'),
(4, 'Atendido', '2017-11-27 20:57:15');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tickets`
--
CREATE TABLE `tickets` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(80) NOT NULL,
`phone` varchar(50) NOT NULL,
`cell_phone` varchar(50) NOT NULL,
`contact_schedule` varchar(50) DEFAULT NULL,
`kind_id` int(11) NOT NULL,
`comment` text NOT NULL,
`image` varchar(150) NOT NULL,
`area` int(11) NOT NULL,
`asunt` varchar(150) NOT NULL,
`id_team` varchar(50) NOT NULL,
`pass_team` varchar(50) NOT NULL,
`client_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`status_id` int(11) NOT NULL,
`number_ticket` varchar(200) NOT NULL,
`asigned_id` int(11) NOT NULL,
`tipo_requerimiento` int(11) NOT NULL DEFAULT '0',
`sistema` varchar(250) NOT NULL,
`date_atendid` datetime NOT NULL,
`finalizado` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tipos_requerimientos`
--
CREATE TABLE `tipos_requerimientos` (
`id` int(11) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `user`
CREATE TABLE usuario(
idusuario integer PRIMARY KEY AUTO_INCREMENT,
usuario varchar(30) not null,
contrasena varchar(60) not null,
nombreusuario varchar(50) not null,
idpuesto integer not null REFERENCES puesto (idpuesto),
fotousuario varchar(250) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `usuario` ( `usuario`, `contrasena`, `nombreusuario`, `idpuesto`,`fotousuario`) VALUES
('admin','90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', 'admin',1,'admin.jpg'),
('superh','90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', 'hector',1,'superh.jpg'),
('jorge','90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', 'jorge',2,'jorge.jpg'),
('mag','90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', 'mag',3,'mag.jpg'),
('edgar','90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', 'admin',2,'edgar.jpg');
UPDATE usuario SET fotousuario = "superh.jpg" WHERE idusuario = 2;
--
/*
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`username` varchar(50) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`password` varchar(60) DEFAULT NULL,
`profile_pic` varchar(250) DEFAULT NULL,
`is_active` tinyint(1) NOT NULL DEFAULT '1',
`is_admin` tinyint(1) NOT NULL DEFAULT '0',
`kind` int(11) NOT NULL DEFAULT '1',
`created_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
*/
--
-- Volcado de datos para la tabla `user`
--
/*
INSERT INTO `user` (`id`, `username`, `name`, `lastname`, `email`, `password`, `profile_pic`, `is_active`, `is_admin`, `kind`, `created_at`) VALUES
(1, 'admin', NULL, NULL, NULL, '90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', 'default.png', 1, 1, 1, '2017-11-27 20:57:14');
*/
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `area`
--
ALTER TABLE `area`
ADD PRIMARY KEY (`id`);
--
/* Indices de la tabla `clientes`
--
--ALTER TABLE `clientes`
--
--ADD PRIMARY KEY (`id`);
*/
--
-- Indices de la tabla `configuration`
--
ALTER TABLE `configuration`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indices de la tabla `kind`
--
ALTER TABLE `kind`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `status`
--
ALTER TABLE `status`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `tickets`
--
ALTER TABLE `tickets`
ADD PRIMARY KEY (`id`),
ADD KEY `area` (`area`),
ADD KEY `status_id` (`status_id`),
ADD KEY `client_id` (`client_id`),
ADD KEY `kind_id` (`kind_id`);
--
-- Indices de la tabla `tipos_requerimientos`
--
ALTER TABLE `tipos_requerimientos`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `user`
--
-- ALTER TABLE `user`
-- ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `area`
--
ALTER TABLE `area`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `clientes`
--
/*ALTER TABLE `clientes`
-- MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `configuration`
*/
--
ALTER TABLE `configuration`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `kind`
--
ALTER TABLE `kind`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT de la tabla `status`
--
ALTER TABLE `status`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `tickets`
--
ALTER TABLE `tickets`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tipos_requerimientos`
--
ALTER TABLE `tipos_requerimientos`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `user`
--
-- ALTER TABLE `user`
-- MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `tickets`
--
ALTER TABLE `tickets`
ADD CONSTRAINT `tickets_ibfk_1` FOREIGN KEY (`area`) REFERENCES `area` (`id`),
ADD CONSTRAINT `tickets_ibfk_2` FOREIGN KEY (`status_id`) REFERENCES `status` (`id`),
-- ADD CONSTRAINT `tickets_ibfk_3` FOREIGN KEY (`client_id`) REFERENCES `clientes` (`id`),
ADD CONSTRAINT `tickets_ibfk_4` FOREIGN KEY (`kind_id`) REFERENCES `kind` (`id`);
/*!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 */;
ALTER TABLE `tickets` ADD `date_asigned` DATETIME NULL AFTER `date_atendid`
| true
|
08d594f63ada524f268df4acc1c17845b7eaff3f
|
SQL
|
gabyacg29/BASE-DE-DATOS
|
/INTRODUCCION BASE DE DATOS_gabriela_cinquemani/BD AGENCIA_VIAJE.sql
|
UTF-8
| 4,611
| 3.5
| 4
|
[] |
no_license
|
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema agencia_viaje
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema agencia_viaje
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `agencia_viaje` DEFAULT CHARACTER SET utf8 ;
USE `agencia_viaje` ;
-- -----------------------------------------------------
-- Table `agencia_viaje`.`turista`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `agencia_viaje`.`turista` (
`idturista` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NOT NULL,
`genero` VARCHAR(1) NOT NULL,
`direccion` VARCHAR(45) NOT NULL,
`email` VARCHAR(45) NOT NULL,
`edad` INT NOT NULL,
PRIMARY KEY (`idturista`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `agencia_viaje`.`agente`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `agencia_viaje`.`agente` (
`idagente` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NOT NULL,
PRIMARY KEY (`idagente`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `agencia_viaje`.`destino`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `agencia_viaje`.`destino` (
`iddestino` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NOT NULL,
`imagen_destino` VARCHAR(50) NOT NULL,
`popularidad` INT NOT NULL,
PRIMARY KEY (`iddestino`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `agencia_viaje`.`hotel`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `agencia_viaje`.`hotel` (
`idhotel` INT NOT NULL AUTO_INCREMENT,
`nombre_hotel` VARCHAR(45) NOT NULL,
`direccion_hotel` VARCHAR(45) NOT NULL,
`imagen_hotel` VARCHAR(50) NOT NULL,
PRIMARY KEY (`idhotel`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `agencia_viaje`.`promociones`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `agencia_viaje`.`promociones` (
`idpromociones` INT NOT NULL AUTO_INCREMENT,
`nombre_promocion` VARCHAR(45) NOT NULL,
`fecha_inicio` DATE NOT NULL,
`fecha:final` DATE NOT NULL,
`precio` DECIMAL(2) NOT NULL,
`destino_iddestino` INT NOT NULL,
`turista_idturista` INT NOT NULL,
`agente_idagente` INT NOT NULL,
`hotel_idhotel` INT NOT NULL,
PRIMARY KEY (`idpromociones`),
INDEX `fk_promociones_destino1_idx` (`destino_iddestino` ASC) VISIBLE,
INDEX `fk_promociones_turista1_idx` (`turista_idturista` ASC) VISIBLE,
INDEX `fk_promociones_agente1_idx` (`agente_idagente` ASC) VISIBLE,
INDEX `fk_promociones_hotel1_idx` (`hotel_idhotel` ASC) VISIBLE,
CONSTRAINT `fk_promociones_destino1`
FOREIGN KEY (`destino_iddestino`)
REFERENCES `agencia_viaje`.`destino` (`iddestino`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_promociones_turista1`
FOREIGN KEY (`turista_idturista`)
REFERENCES `agencia_viaje`.`turista` (`idturista`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_promociones_agente1`
FOREIGN KEY (`agente_idagente`)
REFERENCES `agencia_viaje`.`agente` (`idagente`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_promociones_hotel1`
FOREIGN KEY (`hotel_idhotel`)
REFERENCES `agencia_viaje`.`hotel` (`idhotel`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `agencia_viaje`.`venta`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `agencia_viaje`.`venta` (
`idventa` INT NOT NULL AUTO_INCREMENT,
`fecha_vta` DATE NOT NULL,
`promociones_idpromociones` INT NOT NULL,
PRIMARY KEY (`idventa`),
INDEX `fk_venta_promociones1_idx` (`promociones_idpromociones` ASC) VISIBLE,
CONSTRAINT `fk_venta_promociones1`
FOREIGN KEY (`promociones_idpromociones`)
REFERENCES `agencia_viaje`.`promociones` (`idpromociones`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
| true
|
e87e366527ac473f36795948f168410e2a9ffdab
|
SQL
|
ifsp-slt-old/Controle-de-Agrotoxicos
|
/doc/Ger.%20Configuracao/BancoDeDados/PRJ2_ctrl_agrotoxicos.sql
|
UTF-8
| 9,721
| 2.9375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 21-Out-2016 às 15:27
-- Versão do servidor: 5.1.54-community
-- PHP Version: 5.5.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `ctrl_agrotoxicos`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `agtxunidade`
--
CREATE TABLE IF NOT EXISTS `agtxunidade` (
`idAgtxUnidade` int(11) NOT NULL AUTO_INCREMENT,
`nomeComercialAgtx` varchar(45) NOT NULL,
`classeAplicacaoAgtx` varchar(45) NOT NULL,
`principioAtivoAgtx` varchar(45) NOT NULL,
`concentracaoAgtx` varchar(45) NOT NULL,
`formulacaoAgtx` varchar(45) NOT NULL,
`statusAgtx` char(1) NOT NULL,
`Fabricante_idFabricante` int(11) NOT NULL,
`Fornecedor_idFornecedor` int(11) NOT NULL,
`Embalagem_idEmbalagem` int(11) NOT NULL,
PRIMARY KEY (`idAgtxUnidade`,`Fabricante_idFabricante`,`Fornecedor_idFornecedor`,`Embalagem_idEmbalagem`),
KEY `fk_AgtxUnidade_Fabricante_idx` (`Fabricante_idFabricante`),
KEY `fk_AgtxUnidade_Fornecedor_idx` (`Fornecedor_idFornecedor`),
KEY `fk_AgtxUnidade_Embalagem_idx` (`Embalagem_idEmbalagem`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `embalagem`
--
CREATE TABLE IF NOT EXISTS `embalagem` (
`idEmbalagem` int(11) NOT NULL AUTO_INCREMENT,
`tipoEmbalagem` varchar(10) NOT NULL,
`undMedidaEmbalagem` varchar(3) NOT NULL,
`qtdMedidaEmbalagem` float unsigned NOT NULL,
PRIMARY KEY (`idEmbalagem`),
UNIQUE KEY `tipoEmbalagem_UNIQUE` (`tipoEmbalagem`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `entrada`
--
CREATE TABLE IF NOT EXISTS `entrada` (
`idEntrada` int(6) unsigned zerofill NOT NULL AUTO_INCREMENT,
`receitaEntrada` varchar(45) NOT NULL,
`nfNumEntrada` varchar(45) NOT NULL,
`dataNfEntrada` date NOT NULL,
`dataFabEntrada` date NOT NULL,
`dataValEntrada` date NOT NULL,
`dataEntrada` datetime NOT NULL,
`qtdAtualEntrada` float unsigned NOT NULL,
`stattusUsoEntrada` char(1) NOT NULL,
`AgtxUnidade_idAgtxUnidade` int(11) NOT NULL
PRIMARY KEY (`idEntrada`,`AgtxUnidade_idAgtxUnidade`,`AgtxUnidade_Fabricante_idFabricante`,`AgtxUnidade_Fornecedor_idFornecedor`,`AgtxUnidade_Embalagem_idEmbalagem`),
KEY `fk_Entrada_AgtxUnidade_idx` (`AgtxUnidade_idAgtxUnidade`,`AgtxUnidade_Fabricante_idFabricante`,`AgtxUnidade_Fornecedor_idFornecedor`,`AgtxUnidade_Embalagem_idEmbalagem`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `fabricante`
--
CREATE TABLE IF NOT EXISTS `fabricante` (
`idFabricante` int(11) NOT NULL AUTO_INCREMENT,
`nomeFabricante` varchar(45) NOT NULL,
PRIMARY KEY (`idFabricante`),
UNIQUE KEY `nomeFabricante_UNIQUE` (`nomeFabricante`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `fornecedor`
--
CREATE TABLE IF NOT EXISTS `fornecedor` (
`idFornecedor` int(11) NOT NULL AUTO_INCREMENT,
`nomeFornecedor` varchar(45) NOT NULL,
PRIMARY KEY (`idFornecedor`),
UNIQUE KEY `nomeFabricante_UNIQUE` (`nomeFornecedor`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `requisicao`
--
CREATE TABLE IF NOT EXISTS `requisicao` (
`idRequisicao` int(11) NOT NULL AUTO_INCREMENT,
`tipoRequisicao` char(1) NOT NULL,
`dataRequisicao` date NOT NULL,
`principioAtivoReq` varchar(45) DEFAULT NULL,
`concentraçãoReq` varchar(45) DEFAULT NULL,
`formulacaoReq` varchar(45) DEFAULT NULL,
`undMedidaReq` varchar(3) DEFAULT NULL,
`qtdAplicacaoReq` float DEFAULT NULL,
`nfNumEntradaReq` varchar(45) DEFAULT NULL,
`tipoEmbalagemReq` varchar(10) DEFAULT NULL,
`qtdEmbalagemReq` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`idRequisicao`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `retorno`
--
CREATE TABLE IF NOT EXISTS `retorno` (
`idRetorno` int(11) NOT NULL AUTO_INCREMENT,
`pesoRetorno` float unsigned NOT NULL,
`Saida_idSaida` int(11) NOT NULL,
`Saida_Entrada_idEntrada` int(6) unsigned zerofill NOT NULL,
`Saida_Entrada_AgtxUnidade_idAgtxUnidade` int(11) NOT NULL,
`Saida_Entrada_AgtxUnidade_Fabricante_idFabricante` int(11) NOT NULL,
`Saida_Entrada_AgtxUnidade_Fornecedor_idFornecedor` int(11) NOT NULL,
`Saida_Entrada_AgtxUnidade_Embalagem_idEmbalagem` int(11) NOT NULL,
PRIMARY KEY (`idRetorno`,`Saida_idSaida`,`Saida_Entrada_idEntrada`,`Saida_Entrada_AgtxUnidade_idAgtxUnidade`,`Saida_Entrada_AgtxUnidade_Fabricante_idFabricante`,`Saida_Entrada_AgtxUnidade_Fornecedor_idFornecedor`,`Saida_Entrada_AgtxUnidade_Embalagem_idEmbalagem`),
KEY `fk_Retorno_Saida_idx` (`Saida_idSaida`,`Saida_Entrada_idEntrada`,`Saida_Entrada_AgtxUnidade_idAgtxUnidade`,`Saida_Entrada_AgtxUnidade_Fabricante_idFabricante`,`Saida_Entrada_AgtxUnidade_Fornecedor_idFornecedor`,`Saida_Entrada_AgtxUnidade_Embalagem_idEmbalagem`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `saida`
--
CREATE TABLE IF NOT EXISTS `saida` (
`idSaida` int(11) NOT NULL AUTO_INCREMENT,
`tipoSaida` char(1) NOT NULL,
`dataSaida` datetime NOT NULL,
`pesoSaida` float unsigned DEFAULT NULL,
`Entrada_idEntrada` int(6) unsigned zerofill NOT NULL,
`Entrada_AgtxUnidade_idAgtxUnidade` int(11) NOT NULL,
`Entrada_AgtxUnidade_Fabricante_idFabricante` int(11) NOT NULL,
`Entrada_AgtxUnidade_Fornecedor_idFornecedor` int(11) NOT NULL,
`Entrada_AgtxUnidade_Embalagem_idEmbalagem` int(11) NOT NULL,
`Requisicao_idRequisicao` int(11) NOT NULL,
PRIMARY KEY (`idSaida`,`Entrada_idEntrada`,`Entrada_AgtxUnidade_idAgtxUnidade`,`Entrada_AgtxUnidade_Fabricante_idFabricante`,`Entrada_AgtxUnidade_Fornecedor_idFornecedor`,`Entrada_AgtxUnidade_Embalagem_idEmbalagem`,`Requisicao_idRequisicao`),
KEY `fk_Saida_Entrada_idx` (`Entrada_idEntrada`,`Entrada_AgtxUnidade_idAgtxUnidade`,`Entrada_AgtxUnidade_Fabricante_idFabricante`,`Entrada_AgtxUnidade_Fornecedor_idFornecedor`,`Entrada_AgtxUnidade_Embalagem_idEmbalagem`),
KEY `fk_Saida_Requisicao_idx` (`Requisicao_idRequisicao`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Estrutura da tabela `usuario`
--
CREATE TABLE IF NOT EXISTS `usuario` (
`idUsuario` int(11) NOT NULL AUTO_INCREMENT,
`nomeUsuario` varchar(45) NOT NULL,
`loginUsuario` varchar(7) NOT NULL,
`senhaUsuario` varchar(45) NOT NULL,
`permissaoUsuario` char(1) NOT NULL,
PRIMARY KEY (`idUsuario`),
UNIQUE KEY `loginUsuario_UNIQUE` (`loginUsuario`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Constraints for dumped tables
--
--
-- Limitadores para a tabela `agtxunidade`
--
ALTER TABLE `agtxunidade`
ADD CONSTRAINT `fk_AgtxUnidade_Fabricante` FOREIGN KEY (`Fabricante_idFabricante`) REFERENCES `fabricante` (`idFabricante`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_AgtxUnidade_Fornecedor1` FOREIGN KEY (`Fornecedor_idFornecedor`) REFERENCES `fornecedor` (`idFornecedor`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_AgtxUnidade_Embalagem1` FOREIGN KEY (`Embalagem_idEmbalagem`) REFERENCES `embalagem` (`idEmbalagem`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limitadores para a tabela `entrada`
--
ALTER TABLE `entrada`
ADD CONSTRAINT `fk_Entrada_AgtxUnidade1` FOREIGN KEY (`AgtxUnidade_idAgtxUnidade`, `AgtxUnidade_Fabricante_idFabricante`, `AgtxUnidade_Fornecedor_idFornecedor`, `AgtxUnidade_Embalagem_idEmbalagem`) REFERENCES `agtxunidade` (`idAgtxUnidade`, `Fabricante_idFabricante`, `Fornecedor_idFornecedor`, `Embalagem_idEmbalagem`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limitadores para a tabela `retorno`
--
ALTER TABLE `retorno`
ADD CONSTRAINT `fk_Retorno_Saida1` FOREIGN KEY (`Saida_idSaida`, `Saida_Entrada_idEntrada`, `Saida_Entrada_AgtxUnidade_idAgtxUnidade`, `Saida_Entrada_AgtxUnidade_Fabricante_idFabricante`, `Saida_Entrada_AgtxUnidade_Fornecedor_idFornecedor`, `Saida_Entrada_AgtxUnidade_Embalagem_idEmbalagem`) REFERENCES `saida` (`idSaida`, `Entrada_idEntrada`, `Entrada_AgtxUnidade_idAgtxUnidade`, `Entrada_AgtxUnidade_Fabricante_idFabricante`, `Entrada_AgtxUnidade_Fornecedor_idFornecedor`, `Entrada_AgtxUnidade_Embalagem_idEmbalagem`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Limitadores para a tabela `saida`
--
ALTER TABLE `saida`
ADD CONSTRAINT `fk_Saida_Entrada1` FOREIGN KEY (`Entrada_idEntrada`, `Entrada_AgtxUnidade_idAgtxUnidade`) REFERENCES `entrada` (`idEntrada`, `AgtxUnidade_idAgtxUnidade`, `AgtxUnidade_Fabricante_idFabricante`, `AgtxUnidade_Fornecedor_idFornecedor`, `AgtxUnidade_Embalagem_idEmbalagem`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_Saida_Requisicao1` FOREIGN KEY (`Requisicao_idRequisicao`) REFERENCES `requisicao` (`idRequisicao`) ON DELETE NO ACTION ON UPDATE NO ACTION;
/*!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
|
5f71d22f939ad0cf807642e21f4e6c3ecda18236
|
SQL
|
whediger/ANSI-SQL-standards
|
/Recipes/Recipes_Beef_AND_Garlic.sql
|
UTF-8
| 478
| 3.890625
| 4
|
[] |
no_license
|
SELECT Recipes.RecipeTitle
FROM Recipes
WHERE Recipes.RecipeID
IN (SELECT Recipe_Ingredients.RecipeID
FROM Ingredients
INNER JOIN Recipe_Ingredients
ON Ingredients.IngredientID =
Recipe_Ingredients.IngredientID
WHERE Ingredients.IngredientName = 'Beef'
OR Ingredients.IngredientName = 'Garlic'
GROUP BY Recipe_Ingredients.RecipeID
HAVING COUNT(Recipe_Ingredients.RecipeID) = 2);
| true
|
a8e59a586ba994a08cc1e76574f339ff8577f0e1
|
SQL
|
radtek/abs3
|
/sql/mmfo/bars/View/v_sdo_autopay_rules.sql
|
WINDOWS-1251
| 1,403
| 2.796875
| 3
|
[] |
no_license
|
create or replace view v_sdo_autopay_rules
as
select r.rule_id,
r.rule_desc,
rf.FIELD_ID,
field_desc,
FIELD_DBNAME_COPR2,
FIELD_OPERATOR,
RULE_TEXT,
FIELD_DBNAME_CL
from sdo_autopay_rules r, sdo_autopay_rules_desc rd, sdo_autopay_rules_fields rf
where r.rule_id = rd.rule_id
and rd.field_id = rf.field_id
order by rule_id, field_id;
comment on table v_sdo_autopay_rules is ' ';
comment on column v_sdo_autopay_rules.rule_id is ' ';
comment on column v_sdo_autopay_rules.rule_desc is ' ';
comment on column v_sdo_autopay_rules.FIELD_ID is ' ';
comment on column v_sdo_autopay_rules.field_desc is ' ';
comment on column v_sdo_autopay_rules.FIELD_DBNAME_COPR2 is ' (2)';
comment on column v_sdo_autopay_rules.FIELD_OPERATOR is '';
comment on column v_sdo_autopay_rules.RULE_TEXT is ' ';
comment on column v_sdo_autopay_rules.FIELD_DBNAME_CL is ' ()';
grant select on v_sdo_autopay_rules to bars_access_defrole;
| true
|
b190da17efcef09b0967118f2ba56fdc32249808
|
SQL
|
IVSEZ/mysqlbis
|
/_DailyScript/telemetry_livetv_hourlypivot.sql
|
UTF-8
| 1,979
| 3.6875
| 4
|
[] |
no_license
|
select * from rcbill_my.rep_livetvhourlypivot; -- where sessiondate='2018-08-28';
select * from rcbill_my.rep_livetvhourlystats; -- where resource='SBC';
select *
, year(sessiondate) as SESSIONYR, month(sessiondate) as SESSIONMT, day(sessiondate) as SESSIONDY
, dayname(sessiondate) as SESSIONDAY, monthname(sessiondate) as SESSIONMONTH
from rcbill_my.rep_livetvhourlypivot
-- where monthname(sessiondate) ='August' and resource='SBC'
;
SELECT
RESOURCE
, monthname(sessiondate) as SESSIONMONTH
, round(avg(`0`)) as `0` , round(avg(`1`)) as `1` , round(avg(`2`)) as `2` , round(avg(`3`)) as `3` , round(avg(`4`)) as `4` , round(avg(`5`)) as `5` , round(avg(`6`)) as `6` , round(avg(`7`)) as `7` , round(avg(`8`)) as `8` , round(avg(`9`)) as `9` , round(avg(`10`)) as `10` , round(avg(`11`)) as `11` , round(avg(`12`)) as `12` , round(avg(`13`)) as `13` , round(avg(`14`)) as `14` , round(avg(`15`)) as `15` , round(avg(`16`)) as `16` , round(avg(`17`)) as `17` , round(avg(`18`)) as `18` , round(avg(`19`)) as `19` , round(avg(`20`)) as `20` , round(avg(`21`)) as `21` , round(avg(`22`)) as `22` , round(avg(`23`)) as `23`
FROM rcbill_my.rep_livetvhourlypivot
GROUP BY 1,2
order by sessiondate, resource
;
SELECT
RESOURCE
, dayname(sessiondate) as SESSIONDAY
, round(avg(`0`)) as `0` , round(avg(`1`)) as `1` , round(avg(`2`)) as `2` , round(avg(`3`)) as `3` , round(avg(`4`)) as `4` , round(avg(`5`)) as `5` , round(avg(`6`)) as `6` , round(avg(`7`)) as `7` , round(avg(`8`)) as `8` , round(avg(`9`)) as `9` , round(avg(`10`)) as `10` , round(avg(`11`)) as `11` , round(avg(`12`)) as `12` , round(avg(`13`)) as `13` , round(avg(`14`)) as `14` , round(avg(`15`)) as `15` , round(avg(`16`)) as `16` , round(avg(`17`)) as `17` , round(avg(`18`)) as `18` , round(avg(`19`)) as `19` , round(avg(`20`)) as `20` , round(avg(`21`)) as `21` , round(avg(`22`)) as `22` , round(avg(`23`)) as `23`
FROM rcbill_my.rep_livetvhourlypivot
GROUP BY 1,2
order by sessiondate, resource
;
| true
|
4d1d2e3908fbe2e3f1846da598dabbf9ae48d92c
|
SQL
|
YuanyuWendyMu/EveryDaySQL
|
/HackerRank/Interviews.sql
|
UTF-8
| 1,007
| 4.46875
| 4
|
[] |
no_license
|
select
con.contest_id,
con.hacker_id,
con.name,
sum(total_submissions),
sum(total_accepted_submissions),
sum(total_views),
sum(total_unique_views)
from Contests con
LEFT JOIN colleges col on con.contest_id = col.contest_id
LEFT JOIN Challenges cha on col.college_id = cha. college_id
LEFT JOIN
(select challenge_id,
sum(total_views) as total_views,
sum(total_unique_views) as total_unique_views
from view_stats V
group by challenge_id) temp1
on cha.challenge_id = temp1.challenge_id
LEFT JOIN
(select challenge_id,
sum(total_submissions) as total_submissions,
sum(total_accepted_submissions) as total_accepted_submissions
from Submission_Stats S
group by challenge_id) temp2
on cha.challenge_id = temp2.challenge_id
group by con.contest_id,con.hacker_id,con.name
having sum(total_views) != 0 or
sum(total_unique_views) != 0 or
sum(total_submissions) != 0 or
sum(total_accepted_submissions) != 0
order by con.contest_id
| true
|
284a7fb00874422c0fb9c0b17dd6ac92eaa9c587
|
SQL
|
protosisprov/sisprov_ds
|
/FDSoil/class/sql/menu/n1_select.sql
|
UTF-8
| 179
| 3.03125
| 3
|
[] |
no_license
|
SELECT m.id, m.id_menu_0, m.titulo, m.ruta FROM seguridad.menu_1 as m
JOIN seguridad.rol_1 r ON m.id=r.id_menu_1 WHERE r.id_rol={fld:id} AND id_status=1 ORDER BY id_menu_0,orden;
| true
|
72007f0660ed13601741bbed7800f015bb5a950b
|
SQL
|
Anderson815/turma19java
|
/2-Bloco/MySQL/Exercicio-03/Atividade 2.sql
|
UTF-8
| 1,254
| 3.84375
| 4
|
[] |
no_license
|
-- Criação do banco de dados db_ecommerce
create database db_ecommerce
default character set utf8
default collate utf8_general_ci;
-- Entrar no banco de dados
use db_ecommerce;
-- cria a tabela produto
create table tb_produto(
id bigint auto_increment not null,
nome varchar(25) not null,
preco decimal(6, 2) not null,
marca varchar(25) not null,
quantidade int(4) not null,
primary key(id)
)Engine InnoDb default char set = utf8;
-- Inserir 8 registros na tabela produto
insert into tb_produto (nome, preco, quantidade, marca)
values
('Televisão', '2104.99', '50', 'Samsung'),
('Notebook', '2600.59', '86', 'Dell'),
('Computador', '8054.97', '20', 'G-Fire'),
('Celular', '950.49', '154', 'Apple'),
('Fogão', '1159.00', '37', 'Eletrolux'),
('Geladeira', '2649.00', '15', 'Eletrolux'),
('Headset', '399.99', '320', 'Logitech'),
('Mouse', '150.88', '50', 'Multilaser');
-- Consulta para os produtos com o preço maior que 500
select nome, marca, preco from tb_produto
where preco > 500
order by nome;
-- Consulta para os produtos com o preço menor que 500
select nome, marca, preco from tb_produto
where preco < 500
order by nome;
-- Atualização de um registro
update tb_produto
set preco = '3850.99'
where id = '4';
| true
|
f6643f00f392cffc436c16407ab591ef3708d631
|
SQL
|
younggeun0/SSangYoung
|
/dev/query/date181108_pl/using_update_test_proc.sql
|
UHC
| 738
| 3.125
| 3
|
[] |
no_license
|
SELECT * FROM user_procedures;
SELECT * FROM test_proc;
-- ε (ܺ )
VAR msg VARCHAR2(100);
VAR row_cnt NUMBER;
-- ν
EXEC update_test_proc(1112,'',3000,:msg,:row_cnt);
-- ó(ε )
PRINT msg;
PRINT row_cnt;
-- Ȯ
-- , , 븮, , , , ̻,
-- , , ǥ̻簡 Է Ǿ
EXEC update_test_proc(1112,'',3100,:msg,:row_cnt);
PRINT msg;
PRINT row_cnt;
-- ۴ٸ 5% λ
EXEC update_test_proc(1111,'',2300,:msg,:row_cnt);
PRINT msg;
PRINT row_cnt;
| true
|
079a0a15c734b57e5df56c648d56c42152be5832
|
SQL
|
apache/derby
|
/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedConnectionAttribute.sql
|
ISO-8859-1
| 5,744
| 2.78125
| 3
|
[
"Apache-2.0",
"LicenseRef-scancode-unicode",
"LGPL-2.0-or-later",
"CPL-1.0",
"CDDL-1.0",
"MIT",
"LicenseRef-scancode-other-copyleft",
"NAIST-2003",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"CC-BY-SA-3.0",
"LicenseRef-scancode-generic-export-compliance"
] |
permissive
|
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
disconnect;
connect 'jdbc:derby:detest;create=true;';
connect 'jdbc:derby:detest;create=true;' as Mnchen;
drop table detab;
create table detab ( dc1 decimal(5,3), dc3 date, dc2 char(200) );
insert into detab values(1.123,date('2000-01-25'),'Zuviele Programme gefunden. Versuchen Sie es erneut.');
insert into detab values(2.123,date('2000-02-24'),'Nur Teile der Entwicklungsdatenbank gefunden.');
insert into detab values(3.123,date('2000-03-23'),'Mehr als eine Instanz der Tabelle %s in Entwicklungsdatenbank gefunden.');
insert into detab values(4.123,date('2000-04-22'),'Mehr als einen Runner-Datensatz fr dieses Programm gefunden.');
insert into detab values(5.123,date('2000-05-21'),'Es kann nur eine BEFORE- oder AFTER INPUT/CONSTRUCT-Klausel in einer ');
insert into detab values(6.123,date('2000-06-20'),'INPUT-/CONSTRUCT-Anweisung erscheinen.');
insert into detab values(7.123,date('2000-07-19'),'Die Funktion %s kann nur in einer INPUT- oder CONSTRUCT-Anweisung ');
insert into detab values(8.123,date('2000-08-18'),'Fglpc, der Pcode-Kompiler, ist nicht in Ihrem Pfad vorhanden.');
insert into detab values(9.123,date('2000-09-17'),'Kann Runner %s nicht finden.');
insert into detab values(10.123,date('2000-10-16'),'I/O-Fehler beim Laufen von fglc: %s.');
insert into detab values(11.123,date('2000-11-15'),'I/O-Fehler beim Ausfhren von fglc.');
insert into detab values(12.123,date('2000-12-14'),'Kann Datei %s nicht ffnen, um den Wert einer TEXT-Variable zu lesen.');
insert into detab values(13.123,date('2000-01-13'),'Der angegebene WORDWRAP RIGHT MARGIN-Wert liegt auerhalb des Bereichs.');
insert into detab values(14.123,date('2000-02-12'),'als oder gleich dem Wert des rechten Reportrands sein.');
insert into detab values(15.123,date('2000-03-11'),'4GL untersttzt nicht die Ausgabe einer Blob-Variable.');
insert into detab values(16.123,date('2000-04-10'),'Die HELP- und ATTRIBUTE-Klauseln knnen jeweils nur einmal definiert werden.');
insert into detab values(17.123,date('2000-05-09'),'Ein Feld des INTERVAL-Kennzeichners liegt auerhalb des Bereichs.');
insert into detab values(18.123,date('2000-06-08'),'Der Bereich geht von YEAR TO MONTH und von DAY TO FRACTION.');
insert into detab values(19.123,date('2000-07-07'),'Das Anlegen von Indizes ist hier nicht erlaubt.');
insert into detab values(20.123,date('2000-08-06'),'Hier wird die Eingabe des Spaltennamen erwartet.');
insert into detab values(21.123,date('2000-09-05'),'Hier wird die Eingabe des Tabellennamen erwartet.');
insert into detab values(22.123,date('2000-10-04'),'Der eigentliche Spaltenname kann hier nicht angegeben werden.');
insert into detab values(23.123,date('2000-11-03'),'Die maximale Gre fr Varchar mu zwischen 1 und 255 liegen.');
insert into detab values(24.123,date('2000-12-02'),'Kann keine temporre Datei %s anlegen, um eine Blob-Variable aufzunehmen.');
insert into detab values(25.123,date('2000-11-01'),'Symbol %s mu ein SQL-Datenbank-Elementname sein - entweder ein ');
insert into detab values(26.123,date('2000-10-28'),'Datenbankname, ein Tabellenname oder ein Spaltenname.');
insert into detab values(27.123,date('2000-09-29'),'DATETIME-Einheiten knnen nur YEAR, MONTH, DAY, HOUR, MINUTE,');
insert into detab values(28.123,date('2000-08-30'),'Eingeklammerte Genauigkeit von FRACTION mu zwischen 1 und 5 liegen.');
insert into detab values(29.123,date('2000-07-31'),'Fr andere Zeiteinheiten kann keine Genauigkeit definiert werden.');
insert into detab values(30.123,date('2000-06-25'),'Das Startfeld von DATETIME oder INTERVAL-Kennzeichnern mu in der ');
insert into detab values(31.123,date('2000-05-25'),'Zeitliste vor dem Endfeld stehen.');
insert into detab values(32.123,date('2000-04-25'),'Entladen in Datei %s milungen.');
insert into detab values(33.123,date('2000-03-25'),'Laden aus Datei %s milungen.');
insert into detab values(34.123,date('2000-02-25'),'Das Programm kann eine DISPLAY ARRAY-Anweisung an dieser Stelle nicht');
insert into detab values(35.123,date('2000-01-25'),'beenden, weil es sich nicht in einer DISPLAY ARRAY-Anweisung befindet.');
insert into detab values(36.123,date('2000-02-25'),'Das Programm kann eine INPUT-Anweisung an dieser Stelle nicht beenden,');
insert into detab values(37.123,date('2000-04-25'),'weil es sich nicht in einer INPUT-Anweisung befindet.');
insert into detab values(38.123,date('2000-05-25'),'Konnte Datei %s nicht ffnen.');
insert into detab values(39.123,date('2000-07-25'),'Name des Eigentmers %s hat die Lnge von 8 Zeichen berschritten.');
insert into detab values(40.123,date('2000-09-25'),'Fehler bei der Speicherzuordnung.');
insert into detab values(41.123,date('2000-05-25'),'Unter dem angegebenen Namen wurde kein lauffhiges 4GL-Programm gefunden.');
LOCALIZEDDISPLAY ON;
show connections;
select * from detab;
disconnect;
-- shutdown system
connect 'jdbc:derby:;shutdown=true';
| true
|
c712a00fca95fbfeea2eee373e751cffbba34a12
|
SQL
|
Thien-Computer/App
|
/sql/tabel_hanhkhach.sql
|
UTF-8
| 590
| 3.46875
| 3
|
[] |
no_license
|
drop table if exists ass2.hanhkhach;
create table ass2.hanhkhach(
id_hanhkhach varchar(8) primary key ,
cmnd_cccd varchar(12) unique,
job varchar(50) ,
phone_number varchar(10) unique,
sex varchar(10) ,
email varchar(30) ,
birth date
);
drop trigger if exists ass2.id_hanhkhach;
DELIMITER $$
CREATE TRIGGER ass2.id_hanhkhac
BEFORE INSERT ON ass2.hanhkhach
FOR EACH ROW
BEGIN
DECLARE total INT DEFAULT 0;
SELECT COUNT(*) INTO total
FROM ass2.hanhkhach;
SET NEW.id_hanhkhach = CONCAT('KH', LPAD(CAST(total + 1 AS CHAR),6,'0'));
END$$
DELIMITER ;
| true
|
da9a7426f095c1cd791c2f3f5a82f3e7c97dab36
|
SQL
|
amit15110003/payearn
|
/payearn.sql
|
UTF-8
| 19,762
| 3.15625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 28, 2018 at 02:57 PM
-- Server version: 5.7.19
-- PHP Version: 5.6.31
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: `payearn`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
DROP TABLE IF EXISTS `admin`;
CREATE TABLE IF NOT EXISTS `admin` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`username` varchar(200) NOT NULL,
`password` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`id`, `username`, `password`) VALUES
(1, 'amit', '202cb962ac59075b964b07152d234b70'),
(3, 'admin@123', '202cb962ac59075b964b07152d234b70'),
(4, 'admin@456', '202cb962ac59075b964b07152d234b70');
-- --------------------------------------------------------
--
-- Table structure for table `admin_login`
--
DROP TABLE IF EXISTS `admin_login`;
CREATE TABLE IF NOT EXISTS `admin_login` (
`a_id` int(11) NOT NULL AUTO_INCREMENT,
`a_mail` varchar(200) NOT NULL,
`a_wid` int(11) NOT NULL,
`a_username` varchar(200) NOT NULL,
`a_pass` varchar(200) NOT NULL,
`a_contact` bigint(200) NOT NULL,
`a_design` varchar(50) NOT NULL,
`a_lastseen` timestamp NOT NULL,
`status` int(10) NOT NULL,
PRIMARY KEY (`a_id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin_login`
--
INSERT INTO `admin_login` (`a_id`, `a_mail`, `a_wid`, `a_username`, `a_pass`, `a_contact`, `a_design`, `a_lastseen`, `status`) VALUES
(1, 'amitanand.kvj.2@gmail.com', 0, 'Amit Anand', '202cb962ac59075b964b07152d234b70', 8979997072, 'Admin', '2018-07-23 11:36:05', 1),
(4, 'raviranjan.ptm@gmail.com', 3, 'ravi ranjan', '202cb962ac59075b964b07152d234b70', 8979997072, 'Vendor', '2018-07-23 11:36:05', 1);
-- --------------------------------------------------------
--
-- Table structure for table `cart`
--
DROP TABLE IF EXISTS `cart`;
CREATE TABLE IF NOT EXISTS `cart` (
`id` bigint(200) NOT NULL AUTO_INCREMENT,
`u_id` int(200) NOT NULL,
`p_id` int(200) NOT NULL,
`p_category` varchar(100) NOT NULL,
`item` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=70 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cart`
--
INSERT INTO `cart` (`id`, `u_id`, `p_id`, `p_category`, `item`) VALUES
(69, 4, 8, '', 4),
(68, 4, 1, '', 1);
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
DROP TABLE IF EXISTS `category`;
CREATE TABLE IF NOT EXISTS `category` (
`c_id` int(11) NOT NULL AUTO_INCREMENT,
`c_name` varchar(200) NOT NULL,
`c_descr` varchar(200) NOT NULL,
`c_status` int(11) NOT NULL,
PRIMARY KEY (`c_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `category`
--
INSERT INTO `category` (`c_id`, `c_name`, `c_descr`, `c_status`) VALUES
(1, 'costmatic', '', 1),
(2, 'rty', '', 1);
-- --------------------------------------------------------
--
-- Table structure for table `contact`
--
DROP TABLE IF EXISTS `contact`;
CREATE TABLE IF NOT EXISTS `contact` (
`c_id` int(11) NOT NULL AUTO_INCREMENT,
`c_name` varchar(200) NOT NULL,
`c_mail` text NOT NULL,
`c_subject` text NOT NULL,
`c_message` text NOT NULL,
PRIMARY KEY (`c_id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `contact`
--
INSERT INTO `contact` (`c_id`, `c_name`, `c_mail`, `c_subject`, `c_message`) VALUES
(2, 'xdcvb', 'ravi@gmail.com', 'sdcfv', 'ravi@gmail.com'),
(3, 'xdcvb', 'ravi@gmail.com', 'sdcfv', 'ravi@gmail.com'),
(4, 'xdcvb', 'ravadsfgfhi@gmail.com', 'sdcfv', 'ravi@gmail.com');
-- --------------------------------------------------------
--
-- Table structure for table `delivery`
--
DROP TABLE IF EXISTS `delivery`;
CREATE TABLE IF NOT EXISTS `delivery` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`u_id` int(20) NOT NULL,
`d_fname` varchar(100) NOT NULL,
`d_lname` varchar(100) NOT NULL,
`d_mob` varchar(10) NOT NULL,
`d_country` varchar(100) NOT NULL,
`d_town` varchar(100) NOT NULL,
`d_state` varchar(100) NOT NULL,
`d_pin` int(10) NOT NULL,
`d_add` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `delivery`
--
INSERT INTO `delivery` (`id`, `u_id`, `d_fname`, `d_lname`, `d_mob`, `d_country`, `d_town`, `d_state`, `d_pin`, `d_add`) VALUES
(3, 1, 'amit', 'anand', '8979997072', 'India', 'roorkee', 'Uttarakhand', 247667, 'iit roorkee'),
(4, 4, 'rakesh', 'anand', '8979997072', '', 'roorkee', 'Uttarakhand', 247667, 'iit roorkee');
-- --------------------------------------------------------
--
-- Table structure for table `orderadd`
--
DROP TABLE IF EXISTS `orderadd`;
CREATE TABLE IF NOT EXISTS `orderadd` (
`order_id` int(100) NOT NULL AUTO_INCREMENT,
`u_id` int(11) NOT NULL,
`txnid` varchar(250) NOT NULL,
`o_time` datetime NOT NULL,
`payment_mode` text NOT NULL,
`delivery_email` text NOT NULL,
`delivery_name` text NOT NULL,
`delivery_address` text NOT NULL,
`delivery_city` text NOT NULL,
`delivery_state` text NOT NULL,
`delivery_country` varchar(250) NOT NULL,
`delivery_zip` text NOT NULL,
`delivery_tel` bigint(212) NOT NULL,
`amount` int(100) NOT NULL,
`tax` int(11) NOT NULL,
`p_id` varchar(250) NOT NULL,
`p_sp` varchar(250) NOT NULL,
`p_qty` text NOT NULL,
`o_status` text NOT NULL,
`o_paystatus` varchar(50) NOT NULL,
PRIMARY KEY (`order_id`)
) ENGINE=MyISAM AUTO_INCREMENT=78 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `orderadd`
--
INSERT INTO `orderadd` (`order_id`, `u_id`, `txnid`, `o_time`, `payment_mode`, `delivery_email`, `delivery_name`, `delivery_address`, `delivery_city`, `delivery_state`, `delivery_country`, `delivery_zip`, `delivery_tel`, `amount`, `tax`, `p_id`, `p_sp`, `p_qty`, `o_status`, `o_paystatus`) VALUES
(42, 0, '1530369325636', '2018-06-11 00:00:00', '', 'amitanand.kvj.2@gmail.com', 'amit anand', 'NAYAGAON NEAR MANS KUNJ MANDIR', 'JAMALPUR', 'Bihar', 'India', '811214', 7903135200, 41, 0, '4', '41', '', '', ''),
(45, 0, '1530369866134', '2018-06-30 14:48:37', '', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(44, 0, '1530369866134', '2018-06-30 14:44:27', '', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(46, 0, '1530370122213', '2018-06-30 14:48:43', '', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(47, 0, '1530370122213', '2018-06-30 14:50:14', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(48, 0, '1530370122213', '2018-06-30 15:55:58', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(49, 0, '1530370122213', '2018-06-30 15:56:43', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(50, 0, '1530370122213', '2018-06-30 15:57:17', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(51, 0, '1530370122213', '2018-06-30 15:57:54', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(52, 0, '1530370122213', '2018-06-30 15:58:39', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(53, 0, '1530370122213', '2018-06-30 15:59:24', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(54, 0, '1530370122213', '2018-06-30 16:01:28', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(55, 0, '1530370122213', '2018-06-30 16:01:56', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(56, 0, '1530370122213', '2018-06-30 16:06:24', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(57, 0, '1530370122213', '2018-06-30 16:09:31', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(58, 0, '1530370122213', '2018-06-30 16:14:53', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(59, 0, '1530370122213', '2018-06-30 16:16:32', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(60, 0, '1530370122213', '2018-06-30 16:17:18', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(61, 0, '1530370122213', '2018-06-30 16:17:57', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(62, 0, '1530370122213', '2018-06-30 16:18:33', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(63, 0, '1530370122213', '2018-06-30 18:12:09', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(64, 0, '1530382417510', '2018-06-30 18:13:39', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(65, 0, '1530384032631', '2018-06-30 18:40:36', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(66, 0, '1530384032631', '2018-06-30 18:43:48', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(67, 0, '1530384032631', '2018-06-30 18:44:08', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(68, 0, '1530384032631', '2018-06-30 18:44:56', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(69, 0, '1530384032631', '2018-06-30 18:46:10', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(70, 0, '1530384032631', '2018-06-30 18:47:08', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(71, 0, '1530384032631', '2018-06-30 18:47:26', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(72, 0, '1530384032631', '2018-06-30 18:47:52', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 41, 0, '4', '41', '1', '', ''),
(73, 0, '1530385155128', '2018-06-30 18:59:21', 'cod', 'amitanand.kvj.2@gmail.com', 'RAJIV RANJAN', 'NAYAGAON NEAR MANS KUNJ MANDIR', 'JAMALPUR', 'MANS KUNJ MANDIR', 'India', '811214', 7903135200, 110, 0, '4,8', '41,23', '1,3', '', ''),
(74, 0, '1530385155128', '2018-06-30 19:01:01', 'cod', 'amitanand.kvj.2@gmail.com', 'RAJIV RANJAN', 'NAYAGAON NEAR MANS KUNJ MANDIR', 'JAMALPUR', 'MANS KUNJ MANDIR', 'India', '811214', 7903135200, 110, 0, '4,8', '41,23', '1,3', '', ''),
(75, 0, '1530385155128', '2018-06-30 19:01:26', 'cod', 'amitanand.kvj.2@gmail.com', 'RAJIV RANJAN', 'NAYAGAON NEAR MANS KUNJ MANDIR', 'JAMALPUR', 'MANS KUNJ MANDIR', 'India', '811214', 7903135200, 110, 0, '4,8', '41,23', '1,3', '', ''),
(76, 0, '1530385155128', '2018-06-30 19:01:43', 'cod', 'amitanand.kvj.2@gmail.com', 'RAJIV RANJAN', 'NAYAGAON NEAR MANS KUNJ MANDIR', 'JAMALPUR', 'MANS KUNJ MANDIR', 'India', '811214', 7903135200, 110, 0, '4,8', '41,23', '1,3', '', ''),
(77, 0, '1530876526505', '2018-07-06 11:29:55', 'cod', 'amitanand.kvj.2@gmail.com', 'amit anand', 'iit roorkee', 'roorkee', 'Uttarakhand', 'India', '247667', 8979997072, 155, 0, '1', '155', '1', '', '');
-- --------------------------------------------------------
--
-- Table structure for table `orderpos`
--
DROP TABLE IF EXISTS `orderpos`;
CREATE TABLE IF NOT EXISTS `orderpos` (
`order_id` int(100) NOT NULL AUTO_INCREMENT,
`a_id` int(11) NOT NULL,
`o_wid` int(11) NOT NULL,
`u_id` int(11) NOT NULL,
`txnid` varchar(250) NOT NULL,
`o_time` datetime NOT NULL,
`payment_mode` text NOT NULL,
`amount` int(100) NOT NULL,
`tax` int(11) NOT NULL,
`p_id` varchar(250) NOT NULL,
`p_sp` varchar(250) NOT NULL,
`p_qty` text NOT NULL,
`o_status` text NOT NULL,
PRIMARY KEY (`order_id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `orderpos`
--
INSERT INTO `orderpos` (`order_id`, `a_id`, `o_wid`, `u_id`, `txnid`, `o_time`, `payment_mode`, `amount`, `tax`, `p_id`, `p_sp`, `p_qty`, `o_status`) VALUES
(1, 0, 0, 0, '1530781930', '2018-07-05 09:12:10', 'cash', 310, 0, '1,8', '310,23', '2,1', ''),
(2, 0, 0, 0, '1530781943', '2018-07-05 09:12:23', 'cash', 310, 0, '1,8', '310,23', '2,1', ''),
(3, 0, 0, 0, '1530781987', '2018-07-05 09:13:07', 'cash', 310, 0, '1,8', '310,23', '2,1', ''),
(4, 0, 0, 0, '1530782019', '2018-07-05 09:13:39', 'cash', 333, 0, '1,8', '310,23', '2,1', ''),
(5, 0, 0, 0, '1530782026', '2018-07-05 09:13:46', 'cash', 333, 0, '1,8', '310,23', '2,1', ''),
(6, 0, 0, 0, '1530884460', '2018-07-06 13:41:00', 'cash', 155, 0, '1', '155', '1', ''),
(7, 0, 0, 0, '1532248565', '2018-07-22 08:36:05', 'cash', 155, 0, '1', '155', '1', ''),
(8, 0, 0, 0, '1532254260', '2018-07-22 10:11:00', 'cash', 5118, 0, '1,2,3,4,5', '155,45,354,41,4523', '1,1,1,1,1', ''),
(9, 0, 0, 0, '1532255155', '2018-07-22 10:25:55', 'cash', 5118, 0, '1,2,3,4,5', '155,45,354,41,4523', '1,1,1,1,1', ''),
(10, 0, 0, 0, '1532259534', '2018-07-22 11:38:54', 'cash', 5118, 0, '1,2,3,4,5', '155,45,354,41,4523', '1,1,1,1,1', ''),
(11, 0, 0, 0, '1532259545', '2018-07-22 11:39:05', 'cash', 4759, 0, '8,9,10,5', '23,213,0,4523', '1,1,1,1', ''),
(12, 1, 0, 0, '1532263935', '2018-07-22 12:52:15', 'cash', 200, 0, '7', '200', '1', ''),
(13, 4, 3, 0, '1532263976', '2018-07-22 12:52:56', 'cash', 155, 0, '1', '155', '1', '');
-- --------------------------------------------------------
--
-- Table structure for table `product`
--
DROP TABLE IF EXISTS `product`;
CREATE TABLE IF NOT EXISTS `product` (
`p_id` int(11) NOT NULL AUTO_INCREMENT,
`p_name` varchar(200) NOT NULL,
`p_desc` text NOT NULL,
`p_adddesc` text NOT NULL,
`p_cp` float NOT NULL,
`p_sp` float NOT NULL,
`p_stock` int(11) NOT NULL,
`p_category` int(11) NOT NULL,
`p_warehouse` int(11) NOT NULL,
`p_image` varchar(200) NOT NULL,
`p_view` int(11) NOT NULL,
`p_status` int(11) NOT NULL,
PRIMARY KEY (`p_id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `product`
--
INSERT INTO `product` (`p_id`, `p_name`, `p_desc`, `p_adddesc`, `p_cp`, `p_sp`, `p_stock`, `p_category`, `p_warehouse`, `p_image`, `p_view`, `p_status`) VALUES
(1, '475', '4', '', 0, 155, 0, 0, 0, '1528387689product.jpg', 122, 1),
(2, '45', '4', '45', 4, 45, 4, 45, 0, '1528387739product.jpg', 0, 1),
(3, '52', '535', '35', 535, 354, 354, 345, 353, '1528387790product.jpg', 0, 1),
(4, '425', '4512', '4152', 452, 41, 0, 0, 0, '1528387876product.png', 48, 1),
(5, '453', '523', '5231', 4523, 4523, 4523, 23, 523, '1528388062product.jpg', 0, 1),
(6, '', '', '', 0, 0, 0, 0, 0, '1528387912product.jpg', 0, 1),
(7, 'horlicksb 34', 'atta aur chokar', '250 energy', 250, 200, 100, 34, 0, '1528387959product.png', 0, 1),
(8, 'sfvg', 'f', 'ndgh', 123123, 23, 41561, 0, 0, '1528388206product.png', 3, 1),
(9, 'apple', 'fsdzcf', 'sfd', 2, 213, 2, 0, 0, '1530474566product.png', 0, 1),
(10, 'apple', 'kvh', '', 53, 0, 42, 0, 0, '1530475239product.png', 0, 1),
(11, 'jg', 'vhj', 'jh', 15, 0, 15, 5, 0, '', 0, 1),
(12, 'vjh', 'tcgj', 'yucu', 845, 0, 43, 0, 0, '1530475286product.png', 0, 1),
(13, 'jg', 'jcg', '', 1, 0, 15, 0, 0, '1530475305product.JPG', 0, 1);
-- --------------------------------------------------------
--
-- Table structure for table `subscribe`
--
DROP TABLE IF EXISTS `subscribe`;
CREATE TABLE IF NOT EXISTS `subscribe` (
`s_id` int(11) NOT NULL AUTO_INCREMENT,
`s_mail` varchar(200) NOT NULL,
`s_status` int(11) NOT NULL,
PRIMARY KEY (`s_id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `subscribe`
--
INSERT INTO `subscribe` (`s_id`, `s_mail`, `s_status`) VALUES
(1, 'a2E@DF.GH', 0),
(3, 'amitanand.kvj.2@gmail.com', 0),
(4, 'amit@gmail.com', 0);
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`u_id` int(11) NOT NULL AUTO_INCREMENT,
`u_name` varchar(200) NOT NULL,
`u_lname` varchar(200) NOT NULL,
`u_card` varchar(200) NOT NULL,
`u_contact` bigint(100) NOT NULL,
`u_add` text NOT NULL,
`u_mail` varchar(200) NOT NULL,
`u_visit` timestamp NOT NULL,
`u_visitno` int(11) NOT NULL,
`u_pass` varchar(200) NOT NULL,
`u_status` int(11) NOT NULL,
PRIMARY KEY (`u_id`),
UNIQUE KEY `u_card` (`u_card`),
UNIQUE KEY `u_contact` (`u_contact`),
UNIQUE KEY `u_mail` (`u_mail`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`u_id`, `u_name`, `u_lname`, `u_card`, `u_contact`, `u_add`, `u_mail`, `u_visit`, `u_visitno`, `u_pass`, `u_status`) VALUES
(1, 'hjk', '', 'dfghjk', 111, 'xcvbnm', 'asdfgh', '2018-05-15 18:30:00', 0, '', 1),
(2, 'dineshvar', '', 'esty35', 8450865472, 'p15 basundhara complex\r\nchingrighata', '5362@gdsh.fh', '2018-05-15 18:30:00', 0, '', 1),
(3, 'amit', '', 'ty6w', 7872129887, 'house no 32/4 Mukandpur samtavihar\r\ngali number 5/2 bisfutta road delhi', 'gsg@sdgh.dgs', '2018-05-15 18:30:00', 0, '', 1),
(4, 'amit', 'anand', '', 8979997072, '', 'amitanand.kvj.2@gmail.com', '2018-05-21 16:00:21', 0, '202cb962ac59075b964b07152d234b70', 0);
-- --------------------------------------------------------
--
-- Table structure for table `warehouse`
--
DROP TABLE IF EXISTS `warehouse`;
CREATE TABLE IF NOT EXISTS `warehouse` (
`w_id` int(11) NOT NULL AUTO_INCREMENT,
`w_name` varchar(200) NOT NULL,
`w_location` varchar(200) NOT NULL,
`w_status` int(11) NOT NULL,
PRIMARY KEY (`w_id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `warehouse`
--
INSERT INTO `warehouse` (`w_id`, `w_name`, `w_location`, `w_status`) VALUES
(1, 'Khagriya', 'szfgfs', 0),
(2, 'ytdyt', 'fyik', 0),
(3, 'munger', '', 1);
-- --------------------------------------------------------
--
-- Table structure for table `wishlist`
--
DROP TABLE IF EXISTS `wishlist`;
CREATE TABLE IF NOT EXISTS `wishlist` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`u_id` bigint(20) NOT NULL,
`p_id` bigint(20) NOT NULL,
`item` int(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `wishlist`
--
INSERT INTO `wishlist` (`id`, `u_id`, `p_id`, `item`) VALUES
(14, 1, 3, 1);
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
|
b3007fdca1ae6700676250e0cba161cd9479c0f0
|
SQL
|
chengweilin114/Spring_Web
|
/src/main/webapp/WEB-INF/view/init.sql
|
UTF-8
| 606
| 3.59375
| 4
|
[] |
no_license
|
create table db.category
(
ID int auto_increment
primary key,
BOOK_CLASS varchar(50) not null
)
charset = utf8;
create table db.book
(
ID int auto_increment
primary key,
BOOK_NAME varchar(100) not null,
CATEGORY_ID int not null,
INTRODUCTION mediumtext null,
constraint book_category_id_fk
foreign key (CATEGORY_ID) references db.category (ID)
)
charset = utf8;
create table db.user
(
ID int auto_increment
primary key,
EMAIL varchar(50) not null,
PASSWORD varchar(50) not null
);
| true
|
70248d67f86426f5d915b5edf319390e09e12246
|
SQL
|
HujjajAli/SocialMediaApp
|
/SocialMediaApplication/WebContent/socialmedia.sql
|
UTF-8
| 3,822
| 3.328125
| 3
|
[] |
no_license
|
/*
SQLyog Enterprise - MySQL GUI v6.56
MySQL - 5.0.81-community-nt : Database - socialmedia
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!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' */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`socialmedia` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `socialmedia`;
/*Table structure for table `followers` */
DROP TABLE IF EXISTS `followers`;
CREATE TABLE `followers` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
`follower_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
/*Data for the table `followers` */
insert into `followers`(`id`,`user_id`,`follower_id`) values (1,1,2),(2,1,3),(3,2,1),(4,2,3),(5,2,4),(6,4,1),(7,4,2),(8,4,3),(9,4,5),(10,2,5),(11,4,4),(12,6,1),(13,6,2),(14,6,3),(15,6,4),(16,8,1),(17,8,2),(18,8,6);
/*Table structure for table `profileimages` */
DROP TABLE IF EXISTS `profileimages`;
CREATE TABLE `profileimages` (
`id` int(11) NOT NULL auto_increment,
`image_title` varchar(255) NOT NULL,
`location` varchar(20) NOT NULL,
`upload_date` varchar(255) NOT NULL,
`userid` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `profileimages` */
/*Table structure for table `userinformation` */
DROP TABLE IF EXISTS `userinformation`;
CREATE TABLE `userinformation` (
`id` int(11) NOT NULL auto_increment,
`firstname` varchar(255) default NULL,
`middlename` varchar(255) default NULL,
`lastname` varchar(255) default NULL,
`profession` varchar(255) default NULL,
`address` varchar(500) default NULL,
`day` int(11) default NULL,
`month` int(11) default NULL,
`year` int(11) default NULL,
`userid` int(11) NOT NULL,
`gender` varchar(10) default NULL,
`profileimage` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
/*Data for the table `userinformation` */
insert into `userinformation`(`id`,`firstname`,`middlename`,`lastname`,`profession`,`address`,`day`,`month`,`year`,`userid`,`gender`,`profileimage`) values (1,'Amjad','Ali','Mirjat','Network Engineer','Hyderabad, Sindh, Pakistan',2,9,1995,2,'Male',NULL),(2,'Badsha','Baker','Qambrani','Food Quality Manager Officer','Larkana, Sindh, Pakistan',15,3,1929,4,'Male','humza.jpg'),(3,'Mukhtair','Ali','Chandio','Java Programmer','Hyderabad, Sindh, Pakistan',11,8,1987,6,'Male',NULL),(4,'Aslam','Ali','Khokhar','Programmer','Shedadhkot, Sindh, Pakistan',17,3,1938,8,'Male',NULL),(5,'Mama','Chacha','Nana','Devloper','Haveli, Azad Kashmir, Pakistan',13,6,1929,10,'Female',NULL);
/*Table structure for table `users` */
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(255) default NULL,
`password` varchar(255) default NULL,
`email` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
/*Data for the table `users` */
insert into `users`(`id`,`username`,`password`,`email`) values (1,'hujjaj250','gabbar','hujjajali@gmail.com'),(2,'amjumirjat','sauuni','amjadali@gmail.com'),(3,'abuzarsindhi','sindhimanu','abuzarsindhi@gmail.com'),(4,'abubakerjambo','jambo','abubaker@vivid.com'),(5,'shahidshah','shah','shah@yahoo.com'),(6,'mukhtiarmama','mama','mukhtiarmama@gmail.com'),(7,'saeedahmed','saad','saad@gmail.com'),(8,'aslamba','aslam','aslam@gmail.com'),(9,'zash250','dsdsd','juma@gmail.com'),(10,'mama22','123','mama@mama.com'),(11,'Anil Kapoor','govinda','anilkapoor@gmail.com');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
| true
|
8250fcc4de57a98ce302a8ff3baaf6827206c584
|
SQL
|
radtek/Telecommunication
|
/GSM/DataBase/SCRIPTS_FROM_DB/LONTANA/VIEW/V_TARIFF_VIOLATIONS.SQL
|
UTF-8
| 1,705
| 3.953125
| 4
|
[] |
no_license
|
CREATE OR REPLACE FORCE VIEW "LONTANA"."V_TARIFF_VIOLATIONS" ("ACCOUNT_ID", "YEAR_MONTH", "PHONE_NUMBER", "CELL_PLAN_CODE", "TARIFF_NAME_FROM_OPERATOR", "TARIFF_CODE", "TARIFF_NAME", "STATUS_CODE", "LAST_CHANGE_STATUS_DATE", "STATUS", "DOP_STATUS_NAME", "DOP_STATUS_DATE") AS
SELECT D.ACCOUNT_ID,
D.YEAR_MONTH,
D.PHONE_NUMBER,
D.CELL_PLAN_CODE,
(SELECT TARIFF_NAME
FROM TARIFFS
WHERE TARIFFS.TARIFF_CODE = D.CELL_PLAN_CODE
AND ROWNUM <= 1) TARIFF_NAME_FROM_OPERATOR,
TARIFFS.TARIFF_CODE,
TARIFFS.TARIFF_NAME,
BSC.STATUS_CODE,
D.LAST_CHANGE_STATUS_DATE,
CASE
WHEN NVL(D.CONSERVATION, 0) = 1 THEN 'Сохр.'
WHEN NVL(D.PHONE_IS_ACTIVE, 0) = 1 THEN 'Акт.'
ELSE 'Блок.'
END AS STATUS,
CDS.DOP_STATUS_NAME,
(SELECT MAX(L.DATE_LAST_UPDATED)
FROM LOG_DOP_STATUS L
WHERE L.PHONE_NUMBER = D.PHONE_NUMBER) DOP_STATUS_DATE
FROM DB_LOADER_ACCOUNT_PHONES D, TARIFFS, CONTRACTS C,
BEELINE_STATUS_CODE BSC,
CONTRACT_DOP_STATUSES CDS
WHERE D.YEAR_MONTH = to_number(to_char(sysdate, 'YYYYMM'))
AND C.CONTRACT_ID = GET_ID_LAST_CONTRACT_BY_PHONE(D.PHONE_NUMBER)
AND D.STATUS_ID = BSC.STATUS_ID(+)
AND C.DOP_STATUS = CDS.DOP_STATUS_ID(+)
AND GET_ID_LAST_TARIFF_BY_CONTRACT(C.CONTRACT_ID, C.TARIFF_ID) = TARIFFS.TARIFF_ID
AND TARIFFS.TARIFF_CODE <> D.CELL_PLAN_CODE
AND D.PHONE_NUMBER IN (SELECT PHONE_NUMBER_FEDERAL
FROM CONTRACTS C, CONTRACT_CANCELS CC
WHERE C.CONTRACT_ID = CC.CONTRACT_ID(+)
AND CC.CONTRACT_CANCEL_DATE IS NULL)
| true
|
dfa34dbc8fcfe26c3a5ad30f2a7de4f5168accf7
|
SQL
|
jisoom/sql
|
/team4_운영2.sql
|
UTF-8
| 5,696
| 4.03125
| 4
|
[] |
no_license
|
--SELECT A.LEC_OPEN_ID, A.LEC_ST_DATE, A.LEC_END_DATE, A.LEC_ID, A.LEC_PRICE, A.REGI_ST_DATE, A.REGI_END_DATE, A.LEC_STAT_CODE
-- , A.REGI_STAT_CODE, A.TEACHER_ID, A.LEC_CONTENT, B.CODE_NAME || '호' LEC_ROOM_CODE, A.LEC_NAME, C.MEM_NAME TEACHER_NAME
--FROM LEC_OPEN A LEFT JOIN CODE_TB B ON , MEMBER C
--WHERE 1=1
--AND A.TEACHER_ID = C.MEM_ID
--ORDER BY A.LEC_ST_DATE DESC
SELECT A.LEC_OPEN_ID, A.COLOR, A.STU_ID, TO_DATE(B.LEC_ST_DATE,'YYYY-MM-DD') LEC_ST_DATE, TO_CHAR(B.LEC_END_DATE,'YYYY-MM-DD') LEC_END_DATE, B.LEC_ID, B.LEC_PRICE
, TO_CHAR(B.REGI_ST_DATE,'YYYY-MM-DD') REGI_ST_DATE, TO_CHAR(B.REGI_END_DATE,'YYYY-MM-DD') REGI_END_DATE
, B.LEC_STAT_CODE, B.REGI_STAT_CODE, B.TEACHER_ID, B.LEC_CONTENT, B.LEC_ROOM_CODE, B.LEC_NAME, C.MEM_NAME TEACHER_NAME, D.CODE_NAME || '호' LEC_ROOM_NAME
FROM STU_LEC A LEFT JOIN LEC_OPEN B ON(A.LEC_OPEN_ID = B.LEC_OPEN_ID)
LEFT JOIN MEMBER C ON(B.TEACHER_ID = C.MEM_ID)
LEFT JOIN CODE_TB D ON(B.LEC_ROOM_CODE = D.CODE_ID)
WHERE STU_ID = 'stu01'
--강의명, 강의 시작일 ,강의 종료일, 진행 상태
--, 과목, 학년
--, 요일, 교시
;
/
--방법 1
WITH T AS(
SELECT A.LEC_NAME, TO_DATE(A.LEC_ST_DATE,'YYYY-MM-DD') LEC_ST_DATE, TO_CHAR(A.LEC_END_DATE,'YYYY-MM-DD') LEC_END_DATE
, B.GRADE, C.CODE_NAME SUB_NAME, D.LEC_DAY, D.ST_PER, D.END_PER, E.CODE_NAME LEC_ST_NAME
FROM LEC_OPEN A LEFT JOIN LEC B ON(A.LEC_ID = B.LEC_ID)
LEFT JOIN CODE_TB C ON(B.SUB_CODE = C.CODE_ID)
LEFT JOIN LEC_TABLE D ON(A.LEC_OPEN_ID = D.LEC_OPEN_ID)
LEFT JOIN CODE_TB E ON(A.LEC_STAT_CODE = E.CODE_ID)
WHERE A.LEC_OPEN_ID = 1
)${lectureVo.lecStName}
SELECT DISTINCT LEC_NAME, LEC_ST_DATE, LEC_END_DATE, GRADE, SUB_NAME, ST_PER, END_PER, LEC_ST_NAME
, LISTAGG(LEC_DAY,',') WITHIN GROUP (ORDER BY LEC_DAY) OVER(PARTITION BY LEC_NAME, LEC_ST_DATE, LEC_END_DATE, GRADE, SUB_NAME, ST_PER, END_PER, LEC_ST_NAME) AS LEC_DAY
FROM T;
INSERT INTO ON_LEC(ON_LEC_ID, ON_LEC_TITLE, ON_LEC_CONTENT, PLAY_TIME, LEC_OPEN_ID, WRIER_ID, WRI_DATE, UPDER_ID, UPD_DATE)
VALUES('ON1', '[고등예비과정 수학1] 01강 다항식의 연산(1)', '오늘 강의 영상은 다항식입니다', 40, 1, 'admin01', SYSDATE, 'admin01', SYSDATE)
SELECT ON_LEC_ID, ON_LEC_TITLE, ON_LEC_CONTENT, ON_LEC_ATFILE_ID, PLAY_TIME, LEC_OPEN_ID, WRIER_ID, WRI_DATE, UPDER_ID, UPD_DATE
FROM ON_LEC
WHERE LEC_OPEN_ID =1;
SELECT TO_CHAR(TEST_ST_DATE,'YYYYMMDD'), TO_CHAR(TEST_END_DATE,'YYYYMMDD')
FROM TEST
WHERE NOT OPEN_CODE IN ('E101');
SELECT LEC_DATE, LEC_OPEN_ID, STU_ID, ATTEND_STATE_CODE, ATTEND_DESC
FROM LEC_ATTEND
WHERE STU_ID ='stu01'
AND LEC_OPEN_ID =1;
SELECT LEC_ST_DATE, LEC_END_DATE
FROM LEC_OPEN
WHERE LEC_OPEN_ID =1
--출석 조회
SELECT LEC_DATE, LEC_OPEN_ID, STU_ID, ATTEND_STATE_CODE, ATTEND_DESC, TO_CHAR(LEC_DATE,'YYYYMM') YEAR_MONTH
,(SELECT TO_CHAR(LEC_ST_DATE,'YYYYMM') FROM LEC_OPEN WHERE LEC_OPEN_ID =1) LEC_ST_DATE
,(SELECT TO_CHAR(LEC_END_DATE,'YYYYMM') FROM LEC_OPEN WHERE LEC_OPEN_ID =1) LEC_END_DATE
FROM LEC_ATTEND
WHERE STU_ID = 'stu01'
AND LEC_OPEN_ID = 1
AND LEC_DATE BETWEEN (SELECT LEC_ST_DATE FROM LEC_OPEN WHERE LEC_OPEN_ID =1)
AND (SELECT LEC_END_DATE FROM LEC_OPEN WHERE LEC_OPEN_ID =1)
AND TO_CHAR(LEC_DATE,'YYYYMM') = '202110'
SELECT TO_CHAR(LEC_ST_DATE,'YYYY MM DD') LEC_ST_DATE, TO_CHAR(LEC_END_DATE,'YYYY MM DD') LEC_END_DATE
FROM LEC_OPEN
WHERE LEC_OPEN_ID = 1
--수강생 출결 카운트
SELECT SUM(DECODE(ATTEND_STATE_CODE, 'A101', 1, 0)) attendCnt
, SUM(DECODE(ATTEND_STATE_CODE, 'A102', 1, 0)) absentCnt
, SUM(DECODE(ATTEND_STATE_CODE, 'A103', 1, 0)) lateCnt
, SUM(DECODE(ATTEND_STATE_CODE, 'A104', 1, 0)) earlyCnt
FROM LEC_ATTEND
WHERE LEC_OPEN_ID = 2
AND STU_ID = 'stu01'
AND LEC_DATE BETWEEN (SELECT LEC_ST_DATE FROM LEC_OPEN WHERE LEC_OPEN_ID =2)
AND (SELECT LEC_END_DATE FROM LEC_OPEN WHERE LEC_OPEN_ID =2)
SELECT A.QUEST_ID, A.QUEST_CONTENT, A.QUEST_ANSWER, A.QUEST_POINT, A.QUEST_TYPE, A.QUEST_LEVEL
, A.QUEST_COMMENT, A.EX1, A.EX2, A.EX3, A.EX4, A.EX5, A.TEST_ID, A.QUEST_ATFILE_ID, B.ATFILE_PATH, B.ATFILE_ORINAME
FROM TEST_QUEST A LEFT OUTER JOIN ATFILE B
ON A.QUEST_ATFILE_ID = B.ATFILE_ID
WHERE A.TEST_ID =45
AND A.QUEST_ID = 1
SELECT CODE_GR_ID, CODE_ID, CODE_USE, CODE_NAME, CODE_DESC
FROM CODE_TB
WHERE CODE_GR_ID = 'S1'
SELECT NVL(MAX(CNS_ID),0)+1 FROM COUNSEL
INSERT INTO COUNSEL(STU_NAME, STU_PHN, STU_EMAIL, POST, ADDR, ADDR_DETAIL, PROTEC_NAME, PROTEC_PHN, SCH_NAME
, BOOK_DATE, CNS_ID, CNS_STAT_CODE, HOPE_SUB1, HOPE_SUB2, HOPE_SUB3, GENDER, GRADE, REMARK, HOPE_CNS_DATE)
VALUES('홍길동', '01012345678', 'resdf@asdf.com', '34445', '한밭대로2022', '신동아 아파트402호', '홍길순', '01012345678'
, '대전 둔원고등학교', SYSDATE , (SELECT NVL(MAX(CNS_ID),0)+1 FROM COUNSEL), 'C101', 'S101', 'S102', '', 'female', 1, '집중력이 약해요', '2021-09-27'
)
SELECT T.*
FROM
(SELECT ROW_NUMBER () OVER(ORDER BY TO_NUMBER(CNS_ID) DESC) RNUM
, STU_NAME, STU_PHN, STU_EMAIL, POST, ADDR, ADDR_DETAIL, PROTEC_NAME, PROTEC_PHN, SCH_NAME, CNS_CONTENT, CNS_DATE, CNS_TITLE, BOOK_DATE, CNS_ID
, CNSER_ID, CNS_STAT_CODE, HOPE_SUB1, GENDER, GRADE, REMARK, HOPE_CNS_DATE, HOPE_SUB2, HOPE_SUB3
FROM COUNSEL
WHERE 1=1
ORDER BY BOOK_DATE
) T
WHERE T.RNUM BETWEEN (#{currentPage}-1) * #{rowSize} + 1 AND #{currentPage} * #{rowSize}
SELECT COUNT(CNS_ID) CNT
FROM COUNSEL
COMMIT;
| true
|
95113dc080ba32838fd4dbe46b891f14698dcd12
|
SQL
|
Biswayan375/SQL_Tutorials
|
/PRACTICE_SQL.sql
|
UTF-8
| 13,341
| 3.109375
| 3
|
[] |
no_license
|
-- PDF Page No.: 2, Ques. No.: 2 (Found a problem. Temporarily incomplete!)
-- player table
create table player(
pid varchar2(3),
pname varchar2(10),
nationality varchar2(10),
position varchar2(10),
age number(3),
primary key(pid)
);
insert into player values('e01', 'samuel', 'english', 'defender', 21);
insert into player values('e02', 'dsilva', 'brazilian', 'defender', 20);
insert into player values('e03', 'martinez', 'italian', 'attacker', 22);
insert into player values('e04', 'jordan', 'english', 'midfielder', 19);
insert into player values('e05', 'michael', 'english', 'defender', 20);
insert into player values('e06', 'miguel', 'italian', 'attacker', 25);
insert into player values('e07', 'carlos', 'brazilian', 'defender', 17);
-- club table
create table club(
cid varchar2(3),
cname varchar2(10),
country varchar2(10),
tier number(1),
primary key(cid)
);
insert into club values('c01', 'chelsea', 'england', 1);
insert into club values('c02', 'liverpool', 'england', 3);
insert into club values('c03', 'juventus', 'italy', 1);
insert into club values('c04', 'milan', 'italy', 2);
-- match table
create table match(
pid varchar2(3),
cid varchar2(3),
goal_scored number(1),
no_of_assists number(2),
no_of_fouls number(2),
foreign key(pid) references player(pid) on delete cascade,
foreign key(cid) references club(cid) on delete cascade
);
-- PDF Page No.: 4, Ques No.: 5
-- detective table
create table detective(
detid varchar2(3),
dname varchar2(10),
sex VARCHAR2(1),
age number(2),
experience number(2),
primary key(detid)
);
insert into detective values('d01', 'Suhasini', 'f', 25, 7);
insert into detective values('d02', 'Gauri', 'f', 28, 10);
insert into detective values('d03', 'Sam', 'm', 23, 8);
insert into detective values('d04', 'Rameswar', 'm', 30, 12);
insert into detective values('d05', 'Sunanda', 'f', 25, 10);
insert into detective values('d06', 'Nikhil', 'm', 20, 2);
-- crime table
create table crime(
cid varchar2(3),
cdate date,
location varchar2(15),
type varchar2(10),
primary key(cid)
);
insert into crime values('c01', '15-jan-2010', 'kolkata', 'robbery');
insert into crime values('c02', '7-jul-2015', 'north 24 pgns', 'homicide');
insert into crime values('c03', '12-feb-2008', 'purulia', 'fraud');
insert into crime values('c04', '20-mar-2016', 'north 24 pgns', 'robbery');
insert into crime values('c05', '22-dec-2017', 'north 24 pgns', 'robbery');
insert into crime values('c06', '2-aug-2015', 'kolkata', 'fraud');
insert into crime values('c07', '23-sep-2013', 'kolkata', 'homicide');
insert into crime values('c08', '25-sep-2013', 'kolkata', 'homicide');
-- investigates table
create table investigates(
detid varchar2(3),
cid varchar2(3),
date_from date,
date_to date,
status varchar2(10)
foreign key(detid) references detective(detid),
foreign key(cid) references crime(cid)
);
insert into investigates values('d01', 'c02', '7-jul-2015', '12-sep-2015', 'solved');
insert into investigates values('d02', 'c07', '30-sep-2013', '2-nov-2013', 'solved');
insert into investigates values('d05', 'c08', '25-sep-2013', '12-dec-2013', 'unsolved');
insert into investigates values('d06', 'c05', '22-dec-2017', '10-jan-2018', 'unknown');
select * from detective;
select * from crime;
select * from investigates;
-- Query1: Give details of all female detectives below age 35 who has solved homicide cases
-- (Using bridge)
select d.* from detective d, investigates i, crime c
where
d.detid = i.detid and
c.cid = i.cid and
d.sex = 'f' and
d.age < 35 and
c.type = 'homicide' and
i.status = 'solved';
-- (Using scalar subquery)
select * from detective
where
sex = 'f' and
age < 35 and
detid in(
select detid from investigates
where
cid in(
select cid from crime
where
type = 'homicide'
) and
status = 'solved'
);
-- (Using correlated subquery)
select d.* from detective d
where exists(
select i.* from investigates i
where exists(
select * from crime c
where
d.detid = i.detid and
c.cid = i.cid and
d.sex = 'f' and
d.age < 35 and
c.type = 'homicide' and
i.status = 'solved'
)
);
-- Query2: Find the location where maximum number of crimes have been committed
-- (Using scalar subquery)
select location, count(*) as "No of crimes" from crime
group by location
having count(*) in(
select max(count(*)) as "No. Of Crimes" from crime
group by location
);
-- Ouery3: List all robbery cases that have been taken place during the year 2016 and 2017 at "North 24 pgns"
-- (Using only aggregate function)
select * from crime
where
location = 'north 24 pgns' and
type = 'robbery' and
cdate between '1-jan2016' and '31-dec-2017';
-- PDF Page No.: 5, Ques No.: 6
-- salesperson table
create table salesperson(
sid varchar2(3),
sname varchar2(10),
age number(2),
city varchar2(10),
primary key(sid)
);
insert into salesperson values('s01', 'Ramesh', 22, 'kolkata');
insert into salesperson values('s02', 'Ram', 29, 'kolkata');
insert into salesperson values('s03', 'Dip', 19, 'kolkata');
insert into salesperson values('s04', 'Kailash', 22, 'bangalore');
insert into salesperson values('s05', 'Dipak', 20, 'delhi');
insert into salesperson values('s06', 'Nitin', 22, 'delhi');
insert into salesperson values('s07', 'Mukesh', 20, 'kolkata');
insert into salesperson values('s08', 'Ramakanto', 26, 'kolkata');
-- product table
create table product(
pid varchar2(3),
pname varchar2(15),
company varchar2(10),
price number(5),
color varchar2(10),
type varchar2(15),
primary key(pid)
);
insert into product values('p01', 'air conditioner', 'lloyd', 9900, 'white', 'electronic');
insert into product values('p02', 'air conditioner', 'samsung', 8900, 'grey', 'electronic');
insert into product values('p03', 'smartphone', 'samsung', 22000, 'white', 'electronic');
insert into product values('p04', 'smartphone', 'samsung', 23700, 'black', 'electronic');
insert into product values('p05', 'smartphone', 'realme', 25500, 'black', 'electronic');
insert into product values('p06', 'smartphone', 'redmi', 19999, 'black', 'electronic');
insert into product values('p07', 'table', 'indigo', 6700, 'wooden', 'furniture');
insert into product values('p08', 'bed', 'indigo', 9800, 'wooden', 'furniture');
-- sales table
create table sales(
sid varchar2(3),
pid varchar2(3),
sales_date date,
quantity number(3),
foreign key(sid) references salesperson(sid) on delete cascade,
foreign key(pid) references product(pid) on delete cascade
);
insert into sales values('s01', 'p08', '01-sep-2017', 2);
insert into sales values('s01', 'p07', '01-sep-2017', 2);
insert into sales values('s03', 'p07', '22-sep-2017', 3);
insert into sales values('s03', 'p08', '22-sep-2017', 1);
insert into sales values('s04', 'p03', '12-aug-2017', 3);
insert into sales values('s04', 'p05', '12-aug-2017', 5);
insert into sales values('s04', 'p06', '10-sep-2017', 4);
insert into sales values('s04', 'p03', '12-aug-2017', 3);
insert into sales values('s08', 'p05', '12-sep-2017', 2);
insert into sales values('s07', 'p06', '16-sep-2017', 3);
insert into sales values('s02', 'p01', '12-mar-2017', 2);
insert into sales values('s05', 'p02', '12-apr-2017', 1);
insert into sales values('s06', 'p01', '14-may-2017', 2);
insert into sales values('s02', 'p02', '12-mar-2017', 2);
insert into sales values('s06', 'p01', '02-apr-2018', 2);
insert into sales values('s02', 'p02', '04-may-2018', 3);
-- Query1: Find all salesperson from kolkata who have sold electronic goods during sept, 2017
-- (Using scalar subquery)
select * from salesperson
where
sid in(
select sid from sales
where
pid in(
select pid from product
where
type = 'electronic'
) and
sales_date between '01-sep-2017' and '30-sep-2017'
) and
city = 'kolkata';
-- (Using correlated subquery)
select s.* from salesperson s
where exists(
select sl.* from sales sl
where exists(
select p.* from product p
where
s.sid = sl.sid and
p.pid = sl.pid and
s.city = 'kolkata' and
p.type = 'electronic' and
sales_date between '01-sep-2017' and '30-sep-2017'
)
);
-- Query2: List all black colored smartphones priced above rs. 20000
select * from product
where
pname = 'smartphone' and
color = 'black' and
price > 20000;
-- Query3: Find the air conditioner company which has seen the highest sales in the year 2017
with tempTable as (
select s.pid, sum(s.quantity) as "Total sold" from sales s, product p
where
p.pid = s.pid and
s.sales_date between '01-jan-17' and '31-dec-17' and
p.pname = 'air conditioner'
group by s.pid
)
select p.company from product p, tempTable t
where
p.pid = t.pid and
t."Total sold" = (
select max(tempTable."Total sold") from tempTable
);
-- PDF Page No.: 8, Ques No.: 2
-- cab table
create table cab(
cno number(2),
model varchar2(15),
color varchar2(10),
purchase_date date,
primary key(cno)
);
insert into cab values(1, 'Tata Hexa', 'black', '12-aug-2010');
insert into cab values(2, 'Audi R8', 'red', '29-nov-2008');
insert into cab values(3, 'Ford Eco Sport', 'white', '12-jul-2009');
insert into cab values(4, 'Audi A5', 'white', '2-may-2010');
-- driver table
create table driver(
did number(2),
dname varchar2(10),
phone number(10),
rating number(1),
age number(2),
primary key(did)
);
insert into driver values(1, 'Ramesh', 1234567890, 3, 26);
insert into driver values(2, 'Suresh', 1234567890, 4, 25);
insert into driver values(3, 'Vim', 1234567890, 4, 22);
insert into driver values(4, 'Nayek', 1234567890, 5, 27);
insert into driver values(5, 'Samrat', 1234567890, 5, 25);
insert into driver values(6, 'Guru', 1234567890, 5, 22);
-- allotted table
create table allotted(
cno number(2),
did number(2),
"date" date,
foreign key(cno) references cab(cno) on delete cascade,
foreign key(did) references driver(did) on delete cascade
);
insert into allotted values(2, 1, '02-jul-2018');
insert into allotted values(4, 3, '12-jan-2018');
insert into allotted values(1, 2, '15-sep-2018');
insert into allotted values(4, 5, '02-jan-2018');
insert into allotted values(4, 6, '12-may-2018');
insert into allotted values(3, 4, '12-feb-2020');
insert into allotted values(1, 5, '12-dec-2020');
insert into allotted values(2, 3, '24-sep-2021');
insert into allotted values(4, 6, '24-sep-2021');
insert into allotted values(1, 1, '24-sep-2021');
-- Query1: Find average age of all drivers who have driven Audi A5
-- TO BE NOTED: The use of to_date(). Dates cannot be compared only using '=' or '<>'.
-- (Using scalar subquery)
select avg(age) from driver
where
did in(
select did from allotted
where
cno in(
select cno from cab
where
model = 'Audi A5'
) and
"date" <> to_date((select sysdate from dual))
group by
cno, did
);
-- (Using bridge / join)
select avg(distinct(mixed.age)) as "Avg. age" from
(
select d.age from driver d, allotted a, cab c
where
d.did = a.did and
c.cno = a.cno and
c.model = 'Audi A5' and
a."date" <> to_date((select sysdate from dual))
) mixed;
-- Query2: Display details of all cabs which have been driven by the driver with highest rating in january, 2018
-- (Using scalar subquery)
select * from cab
where
cno in(
select cno from allotted
where
did in(
select did from driver
where
rating in(select max(rating) from driver)
) and
"date" between '01-jan-2018' and '31-jan-2018'
);
-- (Using bridge / join)
select c.* from cab c, allotted a, driver d
where
c.cno = a.cno and
d.did = a.did and
d.rating in(
select max(rating) from driver
) and
a."date" between '01-jan-2018' and '31-jan-2018';
-- (Using correlated subquery)
select c.* from cab c
where exists(
select * from allotted a
where exists(
select * from driver d
where
a.cno = c.cno and
a.did = d.did and
d.rating = (
select max(rating) from driver
) and
a."date" between '01-jan-18' and '31-jan-18'
)
);
-- Query3: Delete all allotments scheduled today
delete from allotted
where
"date" = to_date((select sysdate from dual));
| true
|
0f24ae2d3556f5aa564018e017d60cefbe6c48f9
|
SQL
|
jtsato/java-clean-architecture-example
|
/infra/nosql/src/test/resources/io/github/jtsato/bookstore/infra/book/SearchBooksDataProviderTest.sql
|
UTF-8
| 1,073
| 2.65625
| 3
|
[
"Apache-2.0"
] |
permissive
|
INSERT INTO authors (author_id, name, gender, birthdate)
VALUES (1, 'Cay S. Horstmann', 'MALE', '1959-06-16');
INSERT INTO authors (author_id, name, gender, birthdate)
VALUES (2, 'Joshua Bloch', 'MALE', '1961-08-28');
INSERT INTO books (book_id, author_id, title, price, available, creation_date, update_date)
VALUES (1, 2, 'Effective Java (2nd Edition)', 40.44, FALSE, '2020-03-11T22:04:59.123', '2020-04-12T22:04:59.123');
INSERT INTO books (book_id, author_id, title, price, available, creation_date, update_date)
VALUES (2, 2, 'Effective Java', 30.33, TRUE, '2021-03-12T22:04:59.123', '2021-04-12T22:04:59.123');
INSERT INTO books (book_id, author_id, title, price, available, creation_date, update_date)
VALUES (3, 1, 'Core Java SE 9 for the Impatient, 2nd Edition', 20.22, FALSE, '2020-03-13T21:04:59.123', '2020-04-12T21:04:59.123');
INSERT INTO books (book_id, author_id, title, price, available, creation_date, update_date)
VALUES (4, 1, 'Core Java: Advanced Features uCertify Labs Access Code Card', 10.11, TRUE, '2020-03-14T21:04:59.123', '2020-04-12T21:04:59.123');
| true
|
f82c588f4c54a698ad96e10250fa350f224fe255
|
SQL
|
jee4a/jee4a-user-service
|
/docs/init.sql
|
UTF-8
| 272
| 2.53125
| 3
|
[] |
no_license
|
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nick_name` varchar(32) DEFAULT NULL,
`phone` varchar(32) DEFAULT NULL,
`status` tinyint(4) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| true
|
6c7625c30497256cbd35c30f4b5a3bc9688c12cc
|
SQL
|
debeando/sps
|
/schema.sql
|
UTF-8
| 1,145
| 3.640625
| 4
|
[] |
no_license
|
CREATE DATABASE IF NOT EXISTS trash;
CREATE DATABASE IF NOT EXISTS dba;
USE dba;
CREATE TABLE `audits` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`action` enum('I','U','D') NOT NULL,
`database_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
`column_name` varchar(64) NOT NULL,
`primary_key` int(10) unsigned DEFAULT NULL,
`old_value` text,
`new_value` text,
`user_name` varchar(64) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
KEY `audits_database_name` (`database_name`),
KEY `audits_table_name` (`table_name`),
KEY `audits_column_name` (`column_name`),
KEY `audits_primary_key` (`primary_key`),
KEY `audits_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `trash` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`database_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
`user_name` varchar(64) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| true
|
4bba40132b686b7f6f2366a63f3610da7f56a5c9
|
SQL
|
salapimuhamad/UAS
|
/dump-db_lks-202102261539.sql
|
UTF-8
| 2,822
| 2.953125
| 3
|
[] |
no_license
|
-- MariaDB dump 10.18 Distrib 10.4.17-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: db_lks
-- ------------------------------------------------------
-- Server version 10.4.17-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 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 `distribusi`
--
DROP TABLE IF EXISTS `distribusi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `distribusi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sekolah` varchar(200) DEFAULT NULL,
`kelas` char(1) DEFAULT NULL,
`jumlah` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `distribusi`
--
LOCK TABLES `distribusi` WRITE;
/*!40000 ALTER TABLE `distribusi` DISABLE KEYS */;
INSERT INTO `distribusi` VALUES (1,'La Tansa','1',35),(2,'SMA Negeri Impian','2',100);
/*!40000 ALTER TABLE `distribusi` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `stok`
--
DROP TABLE IF EXISTS `stok`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `stok` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`kelas` char(1) DEFAULT NULL,
`jumlah` int(11) DEFAULT NULL,
`harga` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `stok`
--
LOCK TABLES `stok` WRITE;
/*!40000 ALTER TABLE `stok` DISABLE KEYS */;
INSERT INTO `stok` VALUES (1,'1',500,5000),(2,'6',500,7000),(3,'2',400,6000);
/*!40000 ALTER TABLE `stok` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping routines for database 'db_lks'
--
/*!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-02-26 15:39:42
| true
|
87ac02bfe0a45ff1cd517d92c725e2b5fa90e9ec
|
SQL
|
timothyhoang/databases
|
/server/schema.sql
|
UTF-8
| 808
| 3.6875
| 4
|
[] |
no_license
|
-- CREATE DATABASE chat;
USE chat;
DROP TABLE IF EXISTS `messages`;
CREATE TABLE `messages` (
`id` INT AUTO_INCREMENT,
`username` INT,
`message` VARCHAR(256),
`roomname` INT,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` INT AUTO_INCREMENT,
`name` VARCHAR(24),
PRIMARY KEY (`id`),
UNIQUE KEY (`name`)
);
DROP TABLE IF EXISTS `rooms`;
CREATE TABLE `rooms` (
`id` INT AUTO_INCREMENT,
`name` VARCHAR(12),
PRIMARY KEY (`id`),
UNIQUE KEY (`name`)
);
ALTER TABLE `messages` ADD FOREIGN KEY (username) REFERENCES `users` (`id`);
ALTER TABLE `messages` ADD FOREIGN KEY (roomname) REFERENCES `rooms` (`id`);
/* Execute this file from the command line by typing:
* mysql -u root < server/schema.sql
* to create the database and the tables.*/
| true
|
7a27f5b737b90a1c7598c167d6d91770c900afae
|
SQL
|
tar98/OldSchoolRepo
|
/Web/Signup/sql/Pool-Car.sql
|
UTF-8
| 4,221
| 3.1875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generato il: Apr 09, 2018 alle 03:58
-- Versione del server: 5.5.38-0ubuntu0.14.04.1
-- Versione PHP: 5.5.9-1ubuntu4.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `Pool-Car`
--
-- --------------------------------------------------------
--
-- Struttura della tabella `Autista`
--
CREATE TABLE IF NOT EXISTS `Autista` (
`ID_autista` int(11) NOT NULL AUTO_INCREMENT,
`Cognome` varchar(30) NOT NULL,
`Nome` varchar(30) NOT NULL,
`Email` varchar(30) NOT NULL,
`Password` varchar(32) NOT NULL,
`Telefono` varchar(10) NOT NULL,
`data_nascita` date NOT NULL,
`sesso` varchar(1) NOT NULL,
`nazionalita` varchar(30) NOT NULL,
`Numero_patente` varchar(15) NOT NULL,
`Scadenza_Patente` date NOT NULL,
PRIMARY KEY (`ID_autista`),
UNIQUE KEY `Email` (`Email`),
UNIQUE KEY `Telefono` (`Telefono`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Dump dei dati per la tabella `Autista`
--
INSERT INTO `Autista` (`ID_autista`, `Cognome`, `Nome`, `Email`, `Password`, `Telefono`, `data_nascita`, `sesso`, `nazionalita`, `Numero_patente`, `Scadenza_Patente`) VALUES
(1, 'Scifoni', 'Letizia', 'scifoni.letizia@alice.com', 'scifoniletizia', '0976543215', '1979-11-16', 'F', 'Italia', 'B', '2019-07-12');
-- --------------------------------------------------------
--
-- Struttura della tabella `Auto`
--
CREATE TABLE IF NOT EXISTS `Auto` (
`Targa` varchar(7) NOT NULL,
`Marca` varchar(15) NOT NULL,
`Modello` varchar(15) NOT NULL,
`Cilindrata` int(11) NOT NULL,
`Potenza` int(11) NOT NULL,
`id_autista` int(11) NOT NULL,
PRIMARY KEY (`Targa`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `FeedBack`
--
CREATE TABLE IF NOT EXISTS `FeedBack` (
`ID_pas` int(11) NOT NULL,
`ID_autista` int(11) NOT NULL,
`Data` date NOT NULL,
`Voto` int(11) NOT NULL,
`Giudizio` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `Passegero`
--
CREATE TABLE IF NOT EXISTS `Passegero` (
`ID_pas` int(11) NOT NULL AUTO_INCREMENT,
`Cognome` varchar(30) NOT NULL,
`Nome` varchar(30) NOT NULL,
`Email` varchar(30) NOT NULL,
`Password` varchar(32) NOT NULL,
`Telefono` varchar(10) NOT NULL,
`Anno_nascita` date NOT NULL,
`Sesso` varchar(1) NOT NULL,
`Nazionalita` varchar(30) NOT NULL,
PRIMARY KEY (`ID_pas`),
UNIQUE KEY `Email` (`Email`),
UNIQUE KEY `Telefono` (`Telefono`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- Dump dei dati per la tabella `Passegero`
--
INSERT INTO `Passegero` (`ID_pas`, `Cognome`, `Nome`, `Email`, `Password`, `Telefono`, `Anno_nascita`, `Sesso`, `Nazionalita`) VALUES
(2, 'Mario', 'Rossi', 'mario.rossi@gmail.com', 'mariorossi', '3456789123', '1974-06-13', 'M', 'Italia');
-- --------------------------------------------------------
--
-- Struttura della tabella `Prenotazioni`
--
CREATE TABLE IF NOT EXISTS `Prenotazioni` (
`ID_pas` int(11) NOT NULL,
`ID_autista` int(11) NOT NULL,
`ID_Viaggio` int(11) NOT NULL,
`Data` date NOT NULL,
`Disponibile` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Struttura della tabella `Viaggio`
--
CREATE TABLE IF NOT EXISTS `Viaggio` (
`ID_viaggio` int(11) NOT NULL AUTO_INCREMENT,
`Data` date NOT NULL,
`Destinazione` varchar(30) NOT NULL,
`Importo` double NOT NULL,
`Ora_partenza` int(11) NOT NULL,
`Ora_arrivo` int(11) NOT NULL,
`Durata` int(11) NOT NULL COMMENT 'Minuti',
PRIMARY KEY (`ID_viaggio`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
/*!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
|
67f06e5bfdc71c92e71e9833d3b88eb4f328a277
|
SQL
|
sakaiproject/sakai
|
/msgcntr/messageforums-docs/SAK-11740_oracle.sql
|
UTF-8
| 637
| 2.78125
| 3
|
[
"ECL-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-generic-cla",
"GPL-1.0-or-later"
] |
permissive
|
DROP TABLE MFR_EMAIL_NOTIFICATION_T;
drop sequence MFR_EMAIL_NOTIFICATION_S;
CREATE TABLE "MFR_EMAIL_NOTIFICATION_T"
( "ID" NUMBER(19,0) NOT NULL ENABLE,
"VERSION" NUMBER(10,0) NOT NULL ENABLE,
"USER_ID" VARCHAR2(255 BYTE) NOT NULL ENABLE,
"CONTEXT_ID" VARCHAR2(255 BYTE) NOT NULL ENABLE,
"NOTIFICATION_LEVEL" NUMBER(1,0) NOT NULL ENABLE,
PRIMARY KEY ("ID")
) ;
CREATE INDEX "MFR_EMAIL_USER_ID_I" ON "MFR_EMAIL_NOTIFICATION_T" ("USER_ID") ;
CREATE INDEX "MFR_EMAIL_CONTEXT_ID_I" ON "MFR_EMAIL_NOTIFICATION_T" ("CONTEXT_ID")
;
create sequence MFR_EMAIL_NOTIFICATION_S;
| true
|
95f88df2c5e67a1819eaf603a0473f1b6485d0c7
|
SQL
|
MikeOshadami/mini-ebankingsystem
|
/sql/ebankingproject.sql
|
UTF-8
| 6,081
| 3.140625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Mar 14, 2018 at 04:01 PM
-- Server version: 5.7.19
-- 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: `ebankingproject`
--
-- --------------------------------------------------------
--
-- Table structure for table `accounts`
--
DROP TABLE IF EXISTS `accounts`;
CREATE TABLE IF NOT EXISTS `accounts` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`accountNumber` varchar(50) NOT NULL,
`bankCode` varchar(50) NOT NULL,
`dateCreated` datetime(5) NOT NULL,
`userId` int(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `accounts`
--
INSERT INTO `accounts` (`id`, `accountNumber`, `bankCode`, `dateCreated`, `userId`) VALUES
(1, '2005594449', '003', '2018-03-12 00:00:00.00000', 1),
(2, '1457903578', '001', '2018-03-12 00:00:00.00000', 2),
(3, '1001533529', '004', '2018-03-14 00:00:00.00000', 3),
(4, '9446276402', '006', '2018-03-14 00:00:00.00000', 4);
-- --------------------------------------------------------
--
-- Table structure for table `bankftpsettings`
--
DROP TABLE IF EXISTS `bankftpsettings`;
CREATE TABLE IF NOT EXISTS `bankftpsettings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bankCode` varchar(100) NOT NULL,
`transitAccount` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `bankftpsettings`
--
INSERT INTO `bankftpsettings` (`id`, `bankCode`, `transitAccount`) VALUES
(1, '001', '7393635464'),
(2, '002', '353836647484'),
(3, '003', '43736445433'),
(4, '004', '37393535474'),
(5, '005', '48560244565'),
(6, '006', '67046053455');
-- --------------------------------------------------------
--
-- Table structure for table `banks`
--
DROP TABLE IF EXISTS `banks`;
CREATE TABLE IF NOT EXISTS `banks` (
`1` int(11) NOT NULL AUTO_INCREMENT,
`bankCode` varchar(100) NOT NULL,
`bankName` varchar(100) NOT NULL,
PRIMARY KEY (`1`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `banks`
--
INSERT INTO `banks` (`1`, `bankCode`, `bankName`) VALUES
(1, '001', 'First Bank'),
(2, '002', 'Access Bank'),
(3, '003', 'Zenith Bank'),
(4, '004', 'Fidelity Bank'),
(5, '005', 'Eco Bank'),
(6, '006', 'Diamond Bank');
-- --------------------------------------------------------
--
-- Table structure for table `instanttransactiontlog`
--
DROP TABLE IF EXISTS `instanttransactiontlog`;
CREATE TABLE IF NOT EXISTS `instanttransactiontlog` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`transactionRef` varchar(200) NOT NULL,
`toAccount` varchar(100) NOT NULL,
`toBank` varchar(100) NOT NULL,
`amount` varchar(100) NOT NULL,
`fromAccount` varchar(100) NOT NULL,
`fromBank` varchar(100) NOT NULL,
`responseCode` varchar(50) NOT NULL,
`transactionDate` datetime(6) NOT NULL,
`DRCR` varchar(100) NOT NULL,
`narration` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `instanttransactiontlog`
--
INSERT INTO `instanttransactiontlog` (`id`, `transactionRef`, `toAccount`, `toBank`, `amount`, `fromAccount`, `fromBank`, `responseCode`, `transactionDate`, `DRCR`, `narration`) VALUES
(1, '594653739363', '67046053455', '006', '100000', '9446276402', '006', '00', '2018-03-12 00:00:00.000000', 'DR', ''),
(2, '594653739363', '2005594449', '003', '100000', '43736445433', '003', '00', '2018-03-12 00:00:00.000000', 'CR', 'Cash Deposit by Mike Oshadami'),
(3, '375575644123', '43736445433', '003', '20000', '2005594449', '003', '00', '2018-03-14 00:00:00.000000', 'DR', 'Transfer to Ife Ibidun'),
(4, '375575644123', '1001533529', '004', '20000', '37393535474', '004', '00', '2018-03-14 00:00:00.000000', 'CR', 'NIP - Mike Oshadami');
-- --------------------------------------------------------
--
-- Table structure for table `tellertillaccount`
--
DROP TABLE IF EXISTS `tellertillaccount`;
CREATE TABLE IF NOT EXISTS `tellertillaccount` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(50) NOT NULL,
`balance` varchar(100) NOT NULL,
`dateCreated` datetime(5) NOT NULL,
`lastUpdated` datetime(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tellertillaccount`
--
INSERT INTO `tellertillaccount` (`id`, `user_id`, `balance`, `dateCreated`, `lastUpdated`) VALUES
(1, 4, '1000000', '2018-03-14 00:00:00.00000', '2018-03-14 00:00:00.00000');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(25) NOT NULL,
`account_number` varchar(60) NOT NULL,
`user_password` varchar(255) NOT NULL,
`role` varchar(100) NOT NULL DEFAULT 'CUSTOMER',
`joining_date` datetime NOT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_id`, `user_name`, `account_number`, `user_password`, `role`, `joining_date`) VALUES
(1, 'Mike Oshadami', '2005594449', '098f6bcd4621d373cade4e832627b4f6', 'CUSTOMER', '2015-11-08 17:25:19'),
(2, 'Joe Doe', '2005594433', '1bbd886460827015e5d605ed44252251', 'CUSTOMER', '2015-11-14 13:37:19'),
(3, 'Ife Ibidun', '1001533529', '098f6bcd4621d373cade4e832627b4f6', 'CUSTOMER', '2018-03-14 00:00:00'),
(4, 'Ometere Lawal', '9446276402', '098f6bcd4621d373cade4e832627b4f6 ', 'TELLER', '2018-03-14 00:00:00');
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
|
b4843a86c99423d7e6ae90426153c343d83dfcde
|
SQL
|
Alequin/messaege_app_server
|
/src/sql/tables.sql
|
UTF-8
| 731
| 3.296875
| 3
|
[] |
no_license
|
DROP TABLE IF EXISTS messages;
DROP TABLE IF EXISTS participants;
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS conversations;
CREATE TABLE users(
id SERIAL8 PRIMARY KEY,
name VARCHAR(20),
avatar INT4,
device_system VARCHAR(40),
device_token TEXT,
online_status VARCHAR(20),
is_visible BOOLEAN
);
CREATE TABLE conversations(
id SERIAL8 PRIMARY KEY,
creation_date DATE
);
CREATE TABLE participants(
id SERIAL8 PRIMARY KEY,
user_id INT8 REFERENCES users(id),
conversation_id INT8 REFERENCES conversations(id)
);
CREATE TABLE messages(
id SERIAL8 PRIMARY KEY,
message_body TEXT,
user_id INT8 REFERENCES users(id),
conversation_id INT8 REFERENCES conversations(id),
sent_timestamp TIMESTAMP
);
| true
|
2d8d8cde142ec4cf45ab941b1b6ea6b19a3b085e
|
SQL
|
Genskill2/03-bootcamp-sql-rev-sketch
|
/query2.sql
|
UTF-8
| 86
| 2.578125
| 3
|
[] |
no_license
|
SELECT title,name
FROM books,publisher
WHERE publisher=publisher.id AND country='UK';
| true
|
fdc515d90d4f2859c294147238fe975798293a9d
|
SQL
|
silence-do-good/stress-test-Postgres-and-MySQL
|
/dump/low/day19/select1121.sql
|
UTF-8
| 178
| 2.65625
| 3
|
[] |
no_license
|
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-18T11:21:00Z' AND timestamp<'2017-11-19T11:21:00Z' AND temperature>=37 AND temperature<=50
| true
|
6d51a3baaaefc6f967c0b8b0232aed3dc26d6f9d
|
SQL
|
filipeoliveirah/php-default-project
|
/res/sql/tables/tb_states.sql
|
UTF-8
| 497
| 3.078125
| 3
|
[] |
no_license
|
CREATE TABLE `tb_states` (
`idstate` int(11) NOT NULL AUTO_INCREMENT,
`desstate` varchar(64) NOT NULL,
`desuf` char(2) NOT NULL,
`idcountry` int(11) NOT NULL,
`dtregister` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`idstate`),
KEY `FK_states_countries_idx` (`idcountry`),
CONSTRAINT `FK_states_countries` FOREIGN KEY (`idcountry`) REFERENCES `tb_countries` (`idcountry`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8
| true
|
3bcfaabe89b6432ae09e47a2ddc44d01505b8570
|
SQL
|
tatiopi/PL-SQL
|
/DDL/Vistas/views.sql
|
UTF-8
| 280
| 2.671875
| 3
|
[] |
no_license
|
CREATE TABLE VIEW VALO_VISTA AS
SELECT id_eper , cod_tesv , cod_tsev , cod_tval , importe_valo , importe_iva_valo
FROM VALO_VALORES WHERE ID_EPER IN (SELECT ID_EPER FROM EXPL_DESCUADRES);
select * from VALO_VLISTA WHERE FECHA_ULTIMO_VALO > '01/01/2020' ;
DROP VIEW VALO_VISTA ;
| true
|
a8bc5d085aad5885abb02bb0414a06568e41d3d3
|
SQL
|
elitetheespeon/Espybot
|
/espybot.sql
|
UTF-8
| 3,930
| 3.59375
| 4
|
[
"MIT"
] |
permissive
|
--
-- Table structure for table `config`
--
DROP TABLE IF EXISTS `config`;
CREATE TABLE `config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(45) CHARACTER SET utf8mb4 NOT NULL,
`value1` text COLLATE utf8mb4_unicode_ci,
`value2` text COLLATE utf8mb4_unicode_ci,
`value3` text COLLATE utf8mb4_unicode_ci,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`bot_id` int(2) NOT NULL,
PRIMARY KEY (`id`),
KEY `values` (`bot_id`,`value1`(40),`value2`(40),`value3`(40))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `invites`
--
DROP TABLE IF EXISTS `invites`;
CREATE TABLE `invites` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guild` varchar(50) NOT NULL,
`code` varchar(50) NOT NULL,
`maxage` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`uses` int(11) DEFAULT NULL,
`inviter_id` varchar(50) DEFAULT NULL,
`channel_id` varchar(50) DEFAULT NULL,
`bot_id` int(2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `last_seen`
--
DROP TABLE IF EXISTS `last_seen`;
CREATE TABLE `last_seen` (
`user_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`user_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_online` datetime DEFAULT NULL,
`desc` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`last_spoke` datetime DEFAULT NULL,
`bot_id` int(2) NOT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_id_UNIQUE` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `logs`
--
DROP TABLE IF EXISTS `logs`;
CREATE TABLE `logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guild` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message` text COLLATE utf8mb4_unicode_ci,
`user` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`date` datetime DEFAULT NULL,
`channel` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`bot_id` int(2) NOT NULL,
PRIMARY KEY (`id`),
KEY `channel` (`bot_id`,`guild`,`channel`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `name_history`
--
DROP TABLE IF EXISTS `name_history`;
CREATE TABLE `name_history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_name` varchar(170) CHARACTER SET utf8mb4 NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`bot_id` int(2) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_name_UNIQUE` (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `steam_log`
--
DROP TABLE IF EXISTS `steam_log`;
CREATE TABLE `steam_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`group_name` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`steam_id` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`user_name` varchar(80) CHARACTER SET utf8mb4 DEFAULT NULL,
`is_pm` tinyint(1) NOT NULL DEFAULT '0',
`message` text COLLATE utf8mb4_unicode_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `timers`
--
DROP TABLE IF EXISTS `timers`;
CREATE TABLE `timers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guild_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`channel_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`expires_at` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`new_channel_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`new_channel_desc` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message` text COLLATE utf8mb4_unicode_ci,
`bot_id` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
| true
|
02388acf84a04483141ece7376189ea98a190a1f
|
SQL
|
Bobstar89/Web-based-Projects
|
/shopping_planner/Shopping Database/data insertion/insert_button_mapping_data.sql
|
UTF-8
| 1,339
| 3.046875
| 3
|
[
"MIT"
] |
permissive
|
USE Shopping;
DELETE FROM Button_Mapping;
DELETE FROM Button;
DELETE FROM List_Type;
DELETE FROM Associated_View;
ALTER TABLE Button AUTO_INCREMENT = 1;
ALTER TABLE List_Type AUTO_INCREMENT = 1;
ALTER TABLE Associated_View AUTO_INCREMENT = 1;
INSERT INTO Button(name)
VALUES ('All Groceries'), ('All Games'), ('All Movies'), ('All Music'),
('IGA Groceries'), ('ALDI Groceries'), ('Coles Groceries'), ('Woolworths Groceries'),
('IGA Specials'), ('ALDI Specials'), ('Coles Specials'), ('Woolworths Specials'),
('Playstation'), ('Nintendo Wii'), ('PC'), ('3DS'),
('EB Games'), ('JB Games'), ('Steam Games'), ('PS Store Games'), ('Nintendo eShop'),
('Target Games'), ('Big W Games'), ('K-mart Games'),
('EB Specials'), ('JB Specials'), ('Steam Specials'), ('PS Store Specials'), ('Nintendo eShop Specials'),
('Target Specials'), ('Big W Specials'), ('K-mart Specials');
INSERT INTO List_Type(name) VALUES('Groceries'), ('Games');
INSERT INTO Associated_View(name)
VALUES ('all_games'), ('games_on_platform'), ('all_groceries'), ('iga_groceries'), ('game_sales');
INSERT INTO Button_Mapping(button_id, type_id, view_id)
VALUES(5, 1, 4), (2, 2, 5), (1, 1, 3);
| true
|
f1c98f1f1e0e87f948c70ce4dc0993fb9826c288
|
SQL
|
twan65/springboot-doma2-web
|
/docker-db/initdb/create_table.sql
|
UTF-8
| 2,051
| 3.875
| 4
|
[] |
no_license
|
SET CHARACTER utf8;
USER infodb;
CREATE TABLE information (
id int NOT NULL AUTO_INCREMENT COMMENT 'お知らせID',
title varchar(30) NOT NULL COMMENT 'タイトル',
overview varchar(300) NOT NULL COMMENT '概要',
display_start_date date NOT NULL COMMENT '掲載開始日',
display_end_date date NOT NULL COMMENT '掲載終了日',
is_delete int NOT NULL COMMENT '削除フラグ:0未削除、1:削除',
create_id varchar(128) NOT NULL DEFAULT '' COMMENT '作成者',
update_id varchar(128) NOT NULL DEFAULT '' COMMENT '更新者',
create_date_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '作成日',
update_date_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新日',
constraint information_PKC primary key(id)
) COMMENT='お知らせ';
CREATE TABLE user (
user_id varchar(128) NOT NULL COMMENT 'ユーザーID',
password varchar(1024) NOT NULL COMMENT 'パスワード',
name varchar(100) NOT NULL COMMENT '名前',
is_delete int NOT NULL COMMENT '削除フラグ',
create_id varchar(128) NOT NULL DEFAULT '' COMMENT '作成者',
update_id varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '更新者',
create_date_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '作成日',
update_date_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新日',
constraint user_PKC primary key(user_id)
) COMMENT='ユーザー';
CREATE TABLE information_type (
information_type_id int NOT NULL AUTO_INCREMENT COMMENT 'お知らせ種別ID',
information_type int NOT NULL COMMENT 'お知らせ種別',
create_id varchar(128) NOT NULL COMMENT '作成者',
update_id varchar(128) NOT NULL COMMENT '更新者',
create_date_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '作成日',
update_date_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新日',
constraint information_type_PKC primary key(information_type_id, information_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='お知らせ種別';
| true
|
bd075b040a97237833ea403bc20791d8d570306b
|
SQL
|
josf/folkso
|
/sql/tables/sessions.sql
|
UTF-8
| 3,360
| 4.03125
| 4
|
[] |
no_license
|
drop table if exists oid_urls;
drop table if exists fb_ids;
drop table if exists sessions;
drop table if exists users;
create table users
(userid varchar(255) primary key,
userno integer unsigned auto_increment not null, -- not to be used but mysql wants it
created datetime not null,
last_visit datetime not null,
firstname varchar(255) not null,
lastname varchar(255) not null,
nick varchar(70) not null,
email varchar(255) not null,
institution varchar(255) null,
pays varchar(50) null,
fonction varchar(50) null,
index unumb (userno)
)
ENGINE=InnoDB;
grant select on users to 'folkso'@'localhost';
grant select, insert, update, delete on users to 'folkso-rw'@'localhost';
create table fb_ids
(userid varchar(255) primary key,
fb_uid integer unsigned,
foreign key (userid) references users (userid),
index fb (fb_uid))
ENGINE=InnoDB;
grant select on fb_ids to 'folkso'@'localhost';
grant select, insert, update, delete on fb_ids to 'folkso-rw'@'localhost';
create table oid_urls
(userid varchar(255) primary key,
oid_url text not null,
foreign key (userid) references users (userid),
index oid (oid_url(400)))
ENGINE=InnoDB;
grant select on oid_urls to 'folkso'@'localhost';
grant select, insert, update, delete on oid_urls to 'folkso-rw'@'localhost';
create or replace view fb_users
as select fb_uid, u.userid as userid, last_visit, lastname, firstname, nick, email, institution, pays, fonction
from users u
join fb_ids f on f.userid = u.userid;
grant select on fb_users to 'folkso'@'localhost';
grant select on fb_users to 'folkso-rw'@'localhost';
create or replace view oi_users
as select oid_url, u.userid as userid, last_visit, lastname, firstname, nick, email, institution, pays, fonction
from users u
join oid_urls o on u.userid = o.userid;
create table sessions
(token char(64) primary key,
userid varchar(255) not null,
started timestamp not null default current_timestamp,
foreign key (userid) references users (userid)
)
ENGINE=InnoDB;
grant select on sessions to 'folkso'@'localhost';
grant select, insert, update, delete on sessions to 'folkso-rw'@'localhost';
create table rights
(rightid varchar(20) not null unique,
service varchar(20) not null,
description text null)
ENGINE=InnoDB;
grant select on sessions to 'folkso'@'localhost';
grant select, insert, update, delete on sessions to 'folkso-rw'@'localhost';
insert into rights (rightid, service) values ('create', 'folkso');
insert into rights (rightid, service) values ('delete_othertaggage', 'folkso');
insert into rights (rightid, service) values ('supertag', 'folkso');
insert into rights (rightid, service) values ('delete_tags', 'folkso');
insert into rights (rightid, service) values ('delete', 'folkso_user');
create table users_rights
(userid varchar(255) not null,
rightid varchar(20) not null,
foreign key (userid) references users (userid),
foreign key (rightid) references rights (rightid),
primary key (userid, rightid))
ENGINE=InnoDB;
grant select on sessions to 'folkso'@'localhost';
grant select, insert, update, delete on sessions to 'folkso-rw'@'localhost';
| true
|
80a7ac16d18147c957434f560a6410a224ec8e7a
|
SQL
|
setap/portal
|
/procedureDb/clobagg_type.sql
|
UTF-8
| 1,367
| 2.5625
| 3
|
[] |
no_license
|
create or replace type clobagg_type as object
(
text clob,
static function ODCIAggregateInitialize(sctx in out clobagg_type) return number,
member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number,
member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number,
member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number
);
/
create or replace type body clobagg_type is
static function ODCIAggregateInitialize(sctx in out clobagg_type) return number is
begin
sctx := clobagg_type(null) ;
return ODCIConst.Success ;
end;
member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number is
begin
self.text := self.text || value ;
return ODCIConst.Success;
end;
member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number is
begin
returnValue := self.text;
return ODCIConst.Success;
end;
member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number is
begin
self.text := self.text || ctx2.text;
return ODCIConst.Success;
end;
end;
/
create or replace function clobagg(input clob) return clob
deterministic
parallel_enable
aggregate using clobagg_type;
/
| true
|
784f8471a314fd5e4d8b94c062df737d3d18e936
|
SQL
|
lebatuananh/Example-SQL
|
/6- Where Condition/6.sql
|
UTF-8
| 478
| 2.84375
| 3
|
[] |
no_license
|
USE [C:\DOCUMENTS AND SETTINGS\FABRICE\APPLICATION DATA\LINQPAD\SAMPLES\LINQ IN ACTION\NORTHWND.MDF]
SELECT *
FROM Products
WHERE UnitPrice > 20 OR UnitPrice < 10
ORDER BY UnitPrice DESC
SELECT *
FROM Products
WHERE UnitPrice > 20 AND UnitPrice < 90
ORDER BY UnitPrice DESC
SELECT *
FROM Products
WHERE NOT Discontinued = 0
ORDER BY ProductName
SELECT *
FROM Products
WHERE CategoryID = 6 AND (UnitPrice > 20 OR UnitPrice < 10) AND NOT Discontinued = 0
ORDER BY ProductName
| true
|
594365feddf18a2ac040304828d5db8b80bb4c17
|
SQL
|
sulemankhan447/Scholar-Vision
|
/newEADB.sql
|
UTF-8
| 3,262
| 3.265625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.6.4deb1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Oct 07, 2017 at 01:37 AM
-- Server version: 5.7.18-0ubuntu0.16.10.1
-- PHP Version: 7.0.18-0ubuntu0.16.10.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: `EADB`
--
-- --------------------------------------------------------
--
-- Table structure for table `code`
--
CREATE TABLE `code` (
`rollno` varchar(20) NOT NULL,
`code` text NOT NULL,
`output` text NOT NULL,
`marks` int(11) DEFAULT NULL,
`tos` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `exp_detail`
--
CREATE TABLE `exp_detail` (
`s_name` varchar(255) NOT NULL,
`e_id` int(20) NOT NULL,
`e_aim` varchar(255) DEFAULT NULL,
`writeup` varchar(255) DEFAULT NULL,
`dos` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `faculty`
--
CREATE TABLE `faculty` (
`ID` int(11) NOT NULL,
`fname` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `final`
--
CREATE TABLE `final` (
`rollno` varchar(20) NOT NULL,
`file` mediumtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `student`
--
CREATE TABLE `student` (
`rollno` varchar(20) NOT NULL,
`name` varchar(255) NOT NULL,
`sem` varchar(25) NOT NULL,
`password` varchar(255) NOT NULL,
`registerat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `code`
--
ALTER TABLE `code`
ADD KEY `rollno` (`rollno`);
--
-- Indexes for table `exp_detail`
--
ALTER TABLE `exp_detail`
ADD PRIMARY KEY (`s_name`,`e_id`);
--
-- Indexes for table `faculty`
--
ALTER TABLE `faculty`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `final`
--
ALTER TABLE `final`
ADD KEY `rollno` (`rollno`);
--
-- Indexes for table `student`
--
ALTER TABLE `student`
ADD PRIMARY KEY (`rollno`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `faculty`
--
ALTER TABLE `faculty`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `code`
--
ALTER TABLE `code`
ADD CONSTRAINT `code_ibfk_1` FOREIGN KEY (`rollno`) REFERENCES `student` (`rollno`);
--
-- Constraints for table `final`
--
ALTER TABLE `final`
ADD CONSTRAINT `final_ibfk_1` FOREIGN KEY (`rollno`) REFERENCES `student` (`rollno`);
/*!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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.