text stringlengths 6 9.38M |
|---|
set serveroutput on;
declare
function process_mytable return char is
odd_cnt int := 0;
even_cnt int := 0;
begin
select count(val) into even_cnt from MyTable where mod(val, 2) = 0;
select count(val) into odd_cnt from MyTable where mod(val, 2) != 0;
if odd_cnt = even_cnt
then return 'EQUAL';
else if odd_cnt < even_cnt
then return 'TRUE';
else return 'FALSE';
end if;
end if;
end process_mytable;
begin
dbms_output.put_line(process_mytable());
end; |
Select address from test.test2 |
/*
Copyright 2021 Snowplow Analytics Ltd. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
{{if eq (or .enabled false) true}}
DECLARE RUN_ID TIMESTAMP;
-- A table storing an identifier for this run of a model - used to identify runs of the model across multiple modules/steps (eg. base, page views share this id per run)
CREATE TABLE IF NOT EXISTS {{.scratch_schema}}.mobile_metadata_run_id{{.entropy}} (
run_id TIMESTAMP
);
-- Insert new run_id if one doesn't exist
SET RUN_ID = (SELECT run_id FROM {{.scratch_schema}}.mobile_metadata_run_id{{.entropy}} LIMIT 1);
IF RUN_ID IS NULL THEN
INSERT INTO {{.scratch_schema}}.mobile_metadata_run_id{{.entropy}} (
SELECT
CURRENT_TIMESTAMP()
);
END IF;
-- Permanent metadata table
CREATE TABLE IF NOT EXISTS {{.output_schema}}.datamodel_metadata{{.entropy}} (
run_id TIMESTAMP,
model_version STRING,
model STRING,
module STRING,
run_start_tstamp TIMESTAMP,
run_end_tstamp TIMESTAMP,
rows_this_run INT64,
distinct_key STRING,
distinct_key_count INT64,
time_key STRING,
min_time_key TIMESTAMP,
max_time_key TIMESTAMP,
duplicate_rows_removed INT64,
distinct_keys_removed INT64
)
PARTITION BY DATE(run_start_tstamp);
-- Setup temp metadata tables for this run
CREATE OR REPLACE TABLE {{.scratch_schema}}.mobile_app_errors_metadata_this_run{{.entropy}} (
id STRING,
run_id TIMESTAMP,
model_version STRING,
model STRING,
module STRING,
run_start_tstamp TIMESTAMP,
run_end_tstamp TIMESTAMP,
rows_this_run INT64,
distinct_key STRING,
distinct_key_count INT64,
time_key STRING,
min_time_key TIMESTAMP,
max_time_key TIMESTAMP,
duplicate_rows_removed INT64,
distinct_keys_removed INT64
);
INSERT INTO {{.scratch_schema}}.mobile_app_errors_metadata_this_run{{.entropy}} (
SELECT
'run',
run_id,
'{{.model_version}}',
'mobile',
'app-errors',
CURRENT_TIMESTAMP(),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
FROM {{.scratch_schema}}.mobile_metadata_run_id{{.entropy}}
);
{{end}}
-- Reversing usual order as derived output is optional but staging is not.
-- Staging table always created even if module disabled. This allows for joins downstream.
CREATE TABLE IF NOT EXISTS {{.scratch_schema}}.mobile_app_errors_staged{{.entropy}} (
event_id STRING NOT NULL,
app_id STRING,
user_id STRING,
device_user_id STRING,
network_userid STRING,
session_id STRING,
session_index INT64,
previous_session_id STRING,
session_first_event_id STRING,
dvce_created_tstamp TIMESTAMP,
collector_tstamp TIMESTAMP,
derived_tstamp TIMESTAMP,
model_tstamp TIMESTAMP,
platform STRING,
dvce_screenwidth INT64,
dvce_screenheight INT64,
device_manufacturer STRING,
device_model STRING,
os_type STRING,
os_version STRING,
android_idfa STRING,
apple_idfa STRING,
apple_idfv STRING,
open_idfa STRING,
screen_id STRING,
screen_name STRING,
screen_activity STRING,
screen_fragment STRING,
screen_top_view_controller STRING,
screen_type STRING,
screen_view_controller STRING,
device_latitude FLOAT64,
device_longitude FLOAT64,
device_latitude_longitude_accuracy FLOAT64,
device_altitude FLOAT64,
device_altitude_accuracy FLOAT64,
device_bearing FLOAT64,
device_speed FLOAT64,
geo_country STRING,
geo_region STRING,
geo_city STRING,
geo_zipcode STRING,
geo_latitude FLOAT64,
geo_longitude FLOAT64,
geo_region_name STRING,
geo_timezone STRING,
user_ipaddress STRING,
useragent STRING,
carrier STRING,
network_technology STRING,
network_type STRING,
build STRING,
version STRING,
event_index_in_session INT64,
message STRING,
programming_language STRING,
class_name STRING,
exception_name STRING,
is_fatal BOOLEAN,
line_number INT64,
stack_trace STRING,
thread_id INT64,
thread_name STRING
)
PARTITION BY DATE(derived_tstamp)
CLUSTER BY {{range $i, $cluster_field := .cluster_by}} {{if lt $i 4}} {{if $i}}, {{end}} {{$cluster_field}} {{end}} {{else}} app_id,device_user_id,session_id {{end}};
--Cluster using `.cluster_by` var, else use defaults. Max 4 cluster by fields allowed
{{if eq (or .enabled false) true}}
{{if ne (or .skip_derived false) true}}
-- Create derived table
CREATE TABLE IF NOT EXISTS {{.output_schema}}.mobile_app_errors{{.entropy}} (
event_id STRING NOT NULL,
app_id STRING,
user_id STRING,
device_user_id STRING,
network_userid STRING,
session_id STRING,
session_index INT64,
previous_session_id STRING,
session_first_event_id STRING,
dvce_created_tstamp TIMESTAMP,
collector_tstamp TIMESTAMP,
derived_tstamp TIMESTAMP,
model_tstamp TIMESTAMP,
platform STRING,
dvce_screenwidth INT64,
dvce_screenheight INT64,
device_manufacturer STRING,
device_model STRING,
os_type STRING,
os_version STRING,
android_idfa STRING,
apple_idfa STRING,
apple_idfv STRING,
open_idfa STRING,
screen_id STRING,
screen_name STRING,
screen_activity STRING,
screen_fragment STRING,
screen_top_view_controller STRING,
screen_type STRING,
screen_view_controller STRING,
device_latitude FLOAT64,
device_longitude FLOAT64,
device_latitude_longitude_accuracy FLOAT64,
device_altitude FLOAT64,
device_altitude_accuracy FLOAT64,
device_bearing FLOAT64,
device_speed FLOAT64,
geo_country STRING,
geo_region STRING,
geo_city STRING,
geo_zipcode STRING,
geo_latitude FLOAT64,
geo_longitude FLOAT64,
geo_region_name STRING,
geo_timezone STRING,
user_ipaddress STRING,
useragent STRING,
carrier STRING,
network_technology STRING,
network_type STRING,
build STRING,
version STRING,
event_index_in_session INT64,
message STRING,
programming_language STRING,
class_name STRING,
exception_name STRING,
is_fatal BOOLEAN,
line_number INT64,
stack_trace STRING,
thread_id INT64,
thread_name STRING
)
PARTITION BY DATE(derived_tstamp)
CLUSTER BY {{range $i, $cluster_field := .cluster_by}} {{if lt $i 4}} {{if $i}}, {{end}} {{$cluster_field}} {{end}} {{else}} app_id,device_user_id,session_id {{end}};
--Cluster using `.cluster_by` var, else use defaults. Max 4 cluster by fields allowed
{{end}}
{{end}}
|
-- DISPARADOR PARA COMPROBAR LAS INSERCIONES Y MODIFICACIONES SOBRE LA TABLA
-- COMIDAS
CREATE OR REPLACE TRIGGER insertadatosalimentos
BEFORE INSERT ON comidas
FOR EACH ROW
BEGIN
IF (:new.Azucares < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de azucares
negativos');
ELSIF (:new.Grasas < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de grasas
negativos');
ELSIF (:new.Proteinas < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de proteinas
negativos');
ELSIF ((:new.Grasas + :new.Azucares + :new.Proteinas) < 0 ) THEN
RAISE_APPLICATION_ERROR(-20000, 'La suma de Grasas, Azucares y
Proteinas no puede exceder el 100 %');
END IF;
END insertadatosalimentos;
/
commit;
CREATE OR REPLACE TRIGGER actualizadatosalimentos
BEFORE INSERT ON comidas
FOR EACH ROW
BEGIN
IF (:new.Azucares < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de azucares
negativos');
ELSIF (:new.Grasas < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de grasas
negativos');
ELSIF (:new.Proteinas < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de proteinas
negativos');
ELSIF ((:new.Grasas + :new.Azucares + :new.Proteinas) < 0 ) THEN
RAISE_APPLICATION_ERROR(-20000, 'La suma de Grasas, Azucares y
Proteinas no puede exceder el 100 %');
END IF;
END actualizadatosalimentos;
/
commit;
-- DISPARADOR PARA COMPROBAR LAS INSERCIONES Y MODIFICACIONES SOBRE LA TABLA
-- INYECTA
CREATE OR REPLACE TRIGGER insertadatosinyeccion
BEFORE INSERT ON inyecta
FOR EACH ROW
BEGIN
IF (:new.Unidades < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de unidades de
inyeccion negativos');
ELSIF (:new.Unidades > 60 ) THEN
RAISE_APPLICATION_ERROR(-20000, 'La capacidad máxima de inyección de las
agujas es de 60 unidades');
ELSIF (:new.Unidades > 35) THEN
DBMS_OUTPUT.PUT_LINE('Ha introducido una inyeccion de ' || :new.Unidades
|| ' unidades, es una cantidad
bastante elevada, deberia acudir a su medico');
END IF;
END insertadatosinyeccion;
/
commit;
CREATE OR REPLACE TRIGGER actualizadatosinyeccion
BEFORE UPDATE ON inyecta
FOR EACH ROW
BEGIN
IF (:new.Unidades < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de unidades de
inyeccion negativos');
ELSIF (:new.Unidades > 60 ) THEN
RAISE_APPLICATION_ERROR(-20000, 'La capacidad máxima de inyección de las
agujas es de 60 unidades');
ELSIF (:new.Unidades > 35) THEN
DBMS_OUTPUT.PUT_LINE('Ha introducido una inyeccion de ' || :new.Unidades
|| ' unidades, es una cantidad
bastante elevada, deberia acudir a su medico');
END IF;
END actualizadatosinyeccion;
/
commit;
-- DISPARADOR PARA COMPROBAR LAS INSERCIONES Y MODIFICACIONES SOBRE LA TABLA
-- MIDE
CREATE OR REPLACE TRIGGER insertadatosmedicion
BEFORE INSERT ON mide
FOR EACH ROW
BEGIN
IF (:new.Medicion < 0 ) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de glucosa
negativos');
ELSIF (:new.Medicion < 60) THEN
DBMS_OUTPUT.PUT_LINE('Una medicion de ' || :new.Medicion || ' corresponde
con una hipoglucemia muy fuerte,
si son continuadas deberia acudir a su medico.');
ELSIF (:new.Medicion > 330) THEN
DBMS_OUTPUT.PUT_LINE('Una medicion de ' || :new.Medicion || ' corresponde
con un nivel de glucosa demasiado elevado,
si son continuadas deberia acudir a su medico.');
END IF;
END insertadatosmedicion;
/
commit;
CREATE OR REPLACE TRIGGER actualizadatosmedicion
BEFORE UPDATE ON mide
FOR EACH ROW
BEGIN
IF (:new.Medicion < 0 ) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de glucosa
negativos');
ELSIF (:new.Medicion < 60) THEN
DBMS_OUTPUT.PUT_LINE('Una medicion de ' || :new.Medicion || ' corresponde
con una hipoglucemia muy fuerte,
si son continuadas deberia acudir a su medico.');
ELSIF (:new.Medicion > 330) THEN
DBMS_OUTPUT.PUT_LINE('Una medicion de ' || :new.Medicion || ' corresponde
con un nivel de glucosa demasiado elevado,
si son continuadas deberia acudir a su medico.');
END IF;
END actualizadatosmedicion;
/
commit;
-- DISPARADOR PARA COMPROBAR LAS INSERCIONES Y MODIFICACIONES SOBRE LA TABLA
-- COME
CREATE OR REPLACE TRIGGER insertadatoscomidas
BEFORE INSERT ON Come
FOR EACH ROW
BEGIN
IF (:new.Duracion < 0 ) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de duracion
negativos');
ELSIF (:new.Duracion > 90) THEN
DBMS_OUTPUT.PUT_LINE('Ha introducido una duración de la comida de ' ||
:new.Duracion ||
' asegurese de no equivocarse');
END IF;
IF (:new.Cantidad < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de cantidad
negativos');
END IF;
END insertadatoscomidas;
/
commit;
CREATE OR REPLACE TRIGGER actualizadatoscomidas
BEFORE UPDATE ON Come
FOR EACH ROW
BEGIN
IF (:new.Duracion < 0 ) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de duracion
negativos');
ELSIF (:new.Duracion > 90) THEN
DBMS_OUTPUT.PUT_LINE('Ha introducido una duración de la comida de ' ||
:new.Duracion ||
' asegurese de no equivocarse');
END IF;
IF (:new.Cantidad < 0) THEN
RAISE_APPLICATION_ERROR(-20000, 'No se admiten valores de cantidad
negativos');
END IF;
END actualizadatoscomidas;
/
commit; |
DROP TABLE IF EXISTS `cot_clan_players`;
DROP TABLE IF EXISTS `cot_clan_matches`;
DROP TABLE IF EXISTS `cot_clan_match_players`;
DROP TABLE IF EXISTS `cot_clan_ranks`;
DROP TABLE IF EXISTS `cot_clan_teams`;
DROP TABLE IF EXISTS `cot_clan_team_players`;
DROP TABLE IF EXISTS `cot_clan_platforms`;
DROP TABLE IF EXISTS `cot_clan_games`;
DROP TABLE IF EXISTS `cot_clan_game_type`;
DROP TABLE IF EXISTS `cot_clan_rules`;
DROP TABLE IF EXISTS `cot_clan_tournaments`;
DROP TABLE IF EXISTS `cot_clan_tactics`;
DROP TABLE IF EXISTS `cot_clan_awards`;
DROP TABLE IF EXISTS `cot_clan_awarded`;
DROP TABLE IF EXISTS `cot_clan_maps`;
DROP TABLE IF EXISTS `cot_clan_events`; |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1:3306
-- Tiempo de generación: 24-07-2019 a las 23:19:39
-- Versión del servidor: 5.7.26
-- Versión de PHP: 7.2.18
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: `telcomsis`
--
DELIMITER $$
--
-- Procedimientos
--
DROP PROCEDURE IF EXISTS `usersAddOrEdit`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `usersAddOrEdit` (IN `_id` INT(100), IN `_username` VARCHAR(100), IN `_identificacion` VARCHAR(100), IN `_email` VARCHAR(200)) BEGIN
IF _id = 0 THEN
INSERT INTO users(username,identificacion,email)
VALUES (_username,_identificacion,_email);
SET _id = LAST_INSERT_ID();
ELSE
UPDATE users
SET
username = _username,
identificacion = _identificacion,
email = _email
WHERE id = _id;
END IF;
SELECT _id AS 'id';
END$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`username` varchar(100) NOT NULL,
`identificacion` varchar(100) NOT NULL,
`email` varchar(200) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`id`, `username`, `identificacion`, `email`) VALUES
(1, 'diana', '26223070', 'amezquitadiana@gmail.com'),
(3, 'luis', '26119852', 'hhdagdhda@gmail.com'),
(4, 'lenin', '12340086', 'lenin.paradas@telcomsis.com.ve'),
(5, 'bella amez', '23597969', 'bella@gmail.com');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 24, 2021 at 02:39 PM
-- Server version: 10.4.20-MariaDB
-- PHP Version: 8.0.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `covid-free`
--
-- --------------------------------------------------------
--
-- Table structure for table `need_help`
--
CREATE TABLE `need_help` (
`ID` varchar(20) NOT NULL,
`email` varchar(20) NOT NULL,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`phone` int(10) NOT NULL,
`city` varchar(100) NOT NULL,
`address` varchar(100) NOT NULL,
`N_things` varchar(700) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `vaccination_request`
--
CREATE TABLE `vaccination_request` (
`ID` varchar(20) NOT NULL,
`email` varchar(20) NOT NULL,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`phone` int(10) NOT NULL,
`city` varchar(100) NOT NULL,
`address` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `need_help`
--
ALTER TABLE `need_help`
ADD PRIMARY KEY (`email`);
--
-- Indexes for table `vaccination_request`
--
ALTER TABLE `vaccination_request`
ADD PRIMARY KEY (`email`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 3.3.1
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2013 年 12 月 18 日 20:03
-- 服务器版本: 5.1.38
-- PHP 版本: 5.5.3
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!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 */;
--
-- 数据库: `Yaf\demo`
--
-- --------------------------------------------------------
--
-- 表的结构 `admin`
--
CREATE TABLE IF NOT EXISTS `admin` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(32) NOT NULL,
`password` varchar(32) NOT NULL,
`nickname` varchar(32) NOT NULL,
`realname` varchar(16) NOT NULL,
`email` varchar(255) NOT NULL,
`is_del` enum('0','1') NOT NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='管理员表' AUTO_INCREMENT=8 ;
--
-- 转存表中的数据 `admin`
--
INSERT INTO `admin` (`id`, `username`, `password`, `nickname`, `realname`, `email`, `is_del`) VALUES
(1, 'melon', '25d55ad283aa400af464c76d713c07ad', 'melon', 'melon', 'malong.chn@gmail.com', '0'),
(2, 'zhangsan', '46f94c8de14fb36680850768ff1b7f2a', 'zhangsan', 'zhangsan', 'malong.chn@gmail.com', '0'),
(3, 'admin', '25d55ad283aa400af464c76d713c07ad', 'admin', 'admin', 'admin@gmail.com', '0'),
(7, 'melons', 'b45746b95e3ca1a2486ad63222c37c4b', 'melons', 'melons', 'melons@gmail.com', '0'); |
# les transactions
## Exemple 1
START TRANSACTION;
INSERT INTO Continents (nom_cont) VALUES ('Europe');
INSERT INTO Pays (nom_pays, FK_cont) VALUES ('Belgique', 1);
INSERT INTO personne (nom_pers, prenom_pers, sexe_pers, FK_pays) VALUES ('Gravy', 'Thomas', 'M', 1);
COMMIT;
## Exemple 2
START TRANSACTION;
USE World;
INSERT INTO Continent (nom_cont) VALUES
('Europe'),
('Amerique'),
('Afrique'),
('Asie');
USE World;
INSERT INTO Pays (nom_pays, FK_cont) VALUES
('Belgique', 1),
('Congo', 2),
('Chine', 3),
('Californie', 4);
USE World;
INSERT INTO personne (nom_pers, prenom_pers, sexe_pers, FK_pays) VALUES
('Thomas', 'Gravy', 'M', 1),
('Lucie', 'Lyne', 'F', 2);
COMMIT;
|
${type("inline")}
select * from ${ref("sample_data")}
|
use codeup_test_db;
TRUNCATE albums;
insert into albums (
artist,
record,
release_date,
genre,
sales
)
values
('Michael Jackson', 'Thriller', 1982, 'Pop rock R&B', '45.4'),
('Eagles', 'Their Greatest Hits (1971–1975)', 1976, 'Rock soft rock',
'32.2'),
('Nirvana', 'Nevermind', 1991, 'Grunge', '16.7'),
('The Beatles', 'Sgt. Pepper''s Lonely Hearts Club Band', 1967, 'Rock',
'13.1');
|
USE sec;
INSERT INTO Users(Id,First_name,Last_name,Email)
VALUES
(1,'Ira','Lavrinok','ilavrinok@gmail.com'),
(2,'Alina','Kolodiy','olollo@gmail.com'),
(3,'Andrew','Litovskiy','andrew88@gmail.com'),
(4,'Anton','Pupchenko','catAnddog@gmail.com'),
(5,'Anton','Dolishniy','catAnddog@gmail.com'),
(6,'Borys','Panchenko','nufnuf@gmail.com'),
(7,'Nazar','Sytnyk','cheesecake@gmail.com'),
(8,'Max','Daineka','maxPrivat@gmail.com'),
(9,'Olena','Lavrinok','olenka12@gmail.com'),
(10,'Polina','Sytnyk','polina@gmail.com');
|
Update EMP
Set BASIC = 0
Where BASIC is NULL;
|
select t.date_time as year_week,
date_sub(
date_add(
concat(left(t.date_time, 4), '-01-01'), interval 7*right(t.date_time, 2) day
),
interval weekday(
date_add(
concat(left(t.date_time, 4), '-01-01'), interval 7*right(t.date_time, 2) day
)
)
day
) as first_weekday,
ifnull(a.new_activity, 0) as new_activity,
ifnull(b.new_user, 0) as new_user,
'${GATHER_SYS_TIME}' as time_stamp
from
(
(
select date_format(create_time, '%Y-%v') as date_time
from yz_app_calendar_db.activity_info
where del_status = 0
and account_id >= 20000
and create_time >= date_sub(
date_sub(
date('${GATHER_SYS_TIME}'),
INTERVAL weekday('${GATHER_SYS_TIME}') day
),
INTERVAL ${GATHER_INTERVAL_WEEK} week
)
)
union
(
select date_format(create_time, '%Y-%v') as date_time
from yz_app_calendar_db.activity_participate
where del_status = 0
and account_id >= 20000
and create_time >= date_sub(
date_sub(
date('${GATHER_SYS_TIME}'),
INTERVAL weekday('${GATHER_SYS_TIME}') day
),
INTERVAL ${GATHER_INTERVAL_WEEK} week
)
)
) as t
left join
(
select date_format(create_time, '%Y-%v') as date_time,
count(*) as new_activity
from yz_app_calendar_db.activity_info
where del_status = 0
and account_id >= 20000
and create_time >= date_sub(
date_sub(
date('${GATHER_SYS_TIME}'),
INTERVAL weekday('${GATHER_SYS_TIME}') day
),
INTERVAL ${GATHER_INTERVAL_WEEK} week
)
group by date_time
) as a
on t.date_time = a.date_time
left join
(
select date_format(create_time, '%Y-%v') as date_time,
count(*) as new_user
from yz_app_calendar_db.activity_participate
where del_status = 0
and account_id >= 20000
and create_time >= date_sub(
date_sub(
date('${GATHER_SYS_TIME}'),
INTERVAL weekday('${GATHER_SYS_TIME}') day
),
INTERVAL ${GATHER_INTERVAL_WEEK} week
)
group by date_time
) as b
on t.date_time = b.date_time
order by year_week
|
-- This statement merges the tacc_ and dicccser_ tables based on tacc_election cycle and removes
-- all dicccser_ federal election results, produces a table with the candidate_name, total_transaction,
-- and a numerical value of either 1(win) or 0(loss) indicating the election outcome.
-- Also, the code for every election cycle is available.
-- https://modeanalytics.com/editor/code_for_san_francisco/reports/23fa56dfb4eb
-- Query 1
with candidate_donations as
(
select
regexp_replace(lower(split_part(recipient_candidate_name, ',', 2) || split_part(recipient_candidate_name, ',', 1)), '[^a-z]', '', 'g') as full_name,
sum(transaction_amount) as total_transaction
from trg_analytics.candidate_contributions
where election_cycle = '2015'
--where cast(election_cycle as int) >= 2009
group by recipient_candidate_name
),
election_results as
(
select
contest_name,
regexp_replace(lower(split_part(candidate_name, ',', 2) || split_part(candidate_name, ',', 1)), '[^a-z]', '', 'g') as candidate_name,
vote_total,
rank() over (partition by contest_name order by vote_total desc) = 1 as is_winner
from data_ingest.casos__california_candidate_statewide_election_results
where county_name like 'State Totals'
and contest_name not like 'President%'
and contest_name not like 'president%'
and contest_name not like 'US Senate%'
and contest_name not like 'United States Representative%'
and contest_name not like 'us'
and contest_name not like 'united%'
and contest_name not like '%Congressional District'
)
select
candidate_name,
total_transaction,
is_winner::int as is_winner
from candidate_donations
join election_results
on candidate_donations.full_name = election_results.candidate_name
|
-- load_py.sql
-- create blob table
CREATE COLUMN TABLE "LIVE2"."MYBINARIES"
(
ID INTEGER PRIMARY KEY,
STRING BLOB ST_MEMORY_LOB
)
;
-- create full text index
DROP FULLTEXT INDEX "LIVE2"."MYINDEX_BLOB";
CREATE FULLTEXT INDEX myindex_blob ON "LIVE2"."MYBINARIES" ("STRING")
CONFIGURATION 'EXTRACTION_CORE'
TEXT ANALYSIS ON
MIME TYPE 'application/pdf';
-- code to run python to import PDFs
import pyodbc
conn = pyodbc.connect('DRIVER={HDBODBC};SERVERNODE=hana:30115;SERVERDB=DB1;UID=SYSTEM;PWD=SHALive1') #Open connection to SAP HANA
cur = conn.cursor() #Open a cursor
file = open('C:/Users/Administrator/Downloads/Debate_Transcript.pdf', 'rb') #Open file in read-only and binary
content = file.read() #Save the content of the file in a variable
cur.execute("INSERT INTO LIVE2.MYBINARIES VALUES(?,?)", ('1',content)) #Save the content to the table
cur.execute("COMMIT") #Save the content to the table
file.close() #Close the file
cur.close() #Close the cursor
conn.close() #Close the connection |
--
-- @(#) dbcreate/cffbpfl/mysql/crsp_delete_fbpfl_by_impstartidx.mysql
--
-- net.sourceforge.MssCF.CFFBPfl
--
-- Copyright (c) 2018 Mark Stephen Sobkow
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- Manufactured by MSS Code Factory 2.10
--
delimiter ////
create procedure cffbpf211.sp_delete_fbpfl_by_impstartidx(
argAuditClusterId bigint,
argAuditUserId varchar(36),
argAuditSessionId varchar(36),
secClusterId bigint,
secTenantId bigint,
argTenantId bigint,
argImpStart timestamp )
not deterministic
modifies sql data
begin
declare curRevision int;
declare subret boolean;
declare curTenantId bigint;
declare curFBPflId bigint;
declare done int default false;
declare cur_impstartidx cursor for
select
fbpf.tenantid as tenantid,
fbpf.fbpflid as fbpflid,
fbpf.revision as revision
from cffbpf211.FBPfl as fbpf
where
fbpf.tenantid = argTenantId
and ( ( ( argImpStart is null ) and ( fbpf.impstart is null ) )
or ( ( argImpStart is not null ) and ( fbpf.impstart = argImpStart ) ) );
declare cur_impstartidx_system cursor for
select
fbpf.tenantid as tenantid,
fbpf.fbpflid as fbpflid,
fbpf.revision as revision
from cffbpf211.FBPfl as fbpf
where
fbpf.tenantid = argTenantId
and ( ( ( argImpStart is null ) and ( fbpf.impstart is null ) )
or ( ( argImpStart is not null ) and ( fbpf.impstart = argImpStart ) ) );
declare cur_impstartidx_restricted cursor for
select
fbpf.tenantid as tenantid,
fbpf.fbpflid as fbpflid,
fbpf.revision as revision
from cffbpf211.FBPfl as fbpf
where
fbpf.tenantid = argTenantId
and ( ( ( argImpStart is null ) and ( fbpf.impstart is null ) )
or ( ( argImpStart is not null ) and ( fbpf.impstart = argImpStart ) ) )
and fbpf.TenantId = secTenantId;
declare continue handler for not found set done = true;
select cffbpf211.sp_is_system_user( argAuditUserId ) into subret;
if( subret )
then
open cur_impstartidx_system;
read_loop_impstartidx_system: loop
fetch cur_impstartidx_system into
curTenantId,
curFBPflId,
curRevision;
if done then
leave read_loop_impstartidx_system;
end if;
call cffbpf211.sp_delete_fbpfl( argAuditClusterId,
argAuditUserId,
argAuditSessionId,
secClusterId,
secTenantId,
curTenantId,
curFBPflId,
curRevision );
end loop;
close cur_impstartidx_system;
else
open cur_impstartidx_restricted;
read_loop_impstartidx_restricted: loop
fetch cur_impstartidx_restricted into
curTenantId,
curFBPflId,
curRevision;
if done then
leave read_loop_impstartidx_restricted;
end if;
call cffbpf211.sp_delete_fbpfl( argAuditClusterId,
argAuditUserId,
argAuditSessionId,
secClusterId,
secTenantId,
curTenantId,
curFBPflId,
curRevision );
end loop;
close cur_impstartidx_restricted;
end if;
end;////
|
alter table Entity ADD COLUMN texture varchar(100); |
/************************************************************************************
******************************* EXO 3.1 *********************************
*************************************************************************************/
-- a) find the titles of the courses in the COMP.Sci
-- department that have 3 cedits
select title
from course
where dept_name = 'Comp. Sci.' and credits = 3
;
/* b) Find the IDs of all students who were taught by an instructor
* named Einstein; make sure there are no duplicates in the result */
select *
from takes natural join student -- get all the courses taken by each student
where course_id in (select course_id -- keep those that have taken at list one course taught by Einstein
from teaches natural join instructor
where teaches.ID = instructor.ID and
instructor.name = 'Einstein'
)
;
select TS.name, TI.name
from takes natural join student as TS, teaches natural join instructor as TI
where takes.course_id = teaches.course_id and
TI.name = 'Einstein'
;
select TS.name, TI.name
from takes natural join student as TS, teaches natural join instructor as TI
where takes.course_id = teaches.course_id and
TI.name = 'Einstein'
;
select student.name, instructor.name
from student, takes, instructor, teaches
where teaches.course_id = takes.course_id and
teaches.ID = instructor.ID and
student.ID = takes.ID and
instructor.name = 'Einstein'
;
select distinct student.ID, student.name
from (student join takes using(ID) join
(instructor join teaches using(ID)) using (course_id,sec_id,semester,year))
where instructor.name = 'Einstein'
;
/*
* b) Find the highest salary of any instructor */
select max(salary)
from instructor
;
/*
* c) Find all instructors ezarning the highest salary */
select name
from instructor
where salary = (select max(salary) from instructor )
;
/*
* e) find the enrollement of each section that was offered in Autumn 2009 */
-- sol1: takes the join of section and takes,
-- group by sec_id and course_id, then count ids
select sec_id, course_id, count(ID)
from section natural join takes
where semester = 'Fall' and year = 2009
group by sec_id, course_id
order by sec_id asc, course_id asc
;
-- sol2: generate table of course_id and sec_id
-- for each tuple in this table, compute number of students
-- in a subquery
select course_id, sec_id, (select count(ID)
from takes
where takes.semester = section.semester
and takes.year = section.year
and takes.course_id = section.course_id
) as studentCount
from section
where year = 2009 and semester = 'Fall'
;
/*
* f) find the maximum enrollement accress all sections
in autumn 2009 */
select max(ID_count)
from(select course_id, count(ID) as ID_count
from section natural join takes
where semester = 'Fall' and year = 2009
group by course_id, sec_id) as TAB
;
/************************************************************************************
******************************* EXO 3.2 *********************************
*************************************************************************************/
/* a) dislpay course taken by student ID=12345 and corresponding
grade and credits obtained */
select ID, takes.course_id, credits, grade_points.grade,
grade_points.points, points * credits as totGrade
from takes natural join course, grade_points
where ID = '12345'
and takes.grade = grade_points.grade
;
(select sum(credits*points)
from (takes natural join course) natural join grade_points
where ID = '12345'
)
union
(select 0
from student
where student.ID = '12345' and not exists(select*from takes where takes.ID = '12345')
)
;
-- book
select sum(credits*points)
from (takes natural join course) natural join grade_points
where ID = '12345'
;
/*
* b) find the average grade-point average (GPA) for the abouve student
* that is the total grade points devided by the total crédits for
* the associated courses
*/
select takes.course_id, course.credits,
grade_points.points, points * credits as totGrade
from takes natural join course , grade_points
where ID = '12345'
and takes.grade = grade_points.grade
;
-- Sol 1
select sum(credits) as totCredit, sum(totGrade) as totGrades, sum(totGrade)/sum(credits)
from (select ID, takes.course_id, course.credits,
grade_points.points, points * credits as totGrade
from takes natural join course , grade_points
where takes.grade = grade_points.grade
) as OneStudent
where OneStudent.ID = '12345'
;
-- Sol 2
select sum(credits * points)/sum(credits) as GPA
from (takes natural join course) natural join grade_points
where ID = '12345'
;
/*
* c) find the average grade-point average (GPA) for all student
* that is the total grade points devided by the total crédits for
* the associated courses
*/
select ID, sum(credits) as totCredit, sum(totGrade) as totGrades ,
sum(totGrade)/nullif(sum(credits),0) as GPA
from (select ID, takes.course_id, course.credits,
grade_points.points, points * credits as totGrade
from takes natural join course , grade_points
where takes.grade = grade_points.grade
) as OneStudent
group by ID
;
select ID, sum(credits * points)/nullif(sum(credits),0) as GPA
from (takes natural join course) natural join grade_points
group by ID
;
/************************************************************************************
******************************* EXO 3.3 *********************************
*************************************************************************************/
/* a) Increase the salary of each instructor in the Comp. Sci.
department by 10% */
update instructor
set salary = salary*1.1
where dept_name = 'Comp. Sci.'
;
/* a) delete all courses that have not been offered */
delete from course
where course_id not in (select course_id
from section)
;
/* Insert every student whose tot credit is greater than 100
as an instructor in the same department with a salary of 10,000*/
insert into instructor
(select ID, name, dept_name , 10000
from student
where tot_cred > 100)
;
/************************************************************************************
******************************* EXO 3.4 *********************************
*************************************************************************************/
/*
* a) find the total number of people owned cars that were
* onvolved in accident in 2009
*/
select sum(distinct driver_id)
from (owns natural join participated) natural join accident
where accident.acc_date = 2009
;
/*
select count(distinct name)
from person, participated, accident
where accident.report_number = participated.report_number
and participated.driver_id = person.driver_id
and acc_date between date'1989-01-00' and date'1989-12-31'
;
*/
/*
* a) Add new accodent to database
*********************************/
insert into accident
values
(1111, 2010,'some where in montpellier')
;
insert into participated
select 1111, c.license, o.driver_id, 3000
from person p, owns o, car c
where p.name = 'John'
and p.driver_id = o.driver_id
and o.license = c.license
and c.model = 'Toyota'
;
/*
* c) Delete the Mazda bellonging to John Smith */
-- delete the relation John Smith owns --->
delete from owns
where driver_id = (select driver_id from person where name = 'John Smith')
and 'Mazda' in (select model from car where model = 'Mazda')
;
-- book
delete from car
where model = 'Mazda'
and license in (select license
from person p, owns o
where p.name = 'John' and p.driver_id = o.driver_id
)
;
/************************************************************************************
******************************* EXO 3.5 *********************************
*************************************************************************************/
/*
* a) Display the grade
*******/
insert into marks
values
('11', 30),
('22', 40),
('33', 42),
('44', 50),
('55', 61),
('66', 75),
('70', 64),
('80', 95),
('13', 100)
;
/**/
select*
from marks
;
/***************/
insert into sgrades
select ID*2, (case
when score < 40 then 'F'
when score between 40 and 59 then 'C'
when score between 60 and 79 then 'B'
when score > 79 then 'A'
else '-'
end) as grade
from marks
;
select*
from sgrades natural join marks
;
/*
* b) number of student for each grade
**********/
select grade, count(ID)
from sgrades
group by grade
;
/************************************************************************************
******************************* EXO 3.6 *********************************
*************************************************************************************/
/*
* a)
****/
select *
from department
where lower(dept_name) like '%sci%'
;
/************************************************************************************
******************************* EXO 3.7 *********************************
*************************************************************************************/
-- select distinct p.a1
-- from p, r1, r2
-- where p.a1 = r1.a1 or p.a1 = r2.a1
-- ;
/*
for p non empty,
(r1 intersect r2) != empty set
*/
/************************************************************************************
******************************* EXO 3.8 *********************************
*************************************************************************************/
/*
* a) Find all customers of the bank who have an account
but not a loan
select customer_name
from customer
where customer_name not in (select customer_name from borrwoer);
select customer_name
from custumer as C
where not exists(select custumer_name
from borrower as B
where C.custumer_name = B.custumer_name);
b) find the names of all custumers who live in the same street
and in the same city as Smith
select customer_name
from customer
where (customer_street, customer_city) = (select customer_street, customer_city
from customer
where customer_name = 'Smith')
;
c) find the names of all branches with cutomers who have an account
in the bank and who live in 'Harrison'
select branch_name
from branch, (customer natural join depositor natural join account) as CDC
where branch_name in (select branch_name
from CDC
where CDC.customer_city = 'Harrison'
;
*/
-- a)
select customer_name
from depositor
where customer_name not in (select customer_name from borrower)
;
-- b)
select customer_name
from customer
where (customer_street, customer_city) = (select customer_name, customer_city
from customer
where customer_name = 'Smith'
)
;
select F.customer
from customer F join customer S using (customer_street, customer_city)
where S.customer_name = 'Smith'
;
select F.customer_name
from customer as F, customer as S
where F.customer_city = S.customer_city
and F.customer_street = S.customer_street
;
-- c)
select branch_name
from branch
where branch_name in (select branch_name
from customer natural join depositor natural join account
where customer_city = 'Harrison'
)
;
|
--
-- Table structure for table `peliculas`
--
use curso;
CREATE TABLE IF NOT EXISTS `peliculas` (
`cod_pelicula` int(10) unsigned NOT NULL AUTO_INCREMENT,
`nombre` varchar(45) NOT NULL DEFAULT '',
`genero` varchar(45) NOT NULL DEFAULT '',
`descripcion` varchar(200) NOT NULL DEFAULT '',
`butacas` int(10) unsigned NOT NULL DEFAULT '0',
`disponibles` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`cod_pelicula`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
--
-- Volcado de datos para la tabla `peliculas`
--
INSERT INTO `peliculas` (`cod_pelicula`, `nombre`, `genero`, `descripcion`, `butacas`, `disponibles`) VALUES
(1, 'El paciente ingles', 'Drama', 'Durante la segunda Guerra Mundial, un piloto es rescatado de los...', 40, 9),
(2, 'Perfume de mujer', 'Drama', 'Charlie está becado en uno de los mejores colegios de Estados Unidos', 50, 50),
(3, 'El mercader de venecia', 'Drama', 'Situada en la Venecia del siglo XVI, esta eterna comedia... ', 30, 30),
(4, 'Atrapado sin salida', 'Accion', 'Para no entrar en la cárcel, Randle Patrick McMurphy convenció al juez que es...', 40, 40),
(5, 'Lo que el viento se llevo', 'Drama', 'Esta grandiosa superproduccion marco un hito en el mundo cinematografico... ', 40, 40),
(6, 'El Mago de Oz', 'Ficcion', 'Dorothy es una niña huérfana que se siente infeliz en la granja de sus...', 50, 50),
(7, 'King Kong', 'Ficcion', 'Carl Denham es un director de cine que busca desesperadamente una actriz... ', 40, 40),
(8, 'Casablanca', 'Drama', 'Durante la II Guerra Mundial, Rick Blaine dirige un exitoso local nocturno en Casablanca... ', 50, 50),
(9, 'La mujer pantera', 'Accion', 'Irena, una muchacha serbia que vive en Nueva York, se halla en el zoologico... ', 40, 40),
(10, 'Cantando bajo la lluvia', 'Musical', 'Con el nacimiento del cine sonoro en 1927, la industria cinematográfica debe renovarse... ', 30, 30); |
select Distinct Name from salesperson, orders
where salesperson.ID = orders.salesperson_id
And orders.Amount > 1400
|
CREATE PROC dbo.GetTypes
@ApplicationID uniqueidentifier
AS
Begin
SET NOCOUNT ON;
Select
t.TypeID, t.TypeFullName
from dbo.Type t inner join dbo.Application_Type at
on t.TypeID = at.TypeID
inner join dbo.Application a
on a.ApplicationID = at.ApplicationID
where
a.ApplicationID = @ApplicationID;
End
|
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema viajes
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema viajes
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `viajes` DEFAULT CHARACTER SET utf8 COLLATE utf8_estonian_ci ;
USE `viajes` ;
-- -----------------------------------------------------
-- Table `viajes`.`avion`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `viajes`.`avion` (
`idavion` INT NOT NULL AUTO_INCREMENT,
`tipoAvion` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`capacidad` INT NOT NULL,
`matricula` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`empresa` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`avioncol` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
PRIMARY KEY (`idavion`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `viajes`.`destino`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `viajes`.`destino` (
`iddestino` INT NOT NULL AUTO_INCREMENT,
`aeropuerto` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`ciudad` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`pais` VARCHAR(45) NOT NULL,
PRIMARY KEY (`iddestino`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `viajes`.`origen`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `viajes`.`origen` (
`idtable1` INT NOT NULL AUTO_INCREMENT,
`aeropuerto` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`ciudad` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`pais` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
PRIMARY KEY (`idtable1`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `viajes`.`usuario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `viajes`.`usuario` (
`idusuario` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`apellido` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`edad` INT NOT NULL,
`documento` VARCHAR(45) NOT NULL,
`email` VARCHAR(45) NOT NULL,
`telefono` VARCHAR(20) NULL,
PRIMARY KEY (`idusuario`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `viajes`.`tiquete`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `viajes`.`tiquete` (
`idtiquete` INT NOT NULL AUTO_INCREMENT,
`clase` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`asiento` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL,
`valor` DECIMAL(10,2) NOT NULL,
`hora` TIME NOT NULL,
`fecha` DATE NOT NULL,
`avion_idavion` INT NOT NULL,
`destino_iddestino` INT NOT NULL,
`origen_idtable1` INT NOT NULL,
`usuario_idusuario` INT NOT NULL,
PRIMARY KEY (`idtiquete`),
INDEX `fk_tiquete_avion_idx` (`avion_idavion` ASC) VISIBLE,
INDEX `fk_tiquete_destino1_idx` (`destino_iddestino` ASC) VISIBLE,
INDEX `fk_tiquete_origen1_idx` (`origen_idtable1` ASC) VISIBLE,
INDEX `fk_tiquete_usuario1_idx` (`usuario_idusuario` ASC) VISIBLE,
CONSTRAINT `fk_tiquete_avion`
FOREIGN KEY (`avion_idavion`)
REFERENCES `viajes`.`avion` (`idavion`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tiquete_destino1`
FOREIGN KEY (`destino_iddestino`)
REFERENCES `viajes`.`destino` (`iddestino`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tiquete_origen1`
FOREIGN KEY (`origen_idtable1`)
REFERENCES `viajes`.`origen` (`idtable1`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tiquete_usuario1`
FOREIGN KEY (`usuario_idusuario`)
REFERENCES `viajes`.`usuario` (`idusuario`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `viajes`.`reserva`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `viajes`.`reserva` (
`idreserva` INT NOT NULL AUTO_INCREMENT,
`fechaReserva` DATE NOT NULL,
`idaYvuelta` VARCHAR(5) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL DEFAULT 'no',
`usuario_idusuario` INT NOT NULL,
PRIMARY KEY (`idreserva`),
INDEX `fk_reserva_usuario1_idx` (`usuario_idusuario` ASC) VISIBLE,
CONSTRAINT `fk_reserva_usuario1`
FOREIGN KEY (`usuario_idusuario`)
REFERENCES `viajes`.`usuario` (`idusuario`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
SELECT DISTINCT
A.PROCESS_TYPE,
B.CODE_NAME AS PROCESS_TYPE_NAME
FROM
PROCESS_MST A
LEFT JOIN
CODE_MASTER B
ON
A.PROCESS_TYPE = B.CODE_ID
AND B.CODE_TYPE = CAST('262' AS CHAR(3))
AND B.COUNTRY_ID = /*countryType*/ |
SELECT
-- count(*) as game_count,
player_id,
name,
p.team_id as team_id,
team_name,
CASE
WHEN (sum(hit)/sum(at_bats)) is null THEN 0
WHEN (sum(hit)/sum(at_bats)) is not null THEN (sum(hit)/sum(at_bats))
END as average,
CASE
WHEN ((sum(hit)+sum(twobase)*1+sum(homerun)*2)/sum(at_bats)) is null THEN 0
WHEN ((sum(hit)+sum(twobase)*1+sum(homerun)*2)/sum(at_bats)) is not null THEN ((sum(hit)+sum(twobase)*1+sum(homerun)*2)/sum(at_bats))
END as SLG,
CASE
WHEN ((sum(hit)+sum(four_ball))/sum(tpa))+((sum(hit)+sum(twobase)*1+sum(homerun)*2)/sum(at_bats)) is null THEN 0
WHEN ((sum(hit)+sum(four_ball))/sum(tpa))+((sum(hit)+sum(twobase)*1+sum(homerun)*2)/sum(at_bats)) is not null THEN ((sum(hit)+sum(four_ball))/sum(tpa))+((sum(hit)+sum(twobase)*1+sum(homerun)*2)/sum(at_bats))
END as OPS,
(sum(hit)+sum(four_ball))/sum(tpa) as OBP,
((((sum(hit)+sum(twobase)*1+sum(homerun)*2)+0.26*sum(four_ball)-0.03*sum(strike_out)+3*sum(tpa))*(sum(hit)+sum(four_ball)+2.4*sum(tpa)))/(9*sum(tpa))-0.9*sum(tpa))*27/(sum(at_bats)-sum(hit)) as RC27,
CASE
WHEN sum(at_bats)/sum(strike_out) is null THEN 0
WHEN sum(at_bats)/sum(strike_out) is not null THEN sum(at_bats)/sum(strike_out)
END as not_strike_out,
CASE
WHEN sum(at_bats)/sum(homerun) is null THEN 0
WHEN sum(at_bats)/sum(homerun) is not null THEN sum(at_bats)/sum(homerun)
END as avg_homerun,
CASE
WHEN sum(rbi)/sum(at_bats) is null THEN 0
WHEN sum(rbi)/sum(at_bats) is not null THEN sum(rbi)/sum(at_bats)
END as avg_rbi,
sum(tpa) as tpa,
sum(at_bats) as at_bats,
sum(hit) as hit,
sum(rbi) as rbi,
sum(four_ball) as four_ball,
sum(strike_out) as strike_out,
sum(twobase) as twobase,
sum(homerun) as homerun
FROM batting_sum b
INNER JOIN GAME g on b.game_id=g.game_id
INNER JOIN PLAYER p on b.player_id=p.id
INNER JOIN TEAM t on t.team_id=p.team_id
group by player_id
order by hit desc |
create database school;
create database school_test;
drop database school;
drop database school_test;
ALTER TABLE batch MODIFY id int AUTO_INCREMENT ;
create database jpa_db;
use jpa_db;
create table employee (
id int not null auto_increment,
full_name varchar(50) not null,
primary key(id)
);
insert into employee (full_name) values ("minh");
insert into employee (full_name) values ("thiem");
create database test;
use test;
create table employee (
id int not null auto_increment,
first_name varchar(50) not null,
last_name varchar(50) ,
email varchar(50) ,
primary key(id)
);
insert into employee (first_name,last_name,email) values ("minh","le","lnminh58@gmail.com");
insert into employee (first_name,last_name,email) values ("mary","alan","mary@test.com");
|
/*
SUBCONSULTAS:
- Son consultas que se ejecutan dentro de otras.
- Consiste en utilizar los resultados de la sunsulta para operar en la consulta principal.
- Jugando con las claves ajenas / foraneas.
*/
/*Se pone IN porque la subconsulta devolvera vrios resultados
LA consulta devulve los usuarios si existen ID en los usuarios de la tabla entradas
*/
# Sacar usuarios con entradas#
SELECT * FROM usuarios WHERE id IN (SELECT usuario_id FROM entradas);
# Sacar usuarios sin entradas#
SELECT * FROM usuarios WHERE id NOT IN (SELECT usuario_id FROM entradas);
# Sacar usuarios que tengan alguna entrada que en su titulo habla de GTA #
SELECT nombre, apellidos FROM usuario
WHERE id
IN (SELECT usuario_id FROM entradas WHERE titulo LIKE "%GTA%");
# Sacar todas las entradas de la categoria acción utilizando su nombre#
SELECT * From entradas WHERE categoria_id IN (SELECT id FROM categorias WHERE nombre = 'Accion');
# Mostrar las categorías con más de tres entradas #
SELECT * FROM categorias WHERE id IN (SELECT categoria_id from entradas GROUP BY categoria_id HAVING COUNT(categoria_id >= 3));
# Mostrar los usarios que crearon una entrada un martes #
SELECT * FROM USUARIOS WHERE id IN
(SELECT usuario_id FROM entradas WHERE DAYOFWEEK(fecha)=3);
# Mostrar el nombre el usuario ue tenga mas entradas #
SELECT CONCAT(nombre, ' ', apellidos) AS 'EL usuario con mas entradas' FROM usuarios WHERE id (SELECT usuario_id FROm GROUP BY usuario_id ORDER BY COUNT(id) DESC LIMIT 1);
# Mostrar las categorias sin entradas #
SELECT * FROM categorias WHERE id NOT IN (SELECT categoria_id FROM entradas); |
------------------------------------------------------
-- Autor : Colegio Santa Joaquina de Vedruna
-- Descripción : Script 0 - Formación SQL
-- Responsable : Juan Alejandro Téllez Rubio
-- Alumno 1: Daniel Vazquez Muñoz
-- Alumno 2: Diego López Strickland
-- Alumno 3: Fátima Prieto Alvear
-- Alumno 4: Juan Manuel Hermida Acuña
-- Alumno 5: Alexei Viadero Sanchez
------------------------------------------------------
-- Muestra las distintas ciudades de donde hay institutos que participen en la DUAL, sin repetir ciudad.
SELECT DISTINCT(city) FROM fpdual.highschool;
-- Muestra las asignaturas que imparte el profesor con id=1, ordenadas por nombre.
SELECT * FROM fpdual.subjects WHERE idTeacher=1 ORDER BY Name;
-- Muestra de la tabla class, las notas 5 del estudiante con id 8.
SELECT * FROM fpdual.class WHERE score=5 AND idStudent=8;
-- Los institutos de Sevilla y Cádiz
SELECT * FROM fpdual.highschool WHERE city LIKE "Sevilla" OR city LIKE "Cádiz";
-- Los profesores, menos el profesor con id=1
SELECT * FROM fpdual.teachers WHERE NOT idTeacher=1;
-- Comprobar la máxima nota
SELECT MAX(score) FROM class;
-- Comprobar la mínima nota
SELECT MIN(score) FROM class;
-- Comprobar los institutos de Sevilla.
SELECT name FROM highschool WHERE city LIKE "Sevilla";
-- Sacar el número de alumnos con un COUNT()
SELECT COUNT(idStudent) FROM students;
-- Comprobar la media de las notas por el ID de los alumnos.
SELECT idStudent, AVG(score) FROM class GROUP BY idStudent;
-- Comprobar los alumnos con notas entre 6 y 8.
SELECT idStudent, idSubjects, score FROM class WHERE score BETWEEN 6 AND 8;
-- Primer INNER JOIN, junta varias tablas para conseguir toda la información sobre el estudiante, profesor, asignatura y notas
SELECT sub.idSubjects, sub.name, sub.idTeacher, te.firtsName,
te.lastName AS NOMBRE_FORMADOR, cl.idStudent, st.firstName AS NOMBRE_ESTUDIANTE,
cl.score AS NOTAS FROM subjects sub
INNER JOIN class cl ON sub.idSubjects = cl.idSubjects
INNER JOIN teachers te ON sub.idTeacher = te.idTeacher
INNER JOIN students st ON cl.idStudent = st.idStudent;
-- Primer LEFT JOIN, comprueba los profesores que no imparten ninguna asignatura
SELECT te.FirtsName FROM teachers te LEFT JOIN subjects su ON te.idTeacher = su.idTeacher
WHERE su.idTeacher IS NULL;
-- Primer RIGHT JOIN, comprueba las asignaturas que no tienen asignado ningun profesor
SELECT su.idSubjects, su.name FROM teachers te RIGHT JOIN subjects su ON te.idTeacher = su.idTeacher
WHERE te.idTeacher IS NULL;
-- Cantidad de colegios por ciudades
SELECT city as Ciudad, count(city) as Colegios FROM fpdual.highschool GROUP BY city HAVING Colegios > 2;
-- Alumnos por colegios
SELECT highSchool.name as Colegio, count(students.idSchool) as Alumnos FROM students
JOIN highschool ON students.idSchool = highschool.idSchool GROUP BY students.idSchool HAVING Alumnos > 5;
-- Asignaturas por profesores
SELECT teachers.firtsname as Profesor, count(subjects.idTeacher) as Asignaturas FROM subjects JOIN teachers ON subjects.idTeacher=teachers.idTeacher
GROUP BY Profesor HAVING Asignaturas > 2;
-- BONUS
-- PROCEDIMIENTO QUE DEVUELVE LA MEDIA DE LAS NOTAS
DELIMITER $$
CREATE PROCEDURE getMedia()
BEGIN
SELECT idStudent, AVG(score) FROM class GROUP BY idStudent;
END$$
DELIMITER ;
CALL getMedia();
|
create database dbHistoriaClinica;
use dbHistoriaClinica;
create table Historiaclinica (
idHistoriaClinica int primary key auto_increment,
nombrePaciente varchar(40) not null,
Edad int not null,
FechadeNacimiento datetime not null
);
create table Especialidad (
Especialidad int primary key auto_increment,
CitaSolicitada datetime not null,
FechadeCita int not null
);
create table dbHistoriaClinica(
id int primary key auto_increment not null,
nombrePaciente varchar(20) not null
);
rename table BasePaciente to tabletestrenamed;
truncate table tabletesttrenamed;
drop table tabletesttrenamed;
|
select notice_no, title, inputdate, view_count
from
(select notice_no, title, to_char(inputdate,'yyyy-mm-dd') inputdate, view_count
from notice
)
where notice_no between 11 and 20
ORDER BY LENGTH(notice_no) desc, notice_no desc;
select notice_no, title, to_char(inputdate,'yyyy-mm-dd') inputdate, view_count from
(select notice_no, title, inputdate, view_count, row_number() over(order by inputdate desc) r_num
from notice)
where r_num between 1 and 241;
select view_count from notice
where ;
update notice
set view_count = (select view_count from notice where notice_no=#{notice_no})+1
where notice_no=#{notice_no}
|
-- ACN eTS-Contracts00002724
BEGIN HARMONY.DOIT('select ''eTS-Contracts00002724'' from dual');END;
/
-- Remove HARMONY.TROLE_ROLLBACK-table
BEGIN HARMONY.DOIT('DROP TABLE HARMONY.TROLE_ROLLBACK');END; |
/******************** 12-1 등록 수의 추이와 경향 보기 ********************/
/*날짜별 등록 수의 추이를 집계하는 쿼리*/
SELECT REGISTER_DATE
, COUNT(USER_ID) AS COUNT_REGISTER_DATE
FROM MST_USERS
GROUP BY REGISTER_DATE
ORDER BY REGISTER_DATE;
register_date|count_register_date|
-------------|-------------------|
2016-10-01 | 3|
2016-10-05 | 2|
2016-10-10 | 3|
2016-10-15 | 1|
2016-10-16 | 1|
2016-10-18 | 2|
2016-10-20 | 1|
2016-10-25 | 1|
2016-11-01 | 5|
2016-11-03 | 3|
2016-11-04 | 1|
2016-11-05 | 2|
2016-11-10 | 2|
2016-11-15 | 1|
2016-11-28 | 2|
/*매달 등록 수와 전월비를 계산하는 쿼리*/
with MST_USERS_YEARMONTH as (
select *
, SUBSTR(REGISTER_DATE , 1, 7) as YEAR_MONTH
from mst_users
)
select YEAR_MONTH
, COUNT(USER_ID) as REGISTER_COUNT
, LAG(COUNT(USER_ID)) OVER(order by YEAR_MONTH) as LAST_MONTH_COUNT
, 1.0 * COUNT(USER_ID) / LAG(COUNT(USER_ID)) OVER(order by YEAR_MONTH) as MONTH_OVER_MONTH_RATIO
from MST_USERS_YEARMONTH
group by YEAR_MONTH;
year_month|register_count|last_month_count|month_over_month_ratio|
----------|--------------|----------------|----------------------|
2016-10 | 14| | |
2016-11 | 16| 14| 1.1428571428571429|
/**디바스들의 등록 수를 집계하는 쿼리*/
with MST_USERS_YEARMONTH as (
select *
, SUBSTR(REGISTER_DATE , 1, 7) as YEAR_MONTH
from mst_users
)
select year_month
, count(user_id) as register_count
, count(distinct case when register_device = 'pc' then user_id end) as register_pc
, count(distinct case when register_device = 'sp' then user_id end) as register_sp
, count(distinct case when register_device = 'app' then user_id end) as register_pc
from MST_USERS_YEARMONTH
group by year_month ;
year_month|register_count|register_pc|register_sp|register_pc|
----------|--------------|-----------|-----------|-----------|
2016-10 | 14| 7| 4| 3|
2016-11 | 16| 4| 4| 8|
|
SELECT TABLE_ID,TABLE_NAME
FROM PREPARE_FIELD_MASTER
GROUP BY TABLE_ID,TABLE_NAME ORDER BY TABLE_ID |
FUNCTION ajax_region(p_region IN apex_plugin.t_region,
p_plugin IN apex_plugin.t_plugin)
RETURN apex_plugin.t_region_ajax_result IS
-- plugin attributes
l_result apex_plugin.t_region_ajax_result;
l_plsql p_region.attribute_03%TYPE := p_region.attribute_03;
--
BEGIN
-- execute PL/SQL
apex_plugin_util.execute_plsql_code(p_plsql_code => l_plsql);
--
RETURN l_result;
--
END ajax_region; |
CREATE TABLE GROUP_TEST(
NAME VARCHAR2(100),
GENDER VARCHAR2(100),
LECTURE VARCHAR2(100),
SCORE NUMBER)
INSERT INTO GROUP_TEST
(NAME, GENDER, LECTURE, SCORE)
VALUES
('¹éÁØ','MALE','JAVA',100)
SELECT * FROM GROUP_TEST
SELECT NAME,
SUM(SCORE) AS SUM
FROM
GROUP_TEST
GROUP BY NAME
ORDER BY SUM DESC
|
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema findesk
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `findesk` ;
-- -----------------------------------------------------
-- Schema findesk
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `findesk` DEFAULT CHARACTER SET utf8 ;
USE `findesk` ;
-- -----------------------------------------------------
-- Table `findesk`.`Cor`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `findesk`.`Cor` ;
CREATE TABLE IF NOT EXISTS `findesk`.`Cor` (
`idCor` VARCHAR(7) NOT NULL COMMENT 'contêm o valor hexadecimal da cor referenciada',
`nomeCor` VARCHAR(45) NOT NULL COMMENT 'contêm o nome da cor',
PRIMARY KEY (`idCor`),
UNIQUE INDEX `idCor_UNIQUE` (`idCor` ASC) VISIBLE,
UNIQUE INDEX `nomeCor_UNIQUE` (`nomeCor` ASC) VISIBLE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `findesk`.`Categoria`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `findesk`.`Categoria` ;
CREATE TABLE IF NOT EXISTS `findesk`.`Categoria` (
`idCategoria` CHAR(1) NOT NULL,
`nomeCat` VARCHAR(45) NOT NULL,
PRIMARY KEY (`idCategoria`),
UNIQUE INDEX `nomeCat_UNIQUE` (`nomeCat` ASC) VISIBLE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `findesk`.`Nome`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `findesk`.`Nome` ;
CREATE TABLE IF NOT EXISTS `findesk`.`Nome` (
`idNome` CHAR(10) NOT NULL,
`nome` VARCHAR(45) NOT NULL,
`idCategoria` CHAR(1) NOT NULL,
PRIMARY KEY (`idNome`),
INDEX `fk_Nome_Categoria1_idx` (`idCategoria` ASC) VISIBLE,
CONSTRAINT `fk_idCategoria`
FOREIGN KEY (`idCategoria`)
REFERENCES `findesk`.`Categoria` (`idCategoria`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `findesk`.`Config`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `findesk`.`Config` ;
CREATE TABLE IF NOT EXISTS `findesk`.`Config` (
`idConfig` INT NOT NULL,
`admIpConfig` VARCHAR(15) NOT NULL,
`userIpConfig` VARCHAR(15) NOT NULL,
`portaConfig` INT NOT NULL,
`bufferSizeConfig` INT NOT NULL,
PRIMARY KEY (`idConfig`),
UNIQUE INDEX `idConfig_UNIQUE` (`idConfig` ASC) VISIBLE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `findesk`.`Administrador`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `findesk`.`Administrador` ;
CREATE TABLE IF NOT EXISTS `findesk`.`Administrador` (
`idAdm` INT NOT NULL,
`idConfig` INT NOT NULL,
PRIMARY KEY (`idAdm`),
INDEX `fk_Administrador_Config1_idx` (`idConfig` ASC) VISIBLE,
CONSTRAINT `fk_idAdmConfig`
FOREIGN KEY (`idConfig`)
REFERENCES `findesk`.`Config` (`idConfig`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `findesk`.`Item`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `findesk`.`Item` ;
CREATE TABLE IF NOT EXISTS `findesk`.`Item` (
`idItem` INT NOT NULL COMMENT 'Valor de idêntificação do item',
`idCor` VARCHAR(7) NOT NULL,
`idNome` CHAR(10) NOT NULL,
`idAdm` INT NOT NULL,
`dataEntradaItem` DATETIME NOT NULL COMMENT 'Data referente ao momento de cadastro do item',
`dataSaidaItem` DATETIME NULL COMMENT 'Data referente a retirada do item',
`retiradoItem` TINYINT NOT NULL DEFAULT 0 COMMENT 'Valor valendo 1 = foi retirado ou 0 = não foi retirado',
`fotoItem` VARCHAR(100) NULL COMMENT 'Atributo referente ao arquivo de imagem do item',
`descricaoItem` VARCHAR(200) NULL COMMENT 'descrição escrita pelo administrador no momento do cadastro',
PRIMARY KEY (`idItem`),
INDEX `fk_idItemCor` (`idCor` ASC) VISIBLE,
INDEX `fk_Item_Nome1_idx` (`idNome` ASC) VISIBLE,
INDEX `fk_Item_Administrador1_idx` (`idAdm` ASC) VISIBLE,
CONSTRAINT `fk_idItemCor`
FOREIGN KEY (`idCor`)
REFERENCES `findesk`.`Cor` (`idCor`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_idNome`
FOREIGN KEY (`idNome`)
REFERENCES `findesk`.`Nome` (`idNome`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_idAdm`
FOREIGN KEY (`idAdm`)
REFERENCES `findesk`.`Administrador` (`idAdm`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `findesk`.`Usuario`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `findesk`.`Usuario` ;
CREATE TABLE IF NOT EXISTS `findesk`.`Usuario` (
`idUsuario` INT NOT NULL,
`idConfig` INT NOT NULL,
PRIMARY KEY (`idUsuario`),
INDEX `fk_Usuario_Config1_idx` (`idConfig` ASC) VISIBLE,
CONSTRAINT `fk_idUsuConfig`
FOREIGN KEY (`idConfig`)
REFERENCES `findesk`.`Config` (`idConfig`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-- -----------------------------------------------------
-- Data for table `findesk`.`Cor`
-- -----------------------------------------------------
START TRANSACTION;
USE `findesk`;
INSERT INTO `findesk`.`Cor` (`idCor`, `nomeCor`) VALUES ('#FFFF00', 'Amarelo');
INSERT INTO `findesk`.`Cor` (`idCor`, `nomeCor`) VALUES ('#0000FF', 'Azul');
INSERT INTO `findesk`.`Cor` (`idCor`, `nomeCor`) VALUES ('#000000', 'Preto');
INSERT INTO `findesk`.`Cor` (`idCor`, `nomeCor`) VALUES ('#FFFFFF', 'Branco');
INSERT INTO `findesk`.`Cor` (`idCor`, `nomeCor`) VALUES ('#FF0000', 'Vermelho');
INSERT INTO `findesk`.`Cor` (`idCor`, `nomeCor`) VALUES ('#008000', 'Verde');
INSERT INTO `findesk`.`Cor` (`idCor`, `nomeCor`) VALUES ('#FFA500', 'Laranja');
COMMIT;
-- -----------------------------------------------------
-- Data for table `findesk`.`Categoria`
-- -----------------------------------------------------
START TRANSACTION;
USE `findesk`;
INSERT INTO `findesk`.`Categoria` (`idCategoria`, `nomeCat`) VALUES ('a', 'Eletrônicos');
INSERT INTO `findesk`.`Categoria` (`idCategoria`, `nomeCat`) VALUES ('b', 'Documentos');
INSERT INTO `findesk`.`Categoria` (`idCategoria`, `nomeCat`) VALUES ('c', 'Vestíveis');
INSERT INTO `findesk`.`Categoria` (`idCategoria`, `nomeCat`) VALUES ('f', 'Outros');
INSERT INTO `findesk`.`Categoria` (`idCategoria`, `nomeCat`) VALUES ('d', 'Recipientes');
INSERT INTO `findesk`.`Categoria` (`idCategoria`, `nomeCat`) VALUES ('e', 'Materiais');
COMMIT;
-- -----------------------------------------------------
-- Data for table `findesk`.`Nome`
-- -----------------------------------------------------
START TRANSACTION;
USE `findesk`;
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('1', 'Pendrive', 'a');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('2', 'Notebook', 'a');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('3', 'RG', 'b');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('4', 'RA', 'b');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('5', 'Blusa', 'c');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('6', 'Relógio', 'c');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('7', 'Garrafa', 'd');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('8', 'Copo', 'd');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('9', 'Caderno', 'e');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('10', 'Caneta', 'e');
INSERT INTO `findesk`.`Nome` (`idNome`, `nome`, `idCategoria`) VALUES ('11', 'Guarda-Chuva', 'f');
COMMIT;
-- -----------------------------------------------------
-- Data for table `findesk`.`Config`
-- -----------------------------------------------------
START TRANSACTION;
USE `findesk`;
INSERT INTO `findesk`.`Config` (`idConfig`, `admIpConfig`, `userIpConfig`, `portaConfig`, `bufferSizeConfig`) VALUES (1, '127.0.0.1', '127.0.0.1', 3307, 1024);
COMMIT;
-- -----------------------------------------------------
-- Data for table `findesk`.`Administrador`
-- -----------------------------------------------------
START TRANSACTION;
USE `findesk`;
INSERT INTO `findesk`.`Administrador` (`idAdm`, `idConfig`) VALUES (1, 1);
COMMIT;
-- -----------------------------------------------------
-- Data for table `findesk`.`Usuario`
-- -----------------------------------------------------
START TRANSACTION;
USE `findesk`;
INSERT INTO `findesk`.`Usuario` (`idUsuario`, `idConfig`) VALUES (1, 1);
COMMIT;
|
DELIMITER $$
create procedure PASalaExposicion(
in IDSala int,
in IDExposicion int
)
begin
if IDSala!=0 and IDExposicion!=0 then
select
Sala.ID,
Sala.Nombre,
Exposicion.ID,
Exposicion.Presentador,
Exposicion.Titulo,
Exposicion.Duracion,
TiposExposicion.Descripcion
from
lioness.Sala,
lioness.Exposicion,
lioness.SalaExposicion,
lioness.TiposExposicion
where
Sala.ID=IDSala and
Exposicion.ID=IDExposicion and
TiposExposicion.ID=Exposicion.IDTipo and
SalaExposicion.IDSala=IDSala and
SalaExposicion.IDExposicion=IDExposicion;
elseif IDSala!=0 then
select
Sala.ID,
Sala.Nombre,
Exposicion.ID,
Exposicion.Presentador,
Exposicion.Titulo,
Exposicion.Duracion,
TiposExposicion.Descripcion
from
lioness.Sala,
lioness.Exposicion,
lioness.SalaExposicion,
lioness.TiposExposicion
where
Sala.ID=IDSala and
TiposExposicion.ID=Exposicion.IDTipo and
SalaExposicion.IDSala=IDSala and
SalaExposicion.IDExposicion=Exposicion.ID;
elseif IDExposicion!=0 then
select
Sala.ID,
Sala.Nombre,
Exposicion.ID,
Exposicion.Presentador,
Exposicion.Titulo,
Exposicion.Duracion,
TiposExposicion.Descripcion
from
lioness.Sala,
lioness.Exposicion,
lioness.SalaExposicion,
lioness.TiposExposicion
where
Exposicion.ID=IDExposicion and
TiposExposicion.ID=Exposicion.IDTipo and
SalaExposicion.IDSala=Sala.ID and
SalaExposicion.IDExposicion=IDExposicion;
else
select
Sala.ID,
Sala.Nombre,
Exposicion.ID,
Exposicion.Presentador,
Exposicion.Titulo,
Exposicion.Duracion,
TiposExposicion.Descripcion
from
lioness.Sala,
lioness.Exposicion,
lioness.SalaExposicion,
lioness.TiposExposicion
where
TiposExposicion.ID=Exposicion.IDTipo and
SalaExposicion.IDSala=Sala.ID and
SalaExposicion.IDExposicion=Exposicion.ID;
end if;
END$$
DELIMITER ; |
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jul 28, 2018 at 12:50 PM
-- Server version: 5.7.22-0ubuntu18.04.1
-- PHP Version: 7.2.7-0ubuntu0.18.04.2
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: `ejanta`
--
-- --------------------------------------------------------
--
-- Table structure for table `aadhar_details`
--
CREATE TABLE `aadhar_details` (
`aadhar_id` int(16) NOT NULL,
`mobile_number` int(12) NOT NULL,
`user_name` varchar(40) NOT NULL,
`address` varchar(50) NOT NULL,
`d_o_b` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `admin_reg`
--
CREATE TABLE `admin_reg` (
`admin_id` varchar(100) NOT NULL,
`admin_password` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin_reg`
--
INSERT INTO `admin_reg` (`admin_id`, `admin_password`, `email`) VALUES
('admin', '6ea5360b79e9e12de5373bbb98d5c2d6', 'kalaunnatikala@gmail.com');
-- --------------------------------------------------------
--
-- Table structure for table `announcements`
--
CREATE TABLE `announcements` (
`govtann` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `announcements`
--
INSERT INTO `announcements` (`govtann`) VALUES
('Qualification: Candidates Should have Completed the Graduate, Post graduate in Reconized university. Eligibility criteria and other conditions may be seen on NHAI Website www.nhai.gov.in\r\n');
-- --------------------------------------------------------
--
-- Table structure for table `comment`
--
CREATE TABLE `comment` (
`comment` varchar(255) NOT NULL,
`policy_title` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `comment`
--
INSERT INTO `comment` (`comment`, `policy_title`) VALUES
('r', 'r');
-- --------------------------------------------------------
--
-- Table structure for table `dashboard`
--
CREATE TABLE `dashboard` (
`policy_id` varchar(1000) NOT NULL,
`user_id` varchar(40) NOT NULL,
`Status` varchar(10) NOT NULL,
`comment` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `dashboard`
--
INSERT INTO `dashboard` (`policy_id`, `user_id`, `Status`, `comment`) VALUES
('Atal Pension Yojana_N', '2', 'YES', 'Testing'),
('Pradhan Mantri Suraksha Bima Yojana _N', '2', 'NO', 'Testing'),
('test_N', '2', 'YES', 'Testing'),
('q_N', '2', 'YES', 'Testing'),
('no_S', '2', 'NO', 'Testing'),
('j_N', '2', 'NO', 'Testing'),
('qqq_N', '2', 'YES', 'Testing'),
('testtt_N', '2', 'YES', 'Testing');
-- --------------------------------------------------------
--
-- Table structure for table `discussion_form`
--
CREATE TABLE `discussion_form` (
`policy_name` varchar(50) NOT NULL,
`pub_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `email`
--
CREATE TABLE `email` (
`receiver` varchar(50) NOT NULL,
`subject` varchar(100) NOT NULL,
`mesg` varchar(1000) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `ideas`
--
CREATE TABLE `ideas` (
`ideas` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `ideas`
--
INSERT INTO `ideas` (`ideas`) VALUES
('Defense Distributed, the anarchist gun group known for its 3D printed and milled \"ghost guns,\" has settled a case with the federal government allowing it to upload technical data on nearly any commercially available firearm.'),
('teat'),
('ngfv');
-- --------------------------------------------------------
--
-- Table structure for table `jobalert`
--
CREATE TABLE `jobalert` (
`id` int(50) NOT NULL,
`job_title` varchar(50) NOT NULL,
`job_desc` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `jobalert`
--
INSERT INTO `jobalert` (`id`, `job_title`, `job_desc`) VALUES
(1, 'Engineer', 'Instrumentation Engineer, Anaesthetist, Asst Professor, Lecturer – 12 Posts '),
(2, 'Manager', ', Qualification: Candidates Should have Completed the Graduate, Post graduate in Reconized university. Eligibility criteria and other conditions may be seen on NHAI Website www.nhai.gov.in\r\n');
-- --------------------------------------------------------
--
-- Table structure for table `policy`
--
CREATE TABLE `policy` (
`policy_id` varchar(1000) NOT NULL,
`policy_title` varchar(500) NOT NULL,
`policy_description` varchar(1000) NOT NULL,
`type` varchar(10) NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `policy`
--
INSERT INTO `policy` (`policy_id`, `policy_title`, `policy_description`, `type`, `Timestamp`) VALUES
('Atal Pension Yojana_N', 'Atal Pension Yojana', 'A pension program that allows people to make voluntary contributions within a certain range in order to receive matching government contributions.', 'N', '2018-07-16 19:11:18'),
('j_N', 'j', 'ju', 'N', '2018-07-17 03:47:32'),
('no_S', 'no', 'no', 'S', '2018-07-17 03:46:27'),
('Pradhan Mantri Suraksha Bima Yojana _N', 'Pradhan Mantri Suraksha Bima Yojana ', 'Accidental Insurance with a premium of Rs. 12 per year.', 'N', '2018-07-16 19:11:48'),
('qqq_N', 'qqq', 'ww', 'N', '2018-07-17 05:04:45'),
('q_N', 'q', 'w', 'N', '2018-07-17 03:46:00'),
('testtt_N', 'testtt', 'tyutytgyjh', 'N', '2018-07-20 14:50:42'),
('test_N', 'test', 'test123', 'N', '2018-07-17 03:45:28');
-- --------------------------------------------------------
--
-- Table structure for table `profile`
--
CREATE TABLE `profile` (
`user_name` varchar(40) NOT NULL,
`user_img` varchar(50) NOT NULL,
`badges` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `register`
--
CREATE TABLE `register` (
`aadhar_id` varchar(20) NOT NULL,
`user_password` varchar(100) NOT NULL,
`user_id` varchar(40) NOT NULL,
`e_mail` varchar(40) NOT NULL,
`Type` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `register`
--
INSERT INTO `register` (`aadhar_id`, `user_password`, `user_id`, `e_mail`, `Type`) VALUES
('123412341234', '6ea5360b79e9e12de5373bbb98d5c2d6', 'unnatikala', 'kalaunnatikala@gmail.com', NULL),
('123451234512', '8854315206c3d5f6037320d8254b669c', 'kalakalakala', 'kalaunnatikala@gmail.com', NULL),
('123456123456', '8854315206c3d5f6037320d8254b669c', 'kalakalakala', 'kalaunnatikala@gmail.com', NULL),
('123456789012', '8854315206c3d5f6037320d8254b669c', 'kalakala', 'kalaunnatikala@gmail.com', NULL),
('123456789123', '6ea5360b79e9e12de5373bbb98d5c2d6', 'unnatikala', 'kalaunnatikala@gmail.com', NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `aadhar_details`
--
ALTER TABLE `aadhar_details`
ADD PRIMARY KEY (`aadhar_id`),
ADD UNIQUE KEY `mobile` (`mobile_number`);
--
-- Indexes for table `jobalert`
--
ALTER TABLE `jobalert`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `policy`
--
ALTER TABLE `policy`
ADD PRIMARY KEY (`policy_id`);
--
-- Indexes for table `register`
--
ALTER TABLE `register`
ADD PRIMARY KEY (`aadhar_id`),
ADD UNIQUE KEY `aadhar_id` (`aadhar_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `jobalert`
--
ALTER TABLE `jobalert`
MODIFY `id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
DROP DATABASE IF EXISTS user_center;
CREATE DATABASE user_center;
USE user_center;
CREATE TABLE `users`
(
`id` int (11) NOT NULL AUTO_INCREMENT,
`account` varchar (16) NOT NULL COMMENT '用户帐号,16位字符',
`password` char (64) NOT NULL COMMENT '密码',
`telphone` varchar (32) DEFAULT '' COMMENT '手机号',
PRIMARY KEY (`id`)
)ENGINE= InnoDB DEFAULT CHARSET= utf8;
|
----------------------------------------------------------------------------------------------
-- return database properties.
--
--
----------------------------------------------------------------------------------------------
select serverproperty('Edition')
select
name
,is_read_only
,is_auto_create_stats_on
,auto_update_stats = is_auto_update_stats_on | is_auto_update_stats_async_on
,compatibility_level
,state
,state_desc
,auto_close = databasepropertyex(name,'IsAutoClose')
,is_cursor_close_on_commit_on
,is_local_cursor_default
,is_date_correlation_on
,is_parameterization_forced
,is_ansi_null_default_on
,is_ansi_nulls_on
,is_ansi_padding_on
,is_ansi_warnings_on
,is_arithabort_on
,is_concat_null_yields_null_on
,is_quoted_identifier_on
,is_numeric_roundabort_on
,is_recursive_triggers_on
,page_verify_option_desc
,collation_name
,is_trustworthy_on
,recovery_model
,containment
from
sys.databases
order by
case when name = 'model' then -1 else 0 end
|
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Dec 05, 2019 at 05:17 AM
-- Server version: 5.7.26
-- PHP Version: 7.2.18
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: `page_management`
--
-- --------------------------------------------------------
--
-- Table structure for table `pages`
--
DROP TABLE IF EXISTS `pages`;
CREATE TABLE IF NOT EXISTS `pages` (
`pageid` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`pagetitle` varchar(255) NOT NULL,
`pagebody` mediumtext NOT NULL,
`pagedate` date NOT NULL,
`pageauthor` varchar(255) NOT NULL,
`pagestatus` varchar(255) NOT NULL,
PRIMARY KEY (`pageid`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pages`
--
INSERT INTO `pages` (`pageid`, `pagetitle`, `pagebody`, `pagedate`, `pageauthor`, `pagestatus`) VALUES
(10, 'Page 10', 'Ramdon things', '2019-11-20', 'Williams', 'Unpublish'),
(7, 'Page 6', 'Random stuffs', '2019-12-16', 'Peter', 'Published'),
(9, 'Page 9', 'It is a good page', '2019-12-20', 'Robert', 'Published'),
(11, 'Page 11', 'This is dummy page', '2019-12-04', 'Smith', 'Published'),
(13, 'Page 12', 'This is all about page 12.', '2019-12-04', 'Williams', 'Published');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE TABLE IF NOT EXISTS stories (
sid INT PRIMARY KEY AUTO_INCREMENT,
title TEXT,
slug TEXT NOT NULL,
body TEXT,
cdate DATETIME NOT NULL
);
CREATE TABLE IF NOT EXISTS users (
uid INT PRIMARY KEY AUTO_INCREMENT,
name TEXT NOT NULL,
password TEXT
);
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 28 Jun 2019 pada 20.16
-- Versi server: 10.1.37-MariaDB
-- Versi PHP: 7.2.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `penjualan_baju`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `tbl_kategori`
--
CREATE TABLE `tbl_kategori` (
`kd_kategori` char(8) NOT NULL,
`nm_kategori` varchar(12) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tbl_kategori`
--
INSERT INTO `tbl_kategori` (`kd_kategori`, `nm_kategori`) VALUES
('001', 'BAJU PRIA'),
('002', 'BAJU WANITA'),
('003', 'CELANA PRIA');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tbl_login`
--
CREATE TABLE `tbl_login` (
`username` varchar(15) NOT NULL,
`password` varchar(8) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tbl_produk`
--
CREATE TABLE `tbl_produk` (
`kd_produk` char(8) NOT NULL,
`kd_kategori` char(8) NOT NULL,
`nm_produk` varchar(255) NOT NULL,
`hrg_beli` int(11) NOT NULL,
`hrg_jual` int(11) NOT NULL,
`stok` int(100) NOT NULL,
`satuan` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tbl_produk`
--
INSERT INTO `tbl_produk` (`kd_produk`, `kd_kategori`, `nm_produk`, `hrg_beli`, `hrg_jual`, `stok`, `satuan`) VALUES
('1111', '001', 'Koko Arab', 70000, 80000, 20, 'Kodi'),
('2222', '002', 'Mukena Arab', 100000, 120000, 20, 'Kodi');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tbl_transaksi`
--
CREATE TABLE `tbl_transaksi` (
`no_jual` char(255) NOT NULL,
`kd_produk` char(8) NOT NULL,
`nm__produk` varchar(255) NOT NULL,
`hrg_jual` int(11) NOT NULL,
`qty` int(11) NOT NULL,
`total` int(11) NOT NULL,
`bayar` int(11) NOT NULL,
`kembali` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `tbl_kategori`
--
ALTER TABLE `tbl_kategori`
ADD PRIMARY KEY (`kd_kategori`);
--
-- Indeks untuk tabel `tbl_produk`
--
ALTER TABLE `tbl_produk`
ADD PRIMARY KEY (`kd_produk`);
--
-- Indeks untuk tabel `tbl_transaksi`
--
ALTER TABLE `tbl_transaksi`
ADD PRIMARY KEY (`no_jual`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 25, 2018 at 07:37 AM
-- Server version: 10.1.35-MariaDB
-- PHP Version: 7.2.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `lara_dash`
--
-- --------------------------------------------------------
--
-- Table structure for table `action_items`
--
CREATE TABLE `action_items` (
`id` int(10) NOT NULL,
`objectives_id` int(10) NOT NULL,
`owners_id` int(10) NOT NULL,
`status_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
`due_date` date NOT NULL,
`revised_date` date NOT NULL,
`name` varchar(100) CHARACTER SET latin1 NOT NULL,
`description` text CHARACTER SET latin1 NOT NULL,
`comments` text CHARACTER SET latin1 NOT NULL,
`active` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `action_items`
--
INSERT INTO `action_items` (`id`, `objectives_id`, `owners_id`, `status_id`, `due_date`, `revised_date`, `name`, `description`, `comments`, `active`) VALUES
(1, 1, 1, 'Open', '2018-10-20', '2018-10-20', 'Secure Contact Minister/Sec/RHD Chief ENG ', '', '', 1),
(2, 1, 1, 'Open', '2018-10-21', '2018-10-21', 'Obtain Appointment with Secured contact', '', '', 1),
(3, 1, 1, 'Open', '2018-10-20', '2018-10-20', 'Secure ADB contacts in Manila & Dhaka', '', '', 1),
(4, 1, 1, 'Open', '2018-10-23', '2018-10-23', 'Obtain Appointment with Secured ADB contact', '', '', 1),
(5, 1, 1, 'Open', '2018-11-07', '2018-11-07', 'Visit to Bangladesh', '', '', 1),
(6, 2, 1, 'Open', '2018-11-15', '2018-11-15', 'Initiate Project Strategy ', '', '', 1),
(7, 3, 1, 'Open', '2018-11-16', '2018-11-16', 'Initiate Project Strategy ', '', '', 1),
(8, 4, 1, 'Open', '2018-11-17', '2018-11-17', 'Initiate Project Strategy ', '', '', 1),
(9, 5, 1, 'Open', '2018-11-18', '2018-11-18', 'Initiate Project Strategy ', '', '', 1),
(10, 6, 1, 'Open', '2018-11-19', '2018-11-19', 'Initiate Project Strategy ', '', '', 1),
(11, 7, 2, 'In-Progress', '2018-10-27', '2018-10-27', 'Draft a Country Strategy ', '', '', 1),
(12, 7, 2, 'In-Progress', '2018-10-12', '2018-10-12', 'TOR Draft for project monitoring dashboard ', '', '', 1),
(13, 7, 2, 'Completed', '2018-10-20', '2018-10-20', 'List the Potential ADB WB Projects ', '', '', 1),
(14, 7, 2, 'Open', '2018-11-15', '2018-11-15', 'Country visit planning', '', '', 1),
(15, 8, 1, 'Open', '2018-11-12', '2018-11-12', 'Identify potential projects from ADB and WB', '', '', 1),
(16, 8, 1, 'Open', '2018-11-24', '2018-11-24', 'Stakeholder list and the contact information ', '', '', 1),
(17, 8, 1, 'Open', '2018-11-30', '2018-11-30', 'Plan a visit', '', '', 1),
(18, 9, 1, 'Open', '2018-10-20', '2018-10-20', 'Draft a Country Strategy ', '', '', 1),
(19, 9, 1, 'Open', '2018-10-30', '2018-10-30', 'Collect the prerequisites to register roughton office in india', '', '', 1),
(20, 10, 1, 'Open', '2018-10-15', '2018-10-15', 'List the Potential ADB Projects ', '', '', 1),
(21, 11, 2, 'Open', '2018-11-30', '2018-11-30', 'List the Potential ADB WB Projects ', '', '', 1),
(22, 11, 2, 'Open', '2018-12-05', '2018-12-05', 'Workout partnerships with local consultants', '', '', 1);
-- --------------------------------------------------------
--
-- Table structure for table `cms_apicustom`
--
CREATE TABLE `cms_apicustom` (
`id` int(10) UNSIGNED NOT NULL,
`permalink` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tabel` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`aksi` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`kolom` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`orderby` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`sub_query_1` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`sql_where` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`nama` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`keterangan` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parameter` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`method_type` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parameters` longtext COLLATE utf8mb4_unicode_ci,
`responses` longtext COLLATE utf8mb4_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `cms_apikey`
--
CREATE TABLE `cms_apikey` (
`id` int(10) UNSIGNED NOT NULL,
`screetkey` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`hit` int(11) DEFAULT NULL,
`status` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `cms_dashboard`
--
CREATE TABLE `cms_dashboard` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`id_cms_privileges` int(11) DEFAULT NULL,
`content` longtext COLLATE utf8mb4_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `cms_email_queues`
--
CREATE TABLE `cms_email_queues` (
`id` int(10) UNSIGNED NOT NULL,
`send_at` datetime DEFAULT NULL,
`email_recipient` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email_from_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email_from_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email_cc_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email_subject` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email_content` text COLLATE utf8mb4_unicode_ci,
`email_attachments` text COLLATE utf8mb4_unicode_ci,
`is_sent` tinyint(1) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `cms_email_templates`
--
CREATE TABLE `cms_email_templates` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`slug` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`subject` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`content` longtext COLLATE utf8mb4_unicode_ci,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`from_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`from_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`cc_email` varchar(255) 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 `cms_email_templates`
--
INSERT INTO `cms_email_templates` (`id`, `name`, `slug`, `subject`, `content`, `description`, `from_name`, `from_email`, `cc_email`, `created_at`, `updated_at`) VALUES
(1, 'Email Template Forgot Password Backend', 'forgot_password_backend', NULL, '<p>Hi,</p><p>Someone requested forgot password, here is your new password : </p><p>[password]</p><p><br></p><p>--</p><p>Regards,</p><p>Admin</p>', '[password]', 'System', 'system@crudbooster.com', NULL, '2018-10-21 22:42:16', NULL),
(2, 'Email Template Forgot Password Backend', 'forgot_password_backend', NULL, '<p>Hi,</p><p>Someone requested forgot password, here is your new password : </p><p>[password]</p><p><br></p><p>--</p><p>Regards,</p><p>Admin</p>', '[password]', 'System', 'system@crudbooster.com', NULL, '2018-10-23 01:08:19', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `cms_logs`
--
CREATE TABLE `cms_logs` (
`id` int(10) UNSIGNED NOT NULL,
`ipaddress` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`useragent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`details` text COLLATE utf8mb4_unicode_ci,
`id_cms_users` int(11) 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 `cms_logs`
--
INSERT INTO `cms_logs` (`id`, `ipaddress`, `useragent`, `url`, `description`, `details`, `id_cms_users`, `created_at`, `updated_at`) VALUES
(1, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-21 22:43:54', NULL),
(2, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/menu_management/edit-save/2', 'Update data Get Objectives at Menu Management', '<table class=\"table table-striped\"><thead><tr><th>Key</th><th>Old Value</th><th>New Value</th></thead><tbody><tr><td>name</td><td>Types</td><td>Get Objectives</td></tr><tr><td>color</td><td></td><td>normal</td></tr><tr><td>sorting</td><td>2</td><td></td></tr></tbody></table>', 1, '2018-10-21 22:58:51', NULL),
(3, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-21 23:54:32', NULL),
(4, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-22 00:02:09', NULL),
(5, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-22 06:19:39', NULL),
(6, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-22 21:53:06', NULL),
(7, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-22 22:21:12', NULL),
(8, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-23 01:09:53', NULL),
(9, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/module_generator/delete/13', 'Delete data Types at Module Generator', '', 1, '2018-10-23 02:56:04', NULL),
(10, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/module_generator/delete/14', 'Delete data Test1 at Module Generator', '', 1, '2018-10-23 02:56:11', NULL),
(11, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/module_generator/delete/16', 'Delete data Owners at Module Generator', '', 1, '2018-10-23 02:56:18', NULL),
(12, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/module_generator/delete/15', 'Delete data Action_Items_view at Module Generator', '', 1, '2018-10-23 02:56:25', NULL),
(13, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/module_generator/delete/12', 'Delete data Objectives at Module Generator', '', 1, '2018-10-23 02:56:38', NULL),
(14, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-23 02:58:30', NULL),
(15, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-23 03:03:11', NULL),
(16, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/module_generator/delete/17', 'Delete data Countries at Module Generator', '', 1, '2018-10-23 03:03:34', NULL),
(17, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-23 03:56:26', NULL),
(18, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/menu_management/edit-save/8', 'Update data Countries at Menu Management', '<table class=\"table table-striped\"><thead><tr><th>Key</th><th>Old Value</th><th>New Value</th></thead><tbody><tr><td>name</td><td>Countries19</td><td>Countries</td></tr><tr><td>color</td><td></td><td>normal</td></tr><tr><td>sorting</td><td>2</td><td></td></tr></tbody></table>', 1, '2018-10-23 04:01:38', NULL),
(19, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/menu_management/add-save', 'Add New Data laraveltable at Menu Management', '', 1, '2018-10-23 04:04:02', NULL),
(20, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/menu_management/edit-save/9', 'Update data laraveltable at Menu Management', '<table class=\"table table-striped\"><thead><tr><th>Key</th><th>Old Value</th><th>New Value</th></thead><tbody><tr><td>type</td><td>Route</td><td>Controller & Method</td></tr><tr><td>sorting</td><td></td><td></td></tr></tbody></table>', 1, '2018-10-23 04:07:57', NULL),
(21, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/menu_management/add-save', 'Add New Data Chartgeo at Menu Management', '', 1, '2018-10-23 06:11:05', NULL),
(22, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/menu_management/edit-save/10', 'Update data Chartgeo at Menu Management', '<table class=\"table table-striped\"><thead><tr><th>Key</th><th>Old Value</th><th>New Value</th></thead><tbody><tr><td>parent_id</td><td>0</td><td></td></tr><tr><td>is_dashboard</td><td>0</td><td>1</td></tr><tr><td>sorting</td><td></td><td></td></tr></tbody></table>', 1, '2018-10-23 06:13:52', NULL),
(23, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/menu_management/edit-save/10', 'Update data Chartgeo at Menu Management', '<table class=\"table table-striped\"><thead><tr><th>Key</th><th>Old Value</th><th>New Value</th></thead><tbody><tr><td>sorting</td><td></td><td></td></tr></tbody></table>', 1, '2018-10-23 06:17:29', NULL),
(24, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-23 12:58:43', NULL),
(25, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/football_fans/add-save', 'Add New Data at FootBallFans', '', 1, '2018-10-23 13:06:42', NULL),
(26, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-23 21:42:59', NULL),
(27, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/logout', ' logout', '', NULL, '2018-10-24 23:12:57', NULL),
(28, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-24 23:15:21', NULL),
(29, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'http://localhost:8000/admin/login', 'admin@crudbooster.com login with IP Address 127.0.0.1', '', 1, '2018-10-24 23:26:03', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `cms_menus`
--
CREATE TABLE `cms_menus` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'url',
`path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`color` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parent_id` int(11) DEFAULT NULL,
`is_active` tinyint(1) NOT NULL DEFAULT '1',
`is_dashboard` tinyint(1) NOT NULL DEFAULT '0',
`id_cms_privileges` int(11) DEFAULT NULL,
`sorting` int(11) 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 `cms_menus`
--
INSERT INTO `cms_menus` (`id`, `name`, `type`, `path`, `color`, `icon`, `parent_id`, `is_active`, `is_dashboard`, `id_cms_privileges`, `sorting`, `created_at`, `updated_at`) VALUES
(7, 'Countries18', 'Route', 'AdminCountries18ControllerGetIndex', NULL, 'fa fa-glass', 0, 1, 0, 1, 1, '2018-10-23 03:04:01', NULL),
(8, 'Countries', 'Route', 'AdminCountries19ControllerGetIndex', 'normal', 'fa fa-glass', 0, 1, 0, 1, 2, '2018-10-23 03:59:36', '2018-10-23 04:01:38'),
(9, 'laraveltable', 'Controller & Method', 'TablesController@index', 'normal', 'fa fa-search', 0, 1, 0, 1, NULL, '2018-10-23 04:04:02', '2018-10-23 04:07:57'),
(10, 'Chartgeo', 'Controller & Method', 'FootballFansController@geoChart', 'red', 'fa fa-pencil', 0, 1, 0, 1, NULL, '2018-10-23 06:11:05', '2018-10-23 06:17:28'),
(11, 'FootBallFans', 'Route', 'AdminFootballFansControllerGetIndex', NULL, 'fa fa-glass', 0, 1, 0, 1, 3, '2018-10-23 13:04:14', NULL),
(12, 'Objectives', 'Route', 'AdminObjectives21ControllerGetIndex', NULL, 'fa fa-glass', 0, 1, 0, 1, 4, '2018-10-24 23:52:56', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `cms_menus_privileges`
--
CREATE TABLE `cms_menus_privileges` (
`id` int(10) UNSIGNED NOT NULL,
`id_cms_menus` int(11) DEFAULT NULL,
`id_cms_privileges` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `cms_menus_privileges`
--
INSERT INTO `cms_menus_privileges` (`id`, `id_cms_menus`, `id_cms_privileges`) VALUES
(1, 1, 1),
(3, 2, 1),
(4, 3, 1),
(5, 4, 1),
(6, 5, 1),
(7, 6, 1),
(8, 7, 1),
(10, 8, 1),
(12, 9, 1),
(15, 10, 1),
(16, 11, 1),
(17, 12, 1);
-- --------------------------------------------------------
--
-- Table structure for table `cms_moduls`
--
CREATE TABLE `cms_moduls` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`table_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`controller` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`is_protected` tinyint(1) NOT NULL DEFAULT '0',
`is_active` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `cms_moduls`
--
INSERT INTO `cms_moduls` (`id`, `name`, `icon`, `path`, `table_name`, `controller`, `is_protected`, `is_active`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Notifications', 'fa fa-cog', 'notifications', 'cms_notifications', 'NotificationsController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(2, 'Privileges', 'fa fa-cog', 'privileges', 'cms_privileges', 'PrivilegesController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(3, 'Privileges Roles', 'fa fa-cog', 'privileges_roles', 'cms_privileges_roles', 'PrivilegesRolesController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(4, 'Users Management', 'fa fa-users', 'users', 'cms_users', 'AdminCmsUsersController', 0, 1, '2018-10-21 22:42:14', NULL, NULL),
(5, 'Settings', 'fa fa-cog', 'settings', 'cms_settings', 'SettingsController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(6, 'Module Generator', 'fa fa-database', 'module_generator', 'cms_moduls', 'ModulsController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(7, 'Menu Management', 'fa fa-bars', 'menu_management', 'cms_menus', 'MenusController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(8, 'Email Templates', 'fa fa-envelope-o', 'email_templates', 'cms_email_templates', 'EmailTemplatesController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(9, 'Statistic Builder', 'fa fa-dashboard', 'statistic_builder', 'cms_statistics', 'StatisticBuilderController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(10, 'API Generator', 'fa fa-cloud-download', 'api_generator', '', 'ApiCustomController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(11, 'Log User Access', 'fa fa-flag-o', 'logs', 'cms_logs', 'LogsController', 1, 1, '2018-10-21 22:42:14', NULL, NULL),
(12, 'Objectives', 'fa fa-glass', 'objectives', 'objectives', 'AdminObjectivesController', 0, 0, '2018-10-21 22:44:24', NULL, '2018-10-23 02:56:38'),
(13, 'Types', 'fa fa-glass', 'types', 'types', 'AdminTypesController', 0, 0, '2018-10-21 22:47:20', NULL, '2018-10-23 02:56:04'),
(14, 'Test1', 'fa fa-glass', 'test1', 'countries', 'AdminTest1Controller', 0, 0, '2018-10-22 23:09:33', NULL, '2018-10-23 02:56:11'),
(15, 'Action_Items_view', 'fa fa-glass', 'action_items', 'action_items', 'AdminActionItemsController', 0, 0, '2018-10-23 00:26:16', NULL, '2018-10-23 02:56:25'),
(16, 'Owners', 'fa fa-glass', 'owners', 'owners', 'AdminOwnersController', 0, 0, '2018-10-23 01:11:26', NULL, '2018-10-23 02:56:18'),
(17, 'Countries', 'fa fa-glass', 'countries', 'countries', 'AdminCountriesController', 0, 0, '2018-10-23 02:58:58', NULL, '2018-10-23 03:03:34'),
(18, 'Countries18', 'fa fa-glass', 'countries18', 'countries', 'AdminCountries18Controller', 0, 0, '2018-10-23 03:04:01', NULL, NULL),
(19, 'Countries19', 'fa fa-glass', 'countries19', 'countries', 'AdminCountries19Controller', 0, 0, '2018-10-23 03:59:36', NULL, NULL),
(20, 'FootBallFans', 'fa fa-glass', 'football_fans', 'football_fans', 'AdminFootballFansController', 0, 0, '2018-10-23 13:04:13', NULL, NULL),
(21, 'Objectives', 'fa fa-glass', 'objectives21', 'objectives', 'AdminObjectives21Controller', 0, 0, '2018-10-24 23:52:55', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `cms_notifications`
--
CREATE TABLE `cms_notifications` (
`id` int(10) UNSIGNED NOT NULL,
`id_cms_users` int(11) DEFAULT NULL,
`content` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`is_read` tinyint(1) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `cms_privileges`
--
CREATE TABLE `cms_privileges` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`is_superadmin` tinyint(1) DEFAULT NULL,
`theme_color` varchar(255) 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 `cms_privileges`
--
INSERT INTO `cms_privileges` (`id`, `name`, `is_superadmin`, `theme_color`, `created_at`, `updated_at`) VALUES
(1, 'Super Administrator', 1, 'skin-red', '2018-10-21 22:42:14', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `cms_privileges_roles`
--
CREATE TABLE `cms_privileges_roles` (
`id` int(10) UNSIGNED NOT NULL,
`is_visible` tinyint(1) DEFAULT NULL,
`is_create` tinyint(1) DEFAULT NULL,
`is_read` tinyint(1) DEFAULT NULL,
`is_edit` tinyint(1) DEFAULT NULL,
`is_delete` tinyint(1) DEFAULT NULL,
`id_cms_privileges` int(11) DEFAULT NULL,
`id_cms_moduls` int(11) 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 `cms_privileges_roles`
--
INSERT INTO `cms_privileges_roles` (`id`, `is_visible`, `is_create`, `is_read`, `is_edit`, `is_delete`, `id_cms_privileges`, `id_cms_moduls`, `created_at`, `updated_at`) VALUES
(1, 1, 0, 0, 0, 0, 1, 1, '2018-10-21 22:42:14', NULL),
(2, 1, 1, 1, 1, 1, 1, 2, '2018-10-21 22:42:14', NULL),
(3, 0, 1, 1, 1, 1, 1, 3, '2018-10-21 22:42:14', NULL),
(4, 1, 1, 1, 1, 1, 1, 4, '2018-10-21 22:42:14', NULL),
(5, 1, 1, 1, 1, 1, 1, 5, '2018-10-21 22:42:14', NULL),
(6, 1, 1, 1, 1, 1, 1, 6, '2018-10-21 22:42:14', NULL),
(7, 1, 1, 1, 1, 1, 1, 7, '2018-10-21 22:42:15', NULL),
(8, 1, 1, 1, 1, 1, 1, 8, '2018-10-21 22:42:15', NULL),
(9, 1, 1, 1, 1, 1, 1, 9, '2018-10-21 22:42:15', NULL),
(10, 1, 1, 1, 1, 1, 1, 10, '2018-10-21 22:42:15', NULL),
(11, 1, 0, 1, 0, 1, 1, 11, '2018-10-21 22:42:15', NULL),
(12, 1, 1, 1, 1, 1, 1, 12, NULL, NULL),
(13, 1, 1, 1, 1, 1, 1, 13, NULL, NULL),
(14, 1, 1, 1, 1, 1, 1, 14, NULL, NULL),
(15, 1, 1, 1, 1, 1, 1, 15, NULL, NULL),
(16, 1, 1, 1, 1, 1, 1, 16, NULL, NULL),
(17, 1, 1, 1, 1, 1, 1, 17, NULL, NULL),
(18, 1, 1, 1, 1, 1, 1, 18, NULL, NULL),
(19, 1, 1, 1, 1, 1, 1, 19, NULL, NULL),
(20, 1, 1, 1, 1, 1, 1, 20, NULL, NULL),
(21, 1, 1, 1, 1, 1, 1, 21, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `cms_settings`
--
CREATE TABLE `cms_settings` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`content` text COLLATE utf8mb4_unicode_ci,
`content_input_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`dataenum` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`helper` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`group_setting` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`label` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `cms_settings`
--
INSERT INTO `cms_settings` (`id`, `name`, `content`, `content_input_type`, `dataenum`, `helper`, `created_at`, `updated_at`, `group_setting`, `label`) VALUES
(1, 'login_background_color', NULL, 'text', NULL, 'Input hexacode', '2018-10-21 22:42:15', NULL, 'Login Register Style', 'Login Background Color'),
(2, 'login_font_color', NULL, 'text', NULL, 'Input hexacode', '2018-10-21 22:42:15', NULL, 'Login Register Style', 'Login Font Color'),
(3, 'login_background_image', NULL, 'upload_image', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Login Register Style', 'Login Background Image'),
(4, 'email_sender', 'support@crudbooster.com', 'text', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Email Setting', 'Email Sender'),
(5, 'smtp_driver', 'mail', 'select', 'smtp,mail,sendmail', NULL, '2018-10-21 22:42:15', NULL, 'Email Setting', 'Mail Driver'),
(6, 'smtp_host', '', 'text', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Email Setting', 'SMTP Host'),
(7, 'smtp_port', '25', 'text', NULL, 'default 25', '2018-10-21 22:42:15', NULL, 'Email Setting', 'SMTP Port'),
(8, 'smtp_username', '', 'text', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Email Setting', 'SMTP Username'),
(9, 'smtp_password', '', 'text', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Email Setting', 'SMTP Password'),
(10, 'appname', 'MGC-ICT', 'text', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Application Setting', 'Application Name'),
(11, 'default_paper_size', 'Legal', 'text', NULL, 'Paper size, ex : A4, Legal, etc', '2018-10-21 22:42:15', NULL, 'Application Setting', 'Default Paper Print Size'),
(12, 'logo', NULL, 'upload_image', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Application Setting', 'Logo'),
(13, 'favicon', NULL, 'upload_image', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Application Setting', 'Favicon'),
(14, 'api_debug_mode', 'true', 'select', 'true,false', NULL, '2018-10-21 22:42:15', NULL, 'Application Setting', 'API Debug Mode'),
(15, 'google_api_key', NULL, 'text', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Application Setting', 'Google API Key'),
(16, 'google_fcm_key', NULL, 'text', NULL, NULL, '2018-10-21 22:42:15', NULL, 'Application Setting', 'Google FCM Key');
-- --------------------------------------------------------
--
-- Table structure for table `cms_statistics`
--
CREATE TABLE `cms_statistics` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`slug` varchar(255) 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;
-- --------------------------------------------------------
--
-- Table structure for table `cms_statistic_components`
--
CREATE TABLE `cms_statistic_components` (
`id` int(10) UNSIGNED NOT NULL,
`id_cms_statistics` int(11) DEFAULT NULL,
`componentID` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`component_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`area_name` varchar(55) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`sorting` int(11) DEFAULT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`config` longtext COLLATE utf8mb4_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `cms_users`
--
CREATE TABLE `cms_users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`photo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`id_cms_privileges` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`status` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `cms_users`
--
INSERT INTO `cms_users` (`id`, `name`, `photo`, `email`, `password`, `id_cms_privileges`, `created_at`, `updated_at`, `status`) VALUES
(1, 'Super Admin', NULL, 'admin@crudbooster.com', '$2y$10$QUqChzi9NfferKWy4FH3QenJ7fwsRYKjd7Fr02fxnVZU1osgAQ5.a', 1, '2018-10-21 22:42:14', NULL, 'Active');
-- --------------------------------------------------------
--
-- Table structure for table `countries`
--
CREATE TABLE `countries` (
`id` int(10) NOT NULL,
`name` varchar(10) CHARACTER SET latin1 NOT NULL,
`active` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `countries`
--
INSERT INTO `countries` (`id`, `name`, `active`) VALUES
(1, 'Bangladesh', 1),
(2, 'Nepal', 1),
(3, 'Myanmar', 1),
(4, 'Pakistan', 1),
(5, 'India', 1);
-- --------------------------------------------------------
--
-- Table structure for table `football_fans`
--
CREATE TABLE `football_fans` (
`id` int(10) UNSIGNED NOT NULL,
`footballteam` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`fan` int(11) 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 for table `football_fans`
--
INSERT INTO `football_fans` (`id`, `footballteam`, `fan`, `created_at`, `updated_at`) VALUES
(1, 'Spain', 20000, '2018-10-14 18:30:00', '2018-10-17 18:30:00'),
(2, 'srilanka', 30000, '2018-10-11 18:30:00', '2018-10-17 18:30:00'),
(3, 'india', 40000, '2018-10-14 18:30:00', '2018-10-17 18:30:00'),
(4, 'uk', 50000, '2018-10-11 18:30:00', '2018-10-17 18:30:00'),
(5, 'iceland', 100000, '2018-10-08 18:30:00', '2018-10-17 18:30:00'),
(6, 'Australia', 90000, '2018-10-15 18:30:00', '2018-10-17 18:30:00'),
(7, 'China', 200000, '2018-10-23 13:06:41', NULL);
-- --------------------------------------------------------
--
-- Stand-in structure for view `getobjectives`
-- (See below for the actual view)
--
CREATE TABLE `getobjectives` (
`id` int(10)
,`objective` varchar(100)
,`action_item` varchar(100)
,`country` varchar(10)
);
-- --------------------------------------------------------
--
-- 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, '2016_08_07_145904_add_table_cms_apicustom', 1),
(2, '2016_08_07_150834_add_table_cms_dashboard', 1),
(3, '2016_08_07_151210_add_table_cms_logs', 1),
(4, '2016_08_07_151211_add_details_cms_logs', 1),
(5, '2016_08_07_152014_add_table_cms_privileges', 1),
(6, '2016_08_07_152214_add_table_cms_privileges_roles', 1),
(7, '2016_08_07_152320_add_table_cms_settings', 1),
(8, '2016_08_07_152421_add_table_cms_users', 1),
(9, '2016_08_07_154624_add_table_cms_menus_privileges', 1),
(10, '2016_08_07_154624_add_table_cms_moduls', 1),
(11, '2016_08_17_225409_add_status_cms_users', 1),
(12, '2016_08_20_125418_add_table_cms_notifications', 1),
(13, '2016_09_04_033706_add_table_cms_email_queues', 1),
(14, '2016_09_16_035347_add_group_setting', 1),
(15, '2016_09_16_045425_add_label_setting', 1),
(16, '2016_09_17_104728_create_nullable_cms_apicustom', 1),
(17, '2016_10_01_141740_add_method_type_apicustom', 1),
(18, '2016_10_01_141846_add_parameters_apicustom', 1),
(19, '2016_10_01_141934_add_responses_apicustom', 1),
(20, '2016_10_01_144826_add_table_apikey', 1),
(21, '2016_11_14_141657_create_cms_menus', 1),
(22, '2016_11_15_132350_create_cms_email_templates', 1),
(23, '2016_11_15_190410_create_cms_statistics', 1),
(24, '2016_11_17_102740_create_cms_statistic_components', 1),
(25, '2017_06_06_164501_add_deleted_at_cms_moduls', 1),
(26, '2018_10_22_081826_create_footballfans_table', 2);
-- --------------------------------------------------------
--
-- Table structure for table `objectives`
--
CREATE TABLE `objectives` (
`id` int(10) NOT NULL,
`countries_id` int(10) NOT NULL,
`owners_id` int(10) NOT NULL,
`name` varchar(100) CHARACTER SET latin1 NOT NULL,
`description` text CHARACTER SET latin1 NOT NULL,
`target_timeline` varchar(100) CHARACTER SET latin1 NOT NULL,
`comments` text CHARACTER SET latin1 NOT NULL,
`active` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `objectives`
--
INSERT INTO `objectives` (`id`, `countries_id`, `owners_id`, `name`, `description`, `target_timeline`, `comments`, `active`) VALUES
(1, 1, 1, 'Secure Five Projects in Bangladesh', '', '', '', 1),
(2, 1, 1, 'DHAKA – Sylhet $11.5M RHD', '', '', '', 1),
(3, 1, 1, 'SASEC 3 – $10M RHD', '', '', '', 1),
(4, 1, 1, 'Chittagong – cox’s bazar $14Mn RHD', '', '', '', 1),
(5, 1, 1, 'Rural Bridges – CGED ', '', '', '', 1),
(6, 1, 1, 'Rural Connectivity Improvement Project – CGED ', '', '', '', 1),
(7, 2, 2, 'Secure a $6Mn Worth of Business', '', '', '', 1),
(8, 4, 1, 'Pakistan Opportunities', '', '', '', 1),
(9, 5, 1, 'Go-to Market strategy for India', '', '', '', 1),
(10, 5, 1, 'Secure $10Mn Projects in india', '', '', '', 1),
(11, 3, 2, 'Go to market strategy for Myanmar ', '', '', '', 1);
-- --------------------------------------------------------
--
-- Table structure for table `owners`
--
CREATE TABLE `owners` (
`id` int(10) NOT NULL,
`name` varchar(10) CHARACTER SET latin1 NOT NULL,
`short_code` varchar(10) CHARACTER SET latin1 NOT NULL,
`active` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `owners`
--
INSERT INTO `owners` (`id`, `name`, `short_code`, `active`) VALUES
(1, 'RW', 'RW', 1),
(2, 'NS', 'NS', 1);
-- --------------------------------------------------------
--
-- Table structure for table `status`
--
CREATE TABLE `status` (
`id` int(10) NOT NULL,
`name` varchar(10) CHARACTER SET latin1 NOT NULL,
`active` int(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `status`
--
INSERT INTO `status` (`id`, `name`, `active`) VALUES
(1, 'status 1', 1),
(2, 'test 2', 1),
(3, 'test 3', 0),
(4, 'test 4', 0),
(5, 'status 2', 1);
-- --------------------------------------------------------
--
-- Table structure for table `test_table`
--
CREATE TABLE `test_table` (
`email` varchar(10) NOT NULL,
`name` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `types`
--
CREATE TABLE `types` (
`id` int(10) NOT NULL,
`name` varchar(10) CHARACTER SET latin1 NOT NULL,
`active` int(2) NOT NULL,
`short_code` varchar(10) CHARACTER SET latin1 NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Structure for view `getobjectives`
--
DROP TABLE IF EXISTS `getobjectives`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `getobjectives` AS select `a`.`id` AS `id`,`o`.`name` AS `objective`,`a`.`name` AS `action_item`,`c`.`name` AS `country` from ((`objectives` `o` join `action_items` `a`) join `countries` `c`) where ((`o`.`id` = `a`.`objectives_id`) and (`o`.`countries_id` = `c`.`id`)) ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `action_items`
--
ALTER TABLE `action_items`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_apicustom`
--
ALTER TABLE `cms_apicustom`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_apikey`
--
ALTER TABLE `cms_apikey`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_dashboard`
--
ALTER TABLE `cms_dashboard`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_email_queues`
--
ALTER TABLE `cms_email_queues`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_email_templates`
--
ALTER TABLE `cms_email_templates`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_logs`
--
ALTER TABLE `cms_logs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_menus`
--
ALTER TABLE `cms_menus`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_menus_privileges`
--
ALTER TABLE `cms_menus_privileges`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_moduls`
--
ALTER TABLE `cms_moduls`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_notifications`
--
ALTER TABLE `cms_notifications`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_privileges`
--
ALTER TABLE `cms_privileges`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_privileges_roles`
--
ALTER TABLE `cms_privileges_roles`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_settings`
--
ALTER TABLE `cms_settings`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_statistics`
--
ALTER TABLE `cms_statistics`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_statistic_components`
--
ALTER TABLE `cms_statistic_components`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cms_users`
--
ALTER TABLE `cms_users`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `countries`
--
ALTER TABLE `countries`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `football_fans`
--
ALTER TABLE `football_fans`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `objectives`
--
ALTER TABLE `objectives`
ADD PRIMARY KEY (`id`),
ADD KEY `country` (`countries_id`),
ADD KEY `owner` (`owners_id`);
--
-- Indexes for table `owners`
--
ALTER TABLE `owners`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `status`
--
ALTER TABLE `status`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `action_items`
--
ALTER TABLE `action_items`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT for table `cms_apicustom`
--
ALTER TABLE `cms_apicustom`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cms_apikey`
--
ALTER TABLE `cms_apikey`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cms_dashboard`
--
ALTER TABLE `cms_dashboard`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cms_email_queues`
--
ALTER TABLE `cms_email_queues`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cms_email_templates`
--
ALTER TABLE `cms_email_templates`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `cms_logs`
--
ALTER TABLE `cms_logs`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
--
-- AUTO_INCREMENT for table `cms_menus`
--
ALTER TABLE `cms_menus`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `cms_menus_privileges`
--
ALTER TABLE `cms_menus_privileges`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT for table `cms_moduls`
--
ALTER TABLE `cms_moduls`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `cms_notifications`
--
ALTER TABLE `cms_notifications`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cms_privileges`
--
ALTER TABLE `cms_privileges`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `cms_privileges_roles`
--
ALTER TABLE `cms_privileges_roles`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `cms_settings`
--
ALTER TABLE `cms_settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `cms_statistics`
--
ALTER TABLE `cms_statistics`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cms_statistic_components`
--
ALTER TABLE `cms_statistic_components`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `cms_users`
--
ALTER TABLE `cms_users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `football_fans`
--
ALTER TABLE `football_fans`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT for table `objectives`
--
ALTER TABLE `objectives`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `owners`
--
ALTER TABLE `owners`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `status`
--
ALTER TABLE `status`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `objectives`
--
ALTER TABLE `objectives`
ADD CONSTRAINT `objectives_ibfk_1` FOREIGN KEY (`countries_id`) REFERENCES `countries` (`id`) ON UPDATE CASCADE,
ADD CONSTRAINT `objectives_ibfk_2` FOREIGN KEY (`owners_id`) REFERENCES `owners` (`id`) ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
USE Bank
IF NOT EXISTS(SELECT * FROM sysobjects where id = object_id(N'dbo.pr_GetActiveAccounts') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
EXEC ('CREATE PROCEDURE dbo.pr_GetActiveAccounts AS SET NOCOUNT ON;')
GO
ALTER PROCEDURE dbo.pr_GetActiveAccounts
AS
SELECT
ID
,Balance
,Currency
,AccountStatus
FROM tb_Accounts
WHERE AccountStatus = 1;
GO
|
CREATE TABLE wb_dispatch.dead_webhooks
(
id CHARACTER VARYING(64) NOT NULL,
webhook_id BIGINT NOT NULL,
source_id CHARACTER VARYING NOT NULL,
event_id BIGINT NOT NULL,
parent_event_id BIGINT NOT NULL,
created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
url CHARACTER VARYING NOT NULL,
content_type CHARACTER VARYING NOT NULL,
additional_headers CHARACTER VARYING NOT NULL,
request_body BYTEA NOT NULL,
retry_count BIGINT,
CONSTRAINT pk_dead_webhooks PRIMARY KEY (id)
);
|
#INNER JOIN = JOIN
SELECT *
FROM employees
INNER JOIN dept_manager
ON employees.emp_no = dept_manager.emp_no;
SELECT *
FROM employees
INNER JOIN dept_manager
ON employees.emp_no = dept_manager.emp_no
INNER JOIN departments
ON dept_manager.dept_no = departments.dept_no;
SELECT *
FROM employees emp
INNER JOIN dept_manager as dm
ON emp.emp_no = dm.emp_no
INNER JOIN departments as ds
ON dm.dept_no = ds.dept_no;
SELECT emp.emp_no, emp.first_name, emp.last_name, ds.dept_name
FROM employees emp
INNER JOIN dept_manager as dm
ON emp.emp_no = dm.emp_no
INNER JOIN departments as ds
ON dm.dept_no = ds.dept_no
ORDER BY emp.last_name;
SELECT emp.emp_no, emp.first_name, emp.last_name, ds.dept_name
FROM employees emp
JOIN dept_manager as dm
ON emp.emp_no = dm.emp_no
JOIN departments as ds
ON dm.dept_no = ds.dept_no
WHERE dm.to_date = '9999-01-01'
AND emp.gender = 'M'
ORDER BY emp.last_name;
#-----------
SELECT ds.dept_name, emp.first_name, emp.last_name, titles.title
FROM employees as emp
JOIN
dept_emp as de ON emp.emp_no = de.emp_no
JOIN
departments as ds ON de.dept_no = ds.dept_no
JOIN
titles ON titles.emp_no = emp.emp_no
WHERE titles.to_date = '9999-01-01'
AND de.to_date = '9999-01-01'
ORDER BY ds.dept_name, emp.last_name;
#NATURAL JOIN - when name of columns within JOIN are equal (ON isn't needed)
SELECT ds.dept_name, emp.first_name, emp.last_name, titles.title
FROM employees as emp
NATURAL JOIN
dept_emp as de
NATURAL JOIN
departments as ds
NATURAL JOIN
titles
WHERE titles.to_date = '9999-01-01'
AND de.to_date = '9999-01-01'
ORDER BY ds.dept_name, emp.last_name;
#Equi JOIN
SELECT ds.dept_name, emp.first_name, emp.last_name, titles.title
FROM employees as emp,
dept_emp as de,
departments as ds,
titles
WHERE titles.to_date = '9999-01-01'
AND de.to_date = '9999-01-01'
AND emp.emp_no = de.emp_no
AND de.dept_no = ds.dept_no
AND titles.emp_no = emp.emp_no
ORDER BY ds.dept_name, emp.last_name;
#UNION JOIN
SELECT emp.first_name, emp.last_name, titles.title as dep_n, 'DDDD' as emp_type
FROM employees as emp
JOIN
titles ON titles.emp_no = emp.emp_no
WHERE titles.to_date = '9999-01-01'
AND titles.title LIKE '%_Engineer'
UNION
SELECT emp.first_name, emp.last_name, dm.from_date as dep_n, 'AAAA' as emp_type
FROM employees emp
INNER JOIN dept_manager as dm
ON emp.emp_no = dm.emp_no
INNER JOIN departments as ds
ON dm.dept_no = ds.dept_no
ORDER BY emp_type;
SELECT CURRENT_USER(), VERSION(), USER();
#OUTER JOIN
EXPLAIN SELECT count(*)
from employees
where emp_no not in (select dept_manager.emp_no from dept_manager);
SELECT emp.first_name, emp.last_name, dm.dept_no
from employees as emp
LEFT OUTER JOIN dept_manager as dm
ON emp.emp_no = dm.emp_no;
SELECT emp.first_name, emp.last_name, dm.dept_no
from employees as emp
RIGHT OUTER JOIN dept_manager as dm
ON emp.emp_no = dm.emp_no;
#--------
select ts.emp_no
from titles as ts
where ts.to_date = '9999-01-01';
select count(*)
from employees as emp
where emp.emp_no not in (select ts.emp_no from titles as ts where ts.to_date = '9999-01-01');
SELECT emp.emp_no, emp.last_name, emp.first_name, ts.title, ts.to_date, ts.emp_no, ts.from_date
FROM employees as emp
#JOIN ON titles with ts.to_date = '9999-01-01'.suppose rest ts = null
LEFT OUTER JOIN titles as ts ON emp.emp_no = ts.emp_no and ts.to_date = '9999-01-01'
WHERE ts.emp_no is null;
SELECT emp.emp_no, emp.last_name, emp.first_name, ts.title, ts.to_date, ts.emp_no
FROM employees as emp
LEFT JOIN titles as ts on emp.emp_no = ts.emp_no and ts.to_date = '9999-01-01'
;
|
CREATE TABLE IF NOT EXISTS `image_comment` (
`iCommentID` INT NOT NULL AUTO_INCREMENT,
`iImageID` INT NOT NULL,
`iUserID` INT NOT NULL,
`cComment` TEXT,
PRIMARY KEY (`iCommentID`)
); |
--create database MokeTravels
create table Customer (
CustID varchar(10) NOT NULL,
CustName varchar(70) NOT NULL,
PRIMARY KEY (CustID)
);
create table Itinerary (
ItineraryNo varchar(10) NOT NULL,
Duration float NULL,
ItineraryDesc varchar(150) NULL,
PRIMARY KEY (ItineraryNo)
);
create table Staff (
StaffID varchar(10) NOT NULL,
StaffName varchar(50) NOT NULL
PRIMARY KEY (StaffID)
);
create table Trip (
StaffID varchar(10) NOT NULL,
ItineraryNo varchar(10) NOT NULL,
DepartureDate date UNIQUE NOT NULL,
DepartureTime time NOT NULL,
AdultPrice smallmoney NOT NULL,
ChildPrice smallmoney NOT NULL,
Status varchar(20) NOT NULL,
MaxNoofParticipants int NOT NULL,
constraint fk_Trip_StaffID
foreign key (StaffID) references Staff(StaffID),
constraint fk_Trip_ItineraryNo
foreign key (ItineraryNo) references Itinerary(ItineraryNo),
primary key(DepartureDate,StaffID,ItineraryNo),
CONSTRAINT CK_Trip_AdultPrice CHECK (AdultPrice >= 0),
CONSTRAINT CK_Trip_ChildPrice CHECK (ChildPrice >= 0),
);
create table Booking (
BookingNo varchar(10) NOT NULL,
BookingDate smalldatetime NOT NULL,
StaffID varchar(10) NOT NULL,
CustID varchar(10) NOT NULL,
DepartureDate date NOT NULL,
PRIMARY KEY (BookingNo),
FOREIGN KEY (StaffID) REFERENCES Staff(StaffID),
FOREIGN KEY (CustID) REFERENCES Customer(CustID),
FOREIGN KEY (DepartureDate) REFERENCES Trip(DepartureDate),
);
create table Contact (
StaffID varchar(10) NOT NULL,
StaffContact varchar(20) NOT NULL,
PRIMARY KEY(StaffID),
Foreign KEY (StaffID) REFERENCES Staff(StaffID)
);
create table TravelAdvisor (
StaffID varchar(10) NOT NULL,
PRIMARY KEY (StaffID),
FOREIGN KEY (StaffID) REFERENCES Staff(StaffID)
);
create table TourLeader (
StaffID varchar(10) NOT NULL,
LicenseNo varchar(20) NOT NULL,
LicenseExpiryDate date NOT NULL,
PRIMARY KEY (StaffID),
FOREIGN KEY (StaffID) REFERENCES Staff(StaffID)
);
create table Country (
CountryCode varchar(10) NOT NULL,
CountryDesc char(100) NOT NULL,
PRIMARY KEY (CountryCode)
);
create table City (
CityCode varchar(10) NOT NULL,
CityDesc varchar(100) NULL,
CountryCode varchar(10) NOT NULL,
PRIMARY KEY (CityCode),
FOREIGN KEY (CountryCode) REFERENCES Country(CountryCode)
);
create table Site (
SiteID varchar(10) NOT NULL,
SiteDesc varchar(100) NULL,
CityCode varchar(10) NOT NULL,
PRIMARY KEY (SiteID),
FOREIGN KEY (CityCode) REFERENCES City(CityCode)
);
create table Visits (
ItineraryNo varchar(10) NOT NULL,
SiteID varchar(10) NOT NULL,
CONSTRAINT PK_SiteID_ItineraryNo PRIMARY KEY NONCLUSTERED (SiteID, ItineraryNo),
FOREIGN KEY (SiteID) REFERENCES Site(SiteID),
FOREIGN KEY (ItineraryNo) REFERENCES Itinerary(ItineraryNo)
);
create table Hotel (
HotelID varchar(20) NOT NULL,
HotelName varchar(100) NOT NULL,
HotelCategory varchar(20) NOT NULL,
PRIMARY KEY (HotelID)
);
--
create table StaysIn (
HotelID varchar(20) NOT NULL,
DepartureDate date NOT NULL,
ItineraryNo varchar(10) NOT NULL,
CheckInDate smalldatetime NOT NULL,
CheckOutDate smalldatetime NOT NULL,
CONSTRAINT PK_HotelID_DepartureDate_ItineraryNo PRIMARY KEY NONCLUSTERED (HotelID, DepartureDate, ItineraryNo),
FOREIGN KEY (HotelID) REFERENCES Hotel(HotelID),
FOREIGN KEY (DepartureDate) REFERENCES Trip(DepartureDate),
FOREIGN KEY (ItineraryNo) REFERENCES Itinerary(ItineraryNo)
);
create table Flight (
FlightNo varchar(10) NOT NULL,
Airline varchar(30) NOT NULL,
Origin varchar(30) NOT NULL,
Destination varchar(30) NOT NULL,
FlightTime time NOT NULL,
PRIMARY KEY (FlightNo)
);
create table FliesOn (
DepartureDate date NOT NULL,
ItineraryNo varchar(10) NOT NULL,
FlightNo varchar(10) NOT NULL,
FlightDate smalldatetime NOT NULL,
CONSTRAINT PK_FlightNo_DepartureDate_ItineraryNo PRIMARY KEY NONCLUSTERED (FlightNo, DepartureDate, ItineraryNo),
FOREIGN KEY (FlightNo) REFERENCES Flight(FlightNo),
FOREIGN KEY (DepartureDate) REFERENCES Trip(DepartureDate),
FOREIGN KEY (ItineraryNo) REFERENCES Itinerary(ItineraryNo)
);
create table Passenger (
BookingNo varchar(10) NOT NULL,
CustID varchar(10) NOT NULL,
Age varchar(5) NOT NULL,
Nationality varchar(50) NOT NULL,
PassportNo varchar(15) NOT NULL,
PassportExpiry date NOT NULL,
Gender char (1) NULL CHECK (Gender IN ('M','F')),
PricePaid float,
PRIMARY KEY NONCLUSTERED(BookingNo, CustID),
FOREIGN KEY (CustID) REFERENCES Customer(CustID)
);
--
create table RoomType (
RmTypeID varchar(10) NOT NULL,
RmDesc varchar(100) NOT NULL,
PRIMARY KEY (RmTypeID)
);
create table Requires(
RmTypeID varchar(10) NOT NULL,
BookingNo varchar(10) NOT NULL,
NoOfExtraBeds int NOT NULL,
NoOfRooms int NOT NULL,
CONSTRAINT PK_Requires_RmTypeID PRIMARY KEY NONCLUSTERED (RmTypeID, BookingNo),
FOREIGN KEY (RmTypeID) REFERENCES RoomType(RmTypeID)
);
create table Promotion (
PromoCode varchar(10) NOT NULL,
Discount float NOT NULL,
PromoDesc varchar(30) NULL,
PRIMARY KEY (PromoCode)
);
--
create table AppliesTo (
PromoCode varchar(10) NOT NULL,
DepartureDate date NOT NULL,
ItineraryNo varchar(10) NOT NULL,
CONSTRAINT PK_PromoCode_DepartureDate_ItineraryNo PRIMARY KEY NONCLUSTERED (PromoCode, DepartureDate, ItineraryNo),
FOREIGN KEY (PromoCode) REFERENCES Promotion(PromoCode),
FOREIGN KEY (DepartureDate) REFERENCES Trip(DepartureDate),
FOREIGN KEY (ItineraryNo) REFERENCES Itinerary(ItineraryNo)
);
create table Payment (
PmtNo varchar(10) NOT NULL,
ChequeNo varchar(20) NULL,
CreditCardNo varchar(50) NULL,
PmtDate smalldatetime NOT NULL,
PmtType char(10) NOT NULL,
PmtAmt float NOT NULL,
PmtMethod char(10) NOT NULL,
BookingNo varchar(10) NOT NULL,
PRIMARY KEY (PmtNo),
FOREIGN KEY (BookingNo) REFERENCES Booking(BookingNo)
);
create table Enjoys (
CustID varchar(10) NOT NULL,
BookingNo varchar(10) NOT NULL,
PromoCode varchar(10) NOT NULL,
CONSTRAINT PK_CustID_PromoCode PRIMARY KEY NONCLUSTERED (CustID, PromoCode),
FOREIGN KEY (CustID) REFERENCES Customer(CustID),
FOREIGN KEY (PromoCode) REFERENCES Promotion(PromoCode)
);
create table Organiser (
CustID varchar(10) NOT NULL,
CustEmail varchar(255) NOT NULL,
CustContact int NOT NULL,
PRIMARY KEY (CustID),
FOREIGN KEY (CustID) REFERENCES Customer(CustID)
);
INSERT INTO Country VALUES ('CC001','Peoples Republic of China')
INSERT INTO Country VALUES ('CC002','Malaysia')
INSERT INTO Country VALUES ('CC003','Hong Kong SAR')
INSERT INTO Country VALUES ('CC004','Thailand')
INSERT INTO Country VALUES ('CC005','Vietnam')
INSERT INTO Country VALUES ('CC006','Republic of Korea')
INSERT INTO Country VALUES ('CC007','United States of America')
INSERT INTO Country VALUES ('CC008','Mauritius')
INSERT INTO Country VALUES ('CC009','Switzerland')
INSERT INTO Country VALUES ('CC010','Sweden')
INSERT INTO Country VALUES ('CC011','United Kingdom')
INSERT INTO Country VALUES ('CC012','France')
INSERT INTO Country VALUES ('CC013','Netherlands')
INSERT INTO Country VALUES ('CC014','Australia')
INSERT INTO Country VALUES ('CC015','South Africa')
INSERT INTO City VALUES ('CT001','Shanghai','CC001')
INSERT INTO City VALUES ('CT002','Kuala Lumpur','CC002')
INSERT INTO City VALUES ('CT003','Beijing','CC001')
INSERT INTO City VALUES ('CT004','Hong Kong SAR','CC003')
INSERT INTO City VALUES ('CT005','Hanoi','CC005')
INSERT INTO City VALUES ('CT006','Ho Chi Minh','CC005')
INSERT INTO City VALUES ('CT007','New York','CC007')
INSERT INTO City VALUES ('CT008','Paris','CC012')
INSERT INTO City VALUES ('CT009','Amsterdam','CC013')
INSERT INTO City VALUES ('CT010','London','CC011')
INSERT INTO City VALUES ('CT011','San Francisco','CC007')
INSERT INTO City VALUES ('CT012','Sydney','CC011')
INSERT INTO City VALUES ('CT013','Cape Town','CC015')
INSERT INTO City VALUES ('CT014','Seoul','CC006')
INSERT INTO City VALUES ('CT015','Geneva','CC009')
INSERT INTO Site VALUES ('ST001','Big Ben','CT010')
INSERT INTO Site VALUES ('ST002','Louvre Museum','CT008')
INSERT INTO Site VALUES ('ST003','Ocean Park','CT004')
INSERT INTO Site VALUES ('ST004','Statue of Liberty National Monument','CT007')
INSERT INTO Site VALUES ('ST005','Alcatraz Island','CT011')
INSERT INTO Site VALUES ('ST006','Van Gogh Museum','CT009')
INSERT INTO Site VALUES ('ST007','Sydney Opera House','CT012')
INSERT INTO Site VALUES ('ST008','Ben Thanh Market','CT006')
INSERT INTO Site VALUES ('ST009','Petronas Towers','CT002')
INSERT INTO Site VALUES ('ST010','Yu Garden','CT001')
INSERT INTO Site VALUES ('ST011','Cape of Good Hope','CT013')
INSERT INTO Site VALUES ('ST012','Thăng Long Imperial Citadel','CT005')
INSERT INTO Site VALUES ('ST013','Great Wall of China','CT003')
INSERT INTO Site VALUES ('ST014','Gyeongbokgung Palace','CT014')
INSERT INTO Itinerary VALUES ('IT001', 5.5,'10-Day Shanghai Tour')
INSERT INTO Itinerary VALUES ('IT002', 4.5,'3-Day Kuala Lumpur Tour')
INSERT INTO Itinerary VALUES ('IT003', 6,'5-Day Hong Kong SAR Tour')
INSERT INTO Itinerary VALUES ('IT004', 6.5,'8-Day Ho Chi Minh Tour')
INSERT INTO Itinerary VALUES ('IT005', 3.5,'14-Day New York Tour')
INSERT INTO Itinerary VALUES ('IT006', 3,'7-Day London Tour')
INSERT INTO Itinerary VALUES ('IT007', 3.5,'10-Day Sydney Tour')
INSERT INTO Itinerary VALUES ('IT008', 3.5,'14-Day Paris Tour')
INSERT INTO Itinerary VALUES ('IT009', 4,'12-Day Amsterdam Tour')
INSERT INTO Itinerary VALUES ('IT010', 4.5,'14-Day San Francisco Tour')
INSERT INTO Staff VALUES ('S0001','Andy Ng')
INSERT INTO Staff VALUES ('S0002','Sun Lei')
INSERT INTO Staff VALUES ('S0003','Tan Hock Guan')
INSERT INTO Staff VALUES ('S0004','Liew Yoon Hin')
INSERT INTO Staff VALUES ('S0005','Ismail Ahmed Fulu')
INSERT INTO Staff VALUES ('S0006','Charis Tang')
INSERT INTO Staff VALUES ('S0007','Choo Cheng How')
INSERT INTO Staff VALUES ('S0008','Fabian Ng')
INSERT INTO Staff VALUES ('S0009','Teo Chea Wan')
INSERT INTO Staff VALUES ('S0010','Steven Ong')
INSERT INTO Staff VALUES ('S0011','David Tan')
INSERT INTO Staff VALUES ('S0012','Seth Wong')
INSERT INTO Staff VALUES ('S0013','Davis Eng')
INSERT INTO Staff VALUES ('S0014','Tanya Sing')
INSERT INTO Staff VALUES ('S0015','Lee Kuan Yew')
INSERT INTO Staff VALUES ('S0016','Amos Yee')
INSERT INTO Staff VALUES ('S0017','Lee Hsien Loong')
INSERT INTO Staff VALUES ('S0018','Gerry Lim')
INSERT INTO Staff VALUES ('S0019','Wesley Ang')
INSERT INTO Staff VALUES ('S0020','Tharun Rawisangar')
INSERT INTO Contact VALUES ('S0001','98765432')
INSERT INTO Contact VALUES ('S0002','93647268')
INSERT INTO Contact VALUES ('S0003','87654321')
INSERT INTO Contact VALUES ('S0004','88726374')
INSERT INTO Contact VALUES ('S0005','97273816')
INSERT INTO Contact VALUES ('S0006','96371862')
INSERT INTO Contact VALUES ('S0007','84527328')
INSERT INTO Contact VALUES ('S0008','96272815')
INSERT INTO Contact VALUES ('S0009','82637183')
INSERT INTO Contact VALUES ('S0010','82632718')
INSERT INTO Contact VALUES ('S0011','84567234')
INSERT INTO Contact VALUES ('S0012','92343454')
INSERT INTO Contact VALUES ('S0013','85234456')
INSERT INTO Contact VALUES ('S0014','93423344')
INSERT INTO Contact VALUES ('S0015','88890543')
INSERT INTO Contact VALUES ('S0016','93434564')
INSERT INTO Contact VALUES ('S0017','80986748')
INSERT INTO Contact VALUES ('S0018','85685325')
INSERT INTO Contact VALUES ('S0019','92345067')
INSERT INTO Contact VALUES ('S0020','83466783')
INSERT INTO TourLeader VALUES ('S0001','LN0001','2020-01-01')
INSERT INTO TourLeader VALUES ('S0002','LN0002','2021-02-20')
INSERT INTO TourLeader VALUES ('S0003','LN0003','2020-09-06')
INSERT INTO TourLeader VALUES ('S0004','LN0004', '2019-08-17')
INSERT INTO TourLeader VALUES ('S0005','LN0005','2022-01-11')
INSERT INTO TourLeader VALUES ('S0006','LN0006','2022-11-01')
INSERT INTO TourLeader VALUES ('S0007','LN0007','2021-07-31')
INSERT INTO TourLeader VALUES ('S0008','LN0008', '2020-04-24')
INSERT INTO TourLeader VALUES ('S0009','LN0009', '2022-06-11')
INSERT INTO TourLeader VALUES ('S0010','LN0010', '2020-05-13')
INSERT INTO TravelAdvisor VALUES ('S0011')
INSERT INTO TravelAdvisor VALUES ('S0012')
INSERT INTO TravelAdvisor VALUES ('S0013')
INSERT INTO TravelAdvisor VALUES ('S0014')
INSERT INTO TravelAdvisor VALUES ('S0015')
INSERT INTO TravelAdvisor VALUES ('S0016')
INSERT INTO TravelAdvisor VALUES ('S0017')
INSERT INTO TravelAdvisor VALUES ('S0018')
INSERT INTO TravelAdvisor VALUES ('S0019')
INSERT INTO TravelAdvisor VALUES ('S0020')
INSERT INTO Customer VALUES ('C0001','Lihua')
INSERT INTO Customer VALUES ('C0002','John')
INSERT INTO Customer VALUES ('C0003','Cindy')
INSERT INTO Customer VALUES ('C0004','Samuel')
INSERT INTO Customer VALUES ('C0005','Chai')
INSERT INTO Customer VALUES ('C0006','Ben')
INSERT INTO Customer VALUES ('C0007','Kiki')
INSERT INTO Customer VALUES ('C0008','Ada')
INSERT INTO Customer VALUES ('C0009','Glenn')
INSERT INTO Customer VALUES ('C0010','Danny')
INSERT INTO Trip VALUES ('S0001','IT001','2020-02-17','20:30:00',400,250,'Available',30)
INSERT INTO Trip VALUES ('S0002','IT002','2020-04-23','19:30:00',350,200,'Full',20)
INSERT INTO Trip VALUES ('S0003','IT003','2020-10-15','23:30:00',500,250,'Available',30)
INSERT INTO Trip VALUES ('S0004','IT004','2020-12-23','00:00:00',550,270,'Full',40)
INSERT INTO Trip VALUES ('S0005','IT005','2020-02-18','07:30:00',300,200,'Cancelled',35)
INSERT INTO Trip VALUES ('S0006','IT006','2020-06-10','20:30:00',400,250,'Full',40)
INSERT INTO Trip VALUES ('S0007','IT007','2020-12-11','22:30:00',400,150,'Available',30)
INSERT INTO Trip VALUES ('S0008','IT008','2020-12-20','23:00:00',450,265,'Full',35)
INSERT INTO Trip VALUES ('S0009','IT009','2020-01-20','05:30:00',300,200,'Unavailable',40)
INSERT INTO Trip VALUES ('S0010','IT010','2020-11-30','23:30:00',400,250,'Available',40)
INSERT INTO Booking VALUES ('B0001','2020-01-01 00:00:00','S0011','C0001','2020-02-17')
INSERT INTO Booking VALUES ('B0002','2019-12-01 00:00:00','S0012','C0003','2020-04-23')
INSERT INTO Booking VALUES ('B0003','2019-11-01 00:00:00','S0013','C0004','2020-10-15')
INSERT INTO Booking VALUES ('B0004','2019-09-01 00:00:00','S0013','C0005','2020-12-23')
INSERT INTO Booking VALUES ('B0005','2020-01-10 00:00:00','S0014','C0006','2020-02-17')
INSERT INTO Booking VALUES ('B0006','2020-01-18 00:00:00','S0011','C0007','2020-06-10')
INSERT INTO Booking VALUES ('B0007','2020-01-18 00:00:00','S0018','C0001','2020-12-11')
INSERT INTO Booking VALUES ('B0008','2020-01-06 00:00:00','S0020','C0002','2020-12-20')
INSERT INTO Booking VALUES ('B0009','2019-12-04 00:00:00','S0011','C0009','2020-01-20')
INSERT INTO Booking VALUES ('B0010','2020-01-29 00:00:00','S0015','C0008','2020-11-30')
INSERT INTO Payment VALUES ('PN001',NULL , '4234324209982984','2020-01-01 13:00:00','Balance', 500,'Card','B0001')
INSERT INTO Payment VALUES ('PN002','CN001', NULL,'2019-12-01 09:00:00','Deposit', 500,'Cheque','B0002')
INSERT INTO Payment VALUES ('PN003','CN002', NULL,'2019-11-01 11:00:00','Balance', 400,'Cheque','B0003')
INSERT INTO Payment VALUES ('PN004', NULL, '5747334645642675','2019-09-01 16:00:00','Balance', 550,'Card','B0004')
INSERT INTO Payment VALUES ('PN005','CN003', NULL,'2020-01-21 21:00:00','Balance', 600,'Cheque','B0005')
INSERT INTO Payment VALUES ('PN006', NULL, '685562356361544','2020-01-18 22:00:00','Balance', 530,'Card','B0006')
INSERT INTO Payment VALUES ('PN007','CN004', NULL,'2020-01-18 14:00:00','Deposit', 400,'Cheque','B0007')
INSERT INTO Payment VALUES ('PN008', NULL, '9087564246742334','2020-01-06 16:00:00','Balance', 550,'Card','B0008')
INSERT INTO Payment VALUES ('PN009',NULL, '6764245656736543','2020-01-04 22:00:00','Balance', 450,'Card','B0009')
INSERT INTO Payment VALUES ('PN010','CN005', NULL,'2020-01-29 12:00:00','Deposit', 510,'Cheque','B0010')
INSERT INTO RoomType VALUES ('RT001','Double Queen Bed')
INSERT INTO RoomType VALUES ('RT002','Double King Bed')
INSERT INTO RoomType VALUES ('RT003','Single Queen Bed')
INSERT INTO RoomType VALUES ('RT004','Single King Bed')
INSERT INTO RoomType VALUES ('RT005','Double Single Bed')
INSERT INTO RoomType VALUES ('RT006','Loft Apartment')
INSERT INTO RoomType VALUES ('RT007','Ensuite')
INSERT INTO RoomType VALUES ('RT008','Joint Room')
INSERT INTO RoomType VALUES ('RT009','Queen Bed + Single Bed')
INSERT INTO RoomType VALUES ('RT010','2 Single Beds')
INSERT INTO Requires VALUES ('RT001','B0001', 2, 40)
INSERT INTO Requires VALUES ('RT002','B0001', 3, 45)
INSERT INTO Requires VALUES ('RT003','B0002', 2, 40)
INSERT INTO Requires VALUES ('RT001','B0002', 5, 40)
INSERT INTO Requires VALUES ('RT002','B0003', 2, 60)
INSERT INTO Requires VALUES ('RT003','B0003', 2, 65)
INSERT INTO Requires VALUES ('RT004','B0004', 10, 56)
INSERT INTO Requires VALUES ('RT005','B0004', 6, 40)
INSERT INTO Requires VALUES ('RT004','B0005', 2, 45)
INSERT INTO Requires VALUES ('RT004','B0006', 2, 40)
INSERT INTO Requires VALUES ('RT003','B0007', 1, 40)
INSERT INTO Requires VALUES ('RT010','B0008', 2, 45)
INSERT INTO Requires VALUES ('RT008','B0009', 1, 45)
INSERT INTO Requires VALUES ('RT004','B0010', 2, 40)
INSERT INTO Requires VALUES ('RT005','B0010', 2, 40)
INSERT INTO Organiser VALUES ('C0001','Lihua@gmail.com',01065529988)
INSERT INTO Organiser VALUES ('C0002','John@gmail.com',89929301)
INSERT INTO Organiser VALUES ('C0003','Cindy@gmail.com', 01062783892)
INSERT INTO Organiser VALUES ('C0004','Samuel@gmail.com', 50299506)
INSERT INTO Organiser VALUES ('C0005','Chai@gmail.com', 022590391)
INSERT INTO Organiser VALUES ('C0006','Ben@gmail.com', 90480934)
INSERT INTO Organiser VALUES ('C0007','Kiki@gmail.com', 063-985932)
INSERT INTO Organiser VALUES ('C0008','Ada@gmail.com', 0655425904)
INSERT INTO Organiser VALUES ('C0009','Glenn@gmail.com', 87069053)
INSERT INTO Organiser VALUES ('C0010','Danny@gmail.com',93043902)
INSERT INTO Passenger VALUES ('B0001','C0001', 40,'Peoples Republic of China','C8329833','2022-12-13','F', 500)
INSERT INTO Passenger VALUES ('B0002','C0002', 50,'Singapore','S29833','2022-12-13','F', 500)
INSERT INTO Passenger VALUES ('B0003','C0003', 69,'Peoples Republic of China','C1283792','2022-12-09','F', 400)
INSERT INTO Passenger VALUES ('B0004','C0004', 20 ,'Malaysia','M198623','2021-11-21','M', 550)
INSERT INTO Passenger VALUES ('B0005','C0005', 38,'Thailand','T13425','2021-10-20','M', 600)
INSERT INTO Passenger VALUES ('B0006','C0006', 54,'Singapore','S23890','2021-12-01','M',530)
INSERT INTO Passenger VALUES ('B0007','C0007', 27,'Cambodia','K2234835','2023-05-24','F', 400)
INSERT INTO Passenger VALUES ('B0008','C0008', 29,'Germany','G8171235','2022-11-15','F', 550)
INSERT INTO Passenger VALUES ('B0009','C0009', 33,'Malaysia','M928347','2021-07-04','M', 450)
INSERT INTO Passenger VALUES ('B0010','C0010', 58,'Singapore','S20387','2023-02-27','M', 510)
INSERT INTO Flight VALUES ('FL0001','Singapore Airlines','Singapore','London','13:15')
INSERT INTO Flight VALUES ('FL0002','Singapore Airlines','Singapore','Paris','13:00')
INSERT INTO Flight VALUES ('FL0003','KLM','Singapore','Amsterdam','12:30')
INSERT INTO Flight VALUES ('FL0004','Singapore Airlines','Singapore','Kuala Lumpur','18:30')
INSERT INTO Flight VALUES ('FL0005','Qantas','Singapore','Sydney','07:30')
INSERT INTO Flight VALUES ('FL0006','Air France','Singapore','Paris','13:00')
INSERT INTO Flight VALUES ('FL0007','Singapore Airlines','Singapore','Hong Kong','04:00')
INSERT INTO Flight VALUES ('FL0008','Singapore Airlines','Singapore','Shanghai','05:15')
INSERT INTO Flight VALUES ('FL0009','Singapore Airlines','Shanghai','Singapore','13:15')
INSERT INTO Flight VALUES ('FL0010','Singapore Airlines','London','Singapore','13:15')
INSERT INTO Flight VALUES ('FL0011','Singapore Airlines','Hong Kong','Singapore','4:00')
INSERT INTO Flight VALUES ('FL0012','KLM','Amsterdam', 'Singapore','12:30')
INSERT INTO Flight VALUES ('FL0013','Qantas','Sydney', 'Singapore','7:30')
INSERT INTO Flight VALUES ('FL0014','Singapore Airlines','Paris','Singapore','13:00')
INSERT INTO Flight VALUES ('FL0015','Air France','Paris','Singapore','13:00')
INSERT INTO Flight VALUES ('FL0016','Singapore Airlines','New York','Singapore','18:30')
INSERT INTO Flight VALUES ('FL0017','Singapore Airlines','Singapore','Cape Town','10:30')
INSERT INTO Flight VALUES ('FL0018','Singapore Airlines','Cape Town','Singapore','10:30')
INSERT INTO Flight VALUES ('FL0019','Singapore Airlines','Singapore','San Francisco','15:30')
INSERT INTO Flight VALUES ('FL0020','Singapore Airlines','San Francisco','Singapore','15:30')
INSERT INTO Flight VALUES ('FL0021','SilkAir','Singapore','Ho Chi Minh','14:30')
INSERT INTO Flight VALUES ('FL0022','SilkAir','Ho Chi Minh','Singapore','18:30')
INSERT INTO Flight VALUES ('FL0023','Singapore Airlines','Singapore','New York','06:30')
INSERT INTO FliesOn VALUES('2020-04-23','IT002','FL0004','2020-04-23')
INSERT INTO FliesOn VALUES('2020-10-15','IT003','FL0007','2020-10-15')
INSERT INTO FliesOn VALUES('2020-12-23','IT004','FL0021','2020-12-23')
INSERT INTO FliesOn VALUES('2020-02-17','IT005','FL0023','2020-02-17')
INSERT INTO FliesOn VALUES('2020-06-10','IT006','FL0001','2020-06-10')
INSERT INTO FliesOn VALUES('2020-12-11','IT007','FL0005','2020-12-11')
INSERT INTO FliesOn VALUES('2020-12-20','IT008','FL0006','2020-12-20')
INSERT INTO FliesOn VALUES('2020-01-20','IT009','FL0003','2020-01-20')
INSERT INTO FliesOn VALUES('2020-11-30','IT010','FL0019','2020-11-30')
INSERT INTO Hotel VALUES ('HL001','St Regis New York','6 Stars')
INSERT INTO Hotel VALUES ('HL002','Kempinski London','6 Stars')
INSERT INTO Hotel VALUES ('HL003','Hilton New York','4 Stars')
INSERT INTO Hotel VALUES ('HL004','Holiday Inn Cape Town','3 Stars')
INSERT INTO Hotel VALUES ('HL005','Marriott London','4 Stars')
INSERT INTO Hotel VALUES ('HL006','Four Seasons Amsterdam','4 Stars')
INSERT INTO Hotel VALUES ('HL007','Hyatt San Francisco','4 Stars')
INSERT INTO Hotel VALUES ('HL008','Sands Las Vegas','4 Stars')
INSERT INTO Hotel VALUES ('HL009','The Shard London','5 Stars')
INSERT INTO Hotel VALUES ('HL010','Hilton Paris','4 Stars')
INSERT INTO Hotel VALUES ('HL011','Marriott Paris','4 Stars')
INSERT INTO Hotel VALUES ('HL012','Crowne Plaza Sydney','3 Stars')
INSERT INTO Hotel VALUES ('HL013','Hyatt Paris','4 Stars')
INSERT INTO Hotel VALUES ('HL014','St Regis Shanghai','6 Stars')
INSERT INTO Hotel VALUES ('HL015','Shangri La Shanghai','5 Stars')
INSERT INTO StaysIn VALUES ('HL001','2020-02-17','IT001','2020-02-18','2020-02-27')
INSERT INTO StaysIn VALUES ('HL002','2020-04-23','IT002','2020-04-24','2020-04-26')
INSERT INTO StaysIn VALUES ('HL003','2020-10-15','IT003','2020-10-15','2020-10-20')
INSERT INTO StaysIn VALUES ('HL004','2020-12-23','IT004','2020-12-24','2021-12-31')
INSERT INTO StaysIn VALUES ('HL005','2020-02-17','IT005','2020-02-17','2020-03-03')
INSERT INTO StaysIn VALUES ('HL006','2020-06-10','IT006','2020-06-11','2020-05-17')
INSERT INTO StaysIn VALUES ('HL007','2020-12-11','IT007','2020-12-12','2020-12-21')
INSERT INTO StaysIn VALUES ('HL008','2020-12-20','IT008','2020-12-21','2021-01-04')
INSERT INTO StaysIn VALUES ('HL009','2020-01-20','IT009','2020-01-20','2020-02-02')
INSERT INTO StaysIn VALUES ('HL010','2020-11-30','IT010','2020-12-01','2020-12-12')
INSERT INTO Promotion VALUES ('PC001',0.25 ,'Chinese New Year Sale')
INSERT INTO Promotion VALUES ('PC002',0.5 ,'Anniversary Sale')
INSERT INTO Promotion VALUES ('PC003',0.25 ,'Christmas Sale')
INSERT INTO Promotion VALUES ('PC004',0.25 ,'December School Holiday Sale')
INSERT INTO Promotion VALUES ('PC005',0.25 ,'Great Singapore Sale')
INSERT INTO Promotion VALUES ('PC006',0.25 ,'Hari Raya Sale')
INSERT INTO Promotion VALUES ('PC007',0.35 ,'Mid Autumn Festival Sale')
INSERT INTO Promotion VALUES ('PC008',0.15 ,'June School Holiday Sale')
INSERT INTO Promotion VALUES ('PC009',0.35 ,'Deepavali Sale')
INSERT INTO Promotion VALUES ('PC010',0.25 ,'Vesak Day Sale')
INSERT INTO Enjoys VALUES ('C0001', 'B0001','PC008')
INSERT INTO Enjoys VALUES ('C0001', 'B0001','PC002')
INSERT INTO Enjoys VALUES ('C0003', 'B0003','PC004')
INSERT INTO Enjoys VALUES ('C0004', 'B0004','PC005')
INSERT INTO Enjoys VALUES ('C0004', 'B0004','PC007')
INSERT INTO Enjoys VALUES ('C0005', 'B0005','PC008')
INSERT INTO Enjoys VALUES ('C0006', 'B0006','PC007')
INSERT INTO Enjoys VALUES ('C0007', 'B0007','PC002')
INSERT INTO Enjoys VALUES ('C0007', 'B0007','PC001')
INSERT INTO Enjoys VALUES ('C0009', 'B0009','PC001')
INSERT INTO Enjoys VALUES ('C0009', 'B0009','PC010')
INSERT INTO AppliesTo VALUES ('PC002','2020-02-17','IT001')
INSERT INTO AppliesTo VALUES ('PC003','2020-04-23','IT002')
INSERT INTO AppliesTo VALUES ('PC004','2020-10-15','IT003')
INSERT INTO AppliesTo VALUES ('PC007','2020-12-23','IT004')
INSERT INTO AppliesTo VALUES ('PC007','2020-02-17','IT005')
INSERT INTO AppliesTo VALUES ('PC009','2020-06-10','IT006')
INSERT INTO AppliesTo VALUES ('PC003','2020-12-11','IT007')
INSERT INTO AppliesTo VALUES ('PC001','2020-12-20','IT008')
INSERT INTO AppliesTo VALUES ('PC004','2020-01-20','IT009')
INSERT INTO AppliesTo VALUES ('PC005','2020-11-30','IT010')
INSERT INTO Visits VALUES ('IT001','ST010')
INSERT INTO Visits VALUES ('IT002','ST009')
INSERT INTO Visits VALUES ('IT003','ST003')
INSERT INTO Visits VALUES ('IT004','ST008')
INSERT INTO Visits VALUES ('IT005','ST004')
INSERT INTO Visits VALUES ('IT006','ST001')
INSERT INTO Visits VALUES ('IT007','ST007')
INSERT INTO Visits VALUES ('IT008','ST002')
INSERT INTO Visits VALUES ('IT009','ST006')
INSERT INTO Visits VALUES ('IT010','ST005')
SELECT * FROM Staff
SELECT * FROM TourLeader
SELECT * FROM TravelAdvisor
SELECT * FROM Trip
SELECT * FROM Customer
SELECT * FROM Organiser
SELECT * FROM Passenger
SELECT * FROM Booking
SELECT * FROM Promotion
SELECT * FROM RoomType
SELECT * FROM Payment
SELECT * FROM Hotel
SELECT * FROM Flight
SELECT * FROM Itinerary
SELECT * FROM Site
SELECT * FROM City
SELECT * FROM Country
SELECT * FROM StaysIn
SELECT * FROM FliesOn
SELECT * FROM Requires
SELECT * FROM Enjoys
SELECT * FROM AppliesTo
SELECT * FROM Visits
SELECT * FROM Contact
SELECT CustEmail, CustContact,PmtType
FROM Organiser INNER JOIN
Customer ON Customer.CustID = Organiser.CustID
INNER JOIN Booking ON Organiser.CustID = Booking.CustID
INNER JOIN Payment ON Payment.BookingNo = Booking.BookingNo
WHERE CustName = 'John'
SELECT DepartureDate, StaffName, StaffContact
FROM TourLeader INNER JOIN
Staff ON Staff.StaffID = TourLeader.StaffID
INNER JOIN Contact ON Staff.StaffID = Contact.StaffID
INNER JOIN Trip ON TourLeader.StaffID = Trip.StaffID
ORDER BY DepartureDate ASC
SELECT SiteDesc, Country.CountryCode, Duration
FROM Site INNER JOIN City
ON Site.CityCode = City.CityCode
INNER JOIN Country
ON City.CountryCode = Country.CountryCode
INNER JOIN Visits
ON Visits.SiteID = Site.SiteID
INNER JOIN Itinerary
ON Visits.ItineraryNo = Itinerary.ItineraryNo
WHERE Duration > 5
|
USE employees;
-- 2
SELECT d.dept_name AS 'Departent Name',
concat(e.first_name, ' ', e.last_name) AS 'Department Manager'
FROM employees as e
JOIN dept_manager de
ON de.emp_no = e.emp_no
JOIN departments d
ON d.dept_no = de.dept_no
WHERE de.to_date >= curdate()
ORDER BY d.dept_name;
-->>------------>---+--+->
SELECT d.dept_name AS 'Department',
CONCAT(e.first_name, ' ', e.last_name) AS 'Manager'
FROM employees e
JOIN dept_manager dm
ON dm.emp_no = e.emp_no
JOIN departments d
ON d.dept_no = dm.dept_no
WHERE e.gender = 'F' AND dm.to_date >= now()
ORDER BY d.dept_name;
-- 3
SELECT CONCAT(em.first_name, ' ', em.last_name) AS full_name, d.dept_name
FROM dept_manager as dmm
JOIN employees as em
ON em.emp_no = dmm.emp_no
JOIN departments as d
ON em.emp_no = dmm.emp_no
WHERE to_date > now();
-- 4
SELECT d.dept_name AS 'Departent Name',
concat(e.first_name, ' ', e.last_name) AS 'Department Manager'
FROM employees as e
JOIN dept_manager de
ON de.emp_no = e.emp_no
JOIN departments d
ON d.dept_no = de.dept_no
WHERE de.to_date >= curdate()
ORDER BY d.dept_name;
-- 5
SELECT CONCAT(em.first_name, ' ', em.last_name) AS full_name, d.dept_name
FROM dept_manager as dmm
JOIN employees as em
ON em.emp_no = dmm.emp_no
JOIN departments as d
On d.dept_no = em.emp_no;
-- BONUS
SELECT CONCAT(e.first_name, ' ', e.last_name) AS 'Employee',
d.dept_name
FROM employees as e
LEFT JOIN dept_emp as de
ON de.emp_no = e.emp_no
JOIN departments as d
ON d.dept_no = de.dept_no
UNION SELECT CONCAT(e.first_name, ' ', e.last_name) AS full_name
FROM dept_manager as dm
RIGHT JOIN employees as e
ON e.emp_no = dm.emp_no;
-- Here’s the bonus for the JOIN exercise:
--
-- Use joins along with any MySQL statement
-- we’ve covered so far to answer the following questions:
-- 1. Show current average salaries for all
-- employees, grouped by gender, to
-- show if the average is higher for
-- male/female salaries.
-- 2. Show historic average salaries for all
-- employees, grouped by gender, to
-- show if the average is higher for
-- male/female salaries.
--
-- 3. Show current average salaries of all
-- managers, grouped by gender, to
-- answer if the company pays average
-- manager salaries higher or lower based on gender.
--
-- 4. Show historic average salaries of all
-- managers, grouped by gender, to
-- answer if the company pays average
-- manager salaries higher
-- or lower based on gender.
---- notes
SELECT CONCAT(em.first_name, ' ', em.last_name) AS full_name
FROM dept_manager as dmm
left JOIN employees as em
ON em.emp_no = dmm.emp_no;
SELECT CONCAT(e.first_name, ' ', e.last_name) AS full_name, d.dept_name
FROM employees as e
JOIN dept_emp as de
ON de.emp_no = e.emp_no
JOIN departments as d
ON d.dept_no = de.dept_no
LIMIT 10;
-- returns the names of
SELECT d.dept_name, e.first_name, e.last_name
FROM departments d
JOIN dept_manager dm
ON dm.dept_no = d.dept_no
JOIN employees e
ON dm.emp_no = e.emp_no
WHERE dm.to_date > now();
--BREAKING DOWN NUM 5
-- find the current salary of all current managers
-- salaries - employees (emp_no)
-- employees -> departments (dept_no)
-- dept_manager -> departs (dept_no)
-- this will do a complete log of the the history
SELECT *
FROM salaries
JOIN employees ON salaries.emp_no = employees.emp_no
WHERE salaries.to_date > now();
|
CONNECT TO cs421;
INSERT INTO PRIORITY (category,prioritynumber) VALUES
('Health Care Workers',1)
,('Elderly',1)
,('Immunologically Compromised',1)
,('Teachers',2)
,('Children below 10',2)
,('Those in physical proximity to first priority',2)
,('Essential Service Workers',3)
,('Those in physical proximity to second priority',3)
,('Everyone Else',4)
;
INSERT INTO PATIENT (hinsurenum,patientname,phonenumber,dateofbirth,gender,registrationdate,patientcity,patientstreetaddress,patientpostalcode,numofdoses,category) VALUES
(228879580,'Jane Doe','5144936369','1938-10-15', 'female','2021-02-01','Montreal','4932 Yoho Valley','N4B 2A1',0,'Those in physical proximity to second priority')
,(581984965,'Danika Portillo','4385022468','1940-09-27','female','2021-03-11','Pitt Meadows','190 Silver Springs Blvd','V3Y 8K3',1,'Health Care Workers')
,(549891519,'Ingrid Buck','4387741891','1947-05-04','female','2021-03-21','Cap-Pelé', '597 Garafraxa St', 'E4N 6L9',1,'Health Care Workers')
,(215947635,'Pedro Price','5145381035','1950-09-01','male','2021-04-05','Sainte-Adèle','4540 Ganges Road', 'J8B 7Y4', 2,'Teachers')
,(902152473,'Kurt Joyce','4384906920','1955-12-02','male','2021-06-06','Sainte-Adèle','4301 Sheppard Ave', 'J5X 9Y3', 3,'Immunologically Compromised')
,(216872265,'Ben Hebert','5146866194','1974-10-15','male','2021-08-10','Waverley','4534 49th Avenue', 'B2R 2A5',0,'Children below 10')
,(265189752,'Adeline Davies','4387893208','1977-12-17','female','2021-09-13','Morden','738 Dominion St', 'R6M 7L9',1,'Essential Service Workers')
,(216583150,'Sallie Rutledge','5145254537','1987-03-03','female', '2021-10-04','Toronto', '1281 Albert Street', 'M4W 0B3', 2,'Everyone Else')
,(457620651,'Emmie Barry','5146584205','1994-12-11','female','2021-11-18','St. Stephen','894 River Street', 'E3L 9A8', 0,'Those in physical proximity to first priority')
,(519802942,'Nishat Prova','5145501729','2003-04-07','male', '2021-12-29','Montreal', '3671 rue St-Paul', 'E8P 6R4',0,'Elderly')
;
INSERT INTO PATIENT VALUES (10000, 'Dummy 0', 01111111, '1991-01-01','F','2020-12-10', 'Montreal', '123 Town 1', 'A0B0C0',0, 'Health Care Workers');
INSERT INTO PATIENT VALUES (10001, 'Dummy 1', 10111111, '1991-01-02','M','2020-12-11', 'Montreal', '234 Town 2', 'A0B0C1',0, 'Elderly >=65');
INSERT INTO PATIENT VALUES (10002, 'Dummy 2', 11011111, '1991-01-03','F','2020-12-12', 'Montreal', '345 Town 3', 'A0B1C0',0, 'Teachers');
INSERT INTO PATIENT VALUES (10003, 'Dummy 3', 11101111, '1991-01-04','M','2020-12-13', 'Montreal', '456 Town 4', 'A0B1C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10004, 'Dummy 4', 11110111, '1991-01-05','M','2020-12-14', 'Montreal', '567 Town 5', 'A1B0C0',0, 'Proximity to second priority');
INSERT INTO PATIENT VALUES (10005, 'Dummy 5', 11111011, '1991-01-06','F','2020-12-15', 'Montreal', '678 Town 6', 'A1B0C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10006, 'Dummy 6', 11111101, '1991-01-07','F','2020-12-16', 'Montreal', '789 Town 7', 'A1B1C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10007, 'Dummy 7', 11111110, '1991-01-08','M','2021-01-17', 'Montreal', '891 Town 8', 'A1B1C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10008, 'Dummy 8', 00111111, '1991-01-09','F','2021-01-18', 'Montreal', '123 Town 9', 'A2B0C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10009, 'Dummy 9', 10011111, '1991-01-10','F','2020-12-19', 'Montreal', '234 Town10', 'A2B0C1',0, 'Health Care Workers');
INSERT INTO PATIENT VALUES (10010, 'Dummy10', 11001111, '1991-01-11','M','2020-12-20', 'Montreal', '345 Town11', 'A2B1C0',0, 'Elderly >=65');
INSERT INTO PATIENT VALUES (10011, 'Dummy11', 11100111, '1991-01-12','F','2020-12-21', 'Montreal', '456 Town11', 'A2B1C1',0, 'Teachers');
INSERT INTO PATIENT VALUES (10012, 'Dummy12', 11110011, '1991-01-13','M','2020-12-22', 'Montreal', '567 Town12', 'A3B0C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10013, 'Dummy13', 11111001, '1991-01-14','M','2020-12-23', 'Montreal', '678 Town13', 'A3B0C1',0, 'Proximity to second priority');
INSERT INTO PATIENT VALUES (10014, 'Dummy14', 11111100, '1991-01-15','F','2020-12-24', 'Montreal', '781 Town14', 'A3B1C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10015, 'Dummy15', 00011111, '1991-01-16','F','2020-12-25', 'Montreal', '123 Town15', 'A3B1C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10016, 'Dummy16', 10001111, '1991-01-17','M','2021-01-26', 'Montreal', '234 Town16', 'A4B0C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10017, 'Dummy17', 11000111, '1991-01-18','F','2021-01-27', 'Montreal', '345 Town17', 'A4B0C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10018, 'Dummy18', 11100011, '1991-01-19','F','2020-12-28', 'Montreal', '456 Town18', 'A4B1C0',0, 'Health Care Workers');
INSERT INTO PATIENT VALUES (10019, 'Dummy19', 11110001, '1991-01-20','M','2020-12-29', 'Montreal', '567 Town19', 'A4B1C1',0, 'Elderly >=65');
INSERT INTO PATIENT VALUES (10020, 'Dummy20', 11111000, '1991-01-21','F','2020-12-30', 'Montreal', '678 Town20', 'A5B0C0',0, 'Teachers');
INSERT INTO PATIENT VALUES (10021, 'Dummy21', 00001111, '1991-01-22','M','2020-12-31', 'Montreal', '420 Town21', 'A5B0C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10022, 'Dummy22', 10000111, '1991-01-23','M','2020-01-01', 'Montreal', '421 Town22', 'A5B1C0',0, 'Proximity to second priority');
INSERT INTO PATIENT VALUES (10023, 'Dummy23', 11000011, '1991-01-24','F','2020-01-02', 'Montreal', '422 Town23', 'A5B1C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10024, 'Dummy24', 11100001, '1991-01-25','F','2020-01-03', 'Montreal', '423 Town24', 'A6B0C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10025, 'Dummy25', 11110000, '1991-01-26','M','2021-01-04', 'Montreal', '424 Town25', 'A6B0C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10026, 'Dummy26', 11111111, '1991-01-27','F','2021-01-04', 'Montreal', '425 Town26', 'A6B1C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10027, 'Dummy27', 11111112, '1991-01-26','M','2021-01-04', 'Montreal', '426 Town25', 'A6B1C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10028, 'Dummy28', 11111112, '1991-01-27','F','2021-01-04', 'Montreal', '427 Town26', 'A7B0C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10029, 'Dummy29', 11111113, '1991-01-26','M','2021-01-04', 'Montreal', '428 Town25', 'A7B0C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10030, 'Dummy30', 11111114, '1991-01-27','F','2021-01-04', 'Montreal', '429 Town26', 'A7B1C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10031, 'Dummy31', 11111115, '1991-01-26','M','2021-01-04', 'Montreal', '430 Town25', 'A7B1C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10032, 'Dummy32', 11111116, '1991-01-27','F','2021-01-04', 'Montreal', '431 Town26', 'A8B0C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10033, 'Dummy33', 11111117, '1991-01-26','M','2021-01-04', 'Montreal', '432 Town25', 'A8B0C1',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10034, 'Dummy34', 11111118, '1991-01-27','F','2021-01-04', 'Montreal', '433 Town26', 'A8B1C0',0, 'Everybody else');
INSERT INTO PATIENT VALUES (10035, 'Dummy35', 11111119, '1991-01-27','F','2021-01-05', 'Montreal', '434 Town26', 'A9B1C3',0, 'Everybody else');
INSERT INTO LOCATION (locname,locationstreetaddress,locationcity,locationpostalcode) VALUES
('Jewish General','3755 Chemin de la Côte-Sainte-Catherine','Montreal','H3T 1E2')
,('Grand Garden General Hospital','295 Sixth Street','Pitt Meadows','M3P 3K3')
,('Rose Medical Center','252 Water Street','Cap-Pelé','N1G 6A5')
,('Swanlake Community Hospital','4107 Embro St','Sainte-Adèle','M0E 8A9')
,('Crossroads Hospital','519 McGabim St','Montreal','L0R 4I1')
,('Waverly Community Center','221 rue Levy','Waverley','J0J 2X7')
,('Morden Community Center','1079 Rue De La Gare','Morden','A1X 7B5')
,('Limsa Lominsa Community Center','1711 Halsey Avenue','Toronto','J8L 0S4')
,('Ala Mhigo Clinic','4655 Reserve St','St. Stephen','L3Z 1N2')
,('Kugane Clinic','40 McGill Road','Inkerman','A1W 8S1')
;
INSERT INTO HOSPITAL (locname) VALUES
('Jewish General')
,('Grand Garden General Hospital')
,('Rose Medical Center')
,('Swanlake Community Hospital')
,('Crossroads Hospital')
;
INSERT INTO NURSE (nurseliscennum,nursename,locname) VALUES
(165498,'Tri-tin Truong','Jewish General')
,(841591,'Aiysha Murillo','Grand Garden General Hospital')
,(519821,'Stephen Melendez','Rose Medical Center')
,(315460,'Jiya Massey','Rose Medical Center')
,(631529,'Luka Morley','Crossroads Hospital')
,(105460,'Ava-May Samuels','Jewish General')
,(618294,'Kali Chang','Swanlake Community Hospital')
,(906431,'Dominika Merritt','Rose Medical Center')
,(705136,'Kason Holman','Jewish General')
,(420516,'Amisha Kouma','Crossroads Hospital')
,(983651,'Soraya Goff','Swanlake Community Hospital')
;
INSERT INTO VACCINE (vaccinename,waitperiod,requiredose) VALUES
('Pfizer-BioNTech',4,2)
,('Moderna',5,2)
;
INSERT INTO BATCH (batchnum,expdate,manufacturedate,numofvial,vaccinename,locname) VALUES
(01,'2022-07-25','2021-02-09',200,'Pfizer-BioNTech','Jewish General')
,(02,'2022-09-14','2021-02-11',300,'Moderna','Ala Mhigo Clinic')
,(03,'2022-09-16','2021-02-12',100,'Pfizer-BioNTech','Crossroads Hospital')
,(04,'2022-10-19','2021-03-01',300,'Moderna','Waverly Community Center')
,(05,'2022-10-23','2021-03-04',50,'Moderna','Limsa Lominsa Community Center')
;
INSERT INTO VIAL (vialnum,batchnum,vaccinename) VALUES
(99265,01,'Pfizer-BioNTech')
,(51981,05,'Moderna')
,(99265,02,'Moderna')
,(60050,03,'Pfizer-BioNTech')
,(51912,05,'Moderna')
,(20135,04,'Moderna')
,(10962,03,'Pfizer-BioNTech')
,(30216,01,'Pfizer-BioNTech')
,(70126,02,'Moderna')
,(95018,03,'Pfizer-BioNTech')
,(32015,02,'Moderna')
;
INSERT INTO VACCINATIONDATE (vaccdate,locname) VALUES
('2021-02-06','Jewish General')
,('2021-07-28','Jewish General')
,('2021-08-12','Jewish General')
,('2021-01-27','Jewish General')
,('2022-01-31','Ala Mhigo Clinic')
,('2022-04-01','Ala Mhigo Clinic')
,('2021-03-20','Jewish General')
,('2022-05-27','Crossroads Hospital')
,('2022-06-10','Crossroads Hospital')
;
INSERT INTO SLOT (vaccslot,stime,vaccdate,locname,nurseliscennum,vaccinename,batchnum,vialnum,hinsurenum,dateassigned) VALUES
(01,'20:30:00','2021-02-06','Jewish General',983651,'Pfizer-BioNTech',1,99265,215947635,'2021-04-15')
,(02,'21:00:00','2021-07-28','Jewish General',841591,'Moderna',5,51981,581984965,'2021-07-21')
,(03,'19:00:00','2021-08-12','Jewish General',705136,'Moderna',2,99265,549891519,'2021-08-05')
,(04,'21:00:00','2021-01-27','Jewish General',315460,'Pfizer-BioNTech',3,60050,215947635,'2021-12-24')
,(05,'18:50:00','2022-01-31','Ala Mhigo Clinic',631529,'Moderna',5,51912,216872265,'2022-01-26')
,(06,'9:00:00','2022-04-01','Ala Mhigo Clinic',618294,'Moderna',4,20135,265189752,'2022-03-29')
,(07,'10:00:00','2021-03-20','Jewish General',NULL,NULL,NULL,NULL,NULL,NULL)
,(08,'11:00:00','2022-05-27','Crossroads Hospital',906431,'Pfizer-BioNTech',3,10962,216583150,'2022-05-19')
,(09,'9:30:00','2022-06-10','Crossroads Hospital',165498,'Pfizer-BioNTech',1,30216,457620651,'2022-06-06')
,(10,'18:50:00','2021-03-20','Jewish General',420516,'Moderna',2,70126,NULL,NULL)
;
INSERT INTO SLOT VALUES (01,'12:30:00', '2021-01-31', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 01, 236481, '2021-02-21');
INSERT INTO SLOT VALUES (02,'12:30:00', '2021-01-31', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 08, 10002, '2021-02-21');
INSERT INTO SLOT VALUES (03,'12:30:00', '2021-01-31', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 09, 10003, '2021-02-21');
INSERT INTO SLOT VALUES (04,'12:30:00', '2021-01-31', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 10, 10004, '2021-02-21');
INSERT INTO SLOT VALUES (05,'12:30:00', '2021-01-31', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 11, 10005, '2021-02-21');
INSERT INTO SLOT VALUES (06,'12:30:00', '2021-01-31', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 12, 10006, '2021-02-21');
INSERT INTO SLOT VALUES (01,'12:30:00', '2021-02-06', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 02, 825172, '2021-02-21');
INSERT INTO SLOT VALUES (02,'13:30:00', '2021-02-06', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 03, 212331, '2021-02-21');
INSERT INTO SLOT VALUES (04,'15:30:00', '2021-02-06', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 04, 812345, '2021-02-21');
INSERT INTO SLOT VALUES (05,'16:30:00', '2021-02-06', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 05, 634712, '2021-02-21');
INSERT INTO SLOT VALUES (02,'12:30:00', '2021-02-06', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 14, 10008, '2021-02-21');
INSERT INTO SLOT VALUES (03,'12:30:00', '2021-02-06', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 15, 10009, '2021-02-21');
INSERT INTO SLOT VALUES (04,'12:30:00', '2021-02-06', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 16, 10010, '2021-02-21');
INSERT INTO SLOT VALUES (01,'12:30:00', '2021-03-01', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 06, 236481, '2021-02-21');
INSERT INTO SLOT VALUES (02,'12:30:00', '2021-03-01', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 17, 10011, '2021-02-21');
INSERT INTO SLOT VALUES (03,'12:30:00', '2021-03-01', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 18, 10012, '2021-02-21');
INSERT INTO SLOT VALUES (04,'12:30:00', '2021-03-01', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 19, 10013, '2021-02-21');
INSERT INTO SLOT VALUES (05,'12:30:00', '2021-03-01', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 20, 10014, '2021-02-21');
INSERT INTO SLOT VALUES (06,'12:30:00', '2021-03-01', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 21, 10015, '2021-02-21');
INSERT INTO SLOT VALUES (07,'12:30:00', '2021-03-01', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 22, 10016, '2021-02-21');
INSERT INTO SLOT VALUES (08,'12:30:00', '2021-03-01', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 23, 10017, '2021-02-21');
INSERT INTO SLOT VALUES (09,'12:30:00', '2021-03-01', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 24, 10018, '2021-02-21');
INSERT INTO SLOT VALUES (01,'12:30:00', '2021-03-03', 'Crossroads Hospital', NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SLOT VALUES (02,'12:30:00', '2021-03-03', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 25, 10019, '2021-02-21' );
INSERT INTO SLOT VALUES (03,'12:30:00', '2021-03-03', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 26, 10020, '2021-02-21' );
INSERT INTO SLOT VALUES (04,'12:30:00', '2021-03-03', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 27, 10021, '2021-02-21' );
INSERT INTO SLOT VALUES (05,'12:30:00', '2021-03-03', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 28, 10022, '2021-02-21' );
INSERT INTO SLOT VALUES (06,'12:30:00', '2021-03-03', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 29, 10023, '2021-02-21' );
INSERT INTO SLOT VALUES (07,'12:30:00', '2021-03-03', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 30, 10024, '2021-02-21' );
INSERT INTO SLOT VALUES (08,'12:30:00', '2021-03-03', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 31, 10025, '2021-02-21' );
INSERT INTO SLOT VALUES (09,'12:30:00', '2021-03-03', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 32, 10026, '2021-02-21' );
INSERT INTO SLOT VALUES (10,'12:30:00', '2021-03-03', 'Crossroads Hospital', 165498, 'Pfizer-BioNTech', 02, 33, 10027, '2021-02-21' );
INSERT INTO SLOT VALUES (01,'12:30:00', '2021-04-03', 'Crossroads Hospital', NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SLOT VALUES (02,'12:30:00', '2021-04-03', 'Crossroads Hospital', NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SLOT VALUES (03,'12:30:00', '2021-04-03', 'Crossroads Hospital', 165498, 'Moderna', 01, 07, 10028, '2021-02-21');
INSERT INTO SLOT VALUES (04,'12:30:00', '2021-04-03', 'Crossroads Hospital', 165498, 'Moderna', 01, 08, 10029, '2021-02-21');
INSERT INTO SLOT VALUES (05,'12:30:00', '2021-04-03', 'Crossroads Hospital', 165498, 'Moderna', 01, 09, 10030, '2021-02-21');
INSERT INTO SLOT VALUES (06,'12:30:00', '2021-04-03', 'Crossroads Hospital', 165498, 'Moderna', 01, 10, 10031, '2021-02-21');
INSERT INTO SLOT VALUES (07,'12:30:00', '2021-04-03', 'Crossroads Hospital', 165498, 'Moderna', 01, 11, 10032, '2021-02-21');
INSERT INTO SLOT VALUES (01,'2021-03-20', '12:30:00', 'Jewish General', 165498, 'Pfizer-BioNTech', 02, 07, 712346, '2021-02-01');
INSERT INTO SLOT VALUES (02,'2021-03-20', '13:30:00', 'Jewish General', NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SLOT VALUES (03,'2021-03-20', '14:30:00', 'Jewish General', 165498, 'Moderna', 01, 12, 10033, '2021-02-21');
INSERT INTO SLOT VALUES (04,'2021-03-20', '15:30:00', 'Jewish General', 165498, 'Moderna', 01, 13, 10034, '2021-02-21');
INSERT INTO SLOT VALUES (05,'2021-03-20', '16:30:00', 'Jewish General', 165498, 'Moderna', 01, 14, 10035, '2021-02-21');
INSERT INTO SLOT VALUES (06,'2021-03-20', '16:30:00', 'Jewish General', 165498, 'Moderna', 01, 14, 10007, '2021-02-21');
INSERT INTO SLOT VALUES (01, '2021-01-16', '12:30:00','Ala Mhigo Clinic', 105460, 'Pfizer-BioNTech', 01, 01, 3452734, '2021-01-22');
INSERT INTO SLOT VALUES (02, '2021-01-16', '13:30:00','Ala Mhigo Clinic', 105460, 'Pfizer-BioNTech', 01, 02, 125463, '2021-01-23');
INSERT INTO SLOT VALUES (03, '2021-01-16', '14:30:00','Ala Mhigo Clinic', 105460, 'Pfizer-BioNTech', 01, 03, 235678, '2021-01-24');
INSERT INTO SLOT VALUES (04, '2021-01-16', '15:30:00','Ala Mhigo Clinic', 105460, 'Pfizer-BioNTech', 01, 04, 10000, '2021-01-24');
INSERT INTO SLOT VALUES (05, '2021-01-16', '16:30:00','Ala Mhigo Clinic', 105460, 'Pfizer-BioNTech', 01, 05, 10001, '2021-01-24');
INSERT INTO NURSEASSIGN (nurseliscennum,locname,vaccdate) VALUES
(983651,'Jewish General','2021-02-06')
,(841591,'Jewish General','2021-07-28')
,(705136,'Jewish General','2021-08-12')
,(315460,'Jewish General','2021-01-27')
,(631529,'Ala Mhigo Clinic','2022-01-31')
,(618294,'Ala Mhigo Clinic','2022-04-01')
; |
create database `Company-191112034`; |
INSERT INTO tbl_hospital_gwj(h_seq, h_name, h_addr, h_tel, h_etc)
VALUES(1, '병원이름', '병원주소', '062-111-1111', '햄스터');
CREATE SEQUENCE h_seq
START WITH 1 INCREMENT BY 1; |
SELECT *
FROM (
SELECT region_name,MAX(sum) sum
FROM(
SELECT r.name REGION_NAME,s.name, SUM(o.total_amt_usd)
FROM region r
JOIN sales_reps s
ON s.region_id = r.id
JOIN accounts a
ON a.sales_rep_id = s.id
JOIN orders o
ON o.account_id = a.id
GROUP BY 1,2
ORDER BY 1,3 DESC)t1
GROUP BY 1)t2
JOIN (SELECT r.name REGION_NAME,s.name, SUM(o.total_amt_usd)
FROM region r
JOIN sales_reps s
ON s.region_id = r.id
JOIN accounts a
ON a.sales_rep_id = s.id
JOIN orders o
ON o.account_id = a.id
GROUP BY 1,2
ORDER BY 1,3 DESC)t3
ON t3.region_name = t2.region_name AND t3.sum = t2.sum
SELECT *
FROM (SELECT r.name REGION_NAME, SUM(o.total_amt_usd)
FROM region r
JOIN sales_reps s
ON s.region_id = r.id
JOIN accounts a
ON a.sales_rep_id = s.id
JOIN orders o
ON o.account_id = a.id
GROUP BY 1
ORDER BY 2 DESC
LIMIT 1)t1
JOIN (SELECT r.name REGION_NAME,count(o.*)
FROM region r
JOIN sales_reps s
ON s.region_id = r.id
JOIN accounts a
ON a.sales_rep_id = s.id
JOIN orders o
ON o.account_id = a.id
GROUP BY 1)t2
ON t2.region_name = t1.region_name
SELECT COUNT(*)
FROM(SELECT a.name , SUM(o.total)
FROM accounts a
JOIN orders o
ON o.account_id = a.id
GROUP BY 1
HAVING SUM(o.total) > (SELECT sum_TOTAL
FROM(SELECT a.name , SUM(o.standard_qty),SUM(o.total) SUM_TOTAL
FROM accounts a
JOIN orders o
ON o.account_id = a.id
GROUP BY 1
ORDER BY 2 DESC
LIMIT 1)t1)
ORDER BY 2 DESC)t7
SELECT COUNT(*)
FROM(SELECT a.name , SUM(o.total)
FROM accounts a
JOIN orders o
ON o.account_id = a.id
GROUP BY 1
HAVING SUM(o.total) > (SELECT sum_TOTAL
FROM(SELECT a.name , SUM(o.standard_qty),SUM(o.total) SUM_TOTAL
FROM accounts a
JOIN orders o
ON o.account_id = a.id
GROUP BY 1
ORDER BY 2 DESC
LIMIT 1)t1)
ORDER BY 2 DESC)t7
SELECT AVG(tot_spent)
FROM (SELECT a.id, a.name, SUM(o.total_amt_usd) tot_spent
FROM orders o
JOIN accounts a
ON a.id = o.account_id
GROUP BY a.id, a.name
ORDER BY 3 DESC
LIMIT 10) temp;
|
CREATE TABLE IACUC_PROTO_OLR_DT_REC_TYPE (
REVIEW_DETERM_RECOM_CD NUMBER(3,0) NOT NULL,
DESCRIPTION VARCHAR2(200) NOT NULL,
UPDATE_TIMESTAMP DATE NOT NULL,
UPDATE_USER VARCHAR2(60) NOT NULL,
VER_NBR NUMBER(8,0) DEFAULT 1 NOT NULL,
OBJ_ID VARCHAR2(36) NOT NULL)
/
ALTER TABLE IACUC_PROTO_OLR_DT_REC_TYPE
ADD CONSTRAINT PK_IACUC_PROTO_OLR_DT_REC_TYPE
PRIMARY KEY (REVIEW_DETERM_RECOM_CD)
/
|
--Connect to database
USE DATA9401_PROJECT1
--Create a new table
CREATE TABLE Calgary_Public_Library_Locations_and_Hours (
Library_Name VARCHAR (200),
Postal_Code VARCHAR (7),
Phone_Number VARCHAR (12)
);
--Insert multiple records
INSERT INTO Calgary_Public_Library_Locations_and_Hours(
Library_Name, Postal_Code, Phone_Number
)
VALUES
('W.R. Castell Central Library', 'T2G 2M2', '403-260-2600'),
('Alexander Calhoun Library', 'T2T 3V8', '403-260-2600'),
('Bowness Library', 'T3B 0H3', '403-260-2600'),
('Fish Creek Library', 'T2J 6S1', '403-260-2600'),
('Forest Lawn Library', 'T2A 4M1', '403-260-2600'),
('Glenmore Square Library', 'T2C 2N5', '403-260-2600'),
('Louise Riley Library', 'T2N 1M5', '403-260-2600'),
('Memorial Park Library', 'T2R 0W5', '403-260-2600'),
('Nose Hill Library', 'T2L 0G6', '403-260-2600'),
('Shawnessy Library', 'T2Y 4H3', '403-260-2600'),
('Signal Hill Library', 'T3H 3P8', '403-260-2600'),
('Southwood Library', 'T2W 0J9', '403-260-2600'),
('Judith Umbach Library', 'T2K 4Y5', '403-260-2600'),
('Village Square Library', 'T1Y 6E7', '403-260-2600'),
('Crowfoot Library', 'T3G 5T3', '403-260-2600'),
('Country Hills Library', 'T3K 6E3', '403-260-2600'),
('Saddletowne Library', 'T3J 0C9', '403-260-2600'),
('Westbrook Library', 'T3C 1P4', '403-260-2600');
--Add column
ALTER TABLE Calgary_Public_Library_Locations_and_Hours
ADD Library_FullAddress VARCHAR (255);
--Delete column
ALTER TABLE Calgary_Public_Library_Locations_and_Hours
DROP COLUMN Postal_Code;
--Truncate
TRUNCATE TABLE Calgary_Public_Library_Locations_and_Hours;
--Drop table
DROP TABLE Calgary_Public_Library_Locations_and_Hours;
--Drop database
DROP DATABASE DATA9401_PROJECT1; |
-- ACN eTS-Contracts00002859
set define off;
BEGIN HARMONY.DOIT('select ''eTS-Contracts00002859'' from dual');END;
/
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '60365' and DDS_ITEM_ASS_ID = '311364';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '311364';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '60705' and DDS_ITEM_ASS_ID = '312906';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '312906';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '60366' and DDS_ITEM_ASS_ID = '311385';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '311385';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '39424' and DDS_ITEM_ASS_ID = '222418';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '222418';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '59844' and DDS_ITEM_ASS_ID = '309941';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '309941';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '38986' and DDS_ITEM_ASS_ID = '220915';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220915';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '33258' and DDS_ITEM_ASS_ID = '221439';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '221439';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '59845' and DDS_ITEM_ASS_ID = '309960';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '309960';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '37455' and DDS_ITEM_ASS_ID = '220912';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220912';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '39421' and DDS_ITEM_ASS_ID = '221839';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '221839';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '37455' and DDS_ITEM_ASS_ID = '220910';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220910';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '37455' and DDS_ITEM_ASS_ID = '220911';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220911';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '37455' and DDS_ITEM_ASS_ID = '220913';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220913';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '37455' and DDS_ITEM_ASS_ID = '220914';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220914';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '59829' and DDS_ITEM_ASS_ID = '309812';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '309812';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '39200' and DDS_ITEM_ASS_ID = '221284';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '221284';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '38978' and DDS_ITEM_ASS_ID = '220762';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220762';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '59836' and DDS_ITEM_ASS_ID = '309883';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '309883';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '38988' and DDS_ITEM_ASS_ID = '220918';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220918';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '39421' and DDS_ITEM_ASS_ID = '221838';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '221838';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '39200' and DDS_ITEM_ASS_ID = '221283';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '221283';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '39259' and DDS_ITEM_ASS_ID = '221364';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '221364';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '39259' and DDS_ITEM_ASS_ID = '221363';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '221363';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '38988' and DDS_ITEM_ASS_ID = '220789';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220789';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '37455' and DDS_ITEM_ASS_ID = '220909';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220909';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '37455' and DDS_ITEM_ASS_ID = '220908';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '220908';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '60370' and DDS_ITEM_ASS_ID = '311450';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '311450';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '59839' and DDS_ITEM_ASS_ID = '309902';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '309902';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '59848' and DDS_ITEM_ASS_ID = '309978';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '309978';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '59832' and DDS_ITEM_ASS_ID = '309831';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '309831';
DELETE FROM HARMONY.TROLE_TO_USER_DSS where ROLE_TO_USER_ASS_ID = '56654' and DDS_ITEM_ASS_ID = '310018';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '310018';
DELETE FROM HARMONY.TROLE_TO_PROFILE_DSS where ROLE_TO_PROFILE_ASS_ID = '4322' and DDS_ITEM_ASS_ID = '312866';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '312866';
DELETE FROM HARMONY.TROLE_TO_PROFILE_DSS where ROLE_TO_PROFILE_ASS_ID = '4308' and DDS_ITEM_ASS_ID = '312746';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '312746';
DELETE FROM HARMONY.TROLE_TO_PROFILE_DSS where ROLE_TO_PROFILE_ASS_ID = '4281' and DDS_ITEM_ASS_ID = '312678';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '312678';
DELETE FROM HARMONY.TROLE_TO_PROFILE_DSS where ROLE_TO_PROFILE_ASS_ID = '4309' and DDS_ITEM_ASS_ID = '312775';
DELETE FROM HARMONY.TDDS_ITEM_ASSIGNMENT where ID = '312775';
COMMIT; |
CREATE TABLE REQUESTPAYLOADDATA (
OPPTY_ID INTEGER(15),
OPPTY_SRC_CD VARCHAR(100),
OPPTY_STATUS VARCHAR(100),
OPPTY_SUB_STATUS VARCHAR(100),
OPPTY_RANK_NBR VARCHAR(100),
MEMEBER_TYP_CD VARCHAR(100),
MEMBER_ID INTEGER(15),
CAMPAIGN_ID INTEGER(15),
EVENT_NM_TXT VARCHAR(100),
SUB_CAMPAIGN_TYP_TXT VARCHAR(100),
CONTACT_TYP_CD VARCHAR(100),
CONTACT_TYP_ID VARCHAR(100),
EMAIL_SUBJECT_TXT VARCHAR(100),
SRC_CYCLE_NBR VARCHAR(100),
DELIVERY_DT VARCHAR(100),
ROCM_CYCLE_NBR VARCHAR(100),
ADDTNL_DATA_SEGMENT_1 BLOB,
ADDTNL_DATA_SEGMENT_2 BLOB,
ADDTNL_DATA_SEGMENT_3 BLOB,
ADDTNL_DATA_SEGMENT_4 BLOB,
ADDTNL_DATA_SEGMENT_5 BLOB,
ADDTNL_DATA_SEGMENT_6 BLOB,
ADDTNL_DATA_SEGMENT_7 BLOB,
ADDTNL_DATA_SEGMENT_8 BLOB,
ADDTNL_DATA_SEGMENT_9 BLOB,
ADDTNL_DATA_SEGMENT_10 BLOB,
AUDIT_COLUMNS VARCHAR(255)
);
INSERT INTO `sys`.`requestpayloaddata`
(`DELIVERY_DT`,
`ROCM_CYCLE_NBR`,
`OPPTY_ID`,
`OPPTY_SRC_CD`,
`OPPTY_STATUS`,
`OPPTY_SUB_STATUS`,
`OPPTY_RANK_NBR`,
`MEMEBER_TYP_CD`,
`MEMBER_ID`,
`CAMPAIGN_ID`,
`EVENT_NM_TXT`,
`SUB_CAMPAIGN_TYP_TXT`,
`CONTACT_TYP_CD`,
`CONTACT_TYP_ID`,
`EMAIL_SUBJECT_TXT`,
`SRC_CYCLE_NBR`,
`ADDTNL_DATA_SEGMENT_1`,
`ADDTNL_DATA_SEGMENT_2`,
`ADDTNL_DATA_SEGMENT_3`,
`ADDTNL_DATA_SEGMENT_4`,
`ADDTNL_DATA_SEGMENT_5`,
`ADDTNL_DATA_SEGMENT_6`,
`ADDTNL_DATA_SEGMENT_7`,
`ADDTNL_DATA_SEGMENT_8`,
`ADDTNL_DATA_SEGMENT_9`,
`ADDTNL_DATA_SEGMENT_10`,
`AUDIT_COLUMNS`)
VALUES
('DELIVERY_DT',
'ROCM_CYCLE_NBR',
12301423,
'OPPTY_SRC_CD',
'Initial',
'Initial-progress',
'100',
'MINUTE_CLINIC_ID',
649588852,
649588852,
'CLINICAL_TRIALS_EMAIL',
'EnrollmentConfirmation',
'980890890',
'EMAIL_TYPE',
'abc@cvshealth.com',
'EMAIL/BANNER',
'add1',
'add1',
'add1',
'add1',
'add1',
'add1',
'add1',
'add1',
'add1',
'add1',
'auditlogs');
SELECT * FROM sys.requestpayloaddata;
CREATE TABLE sys.ROCM_DIGITAL_OPPTY (
OPPTY_ID INTEGER(18),
OPPTY_SRC_CD VARCHAR(10),
PGM_CD VARCHAR(10),
SUB_PGM_CD VARCHAR(17),
DELIVERY_DT DATE,
OPPTY_EXPN_DT DATE,
ROCM_CYCLE_NBR INTEGER(10),
OPPTY_STATUS_CD INTEGER(10),
OPPTY_SUB_STATUS_CD INTEGER(10),
OPPTY_RANK_NBR INTEGER(10),
MEMEBER_TYP_CD VARCHAR(30),
MEMBER_ID VARCHAR(30),
CAMPAIGN_ID VARCHAR(30),
EVENT_NM_TXT VARCHAR(100),
SUB_CAMPAIGN_TYP_TXT VARCHAR(100),
CONTACT_TYP_CD VARCHAR(30),
CONTACT_TYP_ID VARCHAR(100),
EMAIL_SUBJECT_TXT VARCHAR(200),
EMAIL_PREVIEW_TXT VARCHAR(200),
SRC_CYCLE_NBR INTEGER(10),
WKFLW_EXECN_ID INTEGER(18),
WKFLW_EXECN_DT DATE,
ODATE DATE,
SRC_WKFLW_EXECN_ID INTEGER(18)
);
----- ORACLE -----
CREATE TABLE sys.ROCM_DIGITAL_OPPTY (
OPPTY_ID INTEGER(18),
OPPTY_SRC_CD VARCHAR(10),
PGM_CD VARCHAR(10),
SUB_PGM_CD VARCHAR(17),
DELIVERY_DT DATE,
OPPTY_EXPN_DT DATE,
ROCM_CYCLE_NBR INTEGER(10),
OPPTY_STATUS_CD INTEGER(10),
OPPTY_SUB_STATUS_CD INTEGER(10),
OPPTY_RANK_NBR INTEGER(10),
MEMEBER_TYP_CD VARCHAR(30),
MEMBER_ID VARCHAR(30),
CAMPAIGN_ID VARCHAR(30),
EVENT_NM_TXT VARCHAR(100),
SUB_CAMPAIGN_TYP_TXT VARCHAR(100),
CONTACT_TYP_CD VARCHAR(30),
CONTACT_TYP_ID VARCHAR(100),
EMAIL_SUBJECT_TXT VARCHAR(200),
EMAIL_PREVIEW_TXT VARCHAR(200),
SRC_CYCLE_NBR INTEGER(10),
WKFLW_EXECN_ID INTEGER(18),
WKFLW_EXECN_DT DATE,
ODATE DATE,
SRC_WKFLW_EXECN_ID INTEGER(18)
); |
--
-- Database: `regform`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`id`, `username`, `password`) VALUES
(1, 'akgim_admin123', '99962cd627ad7baa22af38c906e28869');
-- --------------------------------------------------------
--
-- Table structure for table `studentdetails`
--
CREATE TABLE `studentdetails` (
`id` int(11) NOT NULL,
`Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`see_rollno` varchar(30) NOT NULL,
`gen_rank` varchar(30) NOT NULL,
`category_rank` varchar(30) NOT NULL,
`cat_mat_cmat` varchar(30) NOT NULL,
`percentile` varchar(30) NOT NULL,
`other_exam_name` varchar(50) NOT NULL,
`other_exam_percentile` varchar(30) NOT NULL,
`name` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`fname` varchar(50) NOT NULL,
`dob` varchar(50) NOT NULL,
`nationality` varchar(50) NOT NULL,
`category` varchar(50) NOT NULL,
`Gender` varchar(50) NOT NULL,
`state_of_domicile` varchar(100) NOT NULL,
`permanent_add` varchar(200) NOT NULL,
`pincode_perm` varchar(10) NOT NULL,
`telno_perm` varchar(20) NOT NULL,
`correspondence_add` varchar(200) NOT NULL,
`pincode_corr` varchar(10) NOT NULL,
`telno_corr` varchar(20) NOT NULL,
`local_add` varchar(200) NOT NULL,
`pincode_loc` varchar(10) NOT NULL,
`telno_loc` varchar(20) NOT NULL,
`10_school_name` varchar(200) NOT NULL,
`10_board` varchar(200) NOT NULL,
`10_passingyear` varchar(10) NOT NULL,
`10_percentage` varchar(10) NOT NULL,
`12_school_name` varchar(200) NOT NULL,
`12_board` varchar(200) NOT NULL,
`12_passingyear` varchar(10) NOT NULL,
`12_percentage` varchar(10) NOT NULL,
`diploma_college` varchar(200) NOT NULL,
`diploma_university` varchar(200) NOT NULL,
`diploma_passingyear` varchar(10) NOT NULL,
`diploma_percentage` varchar(10) NOT NULL,
`graduation_college` varchar(200) NOT NULL,
`graduation_university` varchar(200) NOT NULL,
`graduation_passingyear` varchar(10) NOT NULL,
`graduation_percentage` varchar(10) NOT NULL,
`other_college` varchar(200) NOT NULL,
`other_university` varchar(200) NOT NULL,
`other_passingyear` varchar(10) NOT NULL,
`other_percentage` varchar(10) NOT NULL,
`experience_duration` varchar(30) NOT NULL,
`exp_organisation_name` varchar(200) NOT NULL,
`hostel_req` varchar(20) NOT NULL,
`verified` varchar(10) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `studentdetails`
--
INSERT INTO `studentdetails` (`id`, `Date`, `see_rollno`, `gen_rank`, `category_rank`, `cat_mat_cmat`, `percentile`, `other_exam_name`, `other_exam_percentile`, `name`, `email`, `fname`, `dob`, `nationality`, `category`, `Gender`, `state_of_domicile`, `permanent_add`, `pincode_perm`, `telno_perm`, `correspondence_add`, `pincode_corr`, `telno_corr`, `local_add`, `pincode_loc`, `telno_loc`, `10_school_name`, `10_board`, `10_passingyear`, `10_percentage`, `12_school_name`, `12_board`, `12_passingyear`, `12_percentage`, `diploma_college`, `diploma_university`, `diploma_passingyear`, `diploma_percentage`, `graduation_college`, `graduation_university`, `graduation_passingyear`, `graduation_percentage`, `other_college`, `other_university`, `other_passingyear`, `other_percentage`, `experience_duration`, `exp_organisation_name`, `hostel_req`, `verified`) VALUES
(56, '2016-11-20 07:28:01', '1', '1', '1', 'CAT', '1', '1', '1', 'jcnncnc', 'dpksingh1729@gmail.com', 'jjcjcjcj', '15 November, 2016', 'indian', 'SC', 'male', 'up', '1', '123564', '1', '1', '214100', '1', '1', '123456', '1', '1', '1', '1222', '1', '1', '1', '1222', '1', '1', '1', '2221', '1', '1', '1', '1215', '1', '1', '1', '1245', '1', '1', '1', 'Yes', '1'),
(68, '2016-11-27 21:58:17', '1402710116', '456', '12', 'CAT', '1233', 'dfdgn', 'sfdghfg', 'fsdgewrgttggh', 'rgtygfbh@gmail.com', 'fergthyjyt ghgjj', '9 August, 2005', 'rasrdthgggdfh', 'general', 'male', 'retryery', 'fgxhsgfh', '242342', '13213324', 'dfghgfhg', '242342', '3423432', 'ghhgfh', '', '', 'efgrtsdyffgh', 'restdggh', '2122', '12', 'rtgdhjkhj', 'waersatdfy', '1212', '12', 'rtyujgtyu', '', '', '', 'teryuytui', 'rwe4tsydftfy', '1122', '2322', 'e5tryuytu', '', '', '', '', '', 'Yes', '0');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `studentdetails`
--
ALTER TABLE `studentdetails`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `studentdetails`
--
ALTER TABLE `studentdetails`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=73;
/*!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 */;
|
INSERT INTO customer (login, hash, firstName, lastName, email, date , isAdmin) VALUES ($1, $2, $3, $4, $5, $6, $7);
SELECT * FROM customer WHERE login=$1; |
DROP TABLE products;
DROP TABLE cart_items; |
/*
Navicat MySQL Data Transfer
Source Server : zhonggh
Source Server Version : 50721
Source Host : localhost:3306
Source Database : student_system
Target Server Type : MYSQL
Target Server Version : 50721
File Encoding : 65001
Date: 2018-06-22 20:11:20
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for admin
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`id` tinyint(9) NOT NULL AUTO_INCREMENT,
`username` varchar(32) NOT NULL,
`password` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of admin
-- ----------------------------
INSERT INTO `admin` VALUES ('1', 'admin', 'admin');
INSERT INTO `admin` VALUES ('2', '123456', '123456');
|
-- MySQL dump 10.11
--
-- Host: localhost Database: mentordb
-- ------------------------------------------------------
-- Server version 5.0.51a-3ubuntu5.4
/*!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 */;
--
-- Dumping data for table `sf_guard_group`
--
INSERT INTO `sf_guard_group` (`id`, `name`, `description`) VALUES (1,'clients',NULL);
INSERT INTO `sf_guard_group` (`id`, `name`, `description`) VALUES (2,'coaches',NULL);
INSERT INTO `sf_guard_group` (`id`, `name`, `description`) VALUES (3,'admins',NULL);
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2010-07-15 4:27:38
|
set default_transaction_isolation="read committed";
show default_transaction_isolation;
create user qumla with LOGIN password 'Qu312';
alter database qumla owner to qumla;
ALTER DEFAULT PRIVILEGES IN SCHEMA qumla GRANT SELECT, INSERT, UPDATE, DELETE ON tables TO qumla;
ALTER DEFAULT PRIVILEGES IN SCHEMA qumla GRANT SELECT, USAGE ON sequences TO qumla;
GRANT SELECT, INSERT, UPDATE, delete ON ALL TABLES IN SCHEMA qumla to qumla;
GRANT SELECT, USAGE ON ALL sequences IN SCHEMA qumla to qumla;
grant all on schema qumla to qumla;
# login psql -h localhost -U qumla qumla
set search_path=qumla,public
CREATE FUNCTION crypt(text, text) RETURNS text
LANGUAGE c IMMUTABLE STRICT
AS '$libdir/pgcrypto', 'pg_crypt';
ALTER FUNCTION crypt(text, text) OWNER TO qumla;
--
-- Name: encrypt(bytea, bytea, text); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION encrypt(bytea, bytea, text) RETURNS bytea
LANGUAGE c IMMUTABLE STRICT
AS '$libdir/pgcrypto', 'pg_encrypt';
ALTER FUNCTION encrypt(bytea, bytea, text) OWNER TO qumla;
--
-- Name: encrypt_iv(bytea, bytea, bytea, text); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION encrypt_iv(bytea, bytea, bytea, text) RETURNS bytea
LANGUAGE c IMMUTABLE STRICT
AS '$libdir/pgcrypto', 'pg_encrypt_iv';
ALTER FUNCTION encrypt_iv(bytea, bytea, bytea, text) OWNER TO qumla;
--
-- Name: gen_salt(text); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION gen_salt(text) RETURNS text
LANGUAGE c STRICT
AS '$libdir/pgcrypto', 'pg_gen_salt';
ALTER FUNCTION gen_salt(text) OWNER TO qumla;
--
-- Name: gen_salt(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION gen_salt(text, integer) RETURNS text
LANGUAGE c STRICT
AS '$libdir/pgcrypto', 'pg_gen_salt_rounds';
ALTER FUNCTION gen_salt(text, integer) OWNER TO qumla;
|
ALTER TABLE booking ADD COLUMN week_days SET('Mon','Tue','Wed','Thu','Fri','Sat','Sun') NOT NULL;
UPDATE booking SET week_days = 'Mon,Tue,Wed,Thu,Fri,Sat,Sun';
|
SELECT
COUNT(*)
FROM
questions
INNER JOIN
answer_choices ON questions.id = answer_choices.question_id
INNER JOIN
responses ON answer_choices.id = responses.answer_choice_id
WHERE
questions.id = 20
|
DROP TABLE bd_user_role;
DROP TABLE bd_user;
CREATE TABLE IF NOT EXISTS bd_user (
"u_id" SERIAL PRIMARY KEY,
"u_username" varchar(60) UNIQUE DEFAULT NULL,
"u_password" varchar(60) DEFAULT NULL,
"u_email" varchar(60) UNIQUE DEFAULT NULL,
"u_firstname" varchar(60) DEFAULT NULL,
"u_lastname" varchar(60) DEFAULT NULL,
"u_creation_date" date not null default CURRENT_DATE,
"u_hashkey" varchar(60) DEFAULT NULL,
"u_enabled" boolean default false
);
CREATE TABLE IF NOT EXISTS bd_user_role (
"ur_username" varchar(60) DEFAULT NULL REFERENCES bd_user(u_username),
"ur_role" varchar(60) DEFAULT NULL,
CONSTRAINT ur_constraint UNIQUE ("ur_username", "ur_role")
);
-- INSERT SAMPLE DATA --
INSERT INTO bd_user (u_id, u_username, u_firstname, u_lastname, u_password, u_email, u_enabled)
VALUES (1, 'paul', 'paul', 'fournel', '123456', '****', TRUE);
INSERT INTO bd_user (u_id, u_username, u_firstname, u_lastname, u_password, u_email, u_enabled)
VALUES (2, 'melchior', 'melchior', 'fracas','123456', '*****', TRUE);
INSERT INTO bd_user_role (ur_username, ur_role)
VALUES ('paul', 'ROLE_USER');
INSERT INTO bd_user_role (ur_username, ur_role)
VALUES ('paul', 'ROLE_ADMIN');
INSERT INTO bd_user_role (ur_username, ur_role)
VALUES ('melchior', 'ROLE_USER'); |
SET SCHEMA PUBLIC
CREATE TABLE EGEMP(EMPNAME VARCHAR(20),EMPANSWER VARCHAR(50),EMPPASS VARCHAR(1),EMPANSWERTIME VARCHAR(10))
CREATE TABLE EGMC(MCNAME VARCHAR(5) PRIMARY KEY, MCANSWER VARCHAR(50), MCQSTART VARCHAR(1))
INSERT INTO EGMC (MCNAME, MCQSTART) VALUES ('MC','Y') |
/*
Navicat Premium Data Transfer
Source Server : LOCAL
Source Server Type : MySQL
Source Server Version : 100419
Source Host : localhost:3306
Source Schema : savings
Target Server Type : MySQL
Target Server Version : 100419
File Encoding : 65001
Date: 13/08/2021 04:22:46
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for savingstable
-- ----------------------------
DROP TABLE IF EXISTS `savingstable`;
CREATE TABLE `savingstable` (
`custno` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`custname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`cdep` double(10, 1) NULL DEFAULT NULL,
`nyears` int(11) NULL DEFAULT NULL,
`savtype` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`custno`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of savingstable
-- ----------------------------
INSERT INTO `savingstable` VALUES ('448895', 'Test 1', 5.0, 10, 'SAVINGS-REGULAR');
INSERT INTO `savingstable` VALUES ('448896', 'Test 2', 5.0, 9, 'SAVINGS-DELUXE');
SET FOREIGN_KEY_CHECKS = 1;
|
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jan 02, 2017 at 04:52 PM
-- Server version: 5.6.33
-- PHP Version: 5.6.27
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: `yii2bsc`
--
-- --------------------------------------------------------
--
-- Table structure for table `kategoriruangan`
--
CREATE TABLE `kategoriruangan` (
`idkategoriruangan` int(11) NOT NULL,
`nama_kategori` varchar(45) DEFAULT NULL,
`detail_kategori` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `kegiatan`
--
CREATE TABLE `kegiatan` (
`idkegiatan` int(11) NOT NULL,
`nama_kegiatan` varchar(45) DEFAULT NULL,
`pengguna` int(11) DEFAULT NULL,
`mulai_kegiatan` datetime DEFAULT NULL,
`selesai_kegiatan` datetime DEFAULT NULL,
`ruangan_kegiatan` int(11) DEFAULT NULL,
`keterangan` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `pengguna`
--
CREATE TABLE `pengguna` (
`idpengguna` int(11) NOT NULL,
`nama_pengguna` varchar(45) NOT NULL,
`bagian_pengguna` enum('Internal','Eksternal') NOT NULL DEFAULT 'Internal',
`keterangan` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `ruangan`
--
CREATE TABLE `ruangan` (
`idruangan` int(11) NOT NULL,
`kategori_ruangan` int(11) DEFAULT NULL,
`nama_ruangan` varchar(45) DEFAULT NULL,
`kapasitas_ruangan` int(11) DEFAULT NULL,
`fasilitas_ruangan` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_id` int(11) NOT NULL,
`username` varchar(30) NOT NULL,
`password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `kategoriruangan`
--
ALTER TABLE `kategoriruangan`
ADD PRIMARY KEY (`idkategoriruangan`);
--
-- Indexes for table `kegiatan`
--
ALTER TABLE `kegiatan`
ADD PRIMARY KEY (`idkegiatan`),
ADD KEY `pengguna_idx` (`pengguna`),
ADD KEY `ruangan_idx` (`ruangan_kegiatan`);
--
-- Indexes for table `pengguna`
--
ALTER TABLE `pengguna`
ADD PRIMARY KEY (`idpengguna`);
--
-- Indexes for table `ruangan`
--
ALTER TABLE `ruangan`
ADD PRIMARY KEY (`idruangan`),
ADD KEY `kategori_idx` (`kategori_ruangan`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `kategoriruangan`
--
ALTER TABLE `kategoriruangan`
MODIFY `idkategoriruangan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `kegiatan`
--
ALTER TABLE `kegiatan`
MODIFY `idkegiatan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `pengguna`
--
ALTER TABLE `pengguna`
MODIFY `idpengguna` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `ruangan`
--
ALTER TABLE `ruangan`
MODIFY `idruangan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 24, 2018 at 09:44 AM
-- Server version: 10.1.29-MariaDB
-- PHP Version: 7.2.0
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: `ldm`
--
-- --------------------------------------------------------
--
-- Table structure for table `blog`
--
CREATE TABLE `blog` (
`id` int(11) NOT NULL,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`seourl` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`synopsis` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`tag` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status` int(1) NOT NULL DEFAULT '1',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`editor_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `destination`
--
CREATE TABLE `destination` (
`id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`seourl` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`synopsis` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`tag` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status` int(1) NOT NULL DEFAULT '1',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`editor_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 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;
-- --------------------------------------------------------
--
-- Table structure for table `testimonials`
--
CREATE TABLE `testimonials` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`country` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`comment` text NOT NULL,
`status` int(11) NOT NULL DEFAULT '0',
`image` text,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tour`
--
CREATE TABLE `tour` (
`id` int(11) NOT NULL,
`destination_id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`seourl` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`day` int(11) NOT NULL,
`price` decimal(10,0) NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`synopsis` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status` int(1) NOT NULL DEFAULT '1',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`editor_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tour_detail`
--
CREATE TABLE `tour_detail` (
`id` int(11) NOT NULL,
`tour_id` int(11) NOT NULL,
`no` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`image_accomodation` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image_activities` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`status` int(1) NOT NULL DEFAULT '1',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`firstname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`lastname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`birthdate` date DEFAULT NULL,
`picture` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`level` int(1) NOT NULL DEFAULT '2',
`status` int(1) NOT NULL DEFAULT '1',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `blog`
--
ALTER TABLE `blog`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `destination`
--
ALTER TABLE `destination`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `testimonials`
--
ALTER TABLE `testimonials`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tour`
--
ALTER TABLE `tour`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tour_detail`
--
ALTER TABLE `tour_detail`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `blog`
--
ALTER TABLE `blog`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `destination`
--
ALTER TABLE `destination`
MODIFY `id` int(11) 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 for table `testimonials`
--
ALTER TABLE `testimonials`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tour`
--
ALTER TABLE `tour`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tour_detail`
--
ALTER TABLE `tour_detail`
MODIFY `id` int(11) 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=7;
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 */;
|
--Problem 30.Issue few SQL statements to insert,
-- update and delete of some data in the table.
INSERT INTO WorkHours(EmployeeId, Date, Task, Hours, Comments)
VALUES(1, '2015-02-27','zada4a1', 2, 'Smetni zada4ata')
INSERT INTO WorkHours(EmployeeId, Date, Task, Hours, Comments)
VALUES(2, '2015-02-27','zada4a2', 2, 'Smetni zada4ata nomer2')
INSERT INTO WorkHours(EmployeeId, Date, Task, Hours, Comments)
VALUES(3, '2015-02-27','zada4a3', 5, 'Smetni zada4ata nomer5') |
ALTER TABLE `#__itpm_urls` ADD `checked` DATETIME NOT NULL DEFAULT '1000-01-01' AFTER `primary_url`;
ALTER TABLE `#__itpm_urls` ADD INDEX `idx_itpm_uri_checked` (`uri`(191), `checked`);
ALTER TABLE `#__itpm_urls` DROP INDEX `idx_itpm_uri`, ADD INDEX `idx_itpm_uri` (`uri`(191)) USING BTREE; |
select
ei.ei_id,
ei_jsonb.*,
ei.ei_date
from exportationinvoice ei, jsonb_to_record(ei_jsonb) as ei_jsonb (
cl_id int,
zo_id int,
wo_id text,
ei_cancelled boolean,
ei_createdby text
)
where ei.ei_id = $1; |
-- 05/02/2015 - lock customer lat/lng
ALTER TABLE `customers` ADD `is_locked` TINYINT(1) DEFAULT 0 AFTER `total_paid`; |
DROP TABLE PTWT_MASTER CASCADE CONSTRAINTS ;
CREATE TABLE PTWT_MASTER (
PTWTMID VARCHAR2 (10),
PTREGID VARCHAR2 (10),
PTQMID VARCHAR2 (50),
PTPERCENTAGE NUMBER (20),
PTRESULT VARCHAR2 (10),
PTGRADE VARCHAR2 (2),
PTANSWERPATH VARCHAR2 (250),
PTCREATEUSER VARCHAR2 (50),
PTCREATETIME DATE,
PTMODIFYUSER VARCHAR2 (50),
PTMODIFYTIME DATE) |
DROP TABLE IF EXISTS `user_type`;
CREATE TABLE `user_type` (
`id` int NOT NULL AUTO_INCREMENT,
`nama` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `user_type` (`id`, `nama`) VALUES
(1, 'petugas'),
(2, 'anggota');
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int NOT NULL AUTO_INCREMENT,
`user_type_id` int NOT NULL,
`type` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`petugas_id` int DEFAULT NULL,
`nim` int DEFAULT NULL,
`username` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`password` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `user` (`id`, `user_type_id`, `type`, `petugas_id`, `nim`, `username`, `password`) VALUES
(1, 1, 'petugas', 1, NULL, 'rahmat', 'af2a4c9d4c4956ec9d6ba62213eed568'),
(2, 1, 'petugas', 2, NULL, 'inna', '18aa53c0ac2859deaca6674ee136809c'),
(3, 2, 'anggota', NULL, 100, 'dewi', 'ed1d859c50262701d92e5cbf39652792'),
(4, 2, 'anggota', NULL, 200, 'asad', '140b543013d988f4767277b6f45ba542');
DROP TABLE IF EXISTS `akses`;
CREATE TABLE `akses` (
`id` int NOT NULL AUTO_INCREMENT,
`pid` int NOT NULL DEFAULT '0',
`nama` varchar(255) NOT NULL,
`icon` varchar(255) NOT NULL,
`link` varchar(255) NOT NULL,
`urutan` smallint NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `akses` (`id`, `pid`, `nama`, `icon`, `link`, `urutan`) VALUES
(1, 0, 'Peminjaman Saya', 'fa-book', 'peminjaman_saya/read', 1),
(2, 0, 'Dashboard', 'fa-tachometer-alt', 'dashboard/index', 1),
(3, 0, 'Input Peminjaman', 'fa-clipboard', 'peminjaman/read', 2),
(4, 0, 'Laporan', '', '', 3),
(5, 4, 'Grafik Peminjaman', 'fa-tachometer-alt', 'grafik/rekap_peminjaman', 1),
(6, 4, 'Laporan Peminjaman', 'fa-clipboard', 'laporan/rekap_peminjaman', 2),
(7, 4, 'Detail Peminjaman', 'fa-list', 'laporan/detail_peminjaman', 3),
(8, 0, 'Setting', '', '', 4),
(9, 8, 'Buku', 'fa-book', 'buku/read', 1),
(10, 8, 'Anggota', 'fa-user', 'anggota/read', 2),
(11, 8, 'Petugas', 'fa-user-circle', 'petugas/read', 3);
DROP TABLE IF EXISTS `user_type_akses`;
CREATE TABLE `user_type_akses` (
`id` int NOT NULL AUTO_INCREMENT,
`user_type_id` int NOT NULL,
`akses_id` int NOT NULL,
PRIMARY KEY (`id`),
KEY `user_type_id` (`user_type_id`),
KEY `akses_id` (`akses_id`),
CONSTRAINT `user_type_akses_ibfk_1` FOREIGN KEY (`user_type_id`) REFERENCES `user_type` (`id`),
CONSTRAINT `user_type_akses_ibfk_2` FOREIGN KEY (`akses_id`) REFERENCES `akses` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `user_type_akses` (`id`, `user_type_id`, `akses_id`) VALUES
(1, 1, 2),
(2, 1, 3),
(3, 1, 4),
(4, 1, 5),
(5, 1, 6),
(6, 1, 7),
(7, 1, 8),
(8, 1, 9),
(9, 1, 10),
(10, 1, 11),
(11, 2, 1); |
CREATE TABLE da_reg (
reg_no varchar2(15) NOT NULL,
reg_dt date,
umr_no varchar2(15),
area_cd varchar2(8),
city_cd varchar2(8),
district_cd varchar2(8),
state_cd varchar2(8),
country_cd varchar2(8),
referal_source_cd char(1),
nationality_cd varchar2(32),
expiry_dt date,
is_expired char(1),
trn_source_cd varchar2,
company_cd varchar2(8),
company_type_cd varchar2(15),
rec_type_cd varchar2(1),
record_status char(1),
loc_cd varchar2(15),
org_cd varchar2(8) NOT NULL,
grp_cd varchar2(8) NOT NULL,
dw_last_updated_dt date,
dw_facility_cd varchar2(16),
dw_job_run_no integer,
dw_row_id varchar2(128),
age varchar2(16)
);
|
-- Displays the average temperature by city ordered by temperature.
SELECT `city`, AVG(`value`) AS `avg_temp` FROM `temperatures` GROUP BY `city` ORDER BY `avg_temp` DESC;
|
Alter table Bid
add constraint deleteAuctionConstraint_bid
foreign key (auctionID) references Auction(auctionID)
on delete cascade;
Alter table AuctionKeyword
add constraint deleteAuctionConstraint_ak
foreign key (auctionID) references Auction(auctionID)
on delete cascade;
Alter table AuctionImage
add constraint deleteAuctionConstraint_ai
foreign key (auctionID) references Auction(auctionID)
on delete cascade;
ALTER table UserKeyword
add constraint deleteUserConstraint_uk
foreign key (username) references OrdinaryUser(username)
on delete cascade;
Alter table Rating
add constraint deleteUserConstraint_ra
foreign key (rater) references OrdinaryUser(username)
on delete set null;
Alter table Rating
add constraint deleteUserConstraint2_ra
foreign key (ratee) references OrdinaryUser(username)
on delete cascade;
Alter table Warning
add constraint deleteUserConstraint_wa
foreign key (usernameOrdinary) references OrdinaryUser(username)
on delete cascade;
Alter table Complaint
add constraint deleteUserConstraint_c
foreign key (sender) references OrdinaryUser(username)
on delete set null;
Alter table Complaint
add constraint deleteUserConstraint2_c
foreign key (receiver) references OrdinaryUser(username)
on delete cascade;
alter table PendingApplication
add constraint deleteUserConstraint_pa
foreign key (username) references OrdinaryUser(username)
on delete cascade;
Alter table Friend
add constraint deleteUserConstraint_f
foreign key (usernameSuggesting) references OrdinaryUser(username)
on delete cascade;
Alter table Friend
add constraint deleteUserConstraint2_f
foreign key (usernameConfirming) references OrdinaryUser(username)
on delete cascade;
Alter table Auction
add constraint deleteUserConstraint_a
foreign key (creator) references OrdinaryUser(username)
on delete cascade;
alter table Bid
add constraint deleteUserConstraint_bid
foreign key (username) references OrdinaryUser(username)
on delete cascade; |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 10, 2019 at 08:18 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.3.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: `quiz`
--
-- --------------------------------------------------------
--
-- Table structure for table `mst_admin`
--
CREATE TABLE `mst_admin` (
`id` int(11) NOT NULL,
`loginid` varchar(50) NOT NULL,
`pass` varchar(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mst_admin`
--
INSERT INTO `mst_admin` (`id`, `loginid`, `pass`) VALUES
(1, 'admin', 'password');
-- --------------------------------------------------------
--
-- Table structure for table `mst_question`
--
CREATE TABLE `mst_question` (
`que_id` int(5) NOT NULL,
`test_id` int(5) DEFAULT NULL,
`que_desc` varchar(150) DEFAULT NULL,
`ans1` varchar(75) DEFAULT NULL,
`ans2` varchar(75) DEFAULT NULL,
`ans3` varchar(75) DEFAULT NULL,
`ans4` varchar(75) DEFAULT NULL,
`true_ans` int(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mst_question`
--
INSERT INTO `mst_question` (`que_id`, `test_id`, `que_desc`, `ans1`, `ans2`, `ans3`, `ans4`, `true_ans`) VALUES
(16, 8, 'What Default Data Type ?', 'String', 'Variant', 'Integer', 'Boolear', 2),
(17, 8, 'What is Default Form Border Style ?', 'Fixed Single', 'None', 'Sizeable', 'Fixed Diaglog', 3),
(18, 8, 'Which is not type of Control ?', 'text', 'lable', 'checkbox', 'option button', 1),
(19, 9, 'Which of the follwing contexts are available in the add watch window?', 'Project', 'Module', 'Procedure', 'All', 4),
(20, 9, 'Which window will allow you to halt the execution of your code when a variable changes?', 'The call stack window', 'The immedite window', 'The locals window', 'The watch window', 4),
(22, 9, 'How can you print the object name associated with the last VB error to the Immediate window?', 'Debug.Print Err.Number', 'Debug.Print Err.Source', 'Debug.Print Err.Description', 'Debug.Print Err.LastDLLError', 2),
(23, 9, 'How can you print the object name associated with the last VB error to the Immediate window?', 'Debug.Print Err.Number', 'Debug.Print Err.Source', 'Debug.Print Err.Description', 'Debug.Print Err.LastDLLError', 2),
(24, 9, 'What function does the TabStop property on a command button perform?', 'It determines whether the button can get the focus', 'If set to False it disables the Tabindex property.', 'It determines the order in which the button will receive the focus', 'It determines if the access key swquence can be used', 1),
(25, 10, 'You application creates an instance of a form. What is the first event that will be triggered in the from?', 'Load', 'GotFocus', 'Instance', 'Initialize', 4),
(26, 10, 'Which of the following is Hungarian notation for a menu?', 'Menu', 'Men', 'mnu', 'MN', 3),
(27, 10, 'You are ready to run your program to see if it works.Which key on your keyboard will start the program?', 'F2', 'F3', 'F4', 'F5', 4),
(28, 10, 'Which of the following snippets of code will unload a form named frmFo0rm from memory?', 'Unload Form', 'Unload This', 'Unload Me', 'Unload', 3),
(29, 10, 'You want the text in text box named txtMyText to read My Text.In which property will you place this string?', 'Caption', 'Text', 'String', 'None of the above', 2),
(30, 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 3),
(31, 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 3);
-- --------------------------------------------------------
--
-- Table structure for table `mst_result`
--
CREATE TABLE `mst_result` (
`login` varchar(20) DEFAULT NULL,
`test_id` int(5) DEFAULT NULL,
`test_date` date DEFAULT NULL,
`score` int(3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mst_result`
--
INSERT INTO `mst_result` (`login`, `test_id`, `test_date`, `score`) VALUES
('raj', 8, '0000-00-00', 3),
('raj', 9, '0000-00-00', 3),
('raj', 8, '0000-00-00', 1),
('ashish', 10, '0000-00-00', 3),
('ashish', 9, '0000-00-00', 2),
('ashish', 10, '0000-00-00', 0),
('raj', 8, '0000-00-00', 0),
('ankur', 11, '0000-00-00', 0);
-- --------------------------------------------------------
--
-- Table structure for table `mst_subject`
--
CREATE TABLE `mst_subject` (
`sub_id` int(5) NOT NULL,
`sub_name` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mst_subject`
--
INSERT INTO `mst_subject` (`sub_id`, `sub_name`) VALUES
(1, 'VB'),
(2, 'Oracle'),
(3, 'Java'),
(4, 'PHP'),
(5, 'Computer Fundamental'),
(6, 'Networking'),
(7, 'mysql');
-- --------------------------------------------------------
--
-- Table structure for table `mst_test`
--
CREATE TABLE `mst_test` (
`test_id` int(5) NOT NULL,
`sub_id` int(5) DEFAULT NULL,
`test_name` varchar(30) DEFAULT NULL,
`total_que` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mst_test`
--
INSERT INTO `mst_test` (`test_id`, `sub_id`, `test_name`, `total_que`) VALUES
(8, 1, 'VB Basic Test', '3'),
(9, 1, 'Essentials of VB', '5'),
(10, 1, 'Creating User Services', '5'),
(11, 7, 'function', '5');
-- --------------------------------------------------------
--
-- Table structure for table `mst_user`
--
CREATE TABLE `mst_user` (
`user_id` int(5) NOT NULL,
`login` varchar(20) DEFAULT NULL,
`pass` varchar(20) DEFAULT NULL,
`username` varchar(30) DEFAULT NULL,
`address` varchar(50) DEFAULT NULL,
`city` varchar(15) DEFAULT NULL,
`phone` int(10) DEFAULT NULL,
`email` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mst_user`
--
INSERT INTO `mst_user` (`user_id`, `login`, `pass`, `username`, `address`, `city`, `phone`, `email`) VALUES
(12, 'nayeem', 'password', 'nayeem', 'dhaka', 'dhaka', 1924161357, 'nayeem9812@gmail.com');
-- --------------------------------------------------------
--
-- Table structure for table `mst_useranswer`
--
CREATE TABLE `mst_useranswer` (
`sess_id` varchar(80) DEFAULT NULL,
`test_id` int(11) DEFAULT NULL,
`que_des` varchar(200) DEFAULT NULL,
`ans1` varchar(50) DEFAULT NULL,
`ans2` varchar(50) DEFAULT NULL,
`ans3` varchar(50) DEFAULT NULL,
`ans4` varchar(50) DEFAULT NULL,
`true_ans` int(11) DEFAULT NULL,
`your_ans` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mst_useranswer`
--
INSERT INTO `mst_useranswer` (`sess_id`, `test_id`, `que_des`, `ans1`, `ans2`, `ans3`, `ans4`, `true_ans`, `your_ans`) VALUES
('2b8e3337837b82112def8d3e2f42f26e', 8, 'What Default Data Type ?', 'String', 'Variant', 'Integer', 'Boolear', 2, 1),
('2b8e3337837b82112def8d3e2f42f26e', 8, 'What is Default Form Border Style ?', 'Fixed Single', 'None', 'Sizeable', 'Fixed Diaglog', 3, 3),
('2b8e3337837b82112def8d3e2f42f26e', 8, 'Which is not type of Control ?', 'text', 'lable', 'checkbox', 'option button', 1, 3),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 1),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 1),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 2),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 3),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 4),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 4),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 3),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 2),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 2),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 1),
('idjir9pcq2d07764us8rdiq9n5', 11, 'how to use date( ) in mysql ?', 'now( )', 'today( )', 'date( )', 'time( )', 0, 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `mst_admin`
--
ALTER TABLE `mst_admin`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `mst_question`
--
ALTER TABLE `mst_question`
ADD PRIMARY KEY (`que_id`);
--
-- Indexes for table `mst_subject`
--
ALTER TABLE `mst_subject`
ADD PRIMARY KEY (`sub_id`);
--
-- Indexes for table `mst_test`
--
ALTER TABLE `mst_test`
ADD PRIMARY KEY (`test_id`);
--
-- Indexes for table `mst_user`
--
ALTER TABLE `mst_user`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `mst_admin`
--
ALTER TABLE `mst_admin`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `mst_question`
--
ALTER TABLE `mst_question`
MODIFY `que_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;
--
-- AUTO_INCREMENT for table `mst_subject`
--
ALTER TABLE `mst_subject`
MODIFY `sub_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `mst_test`
--
ALTER TABLE `mst_test`
MODIFY `test_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `mst_user`
--
ALTER TABLE `mst_user`
MODIFY `user_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE TABLE Persona (
nombre varchar(30) NOT NULL,
apellido varchar(30) NOT NULL,
);
CREATE TABLE Equipo (
nombre varchar(30) NOT NULL,
);
|
DROP TABLE IF EXISTS users_organisations CASCADE;
CREATE TABLE users_organisations (
id SERIAL PRIMARY KEY NOT NULL,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
organisations_id INTEGER REFERENCES organisations(id) ON DELETE CASCADE
);
|
DROP TABLE IF EXISTS `raw`;
CREATE TABLE `raw` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`json` text NOT NULL,
`is_process` int(11) NOT NULL DEFAULT 0,
`lastupdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
CREATE TABLE `category_table` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'UID',
`tableName` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '表名',
`tableComment` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '表注释',
`isUse` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否激活使用',
`createDT` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updateDT` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `unique` (`tableName`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='分类表';
insert into `category_table` (`id`, `tableName`, `tableComment`, `isUse`) values('1','base_category','分类1.0版本',0);
|
/*
SQLyog Community v8.61
MySQL - 5.0.22-community-nt : Database - dentalsmile
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`dentalsmile` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `dentalsmile`;
/*Table structure for table `appointments` */
DROP TABLE IF EXISTS `appointments`;
CREATE TABLE `appointments` (
`id` int(11) NOT NULL auto_increment,
`appointment_date` date default NULL,
`appointment_time` varchar(10) default NULL,
`patient` varchar(13) default NULL,
`dentist` varchar(13) default NULL,
`room` varchar(50) default NULL,
`created` datetime default NULL,
`createdBy` varchar(13) default NULL,
`modified` datetime default NULL,
`modifiedBy` varchar(13) default NULL,
`notes` varchar(255) default NULL,
`subject` varchar(100) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `appointments` */
insert into `appointments`(`id`,`appointment_date`,`appointment_time`,`patient`,`dentist`,`room`,`created`,`createdBy`,`modified`,`modifiedBy`,`notes`,`subject`) values (1,'2013-05-15','10:00','SUN0104130001','SUN0104130001','1','2013-01-01 00:00:00',NULL,NULL,NULL,NULL,'Test'),(2,'2013-05-10','13:00','SUN0104130001','SUN0104130001','1','2013-01-01 00:00:00',NULL,NULL,NULL,NULL,'Appointment');
/*Table structure for table `dentist` */
DROP TABLE IF EXISTS `dentist`;
CREATE TABLE `dentist` (
`userid` varchar(15) NOT NULL,
`fname` varchar(45) NOT NULL,
`lname` varchar(45) default NULL,
`birthdate` date default NULL,
`birthplace` varchar(45) default NULL,
`address1` varchar(45) default NULL,
`address2` varchar(45) default NULL,
`city` varchar(45) default NULL,
`phone` varchar(15) default NULL,
`created` date default NULL,
`createdBy` varchar(45) default NULL,
`modified` timestamp NULL default NULL,
`modifiedBy` varchar(45) default NULL,
`gender` varchar(6) default NULL,
PRIMARY KEY (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `dentist` */
insert into `dentist`(`userid`,`fname`,`lname`,`birthdate`,`birthplace`,`address1`,`address2`,`city`,`phone`,`created`,`createdBy`,`modified`,`modifiedBy`,`gender`) values ('DWIM','DWIm','MII','1984-05-19','GK','yk','yk','yk','0921',NULL,NULL,NULL,NULL,'M'),('root','root',NULL,'2013-05-05',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),('x','x','x','2013-05-05','x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
/*Table structure for table `measurement` */
DROP TABLE IF EXISTS `measurement`;
CREATE TABLE `measurement` (
`id` int(11) NOT NULL auto_increment,
`patient` varchar(13) default NULL,
`treatment` varchar(16) default NULL,
`pfile` varchar(16) default NULL,
`type` varchar(45) default NULL,
`created` datetime default NULL,
`createdBy` varchar(45) default NULL,
`modified` datetime default NULL,
`modifiedBy` varchar(45) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `measurement` */
/*Table structure for table `measurement_detail` */
DROP TABLE IF EXISTS `measurement_detail`;
CREATE TABLE `measurement_detail` (
`measurement_detail_id` int(7) NOT NULL auto_increment,
`measurement_id` int(7) NOT NULL,
`tooth_id` int(2) default NULL,
PRIMARY KEY (`measurement_detail_id`,`measurement_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `measurement_detail` */
/*Table structure for table `measurementteeth` */
DROP TABLE IF EXISTS `measurementteeth`;
CREATE TABLE `measurementteeth` (
`id` int(11) NOT NULL auto_increment,
`measurementid` int(11) default NULL,
`teethid` varchar(255) default NULL,
`length` double default NULL,
`spoint` varchar(45) default NULL,
`epoint` varchar(45) default NULL,
`type` varchar(5) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `measurementteeth` */
/*Table structure for table `patient` */
DROP TABLE IF EXISTS `patient`;
CREATE TABLE `patient` (
`id` varchar(13) NOT NULL COMMENT 'auto-increment has a limit;\nor generated with format SUN0104130001',
`fname` varchar(45) NOT NULL,
`lname` varchar(45) default NULL,
`birthdate` date NOT NULL,
`birthplace` varchar(50) NOT NULL,
`gender` varchar(6) NOT NULL default '' COMMENT 'M;F',
`address1` varchar(100) NOT NULL,
`address2` varchar(100) default NULL,
`city` varchar(45) default NULL,
`phone` varchar(15) NOT NULL,
`created` date default NULL,
`createdBy` varchar(45) default NULL,
`modified` timestamp NULL default NULL,
`modifiedBy` varchar(45) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `patient` */
insert into `patient`(`id`,`fname`,`lname`,`birthdate`,`birthplace`,`gender`,`address1`,`address2`,`city`,`phone`,`created`,`createdBy`,`modified`,`modifiedBy`) values ('SUN0104130001','DWI','MIYANTO','2013-05-19','GK','Male','yk','yk','yk','0821',NULL,NULL,NULL,NULL),('Tue0705130001','dr.wewe','asas','2013-05-07','5/7/2013','Female','asasa','sasa','sasa','1212','2013-05-07','USER','2013-05-10 09:17:42','USER'),('Fri1005130001','qwqwq','wqwq','2013-05-09','wqwq','Male','qwqw','wqwq','wqwq','12121','2013-05-10','USER',NULL,NULL);
/*Table structure for table `pfile` */
DROP TABLE IF EXISTS `pfile`;
CREATE TABLE `pfile` (
`PATIENT` varchar(13) NOT NULL,
`id` varchar(16) NOT NULL,
`filename` varchar(35) NOT NULL,
`description` varchar(255) default NULL,
`type` tinyint(5) NOT NULL default '0',
`refId` varchar(16) default NULL,
`created` date default NULL COMMENT 'uploaded',
`createdBy` varchar(50) default NULL,
`modified` timestamp NULL default NULL,
`modifiedBy` varchar(50) default NULL,
`screenshot` varchar(50) default NULL,
PRIMARY KEY (`id`),
KEY `fk_PFILE_PATIENT` (`PATIENT`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `pfile` */
insert into `pfile`(`PATIENT`,`id`,`filename`,`description`,`type`,`refId`,`created`,`createdBy`,`modified`,`modifiedBy`,`screenshot`) values ('SUN0104130001','SUN0104130001001','sdefault.obj',NULL,2,NULL,NULL,NULL,NULL,NULL,'default.jpg');
/*Table structure for table `phase` */
DROP TABLE IF EXISTS `phase`;
CREATE TABLE `phase` (
`id` int(1) NOT NULL,
`name` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `phase` */
insert into `phase`(`id`,`name`) values (1,'REGISTERED'),(2,'SCANNING'),(3,'MANIPULATION'),(4,'TREATMENT I'),(5,'TREATMENT II'),(6,'TREATMENT III'),(7,'BRACES'),(8,'WIRING'),(9,'PRINTING');
/*Table structure for table `smileuser` */
DROP TABLE IF EXISTS `smileuser`;
CREATE TABLE `smileuser` (
`userid` varchar(25) NOT NULL,
`password` varchar(35) NOT NULL default '',
`admin` tinyint(1) NOT NULL default '0',
`created` datetime default NULL,
`createdBy` varchar(45) default NULL,
`modified` timestamp NULL default NULL,
`modifiedBy` varchar(45) default NULL,
PRIMARY KEY (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `smileuser` */
insert into `smileuser`(`userid`,`password`,`admin`,`created`,`createdBy`,`modified`,`modifiedBy`) values ('DWIM','900150983CD24FB0D6963F7D28E17F72',0,NULL,NULL,NULL,NULL),('root','202CB962AC59075B964B07152D234B70',1,'2013-05-09 10:20:02','DENTALSMILE',NULL,NULL),('x','D41D8CD98F00B204E9800998ECF8427E',0,'2013-05-12 01:35:09','USER',NULL,NULL);
/*Table structure for table `tooth` */
DROP TABLE IF EXISTS `tooth`;
CREATE TABLE `tooth` (
`number` int(2) NOT NULL,
`type` int(1) default NULL COMMENT '1:upper ; 2:lower',
`name` varchar(25) NOT NULL,
PRIMARY KEY (`number`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `tooth` */
/*Table structure for table `treatment` */
DROP TABLE IF EXISTS `treatment`;
CREATE TABLE `treatment` (
`id` varchar(16) NOT NULL,
`PHASE` int(1) default NULL,
`PATIENT` varchar(13) default NULL,
`DENTIST` varchar(15) default NULL,
`tdate` date default NULL,
`ttime` varchar(10) default NULL,
`room` varchar(45) default NULL,
`refId` varchar(16) default NULL,
`created` date default NULL,
`createdBy` varchar(45) default NULL,
`modified` timestamp NULL default NULL,
`modifiedBy` varchar(45) default NULL,
PRIMARY KEY (`id`),
KEY `fk_TREATMENT_PATIENT` (`PATIENT`),
KEY `fk_TREATMENT_DOCTOR` (`DENTIST`),
KEY `fk_TREATMENT_PHASE` (`PHASE`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `treatment` */
insert into `treatment`(`id`,`PHASE`,`PATIENT`,`DENTIST`,`tdate`,`ttime`,`room`,`refId`,`created`,`createdBy`,`modified`,`modifiedBy`) values ('SUN0104130001001',1,'SUN0104130001','DWIM','2013-04-05','10:00:00','1',NULL,NULL,NULL,NULL,NULL),('SUN0104130001002',2,'SUN0104130001','DWIM','2013-04-05','10:20:00','1','SUN0104130001001',NULL,NULL,NULL,NULL),('Fri1005130001001',1,'Fri1005130001','DWIM','0001-01-01','','001','','2013-05-10','USER',NULL,NULL),('SUN0104130001005',4,'SUN0104130001','root','2013-05-13','12:00:18','2','','2013-05-13','root',NULL,NULL);
/*Table structure for table `treatment_notes` */
DROP TABLE IF EXISTS `treatment_notes`;
CREATE TABLE `treatment_notes` (
`id` int(11) NOT NULL auto_increment,
`TREATMENT` varchar(16) default NULL,
`PFILE` varchar(16) default NULL,
`notes` varchar(255) default NULL,
`description` varchar(255) default NULL,
`created` datetime default NULL,
`createdBy` varchar(45) default NULL,
PRIMARY KEY (`id`),
KEY `fk_TREATMENT_NOTES_TREATMENT_PFILE` (`TREATMENT`,`PFILE`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `treatment_notes` */
insert into `treatment_notes`(`id`,`TREATMENT`,`PFILE`,`notes`,`description`,`created`,`createdBy`) values (1,'SUN0104130001005','','sww','sa','2013-05-13 12:00:18','root');
/*Table structure for table `treatment_pfile` */
DROP TABLE IF EXISTS `treatment_pfile`;
CREATE TABLE `treatment_pfile` (
`TREATMENT` varchar(16) NOT NULL,
`PFILE` varchar(16) NOT NULL,
PRIMARY KEY (`TREATMENT`,`PFILE`),
KEY `fk_TREATMENT_has_PFILE_PFILE` (`PFILE`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*Data for the table `treatment_pfile` */
insert into `treatment_pfile`(`TREATMENT`,`PFILE`) values ('SUN0104130001002','SUN0104130001001');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
-- script to create NORTHWOODS database
-- revised 8/17/2002 JM
-- modified 3/17/2004 LM
DROP TABLE enrollment CASCADE CONSTRAINTS;
DROP TABLE course_section CASCADE CONSTRAINTS;
DROP TABLE term CASCADE CONSTRAINTS;
DROP TABLE course CASCADE CONSTRAINTS;
DROP TABLE student CASCADE CONSTRAINTS;
DROP TABLE faculty CASCADE CONSTRAINTS;
DROP TABLE location CASCADE CONSTRAINTS;
CREATE TABLE LOCATION
(loc_id NUMBER(6),
bldg_code VARCHAR2(10),
room VARCHAR2(6),
capacity NUMBER(5),
CONSTRAINT location_loc_id_pk PRIMARY KEY (loc_id));
CREATE TABLE faculty
(f_id NUMBER(6),
f_last VARCHAR2(30),
f_first VARCHAR2(30),
f_mi CHAR(1),
loc_id NUMBER(5),
f_phone VARCHAR2(10),
f_rank VARCHAR2(9),
f_super NUMBER(6),
f_pin NUMBER(4),
f_image BLOB,
CONSTRAINT faculty_f_id_pk PRIMARY KEY(f_id),
CONSTRAINT faculty_loc_id_fk FOREIGN KEY (loc_id) REFERENCES location(loc_id));
CREATE TABLE student
(s_id VARCHAR2(6),
s_last VARCHAR2(30),
s_first VARCHAR2(30),
s_mi CHAR(1),
s_address VARCHAR2(25),
s_city VARCHAR2(20),
s_state CHAR(2),
s_zip VARCHAR2(10),
s_phone VARCHAR2(10),
s_class CHAR(2),
s_dob DATE,
s_pin NUMBER(4),
f_id NUMBER(6),
time_enrolled INTERVAL YEAR TO MONTH,
CONSTRAINT student_s_id_pk PRIMARY KEY (s_id),
CONSTRAINT student_f_id_fk FOREIGN KEY (f_id) REFERENCES faculty(f_id));
CREATE TABLE TERM
(term_id NUMBER(6),
term_desc VARCHAR2(20),
status VARCHAR2(20),
start_date DATE,
CONSTRAINT term_term_id_pk PRIMARY KEY (term_id),
CONSTRAINT term_status_cc CHECK ((status = 'OPEN') OR (status = 'CLOSED')));
CREATE TABLE COURSE
(course_no VARCHAR2(7),
course_name VARCHAR2(25),
credits NUMBER(2),
CONSTRAINT course_course_id_pk PRIMARY KEY(course_no));
CREATE TABLE COURSE_SECTION
(c_sec_id NUMBER(6),
course_no VARCHAR2(7) CONSTRAINT course_section_courseid_nn NOT NULL,
term_id NUMBER(6) CONSTRAINT course_section_termid_nn NOT NULL,
sec_num NUMBER(2) CONSTRAINT course_section_secnum_nn NOT NULL,
f_id NUMBER(6),
c_sec_day VARCHAR2(10),
c_sec_time DATE,
c_sec_duration INTERVAL DAY TO SECOND,
loc_id NUMBER(6),
max_enrl NUMBER(4) CONSTRAINT course_section_maxenrl_nn NOT NULL,
CONSTRAINT course_section_csec_id_pk PRIMARY KEY (c_sec_id),
CONSTRAINT course_section_cid_fk FOREIGN KEY (course_no) REFERENCES course(course_no),
CONSTRAINT course_section_loc_id_fk FOREIGN KEY (loc_id) REFERENCES location(loc_id),
CONSTRAINT course_section_termid_fk FOREIGN KEY (term_id) REFERENCES term(term_id),
CONSTRAINT course_section_fid_fk FOREIGN KEY (f_id) REFERENCES faculty(f_id));
CREATE TABLE ENROLLMENT
(s_id VARCHAR2(6),
c_sec_id NUMBER(6),
grade CHAR(1),
CONSTRAINT enrollment_pk PRIMARY KEY (s_id, c_sec_id),
CONSTRAINT enrollment_sid_fk FOREIGN KEY (s_id) REFERENCES student(s_id),
CONSTRAINT enrollment_csecid_fk FOREIGN KEY (c_sec_id) REFERENCES course_section (c_sec_id));
---- inserting into LOCATION table
INSERT INTO location VALUES
(1, 'CR', '101', 150);
INSERT INTO location VALUES
(2, 'CR', '202', 40);
INSERT INTO location VALUES
(3, 'CR', '103', 35);
INSERT INTO location VALUES
(4, 'CR', '105', 35);
INSERT INTO location VALUES
(5, 'BUS', '105', 42);
INSERT INTO location VALUES
(6, 'BUS', '404', 35);
INSERT INTO location VALUES
(7, 'BUS', '421', 35);
INSERT INTO location VALUES
(8, 'BUS', '211', 55);
INSERT INTO location VALUES
(9, 'BUS', '424', 1);
INSERT INTO location VALUES
(10, 'BUS', '402', 1);
INSERT INTO location VALUES
(11, 'BUS', '433', 1);
INSERT INTO location VALUES
(12, 'LIB', '217', 2);
INSERT INTO location VALUES
(13, 'LIB', '222', 1);
--- inserting records into FACULTY
INSERT INTO faculty VALUES
(1, 'Marx', 'Teresa', 'J', 9, '4075921695', 'Associate', 4, 6338, EMPTY_BLOB());
INSERT INTO faculty VALUES
(2, 'Zhulin', 'Mark', 'M', 10, '4073875682', 'Full', NULL, 1121, EMPTY_BLOB());
INSERT INTO faculty VALUES
(3, 'Langley', 'Colin', 'A', 12, '4075928719', 'Assistant', 4, 9871, EMPTY_BLOB());
INSERT INTO faculty VALUES
(4, 'Brown', 'Jonnel', 'D', 11, '4078101155', 'Full', NULL, 8297, EMPTY_BLOB());
INSERT INTO faculty VALUES
(5, 'Sealy', 'James', 'L', 13, '4079817153', 'Associate', 1, 6089, EMPTY_BLOB());
--- inserting records into STUDENT
INSERT INTO student VALUES
('JO100', 'Jones', 'Tammy', 'R', '1817 Eagleridge Circle', 'Tallahassee',
'FL', '32811', '7155559876', 'SR', TO_DATE('07/14/1985', 'MM/DD/YYYY'), 8891, 1, TO_YMINTERVAL('3-2'));
INSERT INTO student VALUES
('PE100', 'Perez', 'Jorge', 'C', '951 Rainbow Dr', 'Clermont',
'FL', '34711', '7155552345', 'SR', TO_DATE('08/19/1985', 'MM/DD/YYYY'), 1230, 1, TO_YMINTERVAL('4-2'));
INSERT INTO student VALUES
('MA100', 'Marsh', 'John', 'A', '1275 West Main St', 'Carrabelle',
'FL', '32320', '7155553907', 'JR', TO_DATE('10/10/1982', 'MM/DD/YYYY'), 1613, 1, TO_YMINTERVAL('3-0'));
INSERT INTO student VALUES
('SM100', 'Smith', 'Mike', NULL, '428 Markson Ave', 'Eastpoint',
'FL', '32328', '7155556902', 'SO', TO_DATE('09/24/1986', 'MM/DD/YYYY'), 1841, 2, TO_YMINTERVAL('2-2'));
INSERT INTO student VALUES
('JO101', 'Johnson', 'Lisa', 'M', '764 Johnson Place', 'Leesburg',
'FL', '34751', '7155558899', 'SO', TO_DATE('11/20/1986', 'MM/DD/YYYY'), 4420, 4, TO_YMINTERVAL('1-11'));
INSERT INTO student VALUES
('NG100', 'Nguyen', 'Ni', 'M', '688 4th Street', 'Orlando',
'FL', '31458', '7155554944', 'FR', TO_DATE('12/4/1986', 'MM/DD/YYYY'), 9188, 3, TO_YMINTERVAL('0-4'));
--- inserting records into TERM
INSERT INTO term (term_id, term_desc, status) VALUES
(1, 'Fall 2005', 'CLOSED');
INSERT INTO term (term_id, term_desc, status) VALUES
(2, 'Spring 2006', 'CLOSED');
INSERT INTO term (term_id, term_desc, status) VALUES
(3, 'Summer 2006', 'CLOSED');
INSERT INTO term (term_id, term_desc, status) VALUES
(4, 'Fall 2006', 'CLOSED');
INSERT INTO term (term_id, term_desc, status) VALUES
(5, 'Spring 2007', 'CLOSED');
INSERT INTO term (term_id, term_desc, status) VALUES
(6, 'Summer 2007', 'OPEN');
--- inserting records into COURSE
INSERT INTO course VALUES
('MIS 101', 'Intro. to Info. Systems', 3);
INSERT INTO course VALUES
('MIS 301', 'Systems Analysis', 3);
INSERT INTO course VALUES
('MIS 441', 'Database Management', 3);
INSERT INTO course VALUES
('CS 155', 'Programming in C++', 3);
INSERT INTO course VALUES
('MIS 451', 'Web-Based Systems', 3);
--- inserting records into COURSE_SECTION
INSERT INTO course_section VALUES
(1, 'MIS 101', 4, 1, 2, 'MWF', TO_DATE('10:00 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:00:50.00'), 1, 140);
INSERT INTO course_section VALUES
(2, 'MIS 101', 4, 2, 3, 'TR', TO_DATE('09:30 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:01:15.00'), 7, 35);
INSERT INTO course_section VALUES
(3, 'MIS 101', 4, 3, 3, 'MWF', TO_DATE('08:00 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:00:50.00'), 2, 35);
INSERT INTO course_section VALUES
(4, 'MIS 301', 4, 1, 4, 'TR', TO_DATE('11:00 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:01:15.00'), 6, 35);
INSERT INTO course_section VALUES
(5, 'MIS 301', 5, 2, 4, 'TR', TO_DATE('02:00 PM', 'HH:MI PM'), TO_DSINTERVAL('0 00:01:15.00'), 6, 35);
INSERT INTO course_section VALUES
(6, 'MIS 441', 5, 1, 1, 'MWF', TO_DATE('09:00 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:00:50.00'), 5, 30);
INSERT INTO course_section VALUES
(7, 'MIS 441', 5, 2, 1, 'MWF', TO_DATE('10:00 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:00:50.00'), 5, 30);
INSERT INTO course_section VALUES
(8, 'CS 155', 5, 1, 5, 'TR', TO_DATE('08:00 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:01:15.00'), 3, 35);
INSERT INTO course_section VALUES
(9, 'MIS 451', 5, 1, 2, 'MWF', TO_DATE('02:00 PM', 'HH:MI PM'), TO_DSINTERVAL('0 00:00:50.00'), 5, 35);
INSERT INTO course_section VALUES
(10, 'MIS 451', 5, 2, 2, 'MWF', TO_DATE('03:00 PM', 'HH:MI PM'), TO_DSINTERVAL('0 00:00:50.00'), 5, 35);
INSERT INTO course_section VALUES
(11, 'MIS 101', 6, 1, 1, 'MTWRF', TO_DATE('08:00 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:01:30.00'), 1, 50);
INSERT INTO course_section VALUES
(12, 'MIS 301', 6, 1, 2, 'MTWRF', TO_DATE('08:00 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:01:30.00'), 6, 35);
INSERT INTO course_section VALUES
(13, 'MIS 441', 6, 1, 3, 'MTWRF', TO_DATE('09:00 AM', 'HH:MI AM'), TO_DSINTERVAL('0 00:01:30.00'), 5, 35);
--- inserting records into ENROLLMENT
INSERT INTO enrollment VALUES
('JO100', 1, 'A');
INSERT INTO enrollment VALUES
('JO100', 4, 'A');
INSERT INTO enrollment VALUES
('JO100', 6, 'B');
INSERT INTO enrollment VALUES
('JO100', 9, 'B');
INSERT INTO enrollment VALUES
('PE100', 1, 'C');
INSERT INTO enrollment VALUES
('PE100', 5, 'B');
INSERT INTO enrollment VALUES
('PE100', 6, 'A');
INSERT INTO enrollment VALUES
('PE100', 9, 'B');
INSERT INTO enrollment VALUES
('MA100', 1, 'C');
INSERT INTO enrollment VALUES
('MA100', 12, NULL);
INSERT INTO enrollment VALUES
('MA100', 13, NULL);
INSERT INTO enrollment VALUES
('SM100', 11, NULL);
INSERT INTO enrollment VALUES
('SM100', 12, NULL);
INSERT INTO enrollment VALUES
('JO101', 1, 'B');
INSERT INTO enrollment VALUES
('JO101', 5, 'C');
INSERT INTO enrollment VALUES
('JO101', 9, 'C');
INSERT INTO enrollment VALUES
('JO101', 11, NULL);
INSERT INTO enrollment VALUES
('JO101', 13, NULL);
INSERT INTO enrollment VALUES
('NG100', 11, NULL);
INSERT INTO enrollment VALUES
('NG100', 12, NULL);
COMMIT;
|
--
-- Created by SQL::Translator::Producer::SQLite
-- Created on Thu Mar 29 08:38:44 2012
--
BEGIN TRANSACTION;
--
-- Table: hosts
--
DROP TABLE hosts;
CREATE TABLE hosts (
host_id INTEGER PRIMARY KEY NOT NULL,
hostname VARCHAR(255) NOT NULL,
last_modified DATETIME NOT NULL
);
--
-- Table: osrels
--
DROP TABLE osrels;
CREATE TABLE osrels (
osrel_id INTEGER PRIMARY KEY NOT NULL,
entire_version VARCHAR(255) NOT NULL,
description VARCHAR(255) NOT NULL
);
--
-- Table: appgroups
--
DROP TABLE appgroups;
CREATE TABLE appgroups (
appgroup_id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR(255) NOT NULL,
fk_host_id INT(11) NOT NULL,
FOREIGN KEY(fk_host_id) REFERENCES hosts(host_id)
);
CREATE INDEX appgroups_idx_fk_host_id ON appgroups (fk_host_id);
--
-- Table: host_osrel
--
DROP TABLE host_osrel;
CREATE TABLE host_osrel (
osrel_id INT(11) NOT NULL,
host_id INT(11) NOT NULL,
PRIMARY KEY (osrel_id, host_id),
FOREIGN KEY(host_id) REFERENCES hosts(host_id),
FOREIGN KEY(osrel_id) REFERENCES osrels(osrel_id)
);
CREATE INDEX host_osrel_idx_host_id ON host_osrel (host_id);
CREATE INDEX host_osrel_idx_osrel_id ON host_osrel (osrel_id);
COMMIT;
|
-- 14/12/2014
ALTER TABLE `categories` ADD `sequence_number` INT(5) AFTER `code`;
UPDATE `categories` SET `sequence_number` = `category_id`;
ALTER TABLE `products` ADD `sequence_number` INT(5) AFTER `code`;
UPDATE `products` SET `sequence_number` = `product_id`; |
-- secret: 'c2NyZXQ=' ( secret )
--
-- Data for Name: category; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.category VALUES (1001, 'c2NyZXQ=', 'Matematika');
INSERT INTO public.category VALUES (1002, 'c2NyZXQ=', 'Informatika');
INSERT INTO public.category VALUES (1003, 'c2NyZXQ=', 'Kémia');
INSERT INTO public.category VALUES (1004, 'c2NyZXQ=', 'Biológia');
INSERT INTO public.category VALUES (1005, 'c2NyZXQ=', 'Fizika');
INSERT INTO public.category VALUES (1006, 'c2NyZXQ=', 'Közgazdaságtan');
INSERT INTO public.category VALUES (1007, 'c2NyZXQ=', 'Jogtudomány');
--
-- Data for Name: theme; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.theme VALUES (1001, '2020-05-19 14:56:31.585', 'Analízis 1', 1001);
INSERT INTO public.theme VALUES (1002, '2020-05-19 14:56:31.585', 'Analízis 2', 1001);
INSERT INTO public.theme VALUES (1003, '2020-05-19 14:56:31.585', 'Analízis 3', 1001);
INSERT INTO public.theme VALUES (1004, '2020-05-19 14:56:31.585', 'Analízis 4', 1001);
INSERT INTO public.theme VALUES (1005, '2020-05-19 14:56:31.585', 'Diszkrét matematika 1', 1001);
INSERT INTO public.theme VALUES (1006, '2020-05-19 14:56:31.585', 'Diszkrét matematika 2', 1001);
INSERT INTO public.theme VALUES (1007, '2020-05-19 14:56:31.585', 'Numerikus módszerek 1', 1001);
INSERT INTO public.theme VALUES (1008, '2020-05-19 14:56:31.585', 'Numerikus módszerek 2', 1001);
INSERT INTO public.theme VALUES (1009, '2020-05-19 14:56:31.585', 'Programozási alapismeretek', 1002);
INSERT INTO public.theme VALUES (1010, '2020-05-19 14:56:31.585', 'Programozás', 1002);
INSERT INTO public.theme VALUES (1011, '2020-05-19 14:56:31.585', 'Funkcionális programozás', 1002);
INSERT INTO public.theme VALUES (1012, '2020-05-19 14:56:31.585', 'Műszaki kémia', 1003);
INSERT INTO public.theme VALUES (1013, '2020-05-19 14:56:31.585', 'Szerves kémia', 1003);
INSERT INTO public.theme VALUES (1014, '2020-05-19 14:56:31.585', 'Általános kémia', 1003);
INSERT INTO public.theme VALUES (1015, '2020-05-19 14:56:31.585', 'Rendszertan', 1004);
INSERT INTO public.theme VALUES (1016, '2020-05-19 14:56:31.585', 'Szervezet', 1004);
INSERT INTO public.theme VALUES (1017, '2020-05-19 14:56:31.585', 'Klasszikus fizika', 1005);
INSERT INTO public.theme VALUES (1018, '2020-05-19 14:56:31.585', 'Modern fizika', 1005);
INSERT INTO public.theme VALUES (1019, '2020-05-19 14:56:31.585', 'Alapismeretek', 1006);
INSERT INTO public.theme VALUES (1020, '2020-05-19 14:56:31.585', 'Intézményi közgazdaságtan', 1006);
INSERT INTO public.theme VALUES (1021, '2020-05-19 14:56:31.585', 'Alternatív közgazdaságtan', 1006);
INSERT INTO public.theme VALUES (1022, '2020-05-19 14:56:31.585', 'Büntetőjog 1', 1007);
INSERT INTO public.theme VALUES (1023, '2020-05-19 14:56:31.585', 'Büntetőjog 2', 1007);
INSERT INTO public.theme VALUES (1024, '2020-05-19 14:56:31.585', 'Latin', 1007);
|
-- Script name: inserts.sql
-- Author: Zi Collin Zhen
-- Purpose: insert sample data to test the integrity of this database system
-- !!!!If there's an error, please reference hotelmanagementdbmodel.sql - DROP DATABASE HotelManagementDB comment!!!!
-- the database used to insert the data into.
USE HotelManagementDB;
-- Employee table inserts
INSERT INTO employee (employee_id, email, ssn, name) VALUES (1, 'kiddailey@sbcglobal.net', '680-40-1262', 'Rishi Heath'), (2, 'nichoj@sbcglobal.net', '040-98-7647', 'Talhah Muir'),
(3, 'grinder@att.net', '574-82-7396', 'Kymani Cervantes'),(4, 'afeldspar@gmail.com', '321-28-1580', 'Teddie Tate'),(5, 'luebke@yahoo.ca', '592-18-5202', 'Milo Cohen'),
(6, 'cremonini@me.com', '601-59-0348', 'Mathilda Gomez'),(7, 'miltchev@optonline.net', '397-03-8206', 'Rudi Roy'),(8, 'jmorris@icloud.com', '404-37-6433', 'Diesel Schwartz'),(9, 'ahmad@outlook.com', '505-60-2710', 'Olivia-Grace David'),
(10, 'dburrows@me.com', '430-44-4642', 'Marcus Salt'),(11, 'kawasaki@yahoo.ca', '530-83-2948', 'Faizaan Jaramillo'),(12, 'rddesign@yahoo.ca', '601-42-2183', 'Shannan Collier'),
(13, 'rattenbt@verizon.net', '008-58-7747', 'Darien Duffy'),(14, 'emmanuel@yahoo.com', '042-22-6006', 'Safiyah Woodcock'),(15, 'rgarcia@att.net', '411-78-1574', 'Pooja English'),
(16, 'maratb@optonline.net', '266-57-6869', 'Sanjeev Hills'),(17, 'yfreund@me.com', '658-03-4479', 'Weronika French'),(18, 'tromey@live.com', '574-05-9236', 'Mariam Romero'),
(19, 'hermanab@msn.com', '523-71-9389', 'Callan Bullock'),(20, 'rnewman@outlook.com', '530-82-6792', 'Lindsay Bowler'),(21, 'dodong@att.net', '652-48-8274', 'Melody Ramsey');
-- chef table inserts
INSERT INTO chef (chef_id, employee, name) VALUES (1, 1, 'Rishi Heath'),(2,2,'Talhah Muir'),(3,3,'Kymani Cervantes');
-- engineer table inserts
INSERT INTO engineer (engineer_id, employee, name) VALUES (1, 4,'Teddie Tate'),(2,5,'Milo Cohen'),(3,6,'Mathilda Gomez');
-- housekeeper table inserts
INSERT INTO housekeeper (housekeeper_id, employee, name) VALUES(1,7,'Rudi Roy'),(2,8,'Diesel Schwartz'),(3,9,'Olivia-Grace David');
-- supervisor table inserts
INSERT INTO supervisor (supervisor_id, employee, name) VALUES(1,10,'Marcus Salt'),(2,11,'Faizaan Jaramillo'),(3,12,'Shannan Collier');
-- receptionClerk table inserts
INSERT INTO receptionClerk (receptionClerk_id, employee, name) VALUES(1,13,'Darien Duffy'),(2,14,'Safiyah Woodcock'),(3,15,'Pooja English');
-- manager table inserts
INSERT INTO manager (manager_id, employee, name) VALUES(1,16,'Sanjeev Hills'),(2,17,'Weronika French'),(3,18,'Mariam Romero');
-- roomServicePorter table inserts
INSERT INTO roomServicePorter (roomServicePorter_id, employee, name) VALUES(1,19,'Callan Bullock'),(2,20,'Lindsay Bowler'),(3,21,'Melody Ramsey');
-- hourlyWage table inserts
INSERT INTO hourlyWage(employee, money) VALUE(1,1000),(2,1000),(3,1000),(4,500),(5,500),(6,500),(7,999),(8,999),(9,999),(10,200),(11,200);
-- hoursWorked table inserts
INSERT INTO hoursWorked(employee, money) VALUE(12,200),(13,400),(14,400),(15,400),(16,600),(17,600),(18,600),(19,2000),(20,2000),(21,22000);
-- registerListing table inserts
INSERT INTO registerListing(employee, owner) VALUE(1,1),(2,1),(3,1);
-- owner table inserts
INSERT INTO owner(owner_id, name, email) VALUE(1,'Abby Murray','hmbrand@aol.com'),(2,'Mitchell Bateman','mschilli@comcast.net'),(3,'Hadley Driscoll','philen@yahoo.com');
-- account table inserts
INSERT INTO account (account_id, employee, type, password, created, guest) VALUES (1,1,2,'123456789','2020-05-18',0),(2,2,2,'asdfasd23','2020-02-11',0),(3,0,1,'jasldkjf23','2019-09-01',1);
-- accountType table inserts
INSERT INTO accountType (account_type_id, description) VALUES (1,'Guest Account'),(2,'Employee Account'),(3,'Manager Acccount');
-- supportedFeature table inserts
INSERT INTO supportedFeature (supportedFeature_id, account_type, feature, feedback) VALUES(1,1,1,1),(2,2,2,2),(3,3,3,3);
-- feedback table inserts
INSERT INTO feedback (feedback_id, description, rating) VALUES(1,'fantastic hotel', 5),(2, 'ok hotel', 3),(3, 'decent hotel to stay', 3);
-- feature table inserts
INSERT INTO feature (feature_id, description) VALUES (1,'Guest Features'),(2,'Employee Features'),(3,'Manager features');
-- department table inserts
INSERT INTO department (department_id, description) VALUES(1,'Motel Department'),(2,'Hotel Department'),(3,'Resort Department');
-- engineering table inserts
INSERT INTO engineering (engineering_id, department, name, budget) VALUE (1,1,'Team A',100000),(2,2,'Team A',100000),(3,3,'Team A',100000);
-- foodAndBeverage table inserts
INSERT INTO foodAndBeverage (foodAndBeverage_id, department, name, budget) VALUE(1,1,'Team B',100000),(2,2,'Team B',100000),(3,3,'Team B',100000);
-- humanResource table inserts
INSERT INTO humanResource (humanResource_id, department, name, budget) VALUE(1,1,'Team C',100000),(2,2,'Team C',100000),(3,3,'Team C',100000);
-- salesAndMarketing table inserts
INSERT INTO salesAndMarketing (salesAndMarketing_id, department, name, budget) VALUE(1,1,'Team D',100000),(2,2,'Team D',100000),(3,3,'Team D',100000);
-- accounting table inserts
INSERT INTO accounting (accounting_id, department, name, budget) VALUE(1,1,'Team E',100000),(2,2,'Team E',100000),(3,3,'Team E',100000);
-- roomDivision table inserts
INSERT INTO roomDivision (roomDivision_id, department, name, budget) VALUE(1,1,'Team F',100000),(2,2,'Team F',100000),(3,3,'Team F',100000);
-- gym table inserts
INSERT INTO gym (gym_id, gymName) VALUE(1, 'Raise the Bar Fitness'),(2,'Fit Club'),(3,'Planet Fitness');
-- recreationCenter table inserts
INSERT INTO recreationCenter (recreationCenter_id, recreationCenterName) VALUE(1, 'Minnie and Lovie'),(2,'Potrero Hill'),(3,'Koret Health');
-- pool table inserts
INSERT INTO pool (pool_id, num_of_ppl, time_limit) VALUE(1, 25,60),(2, 50, 60),(3, 100,180);
-- tennisCourt table inserts
INSERT INTO tennisCourt (tennisCourt_id, tennisCourtName) VALUE(1, 'Tenacious Tennis Academy'),(2,'McCoppin Park Tennis Courts'),(3,'GGP Tennis Partners');
-- clothingStore table inserts
INSERT INTO clothingStore (clothingStore_id, store_brand_name ) VALUE(1,'Nike'),(2,'Adidas'),(3,'Gucci');
-- hairSaloon table inserts
INSERT INTO hairSaloon(hairSaloon_id, hairSaloonName, rating) VALUE(1,'Perfect Cut Hair Salon',3),(2,'Ken & Mary Hair Salon',4),(3,'A and k Hair Salon',5);
-- movieTheater table inserts
INSERT INTO movieTheater(movieTheater_id, movieTheaterName,num_movie) VALUE(1,'Four Star Theatre',10),(2,'CineArts at the Empire',15),(3,'AMC Metreon 16',20);
-- jewelryStore table inserts
INSERT INTO jewelryStore(jewelryStore_id,jewelryStoreName, priceRange) VALUE(1,'Geoffreys Diamonds & Goldsmith','medium'),(2,'Kay Jewelers','high'),(3,'Pandora','low');
-- buffet table inserts
INSERT INTO buffet(buffet_id, buffetName, rating ) VALUE(1,'Fiery Hot Pot Buffet',5),(2,'Moonstar',5),(3,'Julies Kitchen',4);
-- restaurant table inserts
INSERT INTO restaurant(restaurant_id, restaurantName, rating) VALUE(1,'Dumpling Kitchen',4),(2,'Toyose',4),(3,'Hongs Kitchen',4);
-- bar table inserts
INSERT INTO bar(bar_id, barName, rating) VALUE(1,'Flanahans Pub',4),(2,'Fire Fly Sports Bar',4),(3,'The Riptide',4);
-- lounge table inserts
INSERT INTO lounge(lounge_id, loungeName, rating) VALUE(1,'Boomerang Cocktail Lounge',3),(2,'Buddha Lounge',5),(3,'Lush Lounge',4);
-- establishment table inserts
INSERT INTO establishment(establishment_id, employee, hotelType,department) VALUE(1,1,1,1),(2,2,2,2),(3,3,3,3);
-- hotelType table inserts
INSERT INTO hotelType(hotelType_id, hotel_type_name,num_room) VALUE(1,'Staypineapple',100),(2,'Holiday Inn',200),(3,'Dream Resort',50);
-- location table inserts
INSERT INTO location(location_id,locationName, locale, hotelType ) VALUE(1,'San Francisco',1,1),(2,'New York',2,2),(3,'Florida',3,3);
-- supportedFacility table inserts
INSERT INTO supportedFacility(supportedFacility_id, hotelType,gym,spa,pool,tennisCourt) VALUE(1,1,1,1,1,1),(2,2,2,2,2,2),(3,3,3,3,3,3);
-- locale table inserts
INSERT INTO locale(locale_id,location_name ) VALUE(1,'Stonestown'),(2,'Lakeshore Plaza'),(3,'Florida Centre');
-- foodVendor table inserts
INSERT INTO foodVendor(foodVendor_id, locale, bar, restaurant, lounge, buffet) VALUE(1,1,1,1,1,1),(2,2,2,2,2,2),(3,3,3,3,3,3);
-- serviceAndRetailVendor table inserts
INSERT INTO serviceAndRetailVendor(serviceAndRetailVendor_id, locale, movieTheater, hairSaloon, clothingStore, jewelryStore) VALUE(1,1,1,1,1,1),(2,2,2,2,2,2),(3,3,3,3,3,3);
-- tourist table inserts
INSERT INTO tourist(tourist_id, touristCountry, locale) VALUE(1, 'China', 1),(2, 'Africa', 2),(3,'Europe',3);
-- databaseSystem table inserts
INSERT INTO databaseSystem(database_id, guest, created, account ) VALUE(1,1,'2020-05-11',1),(2,2,'2020-05-02',2),(3,3,'2020-05-09',3);
-- guests table inserts
INSERT INTO guest(guest_id, name,email,address,post_code,phone,city,state,country) VALUE(1, 'Jesse M Arellano', 'jackolantern@gmail.com','2412 Carter Street', '62220', '618-825-2166','Belleville','IL','United State'),
(2, 'Jeffrey L Hart', 'guapamente@pacifiersshop.life','4319 Shingleton Road', '49007', '269-337-1183','Kalamazoo','MI','United State'),
(3, 'Marie J Beach', 'tklifedqbms@temporary-mail.net','1347 Concord Street', '92369', '704-579-0063','PATTON','CA','United State');
-- room table inserts
INSERT INTO room(room_id,to_date,from_date,roomCategory,guest ) VALUE(1,'2020-05-11','2020-05-15',1,1),(2,'2020-05-02','2020-05-28',2,2),(3,'2020-05-09','2020-05-17',3,3);
-- roomCategory table inserts
INSERT INTO roomCategory(roomCategory_id,name, hotel, guest ) VALUE(1,1,1,1),(2,2,2,2),(3,3,3,3);
-- billingInfo table inserts
INSERT INTO billingInfo(billingInfo_id, invoice, deliveryService, guest, amount ) VALUE(1,1,1,1,45.45),(2,2,2,2,420.45),(3,3,3,3,67.69);
-- deliveryService table inserts
INSERT INTO deliveryService(deliveryService_id, deliveryServiceName) VALUE(1,'Food Delivery'),(2,'Laundry Delivery'),(3,'Amenities Delivery');
-- laundryOrder table inserts
INSERT INTO laundryOrder(laundryOrder_id,order_date,clothe, deliveryService ) VALUE(1,'2020-05-15',1,1),(2,'2020-05-02',2,2),(3,'2020-05-09',3,3);
-- clothe table inserts
INSERT INTO clothe(clothe_id, clotheName, size , price) VALUE(1,'T-Shirt', 'Big', 15),(2,'Jeans','Xtra Large', 40),(3,'Sweater', 'Small', 15);
-- foodOrder table inserts
INSERT INTO foodOrder(foodOrder_id, order_date,meal, deliveryService ) VALUE(1,'2020-05-15',1,1),(2,'2020-06-15',2,2),(3,'2020-07-15',3,3);
-- meal table inserts
INSERT INTO meal(meal_id, mealName, price ) VALUE(1,'Sushi', 40),(2,'Burger',10),(3,'Spaghetti and Meat Balls',20);
-- invoice table inserts
INSERT INTO invoice(invoice_id, status, description) VALUE(1,'Paid','Your balance has been paid.'),(2,'Paid','Your balance has been paid.'),(3,'Overdue','Your balance is overdue for two days.');
-- invoiceInfo table inserts
INSERT INTO invoiceInfo(invoiceInfo_id, paymentType,invoice) VALUE(1,1,1),(2,2,2),(3,3,3);
-- paymentType table inserts
INSERT INTO paymentType(paymentType_id,address,zip_code,country,state,city ) VALUE(1,'2342 Sanputo St.', '23422', 'Africa', 'AF', 'Fan Fan'),(2,'5322 John St.', '22232', 'United Nation', 'UN', 'Izan'),(3,'542 Wonder St.', '2343', 'United States of America', 'CA', 'San Francisco');
-- creditCard table inserts
INSERT INTO creditCard(payment_type,card_number,bank,exp_date,cvv ) VALUE(1,'368194405088870','American Express','2022-11-23',121),(2,'5589981337500028','MasterCard','2022-11-23',555),(3,'4877187570129','Visa', '2022-11-23',333);
-- bankAccount table inserts
INSERT INTO bankAccount(payment_type, acc_number, bank, routing ) VALUE(1,'565777','Bank of America','021000021'),(2,'482917','Chase','011401533'),(3,'262654','Well Fargo','091000019');
-- editReservation table inserts
INSERT INTO editReservation(editReservation_id, room, cancel, date, price, guest ) VALUE(1,50,1,'2020-06-15',22,1),(2,33,33,'2020-05-15',33,2),(3,44,44,'2020-04-15',44,3);
-- priceCategory table inserts
INSERT INTO priceCategory(priceCategory_id,availableRoom,price,hotel,date ) VALUE(1,1,23,2,'2020-05-15'),(2,22,2,2,'2020-06-15'),(3,2,2,2,'2020-07-15') ;
|
-- see SAP note 838725 for info on system stats
begin
-- disable the built in system stats job
dbms_stats.gather_dictionary_stats (
ESTIMATE_PERCENT => NULL,
METHOD_OPT => 'FOR ALL COLUMNS SIZE AUTO',
GRANULARITY => 'ALL',
CASCADE => TRUE,
OPTIONS => 'GATHER',
NO_INVALIDATE => FALSE
);
dbms_stats.gather_fixed_objects_stats(NO_INVALIDATE => FALSE);
end;
/
|
insert into whiskeyTable (name) values ("Jack Daniels");
insert into whiskeyTable (name) values ("Jim Beam");
insert into whiskeyTable (name) values ("Bird Dog");
insert into whiskeyTable (name) values ("Crown Royal"); |
CREATE TABLE [Master].[RoomType] (
[RoomTypeID] INT IDENTITY (1, 1) NOT NULL,
[RoomType] NVARCHAR (20) NOT NULL,
[Rate] DECIMAL (18, 2) NULL,
CONSTRAINT [PK_RoomType] PRIMARY KEY CLUSTERED ([RoomTypeID] ASC)
);
|
-- MySQL dump 10.13 Distrib 5.6.23, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: inikierp
-- ------------------------------------------------------
-- Server version 5.6.21
/*!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 `sevenorderrecordevr`
--
DROP TABLE IF EXISTS `sevenorderrecordevr`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sevenorderrecordevr` (
`evrID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'EIN主鍵',
`sinID` bigint(20) NOT NULL COMMENT '7-11訂單主鍵',
`gcCode` varchar(8) NOT NULL COMMENT '出貨單編號(配送編號)',
`sevrcodeID` int(5) NOT NULL COMMENT '準備退貨類別',
`DCRetDate` date NOT NULL COMMENT '準備退貨日期',
PRIMARY KEY (`evrID`),
KEY `SEVENORDEREVR` (`evrID`),
KEY `sevenOrderRecoredEVR` (`sinID`),
KEY `sevenOrderRecoredEVRCode` (`sevrcodeID`),
CONSTRAINT `sevenOrderRecoredEVR` FOREIGN KEY (`sinID`) REFERENCES `sevenorderrecord` (`sinID`),
CONSTRAINT `sevenOrderRecoredEVRCode` FOREIGN KEY (`sevrcodeID`) REFERENCES `sevenevrcode` (`sevrcodeID`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sevenorderrecordevr`
--
LOCK TABLES `sevenorderrecordevr` WRITE;
/*!40000 ALTER TABLE `sevenorderrecordevr` DISABLE KEYS */;
INSERT INTO `sevenorderrecordevr` VALUES (1,30,'39400027',20,'2013-04-05'),(2,34,'39400029',20,'2013-04-06'),(3,43,'39400039',1,'2013-04-23'),(4,50,'39400045',1,'2013-04-28'),(5,58,'39400053',1,'2013-05-01'),(6,58,'39400052',1,'2013-05-01'),(7,150,'39400151',1,'2013-06-08'),(8,188,'39400189',1,'2013-06-17'),(9,203,'39400203',1,'2013-06-23'),(10,215,'39400215',1,'2013-06-27'),(11,268,'39400266',1,'2013-07-24'),(12,327,'39400324',20,'2013-08-01'),(13,326,'39400323',20,'2013-08-01'),(14,325,'39400322',20,'2013-08-01'),(15,392,'39400387',1,'2013-09-08'),(16,484,'39400486',1,'2013-10-13'),(17,559,'39400554',1,'2013-10-28'),(18,601,'39400592',1,'2013-11-10'),(19,667,'39400659',1,'2013-12-02'),(20,664,'39400656',1,'2013-12-02');
/*!40000 ALTER TABLE `sevenorderrecordevr` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2015-04-21 14:20:31
|
use usc;
DROP TRIGGER IF EXISTS in_b_user_check;
DELIMITER //
CREATE TRIGGER in_b_user_check BEFORE INSERT ON user
FOR EACH ROW
BEGIN
IF EXISTS (SELECT 1 FROM user AS u WHERE u.nu_mobile = NEW.nu_mobile) THEN
SIGNAL sqlstate '45001' set message_text = "User note deleted. This mobile number alredy exists.";
/*ELSEIF NEW.nu_mobile = '00 00000-0000' THEN*/
ELSE
SET NEW.dt_created = CURDATE();
END IF;
END;//
DELIMITER ;
DROP TRIGGER IF EXISTS up_b_user_check;
DELIMITER //
CREATE TRIGGER up_b_user_check BEFORE UPDATE ON user
FOR EACH ROW
BEGIN
IF EXISTS (SELECT 1 FROM user AS u WHERE u.nu_mobile = NEW.nu_mobile AND NEW.nu_mobile <> OLD.nu_mobile) THEN
SIGNAL sqlstate '45002' set message_text = "User note modified. This mobile number alredy exists.";
END IF;
END;//
DELIMITER ;
DROP TRIGGER IF EXISTS de_b_user_check;
DELIMITER //
CREATE TRIGGER de_b_user_check BEFORE DELETE ON user
FOR EACH ROW
BEGIN
IF EXISTS (SELECT 1 FROM user AS u INNER JOIN user as u2 on u.id_user = u2.id_parent_user WHERE u.id_user = OLD.id_user) THEN
SIGNAL sqlstate '45003' set message_text = "User not deleted. There are users under this user (node) in the tree view model.";
END IF;
END;//
DELIMITER ;
|
--
-- 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;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: cards; Type: TABLE; Schema: public; Owner: alexandraplassaras; Tablespace:
--
CREATE TABLE cards (
card_id integer NOT NULL,
card_name character varying(64),
card_debt money,
card_apr integer,
card_date date,
user_id integer
);
ALTER TABLE cards OWNER TO alexandraplassaras;
--
-- Name: cards_card_id_seq; Type: SEQUENCE; Schema: public; Owner: alexandraplassaras
--
CREATE SEQUENCE cards_card_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE cards_card_id_seq OWNER TO alexandraplassaras;
--
-- Name: cards_card_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: alexandraplassaras
--
ALTER SEQUENCE cards_card_id_seq OWNED BY cards.card_id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: alexandraplassaras; Tablespace:
--
CREATE TABLE users (
user_id integer NOT NULL,
email character varying(64),
password character varying(64)
);
ALTER TABLE users OWNER TO alexandraplassaras;
--
-- Name: users_user_id_seq; Type: SEQUENCE; Schema: public; Owner: alexandraplassaras
--
CREATE SEQUENCE users_user_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE users_user_id_seq OWNER TO alexandraplassaras;
--
-- Name: users_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: alexandraplassaras
--
ALTER SEQUENCE users_user_id_seq OWNED BY users.user_id;
--
-- Name: values; Type: TABLE; Schema: public; Owner: alexandraplassaras; Tablespace:
--
CREATE TABLE "values" (
value_id integer NOT NULL,
money_spent_high boolean,
money_spent_low boolean,
time_1 boolean,
time_2 boolean,
time_3 boolean,
money_amnt_low boolean,
money_amnt_high boolean,
user_id integer
);
ALTER TABLE "values" OWNER TO alexandraplassaras;
--
-- Name: values_value_id_seq; Type: SEQUENCE; Schema: public; Owner: alexandraplassaras
--
CREATE SEQUENCE values_value_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE values_value_id_seq OWNER TO alexandraplassaras;
--
-- Name: values_value_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: alexandraplassaras
--
ALTER SEQUENCE values_value_id_seq OWNED BY "values".value_id;
--
-- Name: card_id; Type: DEFAULT; Schema: public; Owner: alexandraplassaras
--
ALTER TABLE ONLY cards ALTER COLUMN card_id SET DEFAULT nextval('cards_card_id_seq'::regclass);
--
-- Name: user_id; Type: DEFAULT; Schema: public; Owner: alexandraplassaras
--
ALTER TABLE ONLY users ALTER COLUMN user_id SET DEFAULT nextval('users_user_id_seq'::regclass);
--
-- Name: value_id; Type: DEFAULT; Schema: public; Owner: alexandraplassaras
--
ALTER TABLE ONLY "values" ALTER COLUMN value_id SET DEFAULT nextval('values_value_id_seq'::regclass);
--
-- Data for Name: cards; Type: TABLE DATA; Schema: public; Owner: alexandraplassaras
--
COPY cards (card_id, card_name, card_debt, card_apr, card_date, user_id) FROM stdin;
1 Visa 123 $2,022.00 15 \N \N
\.
--
-- Name: cards_card_id_seq; Type: SEQUENCE SET; Schema: public; Owner: alexandraplassaras
--
SELECT pg_catalog.setval('cards_card_id_seq', 1, true);
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: alexandraplassaras
--
COPY users (user_id, email, password) FROM stdin;
1 aplass@gmail.com debt
\.
--
-- Name: users_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: alexandraplassaras
--
SELECT pg_catalog.setval('users_user_id_seq', 1, true);
--
-- Data for Name: values; Type: TABLE DATA; Schema: public; Owner: alexandraplassaras
--
COPY "values" (value_id, money_spent_high, money_spent_low, time_1, time_2, time_3, money_amnt_low, money_amnt_high, user_id) FROM stdin;
\.
--
-- Name: values_value_id_seq; Type: SEQUENCE SET; Schema: public; Owner: alexandraplassaras
--
SELECT pg_catalog.setval('values_value_id_seq', 1, false);
--
-- Name: cards_pkey; Type: CONSTRAINT; Schema: public; Owner: alexandraplassaras; Tablespace:
--
ALTER TABLE ONLY cards
ADD CONSTRAINT cards_pkey PRIMARY KEY (card_id);
--
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: alexandraplassaras; Tablespace:
--
ALTER TABLE ONLY users
ADD CONSTRAINT users_pkey PRIMARY KEY (user_id);
--
-- Name: values_pkey; Type: CONSTRAINT; Schema: public; Owner: alexandraplassaras; Tablespace:
--
ALTER TABLE ONLY "values"
ADD CONSTRAINT values_pkey PRIMARY KEY (value_id);
--
-- Name: cards_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: alexandraplassaras
--
ALTER TABLE ONLY cards
ADD CONSTRAINT cards_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(user_id);
--
-- Name: values_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: alexandraplassaras
--
ALTER TABLE ONLY "values"
ADD CONSTRAINT values_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(user_id);
--
-- Name: public; Type: ACL; Schema: -; Owner: alexandraplassaras
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM alexandraplassaras;
GRANT ALL ON SCHEMA public TO alexandraplassaras;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
|
--
-- Create contract table
--
create table contract (
id int not null identity,
body varchar(512) not null
);
|
CREATE TABLE Ofertas(
id int,
precioEstadia double precision NOT NULL,
nombre varchar(32) NOT NULL,
FechaPublicacion Date NOT NULL,
descripcion varchar(32),
alojamientoId int NOT NULL,
operador int NOT NULL,
capacidad int not null,
CONSTRAINT PKoferta PRIMARY KEY (id),
CONSTRAINT FKofertaAlojamiento FOREIGN KEY (alojamientoId) REFERENCES Alojamientos(id),
CONSTRAINT FKoperaAloj FOREIGN KEY (operador) REFERENCES Operadores(id)
);
--CREO RESERVAS
CREATE TABLE Reservas(
id int,
FechaLlegada Date NOT NULL,
recargo double precision NOT NULL,
cantidadDias int NOT NULL,
oferta int NOT NULL,
vigente char(1) NOT NULL,
CONSTRAINT CKvigente CHECK (vigente = 'Y' OR vigente='N'),
CONSTRAINT PKreservaaa PRIMARY KEY (id),
CONSTRAINT FKofertaRese FOREIGN KEY (oferta) REFERENCES Ofertas(id)
);
CREATE TABLE RESERVASCLIENTE(
clienteid int,
reservaid int,
CONSTRAINT PKreservascliente PRIMARY KEY (clienteid,reservaid),
CONSTRAINT FKclienteidres FOREIGN KEY (clienteid) REFERENCES clientes(documento),
CONSTRAINT FKreservasClie FOREIGN KEY (reservaid) REFERENCES reservas (id)
);
CREATE TABLE ServiciosDeAlojamientos(
servicio int,
alojamiento int,
CONSTRAINT PKServiciosDeAlojamientos PRIMARY KEY(servicio,alojamiento),
CONSTRAINT FKalojamientoServsAlojs FOREIGN KEY (alojamiento) REFERENCES alojamientos(id),
CONSTRAINT FKservicioServsAlojs FOREIGN KEY (servicio) REFERENCES Servicios(id)
);
CREATE TABLE ServiciosDeOperadores(
servicio int,
operador int,
CONSTRAINT PKServiciosOperadores PRIMARY KEY(operador,servicio),
CONSTRAINT FKoperadorServiciosOperadores FOREIGN KEY (operador) REFERENCES Operadores(id),
CONSTRAINT FKservicioServiciosOperadores FOREIGN KEY (servicio) REFERENCES Servicios(id)
); |
drop database if exists mb;
create database mb;
use mb;
create table if not exists mb_user(
id int primary key AUTO_INCREMENT,
nickname varchar(20) not null,
pw varchar(50) not null,
email varchar(50) not null,
gender char(2) not NULL,
address varchar(100),
phone_number varchar(20),
introduction varchar(256),
personal_tag varchar(256),
work_at varchar(50),
profile_url varchar(256),
verified tinyint default 0,
create_datetime datetime not null
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1000;
create table if not exists mb_user_delete(
id int primary key AUTO_INCREMENT,
nickname varchar(20) not null,
pw varchar(50) not null,
email varchar(50) not null,
gender char(2) not NULL,
address varchar(100),
phone_number varchar(20),
introduction varchar(256),
personal_tag varchar(256),
work_at varchar(50),
profile_url varchar(256),
verified tinyint default 0,
create_datetime datetime not null
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1000;
create table if not exists mb_user_addinfo(
id int primary key auto_increment,
friend_category text,
privacy_settting tinyint,
notification_setting tinyint,
black_list text
) default CHARSET=utf8 auto_increment = 1000;
CREATE TABLE IF NOT EXISTS `mb_post` (
`id` int primary key AUTO_INCREMENT,
`uid` int not null,
`content` text NOT NULL,
`images_url` text,
retransmission_id int,
topic_id int,
`create_time` datetime NOT NULL
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1000;
CREATE TABLE IF NOT EXISTS `mb_user_relation` (
`uid` int NOT NULL,
`fid` int not null,
friend_category varchar(20),
`id` int primary key AUTO_INCREMENT,
remark_name varchar(20),
create_time datetime not null
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1000;
create table if not exists mb_comment(
id int primary key auto_increment,
pid int not null,
uid int not null,
content text not null,
create_date datetime not null
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1000;
CREATE TABLE IF NOT EXISTS `mb_private_message` (
`id` int primary key AUTO_INCREMENT,
`uid` int NOT NULL,
pid int not null,
`content` text NOT NULL,
`create_time` datetime NOT NULL
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1000;
CREATE TABLE IF NOT EXISTS `mb_message_at` (
`id` int primary key AUTO_INCREMENT,
`uid` int NOT NULL,
`pid` int NOT NULL,
`create_time` datetime NOT NULL
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1000;
create table if not exists mb_collection(
id int primary key auto_increment,
uid int not null,
pid int not null,
create_time datetime not NULL
) default CHARSET=utf8 auto_increment=1000;
create table if not exists mb_love(
id int primary key auto_increment,
uid int not null,
pid int not null,
create_time datetime not null
) default CHARSET=utf8 auto_increment=1000;
create table if not exists mb_user_advice(
id int primary key auto_increment,
uid int not null,
content text not null,
image_url text,
create_time datetime not null
) default CHARSET=utf8 auto_increment=1000;
create table if not exists mb_veri_info(
id int primary key auto_increment,
uid int not null,
veri_type tinyint not null,
citizen_id_name varchar(20) not null,
citizen_id_num varchar(20) not null,
phone_number varchar(20) not null,
veri_reason text not null,
veri_file_url varchar(256) not null,
veri_status tinyint not null,
create_time datetime not null
) default CHARSET=utf8 auto_increment=1000;
create table if not exists mb_topic(
id int primary key auto_increment,
create_uid int not null,
topic_name varchar(256) not null,
topic_image varchar(256),
create_time datetime not null
) default CHARSET=utf8 auto_increment=1000;
create table if not exists mb_user_reported(
id int primary key auto_increment,
uid int not null,
reported_uid int not null,
status tinyint not null,
reported_content text not null,
create_time datetime not null
) default CHARSET=utf8 auto_increment=1000;
create table if not exists mb_post_reported(
id int primary key auto_increment,
uid int not null,
reported_pid int not null,
reported_content text not null,
status tinyint not null,
create_time datetime not null
) default CHARSET=utf8 auto_increment=1000;
create table if not exists mb_sys_message(
id int primary key auto_increment,
uid int not null,
sender_uid int not null,
content text not null,
mess_type tinyint not null,
create_time datetime not null
) default CHARSET=utf8 auto_increment=1000
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.