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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9c8f6ee58ddd0b640db7f11c15879c7dcf71c048 | SQL | mfrazzini-MIDS/W205 | /exercise_1/investigations/hospital_variability/hospital_variability.sql | UTF-8 | 1,393 | 3.859375 | 4 | [] | no_license | -- Query 1: Analysis of variability in procedure_effective_care
SELECT A.measure_id, A.measure_name, incomplete_measures, round((incomplete_measures/4451),3) as avg_completeness FROM
(SELECT m.measure_id, m.measure_name, count(*) as incomplete_measures
FROM hospital h, procedure_effective_care p, measure_dates m
WHERE h.provider_id = p.provider_id
AND h.emergency_services = 'Yes'
AND p.measure_id = m.measure_id
AND p.score not in ('Not Available')
AND (p.footnote not like ('%1 - %') and p.footnote not like ('%5 - %') and p.footnote not like ('%7 - %') and p.footnote not like ('%11 - %'))
GROUP BY m.measure_id, m.measure_name) A
ORDER BY avg_completeness DESC;
-- Query 2: Analysis of variability in procedure_readmissions_deaths
SELECT A.measure_id, A.measure_name, incomplete_measures, round((incomplete_measures/4451),3) as avg_completeness FROM
(SELECT m.measure_id, m.measure_name, count(*) as incomplete_measures
FROM hospital h, procedure_readmissions_deaths p, measure_dates m
WHERE h.provider_id = p.provider_id
AND h.emergency_services = 'Yes'
AND p.measure_id = m.measure_id
AND p.score not in ('Not Available')
AND (p.footnote not like ('%1 - %') and p.footnote not like ('%5 - %') and p.footnote not like ('%7 - %') and p.footnote not like ('%11 - %'))
GROUP BY m.measure_id, m.measure_name) A
ORDER BY avg_completeness DESC;
| true |
7840fcf10780dae17e1b67539e8a294f96b51c8d | SQL | kim-913/CSE414_Database | /HW3/hw3-q1.sql | UTF-8 | 976 | 3.09375 | 3 | [] | no_license | SELECT DISTINCT F1.origin_city AS origin_city, F1.dest_city AS dest_city, MAX(F2.actual_time) AS time
FROM Flights AS F1, Flights AS F2
WHERE F1.origin_city = F2.origin_city
GROUP BY F1.origin_city, F1.dest_city, F1.actual_time
HAVING F1.actual_time = MAX(F2.actual_time)
ORDER BY F1.origin_city, F1.dest_city ASC;
/*rows returned: 334
time: 37s
origin_city dest_city time
Aberdeen SD Minneapolis MN 106
Abilene TX Dallas/Fort Worth TX 111
Adak Island AK Anchorage AK 471
Aguadilla PR New York NY 368
Akron OH Atlanta GA 408
Albany GA Atlanta GA 243
Albany NY Atlanta GA 390
Albuquerque NM Houston TX 492
Alexandria LA Atlanta GA 391
Allentown/Bethlehem/Easton PA Atlanta GA 456
Alpena MI Detroit MI 80
Amarillo TX Houston TX 390
Anchorage AK Barrow AK 490
Appleton WI Atlanta GA 405
Arcata/Eureka CA San Francisco CA 476
Asheville NC Chicago IL 279
Ashland WV Cincinnati OH 84
Aspen CO Los Angeles CA 304
Atlanta GA Honolulu HI 649
Atlantic City NJ Fort Lauderdale FL 212 */ | true |
8a3834c0340ddfdd2e00c283159495b28459d8e3 | SQL | ireapps/census | /tools/sql/ire_export/ire_P40.sql | UTF-8 | 1,388 | 2.78125 | 3 | [
"MIT"
] | permissive | -- P40. FAMILY TYPE AND AGE FOR OWN CHILDREN UNDER 18 YEARS
-- designed to work with the IRE Census bulk data exports
-- see http://census.ire.org/data/bulkdata.html
CREATE TABLE ire_p40 (
geoid VARCHAR(11) NOT NULL,
sumlev VARCHAR(3) NOT NULL,
state VARCHAR(2) NOT NULL,
county VARCHAR(3),
cbsa VARCHAR(5),
csa VARCHAR(3),
necta VARCHAR(5),
cnecta VARCHAR(3),
name VARCHAR(90) NOT NULL,
pop100 INTEGER NOT NULL,
hu100 INTEGER NOT NULL,
pop100_2000 INTEGER,
hu100_2000 INTEGER,
p040001 INTEGER,
p040001_2000 INTEGER,
p040002 INTEGER,
p040002_2000 INTEGER,
p040003 INTEGER,
p040003_2000 INTEGER,
p040004 INTEGER,
p040004_2000 INTEGER,
p040005 INTEGER,
p040005_2000 INTEGER,
p040006 INTEGER,
p040006_2000 INTEGER,
p040007 INTEGER,
p040007_2000 INTEGER,
p040008 INTEGER,
p040008_2000 INTEGER,
p040009 INTEGER,
p040009_2000 INTEGER,
p040010 INTEGER,
p040010_2000 INTEGER,
p040011 INTEGER,
p040011_2000 INTEGER,
p040012 INTEGER,
p040012_2000 INTEGER,
p040013 INTEGER,
p040013_2000 INTEGER,
p040014 INTEGER,
p040014_2000 INTEGER,
p040015 INTEGER,
p040015_2000 INTEGER,
p040016 INTEGER,
p040016_2000 INTEGER,
p040017 INTEGER,
p040017_2000 INTEGER,
p040018 INTEGER,
p040018_2000 INTEGER,
p040019 INTEGER,
p040019_2000 INTEGER,
p040020 INTEGER,
p040020_2000 INTEGER,
PRIMARY KEY (geoid)
);
| true |
e33023cda47a6f2c46506127dec0aa9ad32d91f9 | SQL | ghlacerda/Consultas | /Consultas/Incidente #117022 - Desenvolvimento de relatórios - Robbyson Indicador 203.sql | UTF-8 | 3,962 | 3.578125 | 4 | [] | no_license | DROP TABLE IF EXISTS #TempHostasMotorista
SELECT
MOTORISTA.CGCCPF AS colaborador_identification
,203 AS indicador_identification
,Cast((ISNULL(ISNULL(V.K_DATACHEGADAOMINILINK,V.K_DATACHEGADADIGITADA),V.CHEGADAEFETIVA) - ISNULL(ISNULL(V.K_DATASAIDAOMNILINK,V.K_DATASAIDADIGITADA),V.INICIOEFETIVO)) as Float) * 24.0 AS resultado
,(SUM(DIAS)*1440)
+(SUM(CONVERT(INT,cast(substring(CONVERT(VARCHAR(8),CAST(TEMPOOPERACAOESTIMADO AS TIME)),1,2) AS int)*60+
cast(substring(CONVERT(VARCHAR(8),CAST(TEMPOOPERACAOESTIMADO AS TIME)),4,2) AS int)+
cast(substring(CONVERT(VARCHAR(8),CAST(TEMPOOPERACAOESTIMADO AS TIME)),7,2) AS int)/60.0)))
+(SUM(CONVERT(INT,cast(substring(CONVERT(VARCHAR(8),CAST(HORAS AS TIME)),1,2) AS int)*60+
cast(substring(CONVERT(VARCHAR(8),CAST(HORAS AS TIME)),4,2) AS int)+
cast(substring(CONVERT(VARCHAR(8),CAST(HORAS AS TIME)),7,2) AS int)/60.0))) AS fator_0
,V.NUMEROVIAGEM AS fator_1
,0 AS fator_2
,0 AS fator_3
,0 AS fator_4
,0 AS fator_5
,0 AS fator_6
,0 AS fator_7
,0 AS fator_8
,0 AS fator_9
,0 AS fator_10
,CAST(ISNULL(ISNULL(V.K_DATACHEGADAOMINILINK,V.K_DATACHEGADADIGITADA),V.CHEGADAEFETIVA) AS DATE) AS [DATA]
,LVF.LINHAVIAGEM
,LINHA.NOME
into #TempHostasMotorista
FROM GLOP_VIAGENS V
LEFT JOIN GLOP_LINHAVIAGENS LINHA ON LINHA.HANDLE = V.LINHAVIAGEM
LEFT JOIN GN_PESSOAS MOTORISTA ON V.MOTORISTA = MOTORISTA.HANDLE
LEFT JOIN GLOP_LINHAVIAGEMFILIAIS LVF ON LVF.LINHAVIAGEM = LINHA.HANDLE
--LEFT JOIN GLOP_VIAGEMDOCUMENTOS DV ON DV.VIAGEM = V.HANDLE --AND VP.HANDLE = DV.PARADA
--LEFT JOIN GLOP_VIAGEMPARADAS VP ON V.HANDLE = VP.VIAGEM AND VP.HANDLE = DV.PARADA
WHERE 1=1
AND ISNULL(ISNULL(V.K_DATACHEGADAOMINILINK,V.K_DATACHEGADADIGITADA),V.CHEGADAEFETIVA) >= DATEADD(DAY, -1, GETDATE())
AND ISNULL(ISNULL(V.K_DATACHEGADAOMINILINK,V.K_DATACHEGADADIGITADA),V.CHEGADAEFETIVA) < GETDATE()
--AND V.NUMEROVIAGEM = '2019/362030-2'
AND V.TIPOVIAGEM = 172
AND V.STATUS IN (194, 180, 293, 181)
GROUP BY
MOTORISTA.CGCCPF
,Cast((ISNULL(ISNULL(V.K_DATACHEGADAOMINILINK,V.K_DATACHEGADADIGITADA),V.CHEGADAEFETIVA) - ISNULL(ISNULL(V.K_DATASAIDAOMNILINK,V.K_DATASAIDADIGITADA),V.INICIOEFETIVO)) as Float) * 24.0
,V.NUMEROVIAGEM
,CAST(ISNULL(ISNULL(V.K_DATACHEGADAOMINILINK,V.K_DATACHEGADADIGITADA),V.CHEGADAEFETIVA) AS DATE)
,LVF.LINHAVIAGEM
,LINHA.NOME
SELECT
colaborador_identification
,indicador_identification
,FORMAT(FLOOR(resultado)*100 + (resultado-FLOOR(resultado))*60,'00:00') as resultado
,convert(varchar, fator_0 / 60) + ':' + right('00'+convert(varchar, fator_0 % 60), 2) as fator_0
,fator_1
,fator_2
,fator_3
,fator_4
,fator_5
,fator_6
,fator_7
,fator_8
,fator_9
,fator_10
,[DATA]
,LINHAVIAGEM
,NOME
from #TempHostasMotorista
WHERE REPLACE(REPLACE(colaborador_identification, '.',''),'-','') IN
(
'90014456753'
,'88451143768'
,'11587468735'
,'03090306760'
,'14425495721'
,'09893510767'
,'12654881776'
,'03184311732'
,'14154903764'
,'01726070786'
,'74298500730'
,'47851864704'
,'36954659720'
,'07643710708'
,'81208693700'
,'11322573794'
,'84809922715'
,'11889534781'
,'01713943727'
,'07450977745'
,'79844910706'
,'99517264704'
,'15136363754'
,'13078284778'
,'09809644744'
,'90116054700'
,'07010662703'
,'26157035870'
,'08711447788'
,'00170529711'
,'11840882760'
,'11004081774'
,'92561365700'
,'49351079791'
,'00981374760'
,'52561089720'
,'07157727757'
,'46604596672'
,'99001780768'
,'20945507615'
,'57851972787'
,'03090947714'
,'00153461705'
,'76139409772'
,'14669239708'
,'86565354804'
,'12168082790'
,'03590185724'
,'00805427783'
,'15469199703'
,'05426279730'
,'12753066752'
,'02262315779'
,'06906199870'
,'10867446757'
,'92542484791'
,'15493114763'
,'00152918710'
,'00812965760'
,'11928167730'
,'08250114779'
,'04571375760'
,'00523113765'
,'07747201745'
,'61938718704'
,'08377122707'
,'02008021785'
,'04578726754'
,'17362394730'
,'62332040706'
,'12606267761'
,'09003180741'
,'96995246772'
,'83782460782'
)
| true |
e18e9ada34be98ca120a531ca3c85c1bf1008bdb | SQL | Crigerprogrammer/Fundamentos_BD | /preguntando_bd.sql | UTF-8 | 1,392 | 4.375 | 4 | [] | no_license | -- QUERY Para saber todos los tags de los post de manera descendente
SELECT posts.titulo, GROUP_CONCAT(nombre_etiqueta)
FROM posts
INNER JOIN posts_etiquetas ON posts.id = posts_etiquetas.post_id
INNER JOIN etiquetas ON etiquetas.id = posts_etiquetas.etiqueta_id
GROUP BY posts.id
ORDER BY num_etiquetas DESC;
-- Query para saber que etiqueta nunca han escrito en el blog
SELECT *
FROM etiquetas
LEFT JOIN posts_etiquetas ON etiquetas.id = posts_etiquetas.etiqueta_id
WHERE posts_etiquetas.etiqueta_id IS NULL;
-- Query saber que categoria tiene más post
SELECT c.nombre_categoria, COUNT(*) AS cant_posts
FROM categorias AS c
INNER JOIN posts AS p ON c.id = p.categoria_id
GROUP BY c.id
ORDER BY cant_posts DESC
LIMIT 1;
-- Query para saber que usuario escribe más
SELECT u.nickname, COUNT(*) AS cant_posts
FROM usuarios AS u
INNER JOIN posts AS p ON u.id = p.usuario_id
GROUP BU u.id
ORDER BY cant_posts DESC;
-- Query para saber que usuario escribe más y que categoría escribe más
SELECT u.nickname, COUNT(*) AS cant_posts, GROUP_CONCAT(nombre_categoria)
FROM usuarios AS u
INNER JOIN posts AS p ON u.id = p.usuario_id
INNER JOIN categorias AS c ON c.id = p.categoria_id
GROUP BY u.id
ORDER BY cant_posts DESC;
-- Query para saber usuarios que no han escrito posts
SELECT *
FROM usuarios AS u
LEFT JOIN posts ON u.id = posts.usuario_id
WHERE posts.usuario_id IS NULL | true |
b8cb1091cebd621f74f4f65b1121c4ace37db97d | SQL | imansetyawan/testingslug | /laravel_blog.sql | UTF-8 | 17,236 | 3.0625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 25 Nov 2016 pada 12.06
-- Versi Server: 10.1.9-MariaDB
-- PHP Version: 5.6.15
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: `laravel_blog`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `artikel`
--
CREATE TABLE `artikel` (
`id` int(10) UNSIGNED NOT NULL,
`judulartikel` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deskripsi` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`kategori_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`pageview` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `artikel`
--
INSERT INTO `artikel` (`id`, `judulartikel`, `deskripsi`, `image`, `slug`, `created_at`, `updated_at`, `kategori_id`, `user_id`, `pageview`) VALUES
(1, 'sushi', 'Pernahkah kamu merasa lapar meski baru saja mengkonsumsi makanan? Hal ini biasanya terjadi saat kamu mengkonsumsi makanan tertentu dengan tujuan untuk ‘mengganjal perut’. Padahal seharusnya perutmu terbantu dan merasa kenyang meski untuk sementara. Jika k', 'sushi.jpg', 'sushi', '2016-11-24 20:28:47', '2016-11-24 20:28:47', 22, 1, 0),
(2, 'Pizza', 'Meski dianggap sebagai makanan berat pengganti nasi, makanan-makanan ini hanya menimbulkan masalah seperti roti tawar putih yang berbahan dasar tepung terigu dan pemanis. Karbohidrat olahannya cepat dicerna tubuh dan meningkatkan kadar gula dalam tubuh.\r\n', 'pizza.jpg', 'pizza', '2016-11-24 20:30:13', '2016-11-24 20:30:13', 22, 1, 0),
(3, 'Biskuit dan kue kering sering dikonsumsi untuk mengganjal perut yang lapar', 'Biskuit dan kue kering juga termasuk makanan olahan berbahan tepung dan gula. Makanan ini hanya akan mengenyangkan perut dalam jangka waktu yang sebentar dan memicu rasa lapar datang lagi dalam waktu singkat. Cara kerja gula ini kerap mengingatkan otak ka', 'biskuit.jpg', 'biskuit-dan-kue-kering-sering-dikonsumsi-untuk-mengganjal-perut-yang-lapar', '2016-11-24 20:32:56', '2016-11-24 20:32:56', 25, 1, 0),
(4, 'Minum jus yang ditambah gula bukannya sehat, tubuhmu justru jadi sarang lemak dan gula!', 'Pengolahan jus yang keliru seringkali menghilangkan nutrisi penting tertentu. Misalnya dengan menambahkan gula, terlalu banyak air dan penyaringan yang justru akan membuat jus kehilangan seratnya. Meminum segelas jus seperti ini dapat meningkatkan kadar g', 'minum jus.jpg', 'minum-jus-yang-ditambah-gula-bukannya-sehat-tubuhmu-justru-jadi-sarang-lemak-dan-gula', '2016-11-24 20:35:45', '2016-11-24 20:35:45', 23, 1, 0),
(5, 'Almond Cookies yang baik buat kesehatan matamu', 'Kacang almond kaya akan vitamin E, sehingga sangat baik buat mata. Vitamin E pada kacang terbukti bisa mencegah masuknya redikal bebas yang ganggu mata dan memperlambat perkembangan katarak. Dan karena kacang almond ini bagus untuk kesehatan mata, nggak a', 'almond.jpg', 'almond-cookies-yang-baik-buat-kesehatan-matamu', '2016-11-24 20:48:15', '2016-11-24 20:48:15', 25, 1, 0),
(6, 'Biar manfaatnya makin berasa, buatlah jus wortelmu lebih lezat dengan mencampurkan tomat ke dalamnya', 'Mencampurkan tomat ke dalam jus wortel bisa mengurangi mual dan membuat manfaatnya berlipat ganda, khususnya buat kesehatan mata.\r\n\r\nBahan-bahan:\r\n\r\n 100 gr tomat\r\n 75 gr wortel\r\n 1 sdm madu atau sirup gula\r\n 1 gelas air putih\r\n\r\nCara membuat:', 'jus.jpg', 'biar-manfaatnya-makin-berasa-buatlah-jus-wortelmu-lebih-lezat-dengan-mencampurkan-tomat-ke-dalamnya', '2016-11-24 20:49:59', '2016-11-25 02:43:40', 24, 1, 10);
-- --------------------------------------------------------
--
-- Struktur dari tabel `induk_kategori`
--
CREATE TABLE `induk_kategori` (
`id` int(10) UNSIGNED NOT NULL,
`nama_induk_kategori` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `induk_kategori`
--
INSERT INTO `induk_kategori` (`id`, `nama_induk_kategori`, `created_at`, `updated_at`) VALUES
(1, 'olahraga', '2016-10-06 21:05:28', '2016-11-07 22:45:04'),
(2, 'fashion', '2016-10-06 21:05:47', '2016-10-06 21:05:47'),
(3, 'makanan', '2016-10-06 21:06:12', '2016-11-07 23:55:22'),
(4, 'minuman', '2016-10-06 21:06:31', '2016-11-07 23:56:18'),
(5, 'social', '2016-10-06 21:07:19', '2016-10-06 21:07:19'),
(7, 'politik', '2016-11-07 23:57:30', '2016-11-07 23:57:30');
-- --------------------------------------------------------
--
-- Struktur dari tabel `info`
--
CREATE TABLE `info` (
`id` int(10) UNSIGNED NOT NULL,
`alamat` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`telp` char(27) COLLATE utf8_unicode_ci NOT NULL,
`Email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `info`
--
INSERT INTO `info` (`id`, `alamat`, `telp`, `Email`, `created_at`, `updated_at`) VALUES
(2, 'Paris Perancis', '08910111213', 'firdizf@gmail.com', '2016-11-08 02:27:29', '2016-11-25 02:49:08');
-- --------------------------------------------------------
--
-- Struktur dari tabel `kategori`
--
CREATE TABLE `kategori` (
`id` int(10) UNSIGNED NOT NULL,
`namakategori` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`indukkategori_id` int(10) UNSIGNED NOT NULL,
`slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `kategori`
--
INSERT INTO `kategori` (`id`, `namakategori`, `created_at`, `updated_at`, `indukkategori_id`, `slug`) VALUES
(22, 'makanan', '2016-11-24 02:47:39', '2016-11-24 02:47:39', 0, 'makanan'),
(23, 'minuman', '2016-11-24 02:48:45', '2016-11-24 02:48:45', 0, 'minuman'),
(24, 'softdrink', '2016-11-24 02:49:47', '2016-11-24 02:49:47', 23, 'softdrink'),
(25, 'snack', '2016-11-24 02:50:20', '2016-11-24 02:50:20', 22, 'snack'),
(26, 'buah - buahan', '2016-11-24 20:39:16', '2016-11-24 20:39:16', 0, 'buah-buahan'),
(27, 'sayuran', '2016-11-24 20:39:37', '2016-11-24 20:39:37', 0, 'sayuran');
-- --------------------------------------------------------
--
-- Struktur dari tabel `message`
--
CREATE TABLE `message` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`subject` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`message` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `message`
--
INSERT INTO `message` (`id`, `name`, `email`, `subject`, `message`, `created_at`, `updated_at`) VALUES
(1, 'asf', 'adrfirdi@gmail.com', 'fsag', 'FSAGD', '2016-11-22 20:25:31', '2016-11-22 20:25:31'),
(2, 'ASDFG', 'firdizf@gmail.com', 'DFG', 'EFGD', '2016-11-22 20:28:33', '2016-11-22 20:28:33'),
(3, 'qwsdef', 'adrfirdi@gmail.com', 'df', 'dfvb', '2016-11-22 20:31:48', '2016-11-22 20:31:48'),
(4, 'zaxs', 'adrianzf@gmail.com', 'asd', 'asdcvc', '2016-11-22 20:49:49', '2016-11-22 20:49:49'),
(5, 'adafa', 'adrianzuh@gmail.com', 'asdfg', 'sdfgh', '2016-11-22 20:57:27', '2016-11-22 20:57:27'),
(6, 'oiuyt', 'adrianzuh@gmail.com', 'kjhgf', 'oiu7yt', '2016-11-22 20:58:30', '2016-11-22 20:58:30'),
(7, 'sdfghjk', 'adrianzuh@gmail.com', 'asdf', 'ASDFGH', '2016-11-22 20:59:45', '2016-11-22 20:59:45'),
(8, 'zxcv', 'adrianzf@gmail.com', 'asdfg', 'asdfg', '2016-11-22 21:05:54', '2016-11-22 21:05:54'),
(9, 'asdfg', 'adrianzuh@gmail.com', 'aaaa', 'aaaaa', '2016-11-22 21:09:26', '2016-11-22 21:09:26'),
(10, 'aaa', 'adrianzuh@gmail.com', 'asdfg', 'asdfghjkl', '2016-11-22 23:02:22', '2016-11-22 23:02:22'),
(11, 'asd', 'adrianzuh@gmail.com', 'asdfg', 'asdf', '2016-11-22 23:07:17', '2016-11-22 23:07:17'),
(12, 'sxc', 'adrianzf@gmail.com', 'aa', 'aaaa', '2016-11-22 23:08:47', '2016-11-22 23:08:47'),
(13, 'rt', 'adrianzuh@gmail.com', 'dfg', 'dfgh', '2016-11-22 23:11:29', '2016-11-22 23:11:29'),
(14, 'asdasdff', 'adrianzf@gmail.com', 'asdfgasd', 'asasdf', '2016-11-23 20:49:09', '2016-11-23 20:49:09'),
(15, 'ASDFG', 'adrianzuh@gmail.com', 'asdfasd', 'sd', '2016-11-23 20:53:34', '2016-11-23 20:53:34'),
(16, 'asdasdff', 'adrianzf@gmail.com', 'asd', 'asdc', '2016-11-23 20:55:17', '2016-11-23 20:55:17'),
(17, 'sa', 'adrianzuh@gmail.com', 'asa', 'sadad', '2016-11-23 20:57:45', '2016-11-23 20:57:45'),
(18, 'oiuygt', 'adrianzf@gmail.com', 'uytfr', 'iuytrf', '2016-11-23 21:07:57', '2016-11-23 21:07:57'),
(19, 'oiuygt', 'firdizf@gmail.com', 'oiuhg', 'iuyt', '2016-11-23 21:12:18', '2016-11-23 21:12:18');
-- --------------------------------------------------------
--
-- Struktur dari tabel `migrations`
--
CREATE TABLE `migrations` (
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `migrations`
--
INSERT INTO `migrations` (`migration`, `batch`) VALUES
('2014_10_12_000000_create_users_table', 1),
('2014_10_12_100000_create_password_resets_table', 1),
('2016_09_21_040952_buat_table_kategori', 1),
('2016_09_21_042118_buat_table_artikel', 1),
('2016_09_15_080250_add_field_kategori_id_for_table_artikel', 2),
('2016_09_21_051654_insert_level_di_tabel_user', 2),
('2016_09_23_023254_buat_tabel_induk_kategori', 2),
('2016_09_23_024401_edit_schema_kategori', 2),
('2016_10_03_070147_create_role_table', 3),
('2016_09_29_044449_create_field_user_id_for_table_artikel', 4),
('2016_10_03_070216_create_table_rolesid_for_tabel_users', 4),
('2016_10_06_021040_create_table_tambahan_profil', 5),
('2016_10_18_043522_Create_coloumn_pageview', 6),
('2016_10_20_054045_edit_table_kategori', 6),
('2016_10_21_034548_tambah_kolom_verifikasiregis_pada_tabel_user', 6),
('2016_10_27_045031_create_table_info', 7),
('2016_10_27_065659_buat_table_subscriber', 7),
('2016_10_27_090610_tambah_column_users', 7),
('2016_11_22_051022_buat_tabel_message', 8);
-- --------------------------------------------------------
--
-- Struktur dari tabel `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `roles`
--
CREATE TABLE `roles` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `roles`
--
INSERT INTO `roles` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'user', NULL, NULL),
(2, 'admin', NULL, NULL);
-- --------------------------------------------------------
--
-- Struktur dari tabel `subscriber`
--
CREATE TABLE `subscriber` (
`id` int(10) UNSIGNED NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `subscriber`
--
INSERT INTO `subscriber` (`id`, `email`, `created_at`, `updated_at`) VALUES
(1, 'adrfirdi@gmail.com', '2016-11-08 02:36:17', '2016-11-08 02:36:17'),
(2, 'firdizf@gmail.com', '2016-11-25 02:04:23', '2016-11-25 02:04:23');
-- --------------------------------------------------------
--
-- Struktur dari tabel `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`roles_id` int(10) UNSIGNED NOT NULL,
`namalengkap` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`nomorhp` int(11) NOT NULL,
`angkatan` int(11) NOT NULL,
`ttl` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`alamatasli` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`alamatmalang` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deskripsi` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`confirmed` tinyint(1) NOT NULL DEFAULT '0',
`confirmation_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`avatar` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'default.png'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data untuk tabel `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`, `roles_id`, `namalengkap`, `nomorhp`, `angkatan`, `ttl`, `alamatasli`, `alamatmalang`, `deskripsi`, `image`, `confirmed`, `confirmation_code`, `avatar`) VALUES
(1, 'adrian firdiansyah ', 'firdizf@gmail.com', '$2y$10$6txla4JT7vx6fZOTqsBkz.fzboF8/ZeOxn1S7bg9bj/qvFt8LFyuS', 'CdZeITnAPLIQn6UipbB9gQ5QIaoeTzNXxQelSUiy4o9B4E2qRSLDO6w60BGs', '2016-10-23 21:28:44', '2016-11-24 02:52:08', 2, 'adrian firdiansyah ', 2147483647, 14, 'singapore, 09 september 1996', 'Lamongan', 'Malang', '<p>good job guys<br></p>', '', 1, NULL, '1478581117.jpg'),
(2, 'adrian zuh', 'adrianzuh@gmail.com', '$2y$10$mIRe5IA7sB.SYwNt80bvF.BnPruUgTc.1.a0XiXu1UiFE02dOQaTG', 'nSiZEetCRxnsppYJuBh458P5r7YNEclyC5xTfPrepbPT12vwypMUvOOmOUck', '2016-11-13 21:52:31', '2016-11-13 23:55:30', 2, '', 0, 0, '', '', '', '', '', 1, '0', 'default.png');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `artikel`
--
ALTER TABLE `artikel`
ADD PRIMARY KEY (`id`),
ADD KEY `artikel_kategori_id_foreign` (`kategori_id`),
ADD KEY `artikel_user_id_foreign` (`user_id`);
--
-- Indexes for table `induk_kategori`
--
ALTER TABLE `induk_kategori`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `info`
--
ALTER TABLE `info`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `kategori`
--
ALTER TABLE `kategori`
ADD PRIMARY KEY (`id`),
ADD KEY `kategori_indukkategori_id_foreign` (`indukkategori_id`);
--
-- Indexes for table `message`
--
ALTER TABLE `message`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`),
ADD KEY `password_resets_token_index` (`token`);
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `subscriber`
--
ALTER TABLE `subscriber`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`),
ADD KEY `users_roles_id_foreign` (`roles_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `artikel`
--
ALTER TABLE `artikel`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `induk_kategori`
--
ALTER TABLE `induk_kategori`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `info`
--
ALTER TABLE `info`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `kategori`
--
ALTER TABLE `kategori`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
--
-- AUTO_INCREMENT for table `message`
--
ALTER TABLE `message`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `subscriber`
--
ALTER TABLE `subscriber`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--
--
-- Ketidakleluasaan untuk tabel `artikel`
--
ALTER TABLE `artikel`
ADD CONSTRAINT `artikel_kategori_id_foreign` FOREIGN KEY (`kategori_id`) REFERENCES `kategori` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `artikel_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Ketidakleluasaan untuk tabel `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `users_roles_id_foreign` FOREIGN KEY (`roles_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
5fea561c7c319ea5626f9d5e3b84c833c00fa1d8 | SQL | BrahmaAztra/BrahmaAstra | /samueldb.sql | UTF-8 | 1,622 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 17, 2018 at 11:11 AM
-- Server version: 5.7.20
-- PHP Version: 7.0.25
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: `samueldb`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_id` int(12) NOT NULL,
`firstname` varchar(30) NOT NULL,
`lastname` varchar(30) NOT NULL,
`address` varchar(150) NOT NULL,
`contact` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_id`, `firstname`, `lastname`, `address`, `contact`) VALUES
(1, 'John ', 'Doe', 'New York', '238729837'),
(2, 'Samuel', 'No lastname', 'Earth', '28372983');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
b620003e8570a89645de22dd87a96c30c3a66828 | SQL | dayvillefire/er-processing | /reports/ExtricationMiscodings.sql | UTF-8 | 549 | 3.09375 | 3 | [] | no_license | ###
### ExtricationMiscodings.sql
### @jbuchbinder
###
### Designed to look for mis-codings involving MVAs which should have been
### coded as 352s.
###
SELECT '2018-01-01 00:00:00' INTO @startPosition;
SELECT '2022-01-01 00:00:00' INTO @endPosition;
SELECT
i.IncidentDateTime,
i.RunNumber,
i.IncidentType,
REPLACE(i.Address,'<BR>', ' ') AS Address
FROM Incidents i
WHERE i.IncidentDateTime >= @startPosition AND i.IncidentDateTime < @endPosition AND
LEFT(i.IncidentType,1) = '3' AND
LEFT(i.IncidentType,3) > 321
ORDER BY i.RunNumber;
| true |
46388e4c728c35475b1678b7ac84c4681c6349f9 | SQL | llw33556/apex-blog | /APEX/f401/application/shared_components/user_interface/shortcuts/blog_rss_link.sql | UTF-8 | 824 | 2.609375 | 3 | [
"MIT"
] | permissive | prompt --application/shared_components/user_interface/shortcuts/blog_rss_link
begin
-- Manifest
-- SHORTCUT: BLOG_RSS_LINK
-- Manifest End
wwv_flow_api.component_begin (
p_version_yyyy_mm_dd=>'2020.10.01'
,p_release=>'20.2.0.00.20'
,p_default_workspace_id=>18303204396897713
,p_default_application_id=>401
,p_default_id_offset=>0
,p_default_owner=>'BLOG_040000'
);
wwv_flow_api.create_shortcut(
p_id=>wwv_flow_api.id(4293491733566665)
,p_shortcut_name=>'BLOG_RSS_LINK'
,p_shortcut_type=>'FUNCTION_BODY'
,p_shortcut_language=>'PLSQL'
,p_comments=>'Generate RSS link to page header. Used in page 1 page html header'
,p_shortcut=>wwv_flow_string.join(wwv_flow_t_varchar2(
'return #OWNER#.blog_html.get_rss_link(',
' p_app_id => :APP_ID',
' ,p_app_name => :G_APP_NAME',
');'))
);
wwv_flow_api.component_end;
end;
/
| true |
7e78ad631d26e852c5c6f893b5e28919d963afda | SQL | Sarjuuk/aowow | /setup/updates/1488745158_02.sql | UTF-8 | 7,711 | 3.234375 | 3 | [] | no_license | -- alterations
ALTER TABLE `aowow_spell`
ADD COLUMN `spellVisualId` smallint(5) unsigned NOT NULL AFTER `rankNo`;
ALTER TABLE `aowow_items`
ADD COLUMN `spellVisualId` smallint(5) unsigned NOT NULL DEFAULT '0' AFTER `displayId`,
ADD COLUMN `material` tinyint(3) NOT NULL DEFAULT '0' AFTER `lockId`,
ADD COLUMN `soundOverrideSubclass` tinyint(3) NOT NULL AFTER `subClassBak`,
ADD COLUMN `pickUpSoundId` smallint(5) unsigned NOT NULL DEFAULT '0' AFTER `maxMoneyLoot`,
ADD COLUMN `dropDownSoundId` smallint(5) unsigned NOT NULL DEFAULT '0' AFTER `pickUpSoundId`,
ADD COLUMN `sheatheSoundId` smallint(5) unsigned NOT NULL DEFAULT '0' AFTER `dropDownSoundId`,
ADD COLUMN `unsheatheSoundId` smallint(5) unsigned NOT NULL DEFAULT '0' AFTER `sheatheSoundId`;
-- additions
REPLACE INTO `aowow_articles` (`type`, `typeId`, `locale`, `article`, `quickInfo`)
VALUES (19, -1000, 0, 'Here you can set up a playlist of sounds and music. \n\nJust click the "Add" button near an audio control, then return to this page to listen to the list you\'ve created.', NULL);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!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' */;
DROP TABLE IF EXISTS `aowow_items_sounds`;
CREATE TABLE `aowow_items_sounds` (
`soundId` smallint(5) unsigned NOT NULL,
`subClassMask` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`soundId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='actually .. its only weapon related sounds in here';
DROP TABLE IF EXISTS `aowow_zones_sounds`;
CREATE TABLE `aowow_zones_sounds` (
`id` smallint(5) unsigned NOT NULL,
`ambienceDay` smallint(5) unsigned NOT NULL,
`ambienceNight` smallint(5) unsigned NOT NULL,
`musicDay` smallint(5) unsigned NOT NULL,
`musicNight` smallint(5) unsigned NOT NULL,
`intro` smallint(5) unsigned NOT NULL,
`worldStateId` smallint(5) unsigned NOT NULL,
`worldStateValue` smallint(6) NOT NULL,
INDEX `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `aowow_creature_sounds`;
CREATE TABLE IF NOT EXISTS `aowow_creature_sounds` (
`id` smallint(5) unsigned NOT NULL COMMENT 'CreatureDisplayInfo.dbc/id',
`greeting` smallint(5) unsigned NOT NULL,
`farewell` smallint(5) unsigned NOT NULL,
`angry` smallint(5) unsigned NOT NULL,
`exertion` smallint(5) unsigned NOT NULL,
`exertioncritical` smallint(5) unsigned NOT NULL,
`injury` smallint(5) unsigned NOT NULL,
`injurycritical` smallint(5) unsigned NOT NULL,
`death` smallint(5) unsigned NOT NULL,
`stun` smallint(5) unsigned NOT NULL,
`stand` smallint(5) unsigned NOT NULL,
`footstep` smallint(5) unsigned NOT NULL,
`aggro` smallint(5) unsigned NOT NULL,
`wingflap` smallint(5) unsigned NOT NULL,
`wingglide` smallint(5) unsigned NOT NULL,
`alert` smallint(5) unsigned NOT NULL,
`fidget` smallint(5) unsigned NOT NULL,
`customattack` smallint(5) unsigned NOT NULL,
`loop` smallint(5) unsigned NOT NULL,
`jumpstart` smallint(5) unsigned NOT NULL,
`jumpend` smallint(5) unsigned NOT NULL,
`petattack` smallint(5) unsigned NOT NULL,
`petorder` smallint(5) unsigned NOT NULL,
`petdismiss` smallint(5) unsigned NOT NULL,
`birth` smallint(5) unsigned NOT NULL,
`spellcast` smallint(5) unsigned NOT NULL,
`submerge` smallint(5) unsigned NOT NULL,
`submerged` smallint(5) unsigned NOT NULL,
`transform` smallint(5) unsigned NOT NULL,
`transformanimated` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='!ATTENTION!\r\nthe primary key of this table is NOT a creatureId, but displayId\r\n\r\ncolumn names from LANG.sound_activities';
DROP TABLE IF EXISTS `aowow_emotes_sounds`;
CREATE TABLE IF NOT EXISTS `aowow_emotes_sounds` (
`emoteId` smallint(5) unsigned NOT NULL,
`raceId` tinyint(3) unsigned NOT NULL,
`gender` tinyint(1) unsigned NOT NULL,
`soundId` smallint(5) unsigned NOT NULL,
UNIQUE KEY `emoteId_raceId_gender_soundId` (`emoteId`,`raceId`,`gender`,`soundId`),
KEY `emoteId` (`emoteId`),
KEY `raceId` (`raceId`),
KEY `soundId` (`soundId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `aowow_races_sounds`;
CREATE TABLE IF NOT EXISTS `aowow_races_sounds` (
`raceId` tinyint(3) unsigned NOT NULL,
`soundId` smallint(5) unsigned NOT NULL,
`gender` tinyint(1) unsigned NOT NULL,
UNIQUE KEY `race_soundId_gender` (`raceId`,`soundId`,`gender`),
KEY `race` (`raceId`),
KEY `soundId` (`soundId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `aowow_sounds`;
CREATE TABLE IF NOT EXISTS `aowow_sounds` (
`id` smallint(5) unsigned NOT NULL,
`cat` tinyint(3) unsigned NOT NULL,
`name` varchar(100) NOT NULL,
`cuFlags` int(10) unsigned NOT NULL,
`soundFile1` smallint(5) unsigned DEFAULT NULL,
`soundFile2` smallint(5) unsigned DEFAULT NULL,
`soundFile3` smallint(5) unsigned DEFAULT NULL,
`soundFile4` smallint(5) unsigned DEFAULT NULL,
`soundFile5` smallint(5) unsigned DEFAULT NULL,
`soundFile6` smallint(5) unsigned DEFAULT NULL,
`soundFile7` smallint(5) unsigned DEFAULT NULL,
`soundFile8` smallint(5) unsigned DEFAULT NULL,
`soundFile9` smallint(5) unsigned DEFAULT NULL,
`soundFile10` smallint(5) unsigned DEFAULT NULL,
`flags` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `cat` (`cat`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `aowow_sounds_files`;
CREATE TABLE IF NOT EXISTS `aowow_sounds_files` (
`id` smallint(6) NOT NULL COMMENT '<0 not found in client files',
`file` varchar(75) NOT NULL,
`path` varchar(75) NOT NULL COMMENT 'in client',
`type` tinyint(1) unsigned NOT NULL COMMENT '1: ogg; 2: mp3',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `aowow_spell_sounds`;
CREATE TABLE IF NOT EXISTS `aowow_spell_sounds` (
`id` smallint(5) unsigned NOT NULL COMMENT 'SpellVisual.dbc/id',
`animation` smallint(5) unsigned NOT NULL,
`ready` smallint(5) unsigned NOT NULL,
`precast` smallint(5) unsigned NOT NULL,
`cast` smallint(5) unsigned NOT NULL,
`impact` smallint(5) unsigned NOT NULL,
`state` smallint(5) unsigned NOT NULL,
`statedone` smallint(5) unsigned NOT NULL,
`channel` smallint(5) unsigned NOT NULL,
`casterimpact` smallint(5) unsigned NOT NULL,
`targetimpact` smallint(5) unsigned NOT NULL,
`castertargeting` smallint(5) unsigned NOT NULL,
`missiletargeting` smallint(5) unsigned NOT NULL,
`instantarea` smallint(5) unsigned NOT NULL,
`persistentarea` smallint(5) unsigned NOT NULL,
`casterstate` smallint(5) unsigned NOT NULL,
`targetstate` smallint(5) unsigned NOT NULL,
`missile` smallint(5) unsigned NOT NULL COMMENT 'not predicted by js',
`impactarea` smallint(5) unsigned NOT NULL COMMENT 'not predicted by js',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='!ATTENTION!\r\nthe primary key of this table is NOT a spellId, but spellVisualId\r\n\r\ncolumn names from LANG.sound_activities';
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
UPDATE aowow_dbversion SET `build` = CONCAT(IFNULL(`build`, ''), ' soundfiles'), `sql` = CONCAT(IFNULL(`sql`, ''), ' spell creature sounds spawns');
| true |
f9e94a09b0bdfcf62af71cc9908ec31d75018507 | SQL | delphi1977/NewDicomPACS | /Database/oracle/tables/tdispcard_naz.sql | WINDOWS-1251 | 669 | 3.15625 | 3 | [] | no_license | DROP TABLE ASU.TDISPCARD_NAZ CASCADE CONSTRAINTS
/
--
-- TDISPCARD_NAZ (Table)
--
CREATE TABLE ASU.TDISPCARD_NAZ
(
FK_NAZID NUMBER,
FK_DISPKARDID NUMBER,
FD_NAZ DATE DEFAULT SYSDATE
)
TABLESPACE USR
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING
/
COMMENT ON COLUMN ASU.TDISPCARD_NAZ.FD_NAZ IS ' '
/
| true |
51fb91aa279d7da0014701be128c2e2a4fc0d18f | SQL | jabautista/GeniisysSCA | /src/main/resources/sql/procedures/delete_all_tables_for_pack.prc | UTF-8 | 1,194 | 2.96875 | 3 | [] | no_license | DROP PROCEDURE CPI.DELETE_ALL_TABLES_FOR_PACK;
CREATE OR REPLACE PROCEDURE CPI.DELETE_ALL_TABLES_FOR_PACK
(p_pack_par_id IN GIPI_PACK_PARLIST.pack_par_id%TYPE)
IS
/*
** Created by : Veronica V. Raymundo
** Date Created : March 04, 2011
** Reference By : (GIPIS002A - Package PAR Basic Information)
** Description : This deletes all table records of Package PAR and its sub-policies.
**
*/
BEGIN
FOR i IN (SELECT par_id
FROM gipi_parlist
WHERE par_status NOT IN (98,99)
AND pack_par_id = p_pack_par_id)
LOOP
DELETE_ALL_TABLES2(i.par_id);
END LOOP;
DELETE FROM gipi_pack_winstallment
WHERE pack_par_id = p_pack_par_id;
DELETE FROM gipi_pack_winvperl
WHERE pack_par_id = p_pack_par_id;
DELETE FROM gipi_pack_winv_tax
WHERE pack_par_id = p_pack_par_id;
DELETE FROM gipi_pack_winvoice
WHERE pack_par_id = p_pack_par_id;
DELETE FROM gipi_pack_winvperl
WHERE pack_par_id = p_pack_par_id;
DELETE FROM gipi_pack_wpolnrep
WHERE pack_par_id = p_pack_par_id;
DELETE FROM gipi_pack_wpolwc
WHERE pack_par_id = p_pack_par_id;
END;
/
| true |
87b816004d376bf308a686518a6cd2b2f0cabb88 | SQL | JStein92/Mario-Food-Products | /mario-food.sql | UTF-8 | 3,362 | 3.1875 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Oct 20, 2017 at 11:57 PM
-- Server version: 5.6.34-log
-- PHP Version: 7.1.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: `mario-food`
--
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
CREATE TABLE `products` (
`ProductId` int(11) NOT NULL,
`ProductCost` longtext,
`ProductCountry` longtext,
`ProductName` longtext
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`ProductId`, `ProductCost`, `ProductCountry`, `ProductName`) VALUES
(5, '10', 'USA', 'Beef'),
(6, '5', 'Italy', 'Pasta'),
(7, '3', 'Italy', 'Gelato'),
(8, '8', 'Spain', 'Chicken');
-- --------------------------------------------------------
--
-- Table structure for table `reviews`
--
CREATE TABLE `reviews` (
`ReviewId` int(11) NOT NULL,
`ProductId` int(11) NOT NULL,
`ReviewAuthor` longtext,
`ReviewContentBody` longtext,
`ReviewRating` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `reviews`
--
INSERT INTO `reviews` (`ReviewId`, `ProductId`, `ReviewAuthor`, `ReviewContentBody`, `ReviewRating`) VALUES
(5, 5, 'Jonathan', 'Great beef! Would eat again! Woooooooooooooooooow.', 4),
(6, 6, 'Jonathan', 'Horrible pasta! Never eat here again! grossssssssssssssssssssssssssssss', 1);
-- --------------------------------------------------------
--
-- Table structure for table `__efmigrationshistory`
--
CREATE TABLE `__efmigrationshistory` (
`MigrationId` varchar(95) NOT NULL,
`ProductVersion` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `__efmigrationshistory`
--
INSERT INTO `__efmigrationshistory` (`MigrationId`, `ProductVersion`) VALUES
('20171020185330_Initial', '1.1.2');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`ProductId`);
--
-- Indexes for table `reviews`
--
ALTER TABLE `reviews`
ADD PRIMARY KEY (`ReviewId`),
ADD KEY `IX_Reviews_ProductId` (`ProductId`);
--
-- Indexes for table `__efmigrationshistory`
--
ALTER TABLE `__efmigrationshistory`
ADD PRIMARY KEY (`MigrationId`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
MODIFY `ProductId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `reviews`
--
ALTER TABLE `reviews`
MODIFY `ReviewId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `reviews`
--
ALTER TABLE `reviews`
ADD CONSTRAINT `FK_Reviews_Products_ProductId` FOREIGN KEY (`ProductId`) REFERENCES `products` (`ProductId`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
5d18dc5024e4760856274cc0184ea44e80532b3b | SQL | LorenaArquero/PracticaConcesionario | /practica_php.sql | UTF-8 | 4,153 | 3.40625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.0
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 05-05-2018 a las 16:44:51
-- Versión del servidor: 10.1.31-MariaDB
-- Versión de PHP: 7.2.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `practica_php`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `mensajes`
--
CREATE TABLE `mensajes` (
`id` int(11) NOT NULL,
`emisor` varchar(15) NOT NULL,
`texto` text NOT NULL,
`leido` tinyint(1) NOT NULL,
`fecha` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `pedidos`
--
CREATE TABLE `pedidos` (
`id` int(11) NOT NULL,
`concesionario` varchar(15) NOT NULL,
`fecha` date NOT NULL,
`proveedor` varchar(20) NOT NULL,
`producto` varchar(50) NOT NULL,
`productoID` int(11) NOT NULL,
`cantidad` int(11) NOT NULL,
`confirmado` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `productos`
--
CREATE TABLE `productos` (
`id` int(11) NOT NULL,
`proveedor` varchar(15) NOT NULL,
`nombre` varchar(30) NOT NULL,
`cantidad` int(11) NOT NULL,
`descatalogado` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario`
--
CREATE TABLE `usuario` (
`id` int(11) NOT NULL,
`username` varchar(15) NOT NULL,
`password` varchar(20) NOT NULL,
`tipo` varchar(20) NOT NULL,
`numeroSesiones` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `usuario`
--
INSERT INTO `usuario` (`id`, `username`, `password`, `tipo`, `numeroSesiones`) VALUES
(1, 'concesionario1', 'concesionario1', 'Concesionario', 0),
(2, 'proveedor1', 'proveedor1', 'Proveedor', 0);
--
-- Volcado de datos para la tabla `productos`
--
INSERT INTO `productos` (`id`, `proveedor`, `nombre`, `cantidad`, `descatalogado`) VALUES
(1, 'proveedor1', 'producto1', 500, 0),
(2, 'proveedor1', 'producto2', 500, 0);
--
-- Volcado de datos para la tabla `pedidos`
--
INSERT INTO `pedidos` (`id`, `concesionario`, `fecha`, `proveedor`, `producto`, `productoID`, `cantidad`, `confirmado` ) VALUES
(1, 'concesionario1', '2018-05-09', 'proveedor1', 'producto1', 1, 20, 0),
(2, 'concesionario1', '2018-05-10', 'proveedor1', 'producto2', 2, 30, 0);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `mensajes`
--
ALTER TABLE `mensajes`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `pedidos`
--
ALTER TABLE `pedidos`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `productos`
--
ALTER TABLE `productos`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `mensajes`
--
ALTER TABLE `mensajes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `pedidos`
--
ALTER TABLE `pedidos`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `productos`
--
ALTER TABLE `productos`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `usuario`
--
ALTER TABLE `usuario`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
1082e2502bffc245d5f5417400fd94b82c762119 | SQL | smp-org/smp | /src/Smp.Migrations/Migrations/Up/201912261626_DropPostsTable.sql | UTF-8 | 361 | 3.109375 | 3 | [
"MIT"
] | permissive | IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Comments' AND COLUMN_NAME = 'PostId' AND TABLE_SCHEMA = 'DBO')
BEGIN
ALTER TABLE Comments DROP CONSTRAINT FK_Comments_PostId_Posts_Id
ALTER TABLE Comments DROP COLUMN PostId;
END
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Posts')
BEGIN
DROP TABLE Posts;
END | true |
56f79eaf8d729f78bb7d8e3881923141644d91a1 | SQL | CUBRID/cubrid-testcases | /medium/_02_xtests/cases/joins6.sql | UTF-8 | 380 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | autocommit off;
select shipment_id, product.product_code, to_location, original_loc
from joe.shipment_c s
where product.product_code > all (select product.product_code
from joe.inventory_c i
where product.product_code < 3
and i.location = s.original_loc);
rollback;
| true |
33ca9361a71f5816b9007bd1557e348e63094092 | SQL | fandashtic/arc_chennai | /Sivabalan-SQL/SQL_STORED_PROCEDURE/mERP_sp_Load_GRNDetail.sql | UTF-8 | 898 | 3.140625 | 3 | [] | no_license | CREATE PROCEDURE mERP_sp_Load_GRNDetail(@GRNID INT)
AS
Select
"ItemCode" = G.Product_Code ,
"ItemName" = I.ProductName ,
"UOMQty" = G.UOMQty ,
"FreeQty" = G.FreeQty ,
"UOMID" = G.UOM,
"UOMDescription" = (Select IsNull(Description, 'Multiple') From UOM Where UOM = G.UOM),
"TaxID" = IsNull((select top 1 GRNTAXID from batch_products where batch_products.GRN_ID = @GRNID and batch_Products.Product_code = G.Product_code order by batch_products.batch_code desc),0),
"DiscPer" = G.DiscPer,
"DiscPerUnit" = G.DiscPerUnit,
"InvDiscPer" = G.InvDiscPer,
"InvDiscPerUnit" = G.InvDiscPerUnit,
"InvDiscAmt" = G.InvDiscAmt,
"OtherDiscPer" = G.OtherDiscPer,
"OtherDiscPerUnit" = G.OtherDiscPerUnit,
"OtherDiscAmt" = G.OtherDiscAmt,
"Serial" = G.Serial,
"TOQ"=isnull(G.TOQ,0)
,"HSNNumber" = I.HSNNumber
From GRNDetail G, Items I
Where GRNID = @GRNID
And G.Product_Code = I.Product_Code
Order By G.Serial
| true |
60803febd7172f69034cb91b182add54e95ffe4b | SQL | WYCisme/Xblog | /src/main/resources/20190802.sql | UTF-8 | 16,199 | 3.40625 | 3 | [] | no_license | SET FOREIGN_KEY_CHECKS=0;
CREATE TABLE `blog`.`QRTZ_BLOB_TRIGGERS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`BLOB_DATA` blob NULL,
PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
INDEX `SCHED_NAME`(`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
CONSTRAINT `QRTZ_BLOB_TRIGGERS_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `blog`.`QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_CALENDARS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`CALENDAR_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`CALENDAR` blob NOT NULL,
PRIMARY KEY (`SCHED_NAME`, `CALENDAR_NAME`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_CRON_TRIGGERS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`CRON_EXPRESSION` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TIME_ZONE_ID` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
CONSTRAINT `QRTZ_CRON_TRIGGERS_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `blog`.`QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_FIRED_TRIGGERS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`ENTRY_ID` varchar(95) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`INSTANCE_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`FIRED_TIME` bigint(13) NOT NULL,
`SCHED_TIME` bigint(13) NOT NULL,
`PRIORITY` int(11) NOT NULL,
`STATE` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`JOB_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`JOB_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`, `ENTRY_ID`) USING BTREE,
INDEX `IDX_QRTZ_FT_TRIG_INST_NAME`(`SCHED_NAME`, `INSTANCE_NAME`) USING BTREE,
INDEX `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY`(`SCHED_NAME`, `INSTANCE_NAME`, `REQUESTS_RECOVERY`) USING BTREE,
INDEX `IDX_QRTZ_FT_J_G`(`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE,
INDEX `IDX_QRTZ_FT_JG`(`SCHED_NAME`, `JOB_GROUP`) USING BTREE,
INDEX `IDX_QRTZ_FT_T_G`(`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
INDEX `IDX_QRTZ_FT_TG`(`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_JOB_DETAILS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`JOB_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`JOB_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`DESCRIPTION` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`JOB_CLASS_NAME` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`IS_DURABLE` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`IS_UPDATE_DATA` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`JOB_DATA` blob NULL,
PRIMARY KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE,
INDEX `IDX_QRTZ_J_REQ_RECOVERY`(`SCHED_NAME`, `REQUESTS_RECOVERY`) USING BTREE,
INDEX `IDX_QRTZ_J_GRP`(`SCHED_NAME`, `JOB_GROUP`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_LOCKS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`LOCK_NAME` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`SCHED_NAME`, `LOCK_NAME`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_PAUSED_TRIGGER_GRPS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_SCHEDULER_STATE` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`INSTANCE_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`LAST_CHECKIN_TIME` bigint(13) NOT NULL,
`CHECKIN_INTERVAL` bigint(13) NOT NULL,
PRIMARY KEY (`SCHED_NAME`, `INSTANCE_NAME`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_SIMPLE_TRIGGERS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`REPEAT_COUNT` bigint(7) NOT NULL,
`REPEAT_INTERVAL` bigint(12) NOT NULL,
`TIMES_TRIGGERED` bigint(10) NOT NULL,
PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
CONSTRAINT `QRTZ_SIMPLE_TRIGGERS_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `blog`.`QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_SIMPROP_TRIGGERS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`STR_PROP_1` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`STR_PROP_2` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`STR_PROP_3` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`INT_PROP_1` int(11) NULL DEFAULT NULL,
`INT_PROP_2` int(11) NULL DEFAULT NULL,
`LONG_PROP_1` bigint(20) NULL DEFAULT NULL,
`LONG_PROP_2` bigint(20) NULL DEFAULT NULL,
`DEC_PROP_1` decimal(13, 4) NULL DEFAULT NULL,
`DEC_PROP_2` decimal(13, 4) NULL DEFAULT NULL,
`BOOL_PROP_1` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`BOOL_PROP_2` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
CONSTRAINT `QRTZ_SIMPROP_TRIGGERS_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `blog`.`QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`QRTZ_TRIGGERS` (
`SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`JOB_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`JOB_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`DESCRIPTION` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`NEXT_FIRE_TIME` bigint(13) NULL DEFAULT NULL,
`PREV_FIRE_TIME` bigint(13) NULL DEFAULT NULL,
`PRIORITY` int(11) NULL DEFAULT NULL,
`TRIGGER_STATE` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`TRIGGER_TYPE` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`START_TIME` bigint(13) NOT NULL,
`END_TIME` bigint(13) NULL DEFAULT NULL,
`CALENDAR_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`MISFIRE_INSTR` smallint(2) NULL DEFAULT NULL,
`JOB_DATA` blob NULL,
PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
INDEX `IDX_QRTZ_T_J`(`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE,
INDEX `IDX_QRTZ_T_JG`(`SCHED_NAME`, `JOB_GROUP`) USING BTREE,
INDEX `IDX_QRTZ_T_C`(`SCHED_NAME`, `CALENDAR_NAME`) USING BTREE,
INDEX `IDX_QRTZ_T_G`(`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE,
INDEX `IDX_QRTZ_T_STATE`(`SCHED_NAME`, `TRIGGER_STATE`) USING BTREE,
INDEX `IDX_QRTZ_T_N_STATE`(`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `TRIGGER_STATE`) USING BTREE,
INDEX `IDX_QRTZ_T_N_G_STATE`(`SCHED_NAME`, `TRIGGER_GROUP`, `TRIGGER_STATE`) USING BTREE,
INDEX `IDX_QRTZ_T_NEXT_FIRE_TIME`(`SCHED_NAME`, `NEXT_FIRE_TIME`) USING BTREE,
INDEX `IDX_QRTZ_T_NFT_ST`(`SCHED_NAME`, `TRIGGER_STATE`, `NEXT_FIRE_TIME`) USING BTREE,
INDEX `IDX_QRTZ_T_NFT_MISFIRE`(`SCHED_NAME`, `MISFIRE_INSTR`, `NEXT_FIRE_TIME`) USING BTREE,
INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE`(`SCHED_NAME`, `MISFIRE_INSTR`, `NEXT_FIRE_TIME`, `TRIGGER_STATE`) USING BTREE,
INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP`(`SCHED_NAME`, `MISFIRE_INSTR`, `NEXT_FIRE_TIME`, `TRIGGER_GROUP`, `TRIGGER_STATE`) USING BTREE,
CONSTRAINT `QRTZ_TRIGGERS_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `blog`.`QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
ALTER TABLE `blog`.`admin` ADD COLUMN `update_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间' AFTER `create_date`;
ALTER TABLE `blog`.`admin` DROP COLUMN `update_time`;
ALTER TABLE `blog`.`article` ADD COLUMN `update_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间' AFTER `create_date`;
ALTER TABLE `blog`.`article` MODIFY COLUMN `submit_token` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '提交凭证' AFTER `labels`;
ALTER TABLE `blog`.`article` MODIFY COLUMN `salt` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '盐' AFTER `submit_token`;
ALTER TABLE `blog`.`article` MODIFY COLUMN `intro` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '副标题' AFTER `images`;
ALTER TABLE `blog`.`article` DROP COLUMN `view_count`;
ALTER TABLE `blog`.`article` DROP COLUMN `up_count`;
ALTER TABLE `blog`.`article` DROP COLUMN `down_count`;
ALTER TABLE `blog`.`article` DROP COLUMN `update_time`;
CREATE TABLE `blog`.`article_detail` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`article_id` bigint(20) NOT NULL COMMENT '文章ID',
`view_count` bigint(20) NOT NULL DEFAULT 0 COMMENT '浏览量',
`up_count` bigint(20) NOT NULL DEFAULT 0 COMMENT '点赞量',
`down_count` bigint(20) NOT NULL DEFAULT 0 COMMENT '踩数量',
`create_date` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_date` timestamp(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
ALTER TABLE `blog`.`article_label` ADD COLUMN `update_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间' AFTER `create_date`;
ALTER TABLE `blog`.`article_label` DROP COLUMN `update_time`;
ALTER TABLE `blog`.`article_user` ADD COLUMN `create_date` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间' AFTER `ip`;
ALTER TABLE `blog`.`article_user` ADD COLUMN `update_date` timestamp(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间' AFTER `create_date`;
ALTER TABLE `blog`.`channel` ADD COLUMN `update_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间' AFTER `available`;
ALTER TABLE `blog`.`channel` DROP COLUMN `update_time`;
ALTER TABLE `blog`.`label` ADD COLUMN `update_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间' AFTER `create_date`;
ALTER TABLE `blog`.`label` DROP COLUMN `update_time`;
ALTER TABLE `blog`.`permission` ADD COLUMN `permission_type_id` bigint(20) NULL DEFAULT NULL AFTER `available`;
CREATE TABLE `blog`.`permission_type` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分类名',
`create_date` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_date` timestamp(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`schedule_job` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务id',
`bean_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'spring bean名称',
`params` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '参数',
`cron_expression` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'cron表达式',
`status` tinyint(4) NULL DEFAULT NULL COMMENT '任务状态 0:正常 1:暂停',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_date` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '定时任务' ROW_FORMAT = Dynamic;
CREATE TABLE `blog`.`schedule_job_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务日志id',
`job_id` bigint(20) NOT NULL COMMENT '任务id',
`bean_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'spring bean名称',
`params` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '参数',
`status` tinyint(4) NOT NULL COMMENT '任务状态 0:成功 1:失败',
`error` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '失败信息',
`times` int(11) NOT NULL COMMENT '耗时(单位:毫秒)',
`create_date` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `job_id`(`job_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '定时任务日志' ROW_FORMAT = Dynamic;
ALTER TABLE `blog`.`system_setting` ADD COLUMN `update_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间' AFTER `create_date`;
ALTER TABLE `blog`.`system_setting` DROP COLUMN `update_time`;
SET FOREIGN_KEY_CHECKS=1; | true |
104b2d4b25ae681c21de42c98e03992121b17164 | SQL | erikamart/mysql_projects | /exercise03/exercise3.sql | UTF-8 | 6,906 | 4.5625 | 5 | [
"MIT"
] | permissive | /* Use the chinook database.
Unless otherwise noted use explicit syntax. */
-- Exercise 3
/* 1. Write a select statement that joins the album table to the artist table and returns these
columns for every Album in the database: AlbumId, Title, ArtistId, and the artist's Name */
SELECT Albumid, Title, album.ArtistId, artist.Name
FROM album
INNER JOIN artist ON album.artistid = artist.artistid;
/* 2. For each Invoice in the database list the InvoiceId, the InvoiceDate, the CustomerId, and Total.
Also include the customer's LastName, and Country. Add a clause so that the result is sorted by
country A-Z, and within each country by invoice total - largest to smallest. */
SELECT InvoiceId, InvoiceDate, invoice.CustomerId, Total, customer.LastName, customer.Country
FROM invoice
INNER JOIN customer ON invoice.customerid = customer.customerid
ORDER by country, invoice.Total DESC;
/* 3. Write a select statement that joins the invoice table to the invoice_line table and returns
these columns: InvoiceId, InvoiceDate, CustomerId, Quantity, and UnitPrice. The query should
only return orders for customers 16, 34, 37. */
SELECT invoice.InvoiceId, InvoiceDate, invoice.CustomerId, Quantity, UnitPrice
FROM invoice
INNER JOIN invoiceline ON invoice.InvoiceId = invoiceline.InvoiceId
WHERE invoice.CustomerId IN ('16','34','37');
/* 4. Return the same result as question 3, but this time use implicit syntax */
SELECT invoice.InvoiceId, InvoiceDate, invoice.CustomerId, Quantity, UnitPrice
FROM invoice, invoiceline
WHERE invoice.InvoiceId = invoiceline.InvoiceId
AND invoice.CustomerId IN ('16','34','37');
/* 5. Return the same result as question 3, but this time use the USING keyword */
SELECT invoice.InvoiceId, InvoiceDate, invoice.CustomerId, Quantity, UnitPrice
FROM invoice
JOIN invoiceline USING (InvoiceId)
WHERE invoice.CustomerId IN ('16','34','37');
/* 6. Return the same result as question 3, but this time use table aliases, you may use implicit syntax,
the USING keyword, or any syntax you choose that works, but use table aliases */
SELECT nv.InvoiceId, InvoiceDate, nv.CustomerId, Quantity, UnitPrice
FROM invoice AS nv
INNER JOIN invoiceline AS ln ON nv.InvoiceId = ln.InvoiceId
WHERE nv.CustomerId IN ('16','34','37');
/* 7. Write a select statement that joins the album and the track tables.
Display these columns: AlbumId, Title, TrackId, Name, Composer, and Miliseconds.
Only return rows where the composer contains the text 'Clapton' */
SELECT al.AlbumId, Title, TrackId, tr.Name, Composer, Milliseconds
FROM album AS al
INNER JOIN track AS tr ON al.AlbumId = tr.AlbumId
WHERE Composer like '%Clapton%';
/* 8. For each row in the invoiceline table return the following information:
InvoiceId, TrackId, InvoiceDate, CustomerId, customers' LastName, and Phone */
SELECT nl.InvoiceId, TrackId, InvoiceDate, nv.CustomerId, cu.LastName, cu.Phone
FROM invoiceline AS nl
JOIN invoice AS nv ON nl.InvoiceId = nv.InvoiceId
JOIN customer AS cu ON nv.CustomerId = cu.CustomerId;
/* 9. For every employee in the database write a query that shows the EmployeeId, the LastName, and
the HireDate. If the employee has customers assigned to them display the CustomerId and the
customer's email address. Sort the list so that employees without customers are listed at the top.
Note: the tables are joined on a customer column called SupportRepId */
SELECT em.EmployeeId, em.LastName, HireDate, cu.CustomerId, cu.Email
FROM employee AS em
LEFT JOIN customer AS cu ON em.EmployeeId = cu.SupportRepId
ORDER by cu.customerId;
/* 10. Write a query that displays the AlbumId, the album Title, the TrackId, the Composer of the track, the MediaTypeId,
and the media Name for any track whose composer contains 'Jimmy Page' and whose AlbumId is 44 */
SELECT al.AlbumId, Title, TrackId, Composer, mt.MediaTypeId, mt.Name
FROM album AS al
INNER JOIN track AS tr ON al.AlbumId = tr.AlbumId
INNER JOIN mediatype AS mt ON tr.MediaTypeId = mt.MediaTypeId
WHERE Composer LIKE '%Jimmy Page%'
AND tr.AlbumId = 44;
/* 11. Join the customer table to itself so that only customers located in the same city and country as
other customers are displayed. Display the CustomerId, the City, and Country for each customer. */
SELECT c1.CustomerId, c1.City, c1.Country
FROM customer AS c1
JOIN customer AS c2 ON c1.City = c2.City
AND c1.Country = c2.Country
AND c1.CustomerId <> c2.CustomerId
ORDER BY c1.City, c1.Country;
/* 12. Use the UNION operator to generate a result set consisting of four columns from the invoice table:
InvoiceId, InvoiceDate, Total, And a calculated column called Destination: if the Invoice has a Country
of USA display the words'Domestic' otherwise display the words 'International'*/
SELECT nv.InvoiceId, InvoiceDate, Total, 'Domestic' as Destination
FROM invoice AS nv
WHERE BillingCountry like '%USA%'
UNION
SELECT nv.InvoiceId, InvoiceDate, Total, 'Inernational' as Destination
FROM invoice AS nv
WHERE BillingCountry != '%USA%';
/* 13. Produce a query that displays the employee FirstName, LastName, Customer FirstName, LastName, InvoiceId,
InvoiceDate, Total, TrackId, track Name for every row in the invoiceline table. Use column aliases to
distinguish the customer first and last name and the employee first and last name. */
SELECT em.FirstName AS EmployeeFirstName,
em.LastName AS EmployeeLastName,
cu.FirstName AS CustomerFirstName,
cu.LastName AS CustomerLastName,
nv.InvoiceId,
InvoiceDate,
Total,
nl.TrackId,
tk.Name AS TrackName
FROM track AS tk
INNER JOIN invoiceline AS nl ON tk.TrackId = nl.TrackId
INNER JOIN invoice AS nv ON nl.InvoiceId = nv.InvoiceId
INNER JOIN customer AS cu ON nv.CustomerId = cu.CustomerId
INNER JOIN employee AS em ON cu.SupportRepId = em.EmployeeId;
/* 14. Write a query that displays the CustomerId, the InvoiceDate, and the Total for any invoice that includes
a track whose genre is 'Jazz' */
SELECT nv.CustomerId, nv.InvoiceDate, nv.Total
FROM genre AS ge
INNER JOIN track AS tk ON ge.GenreId = tk.GenreId
INNER JOIN invoiceline as nl ON tk.TrackId = nl.TrackId
INNER JOIN invoice AS nv ON nl.InvoiceId = nv.InvoiceId
WHERE ge.Name = 'Jazz';
/* 15. For every artist whose Name starts with 'A' or 'B' display the artist Name, any AlbumId and album Name
associated with the artists, any TrackId and track Names associated with the artists, and the associated
GenreId and genre Names associated with the track. Use column aliases to distinguish the four Name columns*/
SELECT ar.Name AS ArtistName,
al.AlbumId,
al.Title AS AlbumName,
tk.TrackId,
tk.Name AS TrackName,
ge.GenreId,
ge.Name AS GenreName
FROM artist AS ar
LEFT JOIN album AS al ON ar.ArtistId = al.ArtistId
LEFT JOIN track AS tk ON al.AlbumId = tk.AlbumId
LEFT JOIN genre AS ge ON tk.GenreId = ge.GenreId
WHERE ar.Name like 'A%'
OR ar.Name like 'B%'; | true |
0568922c3d0acc1dac50048aed03a12d9b870cbc | SQL | codeforkansascity/address-api | /data/KCMO-all-addresses/create-hud.sql | UTF-8 | 1,667 | 3.171875 | 3 | [
"MIT"
] | permissive | SET search_path = public, pg_catalog;
--
-- Name: hud_addresses_id_seq_02; Type: SEQUENCE; Schema: public; Owner: c4kc
--
DROP TABLE IF EXISTS hud_addresses ;
DROP SEQUENCE IF EXISTS hud_addresses_id_seq_02;
DROP TABLE IF EXISTS kcmo_all_addresses ;
DROP SEQUENCE IF EXISTS kcmo_all_addresses_id_seq;
DROP TABLE IF EXISTS tmp_kcmo_all_addresses ;
DROP SEQUENCE IF EXISTS tmp_kcmo_all_addresses_id_seq;
CREATE SEQUENCE tmp_kcmo_all_addresses_id_seq
START WITH 2001
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.tmp_kcmo_all_addresses_id_seq OWNER TO c4kc;
SET default_tablespace = '';
SET default_with_oids = false;
CREATE TABLE tmp_kcmo_all_addresses (
id integer DEFAULT nextval('tmp_kcmo_all_addresses_id_seq'::regclass) NOT NULL,
address_api_id integer,
kiva_pin integer,
city_apn character varying(30) DEFAULT NULL::character varying,
addr character varying(20) DEFAULT NULL::character varying,
fraction character varying(20) DEFAULT NULL::character varying,
prefix character varying(20) DEFAULT NULL::character varying,
street character varying(50) DEFAULT NULL::character varying,
street_type character varying(10) DEFAULT NULL::character varying,
suite character varying(20) DEFAULT NULL::character varying,
city character varying(20) DEFAULT 'KANSAS CITY',
state character varying(20) DEFAULT 'MO',
zip character varying(20) DEFAULT NULL::character varying,
added timestamp without time zone DEFAULT now(),
changed timestamp without time zone DEFAULT now()
);
ALTER TABLE public.tmp_kcmo_all_addresses OWNER TO c4kc;
| true |
82e2579e127fa23a94dd945d0f845c5f3a21e3cc | SQL | iceqiw/Wechat-project | /wechat-bg/conf/evolutions/default/2.sql | UTF-8 | 540 | 3.578125 | 4 | [
"CC0-1.0"
] | permissive | # --- !Ups
create table if not exists scm.user
(
id bigint auto_increment,
telephone varchar(64) not null,
nick_name varchar(255) null,
password varchar(255) not null,
modify_time timestamp default CURRENT_TIMESTAMP not null,
create_time timestamp default CURRENT_TIMESTAMP not null,
constraint user_pk
primary key (id)
);
create unique index user_telephone_uindex
on user (telephone);
# --- !Downs
drop table if exists scm.user;
| true |
20bee0f10a409979dbb2a39083c8466e017a77b5 | SQL | vctrmarques/interno-rh-sistema | /rhServer/src/main/resources/db/migration/sprint_1-10/V1_2019_03_15_15_03__ALTER_TABLE_REFERENCIA_SALARIAL.sql | UTF-8 | 455 | 2.65625 | 3 | [] | no_license | -- Davi Queiroz
-- atualização do menu referente a referencia salarial
BEGIN IF (SELECT COUNT(id) FROM referencia_salarial WHERE descricao IS NOT NULL) > 0
UPDATE referencia_salarial SET descricao = 'refatoracao tabela';
ALTER TABLE referencia_salarial
ALTER COLUMN descricao VARCHAR(255) NOT NULL;
END
BEGIN IF (SELECT COUNT(id) FROM referencia_salarial) <= 0
ALTER TABLE referencia_salarial
ALTER COLUMN descricao VARCHAR(255) NOT NULL
END | true |
b1dbf3d02fbe630c689146409dd1e9f36a32f9a6 | SQL | boomiflow-community/useful-db-queries | /postgresql/delete_duplicates.sql | UTF-8 | 147 | 2.96875 | 3 | [] | no_license | WITH uniquerow AS
(SELECT DISTINCT ON (col1, col2) * FROM db_test)
DELETE FROM db_test WHERE db_test.pk_id NOT IN (SELECT pk_id FROM uniquerow);
| true |
1474af845456b6a92fa3276821324eaab56cd604 | SQL | koheitakahashi/rakuraku_ERD_lesson | /ERD_lesson_2.sql | UTF-8 | 2,587 | 3.421875 | 3 | [] | no_license | CREATE TABLE Customer (
customer_id INTEGER NOT NULL,
customer_name VARCHAR(100),
name_furigana VARCHAR(100),
ticket_number INTEGER,
PRIMARY KEY (customer_id)
);
CREATE TABLE ContactMethod (
contact_method_id INTEGER NOT NULL,
contact_method_name VARCHAR(100),
PRIMARY KEY (contact_method_id)
);
CREATE TABLE ContactAddress (
contact_address_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
phone_number INTEGER,
PRIMARY KEY (contact_address_id),
FOREIGN KEY (customer_id) REFERENCES Customer (customer_id)
ON UPDATE RESTRICT
);
CREATE TABLE Publisher (
publisher_id INTEGER NOT NULL,
publisher_name VARCHAR(100),
PRIMARY KEY (publisher_id)
);
CREATE TABLE Book (
book_id INTEGER NOT NULL,
book_name VARCHAR(100),
publication_year INTEGER,
price INTEGER,
publisher_id INTEGER NOT NULL,
PRIMARY KEY (book_id),
FOREIGN KEY (publisher_id) REFERENCES Publisher (publisher_id)
ON UPDATE RESTRICT
);
CREATE TABLE Library (
library_id INTEGER NOT NULL,
library_name VARCHAR(100),
PRIMARY KEY (library_id)
);
CREATE TABLE Know (
know_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
book_id INTEGER NOT NULL,
new_arrivals_books_number INTEGER,
newspaper_name VARCHAR(100),
newapaper_data DATE,
oher VARCHAR(100),
PRIMARY KEY (know_id),
FOREIGN KEY (customer_id) REFERENCES Customer (customer_id)
ON UPDATE RESTRICT,
FOREIGN KEY (book_id) REFERENCES Book (book_id)
ON UPDATE RESTRICT
);
CREATE TABLE Reservation (
reservation_id INTEGER NOT NULL,
application_date DATE,
book_title_transmission INTEGER,
contact_unnecessary INTEGER,
book_id INTEGER NOT NULL,
contact_address_id INTEGER NOT NULL,
library_id INTEGER NOT NULL,
PRIMARY KEY (reservation_id),
FOREIGN KEY (book_id) REFERENCES Book (book_id)
ON UPDATE RESTRICT,
FOREIGN KEY (contact_address_id) REFERENCES ContactAddress (contact_address_id)
ON UPDATE RESTRICT,
FOREIGN KEY (library_id) REFERENCES Library (library_id)
ON UPDATE RESTRICT
);
| true |
3aaf749589641e7ec69fed61998f96681a802397 | SQL | carlosgarciaborrego/Gasolinera | /sql/5A-PAQUETES_CABECERAS.sql | UTF-8 | 9,817 | 3.28125 | 3 | [] | no_license | -- PAQUETES - CABECERAS--
--Clientes
CREATE OR REPLACE PACKAGE Pruebas_Clientes IS
PROCEDURE inicializar;
PROCEDURE insertar(nombre_prueba VARCHAR2, w_nombre IN clientes.nombre%TYPE, w_apellidos IN clientes.apellidos%TYPE, w_dni IN clientes.dni%TYPE, w_telefono IN clientes.telefono%TYPE,
w_correo IN clientes.correo%TYPE, w_fechaNacimiento IN clientes.fechaNacimiento%TYPE, w_contrasena IN clientes.contrasena%TYPE, w_token IN clientes.token%TYPE , salida_esperada BOOLEAN);
PROCEDURE actualizar(nombre_prueba VARCHAR2, w_Id_C IN clientes.Id_C%TYPE, w_nombre IN clientes.nombre%TYPE, w_apellidos IN clientes.apellidos%TYPE, w_dni IN clientes.dni%TYPE, w_telefono IN clientes.telefono%TYPE,
w_correo IN clientes.correo%TYPE, w_fechaNacimiento IN clientes.fechaNacimiento%TYPE, w_contrasena IN clientes.contrasena%TYPE, w_token IN clientes.token%TYPE ,salida_esperada BOOLEAN);
PROCEDURE eliminar(nombre_prueba VARCHAR2, w_Id_C IN clientes.Id_C%TYPE, salida_esperada BOOLEAN);
END Pruebas_Clientes;
/
--Trabajadores
CREATE OR REPLACE PACKAGE pruebas_trabajadores AS
PROCEDURE inicializar;
PROCEDURE insertar
(nombre_prueba VARCHAR2,
w_nombre IN trabajadores.nombre%TYPE,
w_apellidos IN trabajadores.apellidos%TYPE,
w_dni IN trabajadores.dni%TYPE,
w_telefono IN trabajadores.telefono%TYPE,
w_salario IN trabajadores.salario%TYPE,
w_tipoEmpleado IN trabajadores.tipoEmpleado%TYPE,
w_contrasena IN trabajadores.contrasena%TYPE,
salidaEsperada BOOLEAN);
PROCEDURE actualizar
(nombre_prueba VARCHAR2,
w_id_T IN trabajadores.id_T%TYPE,
w_nombre IN trabajadores.nombre%TYPE,
w_apellidos IN trabajadores.apellidos%TYPE,
w_dni IN trabajadores.dni%TYPE,
w_telefono IN trabajadores.telefono%TYPE,
w_salario IN trabajadores.salario%TYPE,
w_tipoEmpleado IN trabajadores.tipoEmpleado%TYPE,
w_contrasena IN trabajadores.contrasena%TYPE,
salidaEsperada BOOLEAN);
PROCEDURE eliminar
(nombre_prueba VARCHAR2,
w_id_T IN trabajadores.id_T%TYPE,
salidaEsperada BOOLEAN);
END pruebas_trabajadores;
/
--Embarcaderos
CREATE OR REPLACE PACKAGE pruebas_embarcaderos AS
PROCEDURE inicializar;
PROCEDURE insertar
(nombre_prueba VARCHAR2,
w_disponible IN embarcaderos.disponible%TYPE,
salidaEsperada BOOLEAN);
PROCEDURE actualizar
(nombre_prueba VARCHAR2,
w_id_E IN embarcaderos.id_E%TYPE,
w_disponible IN embarcaderos.disponible%TYPE,
salidaEsperada BOOLEAN);
PROCEDURE eliminar
(nombre_prueba VARCHAR2,
w_id_E IN embarcaderos.id_E%TYPE,
salidaEsperada BOOLEAN);
END pruebas_embarcaderos;
/
--ItemCompras
/*create or replace PACKAGE pruebas_itemcompras AS
PROCEDURE eliminar(nombre_prueba VARCHAR2,W_ID_I IN ITEMCOMPRAS.ID_I%TYPE, salidaEsperada BOOLEAN);
PROCEDURE inicializar;
PROCEDURE actualizar
(nombre_prueba VARCHAR2,w_Id_I IN ITEMCOMPRAS.ID_I%TYPE,
w_stock IN ITEMCOMPRAS.STOCK%TYPE,
w_precio IN ITEMCOMPRAS.PRECIO%TYPE,salidaEsperada BOOLEAN);
PROCEDURE insertar
(nombre_prueba VARCHAR2,
w_stock IN ITEMCOMPRAS.STOCK%TYPE,
w_precio IN ITEMCOMPRAS.PRECIO%TYPE,salidaEsperada BOOLEAN);
END pruebas_itemcompras;
*/
CREATE OR REPLACE PACKAGE PRUEBAS_ITEMCOMPRAS IS
PROCEDURE inicializar;
PROCEDURE insertar(nombre_prueba VARCHAR2, w_stock IN ITEMCOMPRAS.STOCK%TYPE, w_precio IN ITEMCOMPRAS.PRECIO%TYPE, w_TipoCategoria IN ITEMCOMPRAS.TIPOCATEGORIA%TYPE ,salida_Esperada BOOLEAN);
PROCEDURE actualizar(nombre_prueba VARCHAR2, w_ID_I IN ITEMCOMPRAS.ID_I%TYPE, w_stock IN ITEMCOMPRAS.STOCK%TYPE, w_precio IN ITEMCOMPRAS.PRECIO%TYPE, w_TipoCategoria IN ITEMCOMPRAS.TIPOCATEGORIA%TYPE ,salida_Esperada BOOLEAN);
PROCEDURE eliminar(nombre_prueba VARCHAR2, w_ID_I IN ITEMCOMPRAS.ID_I%TYPE, salida_Esperada BOOLEAN);
END PRUEBAS_ITEMCOMPRAS;
/
--Combustibles
/*create or replace PACKAGE pruebas_combustibles AS
PROCEDURE eliminar (nombre_prueba VARCHAR2,w_ID_COMB IN COMBUSTIBLES.ID_COMB%TYPE,salidaEsperada BOOLEAN);
PROCEDURE inicializar;
PROCEDURE actualizar(nombre_prueba VARCHAR2,w_ID_COMB IN COMBUSTIBLES.ID_COMB%TYPE,
w_TipoCombustible IN COMBUSTIBLES.TIPOCOMBUSTIBLE%TYPE,
w_ID_I IN COMBUSTIBLES.ID_I%TYPE,salidaEsperada BOOLEAN);
PROCEDURE insertar(nombre_prueba VARCHAR2,
w_TipoCombustible IN COMBUSTIBLES.TIPOCOMBUSTIBLE%TYPE,
w_ID_I IN COMBUSTIBLES.ID_I%TYPE,salidaEsperada BOOLEAN);
END pruebas_combustibles;
/*/
CREATE OR REPLACE PACKAGE PRUEBAS_COMBUSTIBLES IS
PROCEDURE inicializar;
PROCEDURE insertar(nombre_prueba VARCHAR2, w_TipoCombustible IN COMBUSTIBLES.TIPOCOMBUSTIBLE%TYPE, w_ID_I IN COMBUSTIBLES.ID_I%TYPE, salida_Esperada BOOLEAN);
PROCEDURE actualizar(nombre_prueba VARCHAR2, w_ID_COMB IN COMBUSTIBLES.ID_COMB%TYPE,w_TipoCombustible IN COMBUSTIBLES.TIPOCOMBUSTIBLE%TYPE, w_ID_I IN COMBUSTIBLES.ID_I%TYPE, salida_Esperada BOOLEAN);
PROCEDURE eliminar(nombre_prueba VARCHAR2, w_ID_COMB IN COMBUSTIBLES.ID_COMB%TYPE, salida_Esperada BOOLEAN);
END PRUEBAS_COMBUSTIBLES;
/
--Almacenes
CREATE OR REPLACE
PACKAGE pruebas_almacenes AS
PROCEDURE inicializar;
PROCEDURE insertar
(nombre_prueba VARCHAR2,
w_direccion in almacenes.direccion%TYPE,
w_ciudad in almacenes.ciudad%TYPE,
w_provincia in almacenes.provincia%TYPE,
salidaEsperada BOOLEAN);
PROCEDURE actualizar
(nombre_prueba VARCHAR2,
w_id_a in almacenes.id_a%TYPE,
w_direccion in almacenes.direccion%TYPE,
w_ciudad in almacenes.ciudad%TYPE,
w_provincia in almacenes.provincia%TYPE,
salidaEsperada BOOLEAN);
PROCEDURE eliminar
(nombre_prueba VARCHAR2,
w_id_a in almacenes.id_a%TYPE,
salidaEsperada BOOLEAN);
END;
/
--Proveedores
CREATE OR REPLACE
PACKAGE pruebas_proveedores AS
PROCEDURE inicializar;
PROCEDURE insertar
(nombre_prueba VARCHAR2,
w_nombre in proveedores.nombre%TYPE,
w_apellidos in proveedores.apellidos%TYPE,
w_dni in proveedores.dni%TYPE,
w_telefono in proveedores.telefono%TYPE,
w_correo in proveedores.correo%TYPE,
salidaEsperada BOOLEAN);
PROCEDURE actualizar
(nombre_prueba VARCHAR2,
w_id_pro in proveedores.id_pro%TYPE,
w_nombre in proveedores.nombre%TYPE,
w_apellidos in proveedores.apellidos%TYPE,
w_dni in proveedores.dni%TYPE,
w_telefono in proveedores.telefono%TYPE,
w_correo in proveedores.correo%TYPE,
salidaEsperada BOOLEAN);
PROCEDURE eliminar
(nombre_prueba VARCHAR2,
w_id_pro in proveedores.id_pro%TYPE,
salidaEsperada BOOLEAN);
END;
/
--Productos
/*create or replace PACKAGE pruebas_productos AS
PROCEDURE eliminar (nombre_prueba VARCHAR2,w_ID_P IN PRODUCTOS.ID_P%TYPE, salidaEsperada BOOLEAN);
PROCEDURE inicializar;
PROCEDURE actualizar(nombre_prueba VARCHAR2,w_ID_P IN PRODUCTOS.ID_P%TYPE,
w_nombre IN PRODUCTOS.NOMBRE%TYPE,
w_codigo IN PRODUCTOS.CODIGO%TYPE,
w_direccionImagen IN PRODUCTOS.DIRECCIONIMAGEN%TYPE,
w_ID_I IN PRODUCTOS.ID_I%TYPE,
w_ID_A IN PRODUCTOS.ID_A%TYPE,
w_ID_PRO IN PRODUCTOS.ID_PRO%TYPE,salidaEsperada BOOLEAN);
PROCEDURE insertar(nombre_prueba VARCHAR2,
w_nombre IN PRODUCTOS.NOMBRE%TYPE,
w_codigo IN PRODUCTOS.CODIGO%TYPE,
w_direccionImagen IN PRODUCTOS.DIRECCIONIMAGEN%TYPE,
w_ID_I IN PRODUCTOS.ID_I%TYPE,
w_ID_A IN PRODUCTOS.ID_A%TYPE,
w_ID_PRO IN PRODUCTOS.ID_PRO%TYPE,salidaEsperada BOOLEAN);
END pruebas_productos;
*/
CREATE OR REPLACE PACKAGE PRUEBAS_PRODUCTOS IS
PROCEDURE inicializar;
PROCEDURE insertar(nombre_prueba VARCHAR2,w_nombre IN PRODUCTOS.NOMBRE%TYPE, w_codigo IN PRODUCTOS.CODIGO%TYPE, w_direccionImagen IN PRODUCTOS.DIRECCIONIMAGEN%TYPE, w_ID_I IN PRODUCTOS.ID_I%TYPE, w_ID_A IN PRODUCTOS.ID_A%TYPE, w_ID_PRO IN PRODUCTOS.ID_PRO%TYPE, salida_Esperada BOOLEAN);
PROCEDURE actualizar(nombre_prueba VARCHAR2,w_ID_P IN PRODUCTOS.ID_P%TYPE,w_nombre IN PRODUCTOS.NOMBRE%TYPE, w_codigo IN PRODUCTOS.CODIGO%TYPE, w_direccionImagen IN PRODUCTOS.DIRECCIONIMAGEN%TYPE, w_ID_I IN PRODUCTOS.ID_I%TYPE, w_ID_A IN PRODUCTOS.ID_A%TYPE, w_ID_PRO IN PRODUCTOS.ID_PRO%TYPE, salida_Esperada BOOLEAN);
PROCEDURE eliminar(nombre_prueba VARCHAR2, w_ID_P IN PRODUCTOS.ID_P%TYPE, salida_Esperada BOOLEAN);
END PRUEBAS_PRODUCTOS;
/
--Compras
CREATE OR REPLACE PACKAGE Pruebas_Compras IS
PROCEDURE inicializar;
PROCEDURE insertar(nombre_prueba VARCHAR2, w_fechaPedido IN COMPRAS.FECHAPEDIDO%TYPE, w_fechaRecogida IN compras.fechaRecogida%TYPE, w_Pagado IN compras.pagado%TYPE, w_preparado IN compras.Preparado%TYPE,
w_Id_C IN compras.Id_C%TYPE, w_Id_T IN compras.Id_T%TYPE, salida_esperada BOOLEAN);
PROCEDURE actualizar(nombre_prueba VARCHAR2, w_Id_COM IN Compras.Id_COM%TYPE, w_fechaPedido IN COMPRAS.FECHAPEDIDO%TYPE, w_fechaRecogida IN compras.fechaRecogida%TYPE,
w_Pagado IN compras.pagado%TYPE, w_preparado IN compras.Preparado%TYPE ,w_Id_C IN compras.Id_C%TYPE, w_Id_T IN compras.Id_T%TYPE, salida_esperada BOOLEAN);
PROCEDURE eliminar(nombre_prueba VARCHAR2, w_Id_COM IN Compras.Id_COM%TYPE, salida_esperada BOOLEAN);
END Pruebas_Compras;
/
--LineaCompras
CREATE OR REPLACE PACKAGE Pruebas_LineaCompras IS
PROCEDURE inicializar;
PROCEDURE insertar(nombre_prueba VARCHAR2, w_cantidad IN lineaCompras.cantidad%TYPE, w_Id_I IN lineaCompras.Id_I%TYPE,w_Id_COM IN lineaCompras.Id_COM%TYPE, salida_esperada BOOLEAN);
PROCEDURE actualizar(nombre_prueba VARCHAR2, w_Id_L IN lineaCompras.Id_L%TYPE, w_cantidad IN lineaCompras.cantidad%TYPE, w_Id_I IN lineaCompras.Id_I%TYPE,w_Id_COM IN lineaCompras.Id_COM%TYPE, salida_esperada BOOLEAN);
PROCEDURE eliminar(nombre_prueba VARCHAR2, w_Id_L IN lineaCompras.Id_L%TYPE, salida_esperada BOOLEAN);
END Pruebas_LineaCompras;
| true |
ce201868700723f1f393f3aad6848701e3d7dfca | SQL | PraderioM/GamePlatform | /backend/games/dixit/sql_scripts/dixit_leader_board.sql | UTF-8 | 411 | 3.40625 | 3 | [] | no_license | create table dixit_leader_board
(
player_name text
constraint dixit_leader_board_users_name_fk
references users,
wins integer,
last_played uuid,
played integer,
points integer
);
alter table dixit_leader_board owner to admin;
create index dixit_leader_board_player_name_index
on dixit_leader_board (player_name);
create index dixit_leader_board_points_index
on dixit_leader_board (points desc);
| true |
25c16f19a8f7fe51f3cfe08c795c6f79f2b6fba7 | SQL | BolderBrighterExperience/playground | /intern08/TEMA5_BUIAC_ANDREI_INTERN08_01/PACKAGES/pkg_08_pkg_hr_employees_specifications.sql | UTF-8 | 1,663 | 2.75 | 3 | [] | no_license | --package specifications
CREATE OR REPLACE PACKAGE pkg_hr_employees
IS
PROCEDURE prc_add_employee(p_employee_id IN NUMBER,
p_first_name IN VARCHAR2,
p_last_name IN VARCHAR2,
p_email IN VARCHAR2,
p_phone_number IN VARCHAR2,
p_hire_date IN DATE,
p_job_id IN VARCHAR2,
p_salary IN NUMBER,
p_commission_pct IN NUMBER,
p_manager_id IN NUMBER,
p_department_id IN NUMBER );
PROCEDURE prc_adjust_employee (p_employee_id IN NUMBER,
p_first_name IN VARCHAR2,
p_last_name IN VARCHAR2,
p_email IN VARCHAR2,
p_phone_number IN VARCHAR2,
p_hire_date IN DATE,
p_job_id IN VARCHAR2,
p_salary IN NUMBER,
p_commission_pct IN NUMBER,
p_manager_id IN NUMBER,
p_department_id IN NUMBER );
PROCEDURE prc_remove_employee (p_employee_id IN NUMBER);
FUNCTION fnc_employee_exists (p_employee_id IN NUMBER)
RETURN BOOLEAN;
FUNCTION fnc_employee_exists_sql(p_employee_id IN NUMBER)
RETURN NUMBER;
END pkg_hr_employees;
/ | true |
c7ca984eca698d9d40a4603b5b1545a7a1860da1 | SQL | Physalium/MySQL | /ZadKontrolne/zd6.sql | UTF-8 | 1,171 | 4.28125 | 4 | [] | no_license | -- 1
select m.Name "Stolica ", m.Population "Populacja w stolicy", p.Name "Panstwo", p.Population "Populacja panstwa"
from city m,
country p
where m.ID = p.Capital
and p.Continent = 'Europe';
-- 2
select city.Name
from city,
country
where CountryCode = Code
and Continent = 'Europe'
order by city.Population desc
limit 1;
-- 3
select Continent, MAX(city.Population)
from country,
city
where CountryCode = Code
group by 1;
-- 4
select Continent, count(*) "Ilosc miast"
from country,
city c
where c.CountryCode = Code
group by Continent;
-- 5
select city.Name "Miasto", country.Name "Panstwo"
from city,
country
where city.Name = country.Name
and city.CountryCode = Code;
-- 6
select Name, language
from country,
countrylanguage
where CountryCode = Code
and (Language = Name or Language = null);
-- 7
select m.Name, j.Language
from country k,
city m,
countrylanguage j
where m.CountryCode = k.Code
and j.Language = "Polish"
and k.Code = j.CountryCode;
-- 8
select j.Language, count(j.Language) ile
from country k,
countrylanguage j
where j.CountryCode = k.Code
group by 1
having ile > 5
order by 2 desc;
| true |
57193c9e45bf684554a1772c0a515b0f36a18a46 | SQL | DrSkyFox/SendAndCall | /sql/cinema_public_customer_1.sql | UTF-8 | 2,179 | 3.171875 | 3 | [] | no_license | create table customer
(
id serial not null
constraint customer_pk
primary key,
session_id integer not null
constraint customer_session_id_fk
references session
on delete set null
);
alter table customer
owner to postgres;
create unique index customer_id_uindex
on customer (id);
INSERT INTO public.customer (id, session_id) VALUES (1, 1);
INSERT INTO public.customer (id, session_id) VALUES (2, 3);
INSERT INTO public.customer (id, session_id) VALUES (3, 5);
INSERT INTO public.customer (id, session_id) VALUES (4, 5);
INSERT INTO public.customer (id, session_id) VALUES (5, 2);
INSERT INTO public.customer (id, session_id) VALUES (6, 2);
INSERT INTO public.customer (id, session_id) VALUES (7, 1);
INSERT INTO public.customer (id, session_id) VALUES (8, 1);
INSERT INTO public.customer (id, session_id) VALUES (9, 4);
INSERT INTO public.customer (id, session_id) VALUES (10, 4);
INSERT INTO public.customer (id, session_id) VALUES (11, 5);
INSERT INTO public.customer (id, session_id) VALUES (12, 2);
INSERT INTO public.customer (id, session_id) VALUES (13, 1);
INSERT INTO public.customer (id, session_id) VALUES (14, 3);
INSERT INTO public.customer (id, session_id) VALUES (15, 3);
INSERT INTO public.customer (id, session_id) VALUES (16, 3);
INSERT INTO public.customer (id, session_id) VALUES (17, 4);
INSERT INTO public.customer (id, session_id) VALUES (18, 3);
INSERT INTO public.customer (id, session_id) VALUES (19, 1);
INSERT INTO public.customer (id, session_id) VALUES (20, 1);
INSERT INTO public.customer (id, session_id) VALUES (21, 3);
INSERT INTO public.customer (id, session_id) VALUES (22, 2);
INSERT INTO public.customer (id, session_id) VALUES (23, 2);
INSERT INTO public.customer (id, session_id) VALUES (24, 2);
INSERT INTO public.customer (id, session_id) VALUES (25, 1);
INSERT INTO public.customer (id, session_id) VALUES (26, 5);
INSERT INTO public.customer (id, session_id) VALUES (27, 5);
INSERT INTO public.customer (id, session_id) VALUES (28, 4);
INSERT INTO public.customer (id, session_id) VALUES (29, 3);
INSERT INTO public.customer (id, session_id) VALUES (30, 2); | true |
036c75142f052dddea55fd1ab2bed7c35ffc88b8 | SQL | daiyuda/db_designer_daiyuda | /designs/1.sql | UTF-8 | 640 | 2.828125 | 3 | [] | no_license | -- QUERY 1
DROP TABLE IF EXISTS mv_1;
CREATE TABLE mv_1
SELECT
l_returnflag,
l_linestatus,
l_shipdate,
SUM(l_quantity) AS sum_qty,
SUM(l_extendedprice) AS sum_base_price,
SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price,
SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,
SUM(l_discount) AS sum_discount,
COUNT(*) AS count_order
FROM
lineitem
GROUP BY
l_returnflag,
l_linestatus,
l_shipdate;
| true |
33a4a95ae978f832e4b7b4823660adcd81c2d6f6 | SQL | Gumichan01/android-resto-m1 | /script/test.sql | UTF-8 | 2,819 | 3.015625 | 3 | [] | no_license |
-- Tests
.print "\n======== Tests ========\n"
insert into Note(valeur) values(3);
insert into Note(valeur) values(1);
insert into Note(valeur) values(4);
select * from Note;
.print "Test Note negatif"
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values(null,9,19);
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values("Lundi",null,22);
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values("Lundi",8,null);
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values("Lundi",null,null);
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values(null,null,0);
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values(null,8,null);
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values(null,null,null);
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values("STOP",8,null);
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values("Lundi",64,null);
insert or ignore into Periode(jour,heure_ouverture,heure_fermeture) values("Lundi",null,64);
.print "Test Note positif"
insert into Periode(jour,heure_ouverture,heure_fermeture) values("Vendredi",10,23);
insert into Periode(jour,heure_ouverture,heure_fermeture) values("Samedi",15,2);
.print ""
.print "SELECT Periode"
select * from Periode;
.print ""
.print "Test GPS negatif"
insert or ignore into gps(latitude,longitude) values(null,0.256);
insert or ignore into gps(latitude,longitude) values(0.256,null);
insert or ignore into gps(latitude,longitude) values(null,null);
.print "Test GPS positif"
insert into gps(latitude,longitude) values(48.949685,72.256147);
insert into gps(latitude,longitude) values(48.902229, 2.302833);
insert into gps(latitude,longitude) values(48.829372,2.381068);
.print ""
.print "SELECT gps"
select * from gps;
insert into Restaurant(nom,adresse,ville,tel,web,photo,cout,type_cuisine,idgps)
values("Lunch time","Rue de Neuilly","Clichy","01xxxxxxxx","www.toto.dump","photo",6,"Fast food",2);
insert into Restaurant(nom,adresse,ville,tel,web,photo,cout,type_cuisine,idgps)
values("Pomme de Pain","9-13, Rue Marie André Lagroua Weill Halle","Paris","01xxxxxxxx",
"www.pommedepain.fr","photo",9,"Classique",3);
.print ""
.print "SELECT Restaurant"
select * from Restaurant;
insert into Avoir(idresto,idnote) values(2,3);
insert into Avoir(idresto,idnote) values(1,3);
insert into Avoir(idresto,idnote) values(1,2);
insert into Avoir(idresto,idnote) values(2,1);
.print ""
.print "SELECT Avoir"
select * from Avoir;
insert into Ouvrir(idresto,idperiode) values(2,2);
insert into Ouvrir(idresto,idperiode) values(1,1);
insert into Ouvrir(idresto,idperiode) values(1,2);
insert into Ouvrir(idresto,idperiode) values(2,1);
.print ""
.print "SELECT Ouvrir"
select * from Ouvrir; | true |
ac4ee01c386dc4a3681bb46eb6f52c5c94eaaafe | SQL | PedroJuliari/ERP | /public_html/erp-novo/banco/entrada_avulsa.sql | UTF-8 | 1,679 | 3.109375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 26-Abr-2019 às 23:20
-- Versão do servidor: 10.1.30-MariaDB
-- PHP Version: 7.2.2
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: `projeto_erp_borrao`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `entrada_avulsa`
--
CREATE TABLE `entrada_avulsa` (
`id_item` int(11) NOT NULL,
`id_produto` int(11) NOT NULL,
`qtde` int(11) NOT NULL,
`valor` decimal(10,2) NOT NULL,
`data_entrada` date DEFAULT NULL,
`hora_entrada` time DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Acionadores `entrada_avulsa`
--
DELIMITER $$
CREATE TRIGGER `TRG_ENTRADA_PRODUTO` AFTER INSERT ON `entrada_avulsa` FOR EACH ROW CALL SP_ATUALIZA_ESTOQUE(new.id_produto, new.qtde, 'E')
$$
DELIMITER ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `entrada_avulsa`
--
ALTER TABLE `entrada_avulsa`
ADD PRIMARY KEY (`id_item`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `entrada_avulsa`
--
ALTER TABLE `entrada_avulsa`
MODIFY `id_item` int(11) NOT NULL AUTO_INCREMENT;
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 |
d08e3b60d8a2895ef4033b15e57153631b656f0c | SQL | prolaymukherjee/TeacherStudentCommunicationSystem_Laravel | /enrollment.sql | UTF-8 | 14,018 | 2.953125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 04, 2018 at 05:10 PM
-- Server version: 10.1.26-MariaDB
-- PHP Version: 7.0.22
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: `enrollment`
--
-- --------------------------------------------------------
--
-- Table structure for table `counselling`
--
CREATE TABLE `counselling` (
`id` int(10) UNSIGNED NOT NULL,
`student_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_roll` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`semester` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`reason` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`action` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`date` date NOT NULL,
`subject` text COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `counselling`
--
INSERT INTO `counselling` (`id`, `student_name`, `student_roll`, `semester`, `reason`, `action`, `date`, `subject`) VALUES
(3, 'Prolay Mukherjee', '151-15-5182', 'Level 1 Term 2', 'Develop Your Behavior', 'How Can You Delevop Your Behavior', '2018-11-03', 'Dear Guardian I want to meet with you.'),
(4, 'Prolay Mukherjee', '151-15-5182', 'Level 1 Term 2', 'Develop Your Behavior', 'How Can You Delevop Your CGPA', '2018-11-01', 'Dear Guardian I want to meet with you.');
-- --------------------------------------------------------
--
-- Table structure for table `enrolled`
--
CREATE TABLE `enrolled` (
`id` int(10) UNSIGNED NOT NULL,
`student_id` int(10) UNSIGNED NOT NULL,
`teacher_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `enrolled`
--
INSERT INTO `enrolled` (`id`, `student_id`, `teacher_id`, `created_at`, `updated_at`) VALUES
(4, 10, 2, NULL, NULL),
(5, 11, 2, NULL, NULL),
(6, 10, 4, NULL, NULL),
(7, 14, 4, NULL, NULL),
(8, 13, 4, NULL, NULL),
(9, 15, 4, NULL, NULL),
(10, 16, 4, NULL, NULL),
(11, 17, 4, NULL, NULL),
(12, 11, 4, NULL, NULL),
(13, 12, 4, NULL, NULL),
(14, 18, 4, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `jobs`
--
CREATE TABLE `jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`queue` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`attempts` tinyint(3) UNSIGNED NOT NULL,
`reserved_at` int(10) UNSIGNED DEFAULT NULL,
`available_at` int(10) UNSIGNED NOT NULL,
`created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `message`
--
CREATE TABLE `message` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`message` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`teacher_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `message`
--
INSERT INTO `message` (`id`, `name`, `email`, `message`, `created_at`, `updated_at`, `teacher_name`) VALUES
(8, 'Md. Safayet Hossain', 'safayet2218@gmail.com', 'Hello, Red', NULL, NULL, 'masud rabbani'),
(9, 'Prolay Mukherjee', 'prolaycsediu@gmail.com', 'hi prolay', NULL, NULL, 'masud rabbani');
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2018_05_13_200109_create_admin_tbl_table', 1),
(2, '2018_05_15_192349_create_student_tbl_table', 2),
(3, '2018_05_17_200519_create_teacher_tbl_table', 3),
(4, '2018_09_20_064501_create_notification_tbl_table', 4),
(5, '2018_09_27_052301_add_counselling_table', 5),
(6, '2018_09_27_065657_create_jobs_table', 6),
(7, '2018_09_27_065759_create_failed_jobs_table', 6),
(8, '2018_09_27_075455_create_message_table', 7),
(9, '2018_09_27_082314_create_student_to_teacher_message_table', 8),
(10, '2018_10_02_184141_create_result_table', 9),
(11, '2018_10_02_184947_create_result_table', 10),
(12, '2018_10_09_051602_add_teacher_initial_to_teacher_tbl', 11),
(13, '2018_10_09_053139_enrolled', 12),
(14, '2018_10_09_072030_add_teacher_name_to_message', 13),
(15, '2018_10_09_072803_add_student_name_to_student_to_teacher_message', 14);
-- --------------------------------------------------------
--
-- Table structure for table `notification_tbl`
--
CREATE TABLE `notification_tbl` (
`notification_id` int(10) UNSIGNED NOT NULL,
`notification_content` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `notification_tbl`
--
INSERT INTO `notification_tbl` (`notification_id`, `notification_content`) VALUES
(4, 'hi all student'),
(5, 'hi all student'),
(6, 'hi'),
(7, 'hi');
-- --------------------------------------------------------
--
-- Table structure for table `result`
--
CREATE TABLE `result` (
`id` int(10) UNSIGNED NOT NULL,
`student_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_roll` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_semester` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_result` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `result`
--
INSERT INTO `result` (`id`, `student_name`, `student_roll`, `student_semester`, `student_result`) VALUES
(6, 'Prolay', '151-15-5182', 'Lavel-1 Term-1', '3.50'),
(7, 'Prolay', '151-15-5182', 'Lavel-1 Term-3', '3.50'),
(8, 'Prolay', '151-15-5182', 'Lavel-1 Term-1', '3.33');
-- --------------------------------------------------------
--
-- Table structure for table `student_tbl`
--
CREATE TABLE `student_tbl` (
`student_id` int(10) UNSIGNED NOT NULL,
`student_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_roll` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_fathername` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_mothername` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_year` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_department` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `student_tbl`
--
INSERT INTO `student_tbl` (`student_id`, `student_name`, `student_roll`, `student_fathername`, `student_mothername`, `student_email`, `student_password`, `student_address`, `student_year`, `student_department`, `student_image`, `created_at`, `updated_at`) VALUES
(12, 'Sadia Sultana', '151-15-4689', 'Md. Abdus Samad Sheakh', 'Selina Begum', 'eqnx.tania@gmail.com', '22222', 'Magura', '2014', 'CSE', 'image/nuzdUFPTUF5MOQPftkSK.png', NULL, NULL),
(18, 'Prolay Mukherjee', '151-15-5182', 'Susthanto Mukherjee', 'Laxmi Mukherjee', 'prolaycsediu@gmail.com', '12345', 'Narail', '2014', 'CSE', 'image/OSaefBwX3lf6uBnJS4kC.png', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `student_to_teacher_message`
--
CREATE TABLE `student_to_teacher_message` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`message` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`student_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `student_to_teacher_message`
--
INSERT INTO `student_to_teacher_message` (`id`, `name`, `email`, `message`, `created_at`, `updated_at`, `student_name`) VALUES
(5, 'masud rabbani', 'rabbani@gmail.com', 'sir', NULL, NULL, 'Prolay Mukherjee');
-- --------------------------------------------------------
--
-- Table structure for table `teacher_tbl`
--
CREATE TABLE `teacher_tbl` (
`teacher_id` int(10) UNSIGNED NOT NULL,
`teacher_Name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`teacher_department` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`teacher_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`teacher_email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`teacher_phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`password` varchar(12) COLLATE utf8mb4_unicode_ci NOT NULL,
`teacher_initial` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `teacher_tbl`
--
INSERT INTO `teacher_tbl` (`teacher_id`, `teacher_Name`, `teacher_department`, `teacher_image`, `teacher_email`, `teacher_phone`, `created_at`, `updated_at`, `password`, `teacher_initial`) VALUES
(3, 'Sadman', 'BBA', 'image/byYMDtdoii7HRUgorbz4.png', 'sadman@gmail.com', '3224', NULL, NULL, '12124', 'DMCX'),
(4, 'masud rabbani', 'CSE', 'image/8plJ40grH02AZL4aPkod.jpg', 'rabbani@gmail.com', '0170000000', NULL, NULL, '12345', 'MR'),
(7, 'Alamin', 'CSE', 'image/VAV2KugOpUfGzKN6yJpo.png', 'alamin@gmail.com', '01700000', NULL, NULL, '12345', 'Al');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `counselling`
--
ALTER TABLE `counselling`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `enrolled`
--
ALTER TABLE `enrolled`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `jobs`
--
ALTER TABLE `jobs`
ADD PRIMARY KEY (`id`),
ADD KEY `jobs_queue_index` (`queue`);
--
-- Indexes for table `message`
--
ALTER TABLE `message`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `notification_tbl`
--
ALTER TABLE `notification_tbl`
ADD PRIMARY KEY (`notification_id`);
--
-- Indexes for table `result`
--
ALTER TABLE `result`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `student_tbl`
--
ALTER TABLE `student_tbl`
ADD PRIMARY KEY (`student_id`);
--
-- Indexes for table `student_to_teacher_message`
--
ALTER TABLE `student_to_teacher_message`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `teacher_tbl`
--
ALTER TABLE `teacher_tbl`
ADD PRIMARY KEY (`teacher_id`),
ADD UNIQUE KEY `teacher_tbl_teacher_initial_unique` (`teacher_initial`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `counselling`
--
ALTER TABLE `counselling`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `enrolled`
--
ALTER TABLE `enrolled`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `jobs`
--
ALTER TABLE `jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `message`
--
ALTER TABLE `message`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `notification_tbl`
--
ALTER TABLE `notification_tbl`
MODIFY `notification_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `result`
--
ALTER TABLE `result`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `student_tbl`
--
ALTER TABLE `student_tbl`
MODIFY `student_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `student_to_teacher_message`
--
ALTER TABLE `student_to_teacher_message`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `teacher_tbl`
--
ALTER TABLE `teacher_tbl`
MODIFY `teacher_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;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 |
a8934bbbcfca88fdbe0a0b8cde6b8282eae9c891 | SQL | spsanderson/bmhmc-sql | /SQL/VISITS_2_MIDNIGHTS.sql | UTF-8 | 665 | 2.9375 | 3 | [] | no_license | SELECT PtNo_Num
, Med_Rec_No AS MRN
, vst_start_dtime AS [ADMIT DTIME]
, DATEPART(hour, vst_start_dtime) AS [ADMIT HOUR]
, 24-DATEPART(HOUR, VST_START_DTIME) AS [HRS 2 MIDNIGHT]
, 24+(24-DATEPART(HOUR, VST_START_DTIME)) AS [HRS 2 SECOND MIDNIGHT]
, Dsch_DTime AS [DISC DTIME]
, DATEDIFF(HOUR,vst_start_dtime,Dsch_DTime) AS [HOURS HERE]
FROM smsdss.BMH_PLM_PtAcct_V
WHERE Dsch_Date >= '2014-01-01'
AND Dsch_Date < '2015-01-01'
AND Plm_Pt_Acct_Type = 'I'
AND DATEDIFF(HOUR,vst_start_dtime,Dsch_DTime) <= (24+(24-DATEPART(HOUR, VST_START_DTIME))) | true |
4e11ccad4dcb28218381004febd5d54d15d485c4 | SQL | SASCopenhaver/References | /CHECKLIST/SQL/sELECT pROJECTS.SQL | UTF-8 | 1,600 | 2.765625 | 3 | [] | no_license | select p.prj_project_id as PrjID
,p.prj_project_number as PrjNum
,p.prj_title as PrjTitle
,p.prj_fiscal_year as PrjFiscYear
/*,f_ProgramOffice(p.prj_program_office) as PrgrOffice*/
/*,f_PersonName ('PrgrOfficer', argUserID) as PrgrOfficer*/
,NVL(pack_checklist.f_Org_Abbr_Title('T', p.prj_project_id), 'No Data Found') as PrgrAgency
,pack_checklist.f_PersonName ('NPAOfficer', p.prj_project_id) as NPAOfficer
,NVL(pack_checklist.f_EVDB_Presence(p.prj_project_id), 'NO') as EVDB_Presence
,NVL(TO_NUMBER( pack_checklist.f_StrategicGoal('ID', p.prj_project_id)), 0) as StrGoalID
,NVL(pack_checklist.f_StrategicGoal('Name', p.prj_project_id), 'No Data Found') as StrGoalName
,pack_checklist.f_PrjStatus('breed' ,p.prj_project_id) as PrjStatus
from usia.project p
where (
p.prj_fiscal_year = pack_checklist.f_CurrentFiscalYear(sysdate)
or
p.prj_fiscal_year = pack_checklist.f_CurrentFiscalYear(sysdate) - 1
)
and
p.prj_createdby = 'breed'
and
p.prj_current_status in ('ACT', 'CLO', 'COM') | true |
cfe39816a6ef54f3cfd80b44ff245213e8d712bd | SQL | wchipchase/chinookSQL | /top_country.sql | UTF-8 | 171 | 3.28125 | 3 | [] | no_license | /*top_country.sql: Which country's customers spent the most?*/
select top(1) BillingCountry, sum(Total) as TotalSales
from Invoice
group by BillingCountry
order by 2 desc | true |
72f2f66605c665d8fc7ea46964b7449bdb1e7504 | SQL | anweshabhar/hotel-reservation-system | /hotel-information-service/src/main/resources/schema.sql | UTF-8 | 442 | 3.546875 | 4 | [] | no_license | DROP TABLE IF EXISTS Hotel_Info;
CREATE TABLE Hotel_Info (
hotel_Id int(18) PRIMARY KEY,
hotel_Name varchar(25) NOT NULL,
hotel_Desc varchar(100),
city varchar(25)
);
DROP TABLE IF EXISTS Rooms;
CREATE TABLE Rooms (
room_Id int(18) PRIMARY KEY,
hotel_Id int(18),
room_Type varchar(25) NOT NULL,
price int(18),
max_guest_allowed int(18),
CONSTRAINT rooms_fk_1 FOREIGN KEY (hotel_Id) REFERENCES Hotel_Info (hotel_Id)
) ;
| true |
48702b38fb07b5c1a34b09d7e1a76a5838d76660 | SQL | qigongcoder/PHP-Easysteps | /13_MySQL_Handle-data/03_update_where.sql | UTF-8 | 539 | 3.5 | 4 | [
"MIT"
] | permissive | CREATE TABLE IF NOT EXISTS tiles
(
id INT AUTO_INCREMENT PRIMARY KEY,
pattern CHAR(16),
color CHAR(16),
price DECIMAL(6,2)
);
INSERT INTO tiles(pattern, color, price)
VALUES ("Spring","Green",9.99),
("Summer","Yellow", 12.99),
("Autumn","Brown", 9.99),
("Winter","Blue", 8.99);
SELECT * FROM tiles;
UPDATE tiles
SET pattern = "Fall" WHERE pattern = "Autumn";
UPDATE tiles SET color = "Gold" WHERE color ="Yellow";
UPDATE tiles SET price = 10.99 WHERE price =9.99;
UPDATE tiles SET price = 11.99 WHERE id =4;
SELECT * FROM tiles; | true |
db44ea1b66906bea35d42baabd8e96c1dce7d764 | SQL | cyclestreets/cyclestreets-setup | /install-osboundaryline/optimizations.sql | UTF-8 | 8,614 | 3.875 | 4 | [] | no_license | -- Changes to the OS Boundary Line database from the directly provided version
-- These changes are aimed at helping performance.
-- Load this file using e.g.:
-- mysql osboundaryline < /opt/cyclestreets-setup/install-osboundaryline/optimizations.sql
-- List the distinct area_description
/*
select area_description, count(*)
from district_borough_unitary
group by area_description;
*/
-- Based on the result of the previous query convert to more efficient ENUM() type and add index
alter table district_borough_unitary
change area_description area_description enum('Metropolitan District','Unitary Authority','District','London Borough'),
add index(area_description);
-- Centroids
/*
-- This query lists the tables that are affected:
select count(*), x.TABLE_NAME
from (SELECT COLUMN_NAME ,TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('global_polygon_id','name', 'area_description', 'geometry', 'hectares')
AND TABLE_SCHEMA='osboundaryline')x
group by x.TABLE_NAME
having count(*)=5;
*/
-- boundary_line_ceremonial_counties
-- Add fields for centroids
alter table boundary_line_ceremonial_counties
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update boundary_line_ceremonial_counties
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- boundary_line_historic_counties
-- Add fields for centroids
alter table boundary_line_historic_counties
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update boundary_line_historic_counties
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- community_ward
-- Add fields for centroids
alter table community_ward
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update community_ward
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- country_region
-- Add fields for centroids
alter table country_region
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update country_region
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- county
-- Add fields for centroids
alter table county
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update county
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- county_electoral_division
-- Add fields for centroids
alter table county_electoral_division
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update county_electoral_division
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- district_borough_unitary
-- Add fields for centroids
alter table district_borough_unitary
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update district_borough_unitary
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- district_borough_unitary_ward
-- Add fields for centroids
alter table district_borough_unitary_ward
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update district_borough_unitary_ward
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- english_region
-- Add fields for centroids
alter table english_region
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update english_region
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- greater_london_const
-- Add fields for centroids
alter table greater_london_const
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update greater_london_const
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- high_water
-- Add fields for centroids
alter table high_water
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update high_water
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- historic_european_region
-- Add fields for centroids
alter table historic_european_region
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update historic_european_region
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- parish
-- Add fields for centroids
alter table parish
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update parish
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- polling_districts_england
-- Add fields for centroids
alter table polling_districts_england
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update polling_districts_england
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- scotland_and_wales_const
-- Add fields for centroids
alter table scotland_and_wales_const
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update scotland_and_wales_const
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- scotland_and_wales_region
-- Add fields for centroids
alter table scotland_and_wales_region
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update scotland_and_wales_region
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- unitary_electoral_division
-- Add fields for centroids
alter table unitary_electoral_division
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update unitary_electoral_division
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- westminster_const
-- Add fields for centroids
alter table westminster_const
add longitude decimal(8,5) not null default 0 comment 'Longitude of centroid',
add latitude decimal(7,5) not null default 0 comment 'Latitude of centroid';
-- Set centroid coordinates
update westminster_const
set longitude = ROUND(ST_X(ST_Centroid(geometry)), 5),
latitude = ROUND(ST_Y(ST_Centroid(geometry)), 5);
-- End of file
| true |
d12152fd25b7950381cca4ee723a02d591e1948f | SQL | wddajd/grw | /grw.sql | UTF-8 | 32,906 | 3.09375 | 3 | [
"MIT"
] | permissive | 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 */;
CREATE DATABASE IF NOT EXISTS `grw` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `grw`;
DROP TABLE IF EXISTS `Fei_acl`;
CREATE TABLE IF NOT EXISTS `Fei_acl` (
`aclid` int(11) NOT NULL,
`name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`controller` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`action` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`acl_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=54 ;
INSERT INTO `Fei_acl` (`aclid`, `name`, `controller`, `action`, `acl_name`) VALUES
(6, '登录', 'Grw', 'login', 'Fei_Any'),
(7, '首页', 'Grw', 'index', 'Fei_Admin'),
(8, '退出', 'Grw', 'logout', 'Fei_Admin'),
(9, '设置', 'setting', 'index', 'Fei_Admin'),
(10, '权限设置', 'setting', 'permission', 'Fei_Admin'),
(11, '权限SET', 'setting', 'permission_set', 'Fei_Admin'),
(12, '后台菜单', 'setting', 'menu', 'Fei_Admin'),
(13, '产品项目', 'project', 'index', 'Fei_Admin'),
(14, '预览中心', 'project', 'main', 'Fei_Admin'),
(15, '栏目设置', 'setting', 'category', 'Fei_Admin'),
(16, '数据备份', 'setting', 'databack', 'Fei_Admin'),
(17, '个人中心', 'Grw', 'profile', 'Fei_Admin'),
(18, '修改密码', 'Grw', 'editpwd', 'Fei_Admin'),
(19, '我的消息', 'Grw', 'message', 'Fei_Admin'),
(20, '任务计划', 'project', 'task', 'Fei_Admin'),
(21, '团队协作', 'cooperation', 'index', 'Fei_Admin'),
(22, '团队成员', 'cooperation', 'person', 'Fei_Admin'),
(23, '部门设置', 'cooperation', 'branch', 'Fei_Admin'),
(24, 'AJAX数据备份', 'setting', 'ajax_databack', 'Fei_Admin'),
(25, 'GRWMAIN', 'grw', 'main', 'Fei_Admin'),
(30, '个人信息', 'profile', 'index', 'Fei_Admin'),
(31, '今日待办', 'timegoal', 'today', 'Fei_Admin'),
(32, '将来或许', 'timegoal', 'maybe', 'Fei_Admin'),
(33, '收集汇总', 'timegoal', 'collect', 'Fei_Admin'),
(34, '回顾', 'timegoal', 'review', 'Fei_Admin'),
(35, '预览', 'money', 'review', 'Fei_Admin'),
(36, '收藏夹', 'favorite', 'index', 'Fei_Admin'),
(37, '通讯录', 'relation', 'contacter', 'Fei_Admin'),
(38, '关注新闻', 'news', 'index', 'Fei_Admin'),
(39, '模板大全', 'profile', 'themes', 'Fei_Admin'),
(40, '作品案例', 'profile', 'product', 'Fei_Admin'),
(41, '日记本', 'note', 'index', 'Fei_Admin'),
(42, '将来获取', 'timegoal', 'maybe', 'Fei_Admin'),
(43, '固定提醒', 'timegoal', 'fixed', 'Fei_Admin'),
(44, '提示信息', 'Grw', 'alert', 'Fei_Admin'),
(45, '功能模块', 'setting', 'module', 'Fei_Admin'),
(46, '密码保险箱', 'password', 'index', 'Fei_Admin'),
(47, '云盘', 'yunpan', 'index', 'Fei_Admin'),
(48, '云盘操作', 'yunpan', 'api', 'Fei_Admin'),
(49, '借款欠款', 'money', 'deposit', 'Fei_Admin'),
(50, '银行卡', 'money', 'bank', 'Fei_Admin'),
(51, '固定资产', 'money', 'assets', 'Fei_Admin'),
(52, '获取天气', 'Grw', 'weather', 'Fei_Admin'),
(53, 'api', 'api', 'index', 'Fei_Any');
DROP TABLE IF EXISTS `Fei_category`;
CREATE TABLE IF NOT EXISTS `Fei_category` (
`catid` tinyint(4) NOT NULL,
`parentid` tinyint(4) NOT NULL DEFAULT '0',
`uid` int(11) NOT NULL,
`catname` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`remark` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
`url` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`setting` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`listorder` tinyint(4) NOT NULL DEFAULT '1',
`ismenu` tinyint(1) NOT NULL,
`letter` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`ico` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
`addtime` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=72 ;
INSERT INTO `Fei_category` (`catid`, `parentid`, `uid`, `catname`, `remark`, `url`, `setting`, `listorder`, `ismenu`, `letter`, `ico`, `addtime`) VALUES
(47, 0, 1, '时间目标', '时间目标管理是一件时间目标管理是一件时间目标管理是一件时间目标管理是一件时间目标管理是一件时间目标管理是一件时间目标管理是一件时', '', '', 3, 1, 'timegoal', 'alarm-clock-select', '0000-00-00 00:00:00'),
(5, 0, 1, '设置', '', '', '', 10, 0, 'setting', 'switch', '0000-00-00 00:00:00'),
(9, 7, 1, '个人信息', '', '', '', 1, 1, 'index', 'icon-user', '0000-00-00 00:00:00'),
(31, 0, 1, '控制面板', '', '', '', 0, 1, 'Grw', 'dashboard', '0000-00-00 00:00:00'),
(21, 5, 1, '后台菜单', '', '', '', 2, 1, 'category', 'icon-sitemap', '0000-00-00 00:00:00'),
(22, 5, 1, '常规设置', '', '', '', 1, 1, 'index', 'icon-tasks', '0000-00-00 00:00:00'),
(23, 7, 1, '我的消息', '', '', '', 2, 0, 'message', 'icon-comments', '0000-00-00 00:00:00'),
(25, 5, 1, '功能权限', '', '', '', 3, 1, 'permission', 'icon-th', '0000-00-00 00:00:00'),
(26, 5, 1, '数据备份', '', '', '', 4, 1, 'databack', 'icon-download-alt', '0000-00-00 00:00:00'),
(28, 27, 1, '发现BUG', '', '', '', 1, 1, 'findbug', '', '0000-00-00 00:00:00'),
(29, 27, 1, '发布公告', '', '', '', 2, 1, 'issue', '', '0000-00-00 00:00:00'),
(30, 18, 1, '部门设置', '', '', '', 3, 1, 'branch', '', '0000-00-00 00:00:00'),
(48, 47, 1, '今日待办', '', '', '', 1, 1, 'today', 'icon-check', '0000-00-00 00:00:00'),
(52, 47, 1, '收集汇总', '', '', '', 5, 1, 'collect', 'icon-inbox', '0000-00-00 00:00:00'),
(53, 0, 1, '收藏夹', '', '', '', 6, 0, 'favorite', 'bookmarks', '0000-00-00 00:00:00'),
(55, 54, 1, '预览', '', '', '', 1, 1, 'review', 'icon-bar-chart', '0000-00-00 00:00:00'),
(56, 0, 1, '密码保险箱', '', '', '', 7, 1, 'password', 'key-solid', '0000-00-00 00:00:00'),
(7, 0, 1, '个人网', '', '', '', 1, 1, 'profile', 'card-address', '0000-00-00 00:00:00'),
(57, 0, 1, '人际关系', '', '', '', 7, 0, 'relation', 'users', '0000-00-00 00:00:00'),
(58, 57, 1, '通讯录', '', '', '', 1, 1, 'contacter', 'icon-list-alt', '0000-00-00 00:00:00'),
(60, 7, 1, '模板大全', '', '', '', 4, 0, 'themes', 'icon-th', '0000-00-00 00:00:00'),
(61, 7, 1, '我的作品', '', '', '', 3, 0, 'product', 'icon-folder-open', '0000-00-00 00:00:00'),
(64, 47, 1, '将来或许', '', '', '', 2, 1, 'maybe', 'icon-road', '0000-00-00 00:00:00'),
(65, 47, 1, '固定提醒', '', '', '', 3, 1, 'fixed', 'icon-time', '0000-00-00 00:00:00'),
(66, 5, 0, '功能模块', '', '', '', 2, 1, 'module', 'icon-tasks', '0000-00-00 00:00:00'),
(67, 0, 0, '云盘', '', '', '', 9, 0, 'yunpan', 'server-cloud', '0000-00-00 00:00:00'),
(68, 54, 0, '借款欠款', '', '', '', 2, 1, 'deposit', 'icon-external-link', '0000-00-00 00:00:00'),
(69, 54, 0, '银行卡', '', '', '', 3, 1, 'bank', 'icon-credit-card', '0000-00-00 00:00:00'),
(70, 54, 0, '固定资产', '', '', '', 4, 1, 'assets', 'icon-home', '0000-00-00 00:00:00'),
(54, 0, 0, '我的钱包', '', '', '', 8, 0, 'money', 'wallet', '0000-00-00 00:00:00');
DROP TABLE IF EXISTS `Fei_contact`;
CREATE TABLE IF NOT EXISTS `Fei_contact` (
`id` tinyint(4) NOT NULL,
`company` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`linkman` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`phone` tinyint(4) NOT NULL,
`tel` tinyint(4) NOT NULL,
`fax` tinyint(4) NOT NULL,
`address` varchar(300) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(30) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
DROP TABLE IF EXISTS `Fei_education`;
CREATE TABLE IF NOT EXISTS `Fei_education` (
`id` int(15) NOT NULL,
`school` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`type` tinyint(1) NOT NULL,
`startime` date NOT NULL,
`endtime` date NOT NULL,
`userid` int(15) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=13 ;
DROP TABLE IF EXISTS `Fei_festival`;
CREATE TABLE IF NOT EXISTS `Fei_festival` (
`fid` int(4) NOT NULL,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`date` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=160 ;
INSERT INTO `Fei_festival` (`fid`, `name`, `date`) VALUES
(1, '新年元旦', '2013-01-01 00:00:00'),
(2, '元宵节', '2013-01-15 00:00:00'),
(3, '腊八节', '2013-01-26 00:00:00'),
(4, '小年', '2013-02-11 00:00:00'),
(5, '情人节', '2013-02-14 00:00:00'),
(6, '除夕', '2013-02-17 00:00:00'),
(7, '春节', '2013-02-18 00:00:00'),
(8, '元宵节', '2013-03-04 00:00:00'),
(9, '全国爱耳日', '2013-03-03 00:00:00'),
(10, '学习雷锋纪念日', '2013-03-05 00:00:00'),
(11, '国际劳动妇女节', '2013-03-08 00:00:00'),
(12, '国际尊严尊敬日', '2013-03-11 00:00:00'),
(13, '中国植树节', '2013-03-12 00:00:00'),
(14, '国际警察日', '2013-03-14 00:00:00'),
(15, '国际消费者权益日', '2013-03-15 00:00:00'),
(16, '手拉手情系贫困小伙伴全国统一行动日', '2013-03-16 00:00:00'),
(17, '中和节(太阳生日)', '2013-03-19 00:00:00'),
(18, '龙抬头节', '2013-03-20 00:00:00'),
(19, '世界森林日', '2013-03-21 00:00:00'),
(20, '世界儿歌日', '2013-03-21 00:00:00'),
(21, '国际消除种族歧视日', '2013-03-21 00:00:00'),
(22, '世界睡眠日', '2013-03-21 00:00:00'),
(23, '世界水日', '2013-03-22 00:00:00'),
(24, '世界气象日', '2013-03-23 00:00:00'),
(25, '世界防治结核病日', '2013-03-24 00:00:00'),
(26, '中小学生安全教育日', '2013-03-25 00:00:00'),
(27, '春社日', '2013-03-25 00:00:00'),
(28, '花朝节(花神节)', '2013-03-30 00:00:00'),
(29, '耶稣受难日', '2013-03-30 00:00:00'),
(30, '国际愚人节', '2013-04-01 00:00:00'),
(31, '寒食节', '2013-04-04 00:00:00'),
(32, '清明节', '2013-04-05 00:00:00'),
(33, '复活节', '2013-04-06 00:00:00'),
(34, '观音菩萨生日', '2013-04-06 00:00:00'),
(35, '世界卫生日', '2013-04-07 00:00:00'),
(36, '世界帕金森病日', '2013-04-11 00:00:00'),
(37, '傣族泼水节', '2013-04-13 00:00:00'),
(38, '上巳节(女儿节)', '2013-04-19 00:00:00'),
(39, '全国企业家活动日', '2013-04-21 00:00:00'),
(40, '世界地球日', '2013-04-22 00:00:00'),
(41, '世界儿童日', '2013-04-22 00:00:00'),
(42, '世界图书和版权日', '2013-04-23 00:00:00'),
(43, '全国预防接种宣传节日', '2013-04-25 00:00:00'),
(44, '国际秘书日', '2013-04-26 00:00:00'),
(45, '世界知识产权日', '2013-04-26 00:00:00'),
(46, '国际劳动节', '2013-05-01 00:00:00'),
(47, '中国青年节', '2013-05-04 00:00:00'),
(48, '全国碘缺乏病宣传日', '2013-05-05 00:00:00'),
(49, '全国爱眼日', '2013-05-05 00:00:00'),
(50, '世界红十字日', '2013-05-08 00:00:00'),
(51, '世界哮喘日', '2013-05-08 00:00:00'),
(52, '国际护士节', '2013-05-12 00:00:00'),
(53, '母亲节', '2013-05-13 00:00:00'),
(54, '国际家庭日', '2013-05-15 00:00:00'),
(55, '国际牛奶日', '2013-05-15 00:00:00'),
(56, '世界电信日', '2013-05-17 00:00:00'),
(57, '国际博物馆日', '2013-05-18 00:00:00'),
(58, '全国助残日', '2013-05-20 00:00:00'),
(59, '中国学生营养日', '2013-05-20 00:00:00'),
(60, '全国母乳喂养宣传日', '2013-05-20 00:00:00'),
(61, '国际生物多样性日', '2013-05-22 00:00:00'),
(62, '佛诞节', '2013-05-24 00:00:00'),
(63, '世界无烟日', '2013-05-31 00:00:00'),
(64, '国际儿童节', '2013-06-01 00:00:00'),
(65, '世界环境日', '2013-06-05 00:00:00'),
(66, '全国爱眼日', '2013-06-06 00:00:00'),
(67, '中国文化遗产日', '2013-06-09 00:00:00'),
(68, '世界防治荒漠化和干旱日', '2013-06-17 00:00:00'),
(69, '父亲节', '2013-06-17 00:00:00'),
(70, '端午节', '2013-06-19 00:00:00'),
(71, '世界难民日', '2013-06-20 00:00:00'),
(72, '国际奥林匹克日', '2013-06-23 00:00:00'),
(73, '全国土地日', '2013-06-25 00:00:00'),
(74, '国际禁毒日', '2013-06-26 00:00:00'),
(75, '联合国宪章日', '2013-06-26 00:00:00'),
(76, '香港回归纪念日', '2013-07-01 00:00:00'),
(77, '中共建党节', '2013-07-01 00:00:00'),
(78, '国际合作社日', '2013-07-07 00:00:00'),
(79, '中国人民抗日战争纪念日', '2013-07-07 00:00:00'),
(80, '世界人口日', '2013-07-11 00:00:00'),
(81, '世界海事日', '2013-07-11 00:00:00'),
(82, '世界语(言)创立日', '2013-07-26 00:00:00'),
(83, '观音成道日', '2013-08-01 00:00:00'),
(84, '中国人民解放军建军节', '2013-08-01 00:00:00'),
(85, '哈尼族苦扎扎节', '2013-08-06 00:00:00'),
(86, '观莲节(莲花生日)', '2013-08-06 00:00:00'),
(87, '苗族吃新节', '2013-08-06 00:00:00'),
(88, '火把节', '2013-08-06 00:00:00'),
(89, '七夕情人节', '2013-08-19 00:00:00'),
(90, '中元节(鬼节)', '2013-08-27 00:00:00'),
(91, '抗日战争胜利纪念日', '2013-09-03 00:00:00'),
(92, '国际扫盲日', '2013-09-08 00:00:00'),
(93, '中国教师节', '2013-09-10 00:00:00'),
(94, '地藏节', '2013-09-10 00:00:00'),
(95, '世界预防自杀日', '2013-09-10 00:00:00'),
(96, '国际臭氧层保护日', '2013-09-16 00:00:00'),
(97, '中国国耻日', '2013-09-18 00:00:00'),
(98, '全国爱牙日', '2013-09-20 00:00:00'),
(99, '全国公民道德宣传日', '2013-09-20 00:00:00'),
(100, '国际和平日', '2013-09-21 00:00:00'),
(101, '无车日', '2013-09-22 00:00:00'),
(102, '中秋节', '2013-09-25 00:00:00'),
(103, '世界旅游日', '2013-09-27 00:00:00'),
(104, '世界教师节(孔子诞辰)', '2013-09-28 00:00:00'),
(105, '国际聋人节(最后一个星期日)', '2013-09-30 00:00:00'),
(106, '世界建筑日(第一个星期一)', '2013-10-01 00:00:00'),
(107, '国际住房日(人居日)(第一个星期一)', '2013-10-01 00:00:00'),
(108, '国庆节', '2013-10-01 00:00:00'),
(109, '国际老人节', '2013-10-01 00:00:00'),
(110, '世界动物日', '2013-10-04 00:00:00'),
(111, '全国高血压日', '2013-10-08 00:00:00'),
(112, '世界邮政日', '2013-10-09 00:00:00'),
(113, '国际减灾日(第二个星期三)', '2013-10-10 00:00:00'),
(114, '世界精神卫生日', '2013-10-10 00:00:00'),
(115, '世界视觉日(第二个星期四)', '2013-10-11 00:00:00'),
(116, '世界保健日', '2013-10-13 00:00:00'),
(117, '中国少年先锋队诞辰日', '2013-10-13 00:00:00'),
(118, '国际音乐节(10月中旬)', '2013-10-14 00:00:00'),
(119, '世界标准日', '2013-10-14 00:00:00'),
(120, '国际盲人节', '2013-10-15 00:00:00'),
(121, '世界粮食日', '2013-10-16 00:00:00'),
(122, '国际消除贫困日', '2013-10-17 00:00:00'),
(123, '重阳节(敬老节)', '2013-10-18 00:00:00'),
(124, '世界传统医药日', '2013-10-18 00:00:00'),
(125, '联合国日', '2013-10-24 00:00:00'),
(126, '全国男性健康日', '2013-10-28 00:00:00'),
(127, '观音出家日', '2013-10-29 00:00:00'),
(128, '重阳节(敬老节)', '2013-10-18 00:00:00'),
(129, '世界传统医药日', '2013-10-18 00:00:00'),
(130, '联合国日', '2013-10-24 00:00:00'),
(131, '全国男性健康日', '2013-10-28 00:00:00'),
(132, '观音出家日', '2013-10-29 00:00:00'),
(133, '万圣节', '2013-10-31 00:00:00'),
(134, '十月革命纪念日', '2013-11-07 00:00:00'),
(135, '中国记者节', '2013-11-08 00:00:00'),
(136, '中国消防宣传日', '2013-01-09 00:00:00'),
(137, '世界青年节', '2013-11-10 00:00:00'),
(138, '祭祖节', '2013-11-10 00:00:00'),
(139, '光棍节', '2013-11-11 00:00:00'),
(140, '国际科学与和平周(11日所属一周)', '2013-11-11 00:00:00'),
(141, '世界糖尿病日', '2013-11-14 00:00:00'),
(142, '国际大学生节', '2013-11-17 00:00:00'),
(143, '感恩节(第四个星期四)', '2013-11-22 00:00:00'),
(144, '国际消除对妇女的暴力日', '2013-11-25 00:00:00'),
(145, '世界艾滋病日', '2013-12-01 00:00:00'),
(146, '国际残疾人日', '2013-12-03 00:00:00'),
(147, '中国法制宣传日', '2013-12-04 00:00:00'),
(148, '国际志愿人员日', '2013-12-05 00:00:00'),
(149, '国际民航日', '2013-12-07 00:00:00'),
(150, '世界足球日', '2013-12-09 00:00:00'),
(151, '国际儿童广播电视日(第二个星期日)', '2013-12-09 00:00:00'),
(152, '世界人权日', '2013-12-10 00:00:00'),
(153, '南京大屠杀纪念日', '2013-12-13 00:00:00'),
(154, '澳门回归纪念日', '2013-12-20 00:00:00'),
(155, '阔时节', '2013-12-20 00:00:00'),
(156, '国际篮球日', '2013-12-21 00:00:00'),
(157, '冬至节', '2013-12-22 00:00:00'),
(158, '平安夜', '2013-12-24 00:00:00'),
(159, '圣诞节', '2013-12-25 00:00:00');
DROP TABLE IF EXISTS `Fei_follow`;
CREATE TABLE IF NOT EXISTS `Fei_follow` (
`id` int(15) NOT NULL,
`icon` int(1) NOT NULL,
`link` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`userid` int(15) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;
DROP TABLE IF EXISTS `Fei_money`;
CREATE TABLE IF NOT EXISTS `Fei_money` (
`id` int(15) NOT NULL,
`action` tinyint(1) NOT NULL,
`money` int(15) NOT NULL,
`mark` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`date` date NOT NULL,
`userid` int(15) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;
DROP TABLE IF EXISTS `Fei_money_assets`;
CREATE TABLE IF NOT EXISTS `Fei_money_assets` (
`id` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`name` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
`sum` int(11) NOT NULL,
`time` date NOT NULL,
`remark` varchar(200) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=9 ;
DROP TABLE IF EXISTS `Fei_money_bank`;
CREATE TABLE IF NOT EXISTS `Fei_money_bank` (
`id` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`title` varchar(35) COLLATE utf8_unicode_ci NOT NULL,
`type` tinyint(1) NOT NULL COMMENT '0信用卡|1储蓄卡',
`num` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`reserve` float NOT NULL COMMENT '余额',
`status` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;
DROP TABLE IF EXISTS `Fei_money_bank_record`;
CREATE TABLE IF NOT EXISTS `Fei_money_bank_record` (
`id` int(11) NOT NULL,
`cz` tinyint(1) NOT NULL,
`bankid` tinyint(2) NOT NULL,
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`sum` int(11) NOT NULL,
`address` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`remark` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`uid` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;
DROP TABLE IF EXISTS `Fei_money_deposit`;
CREATE TABLE IF NOT EXISTS `Fei_money_deposit` (
`id` int(11) NOT NULL,
`type` tinyint(1) NOT NULL COMMENT '0借出1借进',
`user` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`sum` int(11) NOT NULL,
`stime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`period` int(4) NOT NULL COMMENT '天',
`remark` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`uid` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=15 ;
DROP TABLE IF EXISTS `Fei_note`;
CREATE TABLE IF NOT EXISTS `Fei_note` (
`id` int(11) NOT NULL,
`userid` int(11) NOT NULL,
`title` varchar(300) COLLATE utf8_unicode_ci NOT NULL,
`content` text COLLATE utf8_unicode_ci NOT NULL,
`keywords` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`createtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=23 ;
DROP TABLE IF EXISTS `Fei_password`;
CREATE TABLE IF NOT EXISTS `Fei_password` (
`id` int(11) NOT NULL,
`catid` tinyint(4) NOT NULL,
`uid` int(11) NOT NULL,
`title` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`website` varchar(90) COLLATE utf8_unicode_ci NOT NULL,
`username` varchar(35) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(35) COLLATE utf8_unicode_ci NOT NULL,
`remark` varchar(140) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=134 ;
DROP TABLE IF EXISTS `Fei_password_cate`;
CREATE TABLE IF NOT EXISTS `Fei_password_cate` (
`id` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`name` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`all` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=24 ;
DROP TABLE IF EXISTS `Fei_product`;
CREATE TABLE IF NOT EXISTS `Fei_product` (
`id` int(15) NOT NULL,
`name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`pic` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`link` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
`userid` int(15) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=8 ;
DROP TABLE IF EXISTS `Fei_relation_about`;
CREATE TABLE IF NOT EXISTS `Fei_relation_about` (
`id` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`userid` int(11) NOT NULL,
`name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`value` varchar(70) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=21 ;
DROP TABLE IF EXISTS `Fei_relation_contacter`;
CREATE TABLE IF NOT EXISTS `Fei_relation_contacter` (
`id` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`firstchar` char(2) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
`infantname` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`birthtype` tinyint(1) NOT NULL DEFAULT '0' COMMENT '默认0农历,1阳历',
`birthday` date NOT NULL,
`qq` bigint(22) NOT NULL DEFAULT '0',
`mobile` bigint(30) NOT NULL DEFAULT '0',
`weibo` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
`email` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
`birthplace` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
`avatar` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=41 ;
DROP TABLE IF EXISTS `Fei_rss`;
CREATE TABLE IF NOT EXISTS `Fei_rss` (
`id` int(11) NOT NULL,
`url` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`userid` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ;
DROP TABLE IF EXISTS `Fei_site`;
CREATE TABLE IF NOT EXISTS `Fei_site` (
`siteid` tinyint(4) NOT NULL,
`name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`domain` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`title` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`keywords` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(300) COLLATE utf8_unicode_ci NOT NULL,
`author` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`setting` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`addtime` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `Fei_skill`;
CREATE TABLE IF NOT EXISTS `Fei_skill` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`level` int(3) NOT NULL,
`time` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`userid` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;
DROP TABLE IF EXISTS `Fei_system`;
CREATE TABLE IF NOT EXISTS `Fei_system` (
`id` tinyint(4) NOT NULL,
`title` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`branch` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
DROP TABLE IF EXISTS `Fei_todo`;
CREATE TABLE IF NOT EXISTS `Fei_todo` (
`doid` int(10) NOT NULL,
`userid` tinyint(10) NOT NULL,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`remark` text COLLATE utf8_unicode_ci NOT NULL,
`startime` datetime NOT NULL,
`endtime` datetime NOT NULL,
`createtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`mark` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`level` tinyint(1) NOT NULL,
`repeats` tinyint(1) DEFAULT NULL,
`tags` varchar(300) COLLATE utf8_unicode_ci NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=367 ;
DROP TABLE IF EXISTS `Fei_todo_tags`;
CREATE TABLE IF NOT EXISTS `Fei_todo_tags` (
`tagid` tinyint(8) NOT NULL,
`icon` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`userid` tinyint(15) NOT NULL,
`total` int(10) NOT NULL,
`maybe` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=55 ;
DROP TABLE IF EXISTS `Fei_type`;
CREATE TABLE IF NOT EXISTS `Fei_type` (
`typeid` tinyint(4) NOT NULL,
`name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`sort` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`isuse` char(4) COLLATE utf8_unicode_ci NOT NULL,
`addtime` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `Fei_user`;
CREATE TABLE IF NOT EXISTS `Fei_user` (
`id` int(11) NOT NULL,
`openid` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`url` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`username` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`realname` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`gender` char(2) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(26) COLLATE utf8_unicode_ci NOT NULL,
`avatar` varchar(222) COLLATE utf8_unicode_ci NOT NULL,
`position` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`address` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`phone` int(11) DEFAULT NULL,
`qq` int(15) DEFAULT NULL,
`birthday` date NOT NULL,
`description` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
`question` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`answer` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`roleId` tinyint(1) DEFAULT '0',
`status` tinyint(4) NOT NULL DEFAULT '1'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=137 ;
INSERT INTO `Fei_user` (`id`, `openid`, `url`, `username`, `password`, `realname`, `gender`, `email`, `avatar`, `position`, `address`, `phone`, `qq`, `birthday`, `description`, `question`, `answer`, `roleId`, `status`) VALUES
(136, '052DCBF9B4095CF3D7CEEC4F53ECF138', '', '', '', 'Feei', '男', '', 'http://q.qlogo.cn/qqapp/100457409/052DCBF9B4095CF3D7CEEC4F53ECF138/100', '', '', NULL, NULL, '0000-00-00', '', '', '', 0, 1);
DROP TABLE IF EXISTS `Fei_user_category`;
CREATE TABLE IF NOT EXISTS `Fei_user_category` (
`uid` int(11) NOT NULL,
`category` tinyint(4) NOT NULL,
`order` tinyint(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `Fei_user_role`;
CREATE TABLE IF NOT EXISTS `Fei_user_role` (
`id` int(11) unsigned NOT NULL,
`name` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6 ;
INSERT INTO `Fei_user_role` (`id`, `name`) VALUES
(5, '创始人'),
(4, '核心开发者'),
(3, '开发者'),
(2, '特约体验'),
(1, '普通用户');
DROP TABLE IF EXISTS `Fei_work`;
CREATE TABLE IF NOT EXISTS `Fei_work` (
`id` int(15) NOT NULL,
`startime` date NOT NULL,
`endtime` date NOT NULL,
`company` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`position` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`description` text COLLATE utf8_unicode_ci NOT NULL,
`userid` tinyint(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;
DROP TABLE IF EXISTS `Fei_yunpan`;
CREATE TABLE IF NOT EXISTS `Fei_yunpan` (
`id` int(7) unsigned NOT NULL,
`parent_id` int(7) unsigned NOT NULL,
`name` varchar(256) NOT NULL,
`content` longblob NOT NULL,
`size` int(10) unsigned NOT NULL DEFAULT '0',
`mtime` int(10) unsigned NOT NULL,
`mime` varchar(256) NOT NULL DEFAULT 'unknown',
`read` enum('1','0') NOT NULL DEFAULT '1',
`write` enum('1','0') NOT NULL DEFAULT '1',
`locked` enum('1','0') NOT NULL DEFAULT '0',
`hidden` enum('1','0') NOT NULL DEFAULT '0',
`width` int(5) NOT NULL,
`height` int(5) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=102 ;
ALTER TABLE `Fei_acl`
ADD PRIMARY KEY (`aclid`);
ALTER TABLE `Fei_category`
ADD PRIMARY KEY (`catid`), ADD KEY `parentid` (`parentid`);
ALTER TABLE `Fei_contact`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_education`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_festival`
ADD PRIMARY KEY (`fid`);
ALTER TABLE `Fei_follow`
ADD PRIMARY KEY (`id`), ADD KEY `id` (`id`), ADD KEY `userid` (`userid`), ADD KEY `userid_2` (`userid`);
ALTER TABLE `Fei_money`
ADD PRIMARY KEY (`id`), ADD KEY `id` (`id`), ADD KEY `id_2` (`id`);
ALTER TABLE `Fei_money_assets`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_money_bank`
ADD PRIMARY KEY (`id`), ADD KEY `id` (`id`);
ALTER TABLE `Fei_money_bank_record`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_money_deposit`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_note`
ADD PRIMARY KEY (`id`), ADD KEY `userid` (`userid`);
ALTER TABLE `Fei_password`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_password_cate`
ADD PRIMARY KEY (`id`), ADD KEY `id` (`id`);
ALTER TABLE `Fei_product`
ADD PRIMARY KEY (`id`), ADD KEY `id` (`id`), ADD KEY `id_2` (`id`), ADD KEY `userid` (`userid`);
ALTER TABLE `Fei_relation_about`
ADD PRIMARY KEY (`id`), ADD KEY `uid` (`uid`);
ALTER TABLE `Fei_relation_contacter`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_rss`
ADD PRIMARY KEY (`id`), ADD KEY `id` (`id`);
ALTER TABLE `Fei_skill`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_system`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_todo`
ADD PRIMARY KEY (`doid`), ADD KEY `doid` (`doid`);
ALTER TABLE `Fei_todo_tags`
ADD PRIMARY KEY (`tagid`), ADD KEY `tagid` (`tagid`);
ALTER TABLE `Fei_user`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_user_category`
ADD PRIMARY KEY (`uid`);
ALTER TABLE `Fei_user_role`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_work`
ADD PRIMARY KEY (`id`);
ALTER TABLE `Fei_yunpan`
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `parent_name` (`parent_id`,`name`), ADD KEY `parent_id` (`parent_id`);
ALTER TABLE `Fei_acl`
MODIFY `aclid` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=54;
ALTER TABLE `Fei_category`
MODIFY `catid` tinyint(4) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=72;
ALTER TABLE `Fei_contact`
MODIFY `id` tinyint(4) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
ALTER TABLE `Fei_education`
MODIFY `id` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=13;
ALTER TABLE `Fei_festival`
MODIFY `fid` int(4) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=160;
ALTER TABLE `Fei_follow`
MODIFY `id` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
ALTER TABLE `Fei_money`
MODIFY `id` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
ALTER TABLE `Fei_money_assets`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=9;
ALTER TABLE `Fei_money_bank`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
ALTER TABLE `Fei_money_bank_record`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
ALTER TABLE `Fei_money_deposit`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=15;
ALTER TABLE `Fei_note`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=23;
ALTER TABLE `Fei_password`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=134;
ALTER TABLE `Fei_password_cate`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=24;
ALTER TABLE `Fei_product`
MODIFY `id` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
ALTER TABLE `Fei_relation_about`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=21;
ALTER TABLE `Fei_relation_contacter`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=41;
ALTER TABLE `Fei_rss`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
ALTER TABLE `Fei_skill`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
ALTER TABLE `Fei_system`
MODIFY `id` tinyint(4) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
ALTER TABLE `Fei_todo`
MODIFY `doid` int(10) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=367;
ALTER TABLE `Fei_todo_tags`
MODIFY `tagid` tinyint(8) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=55;
ALTER TABLE `Fei_user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=137;
ALTER TABLE `Fei_user_category`
MODIFY `uid` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `Fei_user_role`
MODIFY `id` int(11) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6;
ALTER TABLE `Fei_work`
MODIFY `id` int(15) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
ALTER TABLE `Fei_yunpan`
MODIFY `id` int(7) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=102;
/*!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 |
982aac2ed0e6c9f75cd14f7c60998c6d410d306a | SQL | chaoting1995/mfee09-proj | /0819-create-datalist.sql | UTF-8 | 1,395 | 3.046875 | 3 | [] | no_license | -- 新增
INSERT INTO `address_book`
(`sid`, `name`, `email`, `mobile`, `birthday`, `address`, `created_at`)
-- 值務必用單引號
-- primary key:NULL,會自動邊流水號
VALUES (NULL, '李小明', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW());
-- 新增
-- 用逗號隔開每筆資料
INSERT INTO `address_book`
(`sid`, `name`, `email`, `mobile`, `birthday`, `address`, `created_at`) VALUES
(NULL, '李小明3', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW()),
(NULL, '李小明4', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW()),
(NULL, '李小明5', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW()),
(NULL, '李小明6', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW()),
(NULL, '李小明7', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW()),
(NULL, '李小明8', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW()),
(NULL, '李小明9', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW()),
(NULL, '李小明10', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW()),
(NULL, '李小明11', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW()),
(NULL, '李小明12', 'ming@test.com', '0900000000', '2020-08-04', '台北市', NOW())
-- 修改
UPDATE `address_book` SET `email` = 'ming@test1.com' WHERE `address_book`.`sid` = 3
-- `address_book`.可省略
-- 沒有下WHERE的話,所有東西都會改 | true |
8998ad1f4eb752bfbcdf9c1b76b7dc9fd7da177a | SQL | rasiyanir/FrontEnd | /Assignments/RDBMS/emp.sql | UTF-8 | 2,164 | 3.75 | 4 | [] | no_license | SELECT * FROM riyaz.emp;
select ENAME from riyaz.emp where job="Analyst" or job= "Salesman" ;
select EMPNO, ENAME,JOB, HIREDATE from riyaz.emp where HIREDATE < "1981-09-30";
select ENAME, JOB from riyaz.emp where NOT job = "Manager";
select ENAME from riyaz.emp where EMPNO IN ('7369', '7521','7839', '7934', '7788');
select ENAME from riyaz.emp where DEPTNO NOT IN ('30', '40', '10');
select ENAME from riyaz.emp where HIREDATE BETWEEN '1981-06-30' AND '1981-12-31';
select distinct JOB from riyaz.emp;
select ENAME from riyaz.emp where COMM IS NULL;
select ENAME, JOB from riyaz.emp where MGR IS NULL;
select ENAME from riyaz.emp where DEPTNO IS NULL;
select ENAME from riyaz.emp where COMM IS NOT NULL;
select ENAME from riyaz.emp where ENAME like 'S%' OR ENAME like "%S";
select ENAME from riyaz.emp where ENAME like '_i%';
select count(EMPNO) from riyaz.emp;
select count(DISTINCT JOB) from riyaz.emp;
select SUM(SAL) from riyaz.emp;
select MAX(SAL), MIN(SAL), AVG(SAL) from riyaz.emp;
select MAX(SAL) from riyaz.emp where JOB='Salesman';
select JOB, AVG(SAL) from riyaz.emp where DEPTNO='20' GROUP BY JOB HAVING AVG(SAL) > 1000 ORDER BY JOB;
select count(EMPNO), AVG(SAL) from riyaz.emp where DEPTNO = '20';
select ENAME, SAL, SAL + 0.1*SAL as 'PF' from riyaz.emp;
select curdate(), timestampdiff(Year, HIREDATE, CURDATE()) AS 'Age' from riyaz.emp where timestampdiff(Year, HIREDATE, CURDATE()) > 37;
select EMPNO, ENAME, JOB, SAL from riyaz.emp order by SAL;
select ENAME, HIREDATE from riyaz.emp order by HIREDATE DESC;
select ENAME, SAL, SAL + 0.1*SAL as 'PF', sal*0.5 as 'HRA', SAL*0.3 as 'DA', sal + sal*0.1 + sal*0.5 as 'GROSS' from riyaz.emp order by 'GROSS';
select DEPTNO, count(EMPNO) from riyaz.emp GROUP BY DEPTNO;
select DEPTNO, SUM(SAL) from riyaz.emp GROUP BY DEPTNO;
select JOB, count(EMPNO) from riyaz.emp GROUP BY JOB ORDER BY COUNT(EMPNO) DESC;
select SUM(SAL), MAX(SAL), MIN(SAL), AVG(SAL), JOB from riyaz.emp group by JOB;
select SUM(SAL), MAX(SAL), MIN(SAL), AVG(SAL) from riyaz.emp where DEPTNO = '20';
select AVG(SAL), JOB from riyaz.emp where DEPTNO = '20' GROUP BY JOB HAVING AVG(SAL) > '1000' ; | true |
831c6e70825ac461d11966ce241ce8d4ea865871 | SQL | maquiavelo79/bodyflex | /dataBase/[SP]/SP_CP_ADM_CSU_CAT3_CMB.sql | UTF-8 | 573 | 3.078125 | 3 | [] | no_license | -- select * from PRODUCTO_CATEGORIA2
CALL SP_CP_ADM_CSU_CAT3_CMB(1 ,@codErr);
SELECT @codErr;
DROP PROCEDURE IF EXISTS bodyflex.SP_CP_ADM_CSU_CAT3_CMB;
CREATE PROCEDURE bodyflex.`SP_CP_ADM_CSU_CAT3_CMB`(IN cat2 INTEGER, OUT codErr INTEGER)
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION SET codErr=99;
SET codErr=0;
IF EXISTS(SELECT * FROM PRODUCTO_CATEGORIA3 WHERE PCP2_ID=cat2)THEN
SELECT PCP3_ID
, PCP3_NOM
FROM PRODUCTO_CATEGORIA3
WHERE PCP2_ID=cat2
ORDER BY PCP3_NOM ASC;
ELSE
SET codErr=98;
END IF;
END;
| true |
362a71816ef78e4292dc297c9a2d4e418e28f863 | SQL | pserwylo/herri | /server/db_population/model_attributes/api_attribute.sql | UTF-8 | 3,286 | 2.96875 | 3 | [] | no_license | --
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
--
-- Data for Name: api_attribute; Type: TABLE DATA; Schema: public; Owner: django
--
COPY api_attribute (id, name, column_name, description) FROM stdin;
1 Total Population tot_p_p The number of people who were in a particular region during census night.
39 Age 80-89 years agep_80_89_years AGEP 80-89 years\r\n
38 Age 70-79 years agep_70_79_years Age 70-79 years\r\n
37 AGEP 60-69 years agep_60_69_years Age 60-69 years\r\n
36 Age 50-59 years agep_50_59_years AGEP 50-59 years\r\n
4 Islam relp_islam All subsets of islam are only available in this one category.
35 Age 40-49 years agep_40_49_years Age 40-49 years\r\n
34 Age 30-39 years agep_30_39_years Age 30-39 years\r\n
33 AGE 20-29 years agep_20_29_years Age 20-29 years\r\n
32 Age 10-19 agep_10_19_years Age 10-19 years\r\n
31 Age 0-9 agep_0_9_years Age 0-9
30 Female sexp_female Female Sex
29 Male sexp_male Male Sex
28 Orthodox relp_orthodox_tot Orthodox Christians including Oriental Orthodox, Armenian Apostolic, Coptic Orthodox Church, Syrian Orthodox Church, Ethiopian Orthodox Church, Assyrian Apostolic, Assyrian Church of the East, Ancient Church of the East, Assyrian Apostolic, Eastern Orthodox, Albanian Orthodox, Antiochian Orthodox, Greek Orthodox, Macedonian Orthodox, Romanian Orthodox, Russian Orthodox, Serbian Orthodox, Ukrainian Orthodox, and Eastern Orthodox\r\n
27 Jehovah's Witnesses relp_jehovah_s_witnesses Jehovah's Witnesses\r\n
26 Churches of Christ (Conference) relp_churches_of_christ_conference_ Churches of Christ
25 Church of Jesus Christ of LDS (Mormons) relp_church_of_jesus_christ_of_lds_mormons_ Mormonism
24 Lutheran relp_lutheran Lutheran
23 Macedonian Orthodox relp_macedonian_orthodox Macedonian Orthodox
22 Greek Orthodox relp_greek_orthodox Greek Orthodox
21 Presbyterian relp_presbyterian Presbyterian\r\n
20 Uniting Church relp_uniting_church Uniting Church
19 Zoroastrianism relp_zoroastrianism Zoroastrianism
18 Jainism relp_jainism Jainism
17 No Religion relp_no_religion_tot No religion including rationalism, humanism, atheism, agnosticism and no religion.
16 Caodaism relp_caodaism Caodaism
15 Spiritualism relp_spiritualism Spiritualism
14 Sikhism relp_sikhism Sikhism
13 Witchcraft relp_wiccan_witchcraft Witchcraft
12 Pantheism relp_pantheism Pantheism
11 Paganism relp_paganism Paganism
10 Druse relp_druse Druse
9 Taoism relp_taoism Chinese Taoism
8 Baha'i relp_baha_i Baha'i\r\n
7 Australian Aboriginal Traditional Religions relp_australian_aboriginal_traditional_religions All Australian Aboriginal Traditional Religions
6 Hinduism relp_hinduism All Hindu traditions.
5 Judaism relp_judaism All Jewish denominations
3 Anglican relp_anglican_church_of_australia The Anglican church is wide-spread in australia
2 Roman Catholic relp_western_catholic The Roman Catholic Church is associated with the Vatican.
\.
--
-- Name: api_attribute_id_seq; Type: SEQUENCE SET; Schema: public; Owner: django
--
SELECT pg_catalog.setval('api_attribute_id_seq', 39, true);
--
-- PostgreSQL database dump complete
--
| true |
232b919c4e5dd1e2c0ac1578797241074743d53f | SQL | StechAnurag/mysql | /procedures/withdraw.sql | UTF-8 | 613 | 3.640625 | 4 | [] | no_license | -- Dumping structure for procedure health.withdraw
DELIMITER //
CREATE PROCEDURE `withdraw`(
IN account_no INT,
IN amount NUMERIC(7,2),
OUT success BOOL
)
BEGIN
DECLARE current_balance NUMERIC(7,2) DEFAULT 0.0;
-- check the current balance of the account
SELECT balance INTO current_balance FROM accounts WHERE account_number = account_no;
-- If balance is big enough do the withdrawal
IF current_balance >= amount THEN
UPDATE accounts SET balance = balance - amount WHERE account_number = account_no;
SET success := true;
ELSE
SET success := false;
END IF;
END//
DELIMITER ; | true |
d4da091b68478d3bec75669820c93a527b69c7d9 | SQL | ahj3859/Advanced_JSP_and_Servlet | /Chap02_Controller/create_data_oracle.sql | UTF-8 | 2,566 | 4.09375 | 4 | [] | no_license | drop table board;
drop table users;
create table users(
id varchar2(28) primary key,
password varchar2(8) not null,
name varchar2(30) not null,
role varchar2(5) default 'User'
)
create table board(
seq number(5) primary key,
title varchar2(200) not null,
nickname varchar2(30) not null,
content varchar2(2000) not null,
regdate date default sysdate,
cnt number(5) default 0,
userid varchar2(8) default 'guest'
)
insert into users values('hong', 'hong123', '홍길동', 'Admin');
insert into users values('abc', 'abc123', '임꺽정', 'User');
insert into users values('guest', 'guest123', '일지매', 'Guest');
insert into board(seq, title, nickname, content, regdate, userid)
values(1, '첫 번째 게시물', '홍길동', '첫 번째 게시물 내용.', '2017-02-05', 'hong');
insert into board(seq, title, nickname, content, regdate, userid)
values(2, '두 번째 게시물', '홍길동', '두 번째 게시물 내용.', '2017-03-15', 'hong');
insert into board(seq, title, nickname, content, regdate, userid)
values(3, '세 번째 게시물', '홍길동', '세 번째 게시물 내용.', '2017-03-03', 'hong');
insert into board(seq, title, nickname, content, regdate, userid)
values(4, '네 번째 게시물', '홍길동', '네 번째 게시물 내용.', '2017-05-17', 'hong');
insert into board(seq, title, nickname, content, regdate, userid)
values(5, '다섯 번째 게시물', '일지매', '다섯 번째 게시물 내용.', '2017-05-19', 'guest');
insert into board(seq, title, nickname, content, regdate, userid)
values(6, '여섯 번째 게시물', '일지매', '여섯 번째 게시물 내용.', '2017-12-25', 'guest');
insert into board(seq, title, nickname, content, regdate, userid)
values((select nvl(max(seq), 0)+1 from board), '일곱 번째 게시물', '일지매', '일곱 번째 게시물 내용.', '2017-12-25', 'guest');
select * from users;
select * from board order by seq desc;
select * from board where title like '%번째%' order by seq desc
-- 1명 조회
select * from board where seq = 10;
-- 게시물 삽입
-- nvcl (널이 아니면 꺼낼 값, 널인 경우 처리할 값)
insert into board(seq, title, nickname, content)
values( (select nvl( max(seq), 0) + 1 from board), '테스트타이틀', '테스트', '테스트 컨텐츠')
-- 수정
update board set title = '새로운 타이틀', content = '새로운 컨텐츠' where seq = 10
-- 삭제
delete from board where seq = 12
-- 사용자 체크
select * from users where id = 'guest' and password = 'guest12' | true |
e3f097bed40f38b8bafba7ca73c50439e3393d40 | SQL | sciserver/sqlloader | /schema/patches/04-perms.weblog.sql | UTF-8 | 606 | 3.234375 | 3 | [] | no_license | ---remove skyuser and webuser from weblog db if neccessary
print 'removing unneeded users from weblog db'
if (select count(*) from sys.database_principals where name = 'skyuser') != 0
begin
if (select COUNT(*) from sys.schemas where principal_id=USER_ID('skyuser')) != 0
begin
alter authorization on schema::skyuser TO dbo;
end
drop user skyuser;
end
if (select count(*) from sys.database_principals where name = 'webuser') != 0
begin
if (select COUNT(*) from sys.schemas where principal_id=USER_ID('webuser')) != 0
begin
alter authorization on schema::webuser TO dbo;
end
drop user webuser;
end | true |
3b7d2f0fbdaf817491643bd7621fd83b3a58f125 | SQL | hwxmcMST/SQL | /HW2I_createSKU_DATA.sql | UTF-8 | 270 | 3.015625 | 3 | [] | no_license | CREATE TABLE HW2I_SKU_DATA (
SKU Integer NOT NULL,
SKU_Description VarChar(30) NOT NULL,
Department VarChar(15) NULL,
Buyer VarChar(20) NULL,
CONSTRAINT HW2I_Sku_DataPK PRIMARY KEY (SKU)
); | true |
19cc5b1a416455968ac37aeb5726351515f0c993 | SQL | eHattori/multiverse | /database/tables/create_table_card.sql | UTF-8 | 1,020 | 3.046875 | 3 | [
"ISC"
] | permissive | -- use multiversedb_test executar em ambos ambientes;
use multiversedb;
CREATE TABLE quality(
quality_id int(15) NOT NULL AUTO_INCREMENT,
description varchar(2000) NOT NULL,
PRIMARY KEY (quality_id)
);
CREATE TABLE type(
type_id int(15) NOT NULL AUTO_INCREMENT,
description varchar(2000) NOT NULL,
PRIMARY KEY (type_id)
);
CREATE TABLE tag(
tag_id int(15) NOT NULL AUTO_INCREMENT,
description varchar(2000) NOT NULL,
PRIMARY KEY (tag_id)
);
CREATE TABLE card(
card_id int(15) NOT NULL AUTO_INCREMENT,
name varchar(100) NOT NULL,
imageUrl varchar(2000) NOT NULL,
description varchar(2000) NOT NULL,
quality_id int(15) NOT NULL,
tag_id int(15) NOT NULL,
type_id int(15) NOT NULL,
rarity int(2) NOT NULL,
user varchar(100) NOT NULL,
data DATE NOT NULL,
update_date DATE,
PRIMARY KEY (card_id),
FOREIGN KEY (quality_id) REFERENCES quality(quality_id),
FOREIGN KEY (tag_id) REFERENCES tag(tag_id),
FOREIGN KEY (type_id) REFERENCES type(type_id)
); | true |
8675b1e0e3023dfdf72b4d705b34895bbd63f33c | SQL | sshyran/gpdb | /src/test/tinc/tincrepo/mpp/gpdb/tests/storage/basic/exttab/read/sql/query03.sql | UTF-8 | 19,207 | 2.640625 | 3 | [
"Apache-2.0",
"PostgreSQL",
"LicenseRef-scancode-rsa-md4",
"OLDAP-2.8",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"BSD-3-Clause",
"Zlib",
"LicenseRef-scancode-zeusbench",
"LicenseRef-scancode-mit-modification-obligations",
"OpenSSL",
"MIT",
"LicenseRef-scancode-other-copyleft",
"bzip2-1.0.6"... | permissive | -- start_ignore
drop external table if exists ext_whois;
-- end_ignore
create external table ext_whois (
source_lineno int,
domain_name varchar(350),
subdomain varchar(150),
tld varchar(50),
ip_address inet,
ip_address_int bigint,
reverse_dns varchar(512),
reverse_domain varchar(350),
registrar varchar(200),
registrar_referral varchar(512),
whois_server varchar(512),
harvest_date timestamp with time zone,
created_on timestamp with time zone,
update_date timestamp with time zone,
expire_date timestamp with time zone,
rank int,
status char(1),
update_status int,
nameserver1 varchar(512),
nameserver1_domain_name varchar(350),
nameserver1_subdomain varchar(150),
nameserver1_tld varchar(50),
nameserver2 varchar(512),
nameserver2_domain_name varchar(350),
nameserver2_subdomain varchar(150),
nameserver2_tld varchar(50),
nameserver3 varchar(512),
nameserver3_domain_name varchar(350),
nameserver3_subdomain varchar(150),
nameserver3_tld varchar(50),
nameserver4 varchar(512),
nameserver4_domain_name varchar(350),
nameserver4_subdomain varchar(150),
nameserver4_tld varchar(50),
nameserver5 varchar(512),
nameserver5_domain_name varchar(350),
nameserver5_subdomain varchar(150),
nameserver5_tld varchar(50),
registrant_name varchar(200),
registrant_organization varchar(200),
registrant_email varchar(512),
registrant_email_domain varchar(350),
registrant_email_subdomain varchar(150),
registrant_email_tld varchar(50),
registrant_phone varchar(50),
registrant_fax varchar(50),
registrant_addrall varchar(1024),
registrant_street1 varchar(200),
registrant_street2 varchar(200),
registrant_street3 varchar(200),
registrant_city varchar(200),
registrant_state_province varchar(100),
registrant_postal_code varchar(50),
registrant_country varchar(100),
tech_name varchar(200),
tech_organization varchar(200),
tech_email varchar(512),
tech_email_domain varchar(350),
tech_email_subdomain varchar(150),
tech_email_tld varchar(50),
tech_phone varchar(50),
tech_fax varchar(50),
tech_addrall varchar(1024),
tech_street1 varchar(200),
tech_street2 varchar(200),
tech_street3 varchar(200),
tech_city varchar(200),
tech_state_province varchar(100),
tech_postal_code varchar(50),
tech_country varchar(100),
admin_name varchar(200),
admin_organization varchar(200),
admin_email varchar(512),
admin_email_domain varchar(350),
admin_email_subdomain varchar(150),
admin_email_tld varchar(50),
admin_phone varchar(50),
admin_fax varchar(50),
admin_addrall varchar(1024),
admin_street1 varchar(200),
admin_street2 varchar(200),
admin_street3 varchar(200),
admin_city varchar(200),
admin_state_province varchar(100),
admin_postal_code varchar(50),
admin_country varchar(100),
rec_path varchar(512),
raw_record text
)
location ('gpfdist://@hostname@:@gp_port@/whois.csv' )
format 'csv' (header quote as '"');
-- start_ignore
drop table if exists cpy_whois;
-- end_ignore
create table cpy_whois (
source_lineno int,
domain_name varchar(350),
subdomain varchar(150),
tld varchar(50),
ip_address inet,
ip_address_int bigint,
reverse_dns varchar(512),
reverse_domain varchar(350),
registrar varchar(200),
registrar_referral varchar(512),
whois_server varchar(512),
harvest_date timestamp with time zone,
created_on timestamp with time zone,
update_date timestamp with time zone,
expire_date timestamp with time zone,
rank int,
status char(1),
update_status int,
nameserver1 varchar(512),
nameserver1_domain_name varchar(350),
nameserver1_subdomain varchar(150),
nameserver1_tld varchar(50),
nameserver2 varchar(512),
nameserver2_domain_name varchar(350),
nameserver2_subdomain varchar(150),
nameserver2_tld varchar(50),
nameserver3 varchar(512),
nameserver3_domain_name varchar(350),
nameserver3_subdomain varchar(150),
nameserver3_tld varchar(50),
nameserver4 varchar(512),
nameserver4_domain_name varchar(350),
nameserver4_subdomain varchar(150),
nameserver4_tld varchar(50),
nameserver5 varchar(512),
nameserver5_domain_name varchar(350),
nameserver5_subdomain varchar(150),
nameserver5_tld varchar(50),
registrant_name varchar(200),
registrant_organization varchar(200),
registrant_email varchar(512),
registrant_email_domain varchar(350),
registrant_email_subdomain varchar(150),
registrant_email_tld varchar(50),
registrant_phone varchar(50),
registrant_fax varchar(50),
registrant_addrall varchar(1024),
registrant_street1 varchar(200),
registrant_street2 varchar(200),
registrant_street3 varchar(200),
registrant_city varchar(200),
registrant_state_province varchar(100),
registrant_postal_code varchar(50),
registrant_country varchar(100),
tech_name varchar(200),
tech_organization varchar(200),
tech_email varchar(512),
tech_email_domain varchar(350),
tech_email_subdomain varchar(150),
tech_email_tld varchar(50),
tech_phone varchar(50),
tech_fax varchar(50),
tech_addrall varchar(1024),
tech_street1 varchar(200),
tech_street2 varchar(200),
tech_street3 varchar(200),
tech_city varchar(200),
tech_state_province varchar(100),
tech_postal_code varchar(50),
tech_country varchar(100),
admin_name varchar(200),
admin_organization varchar(200),
admin_email varchar(512),
admin_email_domain varchar(350),
admin_email_subdomain varchar(150),
admin_email_tld varchar(50),
admin_phone varchar(50),
admin_fax varchar(50),
admin_addrall varchar(1024),
admin_street1 varchar(200),
admin_street2 varchar(200),
admin_street3 varchar(200),
admin_city varchar(200),
admin_state_province varchar(100),
admin_postal_code varchar(50),
admin_country varchar(100),
rec_path varchar(512),
raw_record text
)
;
select count(*) from ext_whois;
select count(*) from ext_whois where domain_name like '%viagra%';
copy cpy_whois FROM '@abs_srcdir@/data/whois.csv' csv header quote '"';
-- "
select count(*) from cpy_whois;
select count(*) from cpy_whois where domain_name like '%viagra%';
-- start_ignore
drop table if exists v_w;
-- end_ignore
create table v_w as select * from cpy_whois where domain_name like '%viagra%';
-- mpp-1561: sort distinct spill to disk/external sort
select count(*) from (select * from v_w union select * from cpy_whois) as foo;
select count(*) from (select * from v_w union all select * from cpy_whois) as foo;
select count(*) from (select distinct * from cpy_whois) as foo;
select count(*) from (select * from cpy_whois order by 1 limit 300000 offset 30000) as foo;
select count(*) from (select * from cpy_whois order by 1 limit 300000 offset 1000) as foo;
select source_lineno, domain_name from cpy_whois order by
source_lineno ,
domain_name ,
subdomain ,
tld ,
ip_address ,
ip_address_int ,
reverse_dns ,
reverse_domain ,
registrar ,
registrar_referral,
whois_server ,
harvest_date ,
created_on ,
update_date ,
expire_date ,
rank ,
status ,
update_status ,
nameserver1 ,
nameserver1_domain_name,
nameserver1_subdomain ,
nameserver1_tld ,
nameserver2 ,
nameserver2_domain_name ,
nameserver2_subdomain ,
nameserver2_tld ,
nameserver3 ,
nameserver3_domain_name ,
nameserver3_subdomain ,
nameserver3_tld ,
nameserver4 ,
nameserver4_domain_name ,
nameserver4_subdomain ,
nameserver4_tld ,
nameserver5 ,
nameserver5_domain_name,
nameserver5_subdomain ,
nameserver5_tld ,
registrant_name ,
registrant_organization ,
registrant_email ,
registrant_email_domain ,
registrant_email_subdomain,
registrant_email_tld ,
registrant_phone ,
registrant_fax ,
registrant_addrall ,
registrant_street1 ,
registrant_street2 ,
registrant_street3 ,
registrant_city ,
registrant_state_province,
registrant_postal_code ,
registrant_country,
tech_name ,
tech_organization ,
tech_email ,
tech_email_domain ,
tech_email_subdomain,
tech_email_tld ,
tech_phone ,
tech_fax ,
tech_addrall ,
tech_street1 ,
tech_street2 ,
tech_street3 ,
tech_city ,
tech_state_province ,
tech_postal_code ,
tech_country ,
admin_name ,
admin_organization ,
admin_email ,
admin_email_domain ,
admin_email_subdomain,
admin_email_tld ,
admin_phone ,
admin_fax ,
admin_addrall ,
admin_street1 ,
admin_street2 ,
admin_street3 ,
admin_city ,
admin_state_province,
admin_postal_code ,
admin_country ,
rec_path ,
raw_record
limit 10 offset 10;
-- variations on mpp-1247
select count(*) from (select * from v_w union select * from ext_whois) as foo;
select count(*) from (select * from v_w union all select * from ext_whois) as foo;
select count(*) from (select * from v_w intersect select * from ext_whois) as foo;
select count(*) from (select * from v_w intersect all select * from ext_whois) as foo;
select count(*) from (select * from v_w except select * from ext_whois) as foo;
select count(*) from (select * from v_w except all select * from ext_whois) as foo;
select count(*) from (select * from ext_whois except select * from v_w) as foo;
select count(*) from (select * from ext_whois except all select * from v_w) as foo;
--
-- bad csv (quote must be a single char)
--
-- start_ignore
drop external table if exists bad_whois;
-- end_ignore
create external table bad_whois (
source_lineno int,
domain_name varchar(350)
)
location ('gpfdist://@hostname@:@gp_port@/whois.csv' )
format 'csv' ( header quote as 'ggg');
select count(*) from bad_whois;
--
-- bad csv (ignore quoting)
--
-- start_ignore
drop external table if exists bad_whois;
-- end_ignore
create external table bad_whois (
source_lineno int,
domain_name varchar(350),
subdomain varchar(150),
tld varchar(50),
ip_address inet,
ip_address_int bigint,
reverse_dns varchar(512),
reverse_domain varchar(350),
registrar varchar(200),
registrar_referral varchar(512),
whois_server varchar(512),
harvest_date timestamp with time zone,
created_on timestamp with time zone,
update_date timestamp with time zone,
expire_date timestamp with time zone,
rank int,
status char(1),
update_status int,
nameserver1 varchar(512),
nameserver1_domain_name varchar(350),
nameserver1_subdomain varchar(150),
nameserver1_tld varchar(50),
nameserver2 varchar(512),
nameserver2_domain_name varchar(350),
nameserver2_subdomain varchar(150),
nameserver2_tld varchar(50),
nameserver3 varchar(512),
nameserver3_domain_name varchar(350),
nameserver3_subdomain varchar(150),
nameserver3_tld varchar(50),
nameserver4 varchar(512),
nameserver4_domain_name varchar(350),
nameserver4_subdomain varchar(150),
nameserver4_tld varchar(50),
nameserver5 varchar(512),
nameserver5_domain_name varchar(350),
nameserver5_subdomain varchar(150),
nameserver5_tld varchar(50),
registrant_name varchar(200),
registrant_organization varchar(200),
registrant_email varchar(512),
registrant_email_domain varchar(350),
registrant_email_subdomain varchar(150),
registrant_email_tld varchar(50),
registrant_phone varchar(50),
registrant_fax varchar(50),
registrant_addrall varchar(1024),
registrant_street1 varchar(200),
registrant_street2 varchar(200),
registrant_street3 varchar(200),
registrant_city varchar(200),
registrant_state_province varchar(100),
registrant_postal_code varchar(50),
registrant_country varchar(100),
tech_name varchar(200),
tech_organization varchar(200),
tech_email varchar(512),
tech_email_domain varchar(350),
tech_email_subdomain varchar(150),
tech_email_tld varchar(50),
tech_phone varchar(50),
tech_fax varchar(50),
tech_addrall varchar(1024),
tech_street1 varchar(200),
tech_street2 varchar(200),
tech_street3 varchar(200),
tech_city varchar(200),
tech_state_province varchar(100),
tech_postal_code varchar(50),
tech_country varchar(100),
admin_name varchar(200),
admin_organization varchar(200),
admin_email varchar(512),
admin_email_domain varchar(350),
admin_email_subdomain varchar(150),
admin_email_tld varchar(50),
admin_phone varchar(50),
admin_fax varchar(50),
admin_addrall varchar(1024),
admin_street1 varchar(200),
admin_street2 varchar(200),
admin_street3 varchar(200),
admin_city varchar(200),
admin_state_province varchar(100),
admin_postal_code varchar(50),
admin_country varchar(100),
rec_path varchar(512),
raw_record text
)
location ('gpfdist://@hostname@:@gp_port@/whois.csv' )
format 'csv' ( header quote as 'g');
-- ignore quoting (use g vs double quote)
--
select count(*) from bad_whois;
drop external table bad_whois;
--
-- invalid formatting (drop first column [source_line int])
--
-- start_ignore
drop external table if exists bad2_whois;
-- end_ignore
create external table bad2_whois (
domain_name varchar(350),
subdomain varchar(150),
tld varchar(50),
ip_address inet,
ip_address_int bigint,
reverse_dns varchar(512),
reverse_domain varchar(350),
registrar varchar(200),
registrar_referral varchar(512),
whois_server varchar(512),
harvest_date timestamp with time zone,
created_on timestamp with time zone,
update_date timestamp with time zone,
expire_date timestamp with time zone,
rank int,
status char(1),
update_status int,
nameserver1 varchar(512),
nameserver1_domain_name varchar(350),
nameserver1_subdomain varchar(150),
nameserver1_tld varchar(50),
nameserver2 varchar(512),
nameserver2_domain_name varchar(350),
nameserver2_subdomain varchar(150),
nameserver2_tld varchar(50),
nameserver3 varchar(512),
nameserver3_domain_name varchar(350),
nameserver3_subdomain varchar(150),
nameserver3_tld varchar(50),
nameserver4 varchar(512),
nameserver4_domain_name varchar(350),
nameserver4_subdomain varchar(150),
nameserver4_tld varchar(50),
nameserver5 varchar(512),
nameserver5_domain_name varchar(350),
nameserver5_subdomain varchar(150),
nameserver5_tld varchar(50),
registrant_name varchar(200),
registrant_organization varchar(200),
registrant_email varchar(512),
registrant_email_domain varchar(350),
registrant_email_subdomain varchar(150),
registrant_email_tld varchar(50),
registrant_phone varchar(50),
registrant_fax varchar(50),
registrant_addrall varchar(1024),
registrant_street1 varchar(200),
registrant_street2 varchar(200),
registrant_street3 varchar(200),
registrant_city varchar(200),
registrant_state_province varchar(100),
registrant_postal_code varchar(50),
registrant_country varchar(100),
tech_name varchar(200),
tech_organization varchar(200),
tech_email varchar(512),
tech_email_domain varchar(350),
tech_email_subdomain varchar(150),
tech_email_tld varchar(50),
tech_phone varchar(50),
tech_fax varchar(50),
tech_addrall varchar(1024),
tech_street1 varchar(200),
tech_street2 varchar(200),
tech_street3 varchar(200),
tech_city varchar(200),
tech_state_province varchar(100),
tech_postal_code varchar(50),
tech_country varchar(100),
admin_name varchar(200),
admin_organization varchar(200),
admin_email varchar(512),
admin_email_domain varchar(350),
admin_email_subdomain varchar(150),
admin_email_tld varchar(50),
admin_phone varchar(50),
admin_fax varchar(50),
admin_addrall varchar(1024),
admin_street1 varchar(200),
admin_street2 varchar(200),
admin_street3 varchar(200),
admin_city varchar(200),
admin_state_province varchar(100),
admin_postal_code varchar(50),
admin_country varchar(100),
rec_path varchar(512),
raw_record text
)
location ('gpfdist://@hostname@:@gp_port@/whois.csv' )
format 'csv' (header quote as '"');
-- "
select count(rec_path) from bad2_whois;
drop external table bad2_whois;
--
-- more invalid formatting -- treat a csv file as a text file
--
-- start_ignore
drop external table if exists bad3_whois;
-- end_ignore
create external table bad3_whois (
source_lineno int,
ip_address inet,
ip_address_int bigint,
reverse_dns varchar(512)
)
location ('gpfdist://@hostname@:@gp_port@/whois.csv' )
format 'text' (header delimiter '|');
select count(*) from bad3_whois;
drop external table bad3_whois;
--
-- try a bad location
--
-- start_ignore
drop external table if exists badt1;
-- end_ignore
create external table badt1 (x text)
location ('file://@hostname@@abs_srcdir@/data/no/such/place/badt1.tbl' )
format 'text' (delimiter '|');
select * from badt1;
drop external table badt1;
--
-- try a bad protocol
--
-- start_ignore
drop external table if exists badt2;
-- end_ignore
create external table badt2 (x text)
location ('bad_protocol://@hostname@@abs_srcdir@/data/no/such/place/badt2.tbl' )
format 'text' (delimiter '|');
--
-- get an error for missing gpfdist
--
create external table ext_missing(a int, b int)
location ('gpfdist://@hostname@:99/missing.csv')
format 'csv';
select count(*) from ext_missing;
drop external table ext_missing;
-- do the csv copy tests (adapted from copy.source)
--- test copying in CSV mode with various styles
--- of embedded line ending characters
-- start_ignore
drop table if exists extcpytest;
-- end_ignore
create temp table extcpytest (
style text,
test text,
filler int);
insert into extcpytest values('DOS',E'abc\r\ndef',1);
insert into extcpytest values('Unix',E'abc\ndef',2);
insert into extcpytest values('Mac',E'abc\rdef',3);
insert into extcpytest values(E'esc\\ape',E'a\\r\\\r\\\n\\nb',4);
copy extcpytest to '@gpfdist_datadir@/output/extcpytest.csv' csv;
copy extcpytest to '@gpfdist_datadir@/output/extcpytest.csv' csv quote 'z' escape E'Z';
-- start_ignore
drop external table if exists extcpytest2;
-- end_ignore
create external table extcpytest2 (
style text,
test text,
filler int)
location ('gpfdist://@hostname@:@gp_port@/output/extcpytest.csv')
format 'csv' ( quote as 'z' escape as 'Z');
select * from extcpytest except select * from extcpytest2 order by 1,2,3;
drop external table extcpytest2;
-- test header line feature
-- recreate gpfdist with header (-h) option
-- start_ignore
drop table if exists extcpytest3;
-- end_ignore
create temp table extcpytest3 (
c1 int,
-- "col with , comma" text,
-- "col with "" quote" int);
c2 text,
c3 int);
copy extcpytest3 from stdin csv header;
this is just a line full of junk that would error out if parsed
1,a,1
2,b,2
\.
copy extcpytest3 to '@gpfdist_datadir@/output/extcpytest3.csv' csv header quote 'z' escape E'Z' ;
-- start_ignore
drop external web table if exists gpfdist_curl;
-- end_ignore
CREATE EXTERNAL WEB TABLE gpfdist_curl (c1 text)
execute E'(@gpwhich_curl@ http://@hostname@:@gp_port@/output/extcpytest3.csv)'
on SEGMENT 0
FORMAT 'text' (header delimiter '|');
select * from gpfdist_curl;
DROP EXTERNAL TABLE gpfdist_curl;
--
-- MPP-1584: make -h work with small files
--
-- start_ignore
drop external table if exists extcpytest4;
-- end_ignore
create external table extcpytest4 (
c1 int,
c2 text,
c3 int)
location ('gpfdist://@hostname@:@gp_port@/output/extcpytest3.csv')
format 'csv' (header quote as 'z' escape as 'Z');
select * from extcpytest4;
-- start_ignore
drop external table if exists extcpytest5;
-- end_ignore
create external table extcpytest5 (
c1 int,
c2 text,
c3 int)
location ('file://@hostname@@gpfdist_datadir@/output/extcpytest3.csv')
format 'csv' ( header quote as 'z' escape as 'Z');
select * from extcpytest5;
drop external table extcpytest4;
drop external table extcpytest5;
| true |
6499a25c8cabf15744fd2e2e88c3a44e2ebf8897 | SQL | ojalaquellueva/gnrs | /import_user_data.sql | UTF-8 | 1,025 | 3.515625 | 4 | [
"MIT"
] | permissive | -- ----------------------------------------------------------
-- Import raw user data to table user_data_raw
--
-- Requires parameters:
-- $raw_data_tbl_temp --> :raw_data_tbl_temp (job-specific temp table)
-- $infile --> :infile
-- ----------------------------------------------------------
-- Create job-specific raw data table
DROP TABLE IF EXISTS :"raw_data_tbl_temp";
CREATE TABLE :"raw_data_tbl_temp" (
user_id text DEFAULT NULL,
country text DEFAULT NULL,
state_province text DEFAULT NULL,
county_parish text DEFAULT NULL
)
;
-- Import raw data
\COPY user_data_raw FROM :'infile' DELIMITER ',' CSV NULL AS 'NA' HEADER;
-- Delete existing records for this job, if any
DELETE FROM user_data_raw
WHERE job=:'job'
;
-- Insert records plus job# to main raw data table
INSERT INTO user_data_raw (
job,
user_id,
country,
state_province,
county_parish
)
SELECT
:'job',
user_id,
country,
state_province,
county_parish
FROM :"raw_data_temp"
;
-- Drop job-specific raw data table
DROP TABLE IF EXISTS :"raw_data_tbl_temp";
| true |
64388f9b36d7d4e6363818d32f8b4ce2104488c0 | SQL | Last-Mile-Health/LMD-Databases | /lastmile_ncha/view/view_community_geo_position_cha.sql | UTF-8 | 1,233 | 3.578125 | 4 | [] | no_license | use lastmile_ncha;
drop view if exists lastmile_ncha.view_community_geo_position_cha;
create view lastmile_ncha.view_community_geo_position_cha as
select
pc.community_id,
c.community,
pc.position_id_pk,
pc.position_id,
pc.health_facility_id,
f.health_facility,
f.health_district,
f.county,
s.position_supervisor_id_pk as chss_position_id_pk,
s.position_supervisor_id as chss_position_id,
concat( ps.first_name, ' ', ps.last_name ) as chss,
concat( a.first_name, ' ', a.last_name ) as cha
from lastmile_ncha.view_position_community as pc
left outer join lastmile_ncha.community as c on pc.community_id = c.community_id
left outer join lastmile_ncha.view_geo_health_facility as f on pc.health_facility_id like f.health_facility_id
left outer join lastmile_ncha.view_position_person as a on pc.position_id_pk = a.position_id_pk
left outer join lastmile_ncha.view_position_cha_supervisor as s on pc.position_id_pk = s.position_id_pk
left outer join lastmile_ncha.view_position_person as ps on s.position_supervisor_id_pk = ps.position_id_pk
; | true |
92de5c2fa5cb55343bce44c0cab8ed31af1746e9 | SQL | Himanshu0120/Training-Assignments | /SQL Assignment/Exercise 1/Query 7.sql | UTF-8 | 141 | 2.78125 | 3 | [] | no_license | SELECT ROW_NUMBER() OVER(ORDER BY FirstName) As 'ROW_NUMBER',
FirstName ,
LastName
FROM Person.Person
WHERE FirstName LIKE '%SS%'; | true |
db6b6aa5da528d13a433ea7cd157f66632637b89 | SQL | Mibburo/Master-Form | /contacts_2.sql | UTF-8 | 5,462 | 3.21875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Sep 27, 2016 at 03:30 PM
-- Server version: 5.7.11
-- PHP Version: 5.6.19
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `contacts_2`
--
-- --------------------------------------------------------
--
-- Table structure for table `contactaddresses`
--
CREATE TABLE `contactaddresses` (
`AddrId` int(11) NOT NULL,
`ContactId` int(11) NOT NULL,
`Prefecture` varchar(255) NOT NULL,
`City` varchar(255) NOT NULL,
`ConInfoType` varchar(255) NOT NULL,
`LocationType` varchar(255) NOT NULL,
`Street` varchar(255) NOT NULL,
`ZipCode` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `contactdetails`
--
CREATE TABLE `contactdetails` (
`EphoId` int(11) NOT NULL,
`ContactId` int(11) NOT NULL,
`ConInfoType` varchar(255) NOT NULL,
`LocationType` varchar(255) NOT NULL,
`Details` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `contactdetailstype`
--
CREATE TABLE `contactdetailstype` (
`ConInfoType` varchar(255) NOT NULL,
`LocationType` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `contactdetailstype`
--
INSERT INTO `contactdetailstype` (`ConInfoType`, `LocationType`) VALUES
('Address', 'Home'),
('Address', 'Work'),
('Email', 'Home'),
('Email', 'Work'),
('Phone', 'Home'),
('Phone', 'Mobile'),
('Phone', 'Work');
-- --------------------------------------------------------
--
-- Table structure for table `contacts`
--
CREATE TABLE `contacts` (
`ID` int(11) NOT NULL,
`FirstName` varchar(255) NOT NULL,
`LastName` varchar(255) NOT NULL,
`FatherName` varchar(255) NOT NULL,
`SSN` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `prefecturescities`
--
CREATE TABLE `prefecturescities` (
`PrefectureName` varchar(255) NOT NULL,
`CityName` varchar(255) NOT NULL,
`AreaCode` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `prefecturescities`
--
INSERT INTO `prefecturescities` (`PrefectureName`, `CityName`, `AreaCode`) VALUES
('Attikis', 'Athens', '210'),
('Attikis', 'Laurio', '22920'),
('Attikis', 'Marathonas', '22940'),
('Kykladon', 'Andros', '22820'),
('Kykladon', 'Naxos', '22850'),
('kykladon', 'Santorini', '22860'),
('Thessalonikis', 'Kalamaria', '2313'),
('Thessalonikis', 'Panorama', '2313'),
('Thessalonikis', 'Thessaloniki', '2310');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `contactaddresses`
--
ALTER TABLE `contactaddresses`
ADD PRIMARY KEY (`AddrId`,`ContactId`,`Prefecture`,`ConInfoType`),
ADD KEY `ContactId` (`ContactId`),
ADD KEY `ConInfoType` (`ConInfoType`),
ADD KEY `Prefecture` (`Prefecture`);
--
-- Indexes for table `contactdetails`
--
ALTER TABLE `contactdetails`
ADD PRIMARY KEY (`EphoId`,`ContactId`,`ConInfoType`),
ADD KEY `ContactId` (`ContactId`),
ADD KEY `ConInfoType` (`ConInfoType`);
--
-- Indexes for table `contactdetailstype`
--
ALTER TABLE `contactdetailstype`
ADD PRIMARY KEY (`ConInfoType`,`LocationType`);
--
-- Indexes for table `contacts`
--
ALTER TABLE `contacts`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `prefecturescities`
--
ALTER TABLE `prefecturescities`
ADD PRIMARY KEY (`PrefectureName`,`CityName`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `contactaddresses`
--
ALTER TABLE `contactaddresses`
MODIFY `AddrId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=70;
--
-- AUTO_INCREMENT for table `contactdetails`
--
ALTER TABLE `contactdetails`
MODIFY `EphoId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=150;
--
-- AUTO_INCREMENT for table `contacts`
--
ALTER TABLE `contacts`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `contactaddresses`
--
ALTER TABLE `contactaddresses`
ADD CONSTRAINT `contactaddresses_ibfk_1` FOREIGN KEY (`ContactId`) REFERENCES `contacts` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `contactaddresses_ibfk_2` FOREIGN KEY (`ConInfoType`) REFERENCES `contactdetailstype` (`ConInfoType`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `contactaddresses_ibfk_3` FOREIGN KEY (`Prefecture`) REFERENCES `prefecturescities` (`PrefectureName`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `contactdetails`
--
ALTER TABLE `contactdetails`
ADD CONSTRAINT `contactdetails_ibfk_1` FOREIGN KEY (`ContactId`) REFERENCES `contacts` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `contactdetails_ibfk_2` FOREIGN KEY (`ConInfoType`) REFERENCES `contactdetailstype` (`ConInfoType`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
47ac7ba845f3c4c92a9d4d84fbd013c652777a14 | SQL | vielhuber/gists | /gists/variables #sql/script.sql | UTF-8 | 414 | 3.203125 | 3 | [] | no_license | /* declare first */
SET @variable_name := column;
/* use */
SELECT variable_name FROM table
/* inline declaration */
SELECT @variable_name := column FROM table WHERE variable_name = 'foo'
/* alternative declaration */
SET @variable_name = column;
/* dynamic statements */
SET @variable_name = '* FROM foo';
PREPARE stmt1 FROM CONCAT('SELECT ',@variable_name,' LIMIT 1');
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1; | true |
a6c8d9c1f55bdd409cb3b22d8ca2c6964ecad617 | SQL | jothbc/PDV_JAVA_DESK | /oprincipiodb.sql | UTF-8 | 19,759 | 3.234375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 25-Jun-2019 às 21:30
-- Versão do servidor: 10.1.36-MariaDB
-- versão do PHP: 7.2.11
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: `oprincipiodb`
--
CREATE DATABASE IF NOT EXISTS `oprincipiodb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `oprincipiodb`;
-- --------------------------------------------------------
--
-- Estrutura da tabela `boleto`
--
DROP TABLE IF EXISTS `boleto`;
CREATE TABLE `boleto` (
`id` int(11) NOT NULL,
`fornecedor` int(11) DEFAULT NULL,
`codigo` varchar(44) DEFAULT NULL,
`valor` double DEFAULT NULL,
`vencimento` date DEFAULT NULL,
`pago` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estrutura da tabela `caixa`
--
DROP TABLE IF EXISTS `caixa`;
CREATE TABLE `caixa` (
`seq` int(11) NOT NULL,
`usuario_id` int(11) DEFAULT NULL,
`fundo` double DEFAULT '0',
`dinheiro` double DEFAULT '0',
`credito` double DEFAULT '0',
`debito` double DEFAULT '0',
`crediario` double DEFAULT '0',
`sangria` double DEFAULT '0',
`suprimento` double DEFAULT '0',
`inicial` int(11) DEFAULT NULL,
`final` int(11) DEFAULT NULL,
`data` date DEFAULT NULL,
`status` tinyint(4) DEFAULT '1',
`ip` varchar(45) DEFAULT NULL,
`dinheiro_inf` double DEFAULT '0',
`pos_inf` double DEFAULT '0',
`crediario_inf` double DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estrutura da tabela `cliente`
--
DROP TABLE IF EXISTS `cliente`;
CREATE TABLE `cliente` (
`id` int(11) NOT NULL,
`nome` varchar(200) DEFAULT NULL,
`cpf` varchar(20) DEFAULT NULL,
`telefone` varchar(20) DEFAULT NULL,
`email` varchar(200) DEFAULT NULL,
`crediario` double DEFAULT NULL,
`aniversario` date DEFAULT NULL,
`credito` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `cliente`
--
INSERT INTO `cliente` (`id`, `nome`, `cpf`, `telefone`, `email`, `crediario`, `aniversario`, `credito`) VALUES
(0, 'Consumidor Final', NULL, NULL, NULL, 0, NULL, NULL),
(1, 'RAYSLLA BARTOU', NULL, NULL, NULL, 0, '1996-05-22', 0),
(2, 'JONATHAN COMIN RIBEIRO', '092.459.469-16', '(47) 997432978', 'jothbc@gmail.com', 0, '1996-05-22', 0),
(9, 'SAMOEL', '092.459.469-16', NULL, NULL, 0, NULL, 0);
-- --------------------------------------------------------
--
-- Estrutura da tabela `combo`
--
DROP TABLE IF EXISTS `combo`;
CREATE TABLE `combo` (
`id` int(11) NOT NULL,
`codigo` varchar(20) NOT NULL,
`produto` varchar(20) DEFAULT NULL,
`quantidade` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `combo`
--
INSERT INTO `combo` (`id`, `codigo`, `produto`, `quantidade`) VALUES
(11, '321654', '2', 5),
(12, '321654', '4', 1),
(13, '321654', '5', 1),
(14, '321', '1', 1),
(15, '321', '2', 2),
(16, '321', '3', 3),
(22, '789', '2', 5),
(23, '789', '1', 5);
-- --------------------------------------------------------
--
-- Estrutura da tabela `contas`
--
DROP TABLE IF EXISTS `contas`;
CREATE TABLE `contas` (
`id` int(11) NOT NULL,
`descricao` varchar(200) DEFAULT NULL,
`valor` double DEFAULT NULL,
`vencimento` date DEFAULT NULL,
`pago` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `contas`
--
INSERT INTO `contas` (`id`, `descricao`, `valor`, `vencimento`, `pago`) VALUES
(1, 'uma conta qualquer', 100, '2019-05-23', '2019-05-23'),
(6, 'test3', 7, '2019-01-10', NULL),
(7, 'conta aleatoria', 102, '2019-12-20', NULL),
(8, 'uma grande', 10000, NULL, NULL);
-- --------------------------------------------------------
--
-- Estrutura da tabela `controle`
--
DROP TABLE IF EXISTS `controle`;
CREATE TABLE `controle` (
`id` int(11) NOT NULL,
`descricao` varchar(200) DEFAULT NULL,
`ativo` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `controle`
--
INSERT INTO `controle` (`id`, `descricao`, `ativo`) VALUES
(1, 'pdv_automatico', 1);
-- --------------------------------------------------------
--
-- Estrutura da tabela `fornecedor`
--
DROP TABLE IF EXISTS `fornecedor`;
CREATE TABLE `fornecedor` (
`id` int(11) NOT NULL,
`nome` varchar(200) NOT NULL,
`chave` int(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `fornecedor`
--
INSERT INTO `fornecedor` (`id`, `nome`, `chave`) VALUES
(8, 'SUPERMERCADO CORREIA', 2),
(9, 'FEMSA', 3),
(11, 'VIGOR', 4),
(13, 'ERBS COMERCIO ATACADISTA DE BEBIDAS LTDA', 5),
(14, 'ATACADAO S/A', 6),
(15, 'JONATHAN', 7),
(16, 'PARATI IND COM DE ALIM LTDA', 8),
(17, 'BREAD KING ALIMENTOS EIRELI', 9),
(18, 'BRF S.A', 10),
(19, 'AGRO SANDRI LTDA', 11),
(20, 'DISTRIBUIDORA DE CARNES DISTRIBOI LTDA', 12),
(21, 'DIBAGATIM ALIMENTOS LTDA ME', 13),
(22, 'IRMAOS FOLLE LTDA', 14),
(23, 'BEBIDAS MAX WILHELM LTDA', 15),
(24, 'NEZI DISTRIBUIDORA DE ALIMENTOS LTDA', 16),
(25, 'CENTRO COMERCIAL DE ALIMENTOS LTDA', 17),
(26, 'MCL COM E DIST DE GAS LTDA', 18),
(27, 'SPECHT PRODUTOS ALIMENTICIOS LTDA', 19),
(28, 'INDUSTRIA DE MASSAS ALIMENTICIAS ROSANE EIRELI', 20),
(29, 'TISCOSKI DISTRIBUIDORA COMERCIAL LTDA', 21),
(30, 'DAMA COMERCIO ATACADISTA DE ALIMENTOS LTDA EPP', 22),
(31, 'DOCES CASEIROS NAYANA LTDA ME', 23),
(32, 'BOA MESA COMERCIO DE ALIMENTOS EIRELI', 24),
(33, 'EMBRAST IND E COM DE EMBALAGENS LTDA', 25),
(34, 'BDL DISTRIB E LOGISTICA LTDA', 26),
(36, 'DISTRIBUIDORA MULLER COM E REPRES LTDA', 28),
(37, 'PEDRO MUFFATO E CIA LTDA', 29),
(38, 'RWR LOGISTICA E DISTRIBUICAO LTDA', 30),
(39, 'SPAL IND BRAS BEBIDAS SA', 31),
(40, 'FRISAJO AGRO PECUARIA INDUSTRIAL LTDA', 32),
(41, 'CORDIAL COMERCIO E DISTRIBUICAO LTDA', 33),
(42, 'SEARA ALIMENTOS LTDA', 34),
(43, 'WICKBOLD E NOSSO PAO LTDA', 35),
(44, 'JDC COMERCIO DE CALCADOS LTDA', 36),
(45, 'COOPERATIVA CENTRAL AURORA ALIMENTOS', 37);
-- --------------------------------------------------------
--
-- Estrutura da tabela `fornecedor_conta`
--
DROP TABLE IF EXISTS `fornecedor_conta`;
CREATE TABLE `fornecedor_conta` (
`id` int(11) NOT NULL,
`chave` int(11) NOT NULL,
`banco` int(11) DEFAULT '0',
`numero` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `fornecedor_conta`
--
INSERT INTO `fornecedor_conta` (`id`, `chave`, `banco`, `numero`) VALUES
(1, 2, 1, '123'),
(3, 3, 0, NULL),
(4, 4, 0, NULL),
(5, 5, 33, '8600'),
(6, 6, 1, '2572'),
(7, 7, 0, NULL),
(8, 8, 237, '0000'),
(9, 9, 748, '7789700000612001119369061726060800261104'),
(10, 10, 237, '23721900117'),
(11, 11, 422, '0020'),
(12, 12, 1, '1748'),
(13, 13, 85, '10100208877041000005'),
(14, 14, 1, '1615'),
(15, 15, 237, '0000'),
(16, 16, 341, '1236029722000'),
(17, 17, 341, '7365252423000'),
(18, 18, 756, '0013069012998181000'),
(19, 19, 237, '0000'),
(20, 20, 237, '0000'),
(21, 21, 341, '7776087160000'),
(22, 22, 85, '0019'),
(23, 23, 1, '2522'),
(24, 24, 85, '0951'),
(25, 25, 237, '2656090000018719'),
(26, 26, 237, '316109000004'),
(27, 5, 85, '0931'),
(28, 28, 1, '2204'),
(29, 29, 1, '0000001914619109154517'),
(30, 30, 237, '0000'),
(31, 31, 341, '2938361074000'),
(32, 32, 237, '81609090000046'),
(33, 33, 341, '4115'),
(34, 34, 1, '2711'),
(35, 35, 237, '2000'),
(36, 36, 237, '0000'),
(37, 37, 1, '2454');
-- --------------------------------------------------------
--
-- Estrutura da tabela `fornecedor_info`
--
DROP TABLE IF EXISTS `fornecedor_info`;
CREATE TABLE `fornecedor_info` (
`chave` int(4) NOT NULL,
`cnpj` varchar(50) DEFAULT NULL,
`cpf` varchar(50) DEFAULT NULL,
`telefone` varchar(50) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`ie` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `fornecedor_info`
--
INSERT INTO `fornecedor_info` (`chave`, `cnpj`, `cpf`, `telefone`, `email`, `ie`) VALUES
(2, '20.555.189/0001-96', NULL, '33615974', 'adm.supercorreia@gmail.com', '257393307'),
(6, '75.315.333/0125-49', NULL, '3247-4000', NULL, NULL);
-- --------------------------------------------------------
--
-- Estrutura da tabela `pagamento_pdv`
--
DROP TABLE IF EXISTS `pagamento_pdv`;
CREATE TABLE `pagamento_pdv` (
`seq` int(11) NOT NULL,
`movimento` int(11) NOT NULL,
`total` double DEFAULT NULL,
`troco` double DEFAULT NULL,
`dinheiro` double DEFAULT NULL,
`credito` double DEFAULT NULL,
`debito` double DEFAULT NULL,
`crediario` double DEFAULT NULL,
`desconto` double DEFAULT NULL,
`data` date DEFAULT NULL,
`pago` tinyint(1) DEFAULT NULL,
`data_pago` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `pagamento_pdv`
--
INSERT INTO `pagamento_pdv` (`seq`, `movimento`, `total`, `troco`, `dinheiro`, `credito`, `debito`, `crediario`, `desconto`, `data`, `pago`, `data_pago`) VALUES
(38, 1, 63.09, 0, 34.59, 6, 22.5, 0, 0, '2019-06-22', 1, NULL),
(39, 2, 37.99, 0, 0, 0, 0, 37.99, 0, '2019-06-22', 1, '2019-06-22'),
(40, 3, 68.99, 0, 68.99, 0, 0, 0, 0, '2019-06-22', 1, NULL),
(41, 4, 67.97, 0, 0, 0, 0, 67.97, 0, '2019-06-22', 1, '2019-06-22');
-- --------------------------------------------------------
--
-- Estrutura da tabela `pagamento_pos`
--
DROP TABLE IF EXISTS `pagamento_pos`;
CREATE TABLE `pagamento_pos` (
`seq` int(11) NOT NULL,
`movimento` int(11) DEFAULT NULL,
`parcela_data` date DEFAULT NULL,
`valor_total` double DEFAULT NULL,
`valor_parcela` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `pagamento_pos`
--
INSERT INTO `pagamento_pos` (`seq`, `movimento`, `parcela_data`, `valor_total`, `valor_parcela`) VALUES
(52, 1, '2019-07-22', 28.5, 2),
(53, 1, '2019-08-22', 28.5, 2),
(54, 1, '2019-09-22', 28.5, 2),
(55, 1, '2019-07-22', 28.5, 4.5),
(56, 1, '2019-08-22', 28.5, 4.5),
(57, 1, '2019-09-22', 28.5, 4.5),
(58, 1, '2019-10-22', 28.5, 4.5),
(59, 1, '2019-11-22', 28.5, 4.5);
-- --------------------------------------------------------
--
-- Estrutura da tabela `produto`
--
DROP TABLE IF EXISTS `produto`;
CREATE TABLE `produto` (
`id` int(11) NOT NULL,
`codigo` varchar(20) NOT NULL,
`descricao` varchar(200) DEFAULT NULL,
`custo` double DEFAULT '0',
`margem` double DEFAULT '0',
`venda` double DEFAULT '0',
`estoque` double DEFAULT '0',
`estoque_min` double DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `produto`
--
INSERT INTO `produto` (`id`, `codigo`, `descricao`, `custo`, `margem`, `venda`, `estoque`, `estoque_min`) VALUES
(1, '1', 'luminaria simples', 7, 50, 1, -2, 5),
(13, '11123', 'gato', 50, 20, 60, 2, 2),
(2, '2', 'luminaria trabalhada', 9, 50, 3.5, 11, 10),
(3, '3', 'kit lumi', 8, 50, 1.5, 21, 1),
(9, '321', 'COMBO TEST', NULL, 294.71, 149.99, NULL, NULL),
(10, '321654', 'combo 2', NULL, 175.84, 159.99, NULL, NULL),
(4, '4', 'corda', 7, 0, 1, 14.5, 1),
(5, '5', 'papel', 10, 199.8, 29.98, 2, 12),
(6, '6', 'lapis', 5, 20, 30.99, -24, 1),
(7, '7', 'lampada', 4, 2, 1.02, -2, 2),
(14, '789', 'COMBO DA RAY', NULL, 87.47, 149.98, NULL, NULL),
(8, '8', 'cartolina', 1, 10, 1.1, 15.329999999999998, 0);
-- --------------------------------------------------------
--
-- Estrutura da tabela `usuario`
--
DROP TABLE IF EXISTS `usuario`;
CREATE TABLE `usuario` (
`id` int(11) NOT NULL,
`nome` varchar(100) NOT NULL,
`senha` varchar(100) NOT NULL,
`privilegio` tinyint(4) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `usuario`
--
INSERT INTO `usuario` (`id`, `nome`, `senha`, `privilegio`) VALUES
(4, 'JONATHAN', '202CB962AC59075B964B07152D234B70', 1),
(5, 'RAYSLLA', '202CB962AC59075B964B07152D234B70', 1);
-- --------------------------------------------------------
--
-- Estrutura da tabela `venda_pdv`
--
DROP TABLE IF EXISTS `venda_pdv`;
CREATE TABLE `venda_pdv` (
`seq` int(11) NOT NULL,
`movimento` int(11) NOT NULL,
`id_cliente` int(11) DEFAULT NULL,
`p_codigo` varchar(50) DEFAULT NULL,
`p_descricao` varchar(200) DEFAULT NULL,
`p_venda` double DEFAULT NULL,
`p_qtd` double DEFAULT NULL,
`cancelado` tinyint(4) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `venda_pdv`
--
INSERT INTO `venda_pdv` (`seq`, `movimento`, `id_cliente`, `p_codigo`, `p_descricao`, `p_venda`, `p_qtd`, `cancelado`) VALUES
(202, 1, 0, '8', 'cartolina', 1.1, 1, 0),
(203, 1, 0, '7', 'lampada', 1.02, 1, 0),
(204, 1, 0, '6', 'lapis', 30.99, 1, 0),
(205, 1, 0, '5', 'papel', 29.98, 1, 0),
(206, 2, 2, '1', 'luminaria simples', 1, 1, 0),
(207, 2, 2, '2', 'luminaria trabalhada', 3.5, 1, 0),
(208, 2, 2, '3', 'kit lumi', 1.5, 1, 0),
(209, 2, 2, '4', 'corda', 1, 1, 0),
(210, 2, 2, '6', 'lapis', 30.99, 1, 0),
(211, 3, 0, '1', 'luminaria simples', 1, 1, 0),
(212, 3, 0, '2', 'luminaria trabalhada', 3.5, 1, 0),
(213, 3, 0, '3', 'kit lumi', 1.5, 1, 0),
(214, 3, 0, '4', 'corda', 1, 1, 0),
(215, 3, 0, '5', 'papel', 29.98, 1, 0),
(216, 3, 0, '6', 'lapis', 30.99, 1, 0),
(217, 3, 0, '7', 'lampada', 1.02, 1, 0),
(218, 4, 2, '1', 'luminaria simples', 1, 1, 0),
(219, 4, 2, '2', 'luminaria trabalhada', 3.5, 1, 0),
(220, 4, 2, '3', 'kit lumi', 1.5, 1, 0),
(221, 4, 2, '4', 'corda', 1, 1, 0),
(222, 4, 2, '5', 'papel', 29.98, 1, 0),
(223, 4, 2, '6', 'lapis', 30.99, 1, 0);
-- --------------------------------------------------------
--
-- Stand-in structure for view `vw_movimento`
-- (See below for the actual view)
--
DROP VIEW IF EXISTS `vw_movimento`;
CREATE TABLE `vw_movimento` (
`seq` int(11)
,`movimento` int(11)
,`id_cliente` int(11)
,`prod_cd` varchar(50)
,`prod_desc` varchar(200)
,`prod_valor` double
,`prod_qtd` double
,`total` double
,`troco` double
,`dinheiro` double
,`credito` double
,`debito` double
,`crediario` double
,`desconto` double
,`data` date
,`pago` tinyint(1)
,`data_pago` date
,`cancelado` tinyint(4)
);
-- --------------------------------------------------------
--
-- Stand-in structure for view `vw_venda`
-- (See below for the actual view)
--
DROP VIEW IF EXISTS `vw_venda`;
CREATE TABLE `vw_venda` (
`seq` int(11)
,`movimento` int(11)
,`cliente_id` int(11)
,`cliente_nome` varchar(200)
,`prod_cd` varchar(50)
,`prod_desc` varchar(200)
,`prod_valor` double
,`prod_qtd` double
,`total` double
,`troco` double
,`dinheiro` double
,`credito` double
,`debito` double
,`crediario` double
,`desconto` double
,`data` date
,`pago` tinyint(1)
,`data_pago` date
,`cancelado` tinyint(4)
);
-- --------------------------------------------------------
--
-- Structure for view `vw_movimento`
--
DROP TABLE IF EXISTS `vw_movimento`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vw_movimento` AS select `v`.`seq` AS `seq`,`v`.`movimento` AS `movimento`,`v`.`id_cliente` AS `id_cliente`,`v`.`p_codigo` AS `prod_cd`,`v`.`p_descricao` AS `prod_desc`,`v`.`p_venda` AS `prod_valor`,`v`.`p_qtd` AS `prod_qtd`,`p`.`total` AS `total`,`p`.`troco` AS `troco`,`p`.`dinheiro` AS `dinheiro`,`p`.`credito` AS `credito`,`p`.`debito` AS `debito`,`p`.`crediario` AS `crediario`,`p`.`desconto` AS `desconto`,`p`.`data` AS `data`,`p`.`pago` AS `pago`,`p`.`data_pago` AS `data_pago`,`v`.`cancelado` AS `cancelado` from (`venda_pdv` `v` join `pagamento_pdv` `p` on((`v`.`movimento` = `p`.`movimento`))) ;
-- --------------------------------------------------------
--
-- Structure for view `vw_venda`
--
DROP TABLE IF EXISTS `vw_venda`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vw_venda` AS select `vw_movimento`.`seq` AS `seq`,`vw_movimento`.`movimento` AS `movimento`,`vw_movimento`.`id_cliente` AS `cliente_id`,`cliente`.`nome` AS `cliente_nome`,`vw_movimento`.`prod_cd` AS `prod_cd`,`vw_movimento`.`prod_desc` AS `prod_desc`,`vw_movimento`.`prod_valor` AS `prod_valor`,`vw_movimento`.`prod_qtd` AS `prod_qtd`,`vw_movimento`.`total` AS `total`,`vw_movimento`.`troco` AS `troco`,`vw_movimento`.`dinheiro` AS `dinheiro`,`vw_movimento`.`credito` AS `credito`,`vw_movimento`.`debito` AS `debito`,`vw_movimento`.`crediario` AS `crediario`,`vw_movimento`.`desconto` AS `desconto`,`vw_movimento`.`data` AS `data`,`vw_movimento`.`pago` AS `pago`,`vw_movimento`.`data_pago` AS `data_pago`,`vw_movimento`.`cancelado` AS `cancelado` from (`vw_movimento` join `cliente` on((`vw_movimento`.`id_cliente` = `cliente`.`id`))) ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `boleto`
--
ALTER TABLE `boleto`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `caixa`
--
ALTER TABLE `caixa`
ADD PRIMARY KEY (`seq`);
--
-- Indexes for table `cliente`
--
ALTER TABLE `cliente`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `combo`
--
ALTER TABLE `combo`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `contas`
--
ALTER TABLE `contas`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `controle`
--
ALTER TABLE `controle`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `fornecedor`
--
ALTER TABLE `fornecedor`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `fornecedor_conta`
--
ALTER TABLE `fornecedor_conta`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `fornecedor_info`
--
ALTER TABLE `fornecedor_info`
ADD PRIMARY KEY (`chave`);
--
-- Indexes for table `pagamento_pdv`
--
ALTER TABLE `pagamento_pdv`
ADD PRIMARY KEY (`seq`);
--
-- Indexes for table `pagamento_pos`
--
ALTER TABLE `pagamento_pos`
ADD PRIMARY KEY (`seq`);
--
-- Indexes for table `produto`
--
ALTER TABLE `produto`
ADD PRIMARY KEY (`codigo`);
--
-- Indexes for table `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `venda_pdv`
--
ALTER TABLE `venda_pdv`
ADD PRIMARY KEY (`seq`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `boleto`
--
ALTER TABLE `boleto`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `caixa`
--
ALTER TABLE `caixa`
MODIFY `seq` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cliente`
--
ALTER TABLE `cliente`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `combo`
--
ALTER TABLE `combo`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
--
-- AUTO_INCREMENT for table `contas`
--
ALTER TABLE `contas`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `controle`
--
ALTER TABLE `controle`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `fornecedor`
--
ALTER TABLE `fornecedor`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;
--
-- AUTO_INCREMENT for table `fornecedor_conta`
--
ALTER TABLE `fornecedor_conta`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38;
--
-- AUTO_INCREMENT for table `pagamento_pdv`
--
ALTER TABLE `pagamento_pdv`
MODIFY `seq` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;
--
-- AUTO_INCREMENT for table `pagamento_pos`
--
ALTER TABLE `pagamento_pos`
MODIFY `seq` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=60;
--
-- AUTO_INCREMENT for table `usuario`
--
ALTER TABLE `usuario`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `venda_pdv`
--
ALTER TABLE `venda_pdv`
MODIFY `seq` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=224;
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 |
e4bdfc1d723046fd4989b3fc47a90530f17741e7 | SQL | lingkay/erp | /sql/old_dumps/hris.20150807.patch.sql | UTF-8 | 4,975 | 3.234375 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Aug 07, 2015 at 07:40 AM
-- Server version: 5.6.16
-- PHP Version: 5.5.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `hris2`
--
-- --------------------------------------------------------
--
-- Table structure for table `leave_type`
--
CREATE TABLE IF NOT EXISTS `leave_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_create_id` int(11) DEFAULT NULL,
`accrue_enabled` tinyint(1) NOT NULL,
`accrue_count` double DEFAULT NULL,
`carried_enabled` tinyint(1) NOT NULL,
`leave_count` double NOT NULL,
`service_months` int(11) DEFAULT NULL,
`payment_type` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`date_create` datetime NOT NULL,
`name` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL,
`addtl_requirements` longtext COLLATE utf8_unicode_ci,
`accrue_rule` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`carry_percentage` int(11) DEFAULT NULL,
`carry_period` int(11) DEFAULT NULL,
`gender` longtext COLLATE utf8_unicode_ci,
`emp_status` longtext COLLATE utf8_unicode_ci,
`count_type` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`notes` longtext COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`),
KEY `IDX_E2BC4391EEFE5067` (`user_create_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=12 ;
--
-- Dumping data for table `leave_type`
--
INSERT INTO `leave_type` (`id`, `user_create_id`, `accrue_enabled`, `accrue_count`, `carried_enabled`, `leave_count`, `service_months`, `payment_type`, `date_create`, `name`, `addtl_requirements`, `accrue_rule`, `carry_percentage`, `carry_period`, `gender`, `emp_status`, `count_type`, `notes`) VALUES
(2, NULL, 0, NULL, 0, 5, 12, 'FULL', '2015-07-26 23:20:33', 'Service Incentive Leave', NULL, NULL, NULL, NULL, 'a:2:{s:4:"Male";s:4:"Male";s:6:"Female";s:6:"Female";}', 'a:1:{s:7:"Regular";s:7:"Regular";}', 'per Year', 'Government-mandated leave for employees that have rendered at least 1 year of service in the company'),
(4, NULL, 1, 1, 1, 12, 12, 'NONE', '2015-08-07 05:06:51', 'Sick Leave', NULL, 'Yearly', 100, 8, 'a:2:{s:4:"Male";s:4:"Male";s:6:"Female";s:6:"Female";}', 'a:1:{s:7:"Regular";s:7:"Regular";}', 'per Year', '12 days of Leave for employees that are sick'),
(5, NULL, 0, NULL, 0, 7, 6, 'NONE', '2015-08-07 05:38:25', 'Paternity Leave', NULL, NULL, NULL, NULL, 'a:1:{s:4:"Male";s:4:"Male";}', 'a:1:{s:7:"Regular";s:7:"Regular";}', 'per Request', '7 days of leave for Male employees during Birth or Miscarriage of Legitimate Spouse'),
(6, NULL, 0, NULL, 0, 3, 6, 'NONE', '2015-08-07 05:51:17', 'Bereavement', NULL, NULL, NULL, NULL, 'a:2:{s:4:"Male";s:4:"Male";s:6:"Female";s:6:"Female";}', 'a:2:{s:12:"Probationary";s:12:"Probationary";s:7:"Regular";s:7:"Regular";}', 'per Request', '3 days of leave in the event of death of a family member.'),
(7, NULL, 0, NULL, 0, 7, 12, 'NONE', '2015-08-07 05:54:26', 'Solo Parent Leave', NULL, NULL, NULL, NULL, 'a:2:{s:4:"Male";s:4:"Male";s:6:"Female";s:6:"Female";}', 'a:2:{s:12:"Probationary";s:12:"Probationary";s:7:"Regular";s:7:"Regular";}', 'per Year', 'Persons who fall under the definition of solo parents and who have rendered service of at least one year are entitled to 7 working days of leave to attend to their parental duties.'),
(8, NULL, 0, NULL, 0, 2, 6, 'NONE', '2015-08-07 05:56:15', 'Calamity Leave', NULL, NULL, NULL, NULL, 'a:2:{s:4:"Male";s:4:"Male";s:6:"Female";s:6:"Female";}', 'a:2:{s:12:"Probationary";s:12:"Probationary";s:7:"Regular";s:7:"Regular";}', 'per Request', '2 days of leave for employees that are directly affected by calamity (e.g. Fire, Flood, Typhoon)'),
(9, NULL, 0, NULL, 0, 60, 6, 'NONE', '2015-08-07 05:58:21', 'Magna Carta for Women', NULL, NULL, NULL, NULL, 'a:1:{s:6:"Female";s:6:"Female";}', 'a:2:{s:12:"Probationary";s:12:"Probationary";s:7:"Regular";s:7:"Regular";}', 'per Request', 'Leave for female employees who underwent surgery caused by gynecological disorders'),
(10, NULL, 0, NULL, 0, 60, 6, 'FULL', '2015-08-07 06:00:25', 'Maternity Leave (Normal Delivery)', NULL, NULL, NULL, NULL, 'a:1:{s:6:"Female";s:6:"Female";}', 'a:2:{s:12:"Probationary";s:12:"Probationary";s:7:"Regular";s:7:"Regular";}', 'per Request', ''),
(11, NULL, 0, NULL, 0, 78, 6, 'FULL', '2015-08-07 06:01:21', 'Maternity Leave (Caesarian)', NULL, NULL, NULL, NULL, 'a:1:{s:6:"Female";s:6:"Female";}', 'a:2:{s:12:"Probationary";s:12:"Probationary";s:7:"Regular";s:7:"Regular";}', 'per Request', '');
/*!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 |
d9ab46295ee5760dcae6ad975fbe1547f559d15a | SQL | laiqwq/Drug-administration-system | /Drug administration system/drugmanager.sql | UTF-8 | 5,236 | 3.046875 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50556
Source Host : 127.0.0.1:3306
Source Database : drugmanager
Target Server Type : MYSQL
Target Server Version : 50556
File Encoding : 65001
Date: 2019-07-05 16:51:07
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for log4
-- ----------------------------
DROP TABLE IF EXISTS `log4`;
CREATE TABLE `log4` (
`date` varchar(50) DEFAULT NULL,
`category` varchar(500) DEFAULT NULL,
`message` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of log4
-- ----------------------------
-- ----------------------------
-- Table structure for saledrug
-- ----------------------------
DROP TABLE IF EXISTS `saledrug`;
CREATE TABLE `saledrug` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id` varchar(255) DEFAULT NULL,
`drug_id` varchar(255) DEFAULT NULL,
`sale_number` int(11) DEFAULT NULL,
`date` varchar(255) DEFAULT NULL,
`price` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of saledrug
-- ----------------------------
INSERT INTO `saledrug` VALUES ('1', '1', '2', '3', '4', '5');
INSERT INTO `saledrug` VALUES ('3', '4561111', '789', '7', '52222', '1152');
INSERT INTO `saledrug` VALUES ('4', '145', '2', '10', '36565', '1152');
INSERT INTO `saledrug` VALUES ('6', 'tom', 'drug01', '300', '2018-10-18', '1152');
-- ----------------------------
-- Table structure for stockdrug
-- ----------------------------
DROP TABLE IF EXISTS `stockdrug`;
CREATE TABLE `stockdrug` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bill_id` varchar(255) DEFAULT NULL,
`drug_id` varchar(255) DEFAULT NULL,
`price` double DEFAULT NULL,
`buy_num` int(11) DEFAULT NULL,
`date` varchar(255) DEFAULT NULL,
`supplier` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of stockdrug
-- ----------------------------
INSERT INTO `stockdrug` VALUES ('1', '1', '2', '3', '5', '5', '6');
INSERT INTO `stockdrug` VALUES ('23', '652', '10', '1222', '5', '125', '666');
INSERT INTO `stockdrug` VALUES ('24', '652', '5451252', '1152', '5', '5', '666');
INSERT INTO `stockdrug` VALUES ('25', '', '', null, null, '2018-10-02', '');
INSERT INTO `stockdrug` VALUES ('26', 'test1', 'drug01', '1152', '5000', '2018-10-04', '666');
INSERT INTO `stockdrug` VALUES ('36', '652', '54545454', null, '55555', '', '');
INSERT INTO `stockdrug` VALUES ('37', '652', '8544645', null, '55555', '', '');
INSERT INTO `stockdrug` VALUES ('38', '652', '45812121', null, '55555', '', '');
INSERT INTO `stockdrug` VALUES ('39', '652', '548555', null, '55555', '', '');
INSERT INTO `stockdrug` VALUES ('40', '652', '454848', null, '55555', '', '');
INSERT INTO `stockdrug` VALUES ('41', '652', '8546421', null, '55555', '', '');
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`usertype` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', 'admin', '123', '0');
INSERT INTO `user` VALUES ('11', 'sale', '123', '1');
INSERT INTO `user` VALUES ('25', 'abc', '123', '0');
INSERT INTO `user` VALUES ('26', 'ck', '123', '0');
INSERT INTO `user` VALUES ('27', 'cvvv', '123', '1');
-- ----------------------------
-- Table structure for warehouse
-- ----------------------------
DROP TABLE IF EXISTS `warehouse`;
CREATE TABLE `warehouse` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`drug_id` varchar(255) DEFAULT NULL,
`stock_number` int(11) DEFAULT NULL,
`manufacturer` varchar(255) DEFAULT NULL,
`standard` varchar(255) DEFAULT NULL,
`sale_price` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of warehouse
-- ----------------------------
INSERT INTO `warehouse` VALUES ('1', '1', '123', '3', '4', '5');
INSERT INTO `warehouse` VALUES ('2', '2', '150', null, null, null);
INSERT INTO `warehouse` VALUES ('3', '3', '435', null, null, null);
INSERT INTO `warehouse` VALUES ('4', '5', '0', null, null, null);
INSERT INTO `warehouse` VALUES ('5', '88', '1000', null, null, null);
INSERT INTO `warehouse` VALUES ('6', '789', '337', null, null, null);
INSERT INTO `warehouse` VALUES ('10', '4', '65', null, null, null);
INSERT INTO `warehouse` VALUES ('24', '54545454', '55555', null, null, null);
INSERT INTO `warehouse` VALUES ('25', '8544645', '55555', null, null, null);
INSERT INTO `warehouse` VALUES ('26', '45812121', '55555', null, null, null);
INSERT INTO `warehouse` VALUES ('27', '548555', '55555', null, null, null);
INSERT INTO `warehouse` VALUES ('28', '454848', '55555', null, null, null);
INSERT INTO `warehouse` VALUES ('29', '8546421', '55555', null, null, null);
| true |
6d4639ee5cd6f18c5642dc73fa5e966b76df3a1f | SQL | georgy-kirilov/SoftUni-MSSQL | /CourseLessons/SubqueriesAndJoins/Solutions-Problems-12-18.sql | UTF-8 | 2,109 | 4.15625 | 4 | [] | no_license | use [Geography];
-- Problem 12
select
c.CountryCode,
m.MountainRange,
p.PeakName,
p.Elevation
from Peaks as p
join Mountains as m
on p.MountainId = m.Id
join MountainsCountries as mc
on mc.MountainId = m.Id
join Countries as c
on mc.CountryCode = c.CountryCode
where
c.CountryCode = 'BG' and
p.Elevation > 2835
order by p.Elevation desc;
-- Problem 13
select
c.CountryCode,
count(c.CountryCode) as [MountainRanges]
from MountainsCountries as mc
join Countries as c
on mc.CountryCode = c.CountryCode
join Mountains as m
on mc.MountainId = m.Id
where c.CountryCode in ('BG', 'RU', 'US')
group by c.CountryCode;
-- Problem 14
select top(5)
c.CountryName,
r.RiverName
from Rivers as r
join CountriesRivers as cr
on cr.RiverId = r.Id
right join Countries as c
on cr.CountryCode = c.CountryCode
join Continents as cont
on c.ContinentCode = cont.ContinentCode
where cont.ContinentCode = 'AF'
order by c.CountryName asc;
-- Problem 15
select
ContinentCode,
CurrencyCode,
CurrencyCount as [CurrencyUsage]
from
(select
ContinentCode,
CurrencyCode,
[CurrencyCount],
dense_rank() over
(partition by ContinentCode order by CurrencyCount desc)
as [CurrencyRank]
from
(select
ContinentCode,
CurrencyCode,
count(*) as [CurrencyCount]
from Countries
group by ContinentCode, CurrencyCode
) as [CurrencyCountQuery]
where [CurrencyCount] > 1
) as [CurrencyRankingQuery]
where CurrencyRank = 1
order by ContinentCode asc;
-- Problem 16 => TODO
-- Problem 17
select top(5)
c.CountryName,
max(p.Elevation) as [HighestPeakElevation],
max(r.[Length]) as [LongestRiverLength]
from Countries as c
left join MountainsCountries as mc
on mc.CountryCode = c.CountryCode
left join Mountains as m
on mc.MountainId = m.Id
left join Peaks as p
on p.MountainId = m.Id
left join CountriesRivers as cr
on cr.CountryCode = c.CountryCode
left join Rivers as r
on cr.RiverId = r.Id
group by c.CountryName
order by
[HighestPeakElevation] desc,
[LongestRiverLength] desc,
c.CountryName asc; | true |
f93d4d8649e27472b820cf1b628ea558f8ad3fab | SQL | sixpathdev/revenuemgmt | /project.sql | UTF-8 | 6,174 | 3.046875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Aug 19, 2017 at 01:08 PM
-- Server version: 5.7.17-0ubuntu0.16.04.1
-- PHP Version: 7.0.15-0ubuntu0.16.04.4
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: `project`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`admin _id` int(11) NOT NULL,
`surname` varchar(200) NOT NULL,
`firstname` varchar(200) NOT NULL,
`othername` varchar(200) NOT NULL,
`mobile` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`admin _id`, `surname`, `firstname`, `othername`, `mobile`, `email`, `password`, `datetime`) VALUES
(1, 'Ani', 'Chukwuma', 'Mitchell', '08108440362', 'anichukwuma@gmail.com', 'ani01', '2017-06-28 15:44:06');
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE `category` (
`tax id` int(11) NOT NULL,
`taxcategory` varchar(200) NOT NULL,
`amount` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `category`
--
INSERT INTO `category` (`tax id`, `taxcategory`, `amount`) VALUES
(1, 'event centers', '10000'),
(2, 'fines', '5000'),
(3, 'market levy', '3000'),
(4, 'security', '2000'),
(5, 'waste management', '1000');
-- --------------------------------------------------------
--
-- Table structure for table `payment`
--
CREATE TABLE `payment` (
`payment_id` int(11) NOT NULL,
`email_address` varchar(200) NOT NULL,
`transaction_id` varchar(100) NOT NULL,
`taxcategory` varchar(200) NOT NULL,
`description` text NOT NULL,
`amount` varchar(200) NOT NULL,
`datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `payment`
--
INSERT INTO `payment` (`payment_id`, `email_address`, `transaction_id`, `taxcategory`, `description`, `amount`, `datetime`) VALUES
(1, 'okpala_chuks@yahoo.com', 'RMSYBJzIDWA', 'event centers', 'This is for the community town hall for a wedding purpose', '10000', '2017-06-26 13:01:47'),
(2, 'okpala_chuks@yahoo.com', 'RMShw7KZWO8', 'market levy', 'The monthly market levy', '3000', '2017-06-26 13:05:35'),
(27, 'okpala_chuks@yahoo.com', 'RMSme027UHq', 'market levy', 'market', '3000', '2017-08-02 11:12:11'),
(29, 'okpala_chuks@yahoo.com', 'RMS9h5L8kQD', 'fines', 'fines fines', '5000', '2017-08-05 15:54:08'),
(31, 'okpala_chuks@yahoo.com', 'RMS1sNaH6Lj', 'market levy', 'market oo', '3000', '2017-08-07 16:33:36'),
(32, 'okpala_chuks@yahoo.com', 'RMSMHTRv97G', 'market levy', 'market levy today', '3000', '2017-08-09 07:14:24'),
(33, 'okpala_chuks@yahoo.com', 'RMS8vx2BFnc', 'market levy', 'market levy for defence', '3000', '2017-08-09 10:09:44');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`userid` int(11) NOT NULL,
`surname` varchar(200) NOT NULL,
`firstname` varchar(200) NOT NULL,
`othername` varchar(200) NOT NULL,
`mobile` varchar(200) NOT NULL,
`occupation` varchar(200) NOT NULL,
`homeaddress` text NOT NULL,
`dob` date NOT NULL,
`email` varchar(200) NOT NULL,
`password` varchar(200) NOT NULL,
`sec_question` text NOT NULL,
`sec_answer` text NOT NULL,
`paid` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`userid`, `surname`, `firstname`, `othername`, `mobile`, `occupation`, `homeaddress`, `dob`, `email`, `password`, `sec_question`, `sec_answer`, `paid`) VALUES
(2, 'Okpala', 'Chukwualasu', 'Andrew', '08164544461', 'Trader', 'No 31, Block 2b, Banana Island, Lekki Lagos State ', '1991-08-12', 'okpala_chuks@yahoo.com', 'chuks01', 'What is the name of your favorite uncle?', 'Tony', 7),
(13, 'Agadi', 'ifeanyi', 'Daniel', '08108440362', 'Trader', 'no 45 Margaret catwright avenue,UNN,Nsukka', '1998-12-12', 'ifeanyi_agadi@gmail.com', 'name', 'What is the name of your favourite uncle?', 'ikechukwu', 0);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`admin _id`);
--
-- Indexes for table `category`
--
ALTER TABLE `category`
ADD PRIMARY KEY (`tax id`),
ADD KEY `taxcategory` (`taxcategory`,`amount`);
--
-- Indexes for table `payment`
--
ALTER TABLE `payment`
ADD PRIMARY KEY (`payment_id`),
ADD KEY `email_address` (`email_address`,`taxcategory`,`amount`),
ADD KEY `fk_taxcategory` (`taxcategory`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`userid`),
ADD KEY `email` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `admin _id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
MODIFY `tax id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `payment`
--
ALTER TABLE `payment`
MODIFY `payment_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `userid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `payment`
--
ALTER TABLE `payment`
ADD CONSTRAINT `fk_email` FOREIGN KEY (`email_address`) REFERENCES `users` (`email`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_taxcategory` FOREIGN KEY (`taxcategory`) REFERENCES `category` (`taxcategory`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
961e7c8ef06a9d53b6d39ebb22f0ce49d6067226 | SQL | TechnoPrep/nodejs-emp-tracker-sql | /db/seeds.sql | UTF-8 | 1,150 | 2.953125 | 3 | [
"MIT"
] | permissive | INSERT INTO department (department_name)
VALUES ("Sales"),
("Accounting"),
("Human Resources"),
("Business Integrations");
INSERT INTO role (title, salary, department_id)
VALUES ("Sales Manager", 90000, 1),
("Sales Lead", 80000, 1),
("Sales Representative", 45000, 1),
("Accounting Manager", 85000, 2),
("Accounting Lead", 75000, 2),
("Accounting Representative", 40000, 2),
("HR Manager", 80000, 3),
("HR Lead", 70000, 3),
("HR Representative", 35000, 3),
("BI Manager", 120000, 4),
("Systems Administrator", 100000, 4),
("Application Administrator", 85000, 4);
INSERT INTO employee (first_name, last_name, role_id, manager_id)
VALUES ("Jerry", "Smith", 1, NULL),
("Sally", "Sue", 2, 1),
("Bob", "Ross", 3, 1),
("Rick", "Sanchez", 4, NULL),
("Barbara", "Jones", 5, 4),
("Michael", "Ericson", 6, 4),
("Morty", "Mortison", 7, NULL),
("Sarah", "Henderson", 8, 7),
("Bill", "Hicks", 9, 7),
("Paul", "Paulson", 10, NULL),
("Bill", "Hicks", 11, 10),
("Larry", "David", 12, 10);
| true |
eb1a36a722078286ce5bfea07912597aab2efa5e | SQL | MathiasMinacapilli/BasesTarea2 | /scripts/biblioteca_constraints.sql | UTF-8 | 5,096 | 2.9375 | 3 | [] | no_license | --
-- Name: autores autores_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.autores
ADD CONSTRAINT autores_pkey PRIMARY KEY (cod_autor);
--
-- Name: dewey dewey_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.dewey
ADD CONSTRAINT dewey_pkey PRIMARY KEY (cod_dewey);
--
-- Name: editoriales editoriales_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.editoriales
ADD CONSTRAINT editoriales_pkey PRIMARY KEY (cod_editorial);
--
-- Name: forma_ingreso forma_ingreso_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.forma_ingreso
ADD CONSTRAINT forma_ingreso_pkey PRIMARY KEY (cod_forma_ingreso);
--
-- Name: funciones funciones_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.funciones
ADD CONSTRAINT funciones_pkey PRIMARY KEY (cod_funcion);
--
-- Name: inventario inventario_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.inventario
ADD CONSTRAINT inventario_pkey PRIMARY KEY (cod_registro);
--
-- Name: obra_autor obra_autor_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_autor
ADD CONSTRAINT obra_autor_pkey PRIMARY KEY (cod_obra, cod_autor, cod_funcion);
--
-- Name: obra_editorial obra_editorial_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_editorial
ADD CONSTRAINT obra_editorial_pkey PRIMARY KEY (cod_obra, cod_editorial);
--
-- Name: obra_tema obra_tema_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_tema
ADD CONSTRAINT obra_tema_pkey PRIMARY KEY (cod_tema, cod_obra);
--
-- Name: obras obras_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obras
ADD CONSTRAINT obras_pkey PRIMARY KEY (cod_obra);
--
-- Name: paises paises_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.paises
ADD CONSTRAINT paises_pkey PRIMARY KEY (cod_pais);
--
-- Name: temas temas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.temas
ADD CONSTRAINT temas_pkey PRIMARY KEY (cod_tema);
--
-- Name: inventario inventario_cod_forma_ingreso_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.inventario
ADD CONSTRAINT inventario_cod_forma_ingreso_fkey FOREIGN KEY (cod_forma_ingreso) REFERENCES public.forma_ingreso(cod_forma_ingreso);
--
-- Name: inventario inventario_cod_obra_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.inventario
ADD CONSTRAINT inventario_cod_obra_fkey FOREIGN KEY (cod_obra) REFERENCES public.obras(cod_obra);
--
-- Name: obra_autor obra_autor_cod_autor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_autor
ADD CONSTRAINT obra_autor_cod_autor_fkey FOREIGN KEY (cod_autor) REFERENCES public.autores(cod_autor);
--
-- Name: obra_autor obra_autor_cod_funcion_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_autor
ADD CONSTRAINT obra_autor_cod_funcion_fkey FOREIGN KEY (cod_funcion) REFERENCES public.funciones(cod_funcion);
--
-- Name: obra_autor obra_autor_cod_obra_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_autor
ADD CONSTRAINT obra_autor_cod_obra_fkey FOREIGN KEY (cod_obra) REFERENCES public.obras(cod_obra);
--
-- Name: obra_editorial obra_editorial_cod_editorial_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_editorial
ADD CONSTRAINT obra_editorial_cod_editorial_fkey FOREIGN KEY (cod_editorial) REFERENCES public.editoriales(cod_editorial);
--
-- Name: obra_editorial obra_editorial_cod_obra_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_editorial
ADD CONSTRAINT obra_editorial_cod_obra_fkey FOREIGN KEY (cod_obra) REFERENCES public.obras(cod_obra);
--
-- Name: obra_tema obra_tema_cod_obra_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_tema
ADD CONSTRAINT obra_tema_cod_obra_fkey FOREIGN KEY (cod_obra) REFERENCES public.obras(cod_obra);
--
-- Name: obra_tema obra_tema_cod_tema_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obra_tema
ADD CONSTRAINT obra_tema_cod_tema_fkey FOREIGN KEY (cod_tema) REFERENCES public.temas(cod_tema);
--
-- Name: obras obras_cod_dewey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obras
ADD CONSTRAINT obras_cod_dewey_fkey FOREIGN KEY (cod_dewey) REFERENCES public.dewey(cod_dewey);
--
-- Name: obras obras_pais_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.obras
ADD CONSTRAINT obras_pais_fkey FOREIGN KEY (pais) REFERENCES public.paises(cod_pais);
--
-- PostgreSQL database dump complete
--
| true |
97e2a0a1ad7f61bec634562e69aca4cb00a87329 | SQL | GaganCJ/SE-B4 | /database/database.sql | UTF-8 | 3,511 | 3.765625 | 4 | [] | no_license | /*To create this database locally in your system follow the following steps
1. Install PostgreSQL locally in your system . Follow the following steps to intsall it if not installed in ubuntu
1.Open the terminal (Ctrl+Alt+T)
2. Type $ sudo apt-get update
3. Type $ sudo apt-get install postgresql postgresql-contrib
2. Switch over postgres account on your server by typing
$ sudo -i -u postgres
3. Now access the postgres prompt by typing
$ psql
4.Now create the database 'Transport_Mangement_System' by typing the following command
CREATE DATABASE transport_management_system ;
5. Type the following command to connect/select this database
# \c transport_management_system
6. To Create the relations locallcy in the system run the following queries in your system
-----------------------------------------------------------------------------------------
Instead of manually copy-pasting these sql statements you can execute this file your terminal
After creating the database(After step 4) open the terminal where this file is located
1. Connect to the relevant database eg.
sudo -u postgres psql transport_management_system
2.Then run
\i database.sql
\i insert_dummy_val.sql
\i means execute commands from file
All commands will be executed
*/
/*
DROP DATABASE transport_management_system ;
CREATE DATABASE transport_management_system ;
\c transport_management_system
*/
CREATE TABLE Stu_Per_Data (
USN VARCHAR PRIMARY KEY NOT NULL,
Name CHAR(30) NOT NULL,
Email VARCHAR NOT NULL,
Parent_name CHAR(30) ,
Mobile_No VARCHAR NOT NULL,
Par_Mobile_No VARCHAR ,
Status boolean NOT NULL DEFAULT false,
latitude DOUBLE PRECISION,
longitude DOUBLE PRECISION,
password VARCHAR
);
CREATE TABLE USN_UID(
USN VARCHAR REFERENCES Stu_Per_Data(USN),
UID Serial NOT NULL PRIMARY KEY,
UNIQUE (USN, UID)
);
CREATE TABLE Driver (
Driver_id VARCHAR PRIMARY KEy,
Driver_name CHAR(50),
Mobile_No VARCHAR ,
password VARCHAR
);
CREATE TABLE Bus (
Bus_no VARCHAR PRIMARY KEY ,
Capacity INT
);
CREATE TABLE Bus_Driver(
Driver_id VARCHAR REFERENCES Driver,
Bus_no VARCHAR REFERENCES Bus,
PRIMARY KEY(Driver_id, Bus_no)
);
CREATE TABLE Trip (
Route_no INT PRIMARY KEY,
No_of_stu INT ,
timing TIME,
Bus_no VARCHAR REFERENCES Bus(Bus_no),
Driver_id VARCHAR REFERENCES Driver (Driver_id),
trip_id INT,
trip_date DATE,
status BOOLEAN DEFAULT FALSE
);
CREATE TABLE Stu_Trip_Data (
UID Serial REFERENCES USN_UID(uid) PRIMARY KEY NOT NULL ,
timing TIME ,
cancelled boolean DEFAULT false,
changed boolean DEFAULT false,
latitude DOUBLE PRECISION,
longitude DOUBLE PRECISION,
Route_no INT REFERENCES Trip(Route_no)
);
CREATE TABLE Fut_trip(
trip_id Serial PRIMARY KEY,
drop_pick boolean ,
trip_date DATE,
timing TIME
);
/* drop_pick 1=> from home
0=> from college
*/
CREATE TABLE Cancel_trip(
UID Serial REFERENCES USN_UID(UID),
trip_id Serial REFERENCES Fut_trip(trip_id),
PRIMARY KEY( UID, trip_id)
);
CREATE TABLE Chan_loc(
UID Serial REFERENCES USN_UID(UID),
trip_id Serial REFERENCES Fut_trip(trip_id),
latitude DOUBLE PRECISION,
longitude DOUBLE PRECISION,
PRIMARY KEY(UID, trip_id)
);
CREATE TABLE Chan_time(
UID Serial REFERENCES USN_UID(UID),
trip_id Serial REFERENCES Fut_trip(trip_id),
timing TIME,
PRIMARY KEY (UID,trip_id)
);
CREATE TABLE College_Loc(
latitude DOUBLE PRECISION,
longitude DOUBLE PRECISION,
PRIMARY KEY(latitude, longitude)
);
--INSERT INTO College_Loc VALUES (12.9345,77.5345);
| true |
2ca6a4372c006ae8f91bf2a3a394c266f8d23867 | SQL | kevinmcnamee/feedbackaro-script | /update.status.sql | UTF-8 | 379 | 3.578125 | 4 | [] | no_license | UPDATE issues SET status='open'
WHERE datetime(created_at, '+15 minutes') < CURRENT_TIMESTAMP;
UPDATE issues SET status='instructor needed'
WHERE datetime(created_at, '+45 minutes') < CURRENT_TIMESTAMP;
SELECT name, (strftime('%s', CURRENT_TIMESTAMP) - strftime('%s', issues.created_at))/60 AS minutes_open, content, status
FROM issues JOIN users
ON users.id = issues.user_id;
| true |
4845fc54d48a7e1f6f3183bf03e33e05465ec1fa | SQL | zola89/PrizeGame-Spring-Boot | /springbootuser.sql | UTF-8 | 3,685 | 3.15625 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: localhost Database: springbootuser
-- ------------------------------------------------------
-- Server version 5.7.20-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `code`
--
DROP TABLE IF EXISTS `code`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `code` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`prize_code` varchar(255) NOT NULL,
`prize_time` datetime DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`prize_type` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_9gxhbeppyh2mal8tu4ne06qda` (`prize_code`),
KEY `FK508awl0tukoqm5g9t13gvikxw` (`user_id`),
CONSTRAINT `FK508awl0tukoqm5g9t13gvikxw` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `code`
--
LOCK TABLES `code` WRITE;
/*!40000 ALTER TABLE `code` DISABLE KEYS */;
INSERT INTO `code` VALUES (34,'12345462',NULL,31,'zamena'),(35,'12345466','2018-09-13 01:08:23',31,'letovanje'),(36,'12345423',NULL,32,'zamena'),(37,'12345432',NULL,32,'automobil');
/*!40000 ALTER TABLE `code` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `hibernate_sequence`
--
DROP TABLE IF EXISTS `hibernate_sequence`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `hibernate_sequence` (
`next_val` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `hibernate_sequence`
--
LOCK TABLES `hibernate_sequence` WRITE;
/*!40000 ALTER TABLE `hibernate_sequence` DISABLE KEYS */;
INSERT INTO `hibernate_sequence` VALUES (1);
/*!40000 ALTER TABLE `hibernate_sequence` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`phone` varchar(13) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES (31,'Lazar','012312412'),(32,'Nada','0123dsf412');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-09-13 12:05:34
| true |
37edd9fd12b67cc24dff014e3bbc98b40d6fb64d | SQL | YaleArchivesSpace/data_cleanup_workgroup | /audit_queries/all_notes_w_uris.sql | UTF-8 | 1,372 | 3.15625 | 3 | [] | no_license | select CAST(note.notes as CHAR (500000) CHARACTER SET UTF8) AS Text
, CONCAT('/repositories/', resource.repo_id, '/resources/', resource.id) AS URI
, npi.persistent_id as persistent_id
from resource
JOIN note on note.resource_id = resource.id
JOIN note_persistent_id npi on npi.note_id = note.id
WHERE resource.repo_id = 5
UNION ALL
select CAST(note.notes as CHAR (500000) CHARACTER SET UTF8) AS Text
, CONCAT('/repositories/', ao.repo_id, '/archival_objects/', ao.id) AS URI
, npi.persistent_id as persistent_id
from archival_object ao
JOIN note on note.archival_object_id = ao.id
JOIN note_persistent_id npi on npi.note_id = note.id
WHERE ao.repo_id = 5
UNION ALL
select CAST(note.notes as CHAR (500000) CHARACTER SET UTF8) AS Text
, CONCAT('/repositories/', do.repo_id, 'digital_objects/', do.id) AS URI
, npi.persistent_id as persistent_id
from digital_object do
JOIN note on note.digital_object_id = do.id
JOIN note_persistent_id npi on npi.note_id = note.id
WHERE do.repo_id = 5
UNION ALL
select CAST(note.notes as CHAR (500000) CHARACTER SET UTF8) AS Text
, CONCAT('/repositories/', doc.repo_id, '/digital_object_components/', doc.id) AS URI
, npi.persistent_id as persistent_id
from digital_object_component doc
JOIN note on note.digital_object_component_id = doc.id
JOIN note_persistent_id npi on npi.note_id = note.id
WHERE doc.repo_id = 5
| true |
33e068d9de6a558eda470d0f6d8ed984d42f8585 | SQL | alexmister13/ciudades | /BBDD_ciudadades.sql | UTF-8 | 3,623 | 2.8125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 13-11-2017 a las 17:18:36
-- Versión del servidor: 10.1.26-MariaDB
-- Versión de PHP: 7.1.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `id3642059_pruebafinal`
--
CREATE DATABASE IF NOT EXISTS `ciudades_hosting` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `ciudades_hosting`;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbciudades`
--
CREATE TABLE `tbciudades` (
`id` int(3) NOT NULL,
`ciudad` varchar(200) NOT NULL,
`descripcion` varchar(800) NOT NULL,
`activo` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `tbciudades`
--
INSERT INTO `tbciudades` (`id`, `ciudad`, `descripcion`, `activo`) VALUES
(1, 'Londres', 'descripcion Londres', 1),
(2, 'Paris', 'descripcion Paris', 1),
(3, 'Roma', 'descripcion Roma', 1),
(6, 'Praga', 'descripcion praga', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbimagenes`
--
CREATE TABLE `tbimagenes` (
`id` int(3) NOT NULL,
`imagen` varchar(200) NOT NULL,
`idciudad` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `tbimagenes`
--
INSERT INTO `tbimagenes` (`id`, `imagen`, `idciudad`) VALUES
(7, 'uploads/7_Londres_1.jpg', 1),
(8, 'uploads/8_Londres_2.jpg', 1),
(9, 'uploads/9_Londres_3.jpg', 1),
(10, 'uploads/10_Paris_1.jpg', 2),
(11, 'uploads/11_Paris_2.jpg', 2),
(12, 'uploads/12_Roma_1.jpg', 3),
(13, 'uploads/13_Roma_2.jpg', 3),
(14, 'uploads/14_Roma_3.jpg', 3),
(15, 'uploads/15_praga.jpg', 6),
(16, 'uploads/16_praga.jpg', 6);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbusuarios`
--
CREATE TABLE `tbusuarios` (
`id` int(3) NOT NULL,
`nombreCompleto` varchar(200) NOT NULL,
`user` varchar(200) NOT NULL,
`pass` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `tbusuarios`
--
INSERT INTO `tbusuarios` (`id`, `nombreCompleto`, `user`, `pass`) VALUES
(25, 'Pedro López', 'plopez', '81dc9bdb52d04dc20036dbd8313ed055'),
(27, 'María Ruíz', 'mruiz', '81dc9bdb52d04dc20036dbd8313ed055');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `tbciudades`
--
ALTER TABLE `tbciudades`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `tbimagenes`
--
ALTER TABLE `tbimagenes`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `tbusuarios`
--
ALTER TABLE `tbusuarios`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `user` (`user`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `tbciudades`
--
ALTER TABLE `tbciudades`
MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT de la tabla `tbimagenes`
--
ALTER TABLE `tbimagenes`
MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT de la tabla `tbusuarios`
--
ALTER TABLE `tbusuarios`
MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
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 |
ed462122dab7827d10594e250d4b3ee2304134f8 | SQL | artmanu1995/30PercentPro2 | /Database MySQL Export/restaurant_db.sql | UTF-8 | 8,489 | 3.046875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.6
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Sep 13, 2017 at 10:52 AM
-- Server version: 5.7.17-log
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `restaurant_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `data_foods`
--
CREATE TABLE `data_foods` (
`food_id` text NOT NULL,
`food_name` text NOT NULL,
`food_price` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `data_foods`
--
INSERT INTO `data_foods` (`food_id`, `food_name`, `food_price`) VALUES
('01', 'ตำถาด', 150),
('02', 'ตำทะเล', 60),
('03', 'ตำปูม้า', 50),
('04', 'ตำกุ้งสด', 50),
('05', 'ตำมั่ว', 50),
('06', 'ตำไทย', 40),
('07', 'ตำปูปลาร้า', 40),
('08', 'ตำถั่ว', 40),
('09', 'ตำเเตง', 40),
('10', 'ตำลาว', 40);
-- --------------------------------------------------------
--
-- Table structure for table `data_listorder`
--
CREATE TABLE `data_listorder` (
`listO_id` int(11) NOT NULL,
`food_id` text NOT NULL,
`listO_amount` int(11) NOT NULL,
`listO_hot` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `data_listorder`
--
INSERT INTO `data_listorder` (`listO_id`, `food_id`, `listO_amount`, `listO_hot`) VALUES
(1, '03', 1, 1),
(2, '04', 1, 1),
(3, '05', 1, 1),
(4, '01', 1, 1),
(5, '01', 1, 2),
(6, '03', 1, 1),
(7, '03', 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `data_listpayment`
--
CREATE TABLE `data_listpayment` (
`listP_id` int(11) NOT NULL,
`payment_id` int(11) NOT NULL,
`listO_id` int(11) NOT NULL,
`listP_price` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `data_order`
--
CREATE TABLE `data_order` (
`order_openTable` int(11) NOT NULL,
`table_id` text NOT NULL,
`listO_id` int(11) NOT NULL,
`order_date` date NOT NULL,
`user_id` int(11) NOT NULL,
`sttPay_id` int(11) NOT NULL,
`sttSO_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `data_order`
--
INSERT INTO `data_order` (`order_openTable`, `table_id`, `listO_id`, `order_date`, `user_id`, `sttPay_id`, `sttSO_id`) VALUES
(27, '01', 1, '2017-09-13', 4, 1, 1),
(28, '01', 2, '2017-09-13', 4, 1, 1),
(29, '01', 3, '2017-09-13', 4, 1, 1),
(30, '02', 4, '2017-09-13', 4, 1, 1),
(31, '09', 5, '2017-09-13', 4, 1, 1),
(32, '01', 6, '2017-09-13', 4, 1, 1),
(33, '03', 7, '2017-09-13', 4, 1, 0);
-- --------------------------------------------------------
--
-- Table structure for table `data_payment`
--
CREATE TABLE `data_payment` (
`payment_id` int(11) NOT NULL,
`table_id` int(11) NOT NULL,
`payment_date` datetime(6) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `data_position`
--
CREATE TABLE `data_position` (
`position_id` int(11) NOT NULL,
`position_name` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `data_position`
--
INSERT INTO `data_position` (`position_id`, `position_name`) VALUES
(1, 'พนักงานรับ Order และ พนักงานห้องครัว'),
(2, 'พนักงาน Cashier'),
(3, 'Admin');
-- --------------------------------------------------------
--
-- Table structure for table `data_statuspayment`
--
CREATE TABLE `data_statuspayment` (
`sttPay_id` int(11) NOT NULL,
`sttPay_name` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `data_statuspayment`
--
INSERT INTO `data_statuspayment` (`sttPay_id`, `sttPay_name`) VALUES
(0, 'ชำระเเล้ว'),
(1, 'ยังไม่ชำระ');
-- --------------------------------------------------------
--
-- Table structure for table `data_statussendorder`
--
CREATE TABLE `data_statussendorder` (
`sttSO_id` int(11) NOT NULL,
`sttSO_name` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `data_statussendorder`
--
INSERT INTO `data_statussendorder` (`sttSO_id`, `sttSO_name`) VALUES
(0, 'ส่งเเล้ว'),
(1, 'ยังไม่ส่ง');
-- --------------------------------------------------------
--
-- Table structure for table `data_statustable`
--
CREATE TABLE `data_statustable` (
`sttTable_id` int(11) NOT NULL,
`sttTable_name` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `data_statustable`
--
INSERT INTO `data_statustable` (`sttTable_id`, `sttTable_name`) VALUES
(0, 'ว่าง'),
(1, 'ไม่ว่าง');
-- --------------------------------------------------------
--
-- Table structure for table `data_table`
--
CREATE TABLE `data_table` (
`table_id` text NOT NULL,
`sttTable_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `data_table`
--
INSERT INTO `data_table` (`table_id`, `sttTable_id`) VALUES
('01', 1),
('02', 1),
('03', 1),
('04', 0),
('05', 0),
('06', 0),
('07', 0),
('08', 0),
('09', 1);
-- --------------------------------------------------------
--
-- Table structure for table `data_users`
--
CREATE TABLE `data_users` (
`user_id` int(11) NOT NULL,
`user_username` text NOT NULL,
`user_password` text NOT NULL,
`user_name` text NOT NULL,
`position_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `data_users`
--
INSERT INTO `data_users` (`user_id`, `user_username`, `user_password`, `user_name`, `position_id`) VALUES
(1, 'earth', '1234', 'วโรตม์ คำมา', 1),
(2, 'ass', '1234', 'สุรชัย คำมา', 1),
(3, 'nang', '1234', 'พรศิริ คำมา', 2),
(4, 'art', '1234', 'จักรกฤษณ์ คำมา', 3);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `data_foods`
--
ALTER TABLE `data_foods`
ADD PRIMARY KEY (`food_id`(3));
--
-- Indexes for table `data_listorder`
--
ALTER TABLE `data_listorder`
ADD PRIMARY KEY (`listO_id`);
--
-- Indexes for table `data_listpayment`
--
ALTER TABLE `data_listpayment`
ADD PRIMARY KEY (`listP_id`);
--
-- Indexes for table `data_order`
--
ALTER TABLE `data_order`
ADD PRIMARY KEY (`order_openTable`);
--
-- Indexes for table `data_payment`
--
ALTER TABLE `data_payment`
ADD PRIMARY KEY (`payment_id`);
--
-- Indexes for table `data_position`
--
ALTER TABLE `data_position`
ADD PRIMARY KEY (`position_id`);
--
-- Indexes for table `data_statuspayment`
--
ALTER TABLE `data_statuspayment`
ADD PRIMARY KEY (`sttPay_id`);
--
-- Indexes for table `data_statussendorder`
--
ALTER TABLE `data_statussendorder`
ADD PRIMARY KEY (`sttSO_id`);
--
-- Indexes for table `data_statustable`
--
ALTER TABLE `data_statustable`
ADD PRIMARY KEY (`sttTable_id`);
--
-- Indexes for table `data_table`
--
ALTER TABLE `data_table`
ADD PRIMARY KEY (`table_id`(2));
--
-- Indexes for table `data_users`
--
ALTER TABLE `data_users`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `data_listpayment`
--
ALTER TABLE `data_listpayment`
MODIFY `listP_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_order`
--
ALTER TABLE `data_order`
MODIFY `order_openTable` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT for table `data_payment`
--
ALTER TABLE `data_payment`
MODIFY `payment_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `data_position`
--
ALTER TABLE `data_position`
MODIFY `position_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `data_users`
--
ALTER TABLE `data_users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
/*!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 |
c51ada11eaa76db618598a1f35887d1b94f9e8aa | SQL | nimehjadallah/second_project | /schema.sql | UTF-8 | 4,552 | 3.34375 | 3 | [] | no_license | -- DROP DATABASE IF EXISTS exampledb;
-- CREATE DATABASE exampledb;
-- DROP DATABASE IF EXISTS testdb;
-- CREATE DATABASE testdb;
DROP DATABASE IF EXISTS recipes_db;
CREATE DATABASE recipes_db;
Use recipes_db;
INSERT INTO recipes (name, ingredients, steps, createdAt, updatedAt)
Values ("Cilantro Pistachio Pesto Shrimp Pasta", "Shrimp, Pasta, Cilantro, Pistachios,jalapeño, garlic cloves, lime juice, olive oil, garlic powder, salt and pepper. ",
"Make the pesto by adding the following to the bowl of a food processor: cilantro, pistachios, jalapeño, garlic cloves, lime juice, olive oil, water and salt and pepper. Process until smooth, scraping down the sides and processing again, if necessary.
Next cook the shrimp: add olive oil to a large skillet or pan and place over medium high heat. Add in shrimp, garlic powder and salt and pepper; cook until shrimp is no longer pink. Remove from heat and set aside.
Cook the pasta until al dente, according to the directions on the package. Drain pasta, then add back to pot. Stir in the pesto and shrimp until well coated. Add pasta to bowls and garnish with goat cheese, a few
cilantro leaves and a sprinkle of crushed pistachios. Serve immediately. Makes about 4 servings.", now(), now());
INSERT INTO recipes (name, ingredients, steps, createdAt, updatedAt)
Values ("Chicken Picata", "1/4 cup all-purpose flour
1/2 teaspoon salt
1/2 teaspoon pepper
4 boneless skinless chicken breast halves (4 ounces each)
1/4 cup butter, cubed
1/4 cup white wine or chicken broth
1 tablespoon lemon juice" , "In a shallow bowl, mix flour, salt and pepper. Pound chicken breasts with a meat mallet to 1/2-in. thickness. Dip chicken in flour mixture to coat both sides; shake off excess.
In a large skillet, heat butter over medium heat. Brown chicken on both sides. Add wine; bring to a boil. Reduce heat; simmer, uncovered, until chicken is no longer pink, 12-15 minutes. Drizzle with lemon juice. If desired, sprinkle with parsley." now(), now());
INSERT INTO recipes (name, ingredients, steps, createdAt, updatedAt)
Values ("Baked Lemon Chicken", "1 1/4 pounds boneless skinless chicken breasts
1 tablespoon olive oil
salt and pepper to taste
1 teaspoon Italian seasoning
3 tablespoons butter melted
1 teaspoon minced garlic
1/4 cup chicken broth
2 tablespoons lemon juice
1 tablespoon chopped parsley
lemon slices for serving (optional)" , "Preheat the oven to 400 degrees. Season the chicken breasts on both sides with salt, pepper and the Italian seasoning.
Heat the olive oil in a large pan over medium high heat. Add the chicken breasts and cook for 3-5 minutes on each side or until browned.
Transfer the chicken to a baking dish.
In a small bowl, mix together the butter, garlic, chicken broth and lemon juice. Pour the butter mixture over the chicken.
Bake for 25 minutes or until chicken is cooked through. Bake time may vary depending on the thickness of your chicken breasts.
Spoon the sauce on the bottom of the baking dish over the chicken, then sprinkle with parsley and serve. Garnish with lemon slices if desired." now(), now());
INSERT INTO recipes (name, ingredients, steps, createdAt, updatedAt)
Values ("Dark Chocolate Fondue", "8
oz bittersweet baking chocolate, chopped
8
oz semisweet baking chocolate, chopped
1
pint (2 cups) whipping cream
1
tablespoon vanilla
1
package (10.75 oz) frozen pound cake, cut into 1-inch cubes
40
small fresh strawberries
40
apple slices
Kiwifruit, cut up, if desired" , "In 2-quart heavy saucepan, heat both chocolates and the whipping cream over low heat, stirring frequently, until cream is hot and chocolate is melted. Stir with wire whisk until smooth. Stir in vanilla. Pour into fondue pot. Keep warm with fuel canister on low heat.
Arrange cake and fruit dippers on platter. Set fondue pot in center of platter." now(), now());
INSERT INTO recipes (name, ingredients, steps, createdAt, updatedAt)
Values ("Milk Chocolate Fondue", "2/3
cup half-and-half
12
oz milk chocolate or 1 bag (11.5 oz) milk chocolate chips (2 cups))
2
tablespoons orange-flavored liqueur, kirsch, brandy or half-and-half
Dippers (pound cake cubes, strawberries, pineapple chunks, apple slices, marshmallows)" , "In 2-quart heavy saucepan, heat half-and-half and chocolate over low heat, stirring constantly, until chocolate is melted and mixture is smooth; remove from heat. Stir in liqueur. Pour into fondue pot or chafing dish.
Spear Dippers with fondue forks; dip into fondue. (If fondue becomes too thick, stir in a small amount of half-and-half.)" now(), now()); | true |
438453c20e34f3356c90f7ae345640c88488a54e | SQL | IF65/script | /contabilita/aggiornamento_contabilita.sql | UTF-8 | 7,899 | 3.046875 | 3 | [] | no_license | /*sistemazione numero ddt*/
update `db_sm`.fatture_ca as fca set fca.`numero_bolla_fornitore`=trim(leading 'TC/' FROM fca.`numero_bolla_fornitore`)
where fca.`codice_fornitore`='100860' and fca.`numero_bolla_fornitore` like 'TC/%';
update `db_sm`.fatture_ca as fca set fca.`numero_bolla_fornitore`=trim(trailing '/K' FROM fca.`numero_bolla_fornitore`)
where fca.`codice_fornitore`='100438' and fca.`numero_bolla_fornitore` like '%/K';
update `db_sm`.fatture_ca as fca set fca.`numero_bolla_fornitore`=trim(trailing '/03' FROM fca.`numero_bolla_fornitore`)
where fca.`codice_fornitore`='000077' and fca.`numero_bolla_fornitore` like '%/03';
update `db_sm`.fatture_ca as fca set fca.`numero_bolla_fornitore`=trim(leading '1-' FROM fca.`numero_bolla_fornitore`)
where fca.`codice_fornitore`='100480' and fca.`numero_bolla_fornitore` like '1-%';
update `db_sm`.fatture_ca as fca set fca.`numero_bolla_fornitore`=trim(trailing '/WD' FROM fca.`numero_bolla_fornitore`)
where fca.`codice_fornitore`='100903' and fca.`numero_bolla_fornitore` like '%/WD';
update `db_sm`.fatture_ca as fca set fca.`numero_bolla_fornitore`=trim(leading 'F' FROM fca.`numero_bolla_fornitore`)
where fca.`codice_fornitore`='100912' and fca.`numero_bolla_fornitore` like 'F%';
update `db_sm`.fatture_ca as fca set fca.`numero_bolla_fornitore`=trim(trailing '/16' FROM fca.`numero_bolla_fornitore`)
where fca.`codice_fornitore`='100816' and fca.`numero_bolla_fornitore` like '%/16';
update `db_sm`.fatture_ca as fca set fca.`numero_bolla_fornitore`=trim(leading 'DT' FROM fca.`numero_bolla_fornitore`)
where fca.`codice_fornitore`='100293' and fca.`numero_bolla_fornitore` like 'DT%';
/*fine sistemazione numero ddt*/
update `db_sm`.`fatture_ca` as fca left join `db_sm`.`ean` as e on fca.`codice_ean`=e.`ean`
set codice_articolo_if = ifnull(e.`codice`,'')
where fca.`codice_articolo_if` = '' and fca.`codice_ean`<>'';
update `db_sm`.`fatture_ca` as fca left join `db_sm`.`fornitore_articolo` as far on fca.`codice_articolo_copre`=far.`codice_articolo_fornitore`
set fca.`codice_articolo_if` = far.`codice_articolo`
where fca.`codice_articolo_if` = '' and fca.`codice_articolo_copre`<>'';
drop table if exists `contabilita`.`fatture_ca_testate`;
create table `contabilita`.`fatture_ca_testate` as
select
fca.`numero`,
fca.`data`,
fca.`tipo`,
n.`codice_interno`,
n.`negozio_descrizione`,
fo.`sm` `codice_fornitore`,
case when (`fo`.`descrizione_fornitore` <> '') then `fo`.`descrizione_fornitore` else 'COPRE' end `descrizione_fornitore`,
(case when (`fca`.`numero_bolla_fornitore` <> '') then trim(trailing '-1' FROM trim(leading 'E7J-' FROM trim(leading 'GE0' FROM trim(trailing '/00' FROM trim(leading '0' FROM trim(leading 'DDT' FROM `fca`.`numero_bolla_fornitore`)))))) else trim(leading 'DDT' FROM `fca`.`numero_consegna`) end) AS `numero_ddt`,
fca.`data_bolla_fornitore` `data_ddt`,
fca.`contributi` `nota contr.`,
count(*) `referenze_ddt`,
sum(fca.`quantita`) `pezzi_ddt`,
sum(round(fca.`prezzo_lordo`*fca.`quantita`,2)) `totale ddt`,
(select sum(round(`prezzo_lordo`*`quantita`,2)) from `db_sm`.`fatture_ca` where fca.`numero`=`numero`) `totale_ft`
from `db_sm`.`fatture_ca` as fca
left join `archivi`.`negozi` as n on fca.`codice_punto_consegna`= n.codice_ca
left join `contabilita`.`sm_fornitori` as fo on fca.`codice_fornitore`=fo.`copre`
group by fca.`numero`,(case when (`fca`.`numero_bolla_fornitore` <> '') then trim(trailing '-1' FROM trim(leading 'E7J-' FROM trim(leading 'GE0' FROM trim(trailing '/00' FROM trim(leading '0' FROM trim(leading 'DDT' FROM `fca`.`numero_bolla_fornitore`)))))) else trim(leading 'DDT' FROM `fca`.`numero_consegna`) end)
order by fca.`numero`;
alter table `contabilita`.`fatture_ca_testate` add primary key (`numero`, `codice_fornitore`, `numero_ddt`);
drop table if exists `contabilita`.`fatture_ca_righe`;
create table `contabilita`.`fatture_ca_righe` as
select
fca.`numero`,
fca.`data`,
n.`codice_interno`,
n.`negozio_descrizione`,
fca.`numero_riga`,
fca.`contributi`,
fo.`sm` `codice_fornitore`,
(case when (`fca`.`numero_bolla_fornitore` <> '') then trim(trailing '-1' FROM trim(leading 'E7J-' FROM trim(leading 'GE0' FROM trim(trailing '/00' FROM trim(leading '0' FROM trim(leading 'DDT' FROM `fca`.`numero_bolla_fornitore`)))))) else trim(leading 'DDT' FROM `fca`.`numero_consegna`) end) AS `numero_ddt`,
fca.`data_bolla_fornitore` `data_ddt`,
`fca`.`codice_articolo_copre` `codice_articolo_copre`,
`fca`.`codice_ean` `codice_ean`,
`fca`.`codice_articolo_interno` `codice_articolo_interno`,
ifnull(`fca`.`codice_articolo_if`,'-------') `codice`,
ifnull(`m`.`descrizione`,fca.`descrizione_articolo`) `descrizione`,
ifnull(`m`.`modello`,'-------') `modello`,
ifnull(`m`.`linea`,'-------') `linea`,
fca.`quantita`,
round(fca.`prezzo_lordo`*fca.`quantita`,2) `prezzo`
from `db_sm`.`fatture_ca` as fca
left join `archivi`.`negozi` as n on fca.`codice_punto_consegna`= n.codice_ca
left join `contabilita`.`sm_fornitori` as fo on fca.`codice_fornitore`=fo.`copre`
left join `db_sm`.`magazzino` as m on `fca`.`codice_articolo_if`=m.`codice`
order by fca.`numero`;
alter table `contabilita`.`fatture_ca_righe` add index (`numero`, `codice_fornitore`, `numero_ddt`, `numero_riga`);
drop table if exists `contabilita`.`arrivi_righe`;
create table `contabilita`.`arrivi_righe` as select a.`negozio`, a.`numero_ddt`,a.`codice_fornitore`,ar.`codice_articolo`, ar.`codice_articolo_fornitore`, ar.`quantita`, ar.`costo` `costo_unitario`, round(ar.`quantita`*ar.`costo`,2) `costo`
from db_sm.`arrivi` as a left join db_sm.`righe_arrivi` as ar on a.`id` = ar.`id_arrivi`;
alter table `contabilita`.`arrivi_righe` add index (`negozio`,`numero_ddt`,`codice_fornitore`,`codice_articolo`);
drop table if exists `contabilita`.`dettaglio_fatture`;
create table `contabilita`.`dettaglio_fatture` as
select ft.`numero`, ft.`data`, fr.`contributi`,ft.`codice_interno` `negozio`,ft.`negozio_descrizione` `descrizione neg.`,ft.`codice_fornitore` `fornitore`,
ft.`descrizione_fornitore` `descrizione forn.`,ft.`numero_ddt` `d.d.t.`,fr.`codice`,fr.`codice_articolo_copre`,fr.`codice_ean`,
fr.`descrizione`,fr.`modello`,fr.`linea`,fr.`quantita` `q.ta ddt`,ifnull(ar.`quantita`,0) `q.ta arr.`,ifnull(fr.`quantita`,0)- ifnull(ar.`quantita`,0) `delta q.ta`,
fr.`prezzo` `prezzo ddt`, ifnull(ar.`costo`,0) `prezzo arr.`, ifnull(fr.`prezzo`,0)- ifnull(ar.`costo`,0) `delta prezzo`
from `contabilita`.fatture_ca_testate as ft join `contabilita`.fatture_ca_righe as fr on ft.`numero`=fr.`numero` and ft.`codice_interno`=fr.`codice_interno` and ft.`codice_fornitore`=fr.`codice_fornitore` and ft.`numero_ddt`=fr.`numero_ddt`
left join `contabilita`.arrivi_righe as ar on ft.`codice_fornitore`=ar.`codice_fornitore` and ft.`codice_interno`=ar.`negozio` and ft.`numero_ddt`=ar.`numero_ddt` and fr.`codice`=ar.`codice_articolo`;
update contabilita.fatture_ca_testate as t left join
(select distinct f.numero `numero`,
case when f.`codice_punto_consegna` in ('500113','500213','500313','500413','500513','500613','500713','500813','500913') then
'500013'
else
case when f.`codice_punto_consegna` in ('500153','500253','500333') then
'500053'
else
f.`codice_punto_consegna`
end
end `codice_punto_consegna`
, n.`codice_interno` `codice_interno`, n.`negozio_descrizione` `negozio_descrizione` from db_sm.fatture_ca as f
left join archivi.negozi as n on
case when f.`codice_punto_consegna` in ('500113','500213','500313','500413','500513','500613','500713','500813','500913') then
'500013'
else
case when f.`codice_punto_consegna` in ('500153','500253','500333') then
'500053'
else
f.`codice_punto_consegna`
end
end =n.codice_ca) as f on t.`numero`=f.`numero`
set t.codice_interno=f.codice_interno, t.negozio_descrizione=f.negozio_descrizione
where t.`codice_interno` is null and t.`data`>='2017-01-01'; | true |
55eaaadf0b22de745237951143ea0f22bc025570 | SQL | alte0/43745-yeticave-10 | /queries.sql | UTF-8 | 3,243 | 3.859375 | 4 | [] | no_license | USE `yeticave`;
-- Добавляем список категорий;
INSERT INTO сategories (name, character_code)
VALUES
('Доски и лыжи', 'boards'),
('Крепления', 'attachment'),
('Ботинки', 'boots'),
('Одежда', 'clothing'),
('Инструменты', 'tools'),
('Разное', 'other');
-- Добавляем пользователей;
INSERT INTO users (name, email, password, contacts)
VALUES
('Максим', 'makc@test.test', '@123Rth', '+79998887766'),
('Николай', 'kolya@test.test', '@173Rth', '+79998887766'),
('Василий', 'vasya@test.test', '@546jhg', '+75554443322');
-- Добавляем список объявлений.
INSERT INTO lots (name, description, start_price, image, step, date_completion, user_id, category_id)
VALUES
('2014 Rossignol District Snowboard', 'Отличное состояние, как новый!', 10999, 'img/lot-1.jpg', 100, '2019-10-04 00:00', 1, 1),
('DC Ply Mens 2016/2017 Snowboard', 'Немного краска слезла', 159999, 'img/lot-2.jpg', 1000, '2019-10-8 00:00', 1, 1),
('Крепления Union Contact Pro 2015 года размер L/XL', 'Не разу не пользовался!', 8000, 'img/lot-3.jpg', 100, '2019-10-02 00:00', 1, 2),
('Ботинки для сноуборда DC Mutiny Charocal', 'Эксклюзивные!', 10999, 'img/lot-4.jpg', 100, '2019-10-03 00:00', 1, 3),
('Куртка для сноуборда DC Mutiny Charocal', 'Пару сезонов откатал!', 7500, '/img/lot-5.jpg', 100, '2019-10-01 00:00', 1, 4),
('Маска Oakley Canopy', 'Отдаю почти даром!', 5400, 'img/lot-6.jpg', 50, '2019-10-10 00:00', 1, 6);
-- Добавляем пару ставок для любого объявления.
INSERT INTO bets (price, user_id, lot_id)
VALUES
(11999, 2, 1),
(12999, 3, 1),
(8100, 2, 3),
(9100, 3, 3);
-- Получить все категории.
SELECT * FROM сategories;
-- Получить самые новые, открытые лоты. Каждый лот должен включать название, стартовую цену, ссылку на изображение, цену, название категории.
SELECT l.id, l.date_create, l.date_completion, l.name, l.start_price, l.image, l.category_id, c.name AS category_name, IFNULL(max(b.price), l.start_price) AS price FROM lots l
INNER JOIN сategories c ON l.category_id = c.id
LEFT JOIN bets b ON l.id = b.lot_id
WHERE l.date_completion >= "2019-08-26 13:15"
GROUP BY id
;
-- Показать лот по его id. Получите также название категории, к которой принадлежит лот.
SELECT l.*, c.name FROM lots l
INNER JOIN сategories c ON l.category_id = c.id
WHERE l.id = 1;
-- Обновить название лота по его идентификатору.
UPDATE lots SET name='новое название лота - Маска Oakley Canopy' WHERE id=6;
-- Получить список ставок для лота по его идентификатору с сортировкой по дате.
SELECT * FROM bets WHERE lot_id = 3 ORDER BY date_create DESC; | true |
cadba3184a997498b20fa8c4b0850fea445b5842 | SQL | AshikurRahman-Peters/tiffinbox | /database/school_manage.sql | UTF-8 | 19,469 | 3.28125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 24, 2016 at 04:10 অপরাহ্ণ
-- Server version: 5.6.16
-- PHP Version: 5.5.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `school_manage`
--
-- --------------------------------------------------------
--
-- Table structure for table `attendance`
--
CREATE TABLE IF NOT EXISTS `attendance` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`date` date DEFAULT NULL,
`classId` int(11) DEFAULT NULL,
`sectionId` int(11) DEFAULT NULL,
`rollNo` int(11) DEFAULT NULL,
`status` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `batch`
--
CREATE TABLE IF NOT EXISTS `batch` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`batchName` varchar(255) DEFAULT NULL,
`batchYear` year(4) DEFAULT NULL,
`batchStatus` tinyint(2) DEFAULT NULL,
`createdBy` int(11) DEFAULT NULL,
`createIp` varchar(255) DEFAULT NULL,
`createdDatetime` datetime DEFAULT NULL,
`updatedBy` int(11) DEFAULT NULL,
`updateIp` varchar(255) DEFAULT NULL,
`updatedDatetime` datetime DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `book`
--
CREATE TABLE IF NOT EXISTS `book` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`author` varchar(255) DEFAULT NULL,
`description` text,
`price` varchar(255) DEFAULT NULL,
`status` tinyint(2) DEFAULT NULL COMMENT '0=issued;1=avilable;',
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `book`
--
INSERT INTO `book` (`Id`, `name`, `author`, `description`, `price`, `status`) VALUES
(1, 'abc', 'ashik', 'description', '250', 1);
-- --------------------------------------------------------
--
-- Table structure for table `book_issue`
--
CREATE TABLE IF NOT EXISTS `book_issue` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`bookId` int(11) DEFAULT NULL,
`issueFor` varchar(255) DEFAULT NULL,
`userType` tinyint(4) DEFAULT NULL COMMENT '1=student,2=others',
`issuedate` date DEFAULT NULL,
`issueTill` date DEFAULT NULL,
`note` text,
`status` tinyint(2) DEFAULT NULL COMMENT '0=issued,1=available',
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `branches`
--
CREATE TABLE IF NOT EXISTS `branches` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`branchName` varchar(255) DEFAULT NULL,
`branchCode` varchar(255) DEFAULT NULL,
`branchAddress` text,
`branchStatus` tinyint(2) DEFAULT NULL,
`createdBy` int(11) DEFAULT NULL,
`createdDatetime` datetime DEFAULT NULL,
`createIp` varchar(255) DEFAULT NULL,
`updatedBy` int(11) DEFAULT NULL,
`updateIp` varchar(255) DEFAULT NULL,
`updatedDatetime` datetime DEFAULT NULL,
`schoolId` int(11) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `classes`
--
CREATE TABLE IF NOT EXISTS `classes` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ClassName` varchar(255) DEFAULT NULL,
`ClassNumaricName` int(2) unsigned zerofill DEFAULT NULL,
`ClassTeacherId` int(11) DEFAULT NULL,
`ClassStatus` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `classroutin`
--
CREATE TABLE IF NOT EXISTS `classroutin` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`ClassId` int(11) DEFAULT NULL,
`SubjectId` int(11) DEFAULT NULL,
`SectionId` int(11) DEFAULT NULL,
`DayOftheWeekId` int(11) DEFAULT NULL,
`StartTime` time DEFAULT NULL,
`EndTime` time DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `dayoftheweek`
--
CREATE TABLE IF NOT EXISTS `dayoftheweek` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Day` varchar(55) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `departments`
--
CREATE TABLE IF NOT EXISTS `departments` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`departmentName` varchar(255) DEFAULT NULL,
`departmentStatus` tinyint(2) DEFAULT NULL,
`createdBy` int(11) DEFAULT NULL,
`createDatetime` datetime DEFAULT NULL,
`createIp` varchar(255) DEFAULT NULL,
`updateBy` int(11) DEFAULT NULL,
`updateDatetime` datetime DEFAULT NULL,
`updateIp` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `departments`
--
INSERT INTO `departments` (`Id`, `departmentName`, `departmentStatus`, `createdBy`, `createDatetime`, `createIp`, `updateBy`, `updateDatetime`, `updateIp`) VALUES
(1, 'teacher', 1, NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `designations`
--
CREATE TABLE IF NOT EXISTS `designations` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`designationName` varchar(250) DEFAULT NULL,
`employeeDepartmentId` tinyint(2) DEFAULT NULL,
`designationStatus` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `employee`
--
CREATE TABLE IF NOT EXISTS `employee` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`EmployeeName` varchar(150) DEFAULT NULL,
`EmployeeDeptId` int(11) DEFAULT NULL,
`EmployeeDesignationId` int(11) DEFAULT NULL,
`EmployeeBrithDate` date DEFAULT NULL,
`EmployeeGender` tinyint(2) DEFAULT NULL,
`EmployeeAddress` text,
`EmployeeMobile` varchar(60) DEFAULT NULL,
`EmployeeEmail` varchar(150) DEFAULT NULL,
`EmployeeUserName` varchar(60) DEFAULT NULL,
`EmployeePassword` varchar(255) DEFAULT NULL,
`EmployeePhoto` varchar(255) DEFAULT NULL,
`EmployeeBloodGroup` varchar(5) DEFAULT NULL,
`EmployeeStatus` tinyint(2) DEFAULT '1',
`IsCommittee` tinyint(2) DEFAULT '0' COMMENT '0=not committee member;1=yes committee member',
`CommitteePost` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `employee`
--
INSERT INTO `employee` (`Id`, `EmployeeName`, `EmployeeDeptId`, `EmployeeDesignationId`, `EmployeeBrithDate`, `EmployeeGender`, `EmployeeAddress`, `EmployeeMobile`, `EmployeeEmail`, `EmployeeUserName`, `EmployeePassword`, `EmployeePhoto`, `EmployeeBloodGroup`, `EmployeeStatus`, `IsCommittee`, `CommitteePost`) VALUES
(1, 'ashikur rahman', 0, 0, '1970-01-01', 0, '', '', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'photo-_1_-admin_thumb.jpg', '', 0, 1, NULL),
(2, 'SE', 1, 0, '2014-03-05', 1, 'sadf', '123', 'asdf@sad', 'asdfasdf', '6a204bd89f3c8348afd5c77c717a097a', NULL, NULL, 1, 0, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `examgrades`
--
CREATE TABLE IF NOT EXISTS `examgrades` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`gradeName` varchar(50) DEFAULT NULL,
`gradePoint` double(10,2) DEFAULT NULL,
`markFrom` int(11) DEFAULT NULL,
`markUpto` int(11) DEFAULT NULL,
`comments` varchar(500) DEFAULT NULL,
`createdBy` int(11) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`examGradeStatus` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `examresult`
--
CREATE TABLE IF NOT EXISTS `examresult` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`examId` int(11) DEFAULT NULL,
`subjectId` int(11) DEFAULT NULL,
`classId` int(11) DEFAULT NULL,
`studentId` int(11) DEFAULT NULL,
`marksObtained` varchar(50) DEFAULT NULL,
`attendance` varchar(50) DEFAULT NULL,
`comment` text,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `exams`
--
CREATE TABLE IF NOT EXISTS `exams` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`examName` varchar(255) DEFAULT NULL,
`examDate` date DEFAULT NULL,
`comments` text,
`examStatus` tinyint(2) DEFAULT '1',
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `expenses`
--
CREATE TABLE IF NOT EXISTS `expenses` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`details` text,
`expenceCategoryId` int(11) DEFAULT NULL,
`amount` varchar(255) DEFAULT NULL,
`mediam` varchar(255) DEFAULT NULL,
`date` date DEFAULT NULL,
`status` tinyint(2) DEFAULT '1',
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `expenses`
--
INSERT INTO `expenses` (`Id`, `title`, `details`, `expenceCategoryId`, `amount`, `mediam`, `date`, `status`) VALUES
(1, 'banch repair', '', 1, '100', 'cash', '2016-01-09', 1);
-- --------------------------------------------------------
--
-- Table structure for table `expense_category`
--
CREATE TABLE IF NOT EXISTS `expense_category` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`categoryName` varchar(255) DEFAULT NULL,
`status` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `expense_category`
--
INSERT INTO `expense_category` (`Id`, `categoryName`, `status`) VALUES
(1, 'classroom utility', 1);
-- --------------------------------------------------------
--
-- Table structure for table `fee_type`
--
CREATE TABLE IF NOT EXISTS `fee_type` (
`id` int(55) NOT NULL AUTO_INCREMENT,
`fee_type` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `link`
--
CREATE TABLE IF NOT EXISTS `link` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`title` varchar(255) DEFAULT NULL,
`url` varchar(1024) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `link`
--
INSERT INTO `link` (`Id`, `name`, `title`, `url`) VALUES
(1, 'Sample', 'Link title', 'http://example.com');
-- --------------------------------------------------------
--
-- Table structure for table `noticeboard`
--
CREATE TABLE IF NOT EXISTS `noticeboard` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`noticeTitle` text,
`noticeDescription` text,
`noticeDate` datetime DEFAULT NULL,
`noticeCreatedBy` int(11) DEFAULT NULL,
`noticeCreatedDate` datetime DEFAULT NULL,
`noticeStatus` tinyint(2) DEFAULT '1',
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `noticeboard`
--
INSERT INTO `noticeboard` (`Id`, `noticeTitle`, `noticeDescription`, `noticeDate`, `noticeCreatedBy`, `noticeCreatedDate`, `noticeStatus`) VALUES
(1, 'this is a simple notice', 'this is a description', '2016-01-07 17:15:51', 1, '2016-01-07 17:46:51', 1),
(2, 'this is a simple notice2', 'this is a description2', '2016-12-12 17:51:15', 1, '2016-01-07 17:00:54', 1);
-- --------------------------------------------------------
--
-- Table structure for table `payment`
--
CREATE TABLE IF NOT EXISTS `payment` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`paymentTitle` varchar(255) DEFAULT NULL,
`paymentDetails` tinytext,
`paymentType` tinyint(2) DEFAULT '1' COMMENT '1=student payment; 2=others;',
`classId` int(11) DEFAULT NULL,
`studentId` int(11) DEFAULT NULL,
`totalAmount` varchar(255) DEFAULT NULL,
`createdDate` date DEFAULT NULL,
`status` tinyint(2) DEFAULT NULL COMMENT '1=paid;0=unpaid',
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `payment_history`
--
CREATE TABLE IF NOT EXISTS `payment_history` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`paymentId` int(11) DEFAULT NULL,
`paidAmount` varchar(255) DEFAULT NULL,
`paymentDate` date DEFAULT NULL,
`medium` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `schools`
--
CREATE TABLE IF NOT EXISTS `schools` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`schoolName` varchar(500) DEFAULT NULL,
`schoolLogo` varchar(500) DEFAULT NULL,
`schoolAddress` text,
`createdDatetime` datetime DEFAULT NULL,
`cratedIp` varchar(255) DEFAULT NULL,
`updateDatetime` datetime DEFAULT NULL,
`updateIp` varchar(255) DEFAULT NULL,
`schoolStatus` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `sections`
--
CREATE TABLE IF NOT EXISTS `sections` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ClassId` int(255) DEFAULT NULL,
`SectionName` varchar(255) DEFAULT NULL,
`SectionClassTeacherId` int(11) DEFAULT NULL,
`SectionNumericName` int(2) unsigned zerofill DEFAULT NULL,
`SectionStatus` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `setting`
--
CREATE TABLE IF NOT EXISTS `setting` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`institute_name` varchar(500) DEFAULT NULL,
`institute_logo` varchar(500) DEFAULT NULL,
`address` text,
`contact_no` varchar(100) DEFAULT NULL,
`email` varchar(250) DEFAULT NULL,
`contact_us_email` varchar(255) DEFAULT NULL,
`about_us` text,
`principal_word` text,
`sliders` text,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `setting`
--
INSERT INTO `setting` (`Id`, `institute_name`, `institute_logo`, `address`, `contact_no`, `email`, `contact_us_email`, `about_us`, `principal_word`, `sliders`) VALUES
(1, 'Hello Institute', 'school_Hello Institute.png', 'Sample address', '01752832600', 'email@example.com', 'email@example.com', 'Sample about us', 'Sample word', 'a:2:{i:0;a:3:{s:5:"image";s:55:"http://localhost/tiffinbox//media/slider/slider_sdf.jpg";s:5:"title";s:3:"sdf";s:7:"content";s:6:"sdfsdf";}i:1;a:3:{s:5:"image";s:58:"http://localhost/tiffinbox//media/slider/slider_sdfsdf.jpg";s:5:"title";s:6:"sdfsdf";s:7:"content";s:9:"sdfsdfsdf";}}');
-- --------------------------------------------------------
--
-- Table structure for table `status`
--
CREATE TABLE IF NOT EXISTS `status` (
`id` int(255) DEFAULT NULL,
`status_type_name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `studentdetails`
--
CREATE TABLE IF NOT EXISTS `studentdetails` (
`Id` int(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
`StdName` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`StdFatherName` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`StdMotherName` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`StdDOB` date DEFAULT NULL,
`StdGender` tinyint(2) DEFAULT '1',
`StdBloodGroup` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`StdProfilePhoto` varchar(450) CHARACTER SET utf8 DEFAULT NULL,
`StdGardianName` varchar(255) DEFAULT NULL,
`StdGardianPhoto` varchar(450) CHARACTER SET utf8 DEFAULT NULL,
`StdGardianSigneture` varchar(450) CHARACTER SET utf8 DEFAULT NULL,
`StdContactNo` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`StdPresentAddress` varchar(459) CHARACTER SET utf8 DEFAULT NULL,
`StdPermanentAddress` varchar(450) CHARACTER SET utf8 DEFAULT NULL,
`StdAdmissionYear` year(4) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `studentinfo`
--
CREATE TABLE IF NOT EXISTS `studentinfo` (
`Id` int(11) unsigned zerofill NOT NULL AUTO_INCREMENT,
`StdDetailsId` int(11) DEFAULT NULL,
`StdCurrentId` varchar(255) DEFAULT NULL,
`StdCashId` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`StdRollNo` int(3) unsigned zerofill DEFAULT NULL,
`StdClassId` int(2) unsigned zerofill DEFAULT NULL,
`StdSectionId` int(2) unsigned zerofill DEFAULT NULL,
`StdStatus` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `subjects`
--
CREATE TABLE IF NOT EXISTS `subjects` (
`Id` int(55) NOT NULL AUTO_INCREMENT,
`SubjectName` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`SubjectCode` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`SubjectClassId` int(2) unsigned DEFAULT NULL,
`SubjectIsMust` tinyint(2) DEFAULT '1',
`SubjectIsOptional` tinyint(2) DEFAULT '0',
`SubjectStatus` tinyint(2) DEFAULT '1',
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`type_id` int(100) DEFAULT NULL,
`full_name` varchar(450) DEFAULT NULL,
`user_name` varchar(255) DEFAULT NULL,
`password` varchar(450) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`mobile` varchar(255) DEFAULT NULL,
`last_login_time` varchar(765) DEFAULT NULL,
`last_login_ip` varchar(765) DEFAULT NULL,
`status` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `type_id`, `full_name`, `user_name`, `password`, `email`, `mobile`, `last_login_time`, `last_login_ip`, `status`) VALUES
(1, 1, NULL, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'codekman@gmail.com', NULL, '2016-01-20 20:48:37', '::1', 1);
-- --------------------------------------------------------
--
-- Table structure for table `user_type`
--
CREATE TABLE IF NOT EXISTS `user_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type_name` varchar(255) DEFAULT NULL,
`status` tinyint(2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 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 |
f111d2e7934cab834e3495f0d2661f8dcc8f4ca7 | SQL | raflirosliana/Project-Databases | /ProjectDB 1/Query Insert Data Into Tables.sql | UTF-8 | 6,771 | 2.8125 | 3 | [] | no_license | --USE DATABASE yang sudah dibuat
USE RA_Laundry
--QUERY INSERT DATA Master(10 Data), Header(15 Data), dan Detail(25 Data)
INSERT INTO
MsStaff (StaffId,StaffName,StaffGender,StaffAddress,StaffSalary)
VALUES
('ST001','Putri Dara','Female','Rasuna Said road No.86','2000000'),
('ST002','Zara Dea Imanuel','Female','Gunawarman road No.11','1800000'),
('ST003','Steffani Ardi','Female','Senopati road No.44','1700000'),
('ST004','Kevin Angkasa','Male','Cempaka Putih No.28','2200000'),
('ST005','Maya Tambunan','Female','Rawa Belong road No.99','1900000'),
('ST006','Michael Ardi','Male','Budi Kemuliaan road No.75','2400000'),
('ST007','Jonathan','Male','West Menteng No.67','2800000'),
('ST008','Renita Joel','Female','Permata Hijau No.88','1900000'),
('ST009','Christian Henry Gumilang','Male','Raden Saleh road No.26','2500000'),
('ST010','Giovanni','Male','Ismail Marzuki road No.39','2700000')
INSERT INTO
MsCustomer (CustomerId,CustomerName,CustomerGender,CustomerAddress,CustomerDOB)
VALUES
('CU001','James Gordon','Male','Bangau road No .1','1999-02-11'),
('CU002','Peter','Male','Cempaka road No .2','1998-03-19'),
('CU003','Jonas Glue','Male','Penjernihan road No .14','1990-03-21'),
('CU004','Jonathan','Male','Plavez road No .6','1983-07-21'),
('CU005','Kevin Julius','Male','Anggrek road No .12','1999-03-18'),
('CU006','Okto Josua Summer','Male','Rawa road No .13','1991-09-21'),
('CU007','Chaka Natalie','Female','Penjernihan road No .87','1992-04-14'),
('CU008','Yosevine','Female','Plavez road No .6','1989-09-29'),
('CU009','Clay Aiken Phil','Male','Penjernihan road No .194','1988-08-18'),
('CU010','Chris Scott Kennedy','Male','Plavez road No .92','1995-11-23')
INSERT INTO
MsVendor (VendorId,VendorName,VendorAddress,VendorPhone)
VALUES
('VE001','PT. Angkasa Pura','Sudirman road No.42','081218674367'),
('VE002','Stark Industries','Penjernihan road No .19','081537589354'),
('VE003','Wayne Enterprise','Pajajaran road No. 9','082538505477'),
('VE004','Xeon Group','Majapahit road No. 23','081756285739'),
('VE005','PT. Adaro Energy','Plavez road No .63','081516378225'),
('VE006','BCA Finance','Kuyang road No. 54','085746287599'),
('VE007','PT. Saratoga Investama','Kebon Sirih road No.21','081637599756'),
('VE008','Astra Insurance','Thamrin road No. 45','082646648675'),
('VE009','PT. Indah Permata','Yos Sudarso road No.22','083548769758'),
('VE010','Vens Cargo','S.Parman road No.88','082437646578')
INSERT INTO
MsMaterial (MaterialId,MaterialName,MaterialType,MaterialPrice)
VALUES
('MA001','Wood','Equipment','300000'),
('MA002','Garmen','Supplies','500000'),
('MA003','Bag','Equipment','900000'),
('MA004','Softener','Equipment','650000'),
('MA005','Perfume','Supplies','450000'),
('MA006','Petrochemical','Equipment','875000'),
('MA007','Soap','Supplies','220000'),
('MA008','Iron','Supplies','375000'),
('MA009','Aluminium','Equipment','525000'),
('MA010','Litium','Equipment','750000')
INSERT INTO
MsClothes (ClothesId,ClothesName,ClothesType)
VALUES
('CL001','Suvreme','Cotton'),
('CL002','Kompaz','Viscose'),
('CL003','Yizih','Cotton'),
('CL004','ErZordan','Polyester'),
('CL005','Agigas','Linen'),
('CL006','Naiki','Wool'),
('CL007','LuiVutonk','Polyester'),
('CL008','Sara','Viscose'),
('CL009','KarlandMarx','Linen'),
('CL010','Guci','Wool')
INSERT INTO
HeaderServices (TransactionId,CustomerId,StaffId,ServiceDate)
VALUES
('SR001','CU001','ST001','2019-07-09'),
('SR002','CU002','ST003','2019-12-29'),
('SR003','CU004','ST005','2019-08-17'),
('SR004','CU005','ST008','2019-07-21'),
('SR005','CU007','ST004','2019-02-16'),
('SR006','CU001','ST002','2019-04-25'),
('SR007','CU009','ST007','2019-06-03'),
('SR008','CU008','ST010','2019-07-26'),
('SR009','CU003','ST003','2019-11-19'),
('SR010','CU008','ST009','2019-10-22'),
('SR011','CU004','ST008','2019-04-25'),
('SR012','CU006','ST001','2019-07-13'),
('SR013','CU002','ST007','2019-06-12'),
('SR014','CU010','ST009','2019-03-09'),
('SR015','CU007','ST004','2019-08-27')
INSERT INTO
HeaderPurchase (PurchaseId,StaffId,VendorId,PurchaseDate)
VALUES
('PU001','ST001','VE001','2019-07-13'),
('PU002','ST003','VE005','2019-11-24'),
('PU003','ST004','VE006','2019-12-08'),
('PU004','ST006','VE008','2019-04-17'),
('PU005','ST003','VE002','2019-07-24'),
('PU006','ST001','VE009','2019-06-28'),
('PU007','ST008','VE005','2019-02-19'),
('PU008','ST010','VE004','2019-07-12'),
('PU009','ST009','VE010','2019-09-13'),
('PU010','ST002','VE001','2019-02-28'),
('PU011','ST008','VE003','2019-07-08'),
('PU012','ST005','VE008','2019-05-16'),
('PU013','ST006','VE007','2019-10-28'),
('PU014','ST010','VE009','2019-03-23'),
('PU015','ST007','VE002','2019-07-21')
INSERT INTO
DetailServices (TransactionId,ClothesId,ServiceType,ServicePrice)
VALUES
('SR001','CL001','Laundry Service','30000'),
('SR002','CL002','Dry Cleaning Service','50000'),
('SR003','CL003','Ironing Service','15000'),
('SR004','CL004','Laundry Service','30000'),
('SR005','CL005','Dry Cleaning Service','50000'),
('SR006','CL006','Laundry Service','30000'),
('SR007','CL007','Laundry Service','30000'),
('SR008','CL008','Ironing Service','15000'),
('SR009','CL009','Dry Cleaning Service','50000'),
('SR010','CL010','Laundry Service','30000'),
('SR011','CL001','Ironing Service','15000'),
('SR012','CL002','Dry Cleaning Service','50000'),
('SR013','CL003','Ironing Service','15000'),
('SR014','CL004','Ironing Service','15000'),
('SR015','CL005','Dry Cleaning Service','50000'),
('SR005','CL006','Dry Cleaning Service','50000'),
('SR006','CL007','Dry Cleaning Service','50000'),
('SR007','CL008','Laundry Service','30000'),
('SR011','CL009','Laundry Service','30000'),
('SR012','CL010','Dry Cleaning Service','50000'),
('SR013','CL006','Ironing Service','15000'),
('SR014','CL007','Laundry Service','30000'),
('SR015','CL008','Dry Cleaning Service','50000'),
('SR001','CL009','Dry Cleaning Service','50000'),
('SR002','CL010','Ironing Service','15000')
INSERT INTO
DetailPurchase (PurchaseId,MaterialId,Quantity)
VALUES
('PU001','MA001','5'),
('PU002','MA007','8'),
('PU003','MA003','5'),
('PU004','MA001','4'),
('PU005','MA002','6'),
('PU006','MA008','7'),
('PU007','MA007','2'),
('PU008','MA002','3'),
('PU009','MA004','5'),
('PU010','MA006','3'),
('PU011','MA003','7'),
('PU012','MA002','4'),
('PU013','MA009','8'),
('PU014','MA003','5'),
('PU015','MA001','9'),
('PU001','MA004','7'),
('PU002','MA006','3'),
('PU003','MA010','7'),
('PU004','MA005','3'),
('PU005','MA009','6'),
('PU006','MA004','4'),
('PU007','MA010','7'),
('PU008','MA010','4'),
('PU009','MA008','8'),
('PU010','MA005','7')
| true |
508fd222fa3e38f8ad4a62ec984bb14c06f8e0dd | SQL | jackson20000/ums | /ums.sql | UTF-8 | 2,094 | 3.046875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Dec 04, 2019 at 04:32 PM
-- Server version: 5.7.28-0ubuntu0.18.04.4
-- PHP Version: 7.2.24-0ubuntu0.18.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `ums`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(500) NOT NULL,
`fname` varchar(20) NOT NULL,
`lname` varchar(20) NOT NULL,
`dob` text,
`type` int(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `fname`, `lname`, `dob`, `type`) VALUES
(1, 'admin', '$2b$15$vnH3RwoI7cgbfdlfKzk8p.hRX2xIROh0avFSYOG3pNSU09RdFgT5y', 'jackson', 'John', '', 0),
(7, 'dsadsadsa', '$2b$15$vlaszu0lgmah/KBiasTvuOnB7vrRHaaWajnwxsKPIhvnECQ2vxlRi', 'asasas', 'asasa', '2019-11-28T18:30:00.000Z', 1),
(8, 'dsadsadsa', '$2b$15$vnH3RwoI7cgbfdlfKzk8p.hRX2xIROh0avFSYOG3pNSU09RdFgT5y', 'asasas', 'asasa', '2019-11-28T18:30:00.000Z', 1),
(11, 'sadsad', '$2b$15$bR9mSSi4yOhny0WSLScKt.CKW6olCjxAb5wY3vBmHT4nkPYgclMOS', 'sassadsd', 'sadasdsad', '2019-11-25T18:30:00.000Z', 1),
(21, 'jackson.john', '$2b$15$Fs.FypdNsXXZ2b4pkkYpxuCB79ZiSgBCiNSAvX96084c6nnzx2fN6', 'Jackson', 'John', '2009-09-17T18:30:00.000Z', 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
/*!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 |
442c8f5eb848c6cdd91b6aa9ce0923a03f277a87 | SQL | Kannute/Database-App | /Scripts/pop_wiezienie.sql | UTF-8 | 11,545 | 2.53125 | 3 | [] | no_license | /**** WYPELNIENIE BAZY DANYMI PODSTAWOWYMI ****/
/* TRZY SEGMENTY Z ROZNYMI NACZELNIKAMI */
INSERT INTO wiezienie.segment VALUES (DEFAULT, 'Segment Meski', 1);
INSERT INTO wiezienie.segment VALUES (DEFAULT, 'Segment Zenski', 2);
INSERT INTO wiezienie.segment VALUES (DEFAULT, 'Segment o zaostrzonym rygorze', 3);
/* CELE */
/*Segment męski*/
INSERT INTO wiezienie.cela VALUES (DEFAULT, 100, 2, 1, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 101, 2, 1, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 102, 2, 1, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 103, 2, 1, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 104, 2, 1, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 105, 2, 1, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 106, 2, 1, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 107, 2, 1, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 108, 2, 1, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 109, 1, 1, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 110, 1, 1, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 111, 1, 1, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 112, 1, 1, 'Izolatka');
/*Segment żeński*/
INSERT INTO wiezienie.cela VALUES (DEFAULT, 200, 2, 2, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 201, 2, 2, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 202, 2, 2, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 203, 2, 2, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 204, 2, 2, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 205, 2, 2, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 206, 2, 2, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 207, 2, 2, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 208, 2, 2, 'Cela zwykla');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 209, 1, 2, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 210, 1, 2, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 211, 1, 2, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 212, 1, 2, 'Izolatka');
/*Segment o zaostrzonym rygorze 26*/
INSERT INTO wiezienie.cela VALUES (DEFAULT, 300, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 301, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 302, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 303, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 304, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 305, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 306, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 307, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 308, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 309, 1, 3, 'Izolatka');
INSERT INTO wiezienie.cela VALUES (DEFAULT, 310, 1, 3, 'Izolatka');
/** ZASOBY WIEZIENNE **/
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Kajdanki', 500);
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Kaftan bezpieczenstwa', 54);
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Mundur strażniczy', 40);
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Gaz lzawiacy', 42);
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Buty', 30);
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Woda butla', 500);
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Ryz karton', 600);
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Tusza cieleca kg', 60);
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Przyprawy', 32);
INSERT INTO wiezienie.zasoby VALUES (DEFAULT, 'Akta', 500);
/** ZAWODY **/
INSERT INTO wiezienie.zawod VALUES(DEFAULT, 'Naczelnik');
INSERT INTO wiezienie.zawod VALUES(DEFAULT, 'Straznik');
INSERT INTO wiezienie.zawod VALUES(DEFAULT, 'Lekarz');
INSERT INTO wiezienie.zawod VALUES(DEFAULT, 'Personel pielegniarski');
INSERT INTO wiezienie.zawod VALUES(DEFAULT, 'Personel gastronomiczny');
INSERT INTO wiezienie.zawod VALUES(DEFAULT, 'Personel sprzatajacy');
/** POKOJE **/
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 10, 'Pokoj naczelnika', 1);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 11, 'Pokoj strazniczy', 1);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 12, 'Pokoj strazniczy', 1);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 13, 'Kuchnia', 1);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 14, 'Kotłownia', 1);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 15, 'Piwnica', 1);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 21, 'Pokoj naczelnika', 2);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 22, 'Pokoj strazniczy', 2);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 23, 'Pokoj strazniczy', 2);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 24, 'Kuchnia', 2);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 25, 'Kotłownia', 2);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 26, 'Piwnica', 2);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 31, 'Pokoj naczelnika', 3);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 32, 'Pokoj strazniczy', 3);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 33, 'Pokoj strazniczy', 3);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 34, 'Pokoj strazniczy', 3);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 35, 'Kuchnia', 3);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 36, 'Piwnica', 3);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 16, 'Pokoj lekarski', 1);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 27, 'Pokoj lekarski', 2);
INSERT INTO wiezienie.pokoj VALUES(DEFAULT, 37, 'Pokoj lekarski', 3);
/** PRZYDZIAL DEPOZYTOW**/
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt naczelnika', 1,10);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt naczelnika', 7,10);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt naczelnika', 13,10);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt strazniczy', 2,1);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt strazniczy', 3,3);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt kuchenny', 4,6);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt lekarski', 19,4);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt strazniczy', 8,1);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt strazniczy', 9,3);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt kuchenny', 10,6);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt lekarski', 20, 4);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt strazniczy', 14,1);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt strazniczy', 15,3);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt kuchenny', 17,6);
INSERT INTO wiezienie.depozyt VALUES(DEFAULT, 'Depozyt lekarski', 21 ,4);
/** PRACOWNICY **/
/*Naczelnicy*/
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Jan', 'Kowalski');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 1, 1, 1);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Anna', 'Kowal');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 1, 2, 7);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Adam', 'Nowak');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 1, 3, 13);
/*Straznicy*/
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Karol', 'Karolski');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 2, 4, 2);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Jan', 'Janowski');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 2, 5, 2);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Wojciech', 'Wojtanowicz');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 2, 6, 3);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Zbigniew', 'Zibi');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 2, 7, 8);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Andrzej', 'Andrzejski');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 2, 8, 9);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Grzegorz', 'Gregorianski');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 2, 9, 14);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Florian', 'Florianski');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 2, 10, 15);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Adam', 'Adamski');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 2, 11, 16);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Mariusz', 'Pudzianowski');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 2, 12, 16);
/*Lekarze*/
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Anna', 'Chaber');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 3, 13, 19);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Zdzislaw', 'Religa');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 3, 14, 20);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Tomasz', 'Komenda');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 3, 15, 21);
/*Zespol pielegniarski*/
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Anna', 'Annowicz');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 4, 16, 19);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Janina', 'Janek');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 4, 17, 20);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Halina', 'Halinowicz');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 4, 18, 21);
/*Zespol gatronomiczny*/
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Gordon', 'Gordonowicz');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 5, 19, 4);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Pedro', 'Pascal');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 5, 20, 10);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Karol', 'Amaro');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 5, 21, 17);
/*Zespol sprzatajacy*/
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Jan', 'Niezbedny');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 6, 22, 5);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Andrzej', 'Niebylski');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 6, 23, 5);
INSERT INTO wiezienie.pracownik VALUES(DEFAULT, 'Alutka', 'Lutowicz');
INSERT INTO wiezienie.pracownik_info VALUES(DEFAULT, 6, 24, 11);
/* WIEZNIOWIE */
INSERT INTO wiezienie.wpis_wieznia VALUES ('Tomasz', 'Karolak', 88051032171, 102, 1, 'Udział w pobiciu, narażenia na utratę życia osób trzecich', '2021-12-31', 'Pozłacany zegarek', 1);
INSERT INTO wiezienie.wpis_wieznia VALUES ('Józef', 'Fritzl', 16211029712, 300, 3, 'Napaść na tle seksualnym', '2045-01-01', 'Czapka z daszkiem', 1);
INSERT INTO wiezienie.wpis_wieznia VALUES ('Andreas', 'Breivik', 98030606879, 103, 1, 'Fałszerstwo dokumentów', '2025-01-01', 'Płyta CD', 1);
INSERT INTO wiezienie.wpis_wieznia VALUES ('Agnieszka', 'Dygant', 31030115774, 200, 1, 'Atak terrorystyczny', '2120-01-01', 'Klubowy Szalik', 1);
INSERT INTO wiezienie.wpis_wieznia VALUES ('Jarosław', 'Kaczkowski', 75082525611, 302, 3, 'Zamach stanu', '2200-01-01', 'Porcelanowy kot', 1);
INSERT INTO wiezienie.wpis_wieznia VALUES ('Janusz', 'Pawlacz', 8782525241, 104, 1, 'Prowadzenie zorganizowanej grupy przestępczej', '2035-01-01', 'Kalendarz adwentowy', 1);
INSERT INTO wiezienie.wpis_wieznia VALUES ('Jerzy', 'Turban', 2137555241, 304, 1, 'Fałszerstwa podatkowe', '2024-01-01', 'Marki niemieckie', 300);
INSERT INTO wiezienie.wpis_wieznia VALUES ('Anna', 'Grodzkiewicz', 06100402166, 201, 2, 'Uprwoadzenie osoby nieletniej' , '2030-01-01', 'Fartuch kuchenny', 1);
INSERT INTO wiezienie.wpis_wieznia VALUES ('Kaja', 'Miodek', 57091726041, 203, 2, 'Spowodowanie uszczerbku na zdrowiu' , '2022-01-01', 'Tęczowa przypinka', 1);
INSERT INTO wiezienie.wpis_wieznia VALUES ('Matylda', 'Kononowicz', 17110842620, 204, 2, 'Recydywistyczne zakłócanie ciszy nocnej' , '2021-02-01', 'Megafon', 1);
| true |
54ce2d497ea69a0c9df38927030db029b19f4b09 | SQL | admiralnelson/Bukuku.com | /bukuku_com.sql | UTF-8 | 2,492 | 3.140625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 26, 2018 at 01:01 PM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 7.2.2
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: `bukuku.com`
--
-- --------------------------------------------------------
--
-- Table structure for table `buku`
--
CREATE TABLE `buku` (
`ID_BUKU` varchar(10) NOT NULL,
`JUDUL` varchar(25) NOT NULL,
`HARGA` varchar(15) NOT NULL,
`USERNAME` varchar(20) NOT NULL,
`JUMLAH` int(11) NOT NULL,
`GAMBAR` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `history`
--
CREATE TABLE `history` (
`ID_HISTORY` varchar(10) NOT NULL,
`ID_BUKU` varchar(10) NOT NULL,
`UNAME_PENJUAL` varchar(20) NOT NULL,
`UNAME_PEMBELI` varchar(20) NOT NULL,
`TANGGAL` date NOT NULL,
`JUMLAH` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `rating`
--
CREATE TABLE `rating` (
`ID_RATING` varchar(10) NOT NULL,
`ID_BUKU` varchar(10) NOT NULL,
`USERNAME` varchar(20) NOT NULL,
`RATING` varchar(15) NOT NULL,
`KOMENTAR` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`USERNAME` varchar(15) NOT NULL,
`PASSWORD` varchar(15) NOT NULL,
`NAMA` varchar(20) NOT NULL,
`EMAIL` varchar(25) NOT NULL,
`ALAMAT` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `history`
--
ALTER TABLE `history`
ADD PRIMARY KEY (`ID_HISTORY`);
--
-- Indexes for table `rating`
--
ALTER TABLE `rating`
ADD PRIMARY KEY (`ID_RATING`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`USERNAME`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
a338a182a17b313168142bde9b2d2fac03b29d9e | SQL | labmain/MySnippets | /MySQL/mysql表内容操作.sql | UTF-8 | 2,183 | 4.375 | 4 | [] | no_license | 1、增
insert into 表 (列名,列名...) values (值,值,...)
insert into 表 (列名,列名...) values (值,值,...),(值,值,值...)
insert into 表 (列名,列名...) select (列名,列名...) from 表
例:
insert into tab1(name,email) values('zhangyanlin','zhangyanlin8851@163.com')
2、删
delete from 表 # 删除表里全部数据
delete from 表 where id=1 and name='zhangyanlin' # 删除ID =1 和name='zhangyanlin' 那一行数据
3、改
update 表 set name = 'zhangyanlin' where id>1
update 表 set Address = 'Zhongshan 23', City = 'Nanjing' where LastName = 'Wilson'
4、查
select * from 表
select * from 表 where id > 1
select nid,name,gender as gg from 表 where id > 1
a、条件判断where
select * from 表 where id > 1 and name != 'aylin' and num = 12;
select * from 表 where id between 5 and 16;
select * from 表 where id in (11,22,33)
select * from 表 where id not in (11,22,33)
select * from 表 where id in (select nid from 表)
b、通配符like
select * from 表 where name like 'zhang%' # zhang开头的所有(多个字符串)
select * from 表 where name like 'zhang_' # zhang开头的所有(一个字符)
c、限制limit
select * from 表 limit 5; - 前5行
select * from 表 limit 4,5; - 从第4行开始的5行
select * from 表 limit 5 offset 4 - 从第4行开始的5行
d、排序asc,desc
select * from 表 order by 列 asc - 根据 “列” 从小到大排列
select * from 表 order by 列 desc - 根据 “列” 从大到小排列
select * from 表 order by 列1 desc,列2 asc - 根据 “列1” 从大到小排列,如果相同则按列2从小到大排序
e、分组group by
select num from 表 group by num
select num,nid from 表 group by num,nid
select num,nid from 表 where nid > 10 group by num,nid order nid desc
select num,nid,count(*),sum(score),max(score),min(score) from 表 group by num,nid
select num from 表 group by num having max(id) > 10
特别的:group by 必须在where之后,order by之前
| true |
b9a6d5cbbe67ca524098ef2994816b45f7b9f0fc | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/low/day18/select0254.sql | UTF-8 | 266 | 2.9375 | 3 | [] | no_license |
SELECT sen.name
FROM SENSOR sen, SENSOR_TYPE st, COVERAGE_INFRASTRUCTURE ci
WHERE sen.SENSOR_TYPE_ID=st.id AND st.name='WiFiAP' AND sen.id=ci.SENSOR_ID AND ci.INFRASTRUCTURE_ID=ANY(array['4100_7','4028','4209','5062','4100_9','2089','5039','3072','4226','4032'])
| true |
2d1a9f6289714592eff01ab5320da476fd5a2c08 | SQL | browniefed/next-auth-hasura-urql-boilerplate | /hasura/migrations/1609091411178_set_fk_public_users_role/up.sql | UTF-8 | 209 | 2.6875 | 3 | [] | no_license | alter table "public"."users"
add constraint "users_role_fkey"
foreign key ("role")
references "public"."user_roles"
("value") on update restrict on delete restrict;
| true |
a6696481cc6ad48588b616fe5d5459c2c32cadc2 | SQL | valagic/zadaciEraDijagram | /Samostan.sql | WINDOWS-1250 | 1,717 | 3.859375 | 4 | [] | no_license | drop database if exists samostan;
create database samostan;
use samostan;
/*U samostanu se nalaze sveenici.
Svaki sveenik je zaduen za vie poslova.
Jedan posao u isto vrijeme moe obavljati vie
sveenika. Svaki sveenik ima samo jednog nadreenog
sveenika. */
create table samostan (
id int not null primary key auto_increment,
naziv varchar(50) not null,
svecenici int,
posao int
);
create table svecenici (
id int not null primary key auto_increment,
ime varchar(20) not null,
prezime varchar(20) not null,
samostan int not null,
posao int
);
create table nadredeni (
id int not null primary key auto_increment,
ime varchar(20) not null,
prezime varchar(20) not null,
oib char(11),
svecenici int
);
create table posao (
id int not null primary key auto_increment,
vrijemePosla time,
svecenici int not null
);
alter table svecenici add foreign key(samostan) references samostan(id);
alter table posao add foreign key(svecenici) references svecenici(id);
alter table svecenici add foreign key(posao) references posao(id);
alter table nadredeni add foreign key(svecenici) references svecenici(id);
insert into samostan(naziv) values
('Samostan');
insert into svecenici(ime,prezime,samostan) values
('Pero','Peri',1),
('Pero','Peri2',1),
('Pero','Peri3',1),
('Pero','Peri4',1),
('Pero','Peri5',1),
('Pero','Peri6',1),
('Pero','Peri7',1);
insert into nadredeni(ime,prezime) values
('Marko','Mari');
insert into posao(vrijemePosla,svecenici) values
('08:00:00',1),
('08:00:00',2),
('08:00:00',3),
('08:00:00',4),
('08:00:00',5),
('08:00:00',6),
('08:00:00',7);
select * from samostan;
select * from svecenici;
select * from nadredeni;
select * from posao;
| true |
773bb585a52745c9e4dab71311a7de3faaf56e69 | SQL | DevComSHINE/shine-os-deved | /database/db_check/shinedb_migrated.sql | UTF-8 | 111,494 | 3.265625 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 04, 2016 at 06:10 AM
-- Server version: 5.6.16
-- PHP Version: 5.5.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `shinedb_migrated`
--
-- --------------------------------------------------------
--
-- Table structure for table `allergy_patient`
--
CREATE TABLE IF NOT EXISTS `allergy_patient` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`allergy_patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`old_patient_id` int(11) DEFAULT NULL,
`old_facility_id` int(11) DEFAULT NULL,
`patient_alert_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`allergy_id` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`allergy_reaction_id` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`allergy_severity` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `allergy_patient_allergy_patient_id_unique` (`allergy_patient_id`),
KEY `allergy_patient_patient_alert_id_foreign` (`patient_alert_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `api_user_account`
--
CREATE TABLE `api_user_account` (
`id` int(10) UNSIGNED NOT NULL,
`apiuseraccount_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`first_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`middle_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`last_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`gender` enum('F','M','U') COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`api_purpose` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`username` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`api_key` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`api_secret` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `api_user_account_apiuseraccount_id_unique` (`apiuseraccount_id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `calendar`
--
CREATE TABLE IF NOT EXISTS `calendar` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`calendar_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`allday` varchar(1) COLLATE utf8_unicode_ci DEFAULT '0',
`start` datetime NOT NULL,
`end` datetime NOT NULL,
`title` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`color` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`textcolor` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`facility_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`user_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `calendar_calendar_id_unique` (`calendar_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `chest_xray`
--
CREATE TABLE IF NOT EXISTS `chest_xray` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`chestxray_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`healthcareservice_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`scheduled_date` datetime NOT NULL,
`actual_date` datetime NOT NULL,
`xray_result` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`notes_remarks` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `chest_xray_chestxray_id_unique` (`chestxray_id`),
KEY `chest_xray_healthcareservice_id_foreign` (`healthcareservice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `dengue_record`
--
CREATE TABLE IF NOT EXISTS `dengue_record` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dengue_id` varchar(32) NOT NULL,
`healthcareservice_id` varchar(32) NOT NULL,
`fever_lasting` enum('Y','N','U') DEFAULT 'U',
`fever_now` enum('Y','N','U') DEFAULT 'U',
`platelets_critical` enum('Y','N','U') DEFAULT 'U',
`platelet_count` int(10) DEFAULT NULL,
`rapid_weak_pulse` enum('Y','N','U') DEFAULT 'U',
`pallor_cool_skin` enum('Y','N','U') DEFAULT 'U',
`chills` enum('Y','N','U') DEFAULT 'U',
`rash` enum('Y','N','U') DEFAULT 'U',
`headache` enum('Y','N','U') DEFAULT 'U',
`eye_pain` enum('Y','N','U') DEFAULT 'U',
`body_pain` enum('Y','N','U') DEFAULT 'U',
`joint_pain` enum('Y','N','U') DEFAULT 'U',
`anorexia` enum('Y','N','U') DEFAULT 'U',
`tourniquet_test` enum('Y','N','U') DEFAULT 'U',
`petechiae` enum('Y','N','U') DEFAULT 'U',
`purpura_ecchymosis` enum('Y','N','U') DEFAULT 'U',
`vomit_with_blood` enum('Y','N','U') DEFAULT 'U',
`blood_in_stool` enum('Y','N','U') DEFAULT 'U',
`nasal_bleeding` enum('Y','N','U') DEFAULT 'U',
`vaginal_bleeding` enum('Y','N','U') DEFAULT 'U',
`positive_urinalysis` enum('Y','N','U') DEFAULT 'U',
`lowest_hematocrit` int(11) DEFAULT NULL,
`highest_hematocrit` int(11) DEFAULT NULL,
`lowest_serum_albumin` int(11) DEFAULT NULL,
`lowest_serum_protein` int(11) DEFAULT NULL,
`lowest_pulse_pressure` int(11) DEFAULT NULL,
`lowest_wbc_count` int(11) DEFAULT NULL,
`persistent_vomiting` enum('Y','N','U') DEFAULT 'U',
`abdominal_pain_tenderness` enum('Y','N','U') DEFAULT 'U',
`mucosal_bleeding` enum('Y','N','U') DEFAULT 'U',
`lethargy_restlessness` enum('Y','N','U') DEFAULT 'U',
`liver_enlargement` enum('Y','N','U') DEFAULT 'U',
`pleural_or_abdominal_effusion` enum('Y','N','U') DEFAULT 'U',
`diarrhea` enum('Y','N','U') DEFAULT 'U',
`cough` enum('Y','N','U') DEFAULT 'U',
`conjunctivitis` enum('Y','N','U') DEFAULT 'U',
`nasal_congestion` enum('Y','N','U') DEFAULT 'U',
`sore_throat` enum('Y','N','U') DEFAULT 'U',
`jaundice` enum('Y','N','U') DEFAULT 'U',
`convulsion_or_coma` enum('Y','N','U') DEFAULT 'U',
`nausea_and_vomiting` enum('Y','N','U') DEFAULT 'U',
`arthritis` enum('Y','N','U') DEFAULT 'U',
`is_submitted` tinyint(1) NOT NULL DEFAULT '0',
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `dengue_record_dengue_id_unique` (`dengue_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `diagnosis`
--
CREATE TABLE IF NOT EXISTS `diagnosis` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`diagnosis_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`healthcareservice_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`old_consultation_id` int(11) DEFAULT NULL,
`diagnosislist_id` text COLLATE utf8_unicode_ci,
`diagnosislist_other` text COLLATE utf8_unicode_ci,
`diagnosis_type` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`diagnosis_notes` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `diagnosis_diagnosis_id_unique` (`diagnosis_id`),
KEY `diagnosis_healthcareservice_id_foreign` (`healthcareservice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `diagnosis_icd10`
--
CREATE TABLE IF NOT EXISTS `diagnosis_icd10` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`diagnosisicd10_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`diagnosis_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`icd10_classifications` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`icd10_subClassifications` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`icd10_type` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`icd10_code` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `diagnosis_icd10_diagnosisicd10_id_unique` (`diagnosisicd10_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `disability_patient`
--
CREATE TABLE IF NOT EXISTS `disability_patient` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`disability_patient_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`patient_alert_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`disability_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`disability_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `disability_patient_disability_patient_id_unique` (`disability_patient_id`),
KEY `disability_patient_patient_alert_id_foreign` (`patient_alert_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `disposition`
--
CREATE TABLE IF NOT EXISTS `disposition` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`disposition_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`healthcareservice_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`disposition` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`discharge_condition` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`discharge_datetime` datetime DEFAULT NULL,
`discharge_notes` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `disposition_disposition_id_unique` (`disposition_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `examination`
--
CREATE TABLE IF NOT EXISTS `examination` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`examination_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`healthcareservice_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`Pallor` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Rashes` varchar(48) COLLATE utf8_unicode_ci DEFAULT NULL,
`Jaundice` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Good_Skin_Turgor` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`skin_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Anicteric_Sclerae` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Pupils` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Aural_Discharge` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Intact_Tympanic_Membrane` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Nasal_Discharge` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Tonsillopharyngeal_Congestion` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Hypertrophic_Tonsils` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Palpable_Mass_B` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Exudates` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`heent_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Symmetrical_Chest_Expansion` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Clear_Breathsounds` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Crackles_Rales` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Wheezes` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`chest_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Adynamic_Precordium` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Rhythm` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Heaves` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Murmurs` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`heart_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`anatomy_heart_Others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Flat` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Globular` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Flabby` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Muscle_Guarding` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Tenderness` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Palpable_Mass` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`abdomen_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Normal_Gait` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`Full_Equal_Pulses` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`extreme_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `examination_examination_id_unique` (`examination_id`),
KEY `examination_healthcareservice_id_foreign` (`healthcareservice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `facilities`
--
CREATE TABLE IF NOT EXISTS `facilities` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`old_facility_id` int(11) DEFAULT NULL,
`facility_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`facility_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`DOH_facility_code` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`phic_accr_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`phic_accr_date` date DEFAULT NULL,
`phic_benefit_package` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`phic_benefit_package_date` date DEFAULT NULL,
`ownership_type` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`facility_type` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`provider_type` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`bmonc_cmonc` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
`hospital_license_number` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`flag_allow_referral` varchar(1) COLLATE utf8_unicode_ci DEFAULT '0',
`specializations` text COLLATE utf8_unicode_ci,
`services` text COLLATE utf8_unicode_ci,
`equipment` text COLLATE utf8_unicode_ci,
`enabled_modules` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`enabled_plugins` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`facility_logo` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `facilities_facility_id_unique` (`facility_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `facility_geodata`
--
CREATE TABLE IF NOT EXISTS `facility_geodata` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`facility_geodata_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`facility_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`population` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`barangay` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`households` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`bhs` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`households_water_1` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`households_water_2` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`households_water_3` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`households_toilet` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`households_solid_waste` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`households_sanitary` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`food_establishments` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`food_establishments_permit` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`food_handlers` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`food_handlers_permit` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`salt_samples` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`salt_samples_iodine` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `facility_contact`
--
CREATE TABLE IF NOT EXISTS `facility_contact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`facilitycontact_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`facility_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`house_no` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`building_name` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`street_name` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`village` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`barangay` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`city` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`province` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`region` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`country` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`zip` int(11) NOT NULL,
`phone` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`mobile` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`email_address` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`website` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`flag_allow_referral` varchar(1) COLLATE utf8_unicode_ci DEFAULT '0',
`bmonc_cmonc` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
`hospital_license_number` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `facility_contact_facilitycontact_id_unique` (`facilitycontact_id`),
KEY `facility_contact_facility_id_foreign` (`facility_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `facility_patient_user`
--
CREATE TABLE IF NOT EXISTS `facility_patient_user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`facilitypatientuser_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`facilityuser_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `facility_patient_user_facilitypatientuser_id_unique` (`facilitypatientuser_id`),
KEY `facility_patient_user_patient_id_foreign` (`patient_id`),
KEY `facility_patient_user_facilityuser_id_foreign` (`facilityuser_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `facility_user`
--
CREATE TABLE IF NOT EXISTS `facility_user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`facilityuser_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`user_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`old_user_id` int(11) DEFAULT NULL,
`facility_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`old_facility_id` int(11) DEFAULT NULL,
`featureroleuser_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `facility_user_facilityuser_id_unique` (`facilityuser_id`),
KEY `facility_user_user_id_foreign` (`user_id`),
KEY `facility_user_facility_id_foreign` (`facility_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `familyplanning_service`
--
CREATE TABLE IF NOT EXISTS `familyplanning_service` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`familyplanning_id` varchar(32) NOT NULL,
`healthcareservice_id` varchar(32) NOT NULL,
`conjunctiva` varchar(60) DEFAULT NULL,
`neck` varchar(60) DEFAULT NULL,
`breast` varchar(60) DEFAULT NULL,
`thorax` varchar(60) DEFAULT NULL,
`abdomen` varchar(60) DEFAULT NULL,
`extremities` varchar(60) DEFAULT NULL,
`perineum` varchar(60) DEFAULT NULL,
`vagina` varchar(60) DEFAULT NULL,
`cervix` varchar(60) DEFAULT NULL,
`consistency` varchar(60) DEFAULT NULL,
`uterus_position` varchar(60) DEFAULT NULL,
`uterus_size` varchar(60) DEFAULT NULL,
`uterus_depth` varchar(60) DEFAULT NULL,
`adnexa` varchar(60) DEFAULT NULL,
`full_term` varchar(60) DEFAULT NULL,
`abortions` varchar(60) DEFAULT NULL,
`premature` varchar(60) DEFAULT NULL,
`living_children` varchar(60) DEFAULT NULL,
`date_of_last_delivery` varchar(60) DEFAULT NULL,
`type_of_last_delivery` varchar(60) DEFAULT NULL,
`past_menstrual_period` varchar(60) DEFAULT NULL,
`last_menstrual_period` varchar(60) DEFAULT NULL,
`number_of_days_menses` varchar(60) DEFAULT NULL,
`character_of_menses` varchar(60) DEFAULT NULL,
`history_of_following` text,
`with_history_of_multiple_partners` varchar(15) DEFAULT NULL,
`sti_risks_women` text,
`sti_risks_men` text,
`violence_against_women` text,
`referred_to` text,
`referred_to_others` text,
`planning_start` varchar(60) DEFAULT NULL,
`no_of_living_children` varchar(60) DEFAULT NULL,
`plan_more_children` varchar(15) DEFAULT NULL,
`reason_for_practicing_fp` text,
`client_type` varchar(60) DEFAULT NULL,
`client_sub_type` varchar(60) DEFAULT NULL,
`dropout_date` date DEFAULT NULL,
`dropout_reason` text,
`previous_method` varchar(60) DEFAULT NULL,
`current_method` varchar(60) DEFAULT NULL,
`remarks` text,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `familyplanning_id` (`familyplanning_id`),
UNIQUE KEY `healthcareservice_id` (`healthcareservice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `features`
--
CREATE TABLE IF NOT EXISTS `features` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`feature_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`feature_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`feature_description` text COLLATE utf8_unicode_ci NOT NULL,
`status` tinyint(1) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `features_feature_id_unique` (`feature_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `feature_role`
--
CREATE TABLE IF NOT EXISTS `feature_role` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`featureroleuser_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`role_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`feature_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `feature_role_featureroleuser_id_unique` (`featureroleuser_id`),
KEY `feature_role_role_id_foreign` (`role_id`),
KEY `feature_role_feature_id_foreign` (`feature_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `forgot_password`
--
CREATE TABLE IF NOT EXISTS `forgot_password` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`forgot_password_id` int(11) NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`forgot_password_code` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `general_consultation`
--
CREATE TABLE IF NOT EXISTS `general_consultation` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`generalconsultation_id` varchar(60) NOT NULL,
`healthcareservice_id` varchar(60) NOT NULL,
`medicalcategory_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`complaint` blob,
`complaint_history` blob,
`physical_examination` blob,
`remarks` blob,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `general_consultation_generalconsultation_id_unique` (`generalconsultation_id`),
KEY `general_consultation_healthcareservice_id_foreign` (`healthcareservice_id`),
KEY `general_consultation_medicalcategory_id_foreign` (`medicalcategory_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `healthcare_addendum`
--
CREATE TABLE IF NOT EXISTS `healthcare_addendum` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`addendum_id` varchar(60) NOT NULL,
`healthcareservice_id` varchar(60) NOT NULL,
`user_id` varchar(60) NOT NULL,
`addendum_notes` blob NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `healthcare_addendum_addendum_id_unique` (`addendum_id`),
KEY `healthcare_services_healthcareservice_id_foreign` (`healthcareservice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `healthcare_services`
--
CREATE TABLE IF NOT EXISTS `healthcare_services` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`old_consultation_id` int(11) DEFAULT NULL,
`old_patient_id` int(11) DEFAULT NULL,
`old_facility_id` int(11) DEFAULT NULL,
`old_user_id` int(11) DEFAULT NULL,
`healthcareservice_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`facilitypatientuser_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`healthcareservicetype_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`consultation_type` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`encounter_type` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`parent_service_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`source_referrer_type` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`source_referrer` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`encounter_datetime` datetime DEFAULT NULL,
`seen_by` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `healthcare_services_healthcareservice_id_unique` (`healthcareservice_id`),
KEY `healthcare_services_facilitypatientuser_id_foreign` (`facilitypatientuser_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_allergy_reaction`
--
CREATE TABLE IF NOT EXISTS `lov_allergy_reaction` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`allergyreaction_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`allergyreaction_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_allergy_reaction_allergyreaction_id_unique` (`allergyreaction_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_barangays`
--
CREATE TABLE IF NOT EXISTS `lov_barangays` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`barangay_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`region_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`province_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`city_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`barangay_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`barangay_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`nscb_barangaycode` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`nscb_barangayname` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`barangay_long` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`barangay_lat` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`userLevel_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`barangay_status` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_barangays_barangay_id_unique` (`barangay_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_citymunicipalities`
--
CREATE TABLE IF NOT EXISTS `lov_citymunicipalities` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`citymunicipality_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`region_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`province_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`city_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`city_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`nscb_citycode` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`nscb_cityname` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`userLevel_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`citymun_status` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_citymunicipalities_citymunicipality_id_unique` (`citymunicipality_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_diagnosis`
--
CREATE TABLE IF NOT EXISTS `lov_diagnosis` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`diagnosis_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`diagnosis_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`diagnosis_desc` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`sequence_num` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`diagnosis_type` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_diagnosis_diagnosis_id_unique` (`diagnosis_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_disabilities`
--
CREATE TABLE IF NOT EXISTS `lov_disabilities` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`disability_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disability_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_disabilities_disability_id_unique` (`disability_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_diseases`
--
CREATE TABLE IF NOT EXISTS `lov_diseases` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`disease_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`disease_category` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`disease_code` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`disease_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`phie_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_input_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`disease_radio_values` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`sex_limit` char(1) COLLATE utf8_unicode_ci DEFAULT NULL,
`min_age_limit` int(11) DEFAULT NULL,
`max_age_limit` int(11) DEFAULT NULL,
`block_width` smallint(6) DEFAULT '1',
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_diseases_disease_id_unique` (`disease_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_doh_facility_codes`
--
CREATE TABLE IF NOT EXISTS `lov_doh_facility_codes` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`address` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`region` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`barangay` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`province` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`city` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`zip` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
`landline` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`cellphone` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`fax` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`email2` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`website` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`ownership` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`type` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`status` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_doh_facility_codes_code_unique` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_drugs`
--
CREATE TABLE IF NOT EXISTS `lov_drugs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`drugs_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`product_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`drug_specification` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_drugs_drugs_id_unique` (`drugs_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_enumerations`
--
CREATE TABLE IF NOT EXISTS `lov_enumerations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`enum_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`sequence_number` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`enum_type_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_enumerations_enum_id_unique` (`enum_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_forms`
--
CREATE TABLE IF NOT EXISTS `lov_forms` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`form_name` varchar(100) NOT NULL,
`facility` varchar(50) NOT NULL,
`status` tinyint(1) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_icd10`
--
CREATE TABLE IF NOT EXISTS `lov_icd10` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`icd10_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`icd10_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`icd10_category` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`icd10_subcategory` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`icd10_tricategory` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`icd10_title` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_icd10_icd10_id_unique` (`icd10_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_immunizations`
--
CREATE TABLE IF NOT EXISTS `lov_immunizations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`immunization_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`immunization_short_desc` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`immunization_desc` text COLLATE utf8_unicode_ci NOT NULL,
`cvx_code` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_laboratories`
--
CREATE TABLE IF NOT EXISTS `lov_laboratories` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`laboratory_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`laboratorycode` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`laboratorydescription` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_laboratories_laboratory_id_unique` (`laboratory_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_loincs`
--
CREATE TABLE IF NOT EXISTS `lov_loincs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`loinc_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`test_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`test_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`result_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`result` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`loinc_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`loinc_attribute` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`updated` date NOT NULL,
`method` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_loincs_loinc_id_unique` (`loinc_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_medicalcategory`
--
CREATE TABLE IF NOT EXISTS `lov_medicalcategory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`medicalcategory_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`medicalcategory_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`medicalcategory_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_medicalcategory_medicalcategory_id_unique` (`medicalcategory_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_medicalprocedures`
--
CREATE TABLE IF NOT EXISTS `lov_medicalprocedures` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`medicalprocedure_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`procedure_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`procedure_description` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_medicalprocedures_procedure_code_unique` (`procedure_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_modules`
--
CREATE TABLE IF NOT EXISTS `lov_modules` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`module_name` varchar(100) NOT NULL,
`icon` varchar(30) NOT NULL,
`menu_show` tinyint(1) NOT NULL,
`menu_order` int(11) NOT NULL DEFAULT '1',
`status` tinyint(1) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_province`
--
CREATE TABLE IF NOT EXISTS `lov_province` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`region_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`province_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`province_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`province_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`nscb_provincecode` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`nscb_provincename` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`userLevel_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`province_status` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_province_province_id_unique` (`province_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_referral_reasons`
--
CREATE TABLE IF NOT EXISTS `lov_referral_reasons` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`lovreferralreason_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`referral_reason` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_referral_reasons_lovreferralreason_id_unique` (`lovreferralreason_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_region`
--
CREATE TABLE IF NOT EXISTS `lov_region` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`region_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`region_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`region_short` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`region_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`region_abbreviation` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`nscb_regioncode` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`nscb_regionname` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`userLevel_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`region_status` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `lov_region_region_id_unique` (`region_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `lov_roles_access`
--
CREATE TABLE IF NOT EXISTS `lov_roles_access` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_id` int(11) NOT NULL,
`module_id` int(50) NOT NULL,
`module_access` enum('1','2','3','4') NOT NULL,
`form_id` int(50) NOT NULL,
`form_access` enum('1','2','3','4') NOT NULL,
`status` tinyint(1) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `maternalcare`
--
CREATE TABLE IF NOT EXISTS `maternalcare` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`maternalcare_id` varchar(60) NOT NULL,
`healthcareservice_id` varchar(60) DEFAULT NULL,
`old_consultation_id` int(11) DEFAULT NULL,
`old_patient_id` int(11) DEFAULT NULL,
`old_facility_id` int(11) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `maternalcare_id` (`maternalcare_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `maternalcare_delivery`
--
CREATE TABLE IF NOT EXISTS `maternalcare_delivery` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`maternaldelivery_id` varchar(60) NOT NULL,
`maternalcare_id` varchar(60) NOT NULL,
`termination_datetime` datetime DEFAULT NULL,
`child_gender` enum('F','M','U') DEFAULT NULL,
`livebirth_weight` int(11) DEFAULT NULL,
`termination_outcome` varchar(60) DEFAULT NULL,
`delivered_type` varchar(60) DEFAULT NULL,
`delivery_type_mode` varchar(60) DEFAULT NULL,
`delivery_place_type` varchar(60) DEFAULT NULL,
`delivery_place` varchar(60) DEFAULT NULL,
`attendant` varchar(60) DEFAULT NULL,
`birth_multiplicity` varchar(60) DEFAULT NULL,
`multiple_births` varchar(60) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `maternaldelivery_id` (`maternaldelivery_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `maternalcare_partograph`
--
CREATE TABLE IF NOT EXISTS `maternalcare_partograph` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`old_consultation_id` varchar(50) DEFAULT NULL,
`old_patient_id` int(11) DEFAULT NULL,
`old_facility_id` int(11) DEFAULT NULL,
`partograph_id` varchar(60) NOT NULL,
`maternalcare_id` varchar(60) NOT NULL,
`date_examined` datetime DEFAULT NULL,
`ruptured_membranes` varchar(100) DEFAULT NULL,
`rapid_assessment_result` varchar(100) DEFAULT NULL,
`time_taken` time DEFAULT NULL,
`cervical_dilation` varchar(100) DEFAULT NULL,
`fetal_station` varchar(100) DEFAULT NULL,
`amount_bleeding` int(11) DEFAULT NULL,
`no_contractions` int(11) DEFAULT NULL,
`fetal_heart_rate_per_min` int(11) DEFAULT NULL,
`bloodpressure_systolic` int(11) DEFAULT NULL,
`bloodpressure_diastolic` int(11) DEFAULT NULL,
`bloodpressure_assessment` varchar(100) DEFAULT NULL,
`pulse` varchar(100) DEFAULT NULL,
`placenta_delivered` varchar(100) DEFAULT NULL,
`amniotic_fluid_characteristic` varchar(100) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `partograph_id` (`partograph_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `maternalcare_postpartum`
--
CREATE TABLE IF NOT EXISTS `maternalcare_postpartum` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`old_postpartum_id` int(11) DEFAULT NULL,
`old_consultation_id` varchar(50) DEFAULT NULL,
`old_patient_id` int(11) DEFAULT NULL,
`old_facility_id` int(11) DEFAULT NULL,
`postpartum_id` varchar(60) NOT NULL,
`maternalcare_id` varchar(60) NOT NULL,
`breastfeeding_date` datetime DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `postpartum_id` (`postpartum_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `maternalcare_prenatal`
--
CREATE TABLE IF NOT EXISTS `maternalcare_prenatal` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`old_prenatal_id` int(11) DEFAULT NULL,
`prenatal_id` varchar(60) NOT NULL,
`maternalcare_id` varchar(60) NOT NULL,
`last_menstruation_period` datetime DEFAULT NULL,
`expected_date_delivery` datetime DEFAULT NULL,
`gravidity` int(11) DEFAULT NULL,
`parity` int(11) DEFAULT NULL,
`term` int(11) DEFAULT NULL,
`pre_term` int(11) DEFAULT NULL,
`abortion` int(11) DEFAULT NULL,
`living` int(11) DEFAULT NULL,
`old_consultation_id` varchar(50) DEFAULT NULL,
`old_patient_id` int(11) DEFAULT NULL,
`old_facility_id` int(11) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `prenatal_id` (`prenatal_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `maternalcare_supplements`
--
CREATE TABLE IF NOT EXISTS `maternalcare_supplements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`maternalsupplement_id` varchar(60) NOT NULL,
`prenatal_id` varchar(60) DEFAULT NULL,
`postpartum_id` varchar(60) DEFAULT NULL,
`pregnancy_type` int(11) DEFAULT NULL,
`supplement_type` int(11) DEFAULT NULL,
`scheduled_date` datetime DEFAULT NULL,
`actual_date` datetime DEFAULT NULL,
`quantity_dispensed` int(11) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `maternalsupplement_id` (`maternalsupplement_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `maternalcare_visits`
--
CREATE TABLE IF NOT EXISTS `maternalcare_visits` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`maternalvisits_id` varchar(60) NOT NULL,
`prenatal_id` varchar(60) DEFAULT NULL,
`postpartum_id` varchar(60) DEFAULT NULL,
`trimester_period` int(11) DEFAULT NULL,
`scheduled_visit` datetime DEFAULT NULL,
`actual_visit` datetime DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `maternalvisits_id` (`maternalvisits_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `medicalorder`
--
CREATE TABLE IF NOT EXISTS `medicalorder` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`medicalorder_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`healthcareservice_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`medicalorder_type` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_instructions` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`medicalorder_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `medicalorder_medicalorder_id_unique` (`medicalorder_id`),
KEY `medicalorder_healthcareservice_id_foreign` (`healthcareservice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `medicalorder_laboratoryexam`
--
CREATE TABLE IF NOT EXISTS `medicalorder_laboratoryexam` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`medicalorderlaboratoryexam_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`medicalorder_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`laboratory_test_type` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`laboratory_test_type_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`laboratorytest_result` text COLLATE utf8_unicode_ci,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `medicalorder_laboratoryexam_medicalorderlaboratoryexam_id_unique` (`medicalorderlaboratoryexam_id`),
KEY `medicalorder_laboratoryexam_medicalorder_id_foreign` (`medicalorder_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `medicalorder_prescription`
--
CREATE TABLE IF NOT EXISTS `medicalorder_prescription` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`medicalorderprescription_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`medicalorder_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`generic_name` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`brand_name` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`dose_quantity` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`total_quantity` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`dosage_regimen` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`dosage_regimen_others` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`duration_of_intake` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`regimen_startdate` date DEFAULT NULL,
`regimen_enddate` date DEFAULT NULL,
`prescription_remarks` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `medicalorder_prescription_medicalorderprescription_id_unique` (`medicalorderprescription_id`),
KEY `medicalorder_prescription_medicalorder_id_foreign` (`medicalorder_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `medicalorder_procedure`
--
CREATE TABLE IF NOT EXISTS `medicalorder_procedure` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`medicalorderprocedure_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`medicalorder_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`procedure_order` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`procedure_date` datetime DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `medicalorder_procedure_medicalorderprocedure_id_unique` (`medicalorderprocedure_id`),
KEY `medicalorder_procedure_medicalorder_id_foreign` (`medicalorder_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE IF NOT EXISTS `migrations` (
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `patients`
--
CREATE TABLE IF NOT EXISTS `patients` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`old_patient_id` int(11) DEFAULT NULL,
`old_facility_id` int(11) DEFAULT NULL,
`first_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`last_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`middle_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`maiden_lastname` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`maiden_middlename` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`name_suffix` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
`gender` enum('F','M','U') COLLATE utf8_unicode_ci DEFAULT 'U',
`civil_status` varchar(30) COLLATE utf8_unicode_ci DEFAULT '9',
`birthdate` date DEFAULT NULL,
`birthtime` time DEFAULT NULL,
`birthplace` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
`highest_education` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
`highesteducation_others` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
`religion` varchar(30) COLLATE utf8_unicode_ci DEFAULT 'UNKNO',
`religion_others` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`nationality` varchar(30) COLLATE utf8_unicode_ci DEFAULT 'Filipino',
`blood_type` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
`birth_order` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`referral_notif` tinyint(1) DEFAULT '1',
`broadcast_notif` tinyint(1) DEFAULT '1',
`nonreferral_notif` tinyint(1) DEFAULT '1',
`patient_consent` tinyint(1) DEFAULT '0',
`myshine_acct` tinyint(1) DEFAULT '0',
`age` int(11) DEFAULT NULL,
`photo_url` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patients_patient_id_unique` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_alert`
--
CREATE TABLE IF NOT EXISTS `patient_alert` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_alert_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`alert_type` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`alert_type_other` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_alert_patient_alert_id_unique` (`patient_alert_id`),
KEY `patient_alert_patient_id_foreign` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_childimmunizationhistory`
--
CREATE TABLE IF NOT EXISTS `patient_childimmunizationhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_immunization_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`immunization_code` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`disease_status` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_immuhistory_patient_immuhistory_id_unique` (`patient_immunization_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_contact`
--
CREATE TABLE IF NOT EXISTS `patient_contact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_contact_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`street_address` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`barangay` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`city` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`province` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`region` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`country` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`zip` int(11) DEFAULT NULL,
`phone` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`phone_ext` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`mobile` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_contact_patient_contact_id_unique` (`patient_contact_id`),
KEY `patient_contact_patient_id_foreign` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_death_info`
--
CREATE TABLE IF NOT EXISTS `patient_death_info` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_deathinfo_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`DeathCertificate_Filename` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`DeathCertificateNo` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`datetime_death` datetime DEFAULT NULL,
`PlaceDeath` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`PlaceDeath_FacilityBased` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`PlaceDeath_NID` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`PlaceDeath_NID_Others_Specify` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`mStageDeath` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`Immediate_Cause_of_Death` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`Antecedent_Cause_of_Death` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`Underlying_Cause_of_Death` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`Type_of_Death` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`Remarks` text COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_death_info_patient_deathinfo_id_unique` (`patient_deathinfo_id`),
KEY `patient_death_info_patient_id_foreign` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_elderlyimmunizationhistory`
--
CREATE TABLE IF NOT EXISTS `patient_elderlyimmunizationhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_immunization_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`disease_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`immunization_code` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`disease_status` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`actual_date` datetime DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_immunization_patient_immunization_id_unique` (`patient_immunization_id`),
KEY `patient_immunization_patient_id_foreign` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_emergencyinfo`
--
CREATE TABLE IF NOT EXISTS `patient_emergencyinfo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_emergencyinfo_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`emergency_name` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`emergency_relationship` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`emergency_phone` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`emergency_mobile` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`emergency_address` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_emergencyinfo_patient_emergencyinfo_id_unique` (`patient_emergencyinfo_id`),
KEY `patient_emergencyinfo_patient_id_foreign` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_employmentinfo`
--
CREATE TABLE IF NOT EXISTS `patient_employmentinfo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_employmentinfo_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`occupation` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_name` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_phone` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_unitno` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_address` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_region` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_province` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_citymun` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_barangay` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_zip` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_country` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_employmentinfo_patient_employmentinfo_id_unique` (`patient_employmentinfo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_familyinfo`
--
CREATE TABLE IF NOT EXISTS `patient_familyinfo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_familyinfo_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`father_firstname` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`father_middlename` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`father_lastname` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`suffix` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`father_alive` tinyint(1) DEFAULT NULL,
`mother_firstname` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`mother_middlename` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`mother_lastname` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`mother_alive` tinyint(1) DEFAULT NULL,
`ctr_householdmembers_lt10yrs` int(11) DEFAULT NULL,
`ctr_householdmembers_gt10yrs` int(11) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_familyinfo_patient_familyinfo_id_unique` (`patient_familyinfo_id`),
KEY `patient_familyinfo_patient_id_foreign` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_familymedicalhistory`
--
CREATE TABLE IF NOT EXISTS `patient_familymedicalhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_fmedicalhistory_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_date` text COLLATE utf8_unicode_ci,
`disease_status` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`remarks` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_fmedicalhistory_patient_fmedicalhistory_id_unique` (`patient_fmedicalhistory_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_family_group`
--
CREATE TABLE IF NOT EXISTS `patient_family_group` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_familygroup_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`familygroup_name` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_family_group_patient_familygroup_id_unique` (`patient_familygroup_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_family_group_members`
--
CREATE TABLE IF NOT EXISTS `patient_family_group_members` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_familygroupmember_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_familygroup_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`patient_relationship` int(11) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_family_group_members_patient_familygroupmember_id_unique` (`patient_familygroupmember_id`),
KEY `patient_family_group_members_patient_familygroup_id_foreign` (`patient_familygroup_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_fpcounseling`
--
CREATE TABLE IF NOT EXISTS `patient_fpcounseling` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_fpcounseling_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`counseling_date` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`counseling_status` text COLLATE utf8_unicode_ci,
`remarks` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_fpcounseling_patient_fpcounseling_id_unique` (`patient_fpcounseling_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_medicalhistory`
--
CREATE TABLE IF NOT EXISTS `patient_medicalhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_medicalhistory_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_date` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_status` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`remarks` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_medicalhistory_patient_medicalhistory_id_unique` (`patient_medicalhistory_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_menstrualhistory`
--
CREATE TABLE IF NOT EXISTS `patient_menstrualhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_menstrualhistory_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`menarche` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_period_date` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_period_duration` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`interval` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`no_of_pads` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`onset_intercourse` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`birthcontrol_method` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`menopause` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`menopause_age` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`remarks` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_menstrualhistory_patient_menstrualhistory_id_unique` (`patient_menstrualhistory_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_monitoring`
--
CREATE TABLE IF NOT EXISTS `patient_monitoring` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`monitoring_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`bloodpressure_systolic` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`bloodpressure_diastolic` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`bloodpressure_assessment` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `monitoring_id` (`monitoring_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_personalhistory`
--
CREATE TABLE IF NOT EXISTS `patient_personalhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_personalhistory_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`smoking` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`packs` int(11) DEFAULT NULL,
`bottles` int(11) DEFAULT NULL,
`drinking` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`taking_drugs` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`remarks` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_personalhistory_patient_personalhistory_id_unique` (`patient_personalhistory_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_philhealthinfo`
--
CREATE TABLE IF NOT EXISTS `patient_philhealthinfo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_philhealthinfo_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`provider_account_id` int(11) DEFAULT NULL,
`philhealth_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`philheath_category` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`member_type` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`ccash_transfer` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`benefit_type` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`pamilya_pantawid_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`indigenous_group` tinyint(1) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_philhealthinfo_patient_philhealthinfo_id_unique` (`patient_philhealthinfo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_pregnancyhistory`
--
CREATE TABLE IF NOT EXISTS `patient_pregnancyhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_pregnancyhistory_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`gravidity` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`parity` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`type_of_delivery` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`no_of_term` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`no_of_premature` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`no_of_abortion` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`no_of_children` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`pre-eclampsia` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`remarks` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_pregnancyhistory_patient_pregnancyhistory_id_unique` (`patient_pregnancyhistory_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_pregnancyimmunizationhistory`
--
CREATE TABLE IF NOT EXISTS `patient_pregnancyimmunizationhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_immunization_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`immunization_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`scheduled_date` datetime NOT NULL,
`actual_date` datetime NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_immunization_patient_immunization_id_unique` (`patient_immunization_id`),
KEY `patient_immunization_patient_id_foreign` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_surgicalhistory`
--
CREATE TABLE IF NOT EXISTS `patient_surgicalhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_surgicalhistory_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`surgery` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`surgery_date` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`remarks` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_surgicalhistory_patient_surgicalhistory_id_unique` (`patient_surgicalhistory_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `patient_womenimmunizationhistory`
--
CREATE TABLE IF NOT EXISTS `patient_womenimmunizationhistory` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`patient_immunization_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`immunization_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`disease_status` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`actual_date` datetime NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `patient_immunization_patient_immunization_id_unique` (`patient_immunization_id`),
KEY `patient_immunization_patient_id_foreign` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `pedia_record`
--
CREATE TABLE IF NOT EXISTS `pedia_record` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`pedia_id` int(11) NOT NULL,
`healthcareservice_id` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`case_status` varchar(30) DEFAULT NULL,
`newborn_screening_referral_date` datetime DEFAULT NULL,
`newborn_screening_actual_date` datetime DEFAULT NULL,
`child_protection_date` datetime DEFAULT NULL,
`tt_status` varchar(20) DEFAULT NULL,
`birth_weight` double DEFAULT NULL,
`vit_a_supp_first_date` datetime DEFAULT NULL,
`vit_a_first_age` int(11) DEFAULT NULL,
`vit_a_supp_second_date` datetime DEFAULT NULL,
`vit_a_second_age` int(11) DEFAULT NULL,
`iron_supp_start_date` datetime DEFAULT NULL,
`iron_supp_end_date` datetime DEFAULT NULL,
`bcg_recommended_date` datetime DEFAULT NULL,
`bcg_actual_date` datetime DEFAULT NULL,
`dpt1_recommended_date` datetime DEFAULT NULL,
`dpt1_actual_date` datetime DEFAULT NULL,
`dpt2_recommended_date` datetime DEFAULT NULL,
`dpt2_actual_date` datetime DEFAULT NULL,
`dpt3_recommended_date` datetime DEFAULT NULL,
`dpt3_actual_date` datetime DEFAULT NULL,
`hepa_b1_recommended_date` datetime DEFAULT NULL,
`hepa_b1_actual_date` datetime DEFAULT NULL,
`hepa_b2_recommended_date` datetime DEFAULT NULL,
`hepa_b2_actual_date` datetime DEFAULT NULL,
`hepa_b3_recommended_date` datetime DEFAULT NULL,
`hepa_b3_actual_date` datetime DEFAULT NULL,
`measles_recommended_date` datetime DEFAULT NULL,
`measles_actual_date` datetime DEFAULT NULL,
`opv1_recommended_date` datetime DEFAULT NULL,
`opv1_actual_date` datetime DEFAULT NULL,
`opv2_recommended_date` datetime DEFAULT NULL,
`opv2_actual_date` datetime DEFAULT NULL,
`opv3_recommended_date` datetime DEFAULT NULL,
`opv3_actual_date` datetime DEFAULT NULL,
`is_breastfed_first_month` tinyint(1) DEFAULT NULL,
`is_breastfed_second_month` tinyint(1) DEFAULT NULL,
`is_breastfed_third_month` tinyint(1) DEFAULT NULL,
`is_breastfed_fourth_month` tinyint(1) DEFAULT NULL,
`is_breastfed_fifth_month` tinyint(1) DEFAULT NULL,
`is_breastfed_sixth_month` tinyint(1) DEFAULT NULL,
`breastfeed_sixth_month` datetime DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `pedia_record_pedia_id_unique` (`pedia_id`),
KEY `pedia_record_healthcareservice_id_foreign` (`healthcareservice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `measles_record`
--
CREATE TABLE IF NOT EXISTS `measles_record` (
`measles_id` varchar(32) NOT NULL,
`healthcareservice_id` varchar(32) NOT NULL,
`signs_rashes` enum('Y','N','U') DEFAULT 'U',
`rash_onset` datetime DEFAULT NULL,
`rash_duration` int(40) DEFAULT NULL,
`generalized_rash` enum('Y','N','U') DEFAULT 'U',
`origin_on_body` varchar(40) DEFAULT NULL,
`direction_of_spread` varchar(40) DEFAULT NULL,
`signs_fever` enum('Y','N','U') DEFAULT 'U',
`temperature` int(10) DEFAULT NULL,
`temperature_skin` enum('H','W','N') DEFAULT 'N',
`cough` enum('Y','N','U') DEFAULT 'U',
`runny_nose_coryza` enum('Y','N','U') DEFAULT 'U',
`conjunctivitis` enum('Y','N','U') DEFAULT 'U',
`kopliks_spots` enum('Y','N','U') DEFAULT 'U',
`notes` text,
`hospitalized` enum('Y','N','U') DEFAULT 'U',
`days_hospitalized` int(10) DEFAULT NULL,
`pneumonia` enum('Y','N','U') DEFAULT 'U',
`encephalitis` enum('Y','N','U') DEFAULT 'U',
`other_complications` text,
`is_submitted` tinyint(1) NOT NULL DEFAULT '0',
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `phie_sync`
--
CREATE TABLE `phie_sync` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`sync_id` varchar(60) NOT NULL,
`facilityuser_id` varchar(60) NOT NULL,
`status` tinyint(1) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `phie_sync_sync_id_unique` (`sync_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `sync`
--
CREATE TABLE IF NOT EXISTS `sync` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`facility_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Table structure for table `plugins`
--
CREATE TABLE IF NOT EXISTS `plugins` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`facility_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`plugin_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`plugin_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`values` blob NOT NULL,
`primary_key` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`primary_key_value` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`status` tinyint(1) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `referrals`
--
CREATE TABLE IF NOT EXISTS `referrals` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`referral_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`facility_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`healthcareservice_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`urgency` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`method_transport` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`transport_other` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`management_done` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`medical_given` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`referral_remarks` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`referral_status` int(11) DEFAULT NULL,
`accept_date` timestamp NULL DEFAULT NULL,
`decline_date` timestamp NULL DEFAULT NULL,
`decline_reason` text COLLATE utf8_unicode_ci,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `referrals_referral_id_unique` (`referral_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `referral_messages`
--
CREATE TABLE IF NOT EXISTS `referral_messages` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`referralmessage_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`referral_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`referral_subject` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`referral_message` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
`referral_datetime` datetime DEFAULT NULL,
`referral_message_status` int(11) DEFAULT NULL,
`referrer` int(11) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `referral_messages_referralmessage_id_unique` (`referralmessage_id`),
KEY `referral_messages_referral_id_foreign` (`referral_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `referral_reasons`
--
CREATE TABLE IF NOT EXISTS `referral_reasons` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`referralreason_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`referral_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`lovreferralreason_id` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `referral_reasons_referralreason_id_unique` (`referralreason_id`),
KEY `referral_reasons_referral_id_foreign` (`referral_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `reminders`
--
CREATE TABLE IF NOT EXISTS `reminders` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`reminder_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`facilityuser_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`patient_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`user_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`remindermessage_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `reminders_reminder_id_unique` (`reminder_id`),
KEY `reminders_remindermessage_id_foreign` (`remindermessage_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `reminder_message`
--
CREATE TABLE IF NOT EXISTS `reminder_message` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`remindermessage_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`reminder_subject` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`reminder_message` text COLLATE utf8_unicode_ci NOT NULL,
`appointment_datetime` datetime NOT NULL,
`daysbeforesending` int(11) NOT NULL,
`remindermessage_type` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`sent_status` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`status` enum('1','2','3') COLLATE utf8_unicode_ci NOT NULL,
`reminder_type` enum('1','2','3','4') COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `reminder_message_remindermessage_id_unique` (`remindermessage_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
CREATE TABLE IF NOT EXISTS `roles` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`role_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`role_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`access_level` tinyint(4) NOT NULL,
`role_create` tinyint(1) NOT NULL,
`role_read` tinyint(1) NOT NULL,
`role_update` tinyint(1) NOT NULL,
`role_delete` tinyint(1) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `roles_role_id_unique` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `roles_access`
--
CREATE TABLE IF NOT EXISTS `roles_access` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`role_id` varchar(100) NOT NULL,
`facilityuser_id` varchar(100) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `sessions`
--
CREATE TABLE IF NOT EXISTS `sessions` (
`id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`payload` text COLLATE utf8_unicode_ci NOT NULL,
`last_activity` int(11) NOT NULL,
UNIQUE KEY `sessions_id_unique` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tuberculosis_clinical_history_record`
--
CREATE TABLE IF NOT EXISTS `tuberculosis_clinical_history_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tuberculosis_clinical_history_id` varchar(60) NOT NULL,
`tuberculosis_id` varchar(60) NOT NULL,
`weight_in_kg` int(4) NOT NULL,
`unexplained_fever` enum('Y','N','U') NOT NULL DEFAULT 'U',
`unexplained_cough` enum('Y','N','U') NOT NULL DEFAULT 'U',
`unimproved_well_being` enum('Y','N','U') NOT NULL DEFAULT 'U',
`poor_appetite` enum('Y','N','U') NOT NULL DEFAULT 'U',
`positive_pe_findings` enum('Y','N','U') NOT NULL DEFAULT 'U',
`side_effects` varchar(50) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `tuberculosis_clinical_history_id` (`tuberculosis_clinical_history_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `tuberculosis_dosages_preparations_record`
--
CREATE TABLE IF NOT EXISTS `tuberculosis_dosages_preparations_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tuberculosis_dosages_preparations_id` varchar(60) NOT NULL,
`tuberculosis_id` varchar(60) NOT NULL,
`child_isoniazid` int(5) NOT NULL,
`child_rifampicin` int(5) NOT NULL,
`child_pyrazinamide` int(5) NOT NULL,
`child_ethambutol` int(5) NOT NULL,
`child_streptomycin` int(5) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `tuberculosis_dosages_preparations_id` (`tuberculosis_dosages_preparations_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `tuberculosis_drug_intake_record`
--
CREATE TABLE IF NOT EXISTS `tuberculosis_drug_intake_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tuberculosis_drug_intake_id` varchar(60) NOT NULL,
`tuberculosis_id` varchar(60) NOT NULL,
`adult_date_of_administration` datetime NOT NULL,
`adult_drug_administrator` enum('TP','SLF','MISS') NOT NULL DEFAULT 'MISS',
`adult_intake_type` enum('I','C') NOT NULL DEFAULT 'I',
`adult_drug_intake_remarks` varchar(200) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `tuberculosis_drug_intake_id` (`tuberculosis_drug_intake_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `tuberculosis_dssm_record`
--
CREATE TABLE IF NOT EXISTS `tuberculosis_dssm_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tuberculosis_dssm_id` varchar(60) NOT NULL,
`tuberculosis_id` varchar(60) NOT NULL,
`month` int(11) NOT NULL,
`due_date` datetime NOT NULL,
`date_examined` datetime NOT NULL,
`result` varchar(40) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `tuberculosis_dssm_id` (`tuberculosis_dssm_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `tuberculosis_record`
--
CREATE TABLE IF NOT EXISTS `tuberculosis_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tuberculosis_id` varchar(60) NOT NULL,
`healthcareservice_id` varchar(60) NOT NULL,
`tuberculin_result` int(11) NOT NULL,
`tuberculin_date_read` datetime NOT NULL,
`cxr_findings` varchar(200) NOT NULL,
`cxr_date_of_exam` datetime NOT NULL,
`cxr_tbdc` int(11) NOT NULL,
`other_exam_exam_conducted` int(11) NOT NULL,
`other_exam_date_of_exam` datetime NOT NULL,
`bcg_scar` enum('Y','N','D') NOT NULL DEFAULT 'D',
`category_of_treatment` enum('I','II','III') NOT NULL DEFAULT 'I',
`xpert_results` varchar(40) NOT NULL,
`xpert_date_of_collection` datetime NOT NULL,
`pict_done` enum('Y','N','U') NOT NULL DEFAULT 'U',
`pict_date_administered` datetime NOT NULL,
`diagnosis_tuberculosis_type` enum('TB','TBI','TBE','NTB') NOT NULL DEFAULT 'NTB',
`diagnosis_remarks` int(11) NOT NULL,
`tb_drugs_before` enum('Y','N','U') NOT NULL DEFAULT 'U',
`tb_drugs_date_administered` datetime NOT NULL,
`tb_drugs_duration` enum('L','M') NOT NULL DEFAULT 'L',
`tb_drugs_taken` varchar(40) NOT NULL,
`bacteriological_status` enum('BC','CD','ND') NOT NULL DEFAULT 'ND',
`anatomical_site` enum('P','EP') NOT NULL DEFAULT 'EP',
`anatomical_site_specify` varchar(40) NOT NULL,
`bacteriology_registration_group` enum('N','R','TAF','TALF','PTOU','OTH') NOT NULL DEFAULT 'OTH',
`bacteriology_registration_group_specify` varchar(40) NOT NULL,
`treatment_outcome_date_started` datetime NOT NULL,
`treatment_outcome_date_last_intake` datetime NOT NULL,
`treatment_outcome_result` enum('C','TC','D','F','LTF','NE','EFC') NOT NULL DEFAULT 'EFC',
`treatment_outcome_additional_remarks` varchar(200) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `tuberculosis_id` (`tuberculosis_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`old_user_id` int(11) DEFAULT NULL,
`password` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`salt` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`activation_code` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`first_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`middle_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`last_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`suffix` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`civil_status` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`gender` enum('F','M','U') COLLATE utf8_unicode_ci NOT NULL,
`birth_date` date NOT NULL,
`user_type` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`profile_picture` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`prescription_header` text COLLATE utf8_unicode_ci,
`qrcode` varchar(1) COLLATE utf8_unicode_ci DEFAULT '0',
`status` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`old_profile` tinyint(1) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `users_user_id_unique` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_contact`
--
CREATE TABLE IF NOT EXISTS `user_contact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`usercontact_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`user_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`street_address` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`barangay` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`city` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`province` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`region` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`country` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`zip` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`phone` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`mobile` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`house_no` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`building_name` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`street_name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`village` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_contact_user_id_foreign` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_md`
--
CREATE TABLE IF NOT EXISTS `user_md` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`usermd_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`user_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`profession` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`professional_type_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`professional_license_number` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`med_school` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`med_school_grad_yr` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`residency_trn_inst` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`residency_grad_yr` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_md_user_id_foreign` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_usage_stat`
--
CREATE TABLE IF NOT EXISTS `user_usage_stat` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`userusagestat_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`user_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`login_datetime` datetime NOT NULL,
`logout_datetime` datetime NOT NULL,
`device` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_usage_stat_user_id_foreign` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `vital_physical`
--
CREATE TABLE IF NOT EXISTS `vital_physical` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`vitalphysical_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`healthcareservice_id` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`bloodpressure_systolic` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`bloodpressure_diastolic` varchar(48) COLLATE utf8_unicode_ci DEFAULT NULL,
`bloodpressure_assessment` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`heart_rate` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`pulse_rate` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`respiratory_rate` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`temperature` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`height` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`weight` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`BMI_category` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`waist` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`pregnant` tinyint(1) DEFAULT NULL,
`weight_loss` tinyint(1) DEFAULT NULL,
`with_intact_uterus` tinyint(1) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `vital_physical_vitalphysical_id_unique` (`vitalphysical_id`),
KEY `vital_physical_healthcareservice_id_foreign` (`healthcareservice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci 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 |
02e30445c79e442ea9f3690262d2f7de08178cc0 | SQL | MasanskiAI/Test | /Base results/Task3.1/task6.sql | WINDOWS-1252 | 251 | 3.640625 | 4 | [] | no_license | -- 6. Show total UnitPriceof each SalesOrderID in the year 2005.
SELECT SalesOrderID, SUM(UnitPrice) AS TotalUnitPrice
FROM Sales.SalesOrderDetail
WHERE ModifiedDate BETWEEN '20050101' AND '20051231'
GROUP BY SalesOrderID
ORDER BY SalesOrderID | true |
0d7333840142b05c6bb37c6392d585d04636e866 | SQL | gsiems/sql-tidy | /t/input/ora_merge_001.sql | UTF-8 | 2,957 | 3.046875 | 3 | [
"Artistic-2.0"
] | permissive | MERGE INTO db_dashboard.prev_query_stat o
USING db_dashboard.curr_query_stat n
ON ( n.username = o.username
AND n.osuser = o.osuser
AND n.address = o.address
AND n.hash_value = o.hash_value )
WHEN MATCHED THEN
UPDATE
SET o.polling_dt = n.polling_dt,
o.sql_address_source = n.sql_address_source,
o.status = n.status,
o.temp_used_bytes = n.temp_used_bytes,
o.sql_id = n.sql_id,
o.fetches = n.fetches,
o.executions = n.executions,
o.elapsed_time = n.elapsed_time,
o.rows_processed = n.rows_processed,
o.sharable_mem = n.sharable_mem,
o.persistent_mem = n.persistent_mem,
o.runtime_mem = n.runtime_mem,
o.disk_reads = n.disk_reads,
o.direct_writes = n.direct_writes,
o.buffer_gets = n.buffer_gets,
o.cpu_time = n.cpu_time,
o.physical_read_requests = n.physical_read_requests,
o.physical_read_bytes = n.physical_read_bytes,
o.physical_write_requests = n.physical_write_requests,
o.physical_write_bytes = n.physical_write_bytes,
o.sql_text = n.sql_text
WHEN NOT MATCHED THEN
INSERT (
username,
osuser,
polling_dt,
sql_address_source,
status,
temp_used_bytes,
address,
hash_value,
sql_id,
fetches,
executions,
elapsed_time,
rows_processed,
sharable_mem,
persistent_mem,
runtime_mem,
disk_reads,
direct_writes,
buffer_gets,
cpu_time,
physical_read_requests,
physical_read_bytes,
physical_write_requests,
physical_write_bytes,
sql_text )
VALUES (
n.username,
n.osuser,
n.polling_dt,
n.sql_address_source,
n.status,
n.temp_used_bytes,
n.address,
n.hash_value,
n.sql_id,
n.fetches,
n.executions,
n.elapsed_time,
n.rows_processed,
n.sharable_mem,
n.persistent_mem,
n.runtime_mem,
n.disk_reads,
n.direct_writes,
n.buffer_gets,
n.cpu_time,
n.physical_read_requests,
n.physical_read_bytes,
n.physical_write_requests,
n.physical_write_bytes,
n.sql_text ) ;
| true |
123788930c2f6761531bd7b5de97d54454892e30 | SQL | xackery/eqdb | /npc_types.sql | UTF-8 | 6,736 | 2.609375 | 3 | [] | no_license | -- MySQL dump 10.16 Distrib 10.1.21-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: localhost
-- ------------------------------------------------------
-- Server version 10.1.21-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES UTF8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `npc_types`
--
DROP TABLE IF EXISTS `npc_types`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `npc_types` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`lastname` varchar(32) DEFAULT NULL,
`level` tinyint(2) unsigned NOT NULL DEFAULT '0',
`race` smallint(5) unsigned NOT NULL DEFAULT '0',
`class` tinyint(2) unsigned NOT NULL DEFAULT '0',
`bodytype` int(11) NOT NULL DEFAULT '1',
`hp` int(11) NOT NULL DEFAULT '0',
`mana` int(11) NOT NULL DEFAULT '0',
`gender` tinyint(2) unsigned NOT NULL DEFAULT '0',
`texture` tinyint(2) unsigned NOT NULL DEFAULT '0',
`helmtexture` tinyint(2) unsigned NOT NULL DEFAULT '0',
`herosforgemodel` int(11) NOT NULL DEFAULT '0',
`size` float NOT NULL DEFAULT '0',
`hp_regen_rate` int(11) unsigned NOT NULL DEFAULT '0',
`mana_regen_rate` int(11) unsigned NOT NULL DEFAULT '0',
`loottable_id` int(11) unsigned NOT NULL DEFAULT '0',
`merchant_id` int(11) unsigned NOT NULL DEFAULT '0',
`alt_currency_id` int(11) unsigned NOT NULL DEFAULT '0',
`npc_spells_id` int(11) unsigned NOT NULL DEFAULT '0',
`npc_spells_effects_id` int(11) unsigned NOT NULL DEFAULT '0',
`npc_faction_id` int(11) NOT NULL DEFAULT '0',
`adventure_template_id` int(10) unsigned NOT NULL DEFAULT '0',
`trap_template` int(10) unsigned DEFAULT '0',
`mindmg` int(10) unsigned NOT NULL DEFAULT '0',
`maxdmg` int(10) unsigned NOT NULL DEFAULT '0',
`attack_count` smallint(6) NOT NULL DEFAULT '-1',
`npcspecialattks` varchar(36) NOT NULL DEFAULT '',
`special_abilities` text,
`aggroradius` int(10) unsigned NOT NULL DEFAULT '0',
`assistradius` int(10) unsigned NOT NULL DEFAULT '0',
`face` int(10) unsigned NOT NULL DEFAULT '1',
`luclin_hairstyle` int(10) unsigned NOT NULL DEFAULT '1',
`luclin_haircolor` int(10) unsigned NOT NULL DEFAULT '1',
`luclin_eyecolor` int(10) unsigned NOT NULL DEFAULT '1',
`luclin_eyecolor2` int(10) unsigned NOT NULL DEFAULT '1',
`luclin_beardcolor` int(10) unsigned NOT NULL DEFAULT '1',
`luclin_beard` int(10) unsigned NOT NULL DEFAULT '0',
`drakkin_heritage` int(10) NOT NULL DEFAULT '0',
`drakkin_tattoo` int(10) NOT NULL DEFAULT '0',
`drakkin_details` int(10) NOT NULL DEFAULT '0',
`armortint_id` int(10) unsigned NOT NULL DEFAULT '0',
`armortint_red` tinyint(3) unsigned NOT NULL DEFAULT '0',
`armortint_green` tinyint(3) unsigned NOT NULL DEFAULT '0',
`armortint_blue` tinyint(3) unsigned NOT NULL DEFAULT '0',
`d_melee_texture1` int(11) NOT NULL DEFAULT '0',
`d_melee_texture2` int(11) NOT NULL DEFAULT '0',
`ammo_idfile` varchar(30) NOT NULL DEFAULT 'IT10',
`prim_melee_type` tinyint(4) unsigned NOT NULL DEFAULT '28',
`sec_melee_type` tinyint(4) unsigned NOT NULL DEFAULT '28',
`ranged_type` tinyint(4) unsigned NOT NULL DEFAULT '7',
`runspeed` float NOT NULL DEFAULT '0',
`MR` smallint(5) NOT NULL DEFAULT '0',
`CR` smallint(5) NOT NULL DEFAULT '0',
`DR` smallint(5) NOT NULL DEFAULT '0',
`FR` smallint(5) NOT NULL DEFAULT '0',
`PR` smallint(5) NOT NULL DEFAULT '0',
`Corrup` smallint(5) NOT NULL DEFAULT '0',
`PhR` smallint(5) unsigned NOT NULL DEFAULT '0',
`see_invis` smallint(4) NOT NULL DEFAULT '0',
`see_invis_undead` smallint(4) NOT NULL DEFAULT '0',
`qglobal` int(2) unsigned NOT NULL DEFAULT '0',
`AC` smallint(5) NOT NULL DEFAULT '0',
`npc_aggro` tinyint(4) NOT NULL DEFAULT '0',
`spawn_limit` tinyint(4) NOT NULL DEFAULT '0',
`attack_speed` float NOT NULL DEFAULT '0',
`attack_delay` tinyint(3) unsigned NOT NULL DEFAULT '30',
`findable` tinyint(4) NOT NULL DEFAULT '0',
`STR` mediumint(8) unsigned NOT NULL DEFAULT '75',
`STA` mediumint(8) unsigned NOT NULL DEFAULT '75',
`DEX` mediumint(8) unsigned NOT NULL DEFAULT '75',
`AGI` mediumint(8) unsigned NOT NULL DEFAULT '75',
`_INT` mediumint(8) unsigned NOT NULL DEFAULT '80',
`WIS` mediumint(8) unsigned NOT NULL DEFAULT '75',
`CHA` mediumint(8) unsigned NOT NULL DEFAULT '75',
`see_hide` tinyint(4) NOT NULL DEFAULT '0',
`see_improved_hide` tinyint(4) NOT NULL DEFAULT '0',
`trackable` tinyint(4) NOT NULL DEFAULT '1',
`isbot` tinyint(4) NOT NULL DEFAULT '0',
`exclude` tinyint(4) NOT NULL DEFAULT '1',
`ATK` mediumint(9) NOT NULL DEFAULT '0',
`Accuracy` mediumint(9) NOT NULL DEFAULT '0',
`Avoidance` mediumint(9) unsigned NOT NULL DEFAULT '0',
`slow_mitigation` smallint(4) NOT NULL DEFAULT '0',
`version` smallint(5) unsigned NOT NULL DEFAULT '0',
`maxlevel` tinyint(3) NOT NULL DEFAULT '0',
`scalerate` int(11) NOT NULL DEFAULT '100',
`private_corpse` tinyint(3) unsigned NOT NULL DEFAULT '0',
`unique_spawn_by_name` tinyint(3) unsigned NOT NULL DEFAULT '0',
`underwater` tinyint(3) unsigned NOT NULL DEFAULT '0',
`isquest` tinyint(3) NOT NULL DEFAULT '0',
`emoteid` int(10) unsigned NOT NULL DEFAULT '0',
`spellscale` float NOT NULL DEFAULT '100',
`healscale` float NOT NULL DEFAULT '100',
`no_target_hotkey` tinyint(1) unsigned NOT NULL DEFAULT '0',
`raid_target` tinyint(1) unsigned NOT NULL DEFAULT '0',
`armtexture` tinyint(2) NOT NULL DEFAULT '0',
`bracertexture` tinyint(2) NOT NULL DEFAULT '0',
`handtexture` tinyint(2) NOT NULL DEFAULT '0',
`legtexture` tinyint(2) NOT NULL DEFAULT '0',
`feettexture` tinyint(2) NOT NULL DEFAULT '0',
`light` tinyint(2) NOT NULL DEFAULT '0',
`walkspeed` tinyint(2) NOT NULL DEFAULT '0',
`peqid` int(11) NOT NULL DEFAULT '0',
`unique_` tinyint(2) NOT NULL DEFAULT '0',
`fixed` tinyint(2) NOT NULL DEFAULT '0',
`ignore_despawn` tinyint(2) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=999279 DEFAULT CHARSET=latin1 PACK_KEYS=0;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!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 */;
| true |
511ed2e842e9f835e672677cb6a3c2cb81aefcc1 | SQL | proshunsuke/vg-1day-2018-09-16 | /modeling/db/migrations/20180914044044-create_vegetable_logs.sql | UTF-8 | 426 | 3.375 | 3 | [] | no_license | -- +migrate Up
CREATE TABLE vegetable_logs (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
point_get_date DATE NOT NULL,
user_id INT UNSIGNED NOT NULL,
vegetable_id INT UNSIGNED NOT NULL,
PRIMARY KEY (id),
UNIQUE (point_get_date, user_id),
FOREIGN KEY (user_id) REFERENCES users (id),
FOREIGN KEY (vegetable_id) REFERENCES vegetables (id)
);
-- +migrate Down
DROP TABLE vegetable_logs;
| true |
2d30aee871b2fc37fb611f6a400ee79bf253ee3e | SQL | Elder2004/database-exercises | /database-exercise/Downloads/employees_db/where_exercises.sql | UTF-8 | 736 | 3.390625 | 3 | [] | no_license | use employees;
SELECT *
FROM employees
WHERE first_name IN ('Irena', 'Vidya', 'Maya');
SELECT *
FROM employees
WHERE last_name LIKE 'E%';
SELECT *
FROM employees
WHERE hire_date >= '1990-01-01' and hire_date <= '1999-21-31';
SELECT *
FROM employees
WHERE birth_date LIKE '%12-25';
SELECT *
FROM employees
WHERE last_name LIKE '%q%';
SELECT *
FROM employees
WHERE first_name ='Irena' or first_name = 'Vidya' or first_name = 'Maya';
SELECT *
FROM employees
WHERE last_name LIKE '%E%';
SELECT *
FROM employees
WHERE last_name LIKE 'E%' and last_name LIKE '%E';
SELECT *
FROM employees
WHERE hire_date like '%199%' and birth_date LIKE '%12-25';
SELECT *
FROM employees
WHERE last_name LIKE '%q%' AND last_name NOT LIKE '%qu%';
| true |
b51e378574b5955d413403b2b024c1cd06eecc94 | SQL | egovernments/DIGIT-OSS | /core-services/xstate-chatbot/nodejs/db/migration/main/V20201016131300__chat.sql | UTF-8 | 299 | 2.984375 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | CREATE TABLE eg_chat_state_v2 (
id SERIAL,
user_id TEXT,
active BOOLEAN,
state jsonb,
PRIMARY KEY (id)
);
CREATE INDEX IF NOT EXISTS eg_chat_state_idx_user_id_v2 ON eg_chat_state_v2 (user_id);
CREATE INDEX IF NOT EXISTS eg_chat_state_idx_active_v2 ON eg_chat_state_v2 (active);
| true |
66448291af54be98dcfd64fb05ac3b9b8ae4f82f | SQL | ellawilby/InternshipJune2017 | /DNS/bind.sql | UTF-8 | 8,611 | 3 | 3 | [] | no_license | --
-- Database schema
--
create table soa (
zone_ varchar(255) primary key, -- zone name
ttl int not NULL default '1 day', -- time to live
mname varchar(256) not NULL, -- the original or primary source of data for this zone
rname varchar(256) not NULL, -- responsible person's email
serial char(10) not NULL default -- number of the original copy of the zone
regexp_replace(current_date::text, '(....)-(..)-(..)', '\1\2\3') || '01', -- generate serial from date
refresh_ int not NULL default '3 hours', -- time interval before the zone should be refreshed
retry int not NULL default '1 hour', -- time interval that should elapse before a failed refresh should be retried
expire int not NULL default '1 week', -- time interval that can elapse before the zone is no longer authoritative
minimum int not NULL default '1 day' -- minimum TTL field that should be exported with any RR from this zone
);
-- INSERT INTO "tempSchema".soa(zone_, ttl, mname, rname, serial, refresh_, retry, expire, minimum) VALUES ('.NET', '15 min'::interval, 'a.gtld-servers.net.', 'nstld.verisign-grs.com.', '1487827201', '30 min'::interval, '15 min'::interval, '1 week'::interval, '1 day'::interval);
create table a (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade, -- zone must exists in soa table
ttl int default NULL,
host varchar(256) not NULL default '@',
address inet not NULL
);
create table aaaa (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade,
ttl int default NULL,
host varchar(256) not NULL default '@',
address inet not NULL
);
create table txt (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade,
ttl int default NULL,
host varchar(256) not NULL default '@',
txt_data text not NULL
);
create table spf (
zone_ varchar(256) not NULL references soa on delete cascade,
ttl int default NULL,
host varchar(256) not NULL default '@',
txt_data text not NULL
);
create table ns (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade,
ttl int default NULL,
host varchar(256) not NULL default '@',
nsdname varchar(256) not NULL
);
-- INSERT INTO "tempSchema".ns(zone_, ttl, host, nsdname) VALUES ('.NET', '15 min'::interval, 'TOOLS24', 'NS.CHECKDOMAIN.DE.');
create table mx (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade,
ttl int default NULL,
host varchar(256) not NULL default '@',
preference integer not NULL default 10,
exchange varchar not NULL
);
create table cname (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade,
ttl int default NULL,
host varchar(256) not NULL,
cname varchar(256) not NULL
);
create table srv (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade,
ttl int default NULL,
host varchar(256) not NULL default '@',
priority integer not NULL,
weight integer not NULL,
port integer not NULL,
target varchar not NULL
);
create table ptr (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade,
ttl int default NULL,
host varchar(256) not NULL default '@',
ptrdname varchar(256) not NULL
);
create table hinfo (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade,
ttl int default NULL,
host varchar(256) not NULL default '@',
cpu varchar(256),
os varchar(256),
constraint cpu_os_not_null check (coalesce(cpu, os) is not NULL) -- at least one of `cpu', `os' must be not null
);
create table xfr (
id bigserial primary key,
zone_ varchar(256) not NULL references soa on delete cascade,
client varchar(256)
);
-- view returning records of all types except `NS' and `SOA'
create view d_records as
select
host,
case when a.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from a.ttl) end as ttl, -- if `ttl' in table `a' is not NULL select its value. Select value of `soa.ttl' in other case.
'A' as type,
NULL as priority,
host(address) as data,
soa.zone
from a, soa where soa.zone = a.zone
union
select
host,
case when aaaa.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from aaaa.ttl) end as ttl,
'AAAA' as type,
NULL as priority,
host(address) as data,
soa.zone
from aaaa, soa where soa.zone = aaaa.zone
union
select
host,
case when mx.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from mx.ttl) end as ttl,
'MX' as type,
preference::text as priority,
exchange as data,
soa.zone
from mx, soa where soa.zone = mx.zone
union
select/home/ella/bindproc/bind-parser-master
host,
case when txt.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from txt.ttl) end as ttl,
'TXT' as type,
NULL as priority,
'"' || txt_data || '"' as data, -- add double quotes to text data cause it can contain whitespaces
soa.zone
from txt, soa where soa.zone = txt.zone
union
select
host,
case when spf.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from spf.ttl) end as ttl,
'SPF' as type,
NULL as priority,
'"' || txt_data || '"' as data,
soa.zone
from spf, soa where soa.zone = spf.zone
union
select
host,
case when srv.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from srv.ttl) end as ttl,
'SRV' as type,
priority::text as priority,
weight::text || ' ' || port::text || ' ' || target::text as data, -- concatenate fields as DLZ driver do not expect so much elements in tuple returned from postgres
soa.zone
from srv, soa where soa.zone = srv.zone
union
select
host,
case when cname.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from cname.ttl) end as ttl,
'CNAME' as type,
NULL as priority,
cname as data,
soa.zone
from cname, soa where soa.zone = cname.zone
union
select
host,
case when ptr.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from ptr.ttl) end as ttl,
'PTR' as type,
NULL as priority,
ptrdname as data,
soa.zone
from ptr, soa where soa.zone = ptr.zone
union
select
host,
case when hinfo.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from hinfo.ttl) end as ttl,
'HINFO' as type,
NULL as priority,
cpu || ' ' || os as data,
soa.zone
from hinfo, soa where soa.zone = hinfo.zone
;
-- view returning `NS' and `SOA' record types
create view ns_records as
select
case when ns.ttl is NULL then extract('epoch' from soa.ttl) else extract('epoch' from ns.ttl) end as ttl,
'NS' as type,
NULL as priority,
nsdname as data,
NULL as resp_person,
NULL as serial,
NULL as refresh,
NULL as retry,
NULL as expire,
NULL as minimum,
soa.zone,
host
from ns, soa where soa.zone = ns.zone
union
select
extract('epoch' from ttl) as ttl,
'SOA' as type,
NULL as priority,
mname as data,
rname as resp_person,
serial,
extract('epoch' from refresh),
extract('epoch' from retry),
extract('epoch' from expire),
extract('epoch' from minimum),
zone,
'@' as host
from soa
;
-- view returning all types of records
create view all_records as
select
ttl,
type,
host as host,
priority,
data,
NULL as resp_person,
NULL as serial,
NULL as refresh,
NULL as retry,
NULL as expire,
NULL as minimum,
zone
from d_records
union
select
ttl,
type,
host,
priority,
data,
resp_person,
serial,
refresh,
retry,
expire,
minimum,
zone
from ns_records
;
| true |
c41a17aee700ea61350c96bfd4040e5e2697ea4a | SQL | kwojtas20/restapi | /src/main/resources/database/2020-11-18/01-create-user-authorities.sql | UTF-8 | 757 | 3.5 | 4 | [] | no_license | --liquibase formatted sql
--changeset kwojtas:4
create table users
(
id BIGINT AUTO_INCREMENT PRIMARY KEY,
username varchar(50) not null UNIQUE,
password varchar(100) not null,
enabled boolean not null
);
--changeset kwojtas:5
create table authorities
(
username varchar(50) not null,
authority varchar(50) not null,
constraint fk_authorities_users foreign key (username) references
users (username),
UNIQUE KEY username_authority (username, authority)
);
--changeset kwojtas:6
insert into users (id, username, password, enabled)
values (1, 'string', '{bcrypt}$2a$10$WJpeq/RTg5w/K.fhJOEV8uQAYaS0dSQ5W6nu87gOZ478mO6VGHBnO', true);
insert into authorities (username, authority)
values ('string', 'USER');
| true |
0b17484a3d6ea026ec0ce1c9f04284a1ac8fc1ef | SQL | Koala4ka/my-project | /flyway-mod/src/main/resources/migration/V9__Create_Permision__Role_Table.sql | UTF-8 | 315 | 3.03125 | 3 | [] | no_license | DROP TABLE IF EXISTS permission_role;
CREATE TABLE permission_role
(
role_id BIGINT REFERENCES roles,
permission_id BIGINT REFERENCES permission_table,
created_at TIMESTAMP DEFAULT now() NOT NULL,
updated_at TIMESTAMP DEFAULT now() NOT NULL,
PRIMARY KEY (role_id, permission_id)
);
| true |
a83715ebce4c34448c9f9975d74afb802abed956 | SQL | hetianrui/JavaTest | /数据库/排序分组连接的复习.sql | UTF-8 | 506 | 3.53125 | 4 | [] | no_license | #复习前一天的内容
#查询员工表的employee_id,job_id,last_name,按department_id降序,salary升序
SELECT employee_id,job_id,last_name,salary,department_id
FROM employees
ORDER BY department_id DESC,salary ASC;
#查询员工表的job_id中包含a和e的,并且a在e的前面
SELECT job_id
FROM employees
WHERE job_id LIKE '%a%e%';
#显示当前日期,以及去前后空格,截取子字符串的函数
SELECT NOW();
SELECT TRIM(' dfsdfsd 46465465');
SELECT SUBSTR('fsdfsdf',5,1);
| true |
9bac58eb3be8ba1262c92cdb0235954788d3638f | SQL | CUBRID/cubrid-testcases | /medium/_02_xtests/cases/6741.sql | UTF-8 | 718 | 3.171875 | 3 | [
"BSD-3-Clause"
] | permissive | autocommit off;
create class x (n int, d double)
method class set_cost(string, string) function qo_set_cost;
insert into x values (1, 4.2);
insert into x values (2, 42.0);
call set_cost('m-join', '0') on class x;
--set optimization: level 257;
select c.n
from (select n,d from x) as a(n,d),
(select n,d from x) as b(n,d),
(select n,d from x where n = a.n) as c(n,d)
where a.n = b.n;
select c.n
from (select n,d from x) as a(n,d),
(select n,d from x) as b(n,d),
(select n,d from x where n = a.n
union all
select n,d from x where n = b.n) as c(n,c)
where a.n = b.n;
select a.n + b.n
from (select n,d from x) as a(n,d),
(select n,d from x) as b(n,d);
rollback;
| true |
2e3526a3bf67d34076c0ea21cd2db79cc9727a54 | SQL | jgarzonext/plsql-testing | /script_plsql/bd_iaxis/script/disparadores/TRG_DESCONTRATOSAGR.sql | UTF-8 | 606 | 2.765625 | 3 | [] | no_license | --------------------------------------------------------
-- DDL for Trigger TRG_DESCONTRATOSAGR
--------------------------------------------------------
CREATE OR REPLACE EDITIONABLE TRIGGER "AXIS"."TRG_DESCONTRATOSAGR"
AFTER UPDATE ON descontratosagr
FOR EACH ROW
DECLARE
-- PK Tabla
vindica VARCHAR2(200) := 'SCONAGR = ' || :old.sconagr || ', CIDIOMA = ' ||
:old.cidioma;
BEGIN
--
p_his_procesosrea('DESCONTRATOSAGR', vindica, 'TCONAGR', :old.tconagr, :new.tconagr);
--
END trg_descontratosagr;
/
ALTER TRIGGER "AXIS"."TRG_DESCONTRATOSAGR" ENABLE;
| true |
0373a418321122aaefbfae7e1564b95573544e7a | SQL | dream-marker/wechat-applet-provider | /src/main/resources/dream_marker.sql | UTF-8 | 4,321 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | /*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50709
Source Host : localhost:3306
Source Database : dream_marker
Target Server Type : MYSQL
Target Server Version : 50709
File Encoding : 65001
Date: 2018-10-12 02:34:13
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for tb_image
-- ----------------------------
DROP TABLE IF EXISTS `tb_image`;
CREATE TABLE `tb_image` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`img` varchar(300) NOT NULL COMMENT '图片地址',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4 COMMENT='图片表';
-- ----------------------------
-- Records of tb_image
-- ----------------------------
-- ----------------------------
-- Table structure for tb_system_config
-- ----------------------------
DROP TABLE IF EXISTS `tb_system_config`;
CREATE TABLE `tb_system_config` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`type` tinyint(4) NOT NULL COMMENT '类型',
`config` varchar(1024) NOT NULL COMMENT '内容',
`create_user` bigint(20) NOT NULL COMMENT '创建人ID',
`update_user` bigint(20) NOT NULL COMMENT '创建时间',
`create_time` datetime NOT NULL COMMENT '更新人ID',
`update_time` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COMMENT='系统配置表';
-- ----------------------------
-- Records of tb_system_config
-- ----------------------------
INSERT INTO `tb_system_config` VALUES ('1', '101', '{\"appId\":\"wxe999d4c1904d3f23\",\"appSecret\":\"ddd36814cdd616810d390e4e5131260e\"}', '-1', '-1', '2018-10-11 22:00:02', '2018-10-11 22:00:00');
-- ----------------------------
-- Table structure for tb_user
-- ----------------------------
DROP TABLE IF EXISTS `tb_user`;
CREATE TABLE `tb_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`nick` varchar(64) NOT NULL COMMENT '昵称',
`avatar` varchar(300) NOT NULL COMMENT '头像',
`gender` tinyint(1) NOT NULL DEFAULT '-1' COMMENT '性别',
`birthday` date NOT NULL COMMENT '生日',
`area` tinyint(2) NOT NULL COMMENT '区域',
`channel` tinyint(2) NOT NULL COMMENT '注册渠道',
`status` tinyint(2) NOT NULL DEFAULT '1' COMMENT '状态',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_time` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
-- ----------------------------
-- Records of tb_user
-- ----------------------------
INSERT INTO `tb_user` VALUES ('19', '痕过已然 、足迹', 'https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83eroHqAxuLcuWQLshgiaM6Gr4pt8wkwaicJjTq5kZatAZY0OIqk154wh1mlDvmJ60vaajDMr9j0Bcuwg/132', '1', '2018-10-11', '-1', '1', '1', '2018-10-11 23:39:39', '2018-10-11 23:39:39');
-- ----------------------------
-- Table structure for tb_user_third
-- ----------------------------
DROP TABLE IF EXISTS `tb_user_third`;
CREATE TABLE `tb_user_third` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
`account_1` varchar(64) NOT NULL COMMENT '账号_1 取决于channel',
`account_2` varchar(64) NOT NULL COMMENT '账号_2 取决于channel',
`nick` varchar(32) NOT NULL COMMENT '昵称',
`avatar` varchar(300) NOT NULL COMMENT '头像',
`channel` tinyint(2) NOT NULL COMMENT '渠道 枚举',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`),
UNIQUE KEY `account_1__channel` (`account_1`,`channel`) USING BTREE,
UNIQUE KEY `account_1__2` (`account_1`,`account_2`) USING BTREE,
UNIQUE KEY `user_id__channel` (`user_id`,`channel`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COMMENT='第三方用户绑定表';
-- ----------------------------
-- Records of tb_user_third
-- ----------------------------
INSERT INTO `tb_user_third` VALUES ('16', '19', 'oNFjJw3CyXUy-Wb49uIF_GMwZXGs', 'oChX-0INjwWunu0QlVzzHSu1tR9A', '痕过已然 、足迹', 'https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83eroHqAxuLcuWQLshgiaM6Gr4pt8wkwaicJjTq5kZatAZY0OIqk154wh1mlDvmJ60vaajDMr9j0Bcuwg/132', '1', '2018-10-11 23:39:39');
| true |
50061f1d82e1aed76cc9a05cf175a10acc1fe1fe | SQL | anitasari2311/ReportingSystemFinal | /Dump20191121/cms_readreport_readreport.sql | UTF-8 | 2,112 | 2.734375 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 5.6.23, for Win32 (x86)
--
-- Host: localhost Database: cms_readreport
-- ------------------------------------------------------
-- Server version 5.7.25-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 `readreport`
--
DROP TABLE IF EXISTS `readreport`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `readreport` (
`report_id` varchar(15) DEFAULT NULL,
`report_judul` varchar(15) DEFAULT NULL,
`org_id` smallint(6) DEFAULT NULL,
`namaFile` varchar(15) DEFAULT NULL,
`report_lastProcess` datetime DEFAULT NULL,
`read_PIC` varchar(100) DEFAULT NULL,
`read_penerima` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `readreport`
--
LOCK TABLES `readreport` WRITE;
/*!40000 ALTER TABLE `readreport` DISABLE KEYS */;
/*!40000 ALTER TABLE `readreport` 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 2019-11-21 9:52:40
| true |
4068e6d2166b964a44d50fd7578adc8303b12bb7 | SQL | leesander1/service | /business/data/dbmigrate/sql/migrate.sql | UTF-8 | 1,301 | 4.03125 | 4 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | -- Version: 1.01
-- Description: Create table users
CREATE TABLE users (
user_id UUID NOT NULL,
name TEXT NOT NULL,
email TEXT UNIQUE NOT NULL,
roles TEXT[] NOT NULL,
password_hash TEXT NOT NULL,
department TEXT NULL,
enabled BOOLEAN NOT NULL,
date_created TIMESTAMP NOT NULL,
date_updated TIMESTAMP NOT NULL,
PRIMARY KEY (user_id)
);
-- Version: 1.02
-- Description: Create table products
CREATE TABLE products (
product_id UUID NOT NULL,
name TEXT NOT NULL,
cost INT NOT NULL,
quantity INT NOT NULL,
user_id UUID NOT NULL,
date_created TIMESTAMP NOT NULL,
date_updated TIMESTAMP NOT NULL,
PRIMARY KEY (product_id),
FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE
);
-- Version: 1.03
-- Description: Create table sales
CREATE TABLE sales (
sale_id UUID NOT NULL,
user_id UUID NOT NULL,
product_id UUID NOT NULL,
quantity INT NOT NULL,
paid INT NOT NULL,
date_created TIMESTAMP NOT NULL,
PRIMARY KEY (sale_id),
FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE,
FOREIGN KEY (product_id) REFERENCES products(product_id) ON DELETE CASCADE
);
| true |
2f8619effa3c32656e9f89743673481174ecc855 | SQL | hqottsz/MXI | /assetmanagement-database/src/base/plsql/maintenix/plsql/getFDDisruptionTypes.sql | UTF-8 | 1,348 | 3.5625 | 4 | [] | no_license | --liquibase formatted sql
--changeSet getFDDisruptionTypes:1 stripComments:false endDelimiter:\n\s*/\s*\n|\n\s*/\s*$
CREATE OR REPLACE FUNCTION getFDDisruptionTypes
(
aFdId fl_leg_disrupt.leg_disrupt_id%TYPE
) RETURN String
IS
lFdDisruptionTypes String(4000);
/* cursor declarations */
CURSOR lcur_DisruptionTypes (
cl_FdId fl_leg_disrupt.leg_disrupt_id%type
) IS
SELECT
fl_leg_disrupt_type.disrupt_type_cd
FROM
fl_leg_disrupt,
fl_leg_disrupt_type
WHERE
fl_leg_disrupt.leg_disrupt_id = cl_FdId
AND
fl_leg_disrupt.leg_disrupt_id = fl_leg_disrupt_type.leg_disrupt_id
ORDER BY
disrupt_type_cd;
lrec_DisruptionTypes lcur_DisruptionTypes%ROWTYPE;
BEGIN
lFdDisruptionTypes := NULL;
/* loop for every disruption type define for this flight disruption */
FOR lrec_DisruptionTypes IN lcur_DisruptionTypes(aFdId) LOOP
IF lFdDisruptionTypes IS NULL THEN
/* *** If this is the first row, don't add a comma *** */
lFdDisruptionTypes := lrec_DisruptionTypes.disrupt_type_cd;
ELSE
/* *** add a comma *** */
lFdDisruptionTypes := lFdDisruptionTypes || ', ' || lrec_DisruptionTypes.disrupt_type_cd;
END IF;
END LOOP;
RETURN lFdDisruptionTypes;
END getFDDisruptionTypes;
/ | true |
e5423f4251dbab0addccd3d3e4c75cb3bc3a123c | SQL | sharif-codder/online-result-info | /database-mysql/online_result_submit.sql | UTF-8 | 13,004 | 2.90625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 14, 2019 at 10:56 PM
-- Server version: 10.1.31-MariaDB
-- PHP Version: 7.2.4
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: `online_result_submit`
--
-- --------------------------------------------------------
--
-- Table structure for table `batches`
--
CREATE TABLE `batches` (
`id` int(10) UNSIGNED NOT NULL,
`batch_code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`is_active` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `batches`
--
INSERT INTO `batches` (`id`, `batch_code`, `is_active`, `created_at`, `updated_at`) VALUES
(1, '15341', 1, '2019-05-29 23:20:35', '2019-05-29 23:20:35'),
(2, '16341', 1, '2019-05-29 23:20:53', '2019-05-29 23:20:53');
-- --------------------------------------------------------
--
-- Table structure for table `faculties`
--
CREATE TABLE `faculties` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`userid` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`is_active` int(11) NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `faculties`
--
INSERT INTO `faculties` (`id`, `name`, `userid`, `password`, `is_active`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Millon Mhamud', '133233', '$2y$10$SgHJHk0NI70koMhVPs2XBOSFJSLldOsXqpkUd0/A59g3iM72MbECW', 1, 'ZkXiJkiRJqxBwDxXRdvQ14kRKcxtHqYUFhPgLggPAojjVtmdzSHUZnSwPdtM', '2019-05-29 23:21:20', '2019-05-29 23:21:20'),
(2, 'Abdul Hadi', '133234', '$2y$10$lMNMdncVtACF5CqSwh9zZ.7DpouVLcr2TIyWLSCx9JxnfbgUKfIxi', 1, 'cgstlj0dvZiBlbpzG35PEMWJnChC56ayFvnccRImuE5siEsP5g1m8CLJ48Gf', '2019-05-29 23:21:50', '2019-05-29 23:21:50'),
(3, 'Toufiqur Rahaman', '133235', '$2y$10$wExIxMJhLzeNYFjJTlAUI.GwCDrkxsNd4PJwjNaRhl6eDztpFkmrK', 1, 'E6hMR8hVqTq5eKFQmTJrdWmDmcrUh7Rbol9XTDEmez3ZfWKSX9rZZdln5nai', '2019-05-31 22:52:14', '2019-05-31 22:52:55');
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_05_07_061658_create_faculty_table', 1),
(4, '2019_05_10_060818_create_batches_table', 1),
(5, '2019_05_10_061213_create_subjects_table', 1),
(6, '2019_05_11_034145_create_students_table', 1),
(7, '2019_05_11_142136_create_results_table', 1),
(8, '2019_05_12_051917_add_batch_id_to_result_table', 1),
(9, '2019_05_24_051042_add_password_to_student_table', 1),
(10, '2019_06_01_053418_add_is_active_column_to_subeject', 2);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `results`
--
CREATE TABLE `results` (
`id` int(10) UNSIGNED NOT NULL,
`grade_point` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`grade` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`session` int(11) NOT NULL,
`year` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_id` int(10) UNSIGNED NOT NULL,
`subject_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`batch_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `results`
--
INSERT INTO `results` (`id`, `grade_point`, `grade`, `session`, `year`, `student_id`, `subject_id`, `created_at`, `updated_at`, `batch_id`) VALUES
(1, '3.5', 'A-', 2, '2018', 1, 1, '2019-05-30 04:19:45', '2019-05-30 04:19:45', 1),
(2, '3.00', 'B', 2, '2018', 2, 1, '2019-05-30 04:19:45', '2019-05-30 04:19:45', 1),
(3, '3.5', 'A-', 2, '2018', 1, 3, '2019-05-30 04:20:16', '2019-05-30 04:20:16', 1),
(4, '3.00', 'B', 2, '2018', 2, 3, '2019-05-30 04:20:16', '2019-05-31 22:45:02', 1),
(5, '3.00', 'B', 2, '2018', 1, 2, '2019-05-30 04:47:56', '2019-05-30 04:47:56', 1),
(6, '3.00', 'B', 2, '2018', 2, 2, '2019-05-30 04:47:56', '2019-05-30 04:47:56', 1),
(11, '3.5', 'A-', 0, '2019', 1, 5, '2019-06-01 03:54:52', '2019-06-01 03:54:52', 1),
(12, '2.75', 'B-', 0, '2019', 2, 5, '2019-06-01 03:54:52', '2019-06-01 03:54:52', 1),
(13, '3', 'B', 0, '2019', 1, 4, '2019-06-01 03:56:46', '2019-06-01 03:56:46', 1),
(14, '3.5', 'A-', 0, '2019', 2, 4, '2019-06-01 03:56:46', '2019-06-01 03:56:46', 1),
(25, '3.5', 'A-', 0, '2019', 3, 6, '2019-06-08 11:50:12', '2019-06-08 11:50:12', 2),
(26, '3.25', 'B+', 0, '2019', 4, 6, '2019-06-08 11:50:12', '2019-06-08 11:50:12', 2),
(27, '3.00', 'B', 1, '2019', 1, 7, '2019-06-08 11:57:40', '2019-06-08 11:57:40', 1),
(28, '2.75', 'B-', 1, '2019', 2, 7, '2019-06-08 11:57:40', '2019-06-08 11:57:40', 1),
(29, '3.25', 'B+', 1, '2019', 1, 8, '2019-06-08 11:58:08', '2019-06-08 11:58:08', 1),
(30, '3.00', 'B', 1, '2019', 2, 8, '2019-06-08 11:58:08', '2019-06-08 11:58:08', 1),
(31, '3.25', 'B+', 1, '2019', 1, 9, '2019-06-08 11:59:21', '2019-06-08 11:59:21', 1),
(32, '3.5', 'A-', 1, '2019', 2, 9, '2019-06-08 11:59:21', '2019-06-08 11:59:21', 1);
-- --------------------------------------------------------
--
-- Table structure for table `students`
--
CREATE TABLE `students` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`student_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch_id` int(10) UNSIGNED NOT NULL,
`is_active` int(11) NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `students`
--
INSERT INTO `students` (`id`, `name`, `student_id`, `batch_id`, `is_active`, `remember_token`, `created_at`, `updated_at`, `password`) VALUES
(1, 'sujon shekh', '153410005', 1, 1, '3vB79WKMDH6fFiesUAFD8UW2D7fiCOwXWmHZOboryTDgboPIHDPtgZ7kNOKu', '2019-05-29 23:22:40', '2019-05-29 23:22:40', '$2y$10$Nje4ZP08aRBtYQSoL138ju0AAilwiQWaI8Ft6RE6Yx1Zxc5oBrkpS'),
(2, 'Imrul hassan', '153410007', 1, 1, '8aNLuMT5ndjlDln72Iv3d7W8kSKcc71P6ClAbjuCFFFpOZ1gnCEvUla1VKJk', '2019-05-29 23:23:28', '2019-05-29 23:23:28', '$2y$10$ZOKd3cDO485D29NWjz3bP..kvLaAI.Mk358BFsezKmYzdtpY3bJMK'),
(3, 'Soroup Chokroborti', '163410021', 2, 1, NULL, '2019-05-29 23:24:31', '2019-05-30 04:15:54', '$2y$10$Zamong6jO16rHC0kP9xEc.Txzpsxm5FVQYpb0ny4isf/vuhuWYuIG'),
(4, 'Akbor Ali', '163410012', 2, 1, NULL, '2019-06-01 11:00:07', '2019-06-01 11:00:07', '$2y$10$Smr/bZBOAHGOMdLK8cb0zOQelzexQQaWN46ysC.J0sckYSsVlmIFa');
-- --------------------------------------------------------
--
-- Table structure for table `subjects`
--
CREATE TABLE `subjects` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`faculty_id` int(10) UNSIGNED NOT NULL,
`batch_id` int(10) UNSIGNED NOT NULL,
`session` int(11) NOT NULL,
`year` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`is_active` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `subjects`
--
INSERT INTO `subjects` (`id`, `name`, `faculty_id`, `batch_id`, `session`, `year`, `created_at`, `updated_at`, `is_active`) VALUES
(1, 'Object Oriented Programming', 1, 1, 2, '2018', '2019-05-29 23:25:46', '2019-06-01 03:45:17', 0),
(2, 'Datastructure', 2, 1, 2, '2018', '2019-05-29 23:26:40', '2019-06-01 03:08:33', 0),
(3, 'Data Communication And Networking', 1, 1, 2, '2018', '2019-05-29 23:27:31', '2019-06-01 03:09:09', 0),
(4, 'Web Programming', 2, 1, 0, '2019', '2019-05-29 23:28:47', '2019-06-02 02:16:35', 0),
(5, 'Cyber Security', 2, 1, 0, '2019', '2019-05-29 23:29:39', '2019-06-02 02:18:40', 0),
(6, 'Computer Graphics', 1, 2, 0, '2019', '2019-05-29 23:31:04', '2019-06-01 00:30:15', 1),
(7, 'Statistics', 3, 1, 1, '2019', '2019-06-08 11:54:26', '2019-06-08 11:54:26', 1),
(8, 'Calculas-2', 3, 1, 1, '2019', '2019-06-08 11:55:09', '2019-06-08 11:55:09', 1),
(9, 'Electronics-2', 2, 1, 1, '2019', '2019-06-08 11:55:57', '2019-06-08 11:55:57', 1);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`userid` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`is_active` int(11) NOT NULL,
`role` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `userid`, `password`, `is_active`, `role`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'sharif uddin', '153410008', '$2y$10$AEVUjTQRde/Lbhb8gFM7b.isKFwm/YkRH.rhQkTPX9bmAwS0yRobW', 1, 'admin', 'AUweQNpoEhbGmzmPsMqPkqhp9ppVKETgTQM7HXOK0lVMIx6s9iGrdgsVb8wp', '2019-05-29 23:18:30', '2019-05-29 23:18:30');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `batches`
--
ALTER TABLE `batches`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `faculties`
--
ALTER TABLE `faculties`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `faculties_userid_unique` (`userid`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `results`
--
ALTER TABLE `results`
ADD PRIMARY KEY (`id`),
ADD KEY `results_student_id_index` (`student_id`),
ADD KEY `results_subject_id_index` (`subject_id`),
ADD KEY `results_batch_id_index` (`batch_id`);
--
-- Indexes for table `students`
--
ALTER TABLE `students`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `students_student_id_unique` (`student_id`),
ADD KEY `students_batch_id_index` (`batch_id`);
--
-- Indexes for table `subjects`
--
ALTER TABLE `subjects`
ADD PRIMARY KEY (`id`),
ADD KEY `subjects_faculty_id_index` (`faculty_id`),
ADD KEY `subjects_batch_id_index` (`batch_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_userid_unique` (`userid`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `batches`
--
ALTER TABLE `batches`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `faculties`
--
ALTER TABLE `faculties`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `results`
--
ALTER TABLE `results`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;
--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `subjects`
--
ALTER TABLE `subjects`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
1028477b43efe8e2e48320c598ecdcf329680736 | SQL | megatran/MinesPlaza | /includes/setup.sql | UTF-8 | 227 | 2.59375 | 3 | [] | no_license | CREATE TABLE users (
uid INT NOT NULL AUTO_INCREMENT,
username VARCHAR(30) NOT NULL UNIQUE,
password VARCHAR(64) NOT NULL,
salt VARCHAR(3) NOT NULL,
email VARCHAR(32) NOT NULL UNIQUE,
PRIMARY KEY(uid)
); | true |
563b642338e34e876f112556d0ea2b6a053ab036 | SQL | EdivaldoDavi/ipiavai | /src/main/resources/db/migration/V04__criar_e_registrar_usuarios_e_permissoes.sql | UTF-8 | 3,417 | 3.484375 | 3 | [] | no_license |
CREATE TABLE usuario (
codigo bigint NOT NULL DEFAULT nextval(('usuarios_id_seq'::text)::regclass),
nome character varying(50) NOT NULL,
email character varying(50) NOT NULL,
senha character varying(150) NOT NULL,
data_alteracao timestamp DEFAULT (current_timestamp),
CONSTRAINT codigo_usuario_pkey PRIMARY KEY (codigo)
)
WITH (
OIDS=FALSE
);
CREATE TABLE permissao (
codigo bigint NOT NULL DEFAULT nextval(('permissoes_id_seq'::text)::regclass),
descricao character varying(50) NOT NULL,
apelido_descricao character varying(50) NOT NULL,
CONSTRAINT codigo_permissao_pkey PRIMARY KEY (codigo)
)
WITH (
OIDS=FALSE
);
CREATE TABLE usuario_permissao (
codigo_permissao bigint NOT NULL DEFAULT nextval(('usuario_permissao_id_seq'::text)::regclass),
codigo_usuario bigint NOT NULL,
CONSTRAINT codigo_usuario_permissao_pkey PRIMARY KEY (codigo_usuario,codigo_permissao),
CONSTRAINT fkcodigo_usuario FOREIGN KEY (codigo_usuario)
REFERENCES usuario (codigo) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fkcodigo_permissao FOREIGN KEY (codigo_permissao)
REFERENCES permissao (codigo) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
INSERT INTO usuario (codigo, nome, email, senha) values (1, 'Administrador', 'admin@algamoney.com', '$2a$10$X607ZPhQ4EgGNaYKt3n4SONjIv9zc.VMWdEuhCuba7oLAL5IvcL5.');
INSERT INTO usuario (codigo, nome, email, senha) values (2, 'Maria Silva', 'maria@algamoney.com', '$2a$10$Zc3w6HyuPOPXamaMhh.PQOXvDnEsadztbfi6/RyZWJDzimE8WQjaq');
INSERT INTO permissao (codigo, descricao, apelido_descricao) values (1, 'ROLE_CADASTRAR_CATEGORIA', 'Cadastrar Categoria');
INSERT INTO permissao (codigo, descricao, apelido_descricao) values (2, 'ROLE_PESQUISAR_CATEGORIA', 'Pesquisar Categoria');
INSERT INTO permissao (codigo, descricao, apelido_descricao) values (3, 'ROLE_CADASTRAR_PESSOA', 'Cadastrar Pessoa');
INSERT INTO permissao (codigo, descricao, apelido_descricao) values (4, 'ROLE_REMOVER_PESSOA', 'Excluir Pessoa');
INSERT INTO permissao (codigo, descricao, apelido_descricao) values (5, 'ROLE_PESQUISAR_PESSOA', 'Pesquisar Pessoa');
INSERT INTO permissao (codigo, descricao, apelido_descricao) values (6, 'ROLE_CADASTRAR_LANCAMENTO', 'Cadastrar Lançamento');
INSERT INTO permissao (codigo, descricao, apelido_descricao) values (7, 'ROLE_REMOVER_LANCAMENTO', 'Excluir Lançamento');
INSERT INTO permissao (codigo, descricao, apelido_descricao) values (8, 'ROLE_PESQUISAR_LANCAMENTO', 'Pesquisar Lançamento');
-- admin
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (1, 1);
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (1, 2);
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (1, 3);
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (1, 4);
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (1, 5);
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (1, 6);
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (1, 7);
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (1, 8);
-- maria
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (2, 2);
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (2, 5);
INSERT INTO usuario_permissao (codigo_usuario, codigo_permissao) values (2, 8); | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.