blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 3 276 | src_encoding stringclasses 33
values | length_bytes int64 23 9.61M | score float64 2.52 5.28 | int_score int64 3 5 | detected_licenses listlengths 0 44 | license_type stringclasses 2
values | text stringlengths 23 9.43M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
2583f8ca6c058a94906791b5560ada2c3bd01ede | SQL | cdesmarais/WebDB-Test | /WebDB/StoredProcedures/Common/dbo.Admin_GetRIDCount_ForSurvey.PRC | UTF-8 | 614 | 3.359375 | 3 | [] | no_license |
/****** Object: StoredProcedure [dbo].[Admin_GetRIDCount_ForSurvey] Script Date: 03/26/2013 10:44:27 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Admin_GetRIDCount_ForSurvey]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[Admin_GetRIDCount_ForSurvey]
GO
CREATE PROCEDURE [dbo].[Admin_GetRIDCount_ForSurvey]
@RID int
AS
Set nocount on
Set transaction isolation level read uncommitted
select top 1 RestaurantSurveyID from RestaurantSurveyRestaurants where RID = @RID
GO
-- Set Permission
GRANT EXECUTE ON [Admin_GetRIDCount_ForSurvey] TO ExecuteOnlyRole
GO
| true |
dac907d604bdfc80c86af2e097608850bb8e58da | SQL | coodesoft/webTicketAPI | /sql/21-8-18-2.sql | UTF-8 | 640 | 3.09375 | 3 | [
"BSD-3-Clause"
] | permissive | ALTER TABLE `zona` ADD `final` BOOLEAN NOT NULL DEFAULT TRUE COMMENT 'Este campo indica si al seleccionar esta zona en algun formulario se puede entender que se completó la selección de zonas' AFTER `nivel`;
ALTER TABLE `zona` ADD `denominacion` SMALLINT NOT NULL AFTER `final`;
CREATE TABLE `creoprop`.`zona_denominacion` ( `id` INT NOT NULL AUTO_INCREMENT , `nombre` VARCHAR(100) NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
INSERT INTO `zona_denominacion` (`id`, `nombre`) VALUES (1, 'País'), (2, 'Provincia'), (3, 'Ciudad'), (4, 'Barrio'), (5, 'Zona');
ALTER TABLE `propiedades` ADD `zona_id` INT NOT NULL AFTER `mov_reducida`;
| true |
cd261e15b171b1b44e93f8644013780622761618 | SQL | johnkz1981/database_march | /lesson2/alter_table_example.sql | UTF-8 | 1,638 | 3.78125 | 4 | [] | no_license | RENAME TABLE Countries TO countries;
RENAME TABLE Areas TO regions;
RENAME TABLE Cities TO cities;
ALTER TABLE countries RENAME COLUMN Name TO name;
ALTER TABLE regions RENAME COLUMN Name TO name;
ALTER TABLE regions RENAME COLUMN Countries_id TO country_id;
ALTER TABLE cities DROP FOREIGN KEY fk_Cities_Areas1;
ALTER TABLE regions MODIFY COLUMN id INT NOT NULL;
ALTER TABLE regions DROP PRIMARY KEY;
ALTER TABLE regions ADD CONSTRAINT regions_pk PRIMARY KEY (id);
ALTER TABLE regions RENAME INDEX fk_Areas_Countries_idx TO fk_regions_countries_idx;
ALTER TABLE regions DROP FOREIGN KEY fk_Areas_Countries;
ALTER TABLE regions ADD CONSTRAINT fk_regions_countries
FOREIGN KEY (country_id)
REFERENCES countries(id);
ALTER TABLE cities
RENAME COLUMN Name TO name,
RENAME COLUMN Areas_id TO region_id,
DROP COLUMN Areas_countries_id;
ALTER TABLE cities MODIFY id INT NOT NULL;
ALTER TABLE cities DROP PRIMARY KEY;
ALTER TABLE cities ADD PRIMARY KEY (id);
ALTER TABLE cities MODIFY id INT NOT NULL AUTO_INCREMENT;
ALTER TABLE regions MODIFY id INT NOT NULL AUTO_INCREMENT;
ALTER TABLE cities RENAME INDEX fk_Cities_Areas1_idx TO fk_cities_regions_idx;
CREATE TABLE districts (
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
name VARCHAR(150) NOT NULL,
region_id INT NOT NULL,
CONSTRAINT fk_districts_regions
FOREIGN KEY (region_id)
REFERENCES regions(id)
ON DELETE CASCADE
);
ALTER TABLE cities
ADD COLUMN district_id INT,
ADD CONSTRAINT fk_cities_districts
FOREIGN KEY (district_id)
REFERENCES districts(id);
ALTER TABLE cities
ADD COLUMN detailed_type ENUM('city', 'village', 'settlement');
| true |
6eb5b2734371b03a649de0108ff9bf14a2f625cb | SQL | jrunzer26/CloudCodingEnv | /myapp/database/schema.sql | UTF-8 | 1,166 | 3.609375 | 4 | [
"MIT"
] | permissive | DROP TABLE IF EXISTS Users CASCADE;
DROP TABLE IF EXISTS Quizzes CASCADE;
DROP TABLE IF EXISTS Questions CASCADE;
DROP TABLE IF EXISTS Answers CASCADE;
DROP TABLE IF EXISTS QuizResults CASCADE;
DROP TABLE IF EXISTS Programs CASCADE;
CREATE TABLE Users (
"email" text PRIMARY KEY,
"firstName" text,
"lastName" text,
"role" text
);
CREATE TABLE Quizzes (
"id" serial PRIMARY KEY,
"name" text NOT NULL,
"expDate" timestamp,
"creator" text references Users ("email")
);
CREATE TABLE Questions (
"id" serial PRIMARY KEY,
"question" text NOT NULL,
"quizID" integer references Quizzes ("id") ON DELETE CASCADE
);
CREATE TABLE Answers (
"id" serial PRIMARY KEY,
"value" text NOT NULL,
"correctAnswer" boolean NOT NULL,
"questionID" integer references Questions ("id") ON DELETE CASCADE
);
CREATE TABLE QuizResults (
"id" serial PRIMARY KEY,
"quizID" integer references Quizzes("id") ON DELETE CASCADE,
"dateCompleted" timestamp default current_timestamp,
"email" text references Users("email"),
"mark" decimal
);
CREATE TABLE Programs (
"name" text PRIMARY KEY,
"data" text
); | true |
07ab16ad4e966118b86678ca03e4a810258f82dd | SQL | ZVlad1980/excel_api | /test/residents/check_status.sql | UTF-8 | 516 | 3.375 | 3 | [] | no_license | select extract(year from a.date_op) year,
a.nom_vkl,
a.nom_ips,
a.shifr_schet,
a.sub_shifr_schet,
sum(a.amount) amount
from dv_sr_lspv_acc_v a
where a.nom_vkl = 257
and a.nom_ips = 37
and a.date_op > to_date(20170101, 'yyyymmdd')
and a.charge_type = 'TAX'
group by extract(year from a.date_op),
a.nom_vkl,
a.nom_ips,
a.shifr_schet,
a.sub_shifr_schet
order by year, a.shifr_schet, a.sub_shifr_schet
/
select *
from sp_tax_residents_v nn
| true |
ae2eeb8e3f3bf066253b1ed5c04a21567be2c876 | SQL | dewhitee/snippets | /sql/join/all_genres_of_artist.sql | UTF-8 | 219 | 3.5 | 4 | [
"MIT"
] | permissive | select track.title, artist.name, genre.name
from track join genre join album join artist on
track.genre_id = genre.genre_id and track.album_id = album.album_id and album.artist_id = artist.artist_id
order by album.name; | true |
46c22ba411fcfa6410d309b5cd4ceea212914fe2 | SQL | Vanyok/eventsCalendar | /db_ini.sql | UTF-8 | 8,027 | 2.953125 | 3 | [
"BSD-3-Clause"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: May 19, 2017 at 11:00 PM
-- Server version: 5.7.18-0ubuntu0.16.04.1
-- PHP Version: 7.0.19-1+deb.sury.org~xenial+1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `c_events`
--
-- --------------------------------------------------------
--
-- Table structure for table `event`
--
CREATE TABLE `event` (
`id` int(11) NOT NULL,
`name` text NOT NULL,
`date_start` datetime NOT NULL,
`time_start` int(11) NOT NULL DEFAULT '0',
`time_end` int(11) NOT NULL DEFAULT '0',
`date_end` datetime NOT NULL,
`description` text NOT NULL,
`user_id` int(11) NOT NULL,
`status` int(11) NOT NULL,
`color` varchar(8) NOT NULL,
`is_removed` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `invite`
--
CREATE TABLE `invite` (
`id` int(11) NOT NULL,
`mail` text,
`token` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `migration`
--
CREATE TABLE `migration` (
`version` varchar(180) NOT NULL,
`apply_time` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `migration`
--
INSERT INTO `migration` (`version`, `apply_time`) VALUES
('m000000_000000_base', 1495041293),
('m140209_132017_init', 1495041300),
('m140403_174025_create_account_table', 1495041301),
('m140504_113157_update_tables', 1495041306),
('m140504_130429_create_token_table', 1495041308),
('m140830_171933_fix_ip_field', 1495041309),
('m140830_172703_change_account_table_name', 1495041309),
('m141222_110026_update_ip_field', 1495041310),
('m141222_135246_alter_username_length', 1495041311),
('m150614_103145_update_social_account_table', 1495041314),
('m150623_212711_fix_username_notnull', 1495041314),
('m151218_234654_add_timezone_to_profile', 1495041314),
('m160929_103127_add_last_login_at_to_user_table', 1495041315);
-- --------------------------------------------------------
--
-- Table structure for table `profile`
--
CREATE TABLE `profile` (
`user_id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`public_email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`gravatar_email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`gravatar_id` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`website` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`bio` text COLLATE utf8_unicode_ci,
`timezone` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `profile`
--
INSERT INTO `profile` (`user_id`, `name`, `public_email`, `gravatar_email`, `gravatar_id`, `location`, `website`, `bio`, `timezone`) VALUES
(1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `social_account`
--
CREATE TABLE `social_account` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`provider` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`client_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`data` text COLLATE utf8_unicode_ci,
`code` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` int(11) DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`username` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `token`
--
CREATE TABLE `token` (
`user_id` int(11) NOT NULL,
`code` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`created_at` int(11) NOT NULL,
`type` smallint(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `token`
--
INSERT INTO `token` (`user_id`, `code`, `created_at`, `type`) VALUES
(1, 'vuzICtST2HSSgZlq1xtG7ACfMXEZqi-C', 1495085109, 0);
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password_hash` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`confirmed_at` int(11) DEFAULT NULL,
`unconfirmed_email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`blocked_at` int(11) DEFAULT NULL,
`registration_ip` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`flags` int(11) NOT NULL DEFAULT '0',
`last_login_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `username`, `email`, `password_hash`, `auth_key`, `confirmed_at`, `unconfirmed_email`, `blocked_at`, `registration_ip`, `created_at`, `updated_at`, `flags`, `last_login_at`) VALUES
(1, 'admin', 'admin@mail.com', '$2y$12$KB.sz.D4IL89YCd6Dv1EPe88cDwSATY2//U6FzgXvOwxhlUSgYGJS', 'CHxYMp1bVKydIKG8xncoiFKIxL7xshv6', 1495085109, NULL, NULL, '127.0.0.1', 1495085109, 1495085109, 0, 1495206766),
-- Indexes for dumped tables
--
--
-- Indexes for table `event`
--
ALTER TABLE `event`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `invite`
--
ALTER TABLE `invite`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migration`
--
ALTER TABLE `migration`
ADD PRIMARY KEY (`version`);
--
-- Indexes for table `profile`
--
ALTER TABLE `profile`
ADD PRIMARY KEY (`user_id`);
--
-- Indexes for table `social_account`
--
ALTER TABLE `social_account`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `account_unique` (`provider`,`client_id`),
ADD UNIQUE KEY `account_unique_code` (`code`),
ADD KEY `fk_user_account` (`user_id`);
--
-- Indexes for table `token`
--
ALTER TABLE `token`
ADD UNIQUE KEY `token_unique` (`user_id`,`code`,`type`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `user_unique_username` (`username`),
ADD UNIQUE KEY `user_unique_email` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `event`
--
ALTER TABLE `event`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `invite`
--
ALTER TABLE `invite`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `social_account`
--
ALTER TABLE `social_account`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `profile`
--
--ALTER TABLE `profile`
-- ADD CONSTRAINT `fk_user_profile` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `social_account`
--
--ALTER TABLE `social_account`
-- ADD CONSTRAINT `fk_user_account` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `token`
--
--ALTER TABLE `token`
-- ADD CONSTRAINT `fk_user_token` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
1693607788765e0881fca15b2dcd4d661480ad7b | SQL | sp-autotest/billing-admin | /src/main/resources/sql/postgres/schema.sql | UTF-8 | 43,904 | 3.578125 | 4 | [] | no_license | drop table if exists billing_file cascade;
drop table if exists billing_terminal cascade;
drop table if exists bo_file cascade;
drop table if exists report_file cascade;
drop table if exists country_currency cascade;
drop table if exists file_record cascade;
drop table if exists posting_file cascade;
drop table if exists processing_file cascade;
drop table if exists processing_record cascade;
drop table if exists system_settings cascade;
--drop TABLE if EXISTS "users" CASCADE ;
--drop table if exists user_history CASCADE ;
--drop table if exists carrier CASCADE ;
--drop table if exists terminal CASCADE ;
--drop table if exists terminal_countrycurrency CASCADE ;
drop sequence SEQ_COUNTRY_CURRENCY;
drop sequence SEQ_OPTIONS;
drop sequence SEQ_PROCESSING_FILE;
drop sequence SEQ_PROCESSING_RECORD;
--drop sequence SEQ_TERMINAL;
--drop sequence SEQ_CARRIER;
--drop sequence SEQ_USER;
--drop sequence SEQ_USER_HISTORY;
CREATE TABLE country_currency
(
id bigint NOT NULL,
country_code character varying(255) NOT NULL,
currency_numeric_code integer NOT NULL,
CONSTRAINT country_currency_pkey PRIMARY KEY (id),
CONSTRAINT country_currency_country_code_currency_numeric_code_key UNIQUE (country_code, currency_numeric_code)
);
CREATE TABLE billing_terminal
(
country_code character varying(255) NOT NULL,
terminal_id character varying(255) NOT NULL,
CONSTRAINT billing_terminal_pkey PRIMARY KEY (country_code)
);
CREATE TABLE system_settings
(
id bigint NOT NULL,
encoder character varying(255),
modifier character varying(255),
modify_date timestamp without time zone,
name character varying(255) NOT NULL,
value character varying(255),
visibility character varying(255),
CONSTRAINT system_settings_pkey PRIMARY KEY (id),
CONSTRAINT system_settings_name_key UNIQUE (name)
);
CREATE TABLE processing_file
(
id bigint NOT NULL,
business_date date,
created_date timestamp without time zone,
file_type character varying(255),
name character varying(255),
original_file_name character varying(255),
parent_id bigint,
CONSTRAINT processing_file_pkey PRIMARY KEY (id)
);
CREATE TABLE billing_file
(
count_lines integer,
format character varying(255) NOT NULL,
processing_date timestamp without time zone,
id bigint NOT NULL,
fk_carrier_id bigint,
CONSTRAINT billing_file_pkey PRIMARY KEY (id)
);
CREATE TABLE bo_file
(
format character varying(255) NOT NULL,
id bigint NOT NULL,
fk_carrier_id bigint,
CONSTRAINT bo_file_pkey PRIMARY KEY (id)
);
CREATE TABLE report_file
(
id bigint NOT NULL,
CONSTRAINT report_file_pkey PRIMARY KEY (id)
);
CREATE TABLE posting_file
(
format character varying(255) NOT NULL,
id bigint NOT NULL,
CONSTRAINT posting_file_pkey PRIMARY KEY (id)
);
CREATE TABLE file_record
(
file_id bigint NOT NULL,
record_id bigint NOT NULL,
CONSTRAINT file_record_pkey PRIMARY KEY (file_id, record_id)
);
CREATE TABLE processing_record
(
id bigint NOT NULL,
amount integer,
amount_mps integer,
amount_rub integer,
approval_code character varying(255),
country_code character varying(255),
create_date timestamp without time zone,
currency character varying(255),
document_date character varying(255),
document_number character varying(255),
error_message character varying(255),
expiry character varying(255),
invoice_date character varying(255),
invoice_number character varying(255),
pan character varying(255),
rate_cb character varying(255),
rate_mps character varying(255),
rbs_id character varying(255),
ref_num character varying(255),
status character varying(255),
transaction_type character varying(255),
parent_id bigint,
fk_carrier_id bigint,
utrnno character varying(20),
CONSTRAINT processing_record_pkey PRIMARY KEY (id),
CONSTRAINT processing_record_rbs_id_key UNIQUE (rbs_id)
);
create index approval_code_index on processing_record (approval_code);
create index document_number_index on processing_record (document_number);
create index pan_index on processing_record (pan);
create table users (
id bigint not null,
username character varying (100),
password character varying (100),
updated_at timestamp without time zone,
credentials_expired_at timestamp without time zone,
is_locked boolean default false,
is_enabled boolean default false,
is_account_expired boolean default false,
password_history character varying(1000),
roles character varying(1000),
CONSTRAINT users_pkey PRIMARY KEY (id),
CONSTRAINT users_username UNIQUE (username)
);
create table user_history (
id bigint not null,
user_id bigint,
created_at timestamp without time zone,
action character varying(100),
old_value character varying(255),
new_value character varying(255),
message character varying(255),
status boolean default null,
CONSTRAINT user_history_pkey PRIMARY KEY (id)
);
create sequence SEQ_COUNTRY_CURRENCY;
create sequence SEQ_OPTIONS;
create sequence SEQ_PROCESSING_FILE;
create sequence SEQ_PROCESSING_RECORD;
create sequence SEQ_USER;
create sequence SEQ_USER_HISTORY;
CREATE TABLE billing_system
(
id BIGINT NOT NULL
CONSTRAINT billing_system_pkey
PRIMARY KEY,
created_date TIMESTAMP,
enabled BOOLEAN,
host_address VARCHAR(255),
login VARCHAR(255),
mask_regexp VARCHAR(255),
name VARCHAR(255)
CONSTRAINT billing_system_name_key
UNIQUE,
password VARCHAR(255),
path VARCHAR(255),
sftp_port INTEGER,
carrier_id BIGINT
CONSTRAINT fk79be9c7389ba607
REFERENCES carrier
);
CREATE TABLE billing_systems_emails
(
id BIGINT NOT NULL
CONSTRAINT fk283ec716a66b4f32
REFERENCES billing_system,
emails VARCHAR(200)
);
--admin/pivot43\very
insert into users (updated_at, credentials_expired_at, is_account_expired, is_enabled, is_locked, password, password_history, username, id, roles) values (now(), null, '0', '1', '0', '95d05639c6dca65c9d68cdd55415af8b11631206ba97e1713415942e64e1006ad414fcb289e95889', '95d05639c6dca65c9d68cdd55415af8b11631206ba97e1713415942e64e1006ad414fcb289e95889;', 'admin', nextval('SEQ_USER'), null);
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'AU','036');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'AT','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'AZ','944');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'AL','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'BE','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'BA','977');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'GB','826');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'HU','348');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'DE','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'HK','344');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'GR','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'DK','208');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'EG','818');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'JO','400');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'IE','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'ES','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'IT','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'KZ','398');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'CA','124');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'CY','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'QZ','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'LV','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'LB','840');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'LT','440');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'LT','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'IL','840');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'LU','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'MK','807');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'MY','458');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'NI','840');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'NZ','554');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'NO','578');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'AE','784');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'PA','840');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'PL','985');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'PT','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'RO','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'SA','682');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'RS','941');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'SK','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'SI','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'US','840');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'TH','764');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'TW','901');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'TR','949');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'UA','980');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'FI','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'FR','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'HR','191');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'ME','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'CZ','203');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'CH','756');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'SE','752');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'EE','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'KR','410');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'JP','392');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'CN','156');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'IN','356');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'LK','144');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'MN','496');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'BG','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'BG','975');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'GL','208');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'IS','352');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'AD','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'PM','124');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'BM','060');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'OM','512');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'QA','634');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'BH','048');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'MD','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'KH','116');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'KH','840');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'GF','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'MC','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'CK','554');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'VN','704');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'VN','840');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'MO','446');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'CR','188');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'KI','036');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'FJ','242');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'WS','882');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'TO','776');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'GI','826');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'KG','417');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'SM','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'GP','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'MQ','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'RE','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'LI','756');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'ID','840');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'YT','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'NL','978');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'SG','702');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'PH','608');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'GE','981');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'PH','840');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'RU', '643');
insert into country_currency (id, country_code, currency_numeric_code) values (nextval('SEQ_COUNTRY_CURRENCY'),'RU', '810');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AB-terminal', 'AB');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AU-terminal', 'AU');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AT-terminal', 'AT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AZ-terminal', 'AZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AL-terminal', 'AL');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('DZ-terminal', 'DZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AS-terminal', 'AS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AI-terminal', 'AI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AO-terminal', 'AO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AD-terminal', 'AD');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AQ-terminal', 'AQ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AG-terminal', 'AG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AR-terminal', 'AR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AM-terminal', 'AM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AW-terminal', 'AW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AF-terminal', 'AF');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BS-terminal', 'BS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BD-terminal', 'BD');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BB-terminal', 'BB');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BH-terminal', 'BH');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BY-terminal', 'BY');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BZ-terminal', 'BZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BE-terminal', 'BE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BJ-terminal', 'BJ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BM-terminal', 'BM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BG-terminal', 'BG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BO-terminal', 'BO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BQ-terminal', 'BQ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BA-terminal', 'BA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BW-terminal', 'BW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BR-terminal', 'BR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('IO-terminal', 'IO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BN-terminal', 'BN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BF-terminal', 'BF');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BI-terminal', 'BI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BT-terminal', 'BT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('VU-terminal', 'VU');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('HU-terminal', 'HU');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('VE-terminal', 'VE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('VG-terminal', 'VG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('VI-terminal', 'VI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('VN-terminal', 'VN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GA-terminal', 'GA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('HT-terminal', 'HT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GY-terminal', 'GY');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GM-terminal', 'GM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GH-terminal', 'GH');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GP-terminal', 'GP');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GT-terminal', 'GT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GN-terminal', 'GN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GW-terminal', 'GW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('DE-terminal', 'DE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GG-terminal', 'GG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GI-terminal', 'GI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('HN-terminal', 'HN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('HK-terminal', 'HK');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GD-terminal', 'GD');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GL-terminal', 'GL');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GR-terminal', 'GR');
--INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GE-terminal', 'GE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GU-terminal', 'GU');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('DK-terminal', 'DK');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('JE-terminal', 'JE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('DJ-terminal', 'DJ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('DM-terminal', 'DM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('DO-terminal', 'DO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('EG-terminal', 'EG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ZM-terminal', 'ZM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('EH-terminal', 'EH');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ZW-terminal', 'ZW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('IL-terminal', 'IL');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('IN-terminal', 'IN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ID-terminal', 'ID');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('JO-terminal', 'JO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('IQ-terminal', 'IQ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('IR-terminal', 'IR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('IE-terminal', 'IE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('IS-terminal', 'IS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ES-terminal', 'ES');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('IT-terminal', 'IT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('YE-terminal', 'YE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CV-terminal', 'CV');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KZ-terminal', 'KZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KH-terminal', 'KH');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CM-terminal', 'CM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CA-terminal', 'CA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('QA-terminal', 'QA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KE-terminal', 'KE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CY-terminal', 'CY');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KG-terminal', 'KG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KI-terminal', 'KI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CN-terminal', 'CN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CC-terminal', 'CC');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CO-terminal', 'CO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KM-terminal', 'KM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CG-terminal', 'CG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CD-terminal', 'CD');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KP-terminal', 'KP');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KR-terminal', 'KR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CR-terminal', 'CR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CI-terminal', 'CI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CU-terminal', 'CU');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KW-terminal', 'KW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CW-terminal', 'CW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LA-terminal', 'LA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LV-terminal', 'LV');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LS-terminal', 'LS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LB-terminal', 'LB');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LY-terminal', 'LY');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LR-terminal', 'LR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LI-terminal', 'LI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LT-terminal', 'LT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LU-terminal', 'LU');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MU-terminal', 'MU');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MR-terminal', 'MR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MG-terminal', 'MG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('YT-terminal', 'YT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MO-terminal', 'MO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MW-terminal', 'MW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MY-terminal', 'MY');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ML-terminal', 'ML');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('UM-terminal', 'UM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MV-terminal', 'MV');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MT-terminal', 'MT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MA-terminal', 'MA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MQ-terminal', 'MQ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MH-terminal', 'MH');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MX-terminal', 'MX');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('FM-terminal', 'FM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MZ-terminal', 'MZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MD-terminal', 'MD');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MC-terminal', 'MC');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MN-terminal', 'MN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MS-terminal', 'MS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MM-terminal', 'MM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NA-terminal', 'NA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NR-terminal', 'NR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NP-terminal', 'NP');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NE-terminal', 'NE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NG-terminal', 'NG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NL-terminal', 'NL');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NI-terminal', 'NI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NU-terminal', 'NU');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NZ-terminal', 'NZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NC-terminal', 'NC');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NO-terminal', 'NO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AE-terminal', 'AE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('OM-terminal', 'OM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BV-terminal', 'BV');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('IM-terminal', 'IM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('NF-terminal', 'NF');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CX-terminal', 'CX');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('HM-terminal', 'HM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KY-terminal', 'KY');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CK-terminal', 'CK');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TC-terminal', 'TC');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PK-terminal', 'PK');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PW-terminal', 'PW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PS-terminal', 'PS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PA-terminal', 'PA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('VA-terminal', 'VA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PG-terminal', 'PG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PY-terminal', 'PY');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PE-terminal', 'PE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PN-terminal', 'PN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PL-terminal', 'PL');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PT-terminal', 'PT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PR-terminal', 'PR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MK-terminal', 'MK');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('RE-terminal', 'RE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('RU-terminal', 'RU');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('RW-terminal', 'RW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('RO-terminal', 'RO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('WS-terminal', 'WS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SM-terminal', 'SM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ST-terminal', 'ST');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SA-terminal', 'SA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SZ-terminal', 'SZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SH-terminal', 'SH');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MP-terminal', 'MP');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('BL-terminal', 'BL');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('MF-terminal', 'MF');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SN-terminal', 'SN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('VC-terminal', 'VC');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('KN-terminal', 'KN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LC-terminal', 'LC');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PM-terminal', 'PM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('RS-terminal', 'RS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SC-terminal', 'SC');
--INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SG-terminal', 'SG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SX-terminal', 'SX');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SY-terminal', 'SY');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SK-terminal', 'SK');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SI-terminal', 'SI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GB-terminal', 'GB');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('US-terminal', 'US');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SB-terminal', 'SB');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SO-terminal', 'SO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SD-terminal', 'SD');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SR-terminal', 'SR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SL-terminal', 'SL');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TJ-terminal', 'TJ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TH-terminal', 'TH');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TW-terminal', 'TW');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TZ-terminal', 'TZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TL-terminal', 'TL');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TG-terminal', 'TG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TK-terminal', 'TK');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TO-terminal', 'TO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TT-terminal', 'TT');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TV-terminal', 'TV');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TN-terminal', 'TN');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TM-terminal', 'TM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TR-terminal', 'TR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('UG-terminal', 'UG');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('UZ-terminal', 'UZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('UA-terminal', 'UA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('WF-terminal', 'WF');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('UY-terminal', 'UY');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('FO-terminal', 'FO');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('FJ-terminal', 'FJ');
--INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PH-terminal', 'PH');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('FI-terminal', 'FI');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('FK-terminal', 'FK');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('FR-terminal', 'FR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GF-terminal', 'GF');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('PF-terminal', 'PF');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TF-terminal', 'TF');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('HR-terminal', 'HR');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CF-terminal', 'CF');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('TD-terminal', 'TD');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ME-terminal', 'ME');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CZ-terminal', 'CZ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CL-terminal', 'CL');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('CH-terminal', 'CH');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SE-terminal', 'SE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SJ-terminal', 'SJ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('LK-terminal', 'LK');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('EC-terminal', 'EC');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GQ-terminal', 'GQ');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('AX-terminal', 'AX');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SV-terminal', 'SV');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ER-terminal', 'ER');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('EE-terminal', 'EE');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ET-terminal', 'ET');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('ZA-terminal', 'ZA');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('GS-terminal', 'GS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('OS-terminal', 'OS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('SS-terminal', 'SS');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('JM-terminal', 'JM');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('JP-terminal', 'JP');
INSERT INTO billing_terminal (terminal_id, country_code) VALUES ('EU-terminal', 'EU');
insert into billing_terminal (terminal_id, country_code) values ('666186','SG');
insert into billing_terminal (terminal_id, country_code) values ('666188','PH');
insert into billing_terminal (terminal_id, country_code) values ('666190','GE');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'billing.converter.count_available_reject_record','3');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'report.type','STANDARD');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'automate.enabled','false');
--добавлены значения системных настроек, имеющиеся на текущий момент в модуле
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'automate.ascKeyPath','/usr/local/jetty-services2/config/billing-admin/secret.asc');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'automate.keySecret','123');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'is_refund_as_reversal','true');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'mail.alfacard','NOT_USED_NOW');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'mail.esupport','myworktech@gmail.com');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'mail.raschet','NOT_USED_NOW');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'scheduling.cron.bo','0 30 23 * * *');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'scheduling.cron.bsp','30 44 13 * * *');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'server.params.bo','{"address":"www.bo_server.com","port":1,"path":"/some/path/to/bo/files/","login":"bo_login","password":"bo_password"}');
insert into system_settings (id,name,value) values (nextval('SEQ_OPTIONS'),'server.params.posting','{"address":"10.77.5.93","port":8022,"path":"/chroot/postbofile/local/","login":"postbofile","password":"PostBOFile"}');
--конец добавления настроек
create table carrier (
id bigint not null,
name character varying(100),
iata_code character varying(100),
created_at timestamp without time zone,
mcc CHARACTER VARYING(20),
CONSTRAINT carrier_pkey PRIMARY KEY (id),
CONSTRAINT carrier_name_code_unique UNIQUE (name),
CONSTRAINT carrier_iata_code_unique UNIQUE (iata_code)
);
create sequence SEQ_CARRIER;
create table terminal (
id bigint not null,
name character varying(100),
agrn character varying(100),
terminal character varying(100),
carrier_id bigint not null,
CONSTRAINT country_pkey PRIMARY KEY (id),
CONSTRAINT terminal_name_unique UNIQUE (name),
CONSTRAINT terminal_agrn_unique UNIQUE (agrn),
CONSTRAINT terminal_terminal_unique UNIQUE (terminal)
);
create sequence SEQ_TERMINAL;
create table terminal_countrycurrency (
terminal bigint not null,
countrycurrency bigint not null
);
create sequence bsp_fe_utrnno_seq start with 10000; --set start value
---
--drop table processing_file cascade;
--drop table billing_file cascade;
--drop table bo_file;
--drop table posting_file;
--drop table report_file;
--drop table file_record cascade;
--drop table processing_record cascade;
--truncate processing_file cascade;
--truncate billing_file cascade;
--truncate bo_file cascade;
--truncate posting_file cascade;
--truncate report_file cascade;
--truncate file_record cascade;
--truncate processing_record cascade;
| true |
703ef65a56bc30f9c89f445557e7bda504f0e569 | SQL | timowang1991/SQL-Tutorial---Full-Database-Course-for-Beginners | /03-Update and Delete.sql | UTF-8 | 915 | 3.40625 | 3 | [] | no_license | CREATE TABLE student (
student_id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(20),
major VARCHAR(20) DEFAULT 'undecided'
);
DESCRIBE student;
INSERT INTO student(name, major) VALUES('Jack', 'Biology');
INSERT INTO student(name, major) VALUES('Kate', 'Sociology');
INSERT INTO student(name, major) VALUES('Claire', 'Chemistry');
INSERT INTO student(name, major) VALUES('Jack', 'Biology');
INSERT INTO student(name, major) VALUES('Mike', 'Computer Science');
SET SQL_SAFE_UPDATES=0;
UPDATE student
SET major = 'Com Sci'
WHERE student_id = 4;
UPDATE student
SET major = 'Biochemistry'
WHERE major = 'Bio' OR major = 'Chemistry';
UPDATE student
SET
name = 'Tom',
major = 'undecided'
WHERE student_id = 1;
UPDATE student
SET major = 'undecided';
DELETE FROM student
WHERE student_id = 5;
DELETE FROM student
WHERE name = 'Tom' AND major = 'undecided';
SELECT * FROM student;
DROP TABLE student; | true |
309351b5683a7d163936b616c7c8c3121299fc48 | SQL | hruodwolf/werkzeug | /plsql_uebungen/Kapitel_12_Collection/12_Kapitel_Collection_Beispiel_nested_tables_5_DELETE.sql | ISO-8859-1 | 925 | 2.8125 | 3 | [] | no_license | SET SERVEROUTPUT ON
DECLARE
TYPE List_T IS TABLE OF VARCHAR2 (88);
L_Auto List_T := List_T ();
L_Row PLS_INTEGER;
BEGIN
L_Auto.EXTEND (4);
L_Auto (1) := 'BMW';
L_Auto (2) := 'Audi';
L_Auto (3) := 'VW';
L_Auto (4) := 'Tatra';
L_Row := L_Auto.FIRST;
WHILE L_Row IS NOT NULL LOOP
DBMS_OUTPUT.Put_Line ('at row ' || L_Row || ' is ' || L_Auto (L_Row));
L_Row := L_Auto.NEXT (L_Row);
END LOOP;
DBMS_OUTPUT.Put_Line ('-- jetzt wird ein auto gelscht --');
L_Auto.Delete (3);
L_Row := L_Auto.FIRST;
WHILE L_Row IS NOT NULL LOOP
DBMS_OUTPUT.Put_Line ('at row ' || L_Row || ' is ' || L_Auto (L_Row));
L_Row := L_Auto.NEXT (L_Row);
END LOOP;
END;
/*
at row 1 is BMW
at row 2 is Audi
at row 3 is VW
at row 4 is Tatra
-- jetzt wird ein auto gelscht --
at row 1 is BMW
at row 2 is Audi
at row 4 is Tatra
PL/SQL procedure successfully completed.
*/ | true |
2bccbf456a11363eeaa3e1da1dcfd0548f533b4d | SQL | zzenonn/amazon-kinesis-demo | /kinesis.sql | UTF-8 | 951 | 3.84375 | 4 | [
"MIT"
] | permissive | CREATE OR REPLACE STREAM "TEMP_STREAM" (
"iotName" varchar (40),
"iotValue" integer,
"ANOMALY_SCORE" DOUBLE);
-- Creates an output stream and defines a schema
CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM" (
"iotName" varchar(40),
"iotValue" integer,
"ANOMALY_SCORE" DOUBLE,
"created" TimeStamp);
-- Compute an anomaly score for each record in the source stream
-- using Random Cut Forest
CREATE OR REPLACE PUMP "STREAM_PUMP_1" AS INSERT INTO "TEMP_STREAM"
SELECT STREAM "iotName", "iotValue", ANOMALY_SCORE FROM
TABLE(RANDOM_CUT_FOREST(
CURSOR(SELECT STREAM * FROM "SOURCE_SQL_STREAM_001")
)
);
-- Sort records by descending anomaly score, insert into output stream
CREATE OR REPLACE PUMP "OUTPUT_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM"
SELECT STREAM "iotName", "iotValue", ANOMALY_SCORE, ROWTIME FROM "TEMP_STREAM"
ORDER BY FLOOR("TEMP_STREAM".ROWTIME TO SECOND), ANOMALY_SCORE DESC;
| true |
8476f1ef436f85f15bb85cc80c2f014cee98a2b8 | SQL | jkstill/oracle-script-lib | /sql/stats_trace.sql | UTF-8 | 2,939 | 3.53125 | 4 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive |
set echo on
/*
Enable tracing in DBMS_STATS
http://www.freelists.org/post/oracle-l/dbms-statset-paramtrace3166
http://www.orafaq.com/maillist/oracle-l/2006/08/22/0985.htm
http://www.hellodba.com/reader.php?ID=30&lang=en
Values to use for dbms_stats.set_param('trace','value')
in 11g the set_param procedure is deprecated
the dbms_stats.set_global_prefs procedure will also work for this.
Values are additive
for instance to trace table stats:
session + table + backtrace + query
2182 = 2 + 4 + 128 + 2048
exec dbms_stats.set_param('trace','2182')
1 = use dbms_output.put_line instead of writing into trace file
2 = enable dbms_stat trace only at session level
4 = trace table stats
8 = trace index stats
16 = trace column stats
32 = trace auto stats - save session state log into sys.stats_target$_log
64 = trace scaling
128 = dump backtrace on error
256 = dubious stats detection
512 = auto stats job
1024 = parallel execution tracing
2048 = print query before execution
4096 = partition prune tracing
8192 = trace stat differences
16384 = trace extended column stats gathering
32768 = trace approximate NDV (number distinct values) gathering
SQL to create the table sys.stats_target$_log
create table sys.stats_target$_log
as
select t.*, rpad('X',30,'X') session_id, 1 state
from sys.stats_target$ t
where 1=0
Trace extended stats
16406 = 2 + 4 + 16 + 16384
Trace approximate NDV
32790 = 2 + 4 + 16 + 32768
Definition from dbms_stats_internal package:
DSC_DBMS_OUTPUT_TRC CONSTANT NUMBER := 1;
DSC_SESSION_TRC CONSTANT NUMBER := 2;
DSC_TAB_TRC CONSTANT NUMBER := 4;
DSC_IND_TRC CONSTANT NUMBER := 8;
DSC_COL_TRC CONSTANT NUMBER := 16;
DSC_AUTOST_TRC CONSTANT NUMBER := 32; save session state log into sys.stats_target$_log
DSC_SCALING_TRC CONSTANT NUMBER := 64;
DSC_ERROR_TRC CONSTANT NUMBER := 128;
DSC_DUBIOUS_TRC CONSTANT NUMBER := 256;
DSC_AUTOJOB_TRC CONSTANT NUMBER := 512;
DSC_PX_TRC CONSTANT NUMBER := 1024;
DSC_Q_TRC CONSTANT NUMBER := 2048;
DSC_CCT_TRC CONSTANT NUMBER := 4096;
DSC_DIFFST_TRC CONSTANT NUMBER := 8192;
DSC_USTATS_TRC CONSTANT NUMBER := 16384;
DSC_SYN_TRC CONSTANT NUMBER := 32768;
This query does not show the current session values if the DSC_SESSION_TRC value is used:
Note:
The '1' value for SPARE1 will be set to null if trace prefs are set.
SPARE1 is used as a flag to see if trace has ever been set.
set linesize 200
COLUMN sval1 ON FORMAT 999999
COLUMN sval2 ON FORMAT a26
COLUMN spare1 ON FORMAT 999999999999999999
COLUMN spare2 ON FORMAT a6
COLUMN spare3 ON FORMAT a6
COLUMN spare4 ON FORMAT a40
COLUMN spare5 ON FORMAT a6
COLUMN spare6 ON FORMAT a6
select sname, sval1, sval2
,spare1, spare2, spare3, spare4, spare5, spare6
from SYS.OPTSTAT_HIST_CONTROL$
order by sname
*/
set echo off
| true |
8c5a95755f60f85bfea994a63ce85c0557584f6f | SQL | rkammer/production-sql | /views/subaccount_get_list.sql | UTF-8 | 1,925 | 3.234375 | 3 | [] | no_license | CREATE OR REPLACE VIEW subaccount_get_list(
subaccount_id,
subaccount_code,
subaccount_title,
subaccount_media_company_id,
subaccount_business_group_id,
subaccount_network_id,
subaccount_production_id,
subaccount_season_id,
subaccount_episode_id,
subaccount_ledger_id,
subaccount_account_id,
subaccount_created,
subaccount_created_by,
subaccount_updated,
subaccount_updated_by,
subaccount_status
) AS
SELECT subaccount.id AS subaccount_id,
subaccount.code AS subaccount_code,
subaccount.title AS subaccount_title,
subaccount.media_company_id AS subaccount_media_company_id,
subaccount.business_group_id AS subaccount_business_group_id,
subaccount.network_id AS subaccount_network_id,
subaccount.production_id AS subaccount_production_id,
subaccount.season_id AS subaccount_season_id,
subaccount.episode_id AS subaccount_episode_id,
subaccount.ledger_id AS subaccount_ledger_id,
subaccount.account_id AS subaccount_account_id,
DATE_FORMAT(subaccount.created,'%m/%d/%Y %H:%i:%S') AS subaccount_created,
subaccount.created_by AS subaccount_created_by,
DATE_FORMAT(subaccount.updated,'%m/%d/%Y %H:%i:%S') AS subaccount_updated,
subaccount.updated_by AS subaccount_updated_by,
subaccount.status AS subaccount_status
FROM subaccount AS subaccount; | true |
a7ae6263463d301d12ad5c48b0843f5fb91c6671 | SQL | benhpoh/landmark-remark | /schema.sql | UTF-8 | 223 | 2.59375 | 3 | [] | no_license | CREATE DATABASE landmark;
-- \c landmark;
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username text
);
CREATE TABLE landmarks (
id SERIAL PRIMARY KEY,
user_id INTEGER,
note TEXT,
lat DECIMAL,
lng DECIMAL
); | true |
72d038572f797a882f342365391481f7807bbe3a | SQL | Kris-Zhao/CJV805_HRManagement | /support/createSecurityTable.sql | UTF-8 | 256 | 2.8125 | 3 | [] | no_license | CREATE TABLE SECURITY
( EMPLOYEE_ID NUMBER(6,0) CONSTRAINT sec_emp_id_pk PRIMARY KEY,
SEC_ID VARCHAR2(20),
SEC_PASSWORD VARCAHR2(10),
SEC_STATUS CHAR(1),
CONSTRAINT sec_emp_fk FOREIGN KEY(EMPLOYEE_ID)
REFERENCES EMPLOYEES(EMPLOYEE_ID) ); | true |
5a992b23db3ae592bf0dbb11cb3637ddc260fb5b | SQL | psalmeight/products-api | /migrations/19_create_table_sales.down.sql | UTF-8 | 328 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | CREATE TABLE IF NOT EXISTS "sales"(
"id" SERIAL primary key,
"sale_datetime" VARCHAR,
"sale_dispense_location" VARCHAR,
"sale_dispense_datetime" VARCHAR,
"sale_no" VARCHAR,
"sale_details" VARCHAR,
"sale_status" VARCHAR,
"customer_id" INT,
FOREIGN KEY (customer_id) REFERENCES customers(id)
); | true |
cd7bed2d895b79befc4ecc011e80a53fb1ee4f34 | SQL | Panik1997/Food_Ordering_System | /SQL_TASK.sql | UTF-8 | 448 | 4.03125 | 4 | [] | no_license | /*1. Select countries where the total number of inhabitants (population) in all cities is greater
than 400.*/
SELECT c.Name FROM Country AS c
WHERE 400 < (SELECT ci.Population FROM City AS ci WHERE c.id_CountryID = ci.CountryID)
/*2. Select names of the countries that have no buildings at all*/
SELECT c.Name FROM Country AS c
JOIN City AS ci ON c.CountryID = ci.CountryID
JOIN Building AS b ON ci.CityID = b.CityID
WHERE b.CityID IS NULL
| true |
d99113f8b492672b8f1b89705fae5250f39f3903 | SQL | CeliaZhu/covid19-pennsylvania | /update.sql | UTF-8 | 369 | 3.625 | 4 | [] | no_license | CREATE TEMP TABLE temp_us
(LIKE covid19.covid19us INCLUDING ALL);
\COPY temp_us from '~/git/nytimes-covid19-data/us-counties.csv' delimiter ',' header csv;
INSERT INTO covid19.covid19us (date, county, state, fips, cases, deaths)
SELECT t2.* FROM temp_us t2
LEFT JOIN covid19.covid19us t1 ON
t1.date = t2.date
WHERE
t1.date is NULL
ON CONFLICT DO NOTHING
RETURNING *;
| true |
dbbf78625e210a6ba0308a0fa18b1cf63cc96d33 | SQL | victorluccassvl/UniversityMaterial | /MC536/Querry/SearchQuerry/14_Querry.sql | UTF-8 | 448 | 3.203125 | 3 | [] | no_license | -- 14) Exames de sangue de um determinado paciente ( CPF )
WITH associa_cpf_aos_procedimentos AS (
SELECT *
FROM paciente p INNER JOIN submetido_a s
ON p.cpf = s.cpf
WHERE p.cpf = 23169435862
)
SELECT data, hora, nome, descricaoproc
FROM exame e INNER JOIN associa_cpf_aos_procedimentos a
ON e.codequipe = a.codequipe AND e.codprocedimento = a.codprocedimento
WHERE e.tipo = 'Hemograma'
ORDER BY data,hora ASC
| true |
22590646682b6abe2eee7d0c4023a911fc07029e | SQL | drobnjak98/E-Learning | /baza/predaje.sql | UTF-8 | 790 | 3.46875 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `portal`.`predaje` (
`email_nastavnik` VARCHAR(255) CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci' NOT NULL,
`sifra_kursa` CHAR(6) CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci' NOT NULL,
PRIMARY KEY (`email_nastavnik`, `sifra_kursa`),
INDEX `fk_nastavnik_has_kurs_kurs1_idx` (`sifra_kursa` ASC) ,
INDEX `fk_nastavnik_has_kurs_nastavnik1_idx` (`email_nastavnik` ASC) ,
CONSTRAINT `fk_nastavnik_has_kurs_nastavnik1`
FOREIGN KEY (`email_nastavnik`)
REFERENCES `portal`.`nastavnik` (`email_nastavnik`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_nastavnik_has_kurs_kurs1`
FOREIGN KEY (`sifra_kursa`)
REFERENCES `portal`.`kurs` (`sifra_kursa`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB; | true |
98442ba30a9a8de3e636b3e3083e2c3b7fa0986d | SQL | META-DREAMER/291-P1 | /sql/select.sql | UTF-8 | 863 | 3.375 | 3 | [] | no_license | select * from (
select rownum,src,dst,dep_date,dep_time,arr_time,2 AS stops,flightno1,flightno2,flightno3,layover1*24*60 as layover1,layover2*24*60 as layover2,fare1,fare2,fare3,price,seats
from (select * from (two_good_connections))
union all
select rownum,src,dst,dep_date,dep_time,arr_time,1 AS stops,flightno1,flightno2,NULL as flightno3,layover*24*60 as layover1,NULL as layover2, fare1,fare2, NULL as fare3, price,seats
from (select * from (good_connections))
union all
select rownum,src,dst,dep_date,dep_time,arr_time,0 AS stops,flightno as flightno1,NULL as flightno2,NULL as flightno3,NULL as layover1,NULL as layover2,fare as fare1,NULL as fare2,NULL as fare3,price,seats
from (select * from (available_flights)))
where LOWER(src)=LOWER('{}') and LOWER(dst)=LOWER('{}') and stops<= {} and lower(to_char(dep_time, 'DD-MM-YYYY')) = LOWER('{}') order by {} | true |
2e2af7925e4331a48ca826a0b5507955f37a1b19 | SQL | retailcrm/mg-transport-telegram | /migrations/1528208070_app.up.sql | UTF-8 | 305 | 2.9375 | 3 | [
"MIT"
] | permissive | create table users
(
id serial not null
constraint users_pkey
primary key,
external_id integer not null,
user_photo_url varchar(255),
user_photo_id varchar(100),
created_at timestamp with time zone,
updated_at timestamp with time zone,
constraint users_key unique(external_id)
);
| true |
aaf8a630cdb7200040c26264133c5f674d775711 | SQL | paarthbir77/week6-assignment | /target/classes/com/greatlearning/designpattern2/script.sql | UTF-8 | 231 | 2.75 | 3 | [] | no_license | create database assignment6;
use assignment6;
CREATE TABLE 'accounts' (
'accountNo' int(5) NOT NULL AUTO_INCREMENT,
'balance' int(8) NOT NULL,
'branch' varchar(20) NOT NULL,
'type' varchar(20) NOT NULL,
PRIMARY KEY ('accountNo')
); | true |
ca95d208372c36d98fad566e6b3ac50993e5eb18 | SQL | tianhongw/tinyid | /sql/db1/db.sql | UTF-8 | 1,261 | 3.375 | 3 | [] | no_license | USE tinyid;
CREATE TABLE `tiny_id_info` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`biz_type` varchar(63) NOT NULL,
`max_id` bigint(20) NOT NULL DEFAULT 0,
`step` int(11) DEFAULT 0,
`delta` int(11) NOT NULL DEFAULT 1,
`remainder` int(11) NOT NULL DEFAULT 0,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`version` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_biz_type` (`biz_type`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
INSERT INTO tiny_id_info SET biz_type = "test", max_id = 0, step = 1000, delta = 2, remainder = 0, update_time = now(), create_time = now();
CREATE TABLE `tiny_id_token` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`biz_type` varchar(63) NOT NULL,
`token` varchar(128) NOT NULL,
`description` varchar(1024) NOT NULL DEFAULT '',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_biz_type` (`biz_type`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
INSERT INTO tiny_id_token SET biz_type = "test", token = "abc", update_time = now(), create_time = now();
| true |
c2411834dca22c2e7548ff5ce08ed3502be91aa1 | SQL | AhmedKKhalid/Data-Analysis-Products-Price | /schema/project sql.sql | UTF-8 | 1,321 | 4.40625 | 4 | [] | no_license | /* transactions table */
select * from sales.transactions ;
/* number of row in transactions table */
select count(*) from sales.transactions ;
/* Show transactions for Chennai market (market code for chennai is Mark001 */
select * from sales.transactions where market_code='Mark001' ;
/* Show distrinct product codes that were sold in chennai */
select distinct(product_code) from sales.transactions where market_code='Mark001';
/*Show transactions where currency is US dollars */
select * from sales.transactions where currency='USD' ;
/* Show transactions in 2020 join by date table */
select sales.transactions.*,sales.date.* from sales.transactions
join sales.date on transactions.order_date =date.date
where date.year=2020;
/* Show total revenue in year 2020 */
select sum(sales_amount) from sales.transactions
join sales.date on transactions.order_date=date.date
where date.year=2020;
/* Show total revenue in year 2020, January Month */
select sum(sales_amount) from sales.transactions
join sales.date on transactions.order_date=date.date
where date.year=2020 and date.month_name='January';
/* Show total revenue in year 2020 in Chennai */
select sum(sales_amount) from sales.transactions
join sales.date on transactions.order_date=date.date
where date.year=2020 and transactions.market_code='Mark001'; | true |
866cfe3c4dd3b2b31e8b16b55125ece46454fd1f | SQL | i-avatar777/yii2-service-blockchain-table | /init.sql | UTF-8 | 719 | 3.15625 | 3 | [] | no_license | CREATE TABLE `blockchain_transaction` (
`id` int(11) NOT NULL AUTO_INCREMENT,
row_id int null,
table_id int null,
created_at int null,
hash varchar(64) null,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `blockchain_block` (
`id` int(11) NOT NULL AUTO_INCREMENT,
hash varchar(64) null,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `blockchain_table` (
`id` int(11) NOT NULL AUTO_INCREMENT,
name varchar(100) null,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | true |
10b539a5934c220ba9695978179ecb5c9086ed0c | SQL | emanuelanechei/Oracle-Email-Reports | /sql/errors-Enrich_ACCSHV.sql | UTF-8 | 919 | 3.21875 | 3 | [] | no_license | select segment1 "Part Number"
, case when nvl(fixed_days_supply,0) <> 20 then 'Fixed Days Supply should be 20'
when release_time_fence_code <> 4 then 'Release time fence code should be "User-defined time fence"'
when nvl(release_time_fence_days,0) <> 10 then 'Release time fence days should be 10'
when acceptable_early_days <> 10 then 'Acceptable early days should be 10'
when replenish_to_order_flag <> 'Y' then 'Assemble to order box should be checked on all orgs and master'
end "Problem"
from mtl_system_items_b msi
where msi.organization_id = 85
and inventory_item_status_code = 'Active'
and planner_code = 'ACC-SHV'
and
(
nvl(fixed_days_supply,0) <> 20
or nvl(release_time_fence_days,0) <> 10
or release_time_fence_code <> 4
or acceptable_early_days <> 10
or replenish_to_order_flag <> 'Y'
) | true |
2a35e8ce08b759cfe2ca457966eade17e4b6e11f | SQL | stepheku/cclqueries | /powerforms/smart_template_powerform_search.sql | UTF-8 | 2,235 | 3.71875 | 4 | [
"MIT"
] | permissive | /*
smart_template_powerform_search.sql
~~~~~~~~~~~~~~~~~~~~
Searches for a smart template program usage within PowerForms
*/
select form = dfr.description
, section = dsr.description
, template = cv1.definition
, read_only = nvp3.pvc_value
, dta = dta.description
, event_code = uar_get_code_display(dta.event_cd)
from code_value cv1
, name_value_prefs nvp
, dcp_input_ref dir
, dcp_section_ref dsr
, dcp_forms_def dfd
, dcp_forms_ref dfr
, name_value_prefs nvp2
, name_value_prefs nvp3
, discrete_task_assay dta
plan cv1 where cv1.code_set = 16529
and cv1.active_ind = 1
and cv1.begin_effective_dt_tm <= cnvtdatetime(curdate, curtime3)
and cv1.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
/*Smart template program name*/
and cnvtlower(cv1.definition) = "smart_template_program_name"
join nvp where nvp.merge_id = cv1.code_value
and nvp.merge_name = "CODE_VALUE"
and nvp.pvc_name = "template_cd"
and nvp.active_ind = 1
join dir where dir.dcp_input_ref_id = nvp.parent_entity_id
and dir.active_ind = 1
join nvp2 where nvp2.parent_entity_id = dir.dcp_input_ref_id
and nvp2.active_ind = 1
and nvp2.pvc_name = 'discrete_task_assay'
join dta where dta.task_assay_cd = nvp2.merge_id
join nvp3 where nvp3.parent_entity_id = dir.dcp_input_ref_id
and nvp3.active_ind = 1
and nvp3.pvc_name = "read_only"
join dsr where dsr.dcp_section_ref_id = dir.dcp_section_ref_id
and dsr.dcp_section_instance_id = dir.dcp_section_instance_id
and dsr.beg_effective_dt_tm <= cnvtdatetime(curdate, curtime3)
and dsr.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
join dfd where dfd.dcp_section_ref_id = dsr.dcp_section_ref_id
and dfd.active_ind = 1
join dfr where dfr.dcp_forms_ref_id = dfd.dcp_forms_ref_id
and dfr.dcp_form_instance_id = dfd.dcp_form_instance_id
and dfr.active_ind = 1
and dfr.beg_effective_dt_tm <= cnvtdatetime(curdate, curtime3)
and dfr.end_effective_dt_tm > cnvtdatetime(curdate, curtime3)
order by
dfr.description
, dsr.description
, cv1.definition
with format(date, "mm/dd/yyyy hh:mm:ss;;q")
| true |
26aee4438a2109f7d60e7b377008cac7e9abf89d | SQL | sczhaoqi/docs-manager | /src/main/resources/db/init.sql | UTF-8 | 610 | 2.703125 | 3 | [] | no_license | create table if not exists users(
id int auto_increment primary key,
username varchar(60),
password varchar(100),
enabled boolean default 1
);
create table if not exists AUTHORITIES(
id int auto_increment primary key ,
authority varchar(60),
authority_details varchar(200)
);
create table if not exists user_AUTHORITIES(
id int auto_increment primary key,
aid int,
uid int
);
create table if not exists docs(
id int auto_increment primary key ,
project varchar(500),
zpath varchar(500),
path varchar(500),
href_subfix varchar(500),
utime timestamp,
name varchar(100)
); | true |
edb9929d67082541d63c512fb8bed62b826348f6 | SQL | cpietsch/logger | /mysql/logger.sql | UTF-8 | 329 | 2.546875 | 3 | [
"MIT"
] | permissive | DROP TABLE IF EXISTS `logs`;
CREATE TABLE `logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sessionid` varchar(40) NOT NULL,
`payload` text NOT NULL,
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`ip` varchar(14) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| true |
9f4ee718105f6394d04418807d3f916ae6426fd6 | SQL | yllczjh/yl | /工作文档/健康通平台/更新内容/1互联互通序列、表及表初始数据.sql | GB18030 | 23,369 | 3.234375 | 3 | [] | no_license | create sequence SEQ_ͨ_־_ˮ
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 10;
create sequence SEQ_ͨ__ˮ
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 10;
create sequence SEQ_ͨ_ϸ_ˮ
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 10;
create sequence SEQ_ͨ_ûϢ_ˮ
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 10;
CREATE TABLE ͨ_(
ˮ NUMBER NOT NULL,
ƽ̨ʶ VARCHAR2(50),
ҽԺ VARCHAR2(50),
ID VARCHAR2(50),
ﲡ VARCHAR2(50),
VARCHAR2(50),
״̬ VARCHAR2(50),
ҽԺ VARCHAR2(50),
ƽ̨ VARCHAR2(50),
ʱ DATE,
Һŷ NUMBER(18,3),
Ʒ NUMBER(18,3),
Һ VARCHAR2(50),
Һ VARCHAR2(50),
ԤԼҺ VARCHAR2(50),
ҽԺ֧ VARCHAR2(50),
ƽ̨֧ VARCHAR2(50),
֧ʱ DATE,
ƽ̨ˮ VARCHAR2(50),
֧ VARCHAR2(50),
ܽ NUMBER(18,3),
Ӧ NUMBER(18,3),
ʵ NUMBER(18,3),
ҽͳ֧ NUMBER(18,3),
ҽԺ˿ VARCHAR2(50),
ƽ̨˿ VARCHAR2(50),
˿ʱ DATE,
ƽ̨˿ˮ VARCHAR2(50),
˿ NUMBER(18,3),
˿ԭ VARCHAR2(100),
˿־ VARCHAR2(50),
VARCHAR2(50),
ʱ DATE,
ȡʱ DATE,
ȡԭ VARCHAR2(100),
ҽԺ VARCHAR2(50),
VARCHAR2(50),
ʱ DATE,
VARCHAR2(50),
ʱ DATE,
INTEGER,
ע VARCHAR2(1000),
״̬ VARCHAR2(50),
CONSTRAINT PK_ͨ_ PRIMARY KEY (ˮ)
);
COMMENT ON TABLE ͨ_ IS 'ͨ_';
COMMENT ON COLUMN ͨ_.ˮ IS 'ˮ';
COMMENT ON COLUMN ͨ_.ƽ̨ʶ IS 'ƽ̨ʶ';
COMMENT ON COLUMN ͨ_.ҽԺ IS 'ҽԺ';
COMMENT ON COLUMN ͨ_.ID IS 'ID';
COMMENT ON COLUMN ͨ_.ﲡ IS 'ﲡ';
COMMENT ON COLUMN ͨ_. IS 'ԤԼҺűֵϸշ';
COMMENT ON COLUMN ͨ_.״̬ IS 'ţ֧֧˿ȡɾ';
COMMENT ON COLUMN ͨ_.ҽԺ IS 'ҽԺ';
COMMENT ON COLUMN ͨ_.ƽ̨ IS 'ƽ̨';
COMMENT ON COLUMN ͨ_.ʱ IS 'ʱ';
COMMENT ON COLUMN ͨ_.Һŷ IS 'Һŷ';
COMMENT ON COLUMN ͨ_.Ʒ IS 'Ʒ';
COMMENT ON COLUMN ͨ_.Һ IS '1ˣ2Ů3';
COMMENT ON COLUMN ͨ_.Һ IS 'Һ';
COMMENT ON COLUMN ͨ_.ԤԼҺ IS '1Һţ2ԤԼҺţ3ŹҺ';
COMMENT ON COLUMN ͨ_.ҽԺ֧ IS 'Ʊ';
COMMENT ON COLUMN ͨ_.ƽ̨֧ IS 'ƽ̨֧';
COMMENT ON COLUMN ͨ_.֧ʱ IS '֧ʱ';
COMMENT ON COLUMN ͨ_.ƽ̨ˮ IS 'ƽ̨ˮ';
COMMENT ON COLUMN ͨ_.֧ IS '1-5ƽ̨6';
COMMENT ON COLUMN ͨ_.ܽ IS 'ܽ';
COMMENT ON COLUMN ͨ_.Ӧ IS 'Ӧ';
COMMENT ON COLUMN ͨ_.ʵ IS 'ʵ';
COMMENT ON COLUMN ͨ_.ҽͳ֧ IS 'ҽͳ֧';
COMMENT ON COLUMN ͨ_.ҽԺ˿ IS 'ҽԺ˿';
COMMENT ON COLUMN ͨ_.ƽ̨˿ IS 'ƽ̨˿';
COMMENT ON COLUMN ͨ_.˿ʱ IS '˿ʱ';
COMMENT ON COLUMN ͨ_.ƽ̨˿ˮ IS 'ƽ̨˿ˮ';
COMMENT ON COLUMN ͨ_.˿ IS '˿';
COMMENT ON COLUMN ͨ_.˿ԭ IS '˿ԭ';
COMMENT ON COLUMN ͨ_.˿־ IS '0ʧܣ1ҷ˿2Ժ˿';
COMMENT ON COLUMN ͨ_. IS 'ԤԼҺţԤԼ˺ţշѣԤѺ𣻳Ժ';
COMMENT ON COLUMN ͨ_.ʱ IS 'ʱ';
COMMENT ON COLUMN ͨ_.ȡʱ IS 'ȡʱ';
COMMENT ON COLUMN ͨ_.ȡԭ IS 'ȡԭ';
COMMENT ON COLUMN ͨ_.ҽԺ IS 'ҽԺ';
COMMENT ON COLUMN ͨ_. IS '';
COMMENT ON COLUMN ͨ_.ʱ IS 'ʱ';
COMMENT ON COLUMN ͨ_. IS '';
COMMENT ON COLUMN ͨ_.ʱ IS 'ʱ';
COMMENT ON COLUMN ͨ_. IS '';
COMMENT ON COLUMN ͨ_.ע IS 'ע';
COMMENT ON COLUMN ͨ_.״̬ IS '״̬';
CREATE TABLE ͨ_ϸ(
ˮ NUMBER NOT NULL,
VARCHAR2(50),
VARCHAR2(50),
С VARCHAR2(50),
Ŀ VARCHAR2(50),
Ŀ VARCHAR2(100),
VARCHAR2(100),
κ VARCHAR2(50),
NUMBER(10,4),
λ VARCHAR2(50),
NUMBER(10,4),
ܽ NUMBER(10,4),
VARCHAR2(50),
Ψһ VARCHAR2(50),
CONSTRAINT PK_ͨ_ϸ PRIMARY KEY (ˮ)
);
COMMENT ON TABLE ͨ_ϸ IS 'ͨ_ϸ';
COMMENT ON COLUMN ͨ_ϸ.ˮ IS 'ˮ';
COMMENT ON COLUMN ͨ_ϸ. IS '';
COMMENT ON COLUMN ͨ_ϸ. IS '';
COMMENT ON COLUMN ͨ_ϸ.С IS 'С';
COMMENT ON COLUMN ͨ_ϸ.Ŀ IS 'Ŀ';
COMMENT ON COLUMN ͨ_ϸ.Ŀ IS 'Ŀ';
COMMENT ON COLUMN ͨ_ϸ. IS '';
COMMENT ON COLUMN ͨ_ϸ.κ IS 'κ';
COMMENT ON COLUMN ͨ_ϸ. IS '';
COMMENT ON COLUMN ͨ_ϸ.λ IS 'λ';
COMMENT ON COLUMN ͨ_ϸ. IS '';
COMMENT ON COLUMN ͨ_ϸ.ܽ IS 'ܽ';
COMMENT ON COLUMN ͨ_ϸ. IS '';
COMMENT ON COLUMN ͨ_ϸ.Ψһ IS 'Ψһ';
CREATE TABLE ͨ_־(
ˮ VARCHAR2(50) NOT NULL,
ƽ̨ʶ VARCHAR2(50),
ҽԺ VARCHAR2(50),
ܱ VARCHAR2(50),
VARCHAR2(4000),
ʱ DATE,
ֵ NUMBER,
Ϣ VARCHAR2(1000),
ִʱ DATE,
CONSTRAINT PK_ͨ_־ PRIMARY KEY (ˮ)
);
COMMENT ON TABLE ͨ_־ IS 'ͨ_־';
COMMENT ON COLUMN ͨ_־.ˮ IS 'ˮ';
COMMENT ON COLUMN ͨ_־.ƽ̨ʶ IS 'ƽ̨ʶ';
COMMENT ON COLUMN ͨ_־.ҽԺ IS 'ҽԺ';
COMMENT ON COLUMN ͨ_־.ܱ IS 'ܱ';
COMMENT ON COLUMN ͨ_־. IS '';
COMMENT ON COLUMN ͨ_־.ʱ IS 'ʱ';
COMMENT ON COLUMN ͨ_־.ֵ IS 'ֵ';
COMMENT ON COLUMN ͨ_־.Ϣ IS 'Ϣ';
COMMENT ON COLUMN ͨ_־.ִʱ IS 'ִʱ';
CREATE TABLE ͨ_ûϢ(
ˮ VARCHAR2(50) NOT NULL,
ҽԺ VARCHAR2(50),
ƽ̨ʶ VARCHAR2(50),
ID VARCHAR2(50),
û VARCHAR2(50),
VARCHAR2(50),
Ա VARCHAR2(50),
DATE,
֤ VARCHAR2(50),
֤ VARCHAR2(50),
֤֤ VARCHAR2(50),
֤Ч VARCHAR2(50),
ֻ VARCHAR2(50),
ϵַ VARCHAR2(100),
֤ VARCHAR2(50),
֤ VARCHAR2(50),
VARCHAR2(50),
û VARCHAR2(50),
û VARCHAR2(50),
VARCHAR2(50),
ʱ DATE,
CONSTRAINT PK_ͨ_ûϢ PRIMARY KEY (ˮ)
);
COMMENT ON TABLE ͨ_ûϢ IS 'ͨ_ûϢ';
COMMENT ON COLUMN ͨ_ûϢ.ˮ IS 'ˮ';
COMMENT ON COLUMN ͨ_ûϢ.ҽԺ IS 'ҽԺ';
COMMENT ON COLUMN ͨ_ûϢ.ƽ̨ʶ IS 'ƽ̨ʶ';
COMMENT ON COLUMN ͨ_ûϢ.ID IS 'ID';
COMMENT ON COLUMN ͨ_ûϢ.û IS 'û';
COMMENT ON COLUMN ͨ_ûϢ. IS '';
COMMENT ON COLUMN ͨ_ûϢ.Ա IS 'Ա';
COMMENT ON COLUMN ͨ_ûϢ. IS '';
COMMENT ON COLUMN ͨ_ûϢ.֤ IS '֤';
COMMENT ON COLUMN ͨ_ûϢ.֤ IS '֤';
COMMENT ON COLUMN ͨ_ûϢ.֤֤ IS '֤֤';
COMMENT ON COLUMN ͨ_ûϢ.֤Ч IS '֤Ч';
COMMENT ON COLUMN ͨ_ûϢ.ֻ IS 'ֻ';
COMMENT ON COLUMN ͨ_ûϢ.ϵַ IS 'ϵַ';
COMMENT ON COLUMN ͨ_ûϢ.֤ IS '֤';
COMMENT ON COLUMN ͨ_ûϢ.֤ IS '֤';
COMMENT ON COLUMN ͨ_ûϢ. IS '';
COMMENT ON COLUMN ͨ_ûϢ.û IS 'û';
COMMENT ON COLUMN ͨ_ûϢ.û IS 'û';
COMMENT ON COLUMN ͨ_ûϢ. IS '';
COMMENT ON COLUMN ͨ_ûϢ.ʱ IS 'ʱ';
CREATE TABLE ͨ_ƽ̨(
ˮ VARCHAR2(50) NOT NULL,
ƽ̨ʶ VARCHAR2(50),
ƽ̨ VARCHAR2(50),
ûID VARCHAR2(50),
֤Կ VARCHAR2(50),
ҽԺID VARCHAR2(50),
VARCHAR2(50),
urlַ VARCHAR2(50),
VARCHAR2(50),
VARCHAR2(50),
֧ʽ VARCHAR2(50),
NUMBER(18,3),
ԤԼ VARCHAR2(1000),
Ч״̬ VARCHAR2(50),
VARCHAR2(50),
ʱ DATE,
VARCHAR2(50),
ʱ DATE,
CONSTRAINT PK_ͨ_ƽ̨ PRIMARY KEY (ˮ)
);
COMMENT ON TABLE ͨ_ƽ̨ IS 'ͨ_ƽ̨';
COMMENT ON COLUMN ͨ_ƽ̨.ˮ IS 'ˮ';
COMMENT ON COLUMN ͨ_ƽ̨.ƽ̨ʶ IS 'ƽ̨ʶ';
COMMENT ON COLUMN ͨ_ƽ̨.ƽ̨ IS 'ƽ̨';
COMMENT ON COLUMN ͨ_ƽ̨.ûID IS 'ûID';
COMMENT ON COLUMN ͨ_ƽ̨.֤Կ IS '֤Կ';
COMMENT ON COLUMN ͨ_ƽ̨.ҽԺID IS 'ƽ̨ҽԺΨһʶ';
COMMENT ON COLUMN ͨ_ƽ̨. IS 'hisҽԺΨһʶ';
COMMENT ON COLUMN ͨ_ƽ̨.urlַ IS 'urlַ';
COMMENT ON COLUMN ͨ_ƽ̨. IS '';
COMMENT ON COLUMN ͨ_ƽ̨. IS '';
COMMENT ON COLUMN ͨ_ƽ̨.֧ʽ IS '֧ʽ';
COMMENT ON COLUMN ͨ_ƽ̨. IS 'hisƽ̨Ļ';
COMMENT ON COLUMN ͨ_ƽ̨.ԤԼ IS 'ƽ̨ԤԼĿ';
COMMENT ON COLUMN ͨ_ƽ̨.Ч״̬ IS '1Ч0Ч';
COMMENT ON COLUMN ͨ_ƽ̨. IS '';
COMMENT ON COLUMN ͨ_ƽ̨.ʱ IS 'ʱ';
COMMENT ON COLUMN ͨ_ƽ̨. IS '';
COMMENT ON COLUMN ͨ_ƽ̨.ʱ IS 'ʱ';
CREATE TABLE ͨ_ƽ̨(
ˮ VARCHAR2(50) NOT NULL,
ƽ̨ʶ VARCHAR2(50),
ܱ VARCHAR2(50),
VARCHAR2(50),
״̬ VARCHAR2(50),
ע VARCHAR2(100),
VARCHAR2(50),
ʱ DATE,
VARCHAR2(50),
ʱ DATE,
CONSTRAINT PK_ͨ_ƽ̨ PRIMARY KEY (ˮ)
);
COMMENT ON TABLE ͨ_ƽ̨ IS 'ͨ_ƽ̨';
COMMENT ON COLUMN ͨ_ƽ̨.ˮ IS 'ˮ';
COMMENT ON COLUMN ͨ_ƽ̨.ƽ̨ʶ IS 'ƽ̨ʶ';
COMMENT ON COLUMN ͨ_ƽ̨.ܱ IS 'ܱ';
COMMENT ON COLUMN ͨ_ƽ̨. IS '';
COMMENT ON COLUMN ͨ_ƽ̨.״̬ IS '״̬';
COMMENT ON COLUMN ͨ_ƽ̨.ע IS 'ע';
COMMENT ON COLUMN ͨ_ƽ̨. IS '';
COMMENT ON COLUMN ͨ_ƽ̨.ʱ IS 'ʱ';
COMMENT ON COLUMN ͨ_ƽ̨. IS '';
COMMENT ON COLUMN ͨ_ƽ̨.ʱ IS 'ʱ';
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('1', '12320', '1001', 'ͨŲ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('2', '12320', '1002', 'ûϢע', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('3', '12320', '1003', 'ûϢѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('4', '12320', '1004', 'ҽԺϢѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('5', '12320', '1005', 'û֤', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('6', '12320', '2001', 'Ҳѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('7', '12320', '2002', 'ҽѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('8', '12320', '2003', 'ŰϢѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('9', '12320', '2004', 'Űʱѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('10', '12320', '2005', 'Դ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('11', '12320', '2006', 'Դ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('12', '12320', '2007', 'ԤԼҺŵǼ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('13', '12320', '2008', 'ԤԼҺ֧', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('14', '12320', '2009', 'ԤԼҺȡ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('15', '12320', '2010', 'ԤԼҺ˺', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('16', '12320', '2011', 'ԤԼҺȡ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('17', '12320', '2012', 'Һż¼ѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('18', '12320', '2020', 'ҽݲѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('19', '12320', '3001', 'ɷѼ¼ѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('20', '12320', '3002', 'ɷϸѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('21', '12320', '3003', 'ɷѼ¼֧', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('22', '12320', '3004', 'ɷѶѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('23', '12320', '4001', 'Ŷбѯ', '0', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('24', '12320', '8001', '/бѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('25', '12320', '8002', '鱨ѯ(ͨ)', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('26', '12320', '8003', '鱨ѯ(ҩ)', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('27', '12320', '8004', '鱨ѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('28', '12320', '9003', 'ϵͳѯ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ܱ, , ״̬, , ʱ, , ʱ)
values ('29', '12320', '5004', 'ȡ', '1', '522633020000001', to_date('07-07-2020 12:12:23', 'dd-mm-yyyy hh24:mi:ss'), null, null);
insert into ͨ_ƽ̨ (ˮ, ƽ̨ʶ, ƽ̨, ûID, ֤Կ, ҽԺID, , URLַ, , , ֧ʽ, , ԤԼ, Ч״̬, , ʱ, , ʱ)
values ('1', '12320', '12320', 'ln_12320wx', '2098D32C4D1399EC', '1', '522633020000001', 'http://localhost:8001/APIService.asmx', 'APIService', 'PubService', '֧', 100.000, '1020,1018', '1', null, null, null, null);
commit;
| true |
34ba709d4b6b7c0465a73895760fd412576a97bb | SQL | qlmnrnq/instagram | /aihalBD.sql | UTF-8 | 15,280 | 3.125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1:3306
-- Время создания: Июн 04 2019 г., 03:16
-- Версия сервера: 5.6.41
-- Версия PHP: 5.5.38
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 */;
--
-- База данных: `aihal_pn_9`
--
CREATE DATABASE IF NOT EXISTS `aihal_pn_9` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `aihal_pn_9`;
-- --------------------------------------------------------
--
-- Структура таблицы `actual`
--
CREATE TABLE `actual` (
`title` varchar(355) NOT NULL,
`teg` varchar(355) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `actual`
--
INSERT INTO `actual` (`title`, `teg`) VALUES
('Актуальные темы', '#tag #-hash + tag');
-- --------------------------------------------------------
--
-- Структура таблицы `author`
--
CREATE TABLE `author` (
`author_name` varchar(355) NOT NULL,
`name` varchar(355) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `author`
--
INSERT INTO `author` (`author_name`, `name`) VALUES
('имя автора', 'имя');
-- --------------------------------------------------------
--
-- Структура таблицы `comments`
--
CREATE TABLE `comments` (
`id` int(255) NOT NULL,
`text` varchar(355) NOT NULL,
`user_id` int(255) NOT NULL,
`pin_id` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `comments`
--
INSERT INTO `comments` (`id`, `text`, `user_id`, `pin_id`) VALUES
(10, 'jjjjjj', 8, 11),
(13, 'ggtgtgtgtg', 8, 11),
(14, 'comment', 8, 14),
(16, 'comm', 9, 11),
(27, 'dffffffdfdf', 0, 15),
(28, 'ssfsfsfs', 8, 15),
(29, 'privet', 8, 15),
(30, 'poka', 9, 15),
(31, 'привет какашка', 8, 14),
(32, 'bye', 17, 22),
(33, 'privet', 11, 22),
(34, 'naa', 11, 17),
(35, 'idi v zhopu', 17, 17),
(36, 'nickelodeon', 17, 18),
(37, 'Kruto', 18, 23),
(38, 'круто', 19, 24);
-- --------------------------------------------------------
--
-- Структура таблицы `instagram`
--
CREATE TABLE `instagram` (
`email` varchar(355) NOT NULL,
`name` varchar(355) NOT NULL,
`nickname` varchar(355) NOT NULL,
`password` varchar(355) NOT NULL,
`avatar` varchar(355) NOT NULL,
`user_id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `instagram`
--
INSERT INTO `instagram` (`email`, `name`, `nickname`, `password`, `avatar`, `user_id`) VALUES
('aihal1337@gmail.com', 'айхал', 'test', '111', 'images.jpg', 1),
('mail@mail.ru', 'rtrtrt', 'gavno', '666', '', 2),
('aihal1337@gmail.com', 'rtrtrt', 'test', '222', '', 3),
('fsfsf', 'sfsfsf', 'sfsfsf', '2222', '', 4),
('aihal1337@gmail.com', 'rtrtrt', 'test', '777', '', 5),
('aihal1337@gmail.com', 'uuuuuuu', 'ggggg', '666', 'images.jpg', 6),
('SSSS@MAIL.RU', 'wssfsfs', 'dddd', '444', 'images.jpg', 9),
('2', '2', '2', '2', '', 10),
('aihal1337@gmail.com', '1', '1', '1', '', 11),
('2', '2', '2', '2', '', 12),
('3', '3', '3', '3', '', 13);
-- --------------------------------------------------------
--
-- Структура таблицы `journal`
--
CREATE TABLE `journal` (
`surname` varchar(355) NOT NULL,
`name` varchar(355) NOT NULL,
`19_november` varchar(355) NOT NULL,
`20_november` varchar(355) NOT NULL,
`21_november` varchar(355) NOT NULL,
`id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `journal`
--
INSERT INTO `journal` (`surname`, `name`, `19_november`, `20_november`, `21_november`, `id`) VALUES
('Фамилия', 'Имя', '19 ноября', '20 ноября', '21 ноября', 1),
('Фомин', 'Артем', '5', 'н', '4', 2),
('Кычкин', 'Андрей', '4', '5', 'н', 3),
('Семенов', 'Айхал', '4', '4', 'н', 4),
('Скрябин', 'Владислав', '5', '5', '5', 5),
('Яковлев', 'Иван', '4', 'н', 'н', 6),
('Румянцева', 'Дайаана', '5', '5', '4', 7),
('Тихомиров', 'Данил', '4', '4', '4', 8),
('Неустроев', 'Андрей', '5', '4', '5', 9);
-- --------------------------------------------------------
--
-- Структура таблицы `lessons`
--
CREATE TABLE `lessons` (
`name` varchar(355) NOT NULL,
`subjects` varchar(355) NOT NULL,
`id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `lessons`
--
INSERT INTO `lessons` (`name`, `subjects`, `id`) VALUES
('lena', 'biology', 2),
('sveta', 'biology', 3),
('nastya', 'physics', 4),
('olya', 'geography', 5),
('lucya', 'geography', 6),
('olga', 'geography', 7),
('olga', 'geography', 8),
('Nastya', '23456', 9),
('olga', 'geography', 10);
-- --------------------------------------------------------
--
-- Структура таблицы `pin`
--
CREATE TABLE `pin` (
`pin_id` int(255) NOT NULL,
`img` varchar(355) NOT NULL,
`text` varchar(355) NOT NULL,
`user_id` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `pin`
--
INSERT INTO `pin` (`pin_id`, `img`, `text`, `user_id`) VALUES
(16, 'IMAGES/guccipost.jpg', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate tempora, cum sed saepe sint labore assumenda dignissimos obcaecati quidem, quaerat cumque dolor ad molestias eveniet repellendus perspiciatis nihil! Dolorum, odio.', 11),
(17, 'IMAGES/hz.jpg', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate tempora, cum sed saepe sint labore assumenda dignissimos obcaecati quidem, quaerat cumque dolor ad molestias eveniet repellendus perspiciatis nihil! Dolorum, odio.', 12),
(18, 'IMAGES/gumball.jpg', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate tempora, cum sed saepe sint labore assumenda dignissimos obcaecati quidem, quaerat cumque dolor ad molestias eveniet repellendus perspiciatis nihil! Dolorum, odio.', 13),
(19, 'IMAGES/postphoto.jpg', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate tempora, cum sed saepe sint labore assumenda dignissimos obcaecati quidem, quaerat cumque dolor ad molestias eveniet repellendus perspiciatis nihil! Dolorum, odio.', 14),
(20, 'IMAGES/wallp.jpg', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate tempora, cum sed saepe sint labore assumenda dignissimos obcaecati quidem, quaerat cumque dolor ad molestias eveniet repellendus perspiciatis nihil! Dolorum, odio.', 15),
(21, 'IMAGES/postttt.jpg', 'Lorem ipsum privet ti cho afigell dolor sit amet, consectetur adipisicing elit. Cupiditate tempora, cum sed saepe sint labore assumenda dignissimos obcaecati quidem, quaerat cumque dolor ad molestias eveniet repellendus perspiciatis nihil! Dolorum, odio.', 16),
(22, 'IMAGES/dmc.jpg', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate tempora, cum sed saepe sint labore assumenda dignissimos obcaecati quidem, quaerat cumque dolor ad molestias eveniet repellendus perspiciatis nihil! Dolorum, odio.', 17),
(23, 'IMAGES/3.jpg', '', 18),
(24, 'IMAGES/1.jpg', 'гггг', 19),
(25, 'IMAGES/1.png', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate tempora, cum sed saepe sint labore assumenda dignissimos obcaecati quidem, quaerat cumque dolor ad molestias eveniet repellendus perspiciatis nihil! Dolorum, odio.', 20),
(26, 'IMAGES/', '', 20);
-- --------------------------------------------------------
--
-- Структура таблицы `posts`
--
CREATE TABLE `posts` (
`img` varchar(355) NOT NULL,
`text` varchar(355) NOT NULL,
`post_id` int(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `posts`
--
INSERT INTO `posts` (`img`, `text`, `post_id`) VALUES
('6.png', 'ffff', 1),
('3.png', '4444', 2),
('google.png', '9999', 3),
('5.jpg', '666666666', 4),
('instagram.jpg', 'tttttttttttttttttttttt', 5),
('instagram.jpg', 'gavnj', 6),
('7.jpg', 'gedqb', 7),
('5.jpg', 'bye', 8),
('1.jpg', 'ffff', 9),
('4.jpg', 'gg', 10),
('4.jpg', 'gg', 11),
('4.jpg', 'gg', 12),
('4.jpg', 'bye', 13),
('4.jpg', 'naa', 14),
('4.jpg', 'naa', 15),
('4.jpg', 'lll', 16),
('1.png', 'ffffefefefef', 17);
-- --------------------------------------------------------
--
-- Структура таблицы `store`
--
CREATE TABLE `store` (
`img` varchar(355) NOT NULL,
`text` varchar(355) NOT NULL,
`price` varchar(355) NOT NULL,
`id` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `store`
--
INSERT INTO `store` (`img`, `text`, `price`, `id`) VALUES
('1.jpg', 'Just Cause', '1999', 1),
('2.jpg', 'Far Cry: New Dawn', '1999', 11),
('14.jpg', 'minecraft', '999', 21),
('4.jpg', 'game', '100', 23);
-- --------------------------------------------------------
--
-- Структура таблицы `students`
--
CREATE TABLE `students` (
`name` varchar(355) NOT NULL,
`surname` varchar(355) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `students`
--
INSERT INTO `students` (`name`, `surname`) VALUES
('Нил', 'Армстронг'),
('Майкл', 'Джексон'),
('Селена', 'Гомез');
-- --------------------------------------------------------
--
-- Структура таблицы `students2`
--
CREATE TABLE `students2` (
`name` varchar(355) NOT NULL,
`id` int(10) NOT NULL,
`lesson_id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `students2`
--
INSERT INTO `students2` (`name`, `id`, `lesson_id`) VALUES
('egor', 1, 7),
('georgy', 2, 3),
('vanya', 3, 2),
('liuba', 4, 5),
('beka', 5, 4);
-- --------------------------------------------------------
--
-- Структура таблицы `tweet`
--
CREATE TABLE `tweet` (
`logo` varchar(355) NOT NULL,
`title` varchar(355) NOT NULL,
`text` varchar(355) NOT NULL,
`img` varchar(355) NOT NULL,
`id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `tweet`
--
INSERT INTO `tweet` (`logo`, `title`, `text`, `img`, `id`) VALUES
('post1.jpg', 'Habr@habr_com', 'ufgfhjfjh', 'habr.jpg', 1),
('post2.png', 'Вести.Hi-tech@vestihitech', 'Lorem ipsum — классическая панграмма, условный, зачастую бессмысленный текст-заполнитель, вставляемый в макет страницы.', 'vesti_hi_tech.jpg', 2),
('avatar.jpg', 'привет', 'hello world', 'background.jpg', 19);
-- --------------------------------------------------------
--
-- Структура таблицы `users`
--
CREATE TABLE `users` (
`id` int(255) NOT NULL,
`username` varchar(355) NOT NULL,
`name` varchar(355) NOT NULL,
`password` varchar(355) NOT NULL,
`avatar` varchar(355) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `users`
--
INSERT INTO `users` (`id`, `username`, `name`, `password`, `avatar`) VALUES
(8, 'username', 'name', 'password', 'IMAGES/titanfall2.jpeg'),
(9, 'asdasd', 'ssss', '111', 'IMAGES/3.jpg'),
(10, 'user', 'nameee', '222', 'IMAGES/6831.jpg'),
(11, 'GUCCI', 'Gucci Gucciano', '111', 'IMAGES/gucci.jpg'),
(12, 'somebody', 'once told me', '111', 'IMAGES/shrek.jpg'),
(13, 'cartoonnetwork', 'cartoon network', '111', 'IMAGES/cartoonnet.png'),
(14, 'photomaker', 'photo', '111', 'IMAGES/photomaker.jpg'),
(15, 'killmepls', '111', '111', 'IMAGES/gavno.jpeg'),
(16, 'shingis', '111', '111', 'IMAGES/shingis.jpg'),
(17, 'asd', 'asd', '111', 'IMAGES/dmc.jpg'),
(18, '1', '1', '1', 'IMAGES/1.jpg'),
(19, '7', '2', '2', 'IMAGES/2.jpg'),
(20, '123', '123', 'password', 'IMAGES/2.jpg');
-- --------------------------------------------------------
--
-- Структура таблицы `wish`
--
CREATE TABLE `wish` (
`id` int(10) NOT NULL,
`text` varchar(355) NOT NULL,
`data` date NOT NULL,
`img` varchar(355) NOT NULL,
`status` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `instagram`
--
ALTER TABLE `instagram`
ADD PRIMARY KEY (`user_id`);
--
-- Индексы таблицы `journal`
--
ALTER TABLE `journal`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `lessons`
--
ALTER TABLE `lessons`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `pin`
--
ALTER TABLE `pin`
ADD PRIMARY KEY (`pin_id`);
--
-- Индексы таблицы `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`post_id`);
--
-- Индексы таблицы `store`
--
ALTER TABLE `store`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `students2`
--
ALTER TABLE `students2`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `tweet`
--
ALTER TABLE `tweet`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `wish`
--
ALTER TABLE `wish`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `comments`
--
ALTER TABLE `comments`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39;
--
-- AUTO_INCREMENT для таблицы `instagram`
--
ALTER TABLE `instagram`
MODIFY `user_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT для таблицы `journal`
--
ALTER TABLE `journal`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT для таблицы `lessons`
--
ALTER TABLE `lessons`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT для таблицы `pin`
--
ALTER TABLE `pin`
MODIFY `pin_id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT для таблицы `posts`
--
ALTER TABLE `posts`
MODIFY `post_id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT для таблицы `store`
--
ALTER TABLE `store`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
--
-- AUTO_INCREMENT для таблицы `students2`
--
ALTER TABLE `students2`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT для таблицы `tweet`
--
ALTER TABLE `tweet`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
--
-- AUTO_INCREMENT для таблицы `users`
--
ALTER TABLE `users`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT для таблицы `wish`
--
ALTER TABLE `wish`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
b809eabbdb38e6b5c44fdda47737bca0af01540f | SQL | leed25d/golden | /dotWine/drive_c/XEClient/oledb/samples/RefCur/RefCur.sql | UTF-8 | 1,308 | 3.328125 | 3 | [] | no_license | CREATE OR REPLACE PACKAGE Employees AS
TYPE empcur IS REF CURSOR;
PROCEDURE GetEmpRecords(p_cursor OUT empcur,
indeptno IN NUMBER,
p_errorcode OUT NUMBER);
FUNCTION GetDept(inempno IN NUMBER,
p_errorcode OUT NUMBER)
RETURN empcur;
END Employees;
/
CREATE OR REPLACE PACKAGE BODY Employees AS
PROCEDURE GetEmpRecords(p_cursor OUT empcur,
indeptno IN NUMBER,
p_errorcode OUT NUMBER) IS
BEGIN
p_errorcode := 0;
OPEN p_cursor FOR
SELECT *
FROM emp
WHERE deptno = indeptno
ORDER BY empno;
EXCEPTION
WHEN OTHERS THEN
p_errorcode:= SQLCODE;
END GetEmpRecords;
FUNCTION GetDept(inempno IN NUMBER,
p_errorcode OUT NUMBER)
RETURN empcur IS
p_cursor empcur;
BEGIN
p_errorcode := 0;
OPEN p_cursor FOR
SELECT deptno
FROM emp
WHERE empno = inempno;
RETURN (p_cursor);
EXCEPTION
WHEN OTHERS THEN
p_errorcode:= SQLCODE;
END GetDept;
END Employees;
/
| true |
588080081165e17353fb3ba7e3ee5d2ce82b763c | SQL | keipham/e-commerce_website_PL-SQL | /non-apex/model/CONSTRAINTS/SOK_PRODUCT_DETAIL_LU.sql | UTF-8 | 1,096 | 2.84375 | 3 | [
"MIT"
] | permissive | --------------------------------------------------------
-- Constraints for Table SOK_PRODUCT_DETAIL_LU
--------------------------------------------------------
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" ADD CONSTRAINT "SOK_PRODUCT_DETAIL_PK" PRIMARY KEY ("PRODUCT_DETAIL_ID")
USING INDEX ENABLE;
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" ADD CHECK (product_detail_stock>= 0) ENABLE;
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" MODIFY ("UPDATED_BY" NOT NULL ENABLE);
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" MODIFY ("UPDATED_DATE" NOT NULL ENABLE);
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" MODIFY ("CREATED_BY" NOT NULL ENABLE);
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" MODIFY ("CREATED_DATE" NOT NULL ENABLE);
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" MODIFY ("PRODUCT_DETAIL_STOCK" NOT NULL ENABLE);
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" MODIFY ("PRODUCT_ID" NOT NULL ENABLE);
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" MODIFY ("SEX_CODE" NOT NULL ENABLE);
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" MODIFY ("SIZE_RANGE_CODE" NOT NULL ENABLE);
ALTER TABLE "SOK_PRODUCT_DETAIL_LU" MODIFY ("PRODUCT_DETAIL_ID" NOT NULL ENABLE);
| true |
8d2aa050a73fdef389a1fca35fda660324dfc777 | SQL | levelp/java_07 | /webapp/config/CREATE_001.sql | UTF-8 | 826 | 4.03125 | 4 | [] | no_license | CREATE TABLE resume (
uuid CHAR(36) PRIMARY KEY NOT NULL,
full_name TEXT NOT NULL,
location TEXT
);
CREATE TABLE contact (
id SERIAL,
resume_uuid CHAR(36) NOT NULL,
type TEXT NOT NULL,
value TEXT NOT NULL,
CONSTRAINT contant_pkey PRIMARY KEY (id),
CONSTRAINT contact_fk FOREIGN KEY (resume_uuid)
REFERENCES resume (uuid)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE
)
WITH (OIDS = FALSE);
CREATE UNIQUE INDEX contact_idx ON contact
USING BTREE (resume_uuid, type);
CREATE TABLE TEXT_SECTION
(
id SERIAL,
resume_uuid CHAR(36) NOT NULL,
type VARCHAR NOT NULL,
values VARCHAR NOT NULL,
CONSTRAINT text_section_pkey PRIMARY KEY (id),
FOREIGN KEY (resume_uuid) REFERENCES resume (uuid) ON DELETE CASCADE
);
| true |
89d0f8741f664b0ebfe1a8b5e879cea85d0ed077 | SQL | white-van/freeflo.io | /backend/schema.sql | UTF-8 | 735 | 3.5625 | 4 | [
"MIT"
] | permissive | CREATE TYPE pr_status AS ENUM ('approved', 'denied', 'pending');
CREATE TABLE IF NOT EXISTS users (
ID SERIAL PRIMARY KEY,
username VARCHAR(30) UNIQUE,
email VARCHAR(30),
password VARCHAR(30) NOT NULL
);
CREATE TABLE IF NOT EXISTS articles (
author_id INT REFERENCES users(ID) ,
article_id SERIAL PRIMARY KEY,
title VARCHAR(100),
body VARCHAR(10485760),
image_url VARCHAR(300),
updated_at timestamp with time zone DEFAULT now()
);
CREATE TABLE IF NOT EXISTS reviews (
author_id INT REFERENCES users(ID),
article_id INT REFERENCES articles(article_id),
pr_title VARCHAR(100),
body VARCHAR(10485760),
image_url VARCHAR(300),
created_at timestamp with time zone DEFAULT now(),
review_status pr_status
) | true |
d8dc11789a7708ced73e1e9e1588f4dd9915a0cd | SQL | andri000me/web-2-mi | /web_2_mi.sql | UTF-8 | 2,430 | 3.125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jul 10, 2018 at 10:37 AM
-- Server version: 10.1.13-MariaDB
-- PHP Version: 5.6.23
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: `web_2_mi`
--
-- --------------------------------------------------------
--
-- Table structure for table `barang`
--
CREATE TABLE `barang` (
`id` int(11) NOT NULL,
`nama_barang` varchar(255) NOT NULL,
`deskripsi` text NOT NULL,
`kategori` varchar(255) NOT NULL,
`harga` decimal(13,0) NOT NULL,
`foto` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `barang`
--
INSERT INTO `barang` (`id`, `nama_barang`, `deskripsi`, `kategori`, `harga`, `foto`) VALUES
(9, 'qqqqq', 'deskri', 'kate', '1111', 'foto.jpg'),
(10, 'ryrty', 'trytry', 'rty', '100000', 'rtytry');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`email` varchar(50) NOT NULL,
`name` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`status` enum('admin','staff') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `email`, `name`, `password`, `status`) VALUES
(5, 'qwe@qwe.com', 'Pahrul Irfan', 'f4542db9ba30f7958ae42c113dd87ad21fb2eddb', 'admin'),
(6, 'admin@admin.com', 'Administrator', 'f4542db9ba30f7958ae42c113dd87ad21fb2eddb', 'admin'),
(7, 'staff@admin.com', 'Pegawai', 'f4542db9ba30f7958ae42c113dd87ad21fb2eddb', 'staff');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `barang`
--
ALTER TABLE `barang`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `barang`
--
ALTER TABLE `barang`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
a71bae431f7fb5fe7142ddeb2c8eaf49cbbdc214 | SQL | Fellyx/adpizza | /banco_de_dados.sql | UTF-8 | 5,655 | 3.109375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.2.12deb2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Tempo de geração: 04/06/2015 às 15:16
-- Versão do servidor: 5.6.24-0ubuntu2
-- Versão do PHP: 5.6.4-4ubuntu6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Banco de dados: `adpizza_development`
--
-- --------------------------------------------------------
--
-- Estrutura para tabela `clientes`
--
CREATE TABLE IF NOT EXISTS `clientes` (
`id` int(11) NOT NULL,
`nm_cliente` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`num_tel_cliente` int(11) DEFAULT NULL,
`nm_endereco_cliente` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`num_endereco` int(11) DEFAULT NULL,
`nm_complemento` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`nm_bairro` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`nm_cidade` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`nm_uf` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`cep` int(11) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Fazendo dump de dados para tabela `clientes`
--
INSERT INTO `clientes` (`id`, `nm_cliente`, `num_tel_cliente`, `nm_endereco_cliente`, `num_endereco`, `nm_complemento`, `nm_bairro`, `nm_cidade`, `nm_uf`, `created_at`, `updated_at`, `cep`) VALUES
(1, 'José Pedro', 33424561, 'Rua Amarela', 2, 'Casa B', 'Vila Azul', 'Santos', 'SP', '2015-05-29 19:40:41', '2015-06-03 16:54:44', 11345020);
-- --------------------------------------------------------
--
-- Estrutura para tabela `itens`
--
CREATE TABLE IF NOT EXISTS `itens` (
`id` int(11) NOT NULL,
`nm_item` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`qtd_item` float DEFAULT NULL,
`vl_item` float DEFAULT NULL,
`ds_item` text COLLATE utf8_unicode_ci,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Fazendo dump de dados para tabela `itens`
--
INSERT INTO `itens` (`id`, `nm_item`, `qtd_item`, `vl_item`, `ds_item`, `created_at`, `updated_at`) VALUES
(1, 'Pizza Mussarela', 110, 20, 'Mussarela e Tomate', '2015-05-30 15:25:43', '2015-06-04 17:01:27'),
(2, 'Pizza Pizzaiolo', 100, 35, 'Linguiça Calabresa, Linguiça Toscana, Catupiry e Bacon', '2015-05-30 15:28:21', '2015-05-30 15:28:21');
-- --------------------------------------------------------
--
-- Estrutura para tabela `itens_pedidos`
--
CREATE TABLE IF NOT EXISTS `itens_pedidos` (
`item_id` int(11) DEFAULT NULL,
`pedido_id` int(11) DEFAULT NULL,
`qtd_item_pedido` float DEFAULT NULL,
`vl_item_pedido` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Fazendo dump de dados para tabela `itens_pedidos`
--
INSERT INTO `itens_pedidos` (`item_id`, `pedido_id`, `qtd_item_pedido`, `vl_item_pedido`) VALUES
(20, NULL, 2, 40),
(35, NULL, 2, 70),
(NULL, NULL, NULL, NULL),
(NULL, NULL, NULL, NULL),
(NULL, NULL, NULL, NULL),
(NULL, NULL, NULL, NULL),
(NULL, NULL, NULL, NULL),
(NULL, NULL, NULL, NULL),
(NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estrutura para tabela `pedidos`
--
CREATE TABLE IF NOT EXISTS `pedidos` (
`id` int(11) NOT NULL,
`cliente_id` int(11) DEFAULT NULL,
`dt_pedido` date DEFAULT NULL,
`vl_total` float DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Fazendo dump de dados para tabela `pedidos`
--
INSERT INTO `pedidos` (`id`, `cliente_id`, `dt_pedido`, `vl_total`, `created_at`, `updated_at`) VALUES
(4, 1, '2015-06-03', 110, '2015-06-03 16:53:51', '2015-06-03 16:53:51');
-- --------------------------------------------------------
--
-- Estrutura para tabela `schema_migrations`
--
CREATE TABLE IF NOT EXISTS `schema_migrations` (
`version` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Fazendo dump de dados para tabela `schema_migrations`
--
INSERT INTO `schema_migrations` (`version`) VALUES
('20150529150503'),
('20150529190834'),
('20150529193011'),
('20150529203709'),
('20150530145035'),
('20150530150337'),
('20150530151239');
--
-- Índices de tabelas apagadas
--
--
-- Índices de tabela `clientes`
--
ALTER TABLE `clientes`
ADD PRIMARY KEY (`id`);
--
-- Índices de tabela `itens`
--
ALTER TABLE `itens`
ADD PRIMARY KEY (`id`);
--
-- Índices de tabela `pedidos`
--
ALTER TABLE `pedidos`
ADD PRIMARY KEY (`id`);
--
-- Índices de tabela `schema_migrations`
--
ALTER TABLE `schema_migrations`
ADD UNIQUE KEY `unique_schema_migrations` (`version`);
--
-- AUTO_INCREMENT de tabelas apagadas
--
--
-- AUTO_INCREMENT de tabela `clientes`
--
ALTER TABLE `clientes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `itens`
--
ALTER TABLE `itens`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `pedidos`
--
ALTER TABLE `pedidos`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
5e40e4e5b8bbd09e39b82e233bab02f692f16007 | SQL | fruscil/AFScripts | /DDL_Split_From_Terry/EMOC3_Script-20140219100142_converted/Stored_Procedures/SP_emoc3.get_moc_joaps.sql | UTF-8 | 854 | 3.03125 | 3 | [] | no_license | --<ScriptOptions statementTerminator="@"/>
CREATE PROCEDURE "EMOC3"."GET_MOC_JOAPS" (
p_cursor OUT emoc_types.emoc_cursor,
mocidin NUMBER
)
AS
BEGIN
-- RETURN THE CURSOR FOR THE RECORDSET
OPEN p_cursor FOR
SELECT joap.joapid, joap.joapcode, joap.joapdescription,
joap.landing, joap.redcapstatus, joap.defaultjoap,
joap.colorrulesid, joap.mocid, colorrules.colorid,
colorrules.colorrank, colorrules.codetype, colors.colorname,
colors.colorvalue, colors.fontcolor
FROM joap, colorrules, colors
WHERE ( (colors.colorid(+) = colorrules.colorid)
AND (colorrules.colorrulesid(+) = joap.colorrulesid)
AND (joap.mocid = mocidin)
)
ORDER BY joapcode;
END get_moc_joaps;
@
| true |
afb645682e41ae24ea945107eae8a0584d163eb4 | SQL | Air-Cooled/diboot | /iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-sqlserver-upgrade.sql | UTF-8 | 5,249 | 3.296875 | 3 | [
"Apache-2.0"
] | permissive | ALTER TABLE ${SCHEMA}.iam_user ADD tenant_id bigint not null default 0;
ALTER TABLE ${SCHEMA}.iam_account ADD tenant_id bigint not null default 0;
ALTER TABLE ${SCHEMA}.iam_role ADD tenant_id bigint not null default 0;
ALTER TABLE ${SCHEMA}.iam_user_role ADD tenant_id bigint not null default 0;
ALTER TABLE ${SCHEMA}.iam_frontend_permission ADD tenant_id bigint not null default 0;
ALTER TABLE ${SCHEMA}.iam_role_permission ADD tenant_id bigint not null default 0;
ALTER TABLE ${SCHEMA}.iam_login_trace ADD tenant_id bigint not null default 0;
execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'tenant_id';
execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'tenant_id';
execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_role, 'column', 'tenant_id';
execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_user_role, 'column', 'tenant_id';
execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'tenant_id';
execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_role_permission, 'column', 'tenant_id';
execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'tenant_id';
CREATE nonclustered INDEX idx_iam_user_tenant on iam_user(tenant_id);
CREATE nonclustered INDEX idx_iam_account_tenant on iam_account(tenant_id);
CREATE nonclustered INDEX idx_iam_role_tenant on iam_role(tenant_id);
CREATE nonclustered INDEX idx_iam_user_role_tenant on iam_user_role(tenant_id);
CREATE nonclustered INDEX idx_frontend_permission_tenant on iam_frontend_permission(tenant_id);
CREATE nonclustered INDEX idx_iam_role_permission_tenant on iam_role_permission(tenant_id);
CREATE nonclustered INDEX idx_iam_login_trace_tenant on iam_login_trace(tenant_id);
-- 操作日志表
create table ${SCHEMA}.iam_operation_log
(
id bigint identity ,
tenant_id bigint not null default 0,
business_obj varchar(100) not null,
operation varchar(100) not null,
user_type varchar(100) default 'IamUser' not null ,
user_id bigint not null ,
user_realname varchar(100) null,
request_uri varchar(500) not null,
request_method varchar(20) not null,
request_params varchar(1000) null,
request_ip varchar(50) null,
status_code smallint default 0 not null,
error_msg varchar(1000) null,
is_deleted tinyint default 0 not null ,
create_time datetime default CURRENT_TIMESTAMP not null,
constraint PK_iam_operation_log primary key (id)
);
execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'id';
execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'tenant_id';
execute sp_addextendedproperty 'MS_Description', N'业务对象', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'business_obj';
execute sp_addextendedproperty 'MS_Description', N'操作描述', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'operation';
execute sp_addextendedproperty 'MS_Description', N'用户类型', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'user_type';
execute sp_addextendedproperty 'MS_Description', N'用户ID', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'user_id';
execute sp_addextendedproperty 'MS_Description', N'用户姓名', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'user_realname';
execute sp_addextendedproperty 'MS_Description', N'请求URI', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'request_uri';
execute sp_addextendedproperty 'MS_Description', N'请求方式', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'request_method';
execute sp_addextendedproperty 'MS_Description', N'请求参数', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'request_params';
execute sp_addextendedproperty 'MS_Description', N'IP', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'request_ip';
execute sp_addextendedproperty 'MS_Description', N'状态码', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'status_code';
execute sp_addextendedproperty 'MS_Description', N'异常信息', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'error_msg';
execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'is_deleted';
execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'create_time';
execute sp_addextendedproperty 'MS_Description', N'操作日志', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, null, null;
-- 创建索引
create nonclustered index idx_iam_operation_log on iam_operation_log (user_type, user_id);
create nonclustered index idx_iam_operation_log_tenant on iam_operation_log(tenant_id); | true |
db90b71ee961914cf63e6a79c470080be8fee256 | SQL | Julienski/MyQAPortfolio | /SkilloQueries.sql | UTF-8 | 7,104 | 4.125 | 4 | [] | no_license | #1. Брой на потребители.
Select * from users;
#2. Най-стария потребител.
Select birthDate, username
from users
order by birthDate asc limit 1;
#3. Най-младия потребител.
Select birthDate, username
from users
order by birthDate desc limit 1;
#4. Колко потребители са регистрирани с мейли от abv и gmail. И колко с различни от двата.
Select count(*) from users
where email like '%gmail.com'
union all
Select count(*) from users
where email like '%abv.bg'
union all
Select count(*) from users
where email not like 'gmail.com' and email not like '%abv.bg';
#5. Кои потребители за баннати.
Select username from users
where isBanned=1;
#6. Изкарайте всички потребители от базата като ги наредите по име в азбучен ред и дата на раждане(от най-младия към най-възрастния).
Select * from users
order by username, birthDate desc;
#7. Изкарайте всички потребители от базата, на които потребителското име започва с буквата А.
Select * from users
where username like 'A%';
#8. Изкарайте всички потребители от базата, които съдържат а username името си.
Select * from users
where username like '%A%';
#9. Изкарайте всички потребители от базата, чието име се състои от 2 имена.
Select * from users
where username REGEXP '[[a-z][[:blank:]][a-z]';
#10. Регистрирайте 1 юзър през UI-а и го забранете след това от базата.
Update users
set isBanned=0
where username='username';
#11. Брой на всички постове.
Select count(*) from posts;
#12. Брой на всички постове групирани по статуса на post-a.
Select postStatus, count(*) from posts
group by postStatus;
#13. Намерете поста/овете с най-къс caption.
Select min(caption) from posts;
#14. Покажете поста с най-дълъг caption
Select max(caption) from posts;
#15. Кой потребител има най-много постове. Използвайте join заявка.
Select u.username, count(*) as posts
from users u
left join posts p
on u.id=p.userid
group by u.username
order by posts desc limit 1;
#16. Кои потребители имат най-малко постове. Използвайте join заявка.
Select u.username, count(*) as posts
from users u
left join posts p
on u.id=p.userid
group by u.username
order by posts asc limit 1;
#17. Колко потребителя с по 1 пост имаме. Използвайте join заявка, having clause и вложени заявки.
Select count(username)
from
(
select u.username, count(*) as posts
from users u
left join posts p
on u.id=p.userid
group by u.username
having (posts=1)
)a;
#18. Колко потребителя с по малко от 5 поста имаме. Използвайте join заявка, having clause и вложени заявки.
Select count(username)
from
(
select u.username, count(*) as posts
from users u
left join posts p
on u.id=p.userid
group by u.username
having (posts<5)
)a;
#19. Кои са постовете с най-много коментари. Използвайте вложена заявка и where clause.
Select *
from posts
where commentsCount =(select max(commentsCount) from posts);
#20. Покажете най-стария пост. Може да използвате order или с aggregate function.
Select * from posts
order by createdAt limit 1;
#21. Покажете най-новия пост. Може с order или с aggregate function.
Select * from posts
order by createdAt desc limit 1;
#22. Покажете всички постове с празен caption.
Select * from posts
where caption='';
#23. Създайте потребител през UI-а, добавете му public пост през базата и проверете дали се е създал през UI-а.
Insert into posts (caption, coverUrl, postStatus, createdAt, isDeleted, commentsCount, userId)
values ('test', 'https://i.imgur.com/gMPUKj7.jpg', 'public', curdate(), 0, 0, 2 );
#24. Покажете всички постове и коментарите им ако имат такива.
Select p.id, caption, content
from posts p
inner join comments c
on p.id = c.postId
order by p.id;
#25. Покажете само постове с коментари и самите коментари.
Select p.id, caption, content
from posts p
inner join comments c
on p.id = c.postId
order by p.id;
#26. Покажете името на потребителя с най-много коментари. Използвайте join клауза.
Select u.username, count(*) as c
from comments c
inner join users u
on c.userId = u.id
group by u.username
order by c desc;
#27. Покажете всички коментари, към кой пост принадлежат и кой ги е направил. Използвайте join клауза.
Select u.username, c.content, p.id, p.caption
from comments c
inner join users u
on c.userId = u.id
inner join posts p
on c.postId = p.id;
#28. Кои потребители са like-нали най-много постове.
Select u.username, count(*) c
from users_liked_posts ul
inner join
users u
on u.id=ul.usersId
group by u.username
order by c desc;
#29. Кои потребители не са like-вали постове.
Select u.username
from users u
left join
users_liked_posts ul
on u.id=ul.usersId
where ul.usersId is null
order by u.username;
#30. Кои постове имат like-ове. Покажете id на поста и caption.
Select p.id, p.caption
from posts p
inner join users_liked_posts ul
on p.id=ul.postsId;
#31. Кои постове имат най-много like-ове. Покажете id на поста и caption.
Select p.id, p.caption, count(*) c
from posts p
inner join users_liked_posts ul
on p.id=ul.postsId
group by p.id, p.caption
order by c desc;
#32. Покажете всички потребители, които не follow-ват никого.
Select u.username from users u
left join
users_followers_users uf
on u.id = usersId_1
where usersId_1 is null;
#33. Покажете всички потребители, които не са follow-нати от никого.
Select u.username from users u
left join
users_followers_users uf
on u.id = usersId_2
where usersId_2 is null;
#34. Регистрирайте потребител през UI. Follow-нете някой съществуващ потребител и проверете дали записа го има в базата.
select * from users_followers_users
where usersId_1='firstuserID' and usersId_2='seconduserID';
| true |
e93e088faad7f0366a40951f5c0674a9e133f422 | SQL | smilescripts/indra | /panel/backup/Wed13Aug2014spk1407954593.sql | UTF-8 | 5,646 | 3.125 | 3 | [] | no_license | DROP TABLE histori;
CREATE TABLE `histori` (
`nrp` char(7) NOT NULL,
`histori` int(11) NOT NULL,
PRIMARY KEY (`nrp`),
CONSTRAINT `histori_ibfk_1` FOREIGN KEY (`nrp`) REFERENCES `pendaftaranmahasiswa` (`NRP`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO histori VALUES("6311238","1");
DROP TABLE infobeasiswa;
CREATE TABLE `infobeasiswa` (
`IDINFO` int(11) NOT NULL,
`IDBEASISWA` int(11) NOT NULL,
`IDPETUGAS` int(11) NOT NULL,
`TANGGAL_AWAL` date DEFAULT NULL,
`TANGGAL_AKHIR` date DEFAULT NULL,
`infobeasiswa` varchar(111) NOT NULL,
PRIMARY KEY (`IDINFO`),
KEY `IDBEASISWA` (`IDBEASISWA`),
KEY `IDPETUGAS` (`IDPETUGAS`),
CONSTRAINT `infobeasiswa_ibfk_2` FOREIGN KEY (`IDPETUGAS`) REFERENCES `petugas` (`IDPETUGAS`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO infobeasiswa VALUES("1","1","4","2014-06-02","2014-07-01","syarat Yang harus dikumpulkan paling lambat dari tanggal");
DROP TABLE jenisbeasiswa;
CREATE TABLE `jenisbeasiswa` (
`IDBEASISWA` int(11) NOT NULL,
`NAMA_BEASISWA` varchar(255) DEFAULT NULL,
PRIMARY KEY (`IDBEASISWA`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE jurusan;
CREATE TABLE `jurusan` (
`IDJURUSAN` int(11) NOT NULL AUTO_INCREMENT,
`IDPRODI` int(11) NOT NULL,
`NAMA_JURUSAN` varchar(255) DEFAULT NULL,
PRIMARY KEY (`IDJURUSAN`),
KEY `IDPRODI` (`IDPRODI`),
CONSTRAINT `jurusan_ibfk_1` FOREIGN KEY (`IDPRODI`) REFERENCES `prodi` (`IDPRODI`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
INSERT INTO jurusan VALUES("1","1","Teknik Informatika");
DROP TABLE kelas;
CREATE TABLE `kelas` (
`IDKELAS` int(11) NOT NULL,
`NAMA_KELAS` varchar(255) DEFAULT NULL,
PRIMARY KEY (`IDKELAS`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO kelas VALUES("1","3TI5");
DROP TABLE mahasiswa;
CREATE TABLE `mahasiswa` (
`NRP` char(7) NOT NULL,
`IDPRODI` int(11) NOT NULL,
`NAMAMHS` varchar(255) DEFAULT NULL,
`JK` varchar(255) DEFAULT NULL,
`ALAMATMHS` varchar(255) DEFAULT NULL,
`EMAIL` varchar(255) DEFAULT NULL,
`TELPONMHS` varchar(20) DEFAULT NULL,
`PASSWORDMHS` varchar(255) DEFAULT NULL,
PRIMARY KEY (`NRP`),
KEY `IDPRODI` (`IDPRODI`),
CONSTRAINT `mahasiswa_ibfk_1` FOREIGN KEY (`IDPRODI`) REFERENCES `prodi` (`IDPRODI`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO mahasiswa VALUES("6311238","1","Fajar","laki-laki","margahayu","fajar99@fellow.lpkia.ac.id","0857217986","2011");
DROP TABLE pendaftaranmahasiswa;
CREATE TABLE `pendaftaranmahasiswa` (
`IDDAFTAR` int(11) NOT NULL AUTO_INCREMENT,
`NRP` char(7) NOT NULL,
`TANGGAL` date DEFAULT NULL,
`FOTO` varchar(255) DEFAULT NULL,
`STATUS_PROSES` varchar(255) DEFAULT NULL,
PRIMARY KEY (`IDDAFTAR`),
KEY `NRP` (`NRP`),
CONSTRAINT `pendaftaranmahasiswa_ibfk_1` FOREIGN KEY (`NRP`) REFERENCES `mahasiswa` (`NRP`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
INSERT INTO pendaftaranmahasiswa VALUES("1","6311238","2014-08-13","petugas.png","Disetujui");
DROP TABLE penilaianmahasiswa;
CREATE TABLE `penilaianmahasiswa` (
`IDPENILAIAN` int(11) NOT NULL AUTO_INCREMENT,
`IDDAFTAR` int(11) NOT NULL,
`STATUS_PERSETUJUAN` varchar(255) DEFAULT NULL,
`TANGGAL_PENILAIAN` date DEFAULT NULL,
`HASIL_PENILAIAN` float DEFAULT NULL,
PRIMARY KEY (`IDPENILAIAN`),
KEY `IDDAFTAR` (`IDDAFTAR`),
CONSTRAINT `penilaianmahasiswa_ibfk_1` FOREIGN KEY (`IDDAFTAR`) REFERENCES `pendaftaranmahasiswa` (`IDDAFTAR`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
INSERT INTO penilaianmahasiswa VALUES("1","1","Disetujui","2014-08-13","4.35");
DROP TABLE petugas;
CREATE TABLE `petugas` (
`IDPETUGAS` int(11) NOT NULL AUTO_INCREMENT,
`NAMAPETUGAS` varchar(255) DEFAULT NULL,
`JKPETUGAS` varchar(255) DEFAULT NULL,
`ALAMATPETUGAS` varchar(255) DEFAULT NULL,
`EMAILPETUGAS` varchar(255) DEFAULT NULL,
`TELPONPETUGAS` varchar(255) DEFAULT NULL,
`PASSWORDPETUGAS` varchar(255) DEFAULT NULL,
PRIMARY KEY (`IDPETUGAS`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
INSERT INTO petugas VALUES("1","fajar","laki-laki","margahayu","fajar@gmail.com","091111111","fajar");
INSERT INTO petugas VALUES("2","Ika","Perempuan","Bandung ","ika@gmail.com","123451","ika");
INSERT INTO petugas VALUES("3","lpkia","Perempuan","Soekarno Hatta","lpkia@gmail.com","989898089","adminjaya");
INSERT INTO petugas VALUES("4","asd","Perempuan","Soekarno Hatta","lpkia@gmail.com","9767678","jayaadmin");
DROP TABLE petunjuk_pendaftaran;
CREATE TABLE `petunjuk_pendaftaran` (
`tata_cara` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE prodi;
CREATE TABLE `prodi` (
`IDPRODI` int(11) NOT NULL AUTO_INCREMENT,
`NAMA_PRODI` varchar(255) DEFAULT NULL,
PRIMARY KEY (`IDPRODI`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
INSERT INTO prodi VALUES("1","Manajemen Informatika");
DROP TABLE semester;
CREATE TABLE `semester` (
`IDSEMESTER` int(11) NOT NULL AUTO_INCREMENT,
`NRP` char(7) NOT NULL,
`IDKELAS` int(11) NOT NULL,
`NAMA_SEMESTER` varchar(255) DEFAULT NULL,
`TAHUNAJARAN` varchar(20) DEFAULT NULL,
`IDJURUSAN` int(11) NOT NULL,
PRIMARY KEY (`IDSEMESTER`),
KEY `IDKELAS` (`IDKELAS`),
KEY `IDJURUSAN` (`IDJURUSAN`),
KEY `NRP` (`NRP`),
CONSTRAINT `semester_ibfk_1` FOREIGN KEY (`IDKELAS`) REFERENCES `kelas` (`IDKELAS`),
CONSTRAINT `semester_ibfk_2` FOREIGN KEY (`IDJURUSAN`) REFERENCES `jurusan` (`IDJURUSAN`) ON UPDATE NO ACTION,
CONSTRAINT `semester_ibfk_3` FOREIGN KEY (`NRP`) REFERENCES `mahasiswa` (`NRP`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
INSERT INTO semester VALUES("1","6311238","1","Ganjil","2014","1");
| true |
d51a10c745b85465f3d0e98e6f2b7f9b94331cae | SQL | PaxAuz15/tests | /Talentuum-Healthatom/Challengue2/answer.sql | UTF-8 | 1,248 | 4.40625 | 4 | [] | no_license | -- FIRST QUESTION
SELECT titanes.nombre,titanes.altura
FROM titanes
JOIN muertes
ON titanes.id = muertes.id_titan
WHERE muertes.causa = 'Batallón 1'
ORDER BY titanes.altura DESC
LIMIT 1;
-- SECOND QUESTION
SELECT titanes.id,titanes.nombre, titanes.altura,avistamientos.fecha
FROM titanes
LEFT JOIN muertes
ON titanes.id = muertes.id_titan
JOIN avistamientos
ON titanes.id = avistamientos.id_titan
WHERE muertes.id_titan IS NULL
ORDER BY titanes.altura DESC;
-- THIRD QUESTION
SELECT *
FROM titanes
WHERE titanes.id
IN (
SELECT avistamientos.id_titan
FROM avistamientos
GROUP BY avistamientos.id_titan
HAVING COUNT(*)>1
)
-- FOURTH QUESTION
SELECT recursos.nombre as recurso, SUM(movimientos_recursos.cantidad) as cantidad,recursos.unidad
FROM recursos
JOIN movimientos_recursos
ON movimientos_recursos.id_recurso = recursos.id
JOIN muertes
ON muertes.id = movimientos_recursos.id_muerte
JOIN titanes
ON titanes.id = muertes.id_titan
WHERE titanes.altura <= 5
GROUP BY recursos.id
-- FIFTH QUESTION
SELECT titanes.id,titanes.nombre
FROM titanes
JOIN muertes
ON muertes.id_titan = titanes.id
JOIN avistamientos
ON avistamientos.id_titan = titanes.id
WHERE avistamientos.fecha > muertes.fecha | true |
a59eedd936c13cf40f4045289cd6013e55c5d64b | SQL | lucasmernin/fullstack_spring_mvc_webapp | /Blog_Script.sql | UTF-8 | 1,133 | 3.921875 | 4 | [] | no_license | DROP DATABASE IF EXISTS blog;
CREATE DATABASE blog;
USE blog;
CREATE TABLE `user` (
id int primary key auto_increment,
username varchar(20) not null,
`password` varchar(80) not null,
enabled boolean not null
);
CREATE TABLE tag (
id int primary key auto_increment,
`name` varchar(25) not null
);
CREATE TABLE category (
id int primary key auto_increment,
`name` varchar(25) not null
);
CREATE TABLE post (
id int primary key auto_increment,
userid int not null,
categoryid int not null,
`title` varchar(100) not null,
`content` text,
`date` date,
status varchar(10) not null,
foreign key(userid) references `user`(id),
foreign key(categoryid) references category(id)
);
CREATE TABLE `role` (
id int primary key auto_increment,
`role` varchar(30) not null
);
CREATE TABLE post_tag (
postid int not null,
tagid int not null,
primary key(postid, tagid),
foreign key(postid) references post(id),
foreign key(tagid) references tag(id)
);
CREATE TABLE user_role (
userid int not null,
roleid int not null,
primary key(userid, roleid),
foreign key(userid) references `user`(id),
foreign key(roleid) references `role`(id)
);
| true |
114c2b57bee9a0ddebde8ada71f91fae7f44b881 | SQL | metalrufflez/courses | /stanford_db/sql_social_core.sql | UTF-8 | 1,848 | 4.71875 | 5 | [] | no_license | /* Question 1
Find the names of all students who are friends with someone named Gabriel. */
select hs.name
from Highschooler hs join Friend f
on (hs.ID=f.ID1 and f.ID2 in
(select ID
from Highschooler
where name = 'Gabriel'))
or (hs.ID=f.ID2 and f.ID1 in
(select ID from
Highschooler
where name = 'Gabriel'))
group by hs.name;
/* Question 2
For every student who likes someone 2 or more grades younger than themselves,
return that student's name and grade, and the name and grade of the student
they like. */
select hs.name, hs.grade, hs2.name, hs2.grade
from Highschooler hs, Highschooler hs2, Likes l
where ((hs.id=l.id1
and hs2.id=l.id2
and (hs.grade-hs2.grade)>=2));
/* Question 3
For every pair of students who both like each other, return the name and
grade of both students. Include each pair only once, with the two names
in alphabetical order. */
select hs1.name, hs1.grade, hs2.name, hs2.grade
from Likes l1, Likes l2, Highschooler hs1, Highschooler hs2
where l1.id1 = l2.id2
and l1.id2 = l2.id1
and hs1.id=l1.id1
and hs2.id=l1.id2
and hs1.name < hs2.name;
/* Question 4
Find names and grades of students who only have friends in the same grade.
Return the result sorted by grade, then by name within each grade. */
select name, grade
from Highschooler
where id not in
(select hs1.id
from Highschooler hs1, Highschooler hs2, Friend f1
where hs1.id=f1.id1 and hs2.id=f1.id2 and hs1.grade!=hs2.grade)
order by grade, name;
/* Question 5
Find the name and grade of all students who are liked by more than one other
student. */
select hs.name, hs.grade
from (select l1.id2 as id, count(l1.id2) as count
from Likes l1 group by l1.id2) s
join Highschooler hs
where s.count > 1 and hs.id=s.id;
| true |
1020e3fb730b2ce8829259020c56bc32d9aae6c7 | SQL | Hansimov/cs-notes | /sql/NK-18 获取当前薪水第二多的员工的信息 2.sql | UTF-8 | 434 | 4.21875 | 4 | [] | no_license | with t as (
select s1.salary
from salaries as s1
left join salaries as s2
on s1.salary <= s2.salary
where s1.to_date = '9999-01-01'
and s2.to_date = '9999-01-01'
group by s1.salary
having count(distinct s2.salary)=2
)
select e.emp_no, s.salary, e.last_name, e.first_name
from employees as e
left join salaries as s
on e.emp_no = s.emp_no
where s.to_date = '9999-01-01'
and s.salary in t | true |
66660897bc3afbf9648be9d01ae8ebf1d7070a06 | SQL | jimmyalf/temp | /Spinit.Wpc.Synologen.Database/dbo/Stored Procedures/spBaseRemoveLanguage.sql | UTF-8 | 332 | 2.734375 | 3 | [] | no_license | create PROCEDURE spBaseRemoveLanguage
@id INT,
@status INT OUTPUT
AS
DELETE From tblBaseLocationsLanguages
WHERE cLanguageId = @id
DELETE FROM tblBaseLanguages
WHERE cId = @id
IF (@@ERROR = 0)
BEGIN
SELECT @status = 0
END
ELSE
BEGIN
SELECT @status = @@ERROR
END
| true |
042d14e9b88d1c8889b2a2981d8b0787c22f1d12 | SQL | itekiosu/gulag | /ext/db.sql | UTF-8 | 34,490 | 3.40625 | 3 | [
"MIT"
] | permissive | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
-- --------------------------------------------------------
--
-- Table structure for table `badges`
--
CREATE TABLE `badges` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`colour` varchar(255) NOT NULL,
`icon` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `badges`
--
INSERT INTO `badges` (`id`, `name`, `colour`, `icon`) VALUES
(1, 'Verified', 'color:rgb(0, 255, 21);', 'fas fa-check'),
(2, 'Admin', 'color:rgb(168, 19, 41);', 'fas fa-user-tie'),
(3, 'Donator', 'color:rgb(0, 162, 236);', 'fas fa-heart'),
(4, 'Nominator', 'color:rgb(237, 211, 62);', 'fas fa-circle'),
(6, 'Developer', 'color:rgb(147,112,219);', 'fas fa-blind'),
(7, 'Owner', '', 'fas fa-cog'),
(8, 'Co Owner', '', 'fas fa-battery-half');
ALTER TABLE `badges`
ADD PRIMARY KEY (id);
ALTER TABLE `badges`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
CREATE TABLE `user_hashes` (
`id` int(11) NOT NULL,
`osupath` char(32) NOT NULL,
`adapters` char(32) NOT NULL,
`uninstall_id` char(32) NOT NULL,
`disk_serial` char(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `user_hashes`
--
ALTER TABLE `user_hashes`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `user_hashes`
--
ALTER TABLE `user_hashes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Table structure for table `server_stats`
--
CREATE TABLE `server_stats` (
`online` int(100) NOT NULL DEFAULT '0',
`total` int(100) NOT NULL DEFAULT '0',
`unsupver` text NOT NULL,
`banver` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `server_stats`
--
INSERT INTO `server_stats` (`online`, `total`, `unsupver`, `banver`) VALUES
(0, 0, '', '');
CREATE TABLE `tourney_pool_maps` (
`map_id` int(11) NOT NULL,
`pool_id` int(11) NOT NULL,
`mods` int(11) NOT NULL,
`slot` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `tourney_pools`
--
CREATE TABLE `tourney_pools` (
`id` int(11) NOT NULL,
`name` varchar(16) NOT NULL,
`created_at` datetime NOT NULL,
`created_by` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `achievements`
--
CREATE TABLE `achievements` (
`id` int(11) NOT NULL,
`file` varchar(128) NOT NULL,
`name` varchar(128) CHARACTER SET utf8 NOT NULL,
`desc` varchar(256) CHARACTER SET utf8 NOT NULL,
`cond` varchar(256) NOT NULL,
`mode` tinyint(1) NOT NULL,
`custom` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `stats`
--
CREATE TABLE `stats` (
`id` int(11) NOT NULL,
`tscore_vn_std` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`tscore_vn_taiko` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`tscore_vn_catch` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`tscore_vn_mania` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`tscore_rx_std` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`tscore_rx_taiko` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`tscore_rx_catch` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`tscore_ap_std` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`rscore_vn_std` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`rscore_vn_taiko` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`rscore_vn_catch` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`rscore_vn_mania` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`rscore_rx_std` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`rscore_rx_taiko` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`rscore_rx_catch` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`rscore_ap_std` bigint(21) UNSIGNED NOT NULL DEFAULT '0',
`pp_vn_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`pp_vn_taiko` int(11) UNSIGNED NOT NULL DEFAULT '0',
`pp_vn_catch` int(11) UNSIGNED NOT NULL DEFAULT '0',
`pp_vn_mania` int(11) UNSIGNED NOT NULL DEFAULT '0',
`pp_rx_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`pp_rx_taiko` int(11) UNSIGNED NOT NULL DEFAULT '0',
`pp_rx_catch` int(11) UNSIGNED NOT NULL DEFAULT '0',
`pp_ap_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`plays_vn_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`plays_vn_taiko` int(11) UNSIGNED NOT NULL DEFAULT '0',
`plays_vn_catch` int(11) UNSIGNED NOT NULL DEFAULT '0',
`plays_vn_mania` int(11) UNSIGNED NOT NULL DEFAULT '0',
`plays_rx_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`plays_rx_taiko` int(11) UNSIGNED NOT NULL DEFAULT '0',
`plays_rx_catch` int(11) UNSIGNED NOT NULL DEFAULT '0',
`plays_ap_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`playtime_vn_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`playtime_vn_taiko` int(11) UNSIGNED NOT NULL DEFAULT '0',
`playtime_vn_catch` int(11) UNSIGNED NOT NULL DEFAULT '0',
`playtime_vn_mania` int(11) UNSIGNED NOT NULL DEFAULT '0',
`playtime_rx_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`playtime_rx_taiko` int(11) UNSIGNED NOT NULL DEFAULT '0',
`playtime_rx_catch` int(11) UNSIGNED NOT NULL DEFAULT '0',
`playtime_ap_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`acc_vn_std` float(6,3) NOT NULL DEFAULT '0.000',
`acc_vn_taiko` float(6,3) NOT NULL DEFAULT '0.000',
`acc_vn_catch` float(6,3) NOT NULL DEFAULT '0.000',
`acc_vn_mania` float(6,3) NOT NULL DEFAULT '0.000',
`acc_rx_std` float(6,3) NOT NULL DEFAULT '0.000',
`acc_rx_taiko` float(6,3) NOT NULL DEFAULT '0.000',
`acc_rx_catch` float(6,3) NOT NULL DEFAULT '0.000',
`acc_ap_std` float(6,3) NOT NULL DEFAULT '0.000',
`maxcombo_vn_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`maxcombo_vn_taiko` int(11) UNSIGNED NOT NULL DEFAULT '0',
`maxcombo_vn_catch` int(11) UNSIGNED NOT NULL DEFAULT '0',
`maxcombo_vn_mania` int(11) UNSIGNED NOT NULL DEFAULT '0',
`maxcombo_rx_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`maxcombo_rx_taiko` int(11) UNSIGNED NOT NULL DEFAULT '0',
`maxcombo_rx_catch` int(11) UNSIGNED NOT NULL DEFAULT '0',
`maxcombo_ap_std` int(11) UNSIGNED NOT NULL DEFAULT '0',
`rank_vn_std` int(11) DEFAULT '0',
`rank_rx_std` int(11) DEFAULT '0',
`rank_ap_std` int(11) DEFAULT '0',
`rank_rx_taiko` int(11) DEFAULT '0',
`rank_rx_catch` int(11) DEFAULT '0',
`rank_vn_taiko` int(11) DEFAULT '0',
`rank_vn_catch` int(11) DEFAULT '0',
`rank_vn_mania` int(11) DEFAULT '0',
`crank_vn_std` int(11) DEFAULT '0',
`crank_rx_std` int(11) DEFAULT '0',
`crank_ap_std` int(11) DEFAULT '0',
`crank_vn_taiko` int(11) DEFAULT '0',
`crank_vn_catch` int(11) DEFAULT '0',
`crank_vn_mania` int(11) DEFAULT '0',
`crank_rx_taiko` int(11) DEFAULT '0',
`crank_rx_catch` int(11) DEFAULT '0',
`lb_pp` int(11) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `startups`
--
CREATE TABLE `startups` (
`id` int(11) NOT NULL,
`ver_major` tinyint(4) NOT NULL,
`ver_minor` tinyint(4) NOT NULL,
`ver_micro` tinyint(4) NOT NULL,
`datetime` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `achievements`
--
INSERT INTO `achievements` (`id`, `file`, `name`, `desc`, `cond`, `mode`, `custom`) VALUES
(1, 'osu-skill-pass-1', 'Rising Star', 'Can\'t go forward without the first steps.', '2 >= score.sr > 1', 0, 0),
(2, 'osu-skill-pass-2', 'Constellation Prize', 'Definitely not a consolation prize. Now things start getting hard!', '3 >= score.sr > 2', 0, 0),
(3, 'osu-skill-pass-3', 'Building Confidence', 'Oh, you\'ve SO got this.', '(score.mods & 259 == 0) and 4 >= score.sr > 3', 0, 0),
(4, 'osu-skill-pass-4', 'Insanity Approaches', 'You\'re not twitching, you\'re just ready.', '5 >= score.sr > 4', 0, 0),
(5, 'osu-skill-pass-5', 'These Clarion Skies', 'Everything seems so clear now.', '6 >= score.sr > 5', 0, 0),
(6, 'osu-skill-pass-6', 'Above and Beyond', 'A cut above the rest.', '7 >= score.sr > 6', 0, 0),
(7, 'osu-skill-pass-7', 'Supremacy', 'All marvel before your prowess.', '8 >= score.sr > 7', 0, 0),
(8, 'osu-skill-pass-8', 'Absolution', 'My god, you\'re full of stars!', '9 >= score.sr > 8', 0, 0),
(9, 'osu-skill-pass-9', 'Event Horizon', 'No force dares to pull you under.', '10 >= score.sr > 9', 0, 0),
(10, 'osu-skill-pass-10', 'Phantasm', 'Fevered is your passion, extraordinary is your skill.', '11 >= score.sr > 10', 0, 0),
(11, 'osu-skill-fc-1', 'Totality', 'All the notes. Every single one.', 'score.perfect and 2 >= score.sr > 1', 0, 0),
(12, 'osu-skill-fc-2', 'Business As Usual', 'Two to go, please.', 'score.perfect and 3 >= score.sr > 2', 0, 0),
(13, 'osu-skill-fc-3', 'Building Steam', 'Hey, this isn\'t so bad.', 'score.perfect and 4 >= score.sr > 3', 0, 0),
(14, 'osu-skill-fc-4', 'Moving Forward', 'Bet you feel good about that.', 'score.perfect and 5 >= score.sr > 4', 0, 0),
(15, 'osu-skill-fc-5', 'Paradigm Shift', 'Surprisingly difficult.', 'score.perfect and 6 >= score.sr > 5', 0, 0),
(16, 'osu-skill-fc-6', 'Anguish Quelled', 'Don\'t choke.', 'score.perfect and 7 >= score.sr > 6', 0, 0),
(17, 'osu-skill-fc-7', 'Never Give Up', 'Excellence is its own reward.', 'score.perfect and 8 >= score.sr > 7', 0, 0),
(18, 'osu-skill-fc-8', 'Aberration', 'They said it couldn\'t be done. They were wrong.', 'score.perfect and 9 >= score.sr > 8', 0, 0),
(19, 'osu-skill-fc-9', 'Chosen', 'Reign among the Prometheans, where you belong.', 'score.perfect and 10 >= score.sr > 9', 0, 0),
(20, 'osu-skill-fc-10', 'Unfathomable', 'You have no equal.', 'score.perfect and 11 >= score.sr > 10', 0, 0),
(21, 'osu-combo-500', '500 Combo', '500 big ones! You\'re moving up in the world!', 'score.max_combo >= 500', 0, 0),
(22, 'osu-combo-750', '750 Combo', '750 notes back to back? Woah.', 'score.max_combo >= 750', 0, 0),
(23, 'osu-combo-1000', '1000 Combo', 'A thousand reasons why you rock at this game.', 'score.max_combo >= 1000', 0, 0),
(24, 'osu-combo-2000', '2000 Combo', 'Nothing can stop you now.', 'score.max_combo >= 2000', 0, 0),
(25, 'taiko-skill-pass-1', 'My First Don', 'Marching to the beat of your own drum. Literally.', '2 >= score.sr > 1', 1, 0),
(26, 'taiko-skill-pass-2', 'Katsu Katsu Katsu', 'Hora! Izuko!', '3 >= score.sr > 2', 1, 0),
(27, 'taiko-skill-pass-3', 'Not Even Trying', 'Muzukashii? Not even.', '4 >= score.sr > 3', 1, 0),
(28, 'taiko-skill-pass-4', 'Face Your Demons', 'The first trials are now behind you, but are you a match for the Oni?', '5 >= score.sr > 4', 1, 0),
(29, 'taiko-skill-pass-5', 'The Demon Within', 'No rest for the wicked.', '6 >= score.sr > 5', 1, 0),
(30, 'taiko-skill-pass-6', 'Drumbreaker', 'Too strong.', '7 >= score.sr > 6', 1, 0),
(31, 'taiko-skill-pass-7', 'The Godfather', 'You are the Don of Dons.', '8 >= score.sr > 7', 1, 0),
(32, 'taiko-skill-pass-8', 'Rhythm Incarnate', 'Feel the beat. Become the beat.', '9 >= score.sr > 8', 1, 0),
(33, 'taiko-skill-fc-1', 'Keeping Time', 'Don, then katsu. Don, then katsu..', 'score.perfect and 2 >= score.sr > 1', 1, 0),
(34, 'taiko-skill-fc-2', 'To Your Own Beat', 'Straight and steady.', 'score.perfect and 3 >= score.sr > 2', 1, 0),
(35, 'taiko-skill-fc-3', 'Big Drums', 'Bigger scores to match.', 'score.perfect and 4 >= score.sr > 3', 1, 0),
(36, 'taiko-skill-fc-4', 'Adversity Overcome', 'Difficult? Not for you.', 'score.perfect and 5 >= score.sr > 4', 1, 0),
(37, 'taiko-skill-fc-5', 'Demonslayer', 'An Oni felled forevermore.', 'score.perfect and 6 >= score.sr > 5', 1, 0),
(38, 'taiko-skill-fc-6', 'Rhythm\'s Call', 'Heralding true skill.', 'score.perfect and 7 >= score.sr > 6', 1, 0),
(39, 'taiko-skill-fc-7', 'Time Everlasting', 'Not a single beat escapes you.', 'score.perfect and 8 >= score.sr > 7', 1, 0),
(40, 'taiko-skill-fc-8', 'The Drummer\'s Throne', 'Percussive brilliance befitting royalty alone.', 'score.perfect and 9 >= score.sr > 8', 1, 0),
(41, 'fruits-skill-pass-1', 'A Slice Of Life', 'Hey, this fruit catching business isn\'t bad.', '2 >= score.sr > 1', 2, 0),
(42, 'fruits-skill-pass-2', 'Dashing Ever Forward', 'Fast is how you do it.', '3 >= score.sr > 2', 2, 0),
(43, 'fruits-skill-pass-3', 'Zesty Disposition', 'No scurvy for you, not with that much fruit.', '4 >= score.sr > 3', 2, 0),
(44, 'fruits-skill-pass-4', 'Hyperdash ON!', 'Time and distance is no obstacle to you.', '5 >= score.sr > 4', 2, 0),
(45, 'fruits-skill-pass-5', 'It\'s Raining Fruit', 'And you can catch them all.', '6 >= score.sr > 5', 2, 0),
(46, 'fruits-skill-pass-6', 'Fruit Ninja', 'Legendary techniques.', '7 >= score.sr > 6', 2, 0),
(47, 'fruits-skill-pass-7', 'Dreamcatcher', 'No fruit, only dreams now.', '8 >= score.sr > 7', 2, 0),
(48, 'fruits-skill-pass-8', 'Lord of the Catch', 'Your kingdom kneels before you.', '9 >= score.sr > 8', 2, 0),
(49, 'fruits-skill-fc-1', 'Sweet And Sour', 'Apples and oranges, literally.', 'score.perfect and 2 >= score.sr > 1', 2, 0),
(50, 'fruits-skill-fc-2', 'Reaching The Core', 'The seeds of future success.', 'score.perfect and 3 >= score.sr > 2', 2, 0),
(51, 'fruits-skill-fc-3', 'Clean Platter', 'Clean only of failure. It is completely full, otherwise.', 'score.perfect and 4 >= score.sr > 3', 2, 0),
(52, 'fruits-skill-fc-4', 'Between The Rain', 'No umbrella needed.', 'score.perfect and 5 >= score.sr > 4', 2, 0),
(53, 'fruits-skill-fc-5', 'Addicted', 'That was an overdose?', 'score.perfect and 6 >= score.sr > 5', 2, 0),
(54, 'fruits-skill-fc-6', 'Quickening', 'A dash above normal limits.', 'score.perfect and 7 >= score.sr > 6', 2, 0),
(55, 'fruits-skill-fc-7', 'Supersonic', 'Faster than is reasonably necessary.', 'score.perfect and 8 >= score.sr > 7', 2, 0),
(56, 'fruits-skill-fc-8', 'Dashing Scarlet', 'Speed beyond mortal reckoning.', 'score.perfect and 9 >= score.sr > 8', 2, 0),
(57, 'mania-skill-pass-1', 'First Steps', 'It isn\'t 9-to-5, but 1-to-9. Keys, that is.', '2 >= score.sr > 1', 3, 0),
(58, 'mania-skill-pass-2', 'No Normal Player', 'Not anymore, at least.', '3 >= score.sr > 2', 3, 0),
(59, 'mania-skill-pass-3', 'Impulse Drive', 'Not quite hyperspeed, but getting close.', '4 >= score.sr > 3', 3, 0),
(60, 'mania-skill-pass-4', 'Hyperspeed', 'Woah.', '5 >= score.sr > 4', 3, 0),
(61, 'mania-skill-pass-5', 'Ever Onwards', 'Another challenge is just around the corner.', '6 >= score.sr > 5', 3, 0),
(62, 'mania-skill-pass-6', 'Another Surpassed', 'Is there no limit to your skills?', '7 >= score.sr > 6', 3, 0),
(63, 'mania-skill-pass-7', 'Extra Credit', 'See me after class.', '8 >= score.sr > 7', 3, 0),
(64, 'mania-skill-pass-8', 'Maniac', 'There\'s just no stopping you.', '9 >= score.sr > 8', 3, 0),
(65, 'mania-skill-fc-1', 'Keystruck', 'The beginning of a new story', 'score.perfect and 2 >= score.sr > 1', 3, 0),
(66, 'mania-skill-fc-2', 'Keying In', 'Finding your groove.', 'score.perfect and 3 >= score.sr > 2', 3, 0),
(67, 'mania-skill-fc-3', 'Hyperflow', 'You can *feel* the rhythm.', 'score.perfect and 4 >= score.sr > 3', 3, 0),
(68, 'mania-skill-fc-4', 'Breakthrough', 'Many skills mastered, rolled into one.', 'score.perfect and 5 >= score.sr > 4', 3, 0),
(69, 'mania-skill-fc-5', 'Everything Extra', 'Giving your all is giving everything you have.', 'score.perfect and 6 >= score.sr > 5', 3, 0),
(70, 'mania-skill-fc-6', 'Level Breaker', 'Finesse beyond reason', 'score.perfect and 7 >= score.sr > 6', 3, 0),
(71, 'mania-skill-fc-7', 'Step Up', 'A precipice rarely seen.', 'score.perfect and 8 >= score.sr > 7', 3, 0),
(72, 'mania-skill-fc-8', 'Behind The Veil', 'Supernatural!', 'score.perfect and 9 >= score.sr > 8', 3, 0);
-- --------------------------------------------------------
--
-- Table structure for table `beta_keys`
--
CREATE TABLE `beta_keys` (
`beta_key` varchar(20) NOT NULL,
`used` int(1) NOT NULL DEFAULT '0',
`generated_by` varchar(200) NOT NULL,
`user` varchar(200) DEFAULT NULL,
`for_id` bigint(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `channels`
--
CREATE TABLE `channels` (
`id` int(11) NOT NULL,
`name` varchar(32) NOT NULL,
`topic` varchar(256) NOT NULL,
`read_priv` int(11) NOT NULL DEFAULT '1',
`write_priv` int(11) NOT NULL DEFAULT '2',
`auto_join` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `channels`
--
INSERT INTO `channels` (`id`, `name`, `topic`, `read_priv`, `write_priv`, `auto_join`) VALUES
(1, '#osu', 'General discussion.', 1, 2, 1),
(2, '#announce', 'Exemplary performance and public announcements.', 1, 24576, 1),
(3, '#lobby', 'Multiplayer lobby discussion room.', 1, 2, 0),
(4, '#supporter', 'General discussion for supporters.', 48, 48, 0),
(5, '#staff', 'General discussion for staff members.', 28672, 28672, 1),
(6, '#admin', 'General discussion for administrators.', 24576, 24576, 1),
(7, '#dev', 'General discussion for developers.', 16384, 16384, 1);
-- --------------------------------------------------------
--
-- Table structure for table `clans`
--
CREATE TABLE `clans` (
`id` int(11) NOT NULL,
`name` varchar(16) CHARACTER SET utf8 NOT NULL,
`tag` varchar(6) CHARACTER SET utf8 NOT NULL,
`owner` int(11) NOT NULL,
`created_at` int(11) NOT NULL,
`description` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `client_hashes`
--
CREATE TABLE `client_hashes` (
`userid` int(11) NOT NULL,
`osuver` char(32) NOT NULL,
`ip` varchar(32) NOT NULL,
`osupath` char(32) NOT NULL,
`adapters` char(32) NOT NULL,
`uninstall_id` char(32) NOT NULL,
`disk_serial` char(32) NOT NULL,
`latest_time` datetime NOT NULL,
`occurrences` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
CREATE TABLE `comments` (
`id` int(11) NOT NULL,
`target_id` int(11) NOT NULL COMMENT 'replay, map, or set id',
`target_type` enum('replay','map','song') NOT NULL,
`userid` int(11) NOT NULL,
`time` int(11) NOT NULL,
`comment` varchar(80) CHARACTER SET utf8 NOT NULL,
`colour` char(6) DEFAULT NULL COMMENT 'rgb hex string'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `discord`
--
CREATE TABLE `discord` (
`tag` varchar(110) CHARACTER SET utf8 NOT NULL,
`user` int(11) NOT NULL,
`code` varchar(110) NOT NULL,
`tag_id` bigint(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `favourites`
--
CREATE TABLE `favourites` (
`userid` int(11) NOT NULL,
`setid` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `friendships`
--
CREATE TABLE `friendships` (
`user1` int(11) NOT NULL,
`user2` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `logs`
--
CREATE TABLE `logs` (
`id` int(11) NOT NULL,
`from` int(11) NOT NULL COMMENT 'both from and to are playerids',
`to` int(11) NOT NULL,
`msg` varchar(2048) CHARACTER SET utf8 NOT NULL,
`time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `mail`
--
CREATE TABLE `mail` (
`id` int(11) NOT NULL,
`from_id` int(11) NOT NULL,
`to_id` int(11) NOT NULL,
`msg` text CHARACTER SET utf8 NOT NULL,
`time` int(11) DEFAULT NULL,
`read` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `maps`
--
CREATE TABLE `maps` (
`server` enum('osu!','gulag') NOT NULL DEFAULT 'osu!',
`id` int(11) NOT NULL,
`set_id` int(11) NOT NULL,
`status` int(11) NOT NULL,
`md5` char(32) NOT NULL,
`artist` varchar(128) CHARACTER SET utf8 NOT NULL,
`title` varchar(128) CHARACTER SET utf8 NOT NULL,
`version` varchar(128) CHARACTER SET utf8 NOT NULL,
`creator` varchar(19) CHARACTER SET utf8 NOT NULL COMMENT 'not 100% certain on len',
`last_update` datetime NOT NULL,
`total_length` int(11) NOT NULL,
`frozen` tinyint(1) NOT NULL DEFAULT '0',
`plays` int(11) NOT NULL DEFAULT '0',
`passes` int(11) NOT NULL DEFAULT '0',
`mode` tinyint(1) NOT NULL DEFAULT '0',
`bpm` float(12,2) NOT NULL DEFAULT '0.00',
`cs` float(4,2) NOT NULL DEFAULT '0.00',
`ar` float(4,2) NOT NULL DEFAULT '0.00',
`od` float(4,2) NOT NULL DEFAULT '0.00',
`hp` float(4,2) NOT NULL DEFAULT '0.00',
`diff` float(6,3) NOT NULL DEFAULT '0.000'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `performance_reports`
--
CREATE TABLE `performance_reports` (
`scoreid` int(11) NOT NULL,
`mod_mode` enum('vanilla','relax','autopilot') NOT NULL DEFAULT 'vanilla',
`os` varchar(64) NOT NULL,
`fullscreen` tinyint(1) NOT NULL,
`fps_cap` varchar(16) NOT NULL,
`compatibility` tinyint(1) NOT NULL,
`version` varchar(16) NOT NULL,
`start_time` int(11) NOT NULL,
`end_time` int(11) NOT NULL,
`frame_count` int(11) NOT NULL,
`spike_frames` int(11) NOT NULL,
`aim_rate` int(11) NOT NULL,
`completion` tinyint(1) NOT NULL,
`identifier` varchar(128) DEFAULT NULL COMMENT 'really don''t know much about this yet',
`average_frametime` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `pwreset`
--
CREATE TABLE `pwreset` (
`uid` int(100) NOT NULL,
`code` varchar(100) NOT NULL,
`used` int(1) NOT NULL,
`gentime` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `ratings`
--
CREATE TABLE `ratings` (
`userid` int(11) NOT NULL,
`map_md5` char(32) NOT NULL,
`rating` tinyint(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `requests`
--
CREATE TABLE `requests` (
`id` int(11) NOT NULL,
`requester` varchar(100) NOT NULL,
`map` int(11) NOT NULL,
`status` varchar(11) NOT NULL,
`type` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `scores_ap`
--
CREATE TABLE `scores_ap` (
`id` int(11) NOT NULL,
`map_md5` char(32) NOT NULL,
`score` int(11) NOT NULL,
`pp` float(7,3) NOT NULL,
`acc` float(6,3) NOT NULL,
`max_combo` int(11) NOT NULL,
`mods` int(11) NOT NULL,
`n300` int(11) NOT NULL,
`n100` int(11) NOT NULL,
`n50` int(11) NOT NULL,
`nmiss` int(11) NOT NULL,
`ngeki` int(11) NOT NULL,
`nkatu` int(11) NOT NULL,
`grade` varchar(2) NOT NULL DEFAULT 'N',
`status` tinyint(4) NOT NULL,
`mode` tinyint(4) NOT NULL,
`play_time` int(100) NOT NULL,
`time_elapsed` int(11) NOT NULL,
`client_flags` int(11) NOT NULL,
`userid` int(11) NOT NULL,
`perfect` tinyint(1) NOT NULL,
`mods_readable` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `scores_rx`
--
CREATE TABLE `scores_rx` (
`id` int(11) NOT NULL,
`map_md5` char(32) NOT NULL,
`score` int(11) NOT NULL,
`pp` float(7,3) NOT NULL,
`acc` float(6,3) NOT NULL,
`max_combo` int(11) NOT NULL,
`mods` int(11) NOT NULL,
`n300` int(11) NOT NULL,
`n100` int(11) NOT NULL,
`n50` int(11) NOT NULL,
`nmiss` int(11) NOT NULL,
`ngeki` int(11) NOT NULL,
`nkatu` int(11) NOT NULL,
`grade` varchar(2) NOT NULL DEFAULT 'N',
`status` tinyint(4) NOT NULL,
`mode` tinyint(4) NOT NULL,
`play_time` int(100) NOT NULL,
`time_elapsed` int(11) NOT NULL,
`client_flags` int(11) NOT NULL,
`userid` int(11) NOT NULL,
`perfect` tinyint(1) NOT NULL,
`mods_readable` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `scores_vn`
--
CREATE TABLE `scores_vn` (
`id` int(11) NOT NULL,
`map_md5` char(32) NOT NULL,
`score` int(11) NOT NULL,
`pp` float(7,3) NOT NULL,
`acc` float(6,3) NOT NULL,
`max_combo` int(11) NOT NULL,
`mods` int(11) NOT NULL,
`n300` int(11) NOT NULL,
`n100` int(11) NOT NULL,
`n50` int(11) NOT NULL,
`nmiss` int(11) NOT NULL,
`ngeki` int(11) NOT NULL,
`nkatu` int(11) NOT NULL,
`grade` varchar(2) NOT NULL DEFAULT 'N',
`status` tinyint(4) NOT NULL,
`mode` tinyint(4) NOT NULL,
`play_time` int(100) NOT NULL,
`time_elapsed` int(11) NOT NULL,
`client_flags` int(11) NOT NULL,
`userid` int(11) NOT NULL,
`perfect` tinyint(1) NOT NULL,
`mods_readable` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(32) CHARACTER SET utf8 NOT NULL,
`safe_name` varchar(32) CHARACTER SET utf8 NOT NULL,
`email` varchar(254) NOT NULL,
`priv` int(11) NOT NULL DEFAULT '1',
`pw_bcrypt` char(60) NOT NULL,
`country` char(2) NOT NULL DEFAULT 'xx',
`silence_end` int(11) NOT NULL DEFAULT '0',
`donor_end` int(11) NOT NULL DEFAULT '0',
`creation_time` int(11) NOT NULL DEFAULT '0',
`latest_activity` int(11) NOT NULL DEFAULT '0',
`clan_id` int(11) NOT NULL DEFAULT '0',
`clan_rank` tinyint(1) NOT NULL DEFAULT '0',
`keygen` int(11) NOT NULL DEFAULT '0',
`frozen` int(11) NOT NULL DEFAULT '0',
`freezetime` int(11) NOT NULL DEFAULT '0',
`verified` int(1) NOT NULL DEFAULT '0',
`usedchange` int(11) NOT NULL DEFAULT '0',
`verif` int(1) NOT NULL,
`code` char(5) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `safe_name`, `email`, `priv`, `pw_bcrypt`, `country`, `silence_end`, `donor_end`, `creation_time`, `latest_activity`, `clan_id`, `clan_rank`, `keygen`, `frozen`, `freezetime`, `verified`, `usedchange`, `verif`, `code`) VALUES
(1, 'Ruji', 'ruji', 'contact@iteki.pw', 1, '_______________________my_cool_bcrypt_______________________', 'sl', 0, 0, 1611774412, 1611774412, 0, 0, 0, 0, 0, 0, 0, 1, '');
-- --------------------------------------------------------
--
-- Table structure for table `user_achievements`
--
CREATE TABLE `user_achievements` (
`userid` int(11) NOT NULL,
`achid` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `achievements`
--
ALTER TABLE `achievements`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `achievements_desc_uindex` (`desc`),
ADD UNIQUE KEY `achievements_file_uindex` (`file`),
ADD UNIQUE KEY `achievements_name_uindex` (`name`);
--
-- Indexes for table `beta_keys`
--
ALTER TABLE `beta_keys`
ADD PRIMARY KEY (`beta_key`);
--
-- Indexes for table `channels`
--
ALTER TABLE `channels`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `channels_name_uindex` (`name`);
--
-- Indexes for table `clans`
--
ALTER TABLE `clans`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `clans_name_uindex` (`name`),
ADD UNIQUE KEY `clans_owner_uindex` (`owner`),
ADD UNIQUE KEY `clans_tag_uindex` (`tag`);
--
-- Indexes for table `client_hashes`
--
ALTER TABLE `client_hashes`
ADD PRIMARY KEY (`userid`,`osupath`,`adapters`,`uninstall_id`,`disk_serial`);
--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `discord`
--
ALTER TABLE `discord`
ADD PRIMARY KEY (`tag_id`),
ADD UNIQUE KEY `tag` (`tag`),
ADD UNIQUE KEY `tag_id` (`tag_id`),
ADD UNIQUE KEY `code` (`code`);
--
-- Indexes for table `favourites`
--
ALTER TABLE `favourites`
ADD PRIMARY KEY (`userid`,`setid`);
--
-- Indexes for table `friendships`
--
ALTER TABLE `friendships`
ADD PRIMARY KEY (`user1`,`user2`);
--
-- Indexes for table `logs`
--
ALTER TABLE `logs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `mail`
--
ALTER TABLE `mail`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `maps`
--
ALTER TABLE `maps`
ADD PRIMARY KEY (`server`,`id`),
ADD UNIQUE KEY `maps_id_uindex` (`id`),
ADD UNIQUE KEY `maps_md5_uindex` (`md5`);
--
-- Indexes for table `performance_reports`
--
ALTER TABLE `performance_reports`
ADD PRIMARY KEY (`scoreid`,`mod_mode`);
--
-- Indexes for table `pwreset`
--
ALTER TABLE `pwreset`
ADD PRIMARY KEY (`code`);
--
-- Indexes for table `ratings`
--
ALTER TABLE `ratings`
ADD PRIMARY KEY (`userid`,`map_md5`),
ADD UNIQUE KEY `ratings_map_md5_uindex` (`map_md5`),
ADD UNIQUE KEY `ratings_userid_uindex` (`userid`);
--
-- Indexes for table `requests`
--
ALTER TABLE `requests`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `scores_ap`
--
ALTER TABLE `scores_ap`
ADD PRIMARY KEY (`id`),
ADD KEY `id` (`id`,`map_md5`,`score`,`pp`,`acc`,`max_combo`,`mods`,`n300`,`n100`,`n50`,`nmiss`,`ngeki`,`nkatu`,`grade`,`status`,`mode`),
ADD KEY `play_time` (`play_time`,`time_elapsed`,`client_flags`,`userid`,`perfect`,`mods_readable`);
--
-- Indexes for table `scores_rx`
--
ALTER TABLE `scores_rx`
ADD PRIMARY KEY (`id`),
ADD KEY `id` (`id`,`map_md5`,`score`,`pp`,`acc`,`max_combo`,`mods`,`n300`,`n100`,`n50`,`nmiss`,`ngeki`,`nkatu`,`grade`,`status`,`mode`),
ADD KEY `play_time` (`play_time`,`time_elapsed`,`client_flags`,`userid`,`perfect`,`mods_readable`);
--
-- Indexes for table `scores_vn`
--
ALTER TABLE `scores_vn`
ADD PRIMARY KEY (`id`),
ADD KEY `id` (`id`,`map_md5`,`score`,`pp`,`acc`,`max_combo`,`mods`,`n300`,`n100`,`n50`,`nmiss`,`ngeki`,`nkatu`,`grade`,`status`,`mode`),
ADD KEY `play_time` (`play_time`,`time_elapsed`,`client_flags`,`userid`,`perfect`,`mods_readable`);
--
-- Indexes for table `startups`
--
ALTER TABLE `startups`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stats`
--
ALTER TABLE `stats`
ADD PRIMARY KEY (`id`),
ADD KEY `id` (`id`,`tscore_vn_std`,`tscore_vn_taiko`,`tscore_vn_catch`,`tscore_vn_mania`,`tscore_rx_std`,`tscore_rx_taiko`,`tscore_rx_catch`,`tscore_ap_std`,`rscore_vn_std`,`rscore_vn_taiko`,`rscore_vn_catch`,`rscore_vn_mania`,`rscore_rx_std`,`rscore_rx_taiko`,`rscore_rx_catch`),
ADD KEY `rscore_ap_std` (`rscore_ap_std`,`pp_vn_std`,`pp_vn_taiko`,`pp_vn_catch`,`pp_vn_mania`,`pp_rx_std`,`pp_rx_taiko`,`pp_rx_catch`,`pp_ap_std`,`plays_vn_std`,`plays_vn_taiko`,`plays_vn_catch`,`plays_vn_mania`,`plays_rx_std`,`plays_rx_taiko`,`plays_rx_catch`),
ADD KEY `plays_ap_std` (`plays_ap_std`,`playtime_vn_std`,`playtime_vn_taiko`,`playtime_vn_catch`,`playtime_vn_mania`,`playtime_rx_std`,`playtime_rx_taiko`,`playtime_rx_catch`,`playtime_ap_std`,`acc_vn_std`,`acc_vn_taiko`,`acc_vn_catch`,`acc_vn_mania`,`acc_rx_std`),
ADD KEY `acc_rx_taiko` (`acc_rx_taiko`,`acc_rx_catch`,`acc_ap_std`,`maxcombo_vn_std`,`maxcombo_vn_taiko`,`maxcombo_vn_catch`,`maxcombo_vn_mania`,`maxcombo_rx_std`,`maxcombo_rx_taiko`,`maxcombo_rx_catch`,`maxcombo_ap_std`,`rank_vn_std`,`rank_rx_std`,`rank_ap_std`,`rank_rx_taiko`),
ADD KEY `rank_rx_catch` (`rank_rx_catch`,`rank_vn_taiko`,`rank_vn_catch`,`rank_vn_mania`,`crank_vn_std`,`crank_rx_std`,`crank_ap_std`,`crank_vn_taiko`,`crank_vn_catch`,`crank_vn_mania`,`crank_rx_taiko`,`crank_rx_catch`,`lb_pp`);
--
-- Indexes for table `tourney_pools`
--
ALTER TABLE `tourney_pools`
ADD PRIMARY KEY (`id`),
ADD KEY `tourney_pools_users_id_fk` (`created_by`);
--
-- Indexes for table `tourney_pool_maps`
--
ALTER TABLE `tourney_pool_maps`
ADD PRIMARY KEY (`map_id`,`pool_id`),
ADD KEY `tourney_pool_maps_tourney_pools_id_fk` (`pool_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_uindex` (`email`),
ADD UNIQUE KEY `users_name_uindex` (`name`),
ADD UNIQUE KEY `users_safe_name_uindex` (`safe_name`),
ADD KEY `id` (`id`,`name`,`safe_name`,`email`,`priv`,`pw_bcrypt`,`country`,`silence_end`,`donor_end`,`creation_time`,`latest_activity`,`clan_id`,`clan_rank`,`keygen`,`frozen`,`freezetime`);
--
-- Indexes for table `user_achievements`
--
ALTER TABLE `user_achievements`
ADD PRIMARY KEY (`userid`,`achid`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `achievements`
--
ALTER TABLE `achievements`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=73;
--
-- AUTO_INCREMENT for table `channels`
--
ALTER TABLE `channels`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `clans`
--
ALTER TABLE `clans`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comments`
--
ALTER TABLE `comments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `logs`
--
ALTER TABLE `logs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `mail`
--
ALTER TABLE `mail`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `requests`
--
ALTER TABLE `requests`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `scores_ap`
--
ALTER TABLE `scores_ap`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `scores_rx`
--
ALTER TABLE `scores_rx`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `scores_vn`
--
ALTER TABLE `scores_vn`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `startups`
--
ALTER TABLE `startups`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stats`
--
ALTER TABLE `stats`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tourney_pools`
--
ALTER TABLE `tourney_pools`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) 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 */;
| true |
6b22f0013d381c5f0f56a7fe23277590de448999 | SQL | DigitalWand/digitalwand.admin_helper_example | /install/db/mysql/custom_table.sql | UTF-8 | 909 | 2.796875 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `digitalwand_admin_helper_custom_table_demo` (
`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`STRING` VARCHAR(128) NULL,
`NUMBER` INT(11) NULL,
`TEXT` TEXT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `digitalwand_admin_helper_custom_table_demo_related` (
`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ELEMENT_ID` int(11) UNSIGNED NOT NULL,
`STRING` INT(11) NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `digitalwand_admin_helper_custom_table_demo_many2many` (
`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ELEMENT_ID` int(11) UNSIGNED NOT NULL,
`HL_ID` int(11) UNSIGNED NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; | true |
d701f6ee00f92b1f176567950bad7de9cf4cf3af | SQL | umcssa/freshman-handbook | /server/sql/schema.sql | UTF-8 | 272 | 3.421875 | 3 | [
"Apache-2.0"
] | permissive | CREATE TABLE article (
title VARCHAR(64) PRIMARY KEY NOT NULL,
content VARCHAR(32768) NOT NULL
);
CREATE TABLE image (
image_id INTEGER PRIMARY KEY AUTOINCREMENT,
title VARCHAR(64) NOT NULL,
FOREIGN KEY (title) REFERENCES article (title)
);
| true |
4ebd6a557d797e94d620189e951a32d9ab104d76 | SQL | JayMunnangi/Codebase | /DBFiles_SizeInfo.sql | UTF-8 | 459 | 3.609375 | 4 | [] | no_license | --(Database Filenames and Paths)
SELECT DB_NAME([database_id]) AS [Database Name],
[file_id], name, physical_name, type_desc, state_desc,
is_percent_growth, growth,
CONVERT(bigint, growth/128.0) AS [Growth in MB],
CONVERT(bigint, size/128.0) AS [Total Size in MB]
FROM sys.master_files WITH (NOLOCK)
WHERE --[database_id] > 4
--AND [database_id] <> 32767
[database_id] = 2
ORDER BY DB_NAME([database_id]) OPTION (RECOMPILE); | true |
690ccd78dd7037f95461a82d24218f180e13039a | SQL | anushkafka/meeplepurse | /meeplepurse.sql | UTF-8 | 1,674 | 3.59375 | 4 | [] | no_license | CREATE DATABASE meeplepurse;
CREATE TABLE users
(
id serial PRIMARY KEY,
email VARCHAR(225) unique,
currency VARCHAR(3),
usrname VARCHAR(225),
img_url bytea,
est_budget NUMERIC CHECK (est_budget > 0),
password_digest VARCHAR(400) not NULL
);
CREATE TABLE purchases(
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users (id) ON DELETE RESTRICT,
boardgame_id VARCHAR(50) unique,
boardgame_title VARCHAR(300),
img_url VARCHAR(300),
price NUMERIC CHECK(price > 0),
is_confirmed boolean
);
CREATE TABLE budgets
(
id serial PRIMARY KEY,
user_id INTEGER REFERENCES users (id) ON DELETE RESTRICT,
year VARCHAR(4),
duration INTEGER,
currency VARCHAR(3),
est_budget NUMERIC CHECK (est_budget > 0),
act_budget NUMERIC,
created_date date
);
-- CREATE TABLE boardgames
-- (
-- id serial PRIMARY KEY,
-- budget_id INTEGER REFERENCES budgets (id) ON DELETE RESTRICT,
-- title VARCHAR(300) not null,
-- currency VARCHAR(3),
-- price NUMERIC CHECK(price > 0)
-- );
-- CREATE TABLE user_boardgames
-- (
-- id SERIAL PRIMARY KEY,
-- boardgame_id INTEGER REFERENCES boardgames (id) ON DELETE RESTRICT,
-- user_id INTEGER REFERENCES users (id) ON DELETE RESTRICT
-- );
-- CREATE TABLE comments (
-- id SERIAL PRIMARY KEY,
-- body VARCHAR(500) NOT NULL ,
-- dish_id INTEGER NOT NULL,
-- FOREIGN KEY (dish_id) REFERENCES dishes (id) ON DELETE RESTRICT
-- );
INSERT INTO users
(usrname,pwd,email)
VALUES
('anu', 'pwd', 'email')
-- create TABLE likes(
-- id serial PRIMARY KEY,
-- user_id INTEGER not null,
-- post_id INTEGER not null,
-- FOREIGN KEY (user_id) REFERENCES users(id) on DELETE RESTRICT
-- ); | true |
11d8cb3628b9d9c272f132cf520e106395e42541 | SQL | wangzhibinjunhua/watch_tcp_server | /Applications/database/watch.sql | UTF-8 | 5,876 | 3 | 3 | [
"MIT"
] | permissive | -- MySQL dump 10.13 Distrib 5.5.49, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: watch
-- ------------------------------------------------------
-- Server version 5.5.49-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `watch_app_user`
--
DROP TABLE IF EXISTS `watch_app_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `watch_app_user` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(16) NOT NULL COMMENT '用户名',
`password` varchar(64) NOT NULL COMMENT '密码',
`name` varchar(32) NOT NULL COMMENT '姓名',
`avatar` varchar(255) NOT NULL COMMENT '图像',
`create_time` datetime NOT NULL COMMENT '创建时间',
`nickname` varchar(45) NOT NULL COMMENT '昵称',
`vkey` varchar(255) NOT NULL COMMENT '短信验证码',
`mobile` varchar(45) NOT NULL COMMENT '手机号',
`app_sn` varchar(255) NOT NULL COMMENT 'app 代码',
`sex` int(2) NOT NULL COMMENT '性别',
`birthday` date NOT NULL COMMENT '出生日期',
`cer_number` varchar(45) NOT NULL COMMENT '身份证号码',
`status` int(2) NOT NULL COMMENT '帐号状态:0注册中,1正常,2锁定',
`hid` varchar(45) NOT NULL COMMENT 'uuid',
`token` varchar(60) DEFAULT NULL COMMENT '登录身份令牌',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `watch_app_watch`
--
DROP TABLE IF EXISTS `watch_app_watch`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `watch_app_watch` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`watch_imei` varchar(16) NOT NULL,
`app_id` varchar(16) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=469 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `watch_info`
--
DROP TABLE IF EXISTS `watch_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `watch_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`imei` varchar(15) NOT NULL,
`gps_lon` varchar(255) NOT NULL COMMENT 'gps定位数据',
`gps_lat` varchar(255) NOT NULL COMMENT 'gps定位数据',
`unix_time` int(11) NOT NULL,
`watch_time` datetime NOT NULL COMMENT '手表上报时间',
`system_time` datetime NOT NULL COMMENT '服务器系统时间',
`location_lon` varchar(255) NOT NULL COMMENT '基站wifi定位数据',
`location_lat` varchar(255) NOT NULL COMMENT '基站wifi定位数据',
`location_content` varchar(255) NOT NULL,
`location_type` varchar(4) NOT NULL COMMENT '定位类型,0--gps,1--wifi,2--基站',
`ud_content` varchar(4096) NOT NULL COMMENT '手表上报ud原始数据',
`battery` varchar(5) NOT NULL DEFAULT '' COMMENT '电量',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=102149 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `watch_message`
--
DROP TABLE IF EXISTS `watch_message`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `watch_message` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`flag` varchar(2) NOT NULL DEFAULT '0' COMMENT '0未读,1已读',
`type` varchar(2) NOT NULL DEFAULT '0' COMMENT '0为音频文件,1为图片文件',
`imei` varchar(16) NOT NULL,
`user_id` varchar(16) NOT NULL,
`stamp` varchar(16) NOT NULL,
`file` varchar(255) NOT NULL,
`datetime` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4313 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `watch_sms`
--
DROP TABLE IF EXISTS `watch_sms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `watch_sms` (
`sms_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`content` varchar(255) NOT NULL COMMENT '短信内容',
`mobile` varchar(45) NOT NULL COMMENT '接收手机号',
`status` int(11) NOT NULL COMMENT '验证状态:0 未验证 1:验证完毕',
`v_code` varchar(45) NOT NULL COMMENT '短信验证码',
`type` int(11) NOT NULL COMMENT '短信类型:1 帐号注册验证码;2:密码找回验证码 3:其他',
`unix_time` int(11) NOT NULL,
`app_sn` varchar(255) NOT NULL COMMENT 'app类型:1:儿童手表;2:血压手表',
`send_time` datetime NOT NULL,
`send_status` int(11) NOT NULL COMMENT '发送状态 0:失败 1:成功',
PRIMARY KEY (`sms_id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-03-05 16:02:42
| true |
77119af2517976446d28244e7aa1da329ef6f154 | SQL | maykonmenezes/openprescribing | /openprescribing/dmd/management/commands/dmd_sql/step_02.sql | UTF-8 | 1,606 | 3.09375 | 3 | [
"MIT"
] | permissive | -- Section 6 of Implementation Guide (p43)
insert into dmd_product_temp
select
dmd_amp.apid as dmdid,
NULL as bnf_code,
dmd_amp.vpid,
dmd_amp."nm" as name,
dmd_amp."desc" as full_name,
ema,
1 as pres_statcd,
avail_restrictcd,
2 as product_type,
0 as non_availcd,
2 as concept_class,
false as nurse_f,
false as dent_f,
prod_order_no,
false as sched_1,
false as padm,
false as sched_2,
false as fp10_mda,
false as acbs,
false as assort_flav,
0 as catcd,
NULL as tariff_category,
false as flag_imported,
false as flag_broken_bulk,
false as flag_non_bioequivalence,
false as flag_special_containers
from
dmd_amp
inner join
dmd_vmp
on
dmd_vmp.vpid = dmd_amp.vpid
left join
dmd_ap_info
on
dmd_ap_info.apid = dmd_amp.apid
where
dmd_amp.invalid is NULL
and (dmd_amp.combprodcd is NULL
or dmd_amp.combprodcd = 1)
and (parallel_import is NULL
or parallel_import = 0);
insert into dmd_product_temp
select
vpid as dmdid,
NULL as bnf_code,
vpid,
nm as name,
nm as full_name,
false as ema,
pres_statcd,
NULL as avail_restrictcd,
1 as product_type,
non_availcd,
1 as concept_class,
false as nurse_f,
false as dent_f,
NULL as prod_order_no,
false as sched_1,
false as padm,
false as sched_2,
false as fp10_mda,
false as acbs,
false as assort_flav,
0 as catcd,
NULL as tariff_category,
false as flag_imported,
false as flag_broken_bulk,
false as flag_non_bioequivalence,
false as flag_special_containers
from
dmd_vmp
where
invalid is NULL
and (combprodcd is NULL
or combprodcd = 1);
| true |
50551aebb55d05b9c21deae087321fe49e57103d | SQL | ykxxx/Data-Analysis-Intern2018 | /RFM.sql | UTF-8 | 3,231 | 3.921875 | 4 | [] | no_license |
--RFM模型
create table rfm_table as
select a.uid, brand, model, recent_date, rscore, frequency, fscore, monetary, mscore from (
select distinct uid, brand, province, apcode, ip from ossp_useroperation
where proc_date >= '20180627' and proc_date <= '20180703'
and osid = 'android' and bizid = '100ime')a
left join (
select uid, max(proc_date) as recent_date,
case when max(proc_date) >= '20180627' and max(proc_date) <= '20180724' then 0
when max(proc_date) >= '20180725' then 1 end as rscore
from ossp_useroperation
where proc_date >= '20180627'
group by uid)b
on a.uid = b.uid
left join (
select uid, count(uid) as frequency,
case when count(uid) < 50 then 0 when count(uid) >= 50 then 1 end as fscore
from ossp_useroperation
where proc_date >= '20180627' and proc_date <= '20180726'
group by uid)c
on a.uid = c.uid
left join (
select uid, count(uid) as monetary,
case when count(uid) < 200 then 0 when count(uid) >= 200 then 1 end as mscore
from ossp_useroperation
where proc_date >= '20180101'
group by uid)d
on a.uid = d.uid
--城市分布
select province, count(distinct(uid)) as total_user, count(uid) as total_time
from rfm_table
where rscore = 1 and fscore = 1 and mscore = 1
group by province
--平均时长
select time_level, count(b.uid) as total_time, count(distinct(b.uid)) as total_user from (
select a.uid, case when time_length is null then 'null' when time_length == 0 then '00'
when time_length > 0 and time_length < 5 then '00~05'
when time_length >= 5 and time_length < 10 then '05~10'
when time_length >= 10 and time_length < 30 then '10~30'
when time_length >= 30 and time_length < 60 then '30~60'
when time_length >= 60 and time_length < 600 then '60~600'
when time_length >= 600 then '600以上' end as time_level from (
select uid, (cast(substring(end_time, 13) as int) - cast(substring(start_time, 13) as int))
+ (cast(substring(end_time, 11, 2) as int) - cast(substring(start_time, 11, 2) as int)) * 60 as time_length
from rfm_table
where rscore = 1 and fscore = 1 and mscore = 1)a)b
group by time_level
--使用时间分布
select start_hour, count(a.uid) as total_time, count(distinct(a.uid)) as total_user from (
select uid, substring(start_time, 9, 2) as start_hour
from rfm_table
where rscore = 1 and fscore = 1 and mscore = 1)a
group by start_hour
--渠道分布
select fchan, count(uid) as total_time, count(distinct(uid)) as total_user from (
select distinct uid, df
from rfm_table
where rscore = 1 and fscore = 1 and mscore = 1)a
left join (
select fdf, fchan from dfdata)b
on a.df = b.fdf
group by fchan
--TOP100品牌分布
select brand, count(uid) as total_time, count(distinct(uid)) as total_user
from rfm_table
where rscore = 1 and fscore = 1 and mscore = 1
group by brand
order by total_user desc limit 100;
--apcode
select apcode, count(uid) as total_time, count(distinct(uid)) as total_user
from rfm_table
where rscore = 1 and fscore = 1 and mscore = 1
group by apcode
--ip地址数量分布
select ip_num, count(distinct(uid)) as total_user from (
select uid, count(distinct(ip)) as ip_num
from rfm_table
where rscore = 1 and fscore = 1 and mscore = 1
group by uid)a
group by ip_num
| true |
fd050397524c19362fa6cba5bc862df8d81273f2 | SQL | UnknownDevBY/SpringReactSocialNetwork | /back/src/main/resources/db/migration/V10__Add_users_blacklist.sql | UTF-8 | 206 | 3.203125 | 3 | [] | no_license | create table if not exists user_blacklist (
user_id int not null,
blacklist int
);
alter table if exists user_blacklist
add constraint fk_user_blacklist_users
foreign key (user_id) references users | true |
ab1db856ae017433213067b33d32bda2e7016efb | SQL | sprokushev/Delphi | /MASTER/_DATABASE/Indexes/EUL_SQ_OBJ_FK_I.sql | UTF-8 | 219 | 2.671875 | 3 | [] | no_license | /* This object may not be sorted properly in the script due to cirular references. */
--
-- EUL_SQ_OBJ_FK_I (Index)
--
CREATE INDEX MASTER.EUL_SQ_OBJ_FK_I ON MASTER.EUL_SUB_QUERIES
(SQ_OBJ_ID)
TABLESPACE USERSINDX;
| true |
8dbf9c1b752ee404287870b53145f39fb3d92aa4 | SQL | mfvanek/pg-index-health-sql | /sql/duplicated_indexes.sql | UTF-8 | 975 | 3.71875 | 4 | [
"Apache-2.0"
] | permissive | /*
* Copyright (c) 2019-2023. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health-sql
*
* Licensed under the Apache License 2.0
*/
-- Finds completely identical indexes.
select
table_name,
string_agg('idx=' || idx::text || ', size=' || pg_relation_size(idx), '; ') as duplicated_indexes
from (
select
x.indexrelid::regclass as idx,
x.indrelid::regclass as table_name,
(x.indrelid::text || ' ' || x.indclass::text || ' ' || x.indkey::text || ' ' ||
x.indcollation::text || ' ' ||
coalesce(pg_get_expr(x.indexprs, x.indrelid), '') || ' ' ||
coalesce(pg_get_expr(x.indpred, x.indrelid), '')) as grouping_key
from
pg_catalog.pg_index x
join pg_catalog.pg_stat_all_indexes psai on x.indexrelid = psai.indexrelid
where psai.schemaname = :schema_name_param::text
) sub
group by table_name, grouping_key
having count(*) > 1
order by table_name, sum(pg_relation_size(idx)) desc;
| true |
a7a0467fc9b5b0ef18369081eb15e7a7a5a6fd2f | SQL | Rachel-Pavlakovic/EECS393HealthAndFitnessTracker | /HealthAndFitnessTracker/tracker.sql | UTF-8 | 4,040 | 2.859375 | 3 | [] | no_license | CREATE TYPE unit AS ENUM ('Imperial', 'Metric');
CREATE TYPE not AS ENUM ('Text', 'Email', 'Web');
CREATE TABLE IF NOT EXISTS food (
name VARCHAR(100),
density DOUBLE(10,5),
caloricDensity DOUBLE(10, 5),
PRIMARY KEY (name)
);
CREATE TABLE IF NOT EXISTS drink (
name VARCHAR(100),
density DOUBLE(10,5),
caloriesPerOZ DOUBLE(10, 5),
PRIMARY KEY (name)
)
CREATE TABLE IF NOT EXISTS exercise (
name VARCHAR(100),
caloriesOverTime INTEGER,
PRIMARY KEY (name)
);
CREATE TABLE IF NOT EXISTS userInformation (
username VARCHAR(25),
weight INTEGER,
height INTEGER,
gender VARCHAR(25),
units unit,
notificationType not,
phoneNumber VARCHAR(10),
email VARCHAR(50),
PRIMARY KEY (username)
);
INSERT INTO food VALUES (Pizza, 1.07, 270);
INSERT INTO food VALUES (Apple, 0.2401, 52);
INSERT INTO food VALUES (Carrot, 0.54, 41.38);
INSERT INTO food VALUES (Twinkie, 0.32, 349);
INSERT INTO food VALUES (Chicken Soup, 1.07, 36);
INSERT INTO food VALUES (White Bread, 0.2, 267);
INSERT INTO food VALUES (Chicken Breast, 0.59, 88);
INSERT INTO food VALUES (Chicken Thigh, 0.59, 88);
INSERT INTO food VALUES (Beef Steak, 1.053, 267);
INSERT INTO food VALUES (Lamb Steak, 1.00, 235);
INSERT INTO food VALUES (Pork Chop, 1.03, 167);
INSERT INTO food VALUES (Salmon Filet, 0.919, 206);
INSERT INTO food VALUES (Baked Potatoes, 0.63, 93);
INSERT INTO food VALUES (Mashed Potatoes, 0.97, 103);
INSERT INTO food VALUES (Spinach, 0.63, 23);
INSERT INTO food VALUES (Lactose Free Ice Cream: Vanilla, 1.096, 211);
INSERT INTO food VALUES (Ice Cream: Vanilla, 1.096, 165);
INSERT INTO food VALUES (Cream Cheese, 1.01, 357);
INSERT INTO food VALUES (Parmesan Cheese, 0.63, 415);
INSERT INTO food VALUES (Egg, 1.00, 143);
INSERT INTO food VALUES (Deviled Egg, 1.00, 160);
INSERT INTO food VALUES (Brocoli, 0.777, 34);
INSERT INTO food VALUES (Lettuce, 0.3, 14);
INSERT INTO food VALUES (Hot Dog, 0.9, 247);
INSERT INTO food VALUES (Avocado, 0.63, 160);
INSERT INTO food VALUES (Pasta, 0.64, 158);
INSERT INTO food VALUES (Choclate Chip Cookie, 0.65, 458);
INSERT INTO food VALUES (Clam Chowder, 1.07, 84);
INSERT INTO food VALUES (Apple Pie, 1.11, 253);
INSERT INTO food VALUES (Pecan Pie, 1.21, 412);
INSERT INTO food VALUES (Pork Stew, 0.83, 87);
INSERT INTO food VALUES (Beef Stew, 0.83, 99);
INSERT INTO food VALUES (Chicken Pot Pie, 0.92, 177);
INSERT INTO food VALUES (Buffalo Wings, 0.61, 277);
INSERT INTO food VALUES (Meatloaf, 1.006, 149);
INSERT INTO food VALUES (Ground Beef, 1.006, 332);
INSERT INTO food VALUES (Hamburger, 0.87, 295);
INSERT INTO food VALUES (French Fries, 0.63, 312);
INSERT INTO food VALUES (Oreos, 0.964, 480);
INSERT INTO food VALUES (Donuts, 0.310, 452);
INSERT INTO food VALUES (Tacos, 0.56, 226);
INSERT INTO drink VALUES (Diet Coke, 1.045, 0);
INSERT INTO drink VALUES (Classic Coke, 1.11, 11.83);
INSERT INTO drink VALUES (Water, 1, 0);
INSERT INTO drink VALUES (Lactose Free Milk: Skim, 1.023, 11.25);
INSERT INTO drink VALUES (Apple Juice, 1.05, 14);
INSERT INTO drink VALUES (Orange Juice, 1.25, 14);
INSERT INTO drink VALUES (Wine, 0.98, 24);
INSERT INTO drink VALUES (Margaritas, 0.94, 56.6);
INSERT INTO drink VALUES (Beer, 1.060, 13);
INSERT INTO drink VALUES (Vodka, 0.79, 64);
INSERT INTO drink VALUES (Milk: skim, 1.035, 11.25);
INSERT INTO drink VALUES (Coffee, 1, 0.25);
INSERT INTO drink VALUES (Green Tea, 1, 0.25);
INSERT INTO drink VALUES (Powerade, 1.03, 6.25);
INSERT INTO exercise VALUES (Running, 400);
INSERT INTO exercise VALUES (Swimming, 413);
INSERT INTO exercise VALUES (Hiking, 430);
INSERT INTO exercise VALUES (Walking, 298);
INSERT INTO exercise VALUES (Lifting Weights, 224);
INSERT INTO exercise VALUES (Biking, 450);
INSERT INTO exercise VALUES (Rollerblading, 913);
INSERT INTO exercise VALUES (Skiing: Downhill, 272);
INSERT INTO exercise VALUES (Skiing: Cross Country, 1054);
INSERT INTO exercise VALUES (Yoga, 120);
INSERT INTO exercise VALUES (Pushups, 576);
INSERT INTO exercise VALUES (Crunches, 180);
| true |
8890b5785103e53d7e1247b39c4bd1c4f5c108ca | SQL | MichaelSpr/wisbada | /backend/docs/structure.sql | UTF-8 | 1,349 | 3.328125 | 3 | [] | no_license | DROP TABLE IF EXISTS beziehungen;
CREATE TABLE beziehungen (
tid int(11) NOT NULL,
bid int(11) NOT NULL,
type int(1) NOT NULL,
id_1 int(11) NOT NULL,
id_2 int(11) NOT NULL,
PRIMARY KEY (bid, tid)
);
DROP TABLE IF EXISTS personen;
CREATE TABLE personen (
tid int(11) NOT NULL,
pid int(11) NOT NULL,
name varchar(255) DEFAULT NULL,
vorname varchar(255) DEFAULT NULL,
geburtsort varchar(255) DEFAULT NULL,
geburtsdatum date DEFAULT NULL,
sterbeort varchar(255) DEFAULT NULL,
todesdatum date DEFAULT NULL,
geschlecht int(1) DEFAULT NULL,
bild varchar(255) DEFAULT NULL,
sonstiges text,
PRIMARY KEY (pid, tid)
);
DROP TABLE IF EXISTS stammbaum;
CREATE TABLE stammbaum (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
);
DROP TABLE IF EXISTS log;
CREATE TABLE log (
id int(11) NOT NULL AUTO_INCREMENT,
timestamp timestamp NOT NULL,
server text,
data text,
PRIMARY KEY (id)
);
INSERT INTO stammbaum VALUES (1,'3552043194');
INSERT INTO beziehungen VALUES (1,2,2,1,3),(1,3,2,2,3),(1,1,1,1,2);
INSERT INTO personen VALUES (1,1,'Simpson','Homer Jay','Springfield','1989-12-17','','1900-01-01',0,'',''),(1,2,'Simpson','Marjorie (Marge)','Springfield','1989-12-17','','1900-01-01',1,'',''),(1,3,'Simpson','Bartholomew JoJo (Bart)','Springfield','1989-12-17','','1900-01-01',0,'',''); | true |
b92c5724ede11c72c67cf7384df240117b25cb28 | SQL | hqottsz/MXI | /assetmanagement-database/src/upgrade/plsql/lib/liquibase/8/1/3/0/plsql/lpa_pkg_body.sql | UTF-8 | 18,853 | 3.296875 | 3 | [] | no_license | --liquibase formatted sql
--changeSet lpa_pkg_body:1 stripComments:false endDelimiter:\n\s*/\s*\n|\n\s*/\s*$
CREATE OR REPLACE PACKAGE BODY LPA_PKG
IS
/********************************************************************************
*
* Function: is_task_defn_service_check
* Arguments: an_TaskTaskDbId (IN NUMBER): task definition primary key
* an_TaskTaskId (IN NUMBER): task definition primary key
*
* Description: Tests if a task definition revision is applicable to be considered a Service Check:
* - It is active
* - Is defined against an aircraft assembly
* - Has a task class with a CLASS MODE of 'BLOCK'
* - Is not part of a block chain
* - Is recurring
* - Does not have a task class of 'CHECK' or 'RO'
* - Does not have an applicability rule
* - Has exactly one scheduling rule which is calendar based
*
*
* Orig.Coder: Natasa Subotic
* Recent Date: December 14,2011
*
*********************************************************************************
*
* Copyright 2011 MxI Technologies Ltd. All Rights Reserved.
* Any distribution of the MxI source code by any other party than
* MxI Technologies Ltd is prohibited.
*
*********************************************************************************/
FUNCTION is_task_defn_service_check(
an_TaskTaskDbId IN task_task.task_db_id%TYPE,
an_TaskTaskId IN task_task.task_id%TYPE) RETURN NUMBER
IS
-- Variable declaration
v_count NUMBER;
BEGIN
SELECT
1
INTO v_count
FROM
task_task INNER JOIN eqp_assmbl ON
task_task.assmbl_db_id = eqp_assmbl.assmbl_db_id AND
task_task.assmbl_cd = eqp_assmbl.assmbl_cd
INNER JOIN ref_task_class ON
task_task.task_class_db_id = ref_task_class.task_class_db_id AND
task_task.task_class_cd = ref_task_class.task_class_cd
INNER JOIN (
SELECT
task_sched_rule.task_db_id,
task_sched_rule.task_id,
COUNT(*) as rule_count,
MAX(ref_domain_type.domain_type_cd) AS domain_type_cd_max
FROM
task_sched_rule,
ref_domain_type,
mim_data_type
WHERE
task_sched_rule.data_type_db_id = mim_data_type.data_type_db_id AND
task_sched_rule.data_type_id = mim_data_type.data_type_id
AND
mim_data_type.domain_type_db_id = ref_domain_type.domain_type_db_id AND
mim_data_type.domain_type_cd = ref_domain_type.domain_type_cd
GROUP BY
task_sched_rule.task_db_id,
task_sched_rule.task_id
)sched_rules_count ON
task_task.task_db_id = sched_rules_count.task_db_id AND
task_task.task_id = sched_rules_count.task_id
WHERE
task_task.task_db_id = an_TaskTaskDbId AND
task_task.task_id = an_TaskTaskId
AND
task_task.task_def_status_db_id = 0 AND
task_task.task_def_status_cd = 'ACTV'
AND
task_task.recurring_task_bool = 1
AND
task_task.block_chain_sdesc IS NULL
AND
task_task.on_condition_bool = 0
AND
task_task.task_appl_sql_ldesc IS NULL
AND
ref_task_class.class_mode_cd = 'BLOCK' AND
ref_task_class.task_class_cd NOT IN( 'CHECK', 'RO' )
AND
eqp_assmbl.assmbl_class_db_id = 0 AND
eqp_assmbl.assmbl_class_cd = 'ACFT'
AND
task_task.assmbl_bom_id = 0
AND
sched_rules_count.rule_count = 1
AND
sched_rules_count.domain_type_cd_max = 'CA';
RETURN v_count;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN 0;
END is_task_defn_service_check;
/********************************************************************************
*
* Function: is_task_defn_turn_check
* Arguments: an_TaskTaskDbId (IN NUMBER): task definition primary key
* an_TaskTaskId (IN NUMBER): task definition primary key
*
* Description: Tests if a task definition revision is applicable to be considered a Turn Check:
* - It is active
* - Is defined against an aircraft assembly
* - Has a task class with a CLASS MODE of 'BLOCK'
* - Is not part of a block chain
* - Is not recurring
* - Does not have a task class of 'CHECK' or 'RO'
* - Does not have an applicability rule
* - Has no scheduling rules
* - Is on condition
*
* Orig.Coder: Natasa Subotic
* Recent Date: December 14,2011
*
*********************************************************************************
*
* Copyright 2011 MxI Technologies Ltd. All Rights Reserved.
* Any distribution of the MxI source code by any other party than
* MxI Technologies Ltd is prohibited.
*
*********************************************************************************/
FUNCTION is_task_defn_turn_check(
an_TaskTaskDbId IN task_task.task_db_id%TYPE,
an_TaskTaskId IN task_task.task_id%TYPE) RETURN NUMBER
IS
-- Variable declaration
v_count NUMBER;
BEGIN
SELECT
1
INTO v_count
FROM
task_task INNER JOIN eqp_assmbl ON
eqp_assmbl.assmbl_db_id = task_task.assmbl_db_id AND
eqp_assmbl.assmbl_cd = task_task.assmbl_cd
INNER JOIN ref_task_class ON
ref_task_class.task_class_db_id = task_task.task_class_db_id AND
ref_task_class.task_class_cd = task_task.task_class_cd
LEFT OUTER JOIN task_sched_rule ON
task_sched_rule.task_db_id = task_task.task_db_id AND
task_sched_rule.task_id = task_task.task_id
WHERE
task_task.task_db_id = an_TaskTaskDbId AND
task_task.task_id = an_TaskTaskId
AND
task_task.task_def_status_db_id = 0 AND
task_task.task_def_status_cd = 'ACTV'
AND
task_task.recurring_task_bool = 0
AND
task_task.block_chain_sdesc IS NULL
AND
task_task.on_condition_bool = 1
AND
task_task.task_appl_sql_ldesc IS NULL
AND
ref_task_class.class_mode_cd = 'BLOCK' AND
ref_task_class.task_class_cd NOT IN( 'CHECK', 'RO' )
AND
eqp_assmbl.assmbl_class_db_id = 0 AND
eqp_assmbl.assmbl_class_cd = 'ACFT'
AND
task_task.assmbl_bom_id = 0
AND
task_sched_rule.task_db_id IS NULL AND
task_sched_rule.task_id IS NULL;
RETURN v_count;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN 0;
END is_task_defn_turn_check;
/********************************************************************************
*
* Function: is_task_service_check
*
* Arguments: an_SchedDbId (IN NUMBER): scheduled task primary key
* an_SchedId (IN NUMBER): scheduled task primary key
*
* Description: Tests if the scheduled task's task definition is stored in
* LPA_FLEET table as service block definition. If it is, this task
* is considered service block.
*
*
*
* Orig.Coder: Natasa Subotic
* Recent Date: December 14,2011
*
*********************************************************************************
*
* Copyright 2012 MxI Technologies Ltd. All Rights Reserved.
* Any distribution of the MxI source code by any other party than
* MxI Technologies Ltd is prohibited.
*
*********************************************************************************/
FUNCTION is_task_service_check(
an_SchedDbId IN sched_stask.task_db_id%TYPE,
an_SchedId IN sched_stask.task_id%TYPE) RETURN NUMBER
IS
-- Variable declaration
v_count NUMBER;
BEGIN
SELECT
1
INTO v_count
FROM
sched_stask INNER JOIN task_task ON
task_task.task_db_id = sched_stask.task_db_id AND
task_task.task_id = sched_stask.task_id
INNER JOIN task_defn ON
task_defn.task_defn_db_id = task_task.task_defn_db_id AND
task_defn.task_defn_id = task_task.task_defn_id
WHERE
sched_stask.sched_db_id = an_SchedDbId AND
sched_stask.sched_id = an_SchedId
AND
EXISTS(
SELECT
1
FROM
lpa_fleet
WHERE
lpa_fleet.service_block_defn_db_id = task_defn.task_defn_db_id AND
lpa_fleet.service_block_defn_id = task_defn.task_defn_id
);
RETURN v_count;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN 0;
END is_task_service_check;
/********************************************************************************
*
* Function: is_task_parent_service_check
*
* Arguments: an_SchedDbId (IN NUMBER): scheduled task primary key
* an_SchedId (IN NUMBER): scheduled task primary key
*
* Description: Tests if the scheduled task's parent is service check.
* Task is considered service check if the task's task definition is stored in
* LPA_FLEET table as service block definition.
*
*
*
* Orig.Coder: Natasa Subotic
* Recent Date: January 19, 2011
*
*********************************************************************************
*
* Copyright 2012 MxI Technologies Ltd. All Rights Reserved.
* Any distribution of the MxI source code by any other party than
* MxI Technologies Ltd is prohibited.
*
*********************************************************************************/
FUNCTION is_task_parent_service_check(
an_SchedDbId IN sched_stask.task_db_id%TYPE,
an_SchedId IN sched_stask.task_id%TYPE) RETURN NUMBER
IS
-- Variable declaration
v_count NUMBER;
BEGIN
SELECT
1
INTO v_count
FROM
sched_stask subtask_task INNER JOIN evt_event subtask_event ON
subtask_event.event_db_id = subtask_task.sched_db_id AND
subtask_event.event_id = subtask_task.sched_id
INNER JOIN task_task subtask_task_rev ON
subtask_task_rev.task_db_id = subtask_task.task_db_id AND
subtask_task_rev.task_id = subtask_task.task_id
INNER JOIN task_defn subtask_taskdefn ON
subtask_taskdefn.task_defn_db_id = subtask_task_rev.task_defn_db_id AND
subtask_taskdefn.task_defn_id = subtask_task_rev.task_defn_id
INNER JOIN task_block_req_map ON
task_block_req_map.req_task_defn_db_id = subtask_taskdefn.task_defn_db_id AND
task_block_req_map.req_task_defn_id = subtask_taskdefn.task_defn_id
INNER JOIN task_task parent_task_rev ON
parent_task_rev.task_db_id = task_block_req_map.block_task_db_id AND
parent_task_rev.task_id = task_block_req_map.block_task_id
INNER JOIN task_defn parent_taskdefn ON
parent_taskdefn.task_defn_db_id = parent_task_rev.task_defn_db_id AND
parent_taskdefn.task_defn_id = parent_task_rev.task_defn_id
WHERE
subtask_task.sched_db_id = an_SchedDbId AND
subtask_task.sched_id = an_SchedId
AND
parent_task_rev.task_def_status_cd = 'ACTV'
AND
EXISTS(
SELECT
1
FROM
lpa_fleet
WHERE
lpa_fleet.service_block_defn_db_id = parent_taskdefn.task_defn_db_id AND
lpa_fleet.service_block_defn_id = parent_taskdefn.task_defn_id);
RETURN v_count;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN 0;
END is_task_parent_service_check;
/********************************************************************************
*
* Function: get_service_check_line_loc
*
* Arguments: aLocDbId (IN NUMBER): location primary key
* aLocId (IN NUMBER): location primary key
* aFleetDbId (IN NUMBER): the DbId of the fleet assembly
* aFleedCd (IN STRING) : the code of the fleet assembly
*
* Description: This function returns the line location that has the capability to
* perform the service checks for given fleet and given location(airport)
*
*
* Orig.Coder: sdevi
* Recent Date: January 23,2012
*
*********************************************************************************
*
* Copyright 2012 MxI Technologies Ltd. All Rights Reserved.
* Any distribution of the MxI source code by any other party than
* MxI Technologies Ltd is prohibited.
*
*********************************************************************************/
FUNCTION get_service_check_line_loc(
aLocDbId IN inv_loc.loc_db_id%TYPE,
aLocId IN inv_loc.loc_id%TYPE,
aFleetDbId IN lpa_fleet.fleet_db_id%TYPE,
aFleetCd IN lpa_fleet.fleet_cd%TYPE ) RETURN STRING
IS
ls_line_loc_key string(16);
BEGIN
SELECT
line_location_key
INTO
ls_line_loc_key
FROM
(
SELECT
line_loc.loc_db_id || ':' || line_loc.loc_id as line_location_key,
line_loc.loc_cd
FROM
inv_loc line_loc
WHERE
line_loc.supply_loc_db_id = aLocDbId AND
line_loc.supply_loc_id = aLocId AND
line_loc.loc_type_cd = 'LINE'
AND
--make sure the location is capable of doing the all service work types
(
SELECT count(*)
FROM
lpa_service_work_type
WHERE
lpa_service_work_type.fleet_db_id = aFleetDbId AND
lpa_service_work_type.fleet_cd = aFleetCd
AND NOT EXISTS
(
SELECT
1
FROM
inv_loc_capability
WHERE
inv_loc_capability.loc_db_id = line_loc.loc_db_id AND
inv_loc_capability.loc_id = line_loc.loc_id
AND
inv_loc_capability.assmbl_db_id = lpa_service_work_type.fleet_db_id AND
inv_loc_capability.assmbl_cd = lpa_service_work_type.fleet_cd
AND
inv_loc_capability.work_type_db_id = lpa_service_work_type.work_type_db_id AND
inv_loc_capability.work_type_cd = lpa_service_work_type.work_type_cd
)
) = 0
ORDER BY
line_loc.loc_cd
)
WHERE
ROWNUM = 1;
RETURN ls_line_loc_key;
END get_service_check_line_loc;
/********************************************************************************
*
* Function: get_turn_check_line_loc
*
* Arguments: aLocDbId (IN NUMBER): location primary key
* aLocId (IN NUMBER): location primary key
* aFleetDbId (IN NUMBER): the DbId of the fleet assembly
* aFleedCd (IN STRING) : the code of the fleet assembly
*
* Description: This function returns the line location that has the capability to
* perform the turn checks for given fleet and given location(airport)
*
*
* Orig.Coder: sdevi
* Recent Date: January 23,2012
*
*********************************************************************************
*
* Copyright 2012 MxI Technologies Ltd. All Rights Reserved.
* Any distribution of the MxI source code by any other party than
* MxI Technologies Ltd is prohibited.
*
*********************************************************************************/
FUNCTION get_turn_check_line_loc(
aLocDbId IN inv_loc.loc_db_id%TYPE,
aLocId IN inv_loc.loc_id%TYPE,
aFleetDbId IN lpa_fleet.fleet_db_id%TYPE,
aFleetCd IN lpa_fleet.fleet_cd%TYPE ) RETURN STRING
IS
ls_line_loc_key string(16);
BEGIN
SELECT
line_location_key
INTO
ls_line_loc_key
FROM
(
SELECT
line_loc.loc_db_id || ':' || line_loc.loc_id as line_location_key,
line_loc.loc_cd
FROM
inv_loc line_loc
WHERE
line_loc.supply_loc_db_id = aLocDbId AND
line_loc.supply_loc_id = aLocId AND
line_loc.loc_type_cd = 'LINE'
AND
--make sure the location is capable of doing the all turn work types
(
SELECT count(*)
FROM
lpa_turn_work_type
WHERE
lpa_turn_work_type.fleet_db_id = aFleetDbId AND
lpa_turn_work_type.fleet_cd = aFleetCd
AND NOT EXISTS
(
SELECT
1
FROM
inv_loc_capability
WHERE
inv_loc_capability.loc_db_id = line_loc.loc_db_id AND
inv_loc_capability.loc_id = line_loc.loc_id
AND
inv_loc_capability.assmbl_db_id = lpa_turn_work_type.fleet_db_id AND
inv_loc_capability.assmbl_cd = lpa_turn_work_type.fleet_cd
AND
inv_loc_capability.work_type_db_id = lpa_turn_work_type.work_type_db_id AND
inv_loc_capability.work_type_cd = lpa_turn_work_type.work_type_cd
)
) = 0
ORDER BY
line_loc.loc_cd
)
WHERE
ROWNUM = 1;
RETURN ls_line_loc_key;
END get_turn_check_line_loc;
END LPA_PKG;
/ | true |
dd15c601f1b7cbdbefac5396ef0f5be2ecac05d1 | SQL | riddhi-shikha/Supermarket | /database.sql | UTF-8 | 16,728 | 3.078125 | 3 | [] | no_license | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 8.0.25 - MySQL Community Server - GPL
-- Server OS: Win64
-- HeidiSQL Version: 11.3.0.6295
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- Dumping database structure for supermarketdb
DROP DATABASE IF EXISTS `supermarketdb`;
CREATE DATABASE IF NOT EXISTS `supermarketdb` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `supermarketdb`;
-- Dumping structure for table supermarketdb.category
DROP TABLE IF EXISTS `category`;
CREATE TABLE IF NOT EXISTS `category` (
`cat_id` int NOT NULL AUTO_INCREMENT,
`cat_name` varchar(50) NOT NULL,
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` int NOT NULL,
`modified_on` datetime DEFAULT NULL,
`modified_by` int DEFAULT NULL,
PRIMARY KEY (`cat_id`),
UNIQUE KEY `cat_name` (`cat_name`)
) ENGINE=InnoDB AUTO_INCREMENT=1019 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table supermarketdb.category: ~18 rows (approximately)
DELETE FROM `category`;
/*!40000 ALTER TABLE `category` DISABLE KEYS */;
INSERT INTO `category` (`cat_id`, `cat_name`, `description`, `created_on`, `created_by`, `modified_on`, `modified_by`) VALUES
(1001, 'Electronics', 'Eletronics Items like as Mobile, Television etc.', '2021-06-10 22:29:24', 101, '2021-06-23 23:24:10', 0),
(1002, 'Milk and Dairy foods', 'cheeses, eggs, milk, yogurt, butter', '2021-06-11 01:56:55', 102, '2021-06-24 00:21:28', 102),
(1003, 'Food', 'All Food Items', '2021-06-24 00:13:00', 102, NULL, NULL),
(1004, 'Processed Foods', 'All kind of processed foods', '2021-06-24 00:14:44', 102, NULL, NULL),
(1005, 'Beverages ', 'coffee/tea, juice, soda', '2021-06-24 00:15:21', 102, '2021-06-24 00:20:16', 102),
(1006, 'Meat ', 'lunch meat, poultry, beef, pork', '2021-06-24 00:16:35', 102, '2021-06-24 00:22:41', 102),
(1007, 'Fresh Produce', 'All kind of vegitables', '2021-06-24 00:17:09', 102, NULL, NULL),
(1008, 'Spices ', 'All types of spices ', '2021-06-24 00:17:32', 102, NULL, NULL),
(1009, 'The Dry Food Grocery', 'All types of Groceries', '2021-06-24 00:18:52', 102, NULL, NULL),
(1010, 'Bread/Bakery ', 'sandwich loaves, dinner rolls, tortillas, bagels', '2021-06-24 00:20:01', 102, NULL, NULL),
(1011, 'Canned/Jarred Goods', 'vegetables, spaghetti sauce, ketchup', '2021-06-24 00:20:50', 102, NULL, NULL),
(1012, 'Dry/Baking Goods', 'cereals, flour, sugar, pasta, mixes', '2021-06-24 00:21:48', 102, NULL, NULL),
(1013, 'Frozen Foods', 'waffles, vegetables, individual meals, ice cream', '2021-06-24 00:22:06', 102, NULL, NULL),
(1014, 'Produce', 'fruits, vegetables', '2021-06-24 00:22:58', 102, NULL, NULL),
(1015, 'Cleaners', 'all- purpose, laundry detergent, dishwashing liquid/detergent', '2021-06-24 00:23:21', 102, NULL, NULL),
(1016, 'Paper Goods', 'paper towels, toilet paper, aluminum foil, sandwich bags', '2021-06-24 00:23:38', 102, NULL, NULL),
(1017, 'Personal Care', 'shampoo, soap, hand soap, shaving cream', '2021-06-24 00:23:58', 102, NULL, NULL),
(1018, 'Other', 'baby items, pet items, batteries, greeting cards', '2021-06-24 00:24:16', 102, NULL, NULL);
/*!40000 ALTER TABLE `category` ENABLE KEYS */;
-- Dumping structure for table supermarketdb.product
DROP TABLE IF EXISTS `product`;
CREATE TABLE IF NOT EXISTS `product` (
`prod_id` int NOT NULL AUTO_INCREMENT,
`prod_name` varchar(50) NOT NULL,
`manufacturer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`quantity` int NOT NULL,
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`price` double NOT NULL,
`discount` int NOT NULL DEFAULT '0',
`gst` int NOT NULL DEFAULT '0',
`cat_id` int NOT NULL,
`subcat_id` int NOT NULL,
`created_by` int DEFAULT NULL,
`created_on` datetime NOT NULL,
`modified_by` int DEFAULT NULL,
`modified_on` datetime DEFAULT NULL,
PRIMARY KEY (`prod_id`),
KEY `FK_product_category` (`cat_id`),
KEY `FK_product_subcategory` (`subcat_id`),
KEY `FK_product_user` (`created_by`),
KEY `FK_product_user_2` (`modified_by`),
CONSTRAINT `FK_product_category` FOREIGN KEY (`cat_id`) REFERENCES `category` (`cat_id`),
CONSTRAINT `FK_product_subcategory` FOREIGN KEY (`subcat_id`) REFERENCES `subcategory` (`subcat_id`),
CONSTRAINT `FK_product_user` FOREIGN KEY (`created_by`) REFERENCES `user` (`u_id`),
CONSTRAINT `FK_product_user_2` FOREIGN KEY (`modified_by`) REFERENCES `user` (`u_id`)
) ENGINE=InnoDB AUTO_INCREMENT=100008 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='manufacturer';
-- Dumping data for table supermarketdb.product: ~2 rows (approximately)
DELETE FROM `product`;
/*!40000 ALTER TABLE `product` DISABLE KEYS */;
INSERT INTO `product` (`prod_id`, `prod_name`, `manufacturer`, `quantity`, `description`, `price`, `discount`, `gst`, `cat_id`, `subcat_id`, `created_by`, `created_on`, `modified_by`, `modified_on`) VALUES
(100001, 'Apple iPhone 12 Pro Max', 'Apple', 250, NULL, 134900, 0, 18, 1001, 10001, 101, '2021-06-17 20:54:07', NULL, NULL),
(100002, 'Apple iphone 12 Pro', 'Apple', 234, '128 GB, Midnight Blue ', 124900, 10, 18, 1001, 10001, 102, '2021-06-18 20:07:17', 101, '2021-06-23 15:23:19'),
(100003, 'Maggie', 'Nestle', 548, 'Nestle Maggie', 20, 0, 0, 1004, 10038, 106, '2021-06-24 13:18:50', NULL, NULL),
(100004, 'Bread', 'Britania', 100, 'Britania', 40, 0, 0, 1004, 10028, 106, '2021-06-24 13:19:45', NULL, NULL),
(100005, 'Pepsi Black', 'Pepsi', 120, 'Pepsi', 45, 0, 0, 1005, 10031, 106, '2021-06-24 13:21:53', NULL, NULL),
(100006, 'Chicken', 'Fresho', 100, 'Fresho', 120, 0, 0, 1006, 10039, 106, '2021-06-24 13:23:00', NULL, NULL),
(100007, 'Apple', 'Imported', 500, 'Imported Apple', 250, 0, 0, 1007, 10048, 106, '2021-06-24 13:25:09', NULL, NULL);
/*!40000 ALTER TABLE `product` ENABLE KEYS */;
-- Dumping structure for table supermarketdb.subcategory
DROP TABLE IF EXISTS `subcategory`;
CREATE TABLE IF NOT EXISTS `subcategory` (
`subcat_id` int NOT NULL AUTO_INCREMENT,
`subcat_name` varchar(50) NOT NULL,
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` int NOT NULL,
`modified_on` datetime DEFAULT NULL,
`modified_by` int DEFAULT NULL,
`cat_id` int NOT NULL,
PRIMARY KEY (`subcat_id`),
UNIQUE KEY `subcat_name` (`subcat_name`),
KEY `FK_subcategory_user` (`created_by`),
KEY `FK_subcategory_user_2` (`modified_by`),
KEY `FK_subcategory_category` (`cat_id`),
CONSTRAINT `FK_subcategory_category` FOREIGN KEY (`cat_id`) REFERENCES `category` (`cat_id`),
CONSTRAINT `FK_subcategory_user` FOREIGN KEY (`created_by`) REFERENCES `user` (`u_id`),
CONSTRAINT `FK_subcategory_user_2` FOREIGN KEY (`modified_by`) REFERENCES `user` (`u_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10068 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table supermarketdb.subcategory: ~61 rows (approximately)
DELETE FROM `subcategory`;
/*!40000 ALTER TABLE `subcategory` DISABLE KEYS */;
INSERT INTO `subcategory` (`subcat_id`, `subcat_name`, `description`, `created_on`, `created_by`, `modified_on`, `modified_by`, `cat_id`) VALUES
(10001, 'Mobile Phone & Accessories', 'All types of mobile phone', '2021-06-12 01:06:04', 101, '2021-06-24 00:37:13', 106, 1001),
(10002, 'LED, LCD, Smart TV', 'All Kind of Televisions', '2021-06-24 00:31:37', 102, '2021-06-24 00:36:31', 106, 1001),
(10003, 'Home Theater', 'All Kind of Home Theater', '2021-06-24 00:32:15', 102, NULL, NULL, 1001),
(10004, 'Freezers, Refrigerators & Chillers', 'Freezers, Refrigerators & Chillers', '2021-06-24 00:35:15', 106, NULL, NULL, 1001),
(10005, 'Cleaning Machines & Equipments', 'Cleaning Machines & Equipments', '2021-06-24 00:35:32', 106, NULL, NULL, 1001),
(10006, 'Light Bulb, Lamp & Lighting Fixtures', 'Light Bulb, Lamp & Lighting Fixtures', '2021-06-24 00:35:50', 106, NULL, NULL, 1001),
(10007, 'Adaptors, Plugs & Sockets', 'Adaptors, Plugs & Sockets', '2021-06-24 00:36:08', 106, NULL, NULL, 1001),
(10008, 'Domestic RO Water Purifier & Filters', 'Domestic RO Water Purifier & Filters', '2021-06-24 00:36:49', 106, NULL, NULL, 1001),
(10009, 'Domestic Fans, AC & Coolers', 'Domestic Fans, AC & Coolers', '2021-06-24 00:37:41', 106, NULL, NULL, 1001),
(10010, 'Heater, Thermostat & Heating Devices', 'Heater, Thermostat & Heating Devices', '2021-06-24 00:37:57', 106, NULL, NULL, 1001),
(10011, 'Decorative Light, Lamp & Lamp Shades', 'Decorative Light, Lamp & Lamp Shades', '2021-06-24 00:38:33', 106, NULL, NULL, 1001),
(10012, 'Home Appliances & Kitchen Appliances', 'Home Appliances & Kitchen Appliances', '2021-06-24 00:38:40', 106, NULL, NULL, 1001),
(10013, 'Indoor Lights & Lighting Accessories', 'Indoor Lights & Lighting Accessories', '2021-06-24 00:38:59', 106, NULL, NULL, 1001),
(10014, 'Butter', 'Butter and butter blends.', '2021-06-24 00:40:13', 106, NULL, NULL, 1002),
(10015, 'Cheese', 'Natural and processed cheese products.', '2021-06-24 00:40:34', 106, NULL, NULL, 1002),
(10016, 'Cultured Dairy', 'Yogurt, cottage cheese, sour cream, dips and other cultured dairy foods', '2021-06-24 00:40:53', 106, NULL, NULL, 1002),
(10017, 'Frozen Desserts', 'Ice cream cakes other frozen desserts made with dairy ingredients.', '2021-06-24 00:41:20', 106, NULL, NULL, 1002),
(10018, 'Ice Cream/Novelties', 'Ice cream, ice milk, novelties, sherbets, sorbets and frozen yogurt.', '2021-06-24 00:41:42', 106, NULL, NULL, 1002),
(10019, 'Milk', 'Information on milk processing, milk processors and all types of fluid milk products – whole, skim, 2%, 1%, flavored, cream and half-and-half', '2021-06-24 00:42:34', 106, NULL, NULL, 1002),
(10020, 'Non-Dairy Beverages', 'Juices, teas, coffees, waters, soy and other beverages without dairy ingredients', '2021-06-24 00:42:54', 106, NULL, NULL, 1002),
(10021, 'Whey, Milk Powder', 'Whey protein concentrate, whey protein isolate, milk protein concentrate and other dairy ingredients', '2021-06-24 00:43:14', 106, NULL, NULL, 1002),
(10022, 'Wheat Flour', 'Wheat', '2021-06-24 00:45:29', 106, NULL, NULL, 1003),
(10023, 'Rice', 'All kind of Rice', '2021-06-24 00:45:46', 106, NULL, NULL, 1003),
(10024, 'Pulses', 'All kinds of Pulses', '2021-06-24 00:46:06', 106, NULL, NULL, 1003),
(10025, 'Cereal', 'cereal', '2021-06-24 00:48:33', 106, '2021-06-24 00:49:50', 106, 1004),
(10026, 'Potato chips', 'potato chips', '2021-06-24 00:48:49', 106, '2021-06-24 00:49:44', 106, 1004),
(10027, 'Cookies', 'cookies', '2021-06-24 00:49:00', 106, '2021-06-24 00:49:37', 106, 1004),
(10028, 'Bread', 'Bread', '2021-06-24 00:49:27', 106, NULL, NULL, 1004),
(10029, 'COKE', 'COKE', '2021-06-24 00:51:09', 106, NULL, NULL, 1005),
(10030, 'FANTA', 'FANTA', '2021-06-24 00:51:29', 106, NULL, NULL, 1005),
(10031, 'PEPSI', 'PEPSI', '2021-06-24 00:51:44', 106, NULL, NULL, 1005),
(10032, 'DR. PEPPER', 'DR. PEPPER', '2021-06-24 00:51:57', 106, NULL, NULL, 1005),
(10033, 'SEVEN UP', 'SEVEN UP', '2021-06-24 00:52:10', 106, NULL, NULL, 1005),
(10034, 'RED BULL', 'RED BULL', '2021-06-24 00:52:24', 106, NULL, NULL, 1005),
(10035, 'MONSTER', 'MONSTER', '2021-06-24 00:52:35', 106, NULL, NULL, 1005),
(10036, 'GATORADE', 'GATORADE', '2021-06-24 00:52:46', 106, NULL, NULL, 1005),
(10037, 'NESTLE', 'NESTLE', '2021-06-24 00:53:13', 106, NULL, NULL, 1005),
(10038, 'Maggie', 'Maggie', '2021-06-24 00:53:31', 106, NULL, NULL, 1004),
(10039, 'Chicken', 'Chicken', '2021-06-24 00:54:19', 106, NULL, NULL, 1006),
(10040, 'Sea food', 'Sea food', '2021-06-24 00:54:31', 106, NULL, NULL, 1006),
(10041, 'Eggs', 'Eggs', '2021-06-24 00:54:53', 106, NULL, NULL, 1006),
(10042, 'Fish', 'Fish', '2021-06-24 00:55:05', 106, NULL, NULL, 1006),
(10043, 'Lamb', 'Lamb', '2021-06-24 00:55:15', 106, NULL, NULL, 1006),
(10044, 'Mutton ', 'Mutton ', '2021-06-24 00:55:48', 106, NULL, NULL, 1006),
(10047, 'Vegetable', 'Vegetable', '2021-06-24 00:57:13', 106, NULL, NULL, 1007),
(10048, 'Fruits', 'Fruits', '2021-06-24 00:57:48', 106, NULL, NULL, 1007),
(10053, 'Bun', 'Bun', '2021-06-24 00:58:36', 106, NULL, NULL, 1010),
(10054, 'Cake', 'Cake', '2021-06-24 00:59:00', 106, NULL, NULL, 1010),
(10055, 'Floor Cleaner', 'Floor Cleaner', '2021-06-24 00:59:30', 106, NULL, NULL, 1015),
(10056, 'Bathroom Cleaner', 'Bathroom Cleaner', '2021-06-24 00:59:50', 106, NULL, NULL, 1015),
(10057, 'Kitchen Cleaner', 'Kitchen Cleaner', '2021-06-24 01:00:19', 106, NULL, NULL, 1015),
(10058, 'Shampoo', 'Shampoo', '2021-06-24 01:00:32', 106, NULL, NULL, 1017),
(10059, 'Shop', 'Shop', '2021-06-24 01:00:46', 106, NULL, NULL, 1017),
(10060, 'Deo', 'Deo', '2021-06-24 01:01:03', 106, NULL, NULL, 1017),
(10061, 'Comb', 'Comb', '2021-06-24 01:01:19', 106, NULL, NULL, 1017),
(10062, 'Hair Oil', 'Hair Oil', '2021-06-24 01:01:32', 106, NULL, NULL, 1017),
(10063, 'Hair Gel', 'Hair Gel', '2021-06-24 01:01:44', 106, NULL, NULL, 1017),
(10064, 'Face Cream', 'Face Cream', '2021-06-24 01:02:06', 106, NULL, NULL, 1017),
(10065, 'Dry Fruits', 'Dry Fruits', '2021-06-24 01:02:47', 106, NULL, NULL, 1012),
(10066, 'Moph', 'Moph', '2021-06-24 01:06:22', 106, NULL, NULL, 1018),
(10067, 'Broom', 'Broom', '2021-06-24 01:06:34', 106, NULL, NULL, 1018);
/*!40000 ALTER TABLE `subcategory` ENABLE KEYS */;
-- Dumping structure for table supermarketdb.user
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`u_id` int NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`user_id` varchar(50) NOT NULL,
`role` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`gender` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`contact` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`dob` date NOT NULL,
`address` varchar(1000) NOT NULL,
`photo` varchar(1000) NOT NULL,
`id_type` varchar(50) NOT NULL,
`id_number` varchar(50) NOT NULL,
`created_on` datetime NOT NULL,
`created_by` int NOT NULL,
`modified_on` datetime DEFAULT NULL,
`modified_by` int DEFAULT NULL,
PRIMARY KEY (`u_id`),
UNIQUE KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=107 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table supermarketdb.user: ~5 rows (approximately)
DELETE FROM `user`;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` (`u_id`, `name`, `user_id`, `role`, `password`, `gender`, `contact`, `dob`, `address`, `photo`, `id_type`, `id_number`, `created_on`, `created_by`, `modified_on`, `modified_by`) VALUES
(101, 'Admin_1', 'nits101', 'Admin', '12345', 'Male', '9001900106 ', '1992-06-08', 'M P Nagar, Bhopal, MP, IN', 'E:/SupermarketJava/Supermarket/src/org/github/supermarket/profile/USER_101.png', 'Voter ID', 'MP2018CH2020', '2021-06-10 00:00:00', 101, '2021-06-24 12:56:21', 106),
(102, 'Kumar Deepak', 'R2H0M3', 'Admin', '12345678', 'Male', '9595959595 ', '1993-11-16', 'Mumbai, MH, India', 'E:/SupermarketJava/Supermarket/src/org/github/supermarket/profile/USER_102.png', 'Driving Liecnse', 'DL209876XYZ', '2021-06-11 03:19:32', 101, '2021-06-24 00:10:40', 101),
(103, 'Seller_2', 'QYZX9L', 'Seller', '12345', 'Female', '9009988888 ', '2016-10-04', 'Indore, MP, India', 'E:/SupermarketJava/Supermarket/src/org/github/supermarket/profile/USER_103.png', 'Aadhar Card', '234554321678', '2021-06-11 03:21:25', 102, '2021-06-24 00:07:24', 101),
(104, 'Seller_1', 'SVZM3X', 'Seller', '123456', 'Female', '9875643210 ', '1990-01-31', 'Jabalpur, MP, India', 'E:/SupermarketJava/Supermarket/src/org/github/supermarket/profile/USER_104.png', 'Passport', '98765430982', '2021-06-15 18:08:12', 101, '2021-06-24 00:09:15', 101),
(106, 'Riddhi Shikha', 'MM6E5D', 'Admin', '098765', 'Female', '9999999999 ', '1998-12-26', 'Bhopal, MP, India', 'E:/SupermarketJava/Supermarket/src/org/github/supermarket/profile/USER_105.png', 'Pan Card', 'AAAAA1010A', '2021-06-24 00:06:19', 101, NULL, NULL);
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
| true |
701c6f4b367fe8e999ad15dfc972dee6ef43ed39 | SQL | edebaze/HomEat | /homeat.sql | UTF-8 | 18,393 | 3.375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1
-- Généré le : ven. 06 avr. 2018 à 19:05
-- Version du serveur : 10.1.30-MariaDB
-- Version de PHP : 7.2.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `homeat`
--
-- --------------------------------------------------------
--
-- Structure de la table `address`
--
CREATE TABLE `address` (
`id` int(11) NOT NULL,
`street` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`zip_code` int(11) NOT NULL,
`city` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`comment` text COLLATE utf8_unicode_ci NOT NULL,
`number` int(11) NOT NULL,
`lat` decimal(10,8) NOT NULL,
`lng` decimal(10,8) NOT NULL,
`ip` varchar(50) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `address`
--
INSERT INTO `address` (`id`, `street`, `zip_code`, `city`, `comment`, `number`, `lat`, `lng`, `ip`) VALUES
(1, 'Boulevard Gambetta', 76000, 'Rouen', 'appartement 604', 10, '50.00000000', '30.00000000', '0'),
(5, 'Boulevard Gambetta', 76000, 'Rouen', 'appartement 305', 11, '48.00000000', '2.00000000', '9063'),
(6, 'Marcel Pagnole', 14000, 'Lisieux', 'Appartement 201', 12, '48.00000000', '2.00000000', '9063');
-- --------------------------------------------------------
--
-- Structure de la table `address_has_user`
--
CREATE TABLE `address_has_user` (
`id` int(11) NOT NULL,
`address_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`name` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`principale` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `address_has_user`
--
INSERT INTO `address_has_user` (`id`, `address_id`, `user_id`, `name`, `principale`) VALUES
(1, 1, 1, 'Home Etienne', 1),
(3, 5, 3, 'Home aza', 0),
(4, 6, 3, 'Home aza', 1);
-- --------------------------------------------------------
--
-- Structure de la table `categories_ingredients`
--
CREATE TABLE `categories_ingredients` (
`id` int(11) NOT NULL,
`name` varchar(150) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Structure de la table `categories_recipes`
--
CREATE TABLE `categories_recipes` (
`id` int(11) NOT NULL,
`names_categories_recipes` varchar(150) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `categories_recipes`
--
INSERT INTO `categories_recipes` (`id`, `names_categories_recipes`) VALUES
(1, 'Hallal'),
(2, 'Viande');
-- --------------------------------------------------------
--
-- Structure de la table `challenge`
--
CREATE TABLE `challenge` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`promo` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`xp` int(11) NOT NULL,
`description` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
`max` int(11) NOT NULL,
`ref` int(11) NOT NULL,
`sousref` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `challenge`
--
INSERT INTO `challenge` (`id`, `name`, `image`, `promo`, `xp`, `description`, `max`, `ref`, `sousref`) VALUES
(1, '5 stars', 'images/recompenses/01.png', 'azazaz', 200, 'Recevez une critique à 5 étoiles', 1, 1, 0),
(2, 'Cuis-tôt', 'images/recompenses/02.png', 'machine', 200, 'Commander un plat', 1, 2, 0),
(3, 'Decimeur de cochons', 'images/recompenses/03.png', 'sqdsqdqsd', 500, 'Manger 10 plats à base de cochon', 10, 3, 0),
(4, '5 star - expert', 'images/recompenses/04.jpg', 'edqsqsv', 500, 'Recevez 10 commentaires à 5 étoiles', 10, 1, 1);
-- --------------------------------------------------------
--
-- Structure de la table `ingredients`
--
CREATE TABLE `ingredients` (
`id` int(11) NOT NULL,
`names_ingredients` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`allergenes` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Structure de la table `ingredients_categories_ingredients`
--
CREATE TABLE `ingredients_categories_ingredients` (
`ingredients_id` int(11) NOT NULL,
`categories_ingredients_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Structure de la table `level`
--
CREATE TABLE `level` (
`id` int(11) NOT NULL,
`xp` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `level`
--
INSERT INTO `level` (`id`, `xp`) VALUES
(1, 100),
(2, 200),
(3, 400),
(4, 600),
(5, 800);
-- --------------------------------------------------------
--
-- Structure de la table `orders`
--
CREATE TABLE `orders` (
`id` int(11) NOT NULL,
`status_id` int(11) DEFAULT NULL,
`recipes_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`quantities` int(11) NOT NULL,
`cancel` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `orders`
--
INSERT INTO `orders` (`id`, `status_id`, `recipes_id`, `user_id`, `quantities`, `cancel`) VALUES
(1, 1, 1, 1, 2, 1),
(2, 1, 1, 1, 1, 0),
(3, 1, 1, 1, 3, 1),
(4, 1, 1, 1, 2, 0),
(5, 1, 1, 2, 1, 1),
(6, 1, 1, 2, 2, 1),
(7, 1, 1, 2, 1, 1),
(8, 1, 1, 2, 2, 1),
(9, 2, 1, 2, 1, 1),
(10, 1, 1, 2, 1, 1),
(11, 1, 1, 2, 1, 0),
(12, 1, 1, 3, 1, 1);
-- --------------------------------------------------------
--
-- Structure de la table `recipes`
--
CREATE TABLE `recipes` (
`id` int(11) NOT NULL,
`categorie_id` int(11) DEFAULT NULL,
`status_id` int(11) DEFAULT NULL,
`cuisto_id` int(11) DEFAULT NULL,
`titre` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`description` text COLLATE utf8_unicode_ci NOT NULL,
`price` decimal(10,2) NOT NULL,
`hour` time NOT NULL,
`quantity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `recipes`
--
INSERT INTO `recipes` (`id`, `categorie_id`, `status_id`, `cuisto_id`, `titre`, `image`, `description`, `price`, `hour`, `quantity`) VALUES
(1, NULL, 2, 1, 'Lasagnes au ketchup', 'images/recettes/28768530.jpeg', 'Petit plat chaud du samedi spécial charclo', '3.00', '11:22:00', 2),
(2, NULL, 2, 3, 'Etienne est un ouf', 'images/recettes/45232314.jpeg', 'Etienne est trop un ouf, vraiment', '150.00', '12:07:00', 12);
-- --------------------------------------------------------
--
-- Structure de la table `recipes_ingredients`
--
CREATE TABLE `recipes_ingredients` (
`recipes_id` int(11) NOT NULL,
`ingredients_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Structure de la table `review`
--
CREATE TABLE `review` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`destinataire_id` int(11) DEFAULT NULL,
`comments` text COLLATE utf8_unicode_ci NOT NULL,
`notes` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `review`
--
INSERT INTO `review` (`id`, `user_id`, `destinataire_id`, `comments`, `notes`) VALUES
(1, 1, 1, 'Salut', 0),
(2, 1, 1, 'Salut', 0),
(3, 1, 1, 'Super !', 5),
(4, 2, 2, 'qsds', 5),
(5, 2, 2, 'eeza', 5),
(6, 2, 2, '', 0),
(7, 2, 2, 'Etienne est un ouf', 5),
(8, 2, 2, 'wsh', 5),
(9, 3, 3, '', 5),
(10, 3, 3, '', 5),
(11, 3, 3, '', 5),
(12, 3, 3, '', 0),
(13, 3, 3, '', 0),
(14, 3, 3, '', 0),
(15, 3, 3, '', 5),
(16, 3, 3, 'alulégen', 5);
-- --------------------------------------------------------
--
-- Structure de la table `roles`
--
CREATE TABLE `roles` (
`id` int(11) NOT NULL,
`name` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`description` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `roles`
--
INSERT INTO `roles` (`id`, `name`, `description`) VALUES
(1, 'Admin', 'Administrateur'),
(2, 'User', 'Utilisateur lambda');
-- --------------------------------------------------------
--
-- Structure de la table `status`
--
CREATE TABLE `status` (
`id` int(11) NOT NULL,
`names` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`descriptions` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `status`
--
INSERT INTO `status` (`id`, `names`, `descriptions`) VALUES
(1, 'Vendu', ''),
(2, 'En Vente', '');
-- --------------------------------------------------------
--
-- Structure de la table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`roles_id` int(11) DEFAULT NULL,
`firstname` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`mail` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`pass` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`date_inscription` datetime NOT NULL,
`last_connexion` datetime NOT NULL,
`avatar` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`xp` int(11) NOT NULL,
`level_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `user`
--
INSERT INTO `user` (`id`, `roles_id`, `firstname`, `name`, `mail`, `pass`, `date_inscription`, `last_connexion`, `avatar`, `xp`, `level_id`) VALUES
(1, 2, '', 'Etienne', 'etienne@gmail.com', 'az', '2018-04-04 11:12:04', '2018-04-04 11:12:04', 'images/recompenses/02.png', 0, 1),
(2, 2, '', 'Marc', 'jesus@yahoo.fr', 'a', '2018-04-04 15:21:18', '2018-04-04 15:21:18', 'images/recompenses/01.png', 200, 2),
(3, 2, '', 'aza', 'aza@gmail.com', 'aza', '2018-04-04 16:22:06', '2018-04-04 16:22:06', 'images/recompenses/02.png', 3100, 5);
-- --------------------------------------------------------
--
-- Structure de la table `user_challenge`
--
CREATE TABLE `user_challenge` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`challenge_id` int(11) DEFAULT NULL,
`accomplissement` double NOT NULL,
`used` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Déchargement des données de la table `user_challenge`
--
INSERT INTO `user_challenge` (`id`, `user_id`, `challenge_id`, `accomplissement`, `used`) VALUES
(1, 1, 1, 1, 0),
(2, 1, 2, 1, 0),
(3, 2, 1, 0, 0),
(4, 2, 2, 1, 0),
(5, 3, 1, 1, 0),
(6, 3, 2, 1, 0),
(7, 3, 3, 0, 0),
(8, 3, 4, 0.2, 0);
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `address`
--
ALTER TABLE `address`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `address_has_user`
--
ALTER TABLE `address_has_user`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_2E40F397F5B7AF75` (`address_id`),
ADD KEY `IDX_2E40F397A76ED395` (`user_id`);
--
-- Index pour la table `categories_ingredients`
--
ALTER TABLE `categories_ingredients`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `categories_recipes`
--
ALTER TABLE `categories_recipes`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `challenge`
--
ALTER TABLE `challenge`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `ingredients`
--
ALTER TABLE `ingredients`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `ingredients_categories_ingredients`
--
ALTER TABLE `ingredients_categories_ingredients`
ADD PRIMARY KEY (`ingredients_id`,`categories_ingredients_id`),
ADD KEY `IDX_449D79133EC4DCE` (`ingredients_id`),
ADD KEY `IDX_449D7913B213CE5A` (`categories_ingredients_id`);
--
-- Index pour la table `level`
--
ALTER TABLE `level`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_E52FFDEE6BF700BD` (`status_id`),
ADD KEY `IDX_E52FFDEEFDF2B1FA` (`recipes_id`),
ADD KEY `IDX_E52FFDEEA76ED395` (`user_id`);
--
-- Index pour la table `recipes`
--
ALTER TABLE `recipes`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_A369E2B56BF700BD` (`status_id`),
ADD KEY `IDX_A369E2B52D8FD1A` (`cuisto_id`),
ADD KEY `IDX_A369E2B5BCF5E72D` (`categorie_id`);
--
-- Index pour la table `recipes_ingredients`
--
ALTER TABLE `recipes_ingredients`
ADD PRIMARY KEY (`recipes_id`,`ingredients_id`),
ADD KEY `IDX_761206B0FDF2B1FA` (`recipes_id`),
ADD KEY `IDX_761206B03EC4DCE` (`ingredients_id`);
--
-- Index pour la table `review`
--
ALTER TABLE `review`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_794381C6A76ED395` (`user_id`),
ADD KEY `IDX_794381C6A4F84F6E` (`destinataire_id`);
--
-- Index pour la table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `status`
--
ALTER TABLE `status`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_8D93D64938C751C4` (`roles_id`),
ADD KEY `IDX_8D93D6495FB14BA7` (`level_id`);
--
-- Index pour la table `user_challenge`
--
ALTER TABLE `user_challenge`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_D7E904B5A76ED395` (`user_id`),
ADD KEY `IDX_D7E904B598A21AC6` (`challenge_id`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `address`
--
ALTER TABLE `address`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT pour la table `address_has_user`
--
ALTER TABLE `address_has_user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT pour la table `categories_ingredients`
--
ALTER TABLE `categories_ingredients`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `categories_recipes`
--
ALTER TABLE `categories_recipes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `challenge`
--
ALTER TABLE `challenge`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT pour la table `ingredients`
--
ALTER TABLE `ingredients`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `level`
--
ALTER TABLE `level`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT pour la table `orders`
--
ALTER TABLE `orders`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT pour la table `recipes`
--
ALTER TABLE `recipes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `review`
--
ALTER TABLE `review`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT pour la table `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `status`
--
ALTER TABLE `status`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT pour la table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT pour la table `user_challenge`
--
ALTER TABLE `user_challenge`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- Contraintes pour les tables déchargées
--
--
-- Contraintes pour la table `address_has_user`
--
ALTER TABLE `address_has_user`
ADD CONSTRAINT `FK_2E40F397A76ED395` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
ADD CONSTRAINT `FK_2E40F397F5B7AF75` FOREIGN KEY (`address_id`) REFERENCES `address` (`id`);
--
-- Contraintes pour la table `ingredients_categories_ingredients`
--
ALTER TABLE `ingredients_categories_ingredients`
ADD CONSTRAINT `FK_449D79133EC4DCE` FOREIGN KEY (`ingredients_id`) REFERENCES `ingredients` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_449D7913B213CE5A` FOREIGN KEY (`categories_ingredients_id`) REFERENCES `categories_ingredients` (`id`) ON DELETE CASCADE;
--
-- Contraintes pour la table `orders`
--
ALTER TABLE `orders`
ADD CONSTRAINT `FK_E52FFDEE6BF700BD` FOREIGN KEY (`status_id`) REFERENCES `status` (`id`),
ADD CONSTRAINT `FK_E52FFDEEA76ED395` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
ADD CONSTRAINT `FK_E52FFDEEFDF2B1FA` FOREIGN KEY (`recipes_id`) REFERENCES `recipes` (`id`);
--
-- Contraintes pour la table `recipes`
--
ALTER TABLE `recipes`
ADD CONSTRAINT `FK_A369E2B52D8FD1A` FOREIGN KEY (`cuisto_id`) REFERENCES `user` (`id`),
ADD CONSTRAINT `FK_A369E2B56BF700BD` FOREIGN KEY (`status_id`) REFERENCES `status` (`id`),
ADD CONSTRAINT `FK_A369E2B5BCF5E72D` FOREIGN KEY (`categorie_id`) REFERENCES `categories_recipes` (`id`);
--
-- Contraintes pour la table `recipes_ingredients`
--
ALTER TABLE `recipes_ingredients`
ADD CONSTRAINT `FK_761206B03EC4DCE` FOREIGN KEY (`ingredients_id`) REFERENCES `ingredients` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_761206B0FDF2B1FA` FOREIGN KEY (`recipes_id`) REFERENCES `recipes` (`id`) ON DELETE CASCADE;
--
-- Contraintes pour la table `review`
--
ALTER TABLE `review`
ADD CONSTRAINT `FK_794381C6A4F84F6E` FOREIGN KEY (`destinataire_id`) REFERENCES `user` (`id`),
ADD CONSTRAINT `FK_794381C6A76ED395` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
--
-- Contraintes pour la table `user`
--
ALTER TABLE `user`
ADD CONSTRAINT `FK_8D93D64938C751C4` FOREIGN KEY (`roles_id`) REFERENCES `roles` (`id`),
ADD CONSTRAINT `FK_8D93D6495FB14BA7` FOREIGN KEY (`level_id`) REFERENCES `level` (`id`);
--
-- Contraintes pour la table `user_challenge`
--
ALTER TABLE `user_challenge`
ADD CONSTRAINT `FK_D7E904B598A21AC6` FOREIGN KEY (`challenge_id`) REFERENCES `challenge` (`id`),
ADD CONSTRAINT `FK_D7E904B5A76ED395` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
f911d86024303e9eaeb407be2b9dfb28387e5317 | SQL | annPud/kaoqin | /Scripts/Script.sql | UTF-8 | 796 | 3.515625 | 4 | [] | no_license | SELECT
*
FROM
kaoqin
WHERE
ename = '朱伟亮'
AND EXTRACT(
YEAR_MONTH
FROM
'2015-8-9'
) = EXTRACT(
YEAR_MONTH
FROM
clock
)
ORDER BY
clock ASC;
SELECT
*
FROM
kaoqin
WHERE
ename = '朱伟亮'
AND clock BETWEEN '2015/08/01' AND '2015/09/01'
ORDER BY
clock ASC;
SELECT
dep,
ename,
ckno
FROM
kaoqin
WHERE
clock BETWEEN '2015/08/01' AND '2015/09/01'
GROUP BY
ename,
ckno
ORDER BY
ckno ASC;
SELECT
COUNT(g.ename)
FROM
(
SELECT
ename
FROM
kaoqin
WHERE
clock BETWEEN '2015/08/01' AND '2015/09/01'
GROUP BY
ename,
ckno
) g; | true |
d16cab173c65a1133feacb8645721f1b70fedeb0 | SQL | cchantep/codex | /sql/cars/queries.sql | UTF-8 | 757 | 3.265625 | 3 | [] | no_license | -- vehicule_tbl --
SELECT immat, modele, annee_circu
FROM vehicule_tbl
WHERE no_secu='1710549123456';
SELECT immat, modele, annee_circu
FROM vehicule_tbl
WHERE no_secu='2740749345678';
SELECT vehicule_tbl.immat, vehicule_tbl.modele, vehicule_tbl.annee_circu, vehicule_tbl.no_secu,
client_tbl.nom, client_tbl.prenom
FROM vehicule_tbl
NATURAL JOIN client_tbl;
SELECT vehicule_tbl.annee_circu
FROM vehicule_tbl
NATURAL JOIN client_tbl
WHERE client_tbl.nom='Rudoux';
-- client_tbl --
SELECT no_secu
FROM client_tbl
WHERE nom='Rudoux';
-- sinistre_tbl --
SELECT no_secu
FROM sinistre_tbl
WHERE montant IS NULL;
SELECT client_tbl.nom, client_tbl.prenom
FROM sinistre_tbl
NATURAL JOIN client_tbl
WHERE sinistre_tbl.no_sinistre BETWEEN 200110 AND 200201; | true |
a9e24bf3d9aaa711c8e68808e17f1b8486f91a04 | SQL | zplante/University-Assignments | /CS182/Lab2/query5.sql | UTF-8 | 238 | 3.578125 | 4 | [] | no_license | SELECT c.customerID, c.address, sa.paidPrice * sa.quantity AS theRevenue, sa.dayDate
FROM Customers AS c, Sales AS sa
WHERE c.status = 'H'
AND c.address IS NOT NULL
AND sa.paidPrice * sa.quantity >=200
AND c.customerID = sa.customerID | true |
5b69baafb02edd1e1419fdf44ca4276686567a9b | SQL | nedjoooo/Databases | /04.SQL Introduction/10.All-infotmation-employees-with-job-title-Sales-Representative.sql | UTF-8 | 591 | 4 | 4 | [] | no_license | SELECT e.EmployeeID AS [Employee ID],
e.FirstName + ' ' + e.MiddleName + ' ' + e.LastName AS [Employee Name],
e.JobTitle AS [Job Title],
d.Name AS [Department Name],
m.FirstName + ' ' + m.LastName as [Manager Name],
e.HireDate as [Hire Date],
e.Salary as Salary,
a.AddressText as Adrress,
t.Name as Town
FROM Employees e
JOIN Departments d
ON d.DepartmentID = e.DepartmentID
JOIN Employees m
ON e.ManagerID = m.EmployeeID
JOIN Addresses a
ON a.AddressID = e.AddressID
JOIN Towns t
ON a.TownID = t.TownID
WHERE e.JobTitle = 'Sales Representative' | true |
e2d78d5d1521e1bf94207ee3be0f623224b9717c | SQL | jdwalbur/Passive-Coin-Sorter | /create.sql | UTF-8 | 185 | 2.671875 | 3 | [] | no_license | CREATE TABLE transactions (
id int(10) NOT NULL AUTO_INCREMENT,
timestamp varchar(50) NOT NULL,
amount float NOT NULL,
current_bal float NOT NULL,
PRIMARY KEY(id)
); | true |
c08b0e23cd3c1e41fabb3e6c3a2b3d69ba04ebc2 | SQL | youngquarshie/Student-Clearance-System | /db/clearance.sql | UTF-8 | 13,626 | 2.796875 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 16, 2018 at 06:13 AM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 7.0.9
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: `clearance`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`admin_id` int(10) NOT NULL,
`admin_username` varchar(25) DEFAULT NULL,
`admin_password` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`admin_id`, `admin_username`, `admin_password`) VALUES
(1, 'admin', 'admin');
-- --------------------------------------------------------
--
-- Table structure for table `clearance`
--
CREATE TABLE `clearance` (
`clearance_id` int(10) NOT NULL,
`id` int(10) DEFAULT NULL,
`is_library_approved` int(1) DEFAULT '0',
`is_estate_approved` int(1) DEFAULT '0',
`is_src_approved` int(1) DEFAULT '0',
`is_hod_approved` int(1) DEFAULT '0',
`is_dean_approved` int(1) DEFAULT '0',
`is_sports_approved` int(1) DEFAULT '0',
`is_account_approved` int(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `clearance`
--
INSERT INTO `clearance` (`clearance_id`, `id`, `is_library_approved`, `is_estate_approved`, `is_src_approved`, `is_hod_approved`, `is_dean_approved`, `is_sports_approved`, `is_account_approved`) VALUES
(113, 79, 0, 1, 1, 0, 0, NULL, 1),
(114, 79, 0, 0, 1, 0, 0, NULL, 1),
(115, 71, 0, 0, 1, 0, 0, 1, 1),
(116, 71, 0, 0, 1, 0, 0, 0, 1),
(117, 79, 0, 0, 1, 0, 0, 0, 1),
(118, 71, 0, 0, 1, 0, 0, 0, 1),
(119, 75, 0, 0, NULL, 0, 0, 0, 1),
(120, 75, 0, 0, NULL, 0, 0, 0, 1),
(121, 75, 0, 0, NULL, 0, 0, 0, 1),
(122, 80, 0, 0, NULL, 0, 0, 0, 0),
(123, 73, 0, 0, 1, 0, 0, 0, 1),
(124, 71, 0, 0, 0, 0, 0, 0, 1),
(125, 75, 0, 0, 0, 0, 0, 0, 1),
(126, 79, 0, 0, 0, 0, 0, 0, 1),
(127, 73, 0, 0, 0, 0, 0, 0, 1);
-- --------------------------------------------------------
--
-- Table structure for table `department`
--
CREATE TABLE `department` (
`department_id` int(10) NOT NULL,
`department_name` varchar(70) DEFAULT NULL,
`faculty_id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `department`
--
INSERT INTO `department` (`department_id`, `department_name`, `faculty_id`) VALUES
(20, 'HND Computer Science', 6),
(21, 'HND Computer Networking', 6),
(22, 'HND Hospitality', 6),
(23, 'HND Statistics', 6),
(24, 'HND Fashion Design', 6),
(25, 'HND Accountancy', 7),
(26, 'HND Marketing', 7),
(27, 'HND Purchasing and Supply', 7),
(28, 'HND Secretaryship and Management Studies', 7);
-- --------------------------------------------------------
--
-- Table structure for table `designee`
--
CREATE TABLE `designee` (
`designee_id` int(10) NOT NULL,
`designee_name` varchar(25) DEFAULT NULL,
`username` varchar(25) DEFAULT NULL,
`password` varchar(25) DEFAULT NULL,
`email` varchar(25) DEFAULT NULL,
`user_type` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `designee`
--
INSERT INTO `designee` (`designee_id`, `designee_name`, `username`, `password`, `email`, `user_type`) VALUES
(3, 'Librarian', 'library', 'lib2017', 'youngquarshie@gmail.com', 'librarian'),
(4, 'SRC President', 'src', 'src2017', NULL, 'src'),
(5, 'Estate Department', 'estate', 'estate2017', NULL, 'estate'),
(6, 'Dean of Students', 'dean', 'dean2017', NULL, 'dean'),
(7, 'Accounts', 'account', 'account2017', 'pemzymony@gmail.com', 'account'),
(8, 'Head of Department', 'hod', 'hod2017', NULL, 'hod'),
(9, 'Sports Master', 'sports', 'sports2017', NULL, 'sports');
-- --------------------------------------------------------
--
-- Table structure for table `faculty`
--
CREATE TABLE `faculty` (
`faculty_id` int(10) NOT NULL,
`faculty_name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `faculty`
--
INSERT INTO `faculty` (`faculty_id`, `faculty_name`) VALUES
(6, 'Faculty of Applied Science and Technology'),
(7, 'Faculty of Business and Management Studies'),
(8, 'Faculty of Engineering'),
(9, 'Faculty of Built and Natural Environment'),
(10, 'Faculty of Health and Allied Sciences');
-- --------------------------------------------------------
--
-- Table structure for table `student`
--
CREATE TABLE `student` (
`id` int(10) NOT NULL,
`index_no` varchar(15) DEFAULT NULL,
`first_name` varchar(25) DEFAULT NULL,
`last_name` varchar(25) DEFAULT NULL,
`password` varchar(25) DEFAULT NULL,
`email` varchar(25) DEFAULT NULL,
`status` varchar(10) NOT NULL DEFAULT '0',
`src_request` int(10) DEFAULT '0',
`dean_request` int(10) DEFAULT '0',
`hod_request` int(10) DEFAULT '0',
`sports_request` int(10) DEFAULT '0',
`library_request` int(10) DEFAULT '0',
`account_request` int(10) DEFAULT '0',
`estate_request` int(10) DEFAULT '0',
`department_id` int(10) DEFAULT NULL,
`faculty_id` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `student`
--
INSERT INTO `student` (`id`, `index_no`, `first_name`, `last_name`, `password`, `email`, `status`, `src_request`, `dean_request`, `hod_request`, `sports_request`, `library_request`, `account_request`, `estate_request`, `department_id`, `faculty_id`) VALUES
(71, '04/2015/0808D', 'AMPONSAH', 'OBED', '1234', 'amponsah_obed@gmail.com', '0', 1, 1, 1, 1, 1, 1, 1, 20, 6),
(72, '04/2015/0809D', 'MICHAEL', 'OSEI ANANG', '1234', 'michael_osei@gmail.com', '0', 0, 0, 0, 0, 0, 0, 0, 20, 6),
(73, '04/2015/0701D', 'GILBERT', 'ASMAH', '1234', 'gilbert_asmah@gmail.com', '0', 1, 1, 1, 1, 1, 1, 1, 27, 7),
(74, '04/2014/0702D', 'EWURAMA', 'AMPOMAAH', '1234', 'ewura_ampomah@gmail.com', '0', 1, 1, 0, 0, 1, 1, 1, 27, 7),
(75, '04/2015/0801D', 'NII', 'ARMAH', '1234', 'braniiblack@gmail.com', '0', 1, 1, 1, 1, 1, 1, 1, 20, 6),
(76, '04/2015/1297D', 'EDITH', 'KLU SEWOR', '1234', 'edithklusewor@gmail.com', '0', 0, 0, 0, 0, 0, 0, 0, 26, 7),
(77, '04/2015/1293D', 'SALOMEY', 'SESU GAD', '1234', 'salomey_sesu@gmail.com', '0', 1, 1, 1, 1, 1, 1, 1, 26, 7),
(78, '04/2015/0835D', 'RICHMOND', 'SAKYI TABI', '1234', 'richmond_tabi@gmail.com', '0', 0, 0, 0, 0, 0, 0, 0, 20, 6),
(79, '04/2015/0832D', 'ISAAC', 'QUARSHIE', '1234', 'pemzymony@gmail.com', '0', 1, 1, 1, 1, 1, 1, 1, 20, 6),
(80, '04/2015/0802D', 'STEVEN', 'MANFO', '1234', 'pneumalogoss@gmail.com', '0', 1, 0, 0, 1, 1, 0, 0, 20, 6);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_account`
--
CREATE TABLE `tbl_account` (
`account_id` int(10) NOT NULL,
`student_id` int(10) NOT NULL,
`first_year` float DEFAULT NULL,
`second_year` float DEFAULT NULL,
`third_year` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_estate`
--
CREATE TABLE `tbl_estate` (
`estate_id` int(10) NOT NULL,
`student_id` int(10) NOT NULL,
`type_of_damage` varchar(25) DEFAULT NULL,
`date_of_action` date DEFAULT NULL,
`payment` float DEFAULT NULL,
`payment_date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_library`
--
CREATE TABLE `tbl_library` (
`library_id` int(10) NOT NULL,
`student_id` int(10) NOT NULL,
`book_title` varchar(50) NOT NULL,
`date_of_return` varchar(255) DEFAULT NULL,
`date_of_issue` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_library`
--
INSERT INTO `tbl_library` (`library_id`, `student_id`, `book_title`, `date_of_return`, `date_of_issue`) VALUES
(1, 75, 'Grief Child', '', '2018-05-07');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_sports`
--
CREATE TABLE `tbl_sports` (
`sports_id` int(10) NOT NULL,
`student_id` int(10) NOT NULL,
`item` varchar(25) NOT NULL,
`payment` int(11) DEFAULT NULL,
`date_of_issue` date DEFAULT NULL,
`date_of_return` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_sports`
--
INSERT INTO `tbl_sports` (`sports_id`, `student_id`, `item`, `payment`, `date_of_issue`, `date_of_return`) VALUES
(1, 75, 'Football', NULL, '2018-05-01', NULL),
(2, 79, 'Jersey', NULL, '2018-05-02', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_src`
--
CREATE TABLE `tbl_src` (
`src_id` int(10) NOT NULL,
`student_id` int(10) NOT NULL,
`amount` varchar(25) NOT NULL,
`bal` varchar(25) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_src`
--
INSERT INTO `tbl_src` (`src_id`, `student_id`, `amount`, `bal`) VALUES
(1, 75, '100', NULL),
(2, 80, '100', NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`admin_id`);
--
-- Indexes for table `clearance`
--
ALTER TABLE `clearance`
ADD PRIMARY KEY (`clearance_id`),
ADD KEY `id` (`id`);
--
-- Indexes for table `department`
--
ALTER TABLE `department`
ADD PRIMARY KEY (`department_id`),
ADD KEY `faculty_id` (`faculty_id`);
--
-- Indexes for table `designee`
--
ALTER TABLE `designee`
ADD PRIMARY KEY (`designee_id`);
--
-- Indexes for table `faculty`
--
ALTER TABLE `faculty`
ADD PRIMARY KEY (`faculty_id`);
--
-- Indexes for table `student`
--
ALTER TABLE `student`
ADD PRIMARY KEY (`id`),
ADD KEY `department_id` (`department_id`),
ADD KEY `faculty_id` (`faculty_id`);
--
-- Indexes for table `tbl_account`
--
ALTER TABLE `tbl_account`
ADD PRIMARY KEY (`account_id`),
ADD KEY `student_id` (`student_id`);
--
-- Indexes for table `tbl_estate`
--
ALTER TABLE `tbl_estate`
ADD PRIMARY KEY (`estate_id`),
ADD KEY `student id` (`student_id`);
--
-- Indexes for table `tbl_library`
--
ALTER TABLE `tbl_library`
ADD PRIMARY KEY (`library_id`),
ADD KEY `student_id` (`student_id`);
--
-- Indexes for table `tbl_sports`
--
ALTER TABLE `tbl_sports`
ADD PRIMARY KEY (`sports_id`),
ADD KEY `student_id` (`student_id`);
--
-- Indexes for table `tbl_src`
--
ALTER TABLE `tbl_src`
ADD PRIMARY KEY (`src_id`),
ADD KEY `student_id` (`student_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `admin_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `clearance`
--
ALTER TABLE `clearance`
MODIFY `clearance_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=128;
--
-- AUTO_INCREMENT for table `department`
--
ALTER TABLE `department`
MODIFY `department_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
--
-- AUTO_INCREMENT for table `designee`
--
ALTER TABLE `designee`
MODIFY `designee_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `faculty`
--
ALTER TABLE `faculty`
MODIFY `faculty_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `student`
--
ALTER TABLE `student`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=81;
--
-- AUTO_INCREMENT for table `tbl_account`
--
ALTER TABLE `tbl_account`
MODIFY `account_id` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tbl_estate`
--
ALTER TABLE `tbl_estate`
MODIFY `estate_id` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tbl_library`
--
ALTER TABLE `tbl_library`
MODIFY `library_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tbl_sports`
--
ALTER TABLE `tbl_sports`
MODIFY `sports_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tbl_src`
--
ALTER TABLE `tbl_src`
MODIFY `src_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `clearance`
--
ALTER TABLE `clearance`
ADD CONSTRAINT `clearance_ibfk_1` FOREIGN KEY (`id`) REFERENCES `student` (`id`);
--
-- Constraints for table `department`
--
ALTER TABLE `department`
ADD CONSTRAINT `department_ibfk_1` FOREIGN KEY (`faculty_id`) REFERENCES `faculty` (`faculty_id`);
--
-- Constraints for table `student`
--
ALTER TABLE `student`
ADD CONSTRAINT `student_ibfk_1` FOREIGN KEY (`department_id`) REFERENCES `department` (`department_id`),
ADD CONSTRAINT `student_ibfk_2` FOREIGN KEY (`faculty_id`) REFERENCES `faculty` (`faculty_id`);
--
-- Constraints for table `tbl_account`
--
ALTER TABLE `tbl_account`
ADD CONSTRAINT `tbl_account_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`);
--
-- Constraints for table `tbl_estate`
--
ALTER TABLE `tbl_estate`
ADD CONSTRAINT `tbl_estate_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`);
--
-- Constraints for table `tbl_library`
--
ALTER TABLE `tbl_library`
ADD CONSTRAINT `tbl_library_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`);
--
-- Constraints for table `tbl_sports`
--
ALTER TABLE `tbl_sports`
ADD CONSTRAINT `tbl_sports_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`);
--
-- Constraints for table `tbl_src`
--
ALTER TABLE `tbl_src`
ADD CONSTRAINT `tbl_src_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
eb8e9f9574ccfad741e9563ba5c002a3299e9f0d | SQL | jd-webb/draft-measures | /pages/cql/in-progress/fhir401/NCQA_Common-5.2.000.cql | UTF-8 | 6,220 | 3.53125 | 4 | [
"MIT"
] | permissive | library NCQA_Common version '5.2.000'
using QDM version '5.5'
codesystem "SOP": 'urn:oid:2.16.840.1.113883.3.221.5'
valueset "Hospice Encounter": 'urn:oid:2.16.840.1.113883.3.464.1004.1761'
valueset "Hospice Intervention": 'urn:oid:2.16.840.1.113883.3.464.1004.1762'
code "MEDICAID": '2' from "SOP" display 'MEDICAID'
code "MEDICARE": '1' from "SOP" display 'MEDICARE'
code "PRIVATE HEALTH INSURANCE": '5' from "SOP" display 'PRIVATE HEALTH INSURANCE'
parameter "Measurement Period" Interval<DateTime>
parameter "ProductLine" String
context Patient
define "Commercial Product":
'commercial'
define "First Predecessor Year":
Interval[start of "Measurement Period" - 1 year, start of "Measurement Period" )
define "Is Commercial":
exists ( ["Patient Characteristic Payer": "PRIVATE HEALTH INSURANCE"] )
define "Is Medicaid":
exists ( ["Patient Characteristic Payer": "MEDICAID"] )
define "Is Medicare":
exists ( ["Patient Characteristic Payer": "MEDICARE"] )
define "Medicaid Product":
'medicaid'
define "Medicare Product":
'medicare'
define "Participation":
["Participation": "PRIVATE HEALTH INSURANCE"]
union ["Participation": "MEDICARE"]
union ["Participation": "MEDICAID"]
define "Hospice Intervention or Encounter":
( ["Intervention, Performed": "Hospice Intervention"] Hospice
where Hospice.relevantPeriod overlaps "Measurement Period"
)
union ( ["Encounter, Performed": "Hospice Encounter"] HospiceEncounter
where HospiceEncounter.relevantPeriod overlaps "Measurement Period"
)
define function "Participation In Period"(ParticipationPeriod Interval<DateTime> ):
collapse ( Participation P
let I: P.participationPeriod
intersect ParticipationPeriod
where P.participationPeriod overlaps ParticipationPeriod
return all Interval[ToDate(start of I), predecessor of ( ToDate(
end of I
)+ 1 day
)]
)
define function "Is Enrolled On Date"(ProductLine String, IndexDate DateTime ):
exists ( ( case ProductLine
when "Commercial Product" then ["Participation": "PRIVATE HEALTH INSURANCE"]
when "Medicare Product" then ["Participation": "MEDICARE"]
when "Medicaid Product" then ["Participation": "MEDICAID"]
else null
end ) P
where IndexDate during P.participationPeriod
)
define function "MemberAgeInYearsAt"(date Date ):
years between ToDate(Patient.birthDatetime)and date
define function "Enrollment Periods"(ParticipationPeriod Interval<DateTime> ):
( { 3 years, 2 years, 1 year } ) Year
where
end of ParticipationPeriod - ( Year - 1 year ) after start of ParticipationPeriod
return Interval[Max({ successor of(
end of ParticipationPeriod - Year
), start of ParticipationPeriod }
),
end of ParticipationPeriod - ( Year - 1 year )]
define function "Is Continuously Enrolled In Period"(EnrollmentPeriod Interval<DateTime>, AllowedGapDays Integer ):
"Gap Days In Period"(EnrollmentPeriod, "Participation In Period"(EnrollmentPeriod))<= AllowedGapDays
define function "Is Enrolled"(ProductLine String, IndexDate DateTime, ParticipationPeriod Interval<DateTime>, AllowedGapDays Integer ):
( ProductLine is null
or "Is Enrolled On Date"(ProductLine, IndexDate)
)
and AllTrue(("Enrollment Periods"(ParticipationPeriod))EnrollmentPeriod
return "Is Continuously Enrolled In Period"(EnrollmentPeriod, if duration in months of EnrollmentPeriod >= 6 then AllowedGapDays
else 0
)
)
define function "Product Line"(ProductLine String, IndexDate DateTime, ParticipationPeriod Interval<DateTime> ):
ToProductLine(Last(("Participation" P
where P.participationPeriod overlaps Interval[Coalesce(IndexDate, start of ParticipationPeriod), Coalesce(IndexDate,
end of ParticipationPeriod
)]
sort by
end of participationPeriod)E
where ProductLine is null
or E.code ~ ToProductCode(ProductLine)
).code
)
define function "Gap Days In Period"(ParticipationPeriod Interval<DateTime>, Periods List<Interval<DateTime>> ):
case Count(Periods)
when 1 then if Periods[0]starts day of ParticipationPeriod then difference in days between
end of Periods[0]and
end of ParticipationPeriod
else if Periods[0]ends day of ParticipationPeriod then difference in days between start of ParticipationPeriod and start of Periods[0]
else maximum Integer
when 2 then if Periods[0]starts day of ParticipationPeriod
and Periods[1]ends day of ParticipationPeriod then difference in days between
end of Periods[0]and start of Periods[1]
else maximum Integer
else maximum Integer
end
define function "ToProductCode"(ProductLine String ):
case ProductLine
when "Commercial Product" then "PRIVATE HEALTH INSURANCE"
when "Medicare Product" then "MEDICARE"
when "Medicaid Product" then "MEDICAID"
else null
end
define function "ToProductLine"(ProductCode Code ):
case
when ProductCode ~ "PRIVATE HEALTH INSURANCE" then "Commercial Product"
when ProductCode ~ "MEDICARE" then "Medicare Product"
when ProductCode ~ "MEDICAID" then "Medicaid Product"
else null
end
define function "CalendarAgeInDaysAt"(BirthDateTime DateTime, AsOf DateTime ):
days between ToDate(BirthDateTime)and ToDate(AsOf)
define function "CalendarAgeInDays"(BirthDateTime DateTime ):
CalendarAgeInDaysAt(BirthDateTime, Today())
define function "CalendarAgeInMonthsAt"(BirthDateTime DateTime, AsOf DateTime ):
months between ToDate(BirthDateTime)and ToDate(AsOf)
define function "CalendarAgeInMonths"(BirthDateTime DateTime ):
CalendarAgeInMonthsAt(BirthDateTime, Today())
define function "LengthInDays"(Value Interval<DateTime> ):
difference in days between start of Value and
end of Value
define function "CalendarAgeInYearsAt"(BirthDateTime DateTime, AsOf DateTime ):
years between ToDate(BirthDateTime)and ToDate(AsOf)
define function "CalendarAgeInYears"(BirthDateTime DateTime ):
CalendarAgeInYearsAt(BirthDateTime, Today())
define function "ToDate"(Value DateTime ):
DateTime(year from Value, month from Value, day from Value, 0, 0, 0, 0, timezoneoffset from Value)
| true |
15a9b533f289e28ee2b7a56cd9dd189ff6643bfb | SQL | HoangNhatVo/TutorWeb | /Database/account_proc.sql | UTF-8 | 22,445 | 3.296875 | 3 | [] | no_license | DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAccountByUsername(in us varchar(50))
BEGIN
select * from account where username COLLATE utf8mb4_unicode_ci = us;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAccountByEmail(in e varchar(100))
BEGIN
select * from account where email COLLATE utf8mb4_unicode_ci = e;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAccountByPhone(in phone varchar(15))
BEGIN
select * from account where sdt COLLATE utf8mb4_unicode_ci = phone;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddStudent(in username varchar(50), in password varchar(100), in hoten varchar(100),
in email varchar(100), in ngaysinh date, in gioitinh varchar(5), in diachi varchar(255),
in thanhpho varchar(100), in sdt varchar(15),in chuoixacthuc varchar(255))
BEGIN
insert into account values (null, username,password, hoten, email, ngaysinh, gioitinh, 1, diachi,thanhpho, sdt, 'active', null, '','', 1, 0, false, chuoixacthuc);
insert into taikhoan values(null, LAST_INSERT_ID(),'',0);
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddTeacher(in username varchar(50), in password varchar(100), in hoten varchar(100),
in email varchar(100), in ngaysinh date, in gioitinh varchar(5), in diachi varchar(255),
in thanhpho varchar(100), in sdt varchar(15), in baigioithieu text, in monhoc varchar(255), in chuyennganh int(11), in tienday int(11),in chuoixacthuc varchar(255))
BEGIN
insert into account values (null, username,password, hoten, email, ngaysinh, gioitinh, 2, diachi, thanhpho, sdt, 'active', null, baigioithieu,monhoc, chuyennganh, tienday, false, chuoixacthuc);
insert into taikhoan values(null, LAST_INSERT_ID(),'',0);
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddAdmin(in username varchar(50), in password varchar(100), in hoten varchar(100),
in email varchar(100), in ngaysinh date, in gioitinh varchar(5), in diachi varchar(255),
in thanhpho varchar(100), in sdt varchar(15))
BEGIN
insert into account values (null, username,password, hoten, email, ngaysinh, gioitinh, 3, diachi,thanhpho, sdt, 'active', null, '','', 1, 0, true,'');
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE Get_ChuyenNganh_ByID(in i int(11))
BEGIN
select * from chuyennganh where id=i;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAll_ChuyenNganh()
BEGIN
select * from chuyennganh order by id asc;
END;$$
DELIMITER ;
call GetAll_ChuyenNganh();
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAccountVerify(in verify varchar(255))
BEGIN
select * from account where chuoixacthuc = verify;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE UpdateAccountVerify(in i int(11))
BEGIN
update account set xacthuc = true where id = i;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE Add_Loaigiaodich(in ten varchar(50))
BEGIN
insert into loaigiaodich values(null,ten);
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE UpdateInfoAccount(in i int(11), in ht varchar(100), in dc varchar(100) )
BEGIN
update account set hoten = ht, diachi = dc where id = i;
END;$$
DELIMITER ;
call UpdateInfoAccount(36, 'Nguyễn Nhật','Huế');
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE Update_baigioithieu_Account(in i int(11), in bgt text )
BEGIN
update account set baigioithieu = bgt where id = i;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE UpdateAvatar(in i int(11), in avt varchar(255) )
BEGIN
update account set avatar = avt where id = i;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAccountByID(in i int(11))
BEGIN
select * from account where id = i and xacthuc = true;
END;$$
DELIMITER ;
call GetAccountByID(9);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllAccount()
BEGIN
select * from account where xacthuc = true;
END;$$
DELIMITER ;
call GetAllAccount();
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllAccount2(in _offset int(11),in _Limit int(11))
BEGIN
select * from account where xacthuc = true limit _offset, _Limit;
END;$$
DELIMITER ;
call GetAllAccount2(4,5);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllTeacher()
BEGIN
select * from account where vaitro = 2 and xacthuc = true;
END;$$
DELIMITER ;
call GetAllTeacher();
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllTeacher2(in _offset int(11),in _Limit int(11))
BEGIN
select * from account where vaitro = 2 and xacthuc = true limit _offset, _Limit;
END;$$
DELIMITER ;
call GetAllTeacher2();
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllAdmin()
BEGIN
select * from account where vaitro = 3 and xacthuc = true;
END;$$
DELIMITER ;
call GetAllAdmin();
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddTag (in TagName varchar(50) )
BEGIN
declare count1 int;
declare TagNameNew varchar(50);
if( substring(TagName,1,1)='#')
then
set TagNameNew = TagName;
end if;
if( substring(TagName,1,1)!='#')
then
set TagNameNew = (select concat('#',TagName));
end if;
set count1 =( select count(*) from tag where tentag = TagNameNew);
if( count1=0 )
then
insert into tag values( null,TagNameNew);
select id from tag where tentag = TagNameNew;
end if;
if( count1>0 )
then
select id from tag where tentag = TagNameNew;
end if;
END;$$
DELIMITER ;
call AddTag('abc');
select * from tag;
#----------------- add tag account
DELIMITER $$
USE `sql12314047`$$
create procedure AddTagAccount(in idtag int(11), in idaccount int(11))
begin
if exists( select * from tag_account where id_tag=idtag and id_account=idaccount)
then
select 0 as temp;
else
insert into tag_account values (idtag,idaccount);
select 1 as temp;
end if;
end;$$
DELIMITER ;
call AddTagAccount(2,33);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetTagByID(in i int(11))
BEGIN
select * from tag where id =i;
END;$$
DELIMITER ;
call GetTagByID(2);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE DeleteTag(in i int(11))
BEGIN
delete from tag_account where id_tag=i;
delete from tag where id=i;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllTag()
BEGIN
select * from tag order by id asc;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllTagByAccID(in accID int(11))
BEGIN
select ta.id_tag as IDTag, ta.id_account as IDAccount, t.tentag as NameTag
from tag_account ta, tag t
where ta.id_account = accID and t.id = ta.id_tag
order by ta.id_tag asc;
END;$$
DELIMITER ;
call GetAllTagByAccID(38);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE UpdateTagName(in i int(11), in TagNameUpdate varchar(50))
BEGIN
declare TagNameNew varchar(50);
declare count1 int;
if( substring(TagNameUpdate,1,1)!='#')
then
set TagNameNew =(select concat('#',TagNameUpdate));
set count1 = (select count(*) from tag where tentag = TagNameNew);
if(count1 >0)
then
select 0 as temp;
end if;
if(count1 =0)
then
update tag set tentag=TagNameNew where id=i;
select 1 as temp;
end if;
end if;
if(substring(TagNameUpdate,1,1)='#')
then
set count1 = (select count(*) from tag where tentag = TagNameUpdate);
if(count1 >0)
then
select 0 as temp;
end if;
if(count1 =0)
then
update tag set tentag=TagNameUpdate where id=i;
select 1 as temp;
end if;
end if;
END;$$
DELIMITER ;
call UpdateTagName(1,'#hahahhahahahahhahahhahahahhaa');
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE UpdatePasswordAccountByID(in ID int(11), in newPass varchar(100))
BEGIN
update account a
set a.password = newPass
where a.id = ID;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE ResetPassword(in verify varchar(255), in newPass varchar(100))
BEGIN
update account a
set a.password = newPass
where a.chuoixacthuc = verify;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE ChangeStatusAccount(in i int(11), in statusnew varchar(20))
BEGIN
update account a
set a.tinhtrang = statusnew
where a.id = i;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllContract()
BEGIN
select * from hopdong;
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddContract(in ten varchar(255), in nguoi_day int(11), in nguoi_hoc int(11), in tgianky date)
BEGIN
insert into hopdong(id, tenhopdong, nguoiday, nguoihoc, thoigianky, trangthaihopdong)
values(null, ten, nguoi_day, nguoi_hoc, tgianky, 'Chưa duyệt');
SELECT LAST_INSERT_ID() as id;
#SELECT * FROM hopdong WHERE id = SCOPE_IDENTITY();
END;$$
DELIMITER ;
#call AddContract('Hợp đồng B',38,37,'2019-12-12');
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE UpdateStatusContract(in i int1(11), in status varchar(50))
BEGIN
update hopdong set trangthaihopdong = status where id =i;
END;$$
DELIMITER ;
#call UpdateStatusContract(1);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE Add_DieuKhoanHopDong(in idHD int(11), in noi_dung text, in ben_thuc_hien varchar(100))
BEGIN
insert into dieukhoanhopdong values(null, idHD, noi_dung, ben_thuc_hien);
END;$$
DELIMITER ;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllContractByTeacherID(in teacherID int(11))
BEGIN
select hd.id as IDContract, hd.tenhopdong as NameContract, hd.nguoiday as IDTeacher, hd.nguoihoc as IDStudent, hd.thoigianky as TimeAsigned, hd.trangthaihopdong as StatusContract,
nh.avatar as AvatarStudent, nh.hoten as NameStudent,
nd.avatar as AvatarTeacher, nd.hoten as NameTeacher
from hopdong hd, account nd, account nh
where hd.nguoiday = teacherID and hd.nguoihoc = nh.id and nd.id = teacherID;
END;$$
DELIMITER ;
call GetAllContractByTeacherID(37);
####------------------ CŨ - xài proc dưới page này ----------#
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetContractByID(in i int(11))
BEGIN
select distinct hd.id as IDContract, hd.tenhopdong as NameContract, hd.nguoiday as IDTeacher, hd.nguoihoc as IDStudent, hd.thoigianky as TimeAsigned, hd.trangthaihopdong as StatusContract,
hd.sodiem as ScoreContract, hd.danhgia as CMTContract,
nh.avatar as AvatarStudent, nh.hoten as NameStudent, nh.email as EmailStudent, nh.sdt as PhoneStudent,
nd.avatar as AvatarTeacher, nd.hoten as NameTeacher, nd.email as EmailTeacher, nd.sdt as PhoneTeacher,
c.isRead as IDReadChat
from hopdong hd, account nd, account nh, chat c join hopdong h on c.idhopdong = i and h.id = i
where hd.id = i and hd.nguoiday = nd.id and hd.nguoihoc = nh.id;
END;$$
DELIMITER ;
call GetContractByID(2);
####------------------ --------------------------------------- ----------#
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE Get_DieuKhoanHopDong_ByIDContract(in contractID int(11))
BEGIN
select * from dieukhoanhopdong where sohopdong = contractID;
END;$$
DELIMITER ;
call Get_DieuKhoanHopDong_ByIDContract(11);
#-----------------------------------------------------------#
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE Add_TaiKhoanNganHang(in chu_tai_khoan int(11), in ten_ngan_hang varchar(255))
BEGIN
insert into taikhoan values(null, chu_tai_khoan, ten_ngan_hang, 0);
END;$$
DELIMITER ;
call Add_TaiKhoanNganHang(37,'Vietcombank');
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE NapTienVaoTaiKhoan(in IDTaiKhoanNganHang int(11), in nguoi_nap int(11), in so_tien int(11))
BEGIN
insert into giaodich values(null, IDTaiKhoanNganHang, nguoi_nap, nguoi_nap, 1, so_tien, 'Nộp tiền vào tài khoản');
update taikhoan t
set t.sotienconlai = t.sotienconlai + so_tien
where t.id = IDTaiKhoanNganHang;
END;$$
DELIMITER ;
call NapTienVaoTaiKhoan(1,37,100000);
#-------------------------
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllContract()
BEGIN
select hd.id as IDContract, hd.tenhopdong as NameContract, hd.nguoiday as IDTeacher,
hd.nguoihoc as IDStudent, hd.thoigianky as TimeAsigned, hd.trangthaihopdong as StatusContract,
nd.hoten as NameTeacher, nh.hoten as NameStudent
from hopdong hd, account nd, account nh
where hd.nguoiday = nd.id and hd.nguoihoc = nh.id;
END;$$
DELIMITER ;
call GetAllContract();
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllContractByStudentID(in studentID int(11))
BEGIN
select hd.id as IDContract, hd.tenhopdong as NameContract, hd.nguoiday as IDTeacher, hd.nguoihoc as IDStudent, hd.thoigianky as TimeAsigned, hd.trangthaihopdong as StatusContract,
nh.avatar as AvatarStudent, nh.hoten as NameStudent,
nd.avatar as AvatarTeacher, nd.hoten as NameTeacher
from hopdong hd, account nd, account nh
where hd.nguoihoc = studentID and hd.nguoiday = nd.id and nh.id = studentID;
END;$$
DELIMITER ;
call GetAllContractByStudentID(9);
#------------------ CHAT-----------------------#
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddChat(in IDnguoigui int(11), in IDnguoinhan int(11), in nd text, in thoi_gian_chat datetime, in idhd int(11))
BEGIN
insert into chat values (null, IDnguoigui, IDnguoinhan, nd, thoi_gian_chat, IDnguoinhan, idhd);
select c.id as ID, c.noidung as NoiDungChat, c.thoigianchat as ThoiGianChat,
c.nguoigui as IDNguoiGui, c.nguoinhan as IDNguoiNhan,
ng.hoten as TenNguoiGui, ng.avatar as AvatarNguoiGui,
nn.hoten as TenNguoiNhan, nn.avatar as AvatarNguoiNhan
from chat c, account ng, account nn
where c.id = LAST_INSERT_ID() and IDnguoigui = ng.id and IDnguoinhan = nn.id;
#----SELECT LAST_INSERT_ID() as id;
END;$$
DELIMITER ;
call AddChat(38,37,'123123','2019-12-22 23:59:59',4);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetChat(in IDnguoi1 int(11), in IDnguoi2 int(11))
BEGIN
select c.id as ID, c.noidung as NoiDungChat, c.thoigianchat as ThoiGianChat,
c.nguoigui as IDNguoiGui, c.nguoinhan as IDNguoiNhan,
ng.hoten as TenNguoiGui, ng.avatar as AvatarNguoiGui,
nn.hoten as TenNguoiNhan, nn.avatar as AvatarNguoiNhan
from chat c, account ng, account nn
where (c.nguoigui = IDnguoi1 and c.nguoinhan = IDnguoi2
or c.nguoigui = IDnguoi2 and c.nguoinhan = IDnguoi1)
and c.nguoigui = ng.id and c.nguoinhan = nn.id;
END;$$
DELIMITER ;
call GetChat(36,38);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetChatByIDContract(in IDContract int(11))
BEGIN
update chat ch set ch.isRead = 0 where ch.idhopdong = IDContract;
select c.id as ID, c.noidung as NoiDungChat, c.thoigianchat as ThoiGianChat,
c.idhopdong as IDHopDong,
c.nguoigui as IDNguoiGui, c.nguoinhan as IDNguoiNhan,
ng.hoten as TenNguoiGui, ng.avatar as AvatarNguoiGui,
nn.hoten as TenNguoiNhan, nn.avatar as AvatarNguoiNhan
from chat c, account ng, account nn
where c.nguoigui = ng.id and c.idhopdong = IDContract and c.nguoinhan = nn.id;
END;$$
DELIMITER ;
call GetChatByIDContract(4);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE UpdateIsReadFieldChatByID(in IDChat int(11))
BEGIN
update chat
set isRead = 0
where id=IDChat;
END;$$
DELIMITER ;
call UpdateIsReadFieldChatByID(12);
#------------------ Đánh giá hợp đồng-----------------------#
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddCmtContractByID(in IDContract int(11), in cmt text)
BEGIN
update hopdong
set danhgia = cmt
where id = IDContract;
END;$$
DELIMITER ;
call AddCmtContractByID(2,'abcbabab');
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddScoreContractByID(in IDContract int(11), in score int(11))
BEGIN
update hopdong
set sodiem = score
where id = IDContract;
END;$$
DELIMITER ;
call AddScoreContractByID(2,5);
#------------------ Khiếu nại hợp đồng-----------------------#
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddKNHD(in ID_nguoi_KN int(11), in ID_HD int(11), in noi_dung text, in thoi_gian_KN datetime)
BEGIN
insert into khieunaihopdong values(null, ID_HD, ID_nguoi_KN, noi_dung,thoi_gian_KN);
END;$$
DELIMITER ;
call AddKNHD(37, 1, 'abc','2019-12-12 12:12:12');
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllKNHD()
BEGIN
select kn.id as IDKNHD, kn.noidung as NoiDungKN, kn.thoigiankhieunai as ThoiGianKN,
hd.id as IDHD, hd.tenhopdong as TenHD,
a.hoten as TenNguoiKN, a.avatar as AvatarNguoiKN, v.ten as VaiTroNguoiKN
from hopdong hd, khieunaihopdong kn, account a, vaitro v
where kn.sohopdong=hd.id and kn.nguoikhieunai = a.id and v.id = a.vaitro;
END;$$
DELIMITER ;
call GetAllKNHD();
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllKNHDByIDHD(in IDHD int(11))
BEGIN
select kn.id as IDKNHD, kn.noidung as NoiDungKN, kn.thoigiankhieunai as ThoiGianKN,
hd.id as IDHD, hd.tenhopdong as TenHD,
a.hoten as TenNguoiKN, a.avatar as AvatarNguoiKN, v.ten as VaiTroNguoiKN
from hopdong hd, khieunaihopdong kn, account a, vaitro v
where kn.sohopdong=IDHD and hd.id = IDHD and kn.nguoikhieunai = a.id and v.id = a.vaitro;
END;$$
DELIMITER ;
call GetAllKNHDByIDHD(4);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetAllCMTOfTeacherByID(in IDTeacher int(11))
BEGIN
select hd.id as IDHopDong, nh.id as IDNguoiDanhGia, nh.hoten as TenNguoiDanhGia, nh.avatar as AvatarNguoiDanhGia,
hd.sodiem as SoSao, hd.danhgia as Comment
from hopdong hd, account nd, account nh
where hd.nguoiday = IDTeacher and hd.nguoihoc = nh.id and nd.id = IDTeacher
and ((hd.danhgia != '' and hd.danhgia is not null)or(hd.sodiem is not null and hd.sodiem>0));
END;$$
DELIMITER ;
call GetAllCMTOfTeacherByID(37);
#---------------------------------- giaodich
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddTransaction(in IDNguoiGui int(11), in IDNguoiNhan int(11), in SoGio int(11),
in Mota varchar(255), in ThoiGianGiaoDich datetime)
BEGIN
declare sotien int;
declare STCL int;
set sotien = (select tiendaymotgio from account where id = IDNguoiNhan);
insert into giaodich values(null, IDNguoiGui, IDNguoiNhan,2,SoGio*sotien, Mota, ThoiGianGiaoDich);
set STCL = (select sotienconlai from taikhoan where chutaikhoan = IDNguoiGui);
update taikhoan
set sotienconlai = STCL - SoGio*sotien
where chutaikhoan = IDNguoiGui;
END;$$
DELIMITER ;
call AddTransaction(37,38,4,'new123','2019-12-12 12:12:12');
select * from giaodich;
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetContractByID(in i int(11))
BEGIN
declare count1 int;
set count1 =(select count(distinct isRead) from chat where idhopdong = i and isRead>0 and isRead is not null);
if( count1=0 )
then
select distinct hd.id as IDContract, hd.tenhopdong as NameContract, hd.nguoiday as IDTeacher, hd.nguoihoc as IDStudent, hd.thoigianky as TimeAsigned, hd.trangthaihopdong as StatusContract,
hd.sodiem as ScoreContract, hd.danhgia as CMTContract,
nh.avatar as AvatarStudent, nh.hoten as NameStudent, nh.email as EmailStudent, nh.sdt as PhoneStudent,
nd.avatar as AvatarTeacher, nd.hoten as NameTeacher, nd.email as EmailTeacher, nd.sdt as PhoneTeacher,
0 as IDReadChat
from hopdong hd, account nd, account nh
where hd.id = i and hd.nguoiday = nd.id and hd.nguoihoc = nh.id;
end if;
if( count1>0)
then
select distinct hd.id as IDContract, hd.tenhopdong as NameContract, hd.nguoiday as IDTeacher, hd.nguoihoc as IDStudent, hd.thoigianky as TimeAsigned, hd.trangthaihopdong as StatusContract,
hd.sodiem as ScoreContract, hd.danhgia as CMTContract,
nh.avatar as AvatarStudent, nh.hoten as NameStudent, nh.email as EmailStudent, nh.sdt as PhoneStudent,
nd.avatar as AvatarTeacher, nd.hoten as NameTeacher, nd.email as EmailTeacher, nd.sdt as PhoneTeacher,
c.isRead as IDReadChat
from hopdong hd, account nd, account nh, chat c
where hd.id = i and hd.nguoiday = nd.id and hd.nguoihoc = nh.id and c.idhopdong = i and c.isRead>0;
end if;
END;$$
DELIMITER ;
call GetContractByID(11);
#------------------- Lọc giáo viên
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE FilterTeacher(in diadiem varchar(255), in tienday int(11), in tentag varchar(50))
BEGIN
declare diadiemNew1 varchar(50);
declare diadiemNew2 varchar(50);
declare tagnew1 varchar(50);
declare tagnew2 varchar(50);
set diadiemNew1 = (select concat('%',diadiem));
set diadiemNew2 = (select concat(diadiemNew1,'%'));
set tagnew1 = (select concat('%',tentag));
set tagnew2 = (select concat(tagnew1,'%'));
if(tienday=0)
then
select distinct a.*
from account a, tag_account ta, tag t
where a.vaitro = 2 and a.id = ta.id_account and ta.id_tag = t.id
and a.diachi like diadiemNew2 and t.tentag like tagnew2;
end if;
if(tienday!=0)
then
select distinct a.*
from account a, tag_account ta, tag t
where a.vaitro = 2 and a.id = ta.id_account and ta.id_tag = t.id
and a.diachi like diadiemNew2 and a.tiendaymotgio = tienday
and t.tentag like tagnew2;
end if;
END;$$
DELIMITER ;
call FilterTeacher('HCM', 200, '2');
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetIsReadByIDContract(in IDContract int(11))
BEGIN
declare count1 int;
set count1 = (select count(distinct isRead) from chat where idhopdong = IDContract and isRead>0 and isRead is not null);
if(count1 = 0)
then
select 0;
end if;
if(count1>0)
then
select distinct c.isRead
from chat c
where c.idhopdong = IDContract and c.isRead>0;
end if;
END;$$
DELIMITER ;
call GetIsReadByIDContract(19);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE PayIn(in IDChuTaiKhoan int(11))
BEGIN
declare sotien int;
set sotien = (select sotienconlai from taikhoan where chutaikhoan = IDChuTaiKhoan);
update taikhoan
set sotienconlai = sotien + 100000
where chutaikhoan = IDChuTaiKhoan;
END;$$
DELIMITER ;
call PayIn(37);
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE GetMoney(in IDChuTaiKhoan int(11))
BEGIN
select sotienconlai as SoDu
from taikhoan
where chutaikhoan = IDChuTaiKhoan;
END;$$
DELIMITER ;
call GetMoney(37);
#------------------------------------------------
DELIMITER $$
USE `sql12314047`$$
CREATE PROCEDURE AddBankAccount(in IDChuTaiKhoan int(11), in TenNganHang varchar(255))
BEGIN
insert into taikhoan values(null, IDChuTaiKhoan, TenNganHang,0);
END;$$
DELIMITER ;
call AddBankAccount(38,'vietcombank');
| true |
ef27a6b0e434ffe1ac127f59382b81e93bb3f383 | SQL | jampaniuday/DBA_Scirpts | /Req_to_sid.sql | UTF-8 | 563 | 3.21875 | 3 | [] | no_license | set verify off
set head off
col reqid format 999999999
col sesid format a10
col ospid format a10
select
'Concurrent request number :'||a.request_id ,
'Oracle session id(SID) :'||d.sid,
'Serial Hash value :'||d.serial#,
'OS process id (SPID) :'||c.spid
from
applsys.fnd_concurrent_requests a,
applsys.fnd_concurrent_processes b,
v$process c,
v$session d
where
a.controlling_manager=b.concurrent_process_id
and c.pid=b.oracle_process_id
and c.addr=d.paddr
and a.request_id=&RequestId
and a.phase_code='R';
| true |
005cf3b540d96e0ad29f5219ded54a5df68c8674 | SQL | SevdalinZhelyazkov/ConferenceOrganisation | /src/main/resources/dbScripts/DBUpdate1.sql | UTF-8 | 412 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | ALTER TABLE `conferenceOrganisation`.`userRoles`
DROP FOREIGN KEY `userroles_ibfk_2`;
ALTER TABLE `conferenceOrganisation`.`roles`
CHANGE COLUMN `roleId` `roleId` INT(11) NOT NULL AUTO_INCREMENT ;
ALTER TABLE `conferenceOrganisation`.`userRoles`
ADD CONSTRAINT `userroles_ibfk_2`
FOREIGN KEY (`roleId`)
REFERENCES `conferenceOrganisation`.`roles` (`roleId`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
| true |
035a32b346370b2b138685a735d70a095b3ba4cf | SQL | bravesoftdz/sgts | /sql/oracle/patch_15.01.2009/procedures/2/212_U_DEFECT_VIEW.prc | WINDOWS-1251 | 607 | 3.1875 | 3 | [] | no_license | /* */
CREATE OR REPLACE PROCEDURE U_DEFECT_VIEW
(
DEFECT_VIEW_ID IN INTEGER,
NAME IN VARCHAR2,
DESCRIPTION IN VARCHAR2,
PRIORITY IN INTEGER,
OLD_DEFECT_VIEW_ID IN INTEGER
)
AS
BEGIN
UPDATE DEFECT_VIEWS
SET DEFECT_VIEW_ID=U_DEFECT_VIEW.DEFECT_VIEW_ID,
NAME=U_DEFECT_VIEW.NAME,
DESCRIPTION=U_DEFECT_VIEW.DESCRIPTION,
PRIORITY=U_DEFECT_VIEW.PRIORITY
WHERE DEFECT_VIEW_ID=OLD_DEFECT_VIEW_ID;
COMMIT;
END;
--
/* */
COMMIT
| true |
0cb5ad12ed6647ce7fd4f6a3c895dad1b29b6112 | SQL | harrifeng/mysql-cookbook-code | /misc/serial.sql | UTF-8 | 1,271 | 3.75 | 4 | [] | no_license | # serial.sql
# try the multi-part auto_increment thing
DROP TABLE IF EXISTS serial;
CREATE TABLE serial
(
prefix CHAR(3) NOT NULL,
num INT(5) ZEROFILL NOT NULL AUTO_INCREMENT,
PRIMARY KEY (prefix,num)
);
INSERT INTO serial (prefix)
VALUES("A"),
("A"),
("B"),
("C"),
("A"),
("C"),
("C"),
("C");
SELECT * FROM serial ORDER BY prefix, num;
# try it with the AUTO_INCREMENT column first in the key
DROP TABLE IF EXISTS serial;
CREATE TABLE serial
(
prefix CHAR(3) NOT NULL,
num INT(5) ZEROFILL NOT NULL AUTO_INCREMENT,
PRIMARY KEY (num,prefix)
);
# try it with more than one non-AI part
INSERT INTO serial (prefix)
VALUES("A"),
("A"),
("B"),
("C"),
("A"),
("C"),
("C"),
("C");
SELECT * FROM serial ORDER BY prefix, num;
DROP TABLE IF EXISTS serial;
CREATE TABLE serial
(
prefix CHAR(3) NOT NULL,
prefix2 CHAR(3) NOT NULL,
num INT(5) ZEROFILL NOT NULL AUTO_INCREMENT,
PRIMARY KEY (prefix,prefix2,num)
);
INSERT INTO serial (prefix,prefix2)
VALUES("A","A"),
("A","A"),
("B","A"),
("C","A"),
("A","B"),
("C","B"),
("C","A"),
("C","B");
SELECT * FROM serial ORDER BY prefix, prefix2, num;
| true |
e50d80a78a0952d7eb289445c96e50c74548aa04 | SQL | hyelee-jo/jsp20201103 | /WebContent/WEB-INF/sql/constraint/constEx5.sql | UHC | 2,252 | 4.09375 | 4 | [] | no_license | -- ߰
DROP TABLE emp_copy;
CREATE TABLE emp_copy
AS
SELECT * FROM employee;
SELECT * FROM emp_copy;
SELECT * FROM user_constraints
WHERE table_name='EMPLOYEE';
SELECT * FROM user_constraints
WHERE table_name='EMP_COPY';
ALTER TABLE emp_copy
ADD PRIMARY KEY (eno);
DROP TABLE dept_copy;
CREATE TABLE dept_copy
AS
SELECT * FROM department;
ALTER TABLE dept_copy
ADD CONSTRAINT dept_copy_dno_pk PRIMARY KEY (dno);
SELECT * FROM user_constraints
WHERE table_name='DEPT_COPY';
-- FOREIGN KEY ߰ϱ
alter table emp_copy
add constraint emp_copy_dno_fk
foreign key(dno) references dept_copy(dno);
select table_name, constraint_name from user_constraints where table_name in ('EMP_COPY', 'DEPT_COPY');
-- å (260 )
ALTER TABLE emp_copy
MODIFY ename CONSTRAINT emp_copy_ename_nn NOT NULL;
select table_name, constraint_name
from user_constraints where table_name in('EMP_COPY');
--
ALTER TABLE emp_copy
DROP CONSTRAINT emp_copy_ename_nn;
select * FROM user_constraints
WHERE table_name='DEPT_COPY';
ALTER TABLE emp_copy
DROP CONSTRAINT SYS_C007393;
-- dept_copy primary
ALTER TABLE dept_copy
DROP CONSTRAINT DEPT_COPY_DNO_PK;
ALTER TABLE emp_copy
DROP CONSTRAINT EMP_COPY_DNO_FK;
ALTER TABLE dept_copy
DROP PRIMARY KEY CASCADE;
-- 265 ȥغ
-- 1
drop table emp_sample;
create table emp_sample
as
select * from employee where 1=0;
alter table emp_sample
add constraint my_emp_pk primary key(eno);
select table_name, constraint_name from user_constraints where table_name in ('EMP_SAMPLE');
-- 2
drop table dept_sample;
create table dept_sample
as
select * from department where 1=0;
alter table dept_sample
add constraint my_dept_pk primary key(dno);
select table_name, constraint_name from user_constraints where table_name in ('DEPT_SAMPLE');
-- 3
alter table emp_sample
add constraint my_emp_dept_fk
foreign key(dno) references department(dno);
select table_name, constraint_name
from user_constraints where table_name in ('EMP_SAMPLE');
-- 4
alter table emp_sample
add constraint emp_commission_min check (commission > 0);
select table_name, constraint_name from user_constraints where table_name in('EMP_SAMPLE');
| true |
413df5f070a8301cfe491b998313759e2b1912cf | SQL | cyril23/testone | /SQL_Management/sql_files/3.8/Iteration4/EDW/Queries/how_reported.sql | UTF-8 | 567 | 2.84375 | 3 | [] | no_license | set @qry = concat("
#START QUERY
select formatted_output
#OUTFILE
from (
select concat_ws('|','H',date_format(@end, '%Y%m%d'), date_format(@end, '%Y%m%d')) formatted_output, 1 as seq
union
select '10|In Person' formatted_output, 2 as seq
union
select '18|Phone' formatted_output, 2 as seq
union
select '17|In Writing' formatted_output, 2 as seq
union
select '12|Call Center' formatted_output, 2 as seq
union
select 'T|4' formatted_output, 3 as seq
) temp
order by seq");
prepare stmt from @qry;
execute stmt;
deallocate prepare stmt;
| true |
5d88dd9628f5e9bcbc899f0b45856b44c20aaee2 | SQL | pablomarttiins/TrabalhoTCC | /Scripts SQL/script MODELAGEM BANCO - 31-08-2016 - TB Estado - TB Adms2.sql | UTF-8 | 16,091 | 3.53125 | 4 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | -- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema maxfitt
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema maxfitt
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `maxfitt` DEFAULT CHARACTER SET utf8 ;
USE `maxfitt` ;
-- -----------------------------------------------------
-- Table `maxfitt`.`administrador`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`administrador` (
`codAdm` INT(11) NOT NULL AUTO_INCREMENT,
`nomeAdm` VARCHAR(45) NULL DEFAULT NULL,
`emailAdm` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`codAdm`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`estado`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`estado` (
`codEstado` INT(11) NOT NULL,
`siglaEstado` VARCHAR(45) NOT NULL,
PRIMARY KEY (`codEstado`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`enderecoaluno`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`enderecoaluno` (
`codEnderecoAl` INT(11) NOT NULL AUTO_INCREMENT,
`cidadeAluno` VARCHAR(45) NULL DEFAULT NULL,
`ruaAluno` VARCHAR(45) NULL DEFAULT NULL,
`bairroAluno` VARCHAR(45) NULL DEFAULT NULL,
`numeroEndAluno` VARCHAR(45) NULL DEFAULT NULL,
`cepAluno` VARCHAR(14) NULL DEFAULT NULL,
`codEstado` INT(11) NOT NULL,
PRIMARY KEY (`codEnderecoAl`),
INDEX `fk_enderecoaluno_estado1_idx` (`codEstado` ASC),
CONSTRAINT `fk_enderecoaluno_estado1`
FOREIGN KEY (`codEstado`)
REFERENCES `maxfitt`.`estado` (`codEstado`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 9
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`aluno`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`aluno` (
`codAluno` INT(11) NOT NULL AUTO_INCREMENT,
`nomeAluno` VARCHAR(50) NOT NULL,
`sobrenomeAluno` VARCHAR(50) NOT NULL,
`sexoAluno` CHAR(1) NULL DEFAULT NULL,
`emailAluno` VARCHAR(80) NOT NULL,
`CPF` DECIMAL(11,0) NULL DEFAULT NULL,
`RG` DECIMAL(8,0) NULL DEFAULT NULL,
`codEnderecoAl` INT(11) NOT NULL,
PRIMARY KEY (`codAluno`),
UNIQUE INDEX `emailAluno_UNIQUE` (`emailAluno` ASC),
UNIQUE INDEX `CPF_UNIQUE` (`CPF` ASC),
UNIQUE INDEX `RG_UNIQUE` (`RG` ASC),
INDEX `fk_ALUNO_ENDERECOALUNO1_idx` (`codEnderecoAl` ASC),
CONSTRAINT `fk_ALUNO_ENDERECOALUNO1`
FOREIGN KEY (`codEnderecoAl`)
REFERENCES `maxfitt`.`enderecoaluno` (`codEnderecoAl`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 9
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`objetivotipo`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`objetivotipo` (
`codObjetivoTipo` INT(11) NOT NULL AUTO_INCREMENT,
`descricao` VARCHAR(45) NULL DEFAULT NULL,
`nivel` CHAR(1) NULL DEFAULT NULL,
PRIMARY KEY (`codObjetivoTipo`))
ENGINE = InnoDB
AUTO_INCREMENT = 5
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`aluno_objetivotipo`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`aluno_objetivotipo` (
`codAluno` INT(11) NOT NULL,
`codObjetivoTipo` INT(11) NOT NULL,
PRIMARY KEY (`codAluno`, `codObjetivoTipo`),
INDEX `fk_ALUNO_has_OBJETIVOTIPO_OBJETIVOTIPO1_idx` (`codObjetivoTipo` ASC),
INDEX `fk_ALUNO_has_OBJETIVOTIPO_ALUNO1_idx` (`codAluno` ASC),
CONSTRAINT `fk_ALUNO_has_OBJETIVOTIPO_ALUNO1`
FOREIGN KEY (`codAluno`)
REFERENCES `maxfitt`.`aluno` (`codAluno`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_ALUNO_has_OBJETIVOTIPO_OBJETIVOTIPO1`
FOREIGN KEY (`codObjetivoTipo`)
REFERENCES `maxfitt`.`objetivotipo` (`codObjetivoTipo`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`avaliacao`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`avaliacao` (
`codAvaliacao` INT(11) NOT NULL AUTO_INCREMENT,
`circunferenciaTricepsDireitoContraido` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaTricepsDireitoAlongado` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaTricepsEsquerdoContraido` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaTricepsEsquerdoAlongado` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaBicepsDireitoContraido` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaBicepsDireitoAlongado` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaBicepsEsquerdoContraido` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaBicepsEsquerdoAlongado` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaPeito` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaCoxaDireita` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaCoxaEsquerda` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaPanturrilhaDireita` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaPanturrilhaEsquerda` VARCHAR(45) NULL DEFAULT NULL,
`circunferenciaGluteo` VARCHAR(45) NULL DEFAULT NULL,
`percentGordura` DECIMAL(10,0) NULL DEFAULT NULL,
`peso` DECIMAL(45,0) NULL DEFAULT NULL,
`dataAvaliacao` DATE NULL DEFAULT NULL,
`codAluno` INT(11) NOT NULL,
PRIMARY KEY (`codAvaliacao`),
INDEX `fk_AVALIACAO_ALUNO1_idx` (`codAluno` ASC),
CONSTRAINT `fk_AVALIACAO_ALUNO1`
FOREIGN KEY (`codAluno`)
REFERENCES `maxfitt`.`aluno` (`codAluno`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 8
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`ci_sessions`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`ci_sessions` (
`id_sessao` VARCHAR(40) NOT NULL DEFAULT '0',
`endereco_ip` VARCHAR(16) NOT NULL DEFAULT '0',
`user_agent` VARCHAR(50) NOT NULL,
`ultima_atividade` INT(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id_sessao`))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`enderecoeducador`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`enderecoeducador` (
`codEnderecoEd` INT(11) NOT NULL AUTO_INCREMENT,
`cidadeEducador` VARCHAR(45) NULL DEFAULT NULL,
`bairroEducador` VARCHAR(45) NULL DEFAULT NULL,
`ruaEducador` VARCHAR(45) NULL,
`numeroEndEducador` VARCHAR(45) NULL DEFAULT NULL,
`cepEducador` VARCHAR(8) NULL DEFAULT NULL,
`codEstado` INT(11) NOT NULL,
PRIMARY KEY (`codEnderecoEd`),
INDEX `fk_enderecoeducador_estado1_idx` (`codEstado` ASC),
CONSTRAINT `fk_enderecoeducador_estado1`
FOREIGN KEY (`codEstado`)
REFERENCES `maxfitt`.`estado` (`codEstado`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 12
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`educadorfisico`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`educadorfisico` (
`codEducador` INT(11) NOT NULL AUTO_INCREMENT,
`nomeEducador` VARCHAR(50) NOT NULL,
`sobrenomeEducador` VARCHAR(50) NOT NULL,
`sexoEducador` CHAR(1) NULL DEFAULT NULL,
`emailEducador` VARCHAR(80) NOT NULL,
`CPF` DECIMAL(11,0) NULL DEFAULT NULL,
`RG` DECIMAL(8,0) NULL DEFAULT NULL,
`numeroCref` VARCHAR(40) NOT NULL,
`estadoRegistroCref` VARCHAR(2) NOT NULL,
`statusCref` TINYINT(1) NULL DEFAULT NULL,
`codEnderecoEd` INT(11) NOT NULL,
PRIMARY KEY (`codEducador`),
UNIQUE INDEX `emailEducador_UNIQUE` (`emailEducador` ASC),
UNIQUE INDEX `numeroCref_UNIQUE` (`numeroCref` ASC),
INDEX `fk_EDUCADORFISICO_ENDERECOEDUCADOR1_idx` (`codEnderecoEd` ASC),
CONSTRAINT `fk_EDUCADORFISICO_ENDERECOEDUCADOR1`
FOREIGN KEY (`codEnderecoEd`)
REFERENCES `maxfitt`.`enderecoeducador` (`codEnderecoEd`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 12
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`musculo`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`musculo` (
`codMusculo` INT(11) NOT NULL AUTO_INCREMENT,
`descricao` VARCHAR(45) NOT NULL,
PRIMARY KEY (`codMusculo`))
ENGINE = InnoDB
AUTO_INCREMENT = 9
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`exercicio`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`exercicio` (
`codExercicio` INT(11) NOT NULL AUTO_INCREMENT,
`descricao` VARCHAR(45) NULL DEFAULT NULL,
`codMusculo` INT(11) NOT NULL,
PRIMARY KEY (`codExercicio`),
INDEX `fk_EXERCICIO_MUSCULO1_idx` (`codMusculo` ASC),
CONSTRAINT `fk_EXERCICIO_MUSCULO1`
FOREIGN KEY (`codMusculo`)
REFERENCES `maxfitt`.`musculo` (`codMusculo`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 16
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`fichatreino`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`fichatreino` (
`codFichaTreino` INT(11) NOT NULL AUTO_INCREMENT,
`tempoUtil` VARCHAR(45) NULL DEFAULT NULL,
`codObjetivoTipo` INT(11) NOT NULL,
`codEducador` INT(11) NOT NULL,
PRIMARY KEY (`codFichaTreino`),
INDEX `fk_FICHATREINO_OBJETIVOTIPO1_idx` (`codObjetivoTipo` ASC),
INDEX `fk_FICHATREINO_EDUCADORFISICO1_idx` (`codEducador` ASC),
CONSTRAINT `fk_FICHATREINO_EDUCADORFISICO1`
FOREIGN KEY (`codEducador`)
REFERENCES `maxfitt`.`educadorfisico` (`codEducador`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_FICHATREINO_OBJETIVOTIPO1`
FOREIGN KEY (`codObjetivoTipo`)
REFERENCES `maxfitt`.`objetivotipo` (`codObjetivoTipo`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 28
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`grupo`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`grupo` (
`codGrupo` INT(11) NOT NULL AUTO_INCREMENT,
`descricaoGrupo` VARCHAR(45) NULL DEFAULT NULL,
`codFichaTreino` INT(11) NOT NULL,
PRIMARY KEY (`codGrupo`),
INDEX `fk_GRUPO_FICHATREINO1_idx` (`codFichaTreino` ASC),
CONSTRAINT `fk_GRUPO_FICHATREINO1`
FOREIGN KEY (`codFichaTreino`)
REFERENCES `maxfitt`.`fichatreino` (`codFichaTreino`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 20
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`grupo_exercicio`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`grupo_exercicio` (
`codGrupo` INT(11) NOT NULL,
`codExercicio` INT(11) NOT NULL,
`serie` DECIMAL(10,0) NOT NULL,
`repeticao` DECIMAL(10,0) NOT NULL,
`tempoIntervalo` VARCHAR(10) NULL DEFAULT NULL,
PRIMARY KEY (`codGrupo`, `codExercicio`),
INDEX `fk_grupo_has_exercicio_exercicio2_idx` (`codExercicio` ASC),
INDEX `fk_grupo_has_exercicio_grupo2_idx` (`codGrupo` ASC),
CONSTRAINT `fk_grupo_has_exercicio_exercicio2`
FOREIGN KEY (`codExercicio`)
REFERENCES `maxfitt`.`exercicio` (`codExercicio`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_grupo_has_exercicio_grupo2`
FOREIGN KEY (`codGrupo`)
REFERENCES `maxfitt`.`grupo` (`codGrupo`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`tipotelefone`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`tipotelefone` (
`codTipoTelefone` INT(11) NOT NULL AUTO_INCREMENT,
`descricao` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`codTipoTelefone`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`telefonealuno`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`telefonealuno` (
`codTelefoneAl` INT(11) NOT NULL AUTO_INCREMENT,
`numeroTelefone` DECIMAL(11,0) NULL DEFAULT NULL,
`codAluno` INT(11) NOT NULL,
`codTipoTelefone` INT(11) NOT NULL,
PRIMARY KEY (`codTelefoneAl`),
INDEX `fk_TELEFONEALUNO_ALUNO_idx` (`codAluno` ASC),
INDEX `fk_TELEFONEALUNO_TIPOTELEFONE1_idx` (`codTipoTelefone` ASC),
CONSTRAINT `fk_TELEFONEALUNO_ALUNO`
FOREIGN KEY (`codAluno`)
REFERENCES `maxfitt`.`aluno` (`codAluno`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_TELEFONEALUNO_TIPOTELEFONE1`
FOREIGN KEY (`codTipoTelefone`)
REFERENCES `maxfitt`.`tipotelefone` (`codTipoTelefone`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`telefoneeducador`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`telefoneeducador` (
`codTelefoneEd` INT(11) NOT NULL AUTO_INCREMENT,
`numeroTelefone` VARCHAR(45) NULL DEFAULT NULL,
`codEducador` INT(11) NOT NULL,
`codTipoTelefone` INT(11) NOT NULL,
PRIMARY KEY (`codTelefoneEd`),
INDEX `fk_TELEFONEEDUCADOR_EDUCADORFISICO1_idx` (`codEducador` ASC),
INDEX `fk_TELEFONEEDUCADOR_TIPOTELEFONE1_idx` (`codTipoTelefone` ASC),
CONSTRAINT `fk_TELEFONEEDUCADOR_EDUCADORFISICO1`
FOREIGN KEY (`codEducador`)
REFERENCES `maxfitt`.`educadorfisico` (`codEducador`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_TELEFONEEDUCADOR_TIPOTELEFONE1`
FOREIGN KEY (`codTipoTelefone`)
REFERENCES `maxfitt`.`tipotelefone` (`codTipoTelefone`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `maxfitt`.`usuario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maxfitt`.`usuario` (
`codUsuario` INT(11) NOT NULL AUTO_INCREMENT,
`login` VARCHAR(45) NOT NULL,
`senha` VARCHAR(45) NOT NULL,
`status` INT(11) NULL DEFAULT NULL,
`nivel` INT(11) NULL DEFAULT NULL,
`codEducador` INT(11) NULL DEFAULT NULL,
`codAluno` INT(11) NULL DEFAULT NULL,
`codAdm` INT(11) NOT NULL,
PRIMARY KEY (`codUsuario`),
INDEX `fk_USUARIO_educadorfisico1_idx` (`codEducador` ASC),
INDEX `fk_USUARIO_aluno1_idx` (`codAluno` ASC),
INDEX `fk_usuario_administrador1_idx` (`codAdm` ASC),
CONSTRAINT `fk_USUARIO_aluno1`
FOREIGN KEY (`codAluno`)
REFERENCES `maxfitt`.`aluno` (`codAluno`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_USUARIO_educadorfisico1`
FOREIGN KEY (`codEducador`)
REFERENCES `maxfitt`.`educadorfisico` (`codEducador`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_usuario_administrador1`
FOREIGN KEY (`codAdm`)
REFERENCES `maxfitt`.`administrador` (`codAdm`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 15
DEFAULT CHARACTER SET = utf8;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
| true |
bb425c8988168bd50fd2704405d651bcdbf3e172 | SQL | pkhandke/PostgreSQL_ParchAndPosey | /Logical Operators/lo4.sql | UTF-8 | 751 | 4.03125 | 4 | [] | no_license | /*
1. Write a query that returns all the orders where the standard_qty is over 1000, the poster_qty is 0, and the gloss_qty is 0.
2. Using the accounts table find all the companies whose names do not start with 'C' and end with 's'.
3. Use the web_events table to find all information regarding individuals who were contacted via organic or adwords and started their account at any point in 2016 sorted from newest to oldest.
*/
SELECT *
FROM orders
WHERE standard_qty>1000 AND poster_qty=0 AND gloss_qty=0;
SELECT *
FROM accounts
WHERE name NOT LIKE 'C%' AND name NOT LIKE '%s';
SELECT *
FROM web_events
WHERE channel IN ('organic', 'adwords') AND occurred_at BETWEEN '2016-01-01' AND '2017-01-01'
ORDER BY occurred_at desc
| true |
b67a37dd37892314fc59230a3d06c335aa257e51 | SQL | SchuylerGoodman/record-indexer | /database/DatabaseCreate.sql | UTF-8 | 1,513 | 3.28125 | 3 | [] | no_license | DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS projects;
DROP TABLE IF EXISTS fields;
DROP TABLE IF EXISTS records;
DROP TABLE IF EXISTS images;
CREATE TABLE users
(
userId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
username VARCHAR(255) NOT NULL UNIQUE,
first VARCHAR(255) NOT NULL,
last VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
records INTEGER DEFAULT 0
);
CREATE TABLE projects
(
projectId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
title VARCHAR(255) NOT NULL UNIQUE,
recordCount INTEGER NOT NULL,
firstYCoord INTEGER NOT NULL,
fieldHeight INTEGER NOT NULL
);
CREATE TABLE fields
(
fieldId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
title VARCHAR(255) NOT NULL,
xCoordinate INTEGER NOT NULL,
width INTEGER NOT NULL,
helpHtml VARCHAR(255) NOT NULL,
columnNumber INTEGER NOT NULL,
projectId INTEGER NOT NULL,
knownData VARCHAR(255) DEFAULT '',
CONSTRAINT unq UNIQUE (columnNumber, projectId)
);
CREATE TABLE records
(
recordId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
imageId INTEGER NOT NULL,
fieldId INTEGER NOT NULL,
rowNumber INTEGER NOT NULL,
value VARCHAR(255),
CONSTRAINT unq UNIQUE (imageId, fieldId, rowNumber)
);
CREATE TABLE images
(
imageId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
path VARCHAR(255) NOT NULL UNIQUE,
title VARCHAR(255) NOT NULL,
projectId INTEGER NOT NULL,
currentUser INTEGER DEFAULT 0
);
| true |
18503d057a213c2f5d6e28b8f1f3185f01f0a3a9 | SQL | tahhan/RecSys | /resources/recruitment.sql | UTF-8 | 18,342 | 3.28125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 12, 2011 at 07:56 PM
-- Server version: 5.1.37
-- PHP Version: 5.3.0
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 */;
--
-- Database: `recruitment`
--
-- --------------------------------------------------------
--
-- Table structure for table `candidate`
--
CREATE TABLE IF NOT EXISTS `candidate` (
`seeker_id` int(11) NOT NULL,
`vacancy_id` int(11) NOT NULL,
`status` tinyint(4) NOT NULL COMMENT '0: contacted, 1: 1st interview, 2: 2nd interview, 3: sent offer to him, 4: sent contract to him',
PRIMARY KEY (`seeker_id`,`vacancy_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `candidate`
--
-- --------------------------------------------------------
--
-- Table structure for table `city`
--
CREATE TABLE IF NOT EXISTS `city` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`city_name` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`country_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `city`
--
-- --------------------------------------------------------
--
-- Table structure for table `company_info`
--
CREATE TABLE IF NOT EXISTS `company_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`company_name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`industry_id` int(11) NOT NULL,
`no_employees` int(11) NOT NULL,
`city_id` int(11) NOT NULL COMMENT 'we can find country from city',
`contact_person` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`phone_number` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`hear_from` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `company_info`
--
-- --------------------------------------------------------
--
-- Table structure for table `country`
--
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`country_name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=245 ;
--
-- Dumping data for table `country`
--
INSERT INTO `country` (`id`, `country_name`) VALUES
(1, 'Algeria'),
(2, 'Bahrain'),
(3, 'Djibouti'),
(4, 'Egypt'),
(5, 'Iraq'),
(6, 'Jordan'),
(7, 'Kuwait'),
(8, 'Lebanon'),
(9, 'Libya'),
(10, 'Mauritania'),
(11, 'Morocco'),
(12, 'Oman'),
(13, 'Palestine'),
(14, 'Qatar'),
(15, 'Saudi Arabia'),
(16, 'Somalia'),
(17, 'Sudan'),
(18, 'Syria'),
(19, 'Tunisia'),
(20, 'UAE'),
(21, 'Yemen'),
(22, 'Afghanistan'),
(23, 'Aland Islands'),
(24, 'Albania'),
(25, 'American Samoa'),
(26, 'Andorra'),
(27, 'Angola'),
(28, 'Anguilla'),
(29, 'Antarctica'),
(30, 'Antigua and Barbuda'),
(31, 'Argentina'),
(32, 'Armenia'),
(33, 'Aruba'),
(34, 'Australia'),
(35, 'Austria'),
(36, 'Azerbaijan'),
(37, 'Bangladesh'),
(38, 'Barbados'),
(39, 'Belarus'),
(40, 'Belgium'),
(41, 'Belize'),
(42, 'Benin'),
(43, 'Bermuda'),
(44, 'Bhutan'),
(45, 'Bolivia'),
(46, 'Bosnia and Herzegovina'),
(47, 'Botswana'),
(48, 'Bouvet Island'),
(49, 'Brazil'),
(50, 'British Indian Ocean Territory'),
(51, 'British Virgin Islands'),
(52, 'Brunei Darussalam'),
(53, 'Bulgaria'),
(54, 'Burkina Faso'),
(55, 'Burundi'),
(56, 'Cambodia'),
(57, 'Cameroon'),
(58, 'Canada'),
(59, 'Cape Verde'),
(60, 'Cayman Islands'),
(61, 'Central African Republic'),
(62, 'Chad'),
(63, 'Chile'),
(64, 'China'),
(65, 'Christmas Island'),
(66, 'Cocos (Keeling) Islands'),
(67, 'Colombia'),
(68, 'Comoros'),
(69, 'Congo'),
(70, 'Congo, the Democratic Republic of the'),
(71, 'Cook Islands'),
(72, 'Costa Rica'),
(73, 'Cote d''Ivoire'),
(74, 'Croatia'),
(75, 'Cuba'),
(76, 'Cyprus'),
(77, 'Czech Republic'),
(78, 'Denmark'),
(79, 'Dominica'),
(80, 'Dominican Republic'),
(81, 'Ecuador'),
(82, 'El Salvador'),
(83, 'Equatorial Guinea'),
(84, 'Eritrea'),
(85, 'Estonia'),
(86, 'Ethiopia'),
(87, 'Falkland Islands (Malvinas)'),
(88, 'Faroe Islands'),
(89, 'Fiji'),
(90, 'Finland'),
(91, 'France'),
(92, 'French Guiana'),
(93, 'French Polynesia'),
(94, 'French Southern Territories'),
(95, 'Gabon'),
(96, 'Gambia'),
(97, 'Georgia'),
(98, 'Germany'),
(99, 'Ghana'),
(100, 'Gibraltar'),
(101, 'Greece'),
(102, 'Greenland'),
(103, 'Grenada'),
(104, 'Guadeloupe'),
(105, 'Guam'),
(106, 'Guatemala'),
(107, 'Guernsey'),
(108, 'Guinea'),
(109, 'Guinea Bissau'),
(110, 'Guyana'),
(111, 'Haiti'),
(112, 'Heard and McDonald Islands'),
(113, 'Holy See (Vatican City)'),
(114, 'Honduras'),
(115, 'Hong Kong (SAR)'),
(116, 'Hungary'),
(117, 'Iceland'),
(118, 'India'),
(119, 'Indonesia'),
(120, 'Iran'),
(121, 'Ireland'),
(122, 'Isle of Man'),
(123, 'Italy'),
(124, 'Jamaica'),
(125, 'Japan'),
(126, 'Jersey'),
(127, 'Kazakhstan'),
(128, 'Kenya'),
(129, 'Kiribati'),
(130, 'Korea, Democratic People''s Republic of'),
(131, 'Korea, Republic of'),
(132, 'Kyrgyzstan'),
(133, 'Lao People''s Democratic Republic'),
(134, 'Latvia'),
(135, 'Lesotho'),
(136, 'Liberia'),
(137, 'Liechtenstein'),
(138, 'Lithuania'),
(139, 'Luxembourg'),
(140, 'Macao'),
(141, 'Macedonia'),
(142, 'Madagascar'),
(143, 'Malawi'),
(144, 'Malaysia'),
(145, 'Maldives'),
(146, 'Mali'),
(147, 'Malta'),
(148, 'Marshall Islands'),
(149, 'Martinique'),
(150, 'Mauritius'),
(151, 'Mayotte'),
(152, 'Mexico'),
(153, 'Micronesia, Federated States of'),
(154, 'Moldova'),
(155, 'Monaco'),
(156, 'Mongolia'),
(157, 'Montenegro'),
(158, 'Montserrat'),
(159, 'Mozambique'),
(160, 'Myanmar'),
(161, 'Namibia'),
(162, 'Nauru'),
(163, 'Nepal'),
(164, 'Netherlands'),
(165, 'Netherlands Antilles'),
(166, 'New Caledonia'),
(167, 'New Zealand'),
(168, 'Nicaragua'),
(169, 'Niger'),
(170, 'Nigeria'),
(171, 'Niue'),
(172, 'Norfolk Island'),
(173, 'Northern Mariana Islands'),
(174, 'Norway'),
(175, 'Pakistan'),
(176, 'Palau'),
(177, 'Panama'),
(178, 'Papua New Guinea'),
(179, 'Paraguay'),
(180, 'Peru'),
(181, 'Philippines'),
(182, 'Pitcairn'),
(183, 'Poland'),
(184, 'Portugal'),
(185, 'Puerto Rico'),
(186, 'Romania'),
(187, 'Russia'),
(188, 'Rwanda'),
(189, 'Réunion'),
(190, 'Saint Barthelemy'),
(191, 'Saint Helena'),
(192, 'Saint Kitts and Nevis'),
(193, 'Saint Lucia'),
(194, 'Saint Pierre and Miquelon'),
(195, 'Saint Vincent and the Grenadines'),
(196, 'Samoa'),
(197, 'San Marino'),
(198, 'Senegal'),
(199, 'Serbia'),
(200, 'Seychelles'),
(201, 'Sierra Leone'),
(202, 'Singapore'),
(203, 'Slovakia'),
(204, 'Slovenia'),
(205, 'Solomon Islands'),
(206, 'South Africa'),
(207, 'South Georgia and the South Sandwich Islands'),
(208, 'Spain'),
(209, 'Sri Lanka'),
(210, 'Suriname'),
(211, 'Svalbard and Jan Mayen'),
(212, 'Swaziland'),
(213, 'Sweden'),
(214, 'Switzerland'),
(215, 'São Tomé and Príncipe'),
(216, 'Taiwan'),
(217, 'Tajikistan'),
(218, 'Tanzania'),
(219, 'Thailand'),
(220, 'The Bahamas'),
(221, 'Timor Leste'),
(222, 'Togo'),
(223, 'Tokelau'),
(224, 'Tonga'),
(225, 'Trinidad and Tobago'),
(226, 'Turkey'),
(227, 'Turkmenistan'),
(228, 'Turks and Caicos Islands'),
(229, 'Tuvalu'),
(230, 'USA'),
(231, 'Uganda'),
(232, 'Ukraine'),
(233, 'United Kingdom'),
(234, 'United States Minor Outlying Islands'),
(235, 'Uruguay'),
(236, 'Uzbekistan'),
(237, 'Vanuatu'),
(238, 'Venezuela'),
(239, 'Vietnam'),
(240, 'Virgin Islands'),
(241, 'Wallis and Futuna'),
(242, 'Western Sahara'),
(243, 'Zambia'),
(244, 'Zimbabwe');
-- --------------------------------------------------------
--
-- Table structure for table `department`
--
CREATE TABLE IF NOT EXISTS `department` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Dept id',
`company_id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Dept name',
`contact_person` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `department`
--
-- --------------------------------------------------------
--
-- Table structure for table `industry`
--
CREATE TABLE IF NOT EXISTS `industry` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`industry_name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=46 ;
--
-- Dumping data for table `industry`
--
INSERT INTO `industry` (`id`, `industry_name`) VALUES
(1, 'Accounting and Auditing'),
(2, 'Marketing and Public Relations'),
(3, 'Agriculture'),
(4, 'Airlines and Aviation'),
(5, 'Architecture'),
(6, 'Automotive'),
(7, 'Business Support Services'),
(8, 'Biotechnology'),
(9, 'Catering, Food Services and Restaurants'),
(10, 'Social Services and Non-Profit'),
(11, 'Hardware and Maintenance'),
(12, 'Software'),
(13, 'Construction'),
(14, 'Consulting Services'),
(15, 'Distribution and Logistics'),
(16, 'Education and Training'),
(17, 'Entertainment, Sports and Recreation'),
(18, 'Clothing and Fashion'),
(19, 'Financial Services'),
(20, 'Public Sector'),
(21, 'Healthcare and Medicine'),
(22, 'Hospitality, Travel and Tourism'),
(23, 'Insurance'),
(24, 'Internet and E-Commerce'),
(25, 'Law Enforcement and Security'),
(26, 'Legal'),
(27, 'Manufacturing and Production'),
(28, 'Maritime'),
(29, 'Communications and Media'),
(30, 'Art and Design'),
(31, 'Employment Placement Agencies and HR'),
(32, 'Electro-Mechanical Products'),
(33, 'Other'),
(34, 'Energy Production and Distribution'),
(35, 'Pharmaceuticals'),
(36, 'Publishing'),
(37, 'Petrochemicals and Mining'),
(38, 'Real Estate'),
(39, 'Retail and Wholesale'),
(40, 'Shipping and Transportation'),
(41, 'Fast Moving Consumer Goods (FMCG)'),
(42, 'Telecommunications'),
(43, 'Call Center'),
(44, 'Furniture'),
(45, 'Diversified Group');
-- --------------------------------------------------------
--
-- Table structure for table `rrf`
--
CREATE TABLE IF NOT EXISTS `rrf` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'RRF iD',
`department_id` int(11) NOT NULL,
`job_title` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'CEO, mngr, team leader, employer',
`job_description` text COLLATE utf8_unicode_ci NOT NULL,
`salary` int(11) NOT NULL,
`no_employees_required` int(11) NOT NULL,
`type_employment` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'permanent, limited',
`reason_employment` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'new position, replacement',
`status` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'if not accepted (pending)',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `rrf`
--
-- --------------------------------------------------------
--
-- Table structure for table `saved_searches_company_cvs`
--
CREATE TABLE IF NOT EXISTS `saved_searches_company_cvs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`company_id` int(11) NOT NULL,
`list_of_applicants_id` text COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `saved_searches_company_cvs`
--
-- --------------------------------------------------------
--
-- Table structure for table `seeker`
--
CREATE TABLE IF NOT EXISTS `seeker` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`full_name` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`telephone` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
`password` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`DOB` date DEFAULT NULL,
`gender` tinyint(4) DEFAULT '0',
`marital_status` tinyint(4) DEFAULT '0',
`nationalities` text COLLATE utf8_unicode_ci COMMENT 'this colum should be used as json array with each nationalities but there is a table for nationality\nlike [1,2,3] ',
`living_in` int(11) DEFAULT NULL COMMENT 'the city id of where he lives',
`residency_status` tinyint(4) DEFAULT NULL COMMENT 'type by number :\n0 - Citizen\n1 - Residency Visa (Non-transferable)\n2 - Residency Visa (Transferable)\n3 - Student Visa\n4 - Transit Visa\n5 - Visit Visa\n6 - No Visa',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `seeker`
--
-- --------------------------------------------------------
--
-- Table structure for table `seeker_apply_vacancy`
--
CREATE TABLE IF NOT EXISTS `seeker_apply_vacancy` (
`seeker_id` int(11) NOT NULL,
`vacancy_id` int(11) NOT NULL,
PRIMARY KEY (`seeker_id`,`vacancy_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `seeker_apply_vacancy`
--
-- --------------------------------------------------------
--
-- Table structure for table `seeker_edu`
--
CREATE TABLE IF NOT EXISTS `seeker_edu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`seeker_id` int(11) NOT NULL,
`edu_level` enum('elementary','high_school','diploma','uni_bachelors','masters','phd') COLLATE utf8_unicode_ci NOT NULL,
`degree` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`uni_name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`country_id` int(11) NOT NULL,
`start_date` date NOT NULL,
`graduation_date` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `seeker_edu`
--
-- --------------------------------------------------------
--
-- Table structure for table `seeker_edu_degree`
--
CREATE TABLE IF NOT EXISTS `seeker_edu_degree` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`seeker_id` int(11) NOT NULL,
`degree_level` enum('uni_bachelors','masters','phd') COLLATE utf8_unicode_ci NOT NULL,
`uni_name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`degree` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `seeker_edu_degree`
--
-- --------------------------------------------------------
--
-- Table structure for table `seeker_edu_info`
--
CREATE TABLE IF NOT EXISTS `seeker_edu_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`seeker_id` int(11) NOT NULL,
`have_degree` tinyint(4) NOT NULL DEFAULT '0',
`highest_level` enum('elementary','high_school','diploma','uni') COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `seeker_edu_info`
--
-- --------------------------------------------------------
--
-- Table structure for table `seeker_other_info`
--
CREATE TABLE IF NOT EXISTS `seeker_other_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`seeker_id` int(11) NOT NULL,
`title` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`description` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `seeker_other_info`
--
-- --------------------------------------------------------
--
-- Table structure for table `seeker_professional_info`
--
CREATE TABLE IF NOT EXISTS `seeker_professional_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`seeker_id` int(11) NOT NULL,
`have_exp` tinyint(4) NOT NULL DEFAULT '0',
`exp_years` int(11) DEFAULT NULL,
`last_job_title` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
`primary_comm` int(11) NOT NULL COMMENT 'comm id',
`second_comm` int(11) DEFAULT NULL COMMENT 'comm id',
`third_comm` int(11) DEFAULT NULL COMMENT 'comm id',
`lang_list` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'json array of objects like [{''arabic'':''begginer''},{''english'':}]',
`skills` text COLLATE utf8_unicode_ci COMMENT 'free text',
`preferd_place` int(11) DEFAULT NULL COMMENT 'country id',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `seeker_professional_info`
--
-- --------------------------------------------------------
--
-- Table structure for table `seeker_work_exp`
--
CREATE TABLE IF NOT EXISTS `seeker_work_exp` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`seeker_id` int(11) NOT NULL,
`job_title` int(11) NOT NULL,
`company_name` int(11) NOT NULL,
`country_id` int(11) NOT NULL,
`start_date` date NOT NULL,
`end_date` date DEFAULT NULL,
`still_working` tinyint(4) NOT NULL,
`description` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `seeker_work_exp`
--
-- --------------------------------------------------------
--
-- Table structure for table `vacancy`
--
CREATE TABLE IF NOT EXISTS `vacancy` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`department_id` int(11) NOT NULL,
`job_title` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'CEO, mngr, team leader, employer',
`job_description` text COLLATE utf8_unicode_ci NOT NULL,
`salary` int(11) NOT NULL,
`no_employees_required` int(11) NOT NULL,
`type_employment` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'permanent, limited',
`reason_employment` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'new position, replacement',
`status` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'empty, need more, accepted, removed',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Dumping data for table `vacancy`
--
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
33728e0651c781cc6e977152de472e782cf9859c | SQL | svn2github/openbiz-cubi | /cubi/modules/email/mod.install.sql | UTF-8 | 1,695 | 3.03125 | 3 | [
"BSD-3-Clause"
] | permissive | /*Table structure for table `email_log` */
DROP TABLE IF EXISTS `email_log`;
CREATE TABLE `email_log` (
`id` int(11) NOT NULL auto_increment,
`result` varchar(255) NOT NULL,
`sender` varchar(255) NOT NULL,
`sender_name` varchar(255) NOT NULL,
`recipients` text NOT NULL,
`subject` varchar(255) NOT NULL,
`content` longtext NOT NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `result` (`result`),
KEY `sender` (`sender`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*Data for the table `email_log` */
/*Table structure for table `email_queue` */
DROP TABLE IF EXISTS `email_queue`;
CREATE TABLE `email_queue` (
`id` int(11) NOT NULL auto_increment,
`sender` varchar(255) NOT NULL,
`recipient_name` varchar(255) NOT NULL,
`recipient` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL,
`content` longtext NOT NULL,
`status` enum('pending','sending','sent') NOT NULL,
`create_time` datetime NOT NULL,
`sent_time` datetime default NULL,
PRIMARY KEY (`id`),
KEY `flag` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*Data for the table `email_queue` */
/* Insert Cronjob Task*/
INSERT INTO `cronjob` ( `name`, `minute`, `hour`, `day`, `month`, `weekday`, `command`, `sendmail`, `max_run`, `num_run`, `description`, `status`, `last_exec`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES
( 'Sending Email Job', '*', '*', '*', '*', '*', '{APP_HOME}/bin/cronjob/run_svc.php userEmailService sendEmailFromQueue', '', 1, 0, 'System Email Queue Service', 1, 1296586403, 1, '2011-02-01 10:24:31', 1, '2011-02-01 10:51:04');
| true |
362c8b3ad0a08fbaa7a219b8fe5af3bda4d5f33e | SQL | AndersonYesidParra/Regitra_productos.personasSENA | /taller (1).sql | UTF-8 | 5,168 | 3.015625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 03-05-2021 a las 05:02:29
-- Versión del servidor: 10.4.17-MariaDB
-- Versión de PHP: 8.0.2
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 */;
--
-- Base de datos: `taller`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `personas`
--
CREATE TABLE `personas` (
`id` int(11) NOT NULL,
`nombre` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`apellido` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
`tipocedula` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`cedula` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`direccion` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,
`tipo` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`pais` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`departamento` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
`municipio` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
`correo` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`telefono` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`sexo` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Volcado de datos para la tabla `personas`
--
INSERT INTO `personas` (`id`, `nombre`, `apellido`, `tipocedula`, `cedula`, `direccion`, `tipo`, `pais`, `departamento`, `municipio`, `correo`, `telefono`, `sexo`) VALUES
(11, '5', '5', 'contraseñaregistro', '5', '5', 'cliente', '5', '5', '5', '5@gmail.com', '5', 'h'),
(15, '111', '1', 'targetaidentidad', '1', '11', 'empleado', '111', '1', '3', '111@gmail.com', '1', 'h');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `productos`
--
CREATE TABLE `productos` (
`id` int(11) NOT NULL,
`codigo` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`marca` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
`fecha` datetime DEFAULT NULL,
`cantidad` int(11) DEFAULT NULL,
`ubicacion` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`movimiento` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`foto` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`descripcion` varchar(8000) COLLATE utf8_unicode_ci DEFAULT NULL,
`cantidadMaxima` int(11) DEFAULT NULL,
`cantidadMinima` int(11) DEFAULT NULL,
`fechaCompra` datetime DEFAULT NULL,
`fechaCaducidad` datetime DEFAULT NULL,
`precio` decimal(10,2) DEFAULT NULL,
`iva` int(11) DEFAULT NULL,
`aplicaIva` bit(1) DEFAULT NULL,
`pais` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Volcado de datos para la tabla `productos`
--
INSERT INTO `productos` (`id`, `codigo`, `marca`, `fecha`, `cantidad`, `ubicacion`, `movimiento`, `foto`, `descripcion`, `cantidadMaxima`, `cantidadMinima`, `fechaCompra`, `fechaCaducidad`, `precio`, `iva`, `aplicaIva`, `pais`) VALUES
(17, '1asdf', 'cocacola', '2021-05-27 00:00:00', 21, 'CO', 'Ingresado', NULL, ' asdf', 21, 12, '2021-05-27 00:00:00', '2021-05-14 00:00:00', '123.00', 123, b'1', 'CO');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuarios`
--
CREATE TABLE `usuarios` (
`id` int(11) NOT NULL,
`nombre` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`apellido` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`correo` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Volcado de datos para la tabla `usuarios`
--
INSERT INTO `usuarios` (`id`, `nombre`, `apellido`, `password`, `correo`) VALUES
(18, 'Anderson', 'Florez', '99', 'yesdi@gmail.com'),
(19, 'PRUEBA', 'PRUEBA', '11', 'prueba@gmail.com'),
(20, 'prueba1', 'prueba1', '2020', 'prueba1@gmail.com'),
(21, '', '', '', '');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `personas`
--
ALTER TABLE `personas`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `productos`
--
ALTER TABLE `productos`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `usuarios`
--
ALTER TABLE `usuarios`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `personas`
--
ALTER TABLE `personas`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT de la tabla `productos`
--
ALTER TABLE `productos`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT de la tabla `usuarios`
--
ALTER TABLE `usuarios`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
b800991324540b042c4b9a2f5a15caf6a7e1204b | SQL | GingSing/LightBnB | /1_queries/5_get_all_reservations_for_user.sql | UTF-8 | 321 | 3.5 | 4 | [] | no_license | SELECT reservations.*, properties.*, avg(rating)
FROM property_reviews
JOIN reservations ON reservation_id = reservations.id
JOIN properties ON property_reviews.property_id = properties.id
WHERE end_date < now()::date and property_reviews.guest_id = 1
GROUP BY reservations.id, properties.id
ORDER BY start_date
LIMIT 10; | true |
4aea3a3173dae0af3152543c907697e0405c3d35 | SQL | 1suming/CenturyServer | /sql/output/localhost.sql | UTF-8 | 4,663 | 3.1875 | 3 | [] | no_license |
-- 创建数据库 --
CREATE DATABASE `centurywar` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
use centurywar;
-- 方法性能分析 --
CREATE TABLE `command_analysis`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`command` varchar(100) default "[]" COMMENT '',
`createtime` int(10) default "0" COMMENT '',
`type` varchar(15) default "" COMMENT '',
`count` int(10) default "0" COMMENT '' )ENGINE=InnoDB DEFAULT CHARSET=utf8;use centurywar;-- 测试数据库连接 --
CREATE TABLE `testContent`(
`gameuid` int(10) default "0" COMMENT '',
`count` int(10) default "0" COMMENT '',
PRIMARY KEY (`gameuid`,`count`))ENGINE=InnoDB DEFAULT CHARSET=utf8;use centurywar;-- 用户基本信息表 --
CREATE TABLE `user_account`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`server` int(5) default "0" COMMENT '玩家当前等级',
`uid` varchar(100) default "" COMMENT '玩家UID',
`exp` int(10) default "0" COMMENT '玩家当前经验',
`level` int(5) default "0" COMMENT '玩家当前等级',
`createtime` int(10) default "0" COMMENT '玩家创建时间 ',
`updatetime` int(10) default "0" COMMENT '玩家更新时间 ',
`power` int(5) default "0" COMMENT '玩家体力',
`ip` varchar(20) default "" COMMENT '玩家UID',
`country` varchar(10) default "" COMMENT '玩家UID',
`authcode` int(6) default "0" COMMENT '玩家UID',
PRIMARY KEY (`gameuid`))ENGINE=InnoDB DEFAULT CHARSET=utf8;use centurywar;-- 用户建筑表 --
CREATE TABLE `user_building`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`crop` int(5) default "0" COMMENT '资源地1',
`cropupdatetime` int(10) default "0" COMMENT '收获时间',
PRIMARY KEY (`gameuid`))ENGINE=InnoDB DEFAULT CHARSET=utf8;use centurywar;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__0`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__1`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__2`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__3`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__4`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__5`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__6`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__7`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__8`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;-- 用户Mapping映射表 --
CREATE TABLE `user_mapping__9`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`uid` varchar(100) COMMENT '用户UID数据',
PRIMARY KEY (`gameuid`), UNIQUE KEY `uid` (`uid`))ENGINE=InnoDB
DEFAULT CHARSET=utf8;use centurywar;-- 用户正在生产的信息表 --
CREATE TABLE `user_runtime`(
`gameuid` int(10) default "0" COMMENT '玩家GAMEUID',
`data` varchar(500) default "[]" COMMENT 'Runtime数据',
`updatetime` int(10) default "0" COMMENT '更新时间',
PRIMARY KEY (`gameuid`))ENGINE=InnoDB DEFAULT CHARSET=utf8; | true |
27cb1596515d466d3d1f87e36dc71f5f634fb370 | SQL | GiselaCapozzi/proyectoFinalPHP | /libreria.sql | UTF-8 | 5,423 | 3.03125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.3
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 08-08-2021 a las 23:45:26
-- Versión del servidor: 10.4.14-MariaDB
-- Versión de PHP: 7.4.11
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 */;
--
-- Base de datos: `libreria`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `eventospredefinidosusuarios`
--
CREATE TABLE `eventospredefinidosusuarios` (
`codigo` int(11) NOT NULL,
`titulo` varchar(255) DEFAULT NULL,
`horainicio` time DEFAULT NULL,
`horafin` time DEFAULT NULL,
`colortexto` varchar(7) DEFAULT NULL,
`colorfondo` varchar(7) DEFAULT NULL,
`usuario` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `eventospredefinidosusuarios`
--
INSERT INTO `eventospredefinidosusuarios` (`codigo`, `titulo`, `horainicio`, `horafin`, `colortexto`, `colorfondo`, `usuario`) VALUES
(1, 'Clase de tai-chi', '09:15:00', '10:15:00', '#ffffff', '#94ceca', 'admin'),
(2, 'Clase de pilates', '11:00:00', '11:50:00', '#ffffff', '#14868c', 'admin'),
(3, 'Clase de yoga', '13:05:00', '14:00:00', '#ffffff', '#2f416d', 'admin'),
(4, 'Clase de calistenia', '18:05:00', '19:00:00', '#ffffff', '#5d1451', 'admin'),
(5, 'Leer un libro', '14:20:00', '15:30:00', '#f312a0', '#37d7cd', 'giss');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `eventosusuarios`
--
CREATE TABLE `eventosusuarios` (
`codigo` int(11) NOT NULL,
`titulo` varchar(255) DEFAULT NULL,
`descripcion` text DEFAULT NULL,
`inicio` datetime DEFAULT NULL,
`fin` datetime DEFAULT NULL,
`colortexto` varchar(7) DEFAULT NULL,
`colorfondo` varchar(7) DEFAULT NULL,
`usuario` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `eventosusuarios`
--
INSERT INTO `eventosusuarios` (`codigo`, `titulo`, `descripcion`, `inicio`, `fin`, `colortexto`, `colorfondo`, `usuario`) VALUES
(1, 'Clase de tai-chi', '', '2021-08-07 09:15:00', '2021-08-07 10:15:00', '#ffffff', '#94ceca', 'admin'),
(2, 'Clase de pilates', '', '2021-08-07 11:00:00', '2021-08-07 11:50:00', '#ffffff', '#14868c', 'admin'),
(3, 'Clase de tai-chi', '', '2021-08-08 09:15:00', '2021-08-08 10:15:00', '#ffffff', '#94ceca', 'admin'),
(4, 'Clase de pilates', '', '2021-08-08 11:00:00', '2021-08-08 11:50:00', '#ffffff', '#14868c', 'admin'),
(5, 'Clase de yoga', '', '2021-08-08 13:05:00', '2021-08-08 14:00:00', '#ffffff', '#2f416d', 'admin'),
(6, 'Clase de calistenia', '', '2021-08-08 18:05:00', '2021-08-08 19:00:00', '#ffffff', '#5d1451', 'admin'),
(7, 'Clase de calistenia', '', '2021-08-09 18:05:00', '2021-08-09 19:00:00', '#ffffff', '#5d1451', 'admin'),
(8, 'Clase de calistenia', '', '2021-08-10 18:05:00', '2021-08-10 19:00:00', '#ffffff', '#5d1451', 'admin'),
(9, 'Clase de pilates', '', '2021-08-11 11:00:00', '2021-08-11 11:50:00', '#ffffff', '#14868c', 'admin'),
(10, 'Almuerzo a la canasta', 'Trae cada uno su comida', '2021-08-07 12:15:00', '2021-08-07 13:00:00', '#ffffff', '#3788d8', 'admin'),
(11, 'Clase de calistenia', '', '2021-08-07 18:05:00', '2021-08-07 19:00:00', '#ffffff', '#5d1451', 'admin'),
(12, 'Clase de calistenia', '', '2021-08-11 18:05:00', '2021-08-11 19:00:00', '#ffffff', '#5d1451', 'admin'),
(13, 'Reunión de personal', '', '2021-08-08 21:00:00', '2021-08-08 22:00:00', '#ffffff', '#3788d8', 'admin'),
(14, 'Desayuno de grupo', '', '2021-08-10 07:00:00', '2021-08-10 08:00:00', '#ffffff', '#3788d8', 'admin'),
(15, 'Día de descanso', '', '2021-08-13 00:05:00', '2021-08-13 23:55:00', '#ffffff', '#3788d8', 'admin'),
(17, 'Cocinar pasta', 'Pasta Casera', '2021-08-12 12:30:00', '2021-08-12 13:00:00', '#ffffff', '#5900ff', 'giss');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuarios`
--
CREATE TABLE `usuarios` (
`nombre` varchar(50) NOT NULL,
`clave` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `usuarios`
--
INSERT INTO `usuarios` (`nombre`, `clave`) VALUES
('admin', 'admin'),
('giss', '123');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `eventospredefinidosusuarios`
--
ALTER TABLE `eventospredefinidosusuarios`
ADD PRIMARY KEY (`codigo`);
--
-- Indices de la tabla `eventosusuarios`
--
ALTER TABLE `eventosusuarios`
ADD PRIMARY KEY (`codigo`);
--
-- Indices de la tabla `usuarios`
--
ALTER TABLE `usuarios`
ADD PRIMARY KEY (`nombre`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `eventospredefinidosusuarios`
--
ALTER TABLE `eventospredefinidosusuarios`
MODIFY `codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `eventosusuarios`
--
ALTER TABLE `eventosusuarios`
MODIFY `codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
d2a45726c395cf814a4d58aa0d344000f015b512 | SQL | szwetsloot/RC | /Dumps/bouys.sql | UTF-8 | 1,002 | 2.921875 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50505
Source Host : localhost:3306
Source Database : rowcoaching
Target Server Type : MYSQL
Target Server Version : 50505
File Encoding : 65001
Date: 2017-07-11 14:30:40
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for bouys
-- ----------------------------
DROP TABLE IF EXISTS `bouys`;
CREATE TABLE `bouys` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tracker_id` int(11) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`combination` int(11) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`prev` int(11) DEFAULT NULL,
`order` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of bouys
-- ----------------------------
INSERT INTO `bouys` VALUES ('1', '4', '2', '0', '1', '3', '1');
INSERT INTO `bouys` VALUES ('3', '6', '2', '0', '2', '1', '2');
| true |
25dfc7f5bc0543ad7f9c79442dce9091bf8685b5 | SQL | whlee21/aumc-daily | /init_load/sprint_3/itf_cost_i.sql | UTF-8 | 13,268 | 3.21875 | 3 | [] | no_license | /*****************************************************
프로그램명 : ITF_COST_I.sql
작성자 : Won Jong Bok
수정자 :
최초 작성일 : 2020-12-04
수정일 :
소스 테이블(기본) :
소스 테이블(참조) :
프로그램 설명 : 입원COST내역
cnt :
time :
*****************************************************/
DROP TABLE if exists itfcdmpv532_daily.ITF_COST_I;;
create table itfcdmpv532_daily.ITF_COST_I as
SELECT
null::varchar(50) as visit_no -- 방문고유번호
, patno::varchar(50) as patient_id -- 환자번호
, ordtable::varchar as order_tb -- 처방테이블
, admtime::timestamp as medical_dt -- 진료일시
, orddate::timestamp as order_dt -- 처방일시
, ordseqno::varchar(50) as order_seq -- 처방순번
, ordcode::varchar(50) as order_cd -- 처방코드
, sugacode::varchar(50) as order_sub_cd -- 처방코드
, pattyp::varchar(10) as insurance_gb -- 보험구분
, patfg::varchar(10) as visit_gb -- 내원구분
, a.meddept::varchar(50) as medical_dept -- 진료과
, ownamt::numeric as patient_pay_amt -- 환자부담금
, reqamt::numeric as insurance_pay_amt -- 공단부담금
, totamt::numeric as total_pay_amt -- 총액
, c24::varchar as cost_gb -- 비용구분
, drg_gb::varchar(1) as drg_gb -- DRG구분
, c33::varchar(50) as drg_cd -- DRG코드
, 'won'::varchar(10) as currency -- 화폐단위
, 'N'::varchar(10) as cancel_yn -- 취소여부
, '입원 계산 내역'::varchar(10) as reference_gb
, edittime::timestamp as lastupdate_dt
FROM (
SELECT b.patno
, b.admtime::timestamp::text
, '[DRG]' ordtable
, NULL orddate
, NULL ordseqno
, NULL ordcode
, CASE
WHEN c.seq = '0' THEN a.btotamt::numeric + a.selamt::numeric - a.totdietamt::numeric - a.suraddamt::numeric - a.sonicamt::numeric
WHEN c.seq = '1' THEN a.totdietamt::numeric
WHEN c.seq = '2' THEN a.suraddamt::numeric
WHEN c.seq = '3' THEN a.sonicamt::numeric
END
totamt -- 총금액
, CASE
WHEN c.seq = '0' THEN
a.reqamt::numeric
+ a.reqselamt::numeric
- (a.totdietamt::numeric - a.owndietamt::numeric)
- (a.suraddamt::numeric - a.ownsuraddamt::numeric)
- (a.sonicamt::numeric - a.ownsonicamt::numeric)
WHEN c.seq = '1' THEN
a.totdietamt::numeric - a.owndietamt::numeric
WHEN c.seq = '2' THEN
a.suraddamt::numeric - a.ownsuraddamt::numeric
WHEN c.seq = '3' THEN
a.sonicamt::numeric - a.ownsonicamt::numeric
END
reqamt -- 조합부담
, CASE
WHEN c.seq = '0' THEN a.ownamt::numeric + a.ownselamt::numeric - a.owndietamt::numeric - a.ownsuraddamt::numeric - a.ownsonicamt::numeric
WHEN c.seq = '1' THEN a.owndietamt::numeric
WHEN c.seq = '2' THEN a.ownsuraddamt::numeric
WHEN c.seq = '3' THEN a.ownsonicamt::numeric
END
ownamt -- 환자부담
, a.pattyp --23:건강보험 insurance_gb
, '포괄수가진료비' c24 -- cost_gb
, 'Y' drg_gb
, a.drgno c33 --drg_cd
, a.patfg
, NULL AS sugacode
, a.edittime::timestamp::text
, null as meddept --
FROM ods_daily.airdrpat a, ods_daily.apchangt b, (select seq FROM generate_series(0, 3) AS seq) c
WHERE 1=1
-- a.patno = :patno
--AND a.admtime = TO_DATE (:admtime, 'yyyy-mm-dd hh24:mi')
AND a.jobstat = 'P'
AND a.patno = b.patno
AND a.admtime = b.admtime
AND a.pattyp = b.pattyp
AND a.typecd = b.typecd
AND a.fromdate = b.fromdate
union all
SELECT
a.patno
, a.admtime
, a.ordtable
, a.orddate::date as orddate
, a.ordseqno
, a.ordcode
, CASE
WHEN coalesce (a.drgyn, 'N') = 'N'
OR coalesce (jobstat, 'S') <> 'P' THEN
a.rcpamt::numeric
ELSE
CASE
WHEN a.instyp IN ('4', '7')
AND coalesce (a.drguniyn, 'N') = 'Y' THEN --RCPAMT
CASE
WHEN a.acttyp IN ('4AM1', '4AM2', '4AM3', '4AM4')
and
coalesce ( ( SELECT 'Y'
FROM ods_daily.apipcalt
WHERE patno = a.patno
AND admtime = a.admtime
AND rejttime is null
--AND (sugacode LIKE 'LA226%' OR sugacode LIKE 'LA227%')
--20170411 KEJ LA201','LA202','LA203' ,'LA204','LA205','LA206 추가
-- AND substr(sugacode,1,5) IN ('LA226','LA227','LA201','LA202','LA203' ,'LA204','LA205','LA206')
AND (substr(sugacode,1,5) IN ('LA226','LA227') OR substr(sugacode,1,5) IN ('LA201','LA202','LA203' ,'LA204','LA205','LA206') AND (execdate::date >= to_date('20170411','yyyymmdd') OR PATNO = '2188490'))
AND pattyp = a.pattyp
AND typecd = a.typecd
AND execdate::date BETWEEN a.fromdate::date AND a.todate::date
AND coalesce(instyp,'*') NOT IN ('3')
limit 1), 'N') = 'N'
/* AND ods_daily.fn_ai_pcaexists (a.patno
, a.admtime
, 'I'
, a.pattyp
, a.typecd
, c.fromdate::date
, c.todate::date) = 'N'
*/
THEN
0
ELSE
a.rcpamt::numeric
END
ELSE
0
END
END
+ coalesce (a.spcamt::numeric, 0)
+ coalesce (a.yschaamt::numeric, 0)
totamt /* 총금액 */
--------------------------------------------------------------------------------------------------------------
, CASE
WHEN coalesce (a.drgyn, 'N') = 'N'
OR coalesce (jobstat, 'S') <> 'P' THEN
CASE
WHEN a.typecd NOT IN ('99', 'ST')
AND a.instyp IN ('0', '2', '7', '8')
AND a.ownrat::numeric <> 100 THEN
a.rcpamt::numeric * (100 - a.ownrat::numeric) / 100
ELSE
0
END
ELSE
0
END
+ coalesce (a.yschaamt::numeric, 0)
+ (a.spcamt::numeric
- coalesce (ods_daily.fc_ac_own_spcamt (a.pattyp
, a.typecd
, a.sugacode
, a.instyp
, a.acttyp
, a.actmatyp
, a.susulyn
, a.execdate::date
, a.spcamt::numeric), 0))
reqamt /* 조합부담 */
--------------------------------------------------------------------------------------------------------------
, CASE
WHEN coalesce (a.drgyn, 'N') = 'N'
OR coalesce (jobstat, 'S') <> 'P' THEN
a.rcpamt::numeric * a.ownrat::numeric / 100
ELSE --[DRG]
CASE
WHEN coalesce (a.drguniyn, 'N') = 'Y'
AND a.instyp IN ('4', '7') THEN --A.RCPAMT
CASE
WHEN a.acttyp IN ('4AM1', '4AM2', '4AM3', '4AM4')
and coalesce ((
SELECT 'Y'
FROM ods.apipcalt
WHERE patno = a.patno
AND admtime = a.admtime
AND rejttime is null
--AND (sugacode LIKE 'LA226%' OR sugacode LIKE 'LA227%')
--20170411 KEJ LA201','LA202','LA203' ,'LA204','LA205','LA206 추가
-- AND substr(sugacode,1,5) IN ('LA226','LA227','LA201','LA202','LA203' ,'LA204','LA205','LA206')
AND (substr(sugacode,1,5) IN ('LA226','LA227') OR substr(sugacode,1,5) IN ('LA201','LA202','LA203' ,'LA204','LA205','LA206') AND (execdate::date >= to_date('20170411','yyyymmdd') OR PATNO = '2188490'))
AND pattyp = a.pattyp
AND typecd = a.typecd
AND execdate::date BETWEEN a.fromdate::date AND a.todate::date
AND coalesce(instyp,'*') NOT IN ('3')
limit 1 ),'N'
) = 'N'
/*
AND ods_daily.fn_ai_pcaexists (a.patno
, a.admtime
, 'I'
, a.pattyp
, a.typecd
, c.fromdate::date
, c.todate::date) = 'N'
*/
THEN 0
ELSE
a.rcpamt::numeric
END
ELSE
0
END
END
+ coalesce (ods_daily.fc_ac_own_spcamt (a.pattyp
, a.typecd
, a.sugacode
, a.instyp
, a.acttyp
, a.actmatyp
, a.susulyn
, a.execdate::date
, a.spcamt::numeric), 0)
ownamt /* 본인부담 */
, a.pattyp /* 진료구분 */
, 'I'||lpad(a.noptvalue2::text,2,'0')
c24
/* , (SELECT codename
FROM ods_daily.cscomcdt
WHERE largecode = 'AC'
AND midgcode = 'AC017'
AND smallgcode = lpad(e.noptvalue2,2,'0'))
c24*/
, a.drgyn as drg_gb
, null c33
,a.patfg
,a.sugacode
,a.edittime
,a.meddept
FROM itfcdmpv532_daily.itf_cost_i_temp a
left join ods_daily.airdrpat r on a.patno2 = r.patno
AND a.admtime2 = r.admtime
AND a.pattyp = r.pattyp
AND a.typecd2 = r.typecd
AND a.fromdate = r.fromdate
AND r.jobstat = 'P'
WHERE 1=1
) A
;;
-----------------------------check cnt
insert into ods_daily.etl_task_check(task_grp_id, task_id, table_name, cnt)
select (SELECT last_value FROM etl_task_check_grp_id), 'itf_cost_i' , 'itf_cost_i', count(*) as cnt
from itfcdmpv532_daily.itf_cost_i ;
| true |
c813ed9619c26902b2184ccc54f9760de2ba894d | SQL | Nazira73/SQL | /Cascading Referential Integrity.sql | UTF-8 | 3,961 | 4.09375 | 4 | [] | no_license | -----------------------------------
-- Cascading Referential integrity
-----------------------------------
-- It allows to define the actions Microsoft SQL Server should take when a user attempts to delete or update a key to which an
-- existing foreign key points
Select * from tblperson
Select * from tblgender
-- ID Name EmailID GenderID
-- 1 Russell r@r.com 1
-- 2 Karan k@j.com 3
-- 3 Sara sara@s.com 2
-- 4 James j@j.com NULL
-- 5 Rahul kl@rahul.com NULL
-- 6 McCullum mc@srh.com NULL
-- 7 Raja raja@csp.com 3
-- 8 Todd t@t.com NULL
-- 9 Ben Ben@yahoo.com 2
-- 10 Joy joy@f.com 3
-- 11 Andrew a@f.com 1
-- Id Gender
-- 1 Male
-- 2 Female
-- 3 Unknown
-- If someone tries to delete a record from tblgender table where ID = 1, then record with ID = 1,5,11 in tblperson will become orphan
-- record due to foreign key relation between them
-- Microsoft SQL server by default doesnt allow to delete or update such records. In such cases Cascading referential integrity constraint
-- can be used to define the actions that MS SQL server should take.
-- There are 4 options:
-- 1. No action (Default):-
-- Throws an error, delete and update statments are rolled back
-- 2. Set Default:-
-- If someone attempts to delete or update a row to which foreign key points, then all such rows are set to default value
-- 3. Set Null:-
-- If someone attempts to delete or update a row to which foreign key points, then all such rows are set to NULL value
-- 4. Cascade:-
-- If someone attempts to delete or update a row to which foreign key points, then all such rows are also deleted or updated
---------------
-- Designer
---------------
-- Note:- Cascading referential integrity settings can be done only at the time of table defination
Delete from tblgender where Id = 1
-- Error: The DELETE statement conflicted with the REFERENCE constraint "Fk_tblperson_GenderId". The conflict occurred in database
-- "Organisation", table "dbo.tblperson", column 'GenderID'.
-- Lets make Delete rules or Update rules as Default
Delete from tblgender where Id = 2
Select * from tblperson
Select * from tblgender
-- ID Name EmailID GenderID
-- 1 Russell r@r.com 1
-- 2 Karan k@j.com 3
-- 3 Sara sara@s.com 3
-- 4 James j@j.com NULL
-- 5 Rahul kl@rahul.com 1
-- 6 McCullum mc@srh.com NULL
-- 7 Raja raja@csp.com 3
-- 8 Todd t@t.com NULL
-- 9 Ben Ben@yahoo.com 3
-- 10 Joy joy@f.com 3
-- 11 Andrew a@f.com 1
-- Id Gender
-- 1 Male
-- 3 Unknown
-- Lets make Delete rules or Update rules as Set null
Delete from tblgender where Id = 3
Select * from tblperson
Select * from tblgender
-- ID Name EmailID GenderID
-- 1 Russell r@r.com 1
-- 2 Karan k@j.com NULL
-- 3 Sara sara@s.com NULL
-- 4 James j@j.com NULL
-- 5 Rahul kl@rahul.com 1
-- 6 McCullum mc@srh.com NULL
-- 7 Raja raja@csp.com NULL
-- 8 Todd t@t.com NULL
-- 9 Ben Ben@yahoo.com NULL
-- 10 Joy joy@f.com NULL
-- 11 Andrew a@f.com 1
--Id Gender
-- 1 Male
-- Lets make Delete rules or Update rules as Cascade
Delete from tblgender where Id = 1
Select * from tblperson
Select * from tblgender
-- ID Name EmailID GenderID
-- 2 Karan k@j.com NULL
-- 3 Sara sara@s.com NULL
-- 4 James j@j.com NULL
-- 6 McCullum mc@srh.com NULL
-- 7 Raja raja@csp.com NULL
-- 8 Todd t@t.com NULL
-- 9 Ben Ben@yahoo.com NULL
-- 10 Joy joy@f.com NULL
-- Id Gender
-------------------------
-- Query
-------------------------
-- For setting up cascading referential integrity on a specific column using query we need to delete the old table and create a new
-- with CIR defination as well
-- eg:
Create table tablename
(
Column1 datatype primary key,
Column2 datatype not null,
....
....
GenderID int CONSTRAINT FK_tblPerson_GenderID FOREIGN KEY REFERENCES tblgender(Id)
ON Delete No action/cascade/Set null/Default
ON Update No action/cascade/Set null/Default
) | true |
4c4956e95951cb6eb442999b881b5e51c67d26a7 | SQL | hyndio/notebook | /Oracle常用SQL/createtablespace.sql | GB18030 | 17,636 | 2.78125 | 3 | [] | no_license |
---ļλûļɸʵʻ
--1
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO1" DATAFILE '/opt/oracle/oradata/oradb/fltinfo1a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo1b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo1c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--2
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO2" DATAFILE '/opt/oracle/oradata/oradb/fltinfo2a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo2b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo2c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--3
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO3" DATAFILE '/opt/oracle/oradata/oradb/fltinfo3a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo3b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo3c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--4
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO4" DATAFILE '/opt/oracle/oradata/oradb/fltinfo4a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo4b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo4c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--5
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO5" DATAFILE '/opt/oracle/oradata/oradb/fltinfo5a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo5b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo5c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--6
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO6" DATAFILE '/opt/oracle/oradata/oradb/fltinfo6a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo6b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo6c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--7
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO7" DATAFILE '/opt/oracle/oradata/oradb/fltinfo7a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo7b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo7c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--8
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO8" DATAFILE '/opt/oracle/oradata/oradb/fltinfo8a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo8b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo8c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--9
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO9" DATAFILE '/opt/oracle/oradata/oradb/fltinfo9a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo9b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo9c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--10
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO10" DATAFILE '/opt/oracle/oradata/oradb/fltinfo10a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo10b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo10c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--11
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO11" DATAFILE '/opt/oracle/oradata/oradb/fltinfo11a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo11b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo11c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--12
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO12" DATAFILE '/opt/oracle/oradata/oradb/fltinfo12a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo12b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo12c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--13
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO13" DATAFILE '/opt/oracle/oradata/oradb/fltinfo13a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo13b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo13c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--14
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO14" DATAFILE '/opt/oracle/oradata/oradb/fltinfo14a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo14b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo14c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--15
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO15" DATAFILE '/opt/oracle/oradata/oradb/fltinfo15a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo15b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo15c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--16
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO16" DATAFILE '/opt/oracle/oradata/oradb/fltinfo16a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo16b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo16c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--17
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO17" DATAFILE '/opt/oracle/oradata/oradb/fltinfo17a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo17b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo17c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--18
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO18" DATAFILE '/opt/oracle/oradata/oradb/fltinfo18a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo18b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo18c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--19
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO19" DATAFILE '/opt/oracle/oradata/oradb/fltinfo19a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo19b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo19c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--20
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO20" DATAFILE '/opt/oracle/oradata/oradb/fltinfo20a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo20b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo20c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--21
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO21" DATAFILE '/opt/oracle/oradata/oradb/fltinfo21a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo21b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo21c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--22
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO22" DATAFILE '/opt/oracle/oradata/oradb/fltinfo22a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo22b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo22c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--23
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO23" DATAFILE '/opt/oracle/oradata/oradb/fltinfo23a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo23b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo23c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--24
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO24" DATAFILE '/opt/oracle/oradata/oradb/fltinfo24a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo24b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo24c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--25
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO25" DATAFILE '/opt/oracle/oradata/oradb/fltinfo25a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo25b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo25c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--26
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO26" DATAFILE '/opt/oracle/oradata/oradb/fltinfo26a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo26b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo26c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--27
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO27" DATAFILE '/opt/oracle/oradata/oradb/fltinfo27a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo27b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo27c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--28
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO28" DATAFILE '/opt/oracle/oradata/oradb/fltinfo28a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo28b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo28c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--29
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO29" DATAFILE '/opt/oracle/oradata/oradb/fltinfo29a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo29b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo29c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--30
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO30" DATAFILE '/opt/oracle/oradata/oradb/fltinfo30a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo30b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo30c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
--31
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFO31" DATAFILE '/opt/oracle/oradata/oradb/fltinfo31a.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo31b.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFO1" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfo31c.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
---ռ
--ļ
CREATE SMALLFILE TABLESPACE "FLTINFOINDEX" DATAFILE '/opt/oracle/oradata/oradb/fltinfoindexa.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
--ļ
ALTER TABLESPACE "FLTINFOINDEX" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfoindexb.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFOINDEX" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfoindexc.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFOINDEX" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfoindexd.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFOINDEX" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfoindexe.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFOINDEX" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfoindexf.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
ALTER TABLESPACE "FLTINFOINDEX" ADD DATAFILE '/opt/oracle/oradata/oradb/fltinfoindexg.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;
| true |
b28a247b49a3a98ad69c0026808f6299cf725558 | SQL | Sathimantha/JPA-POS | /db-script.sql | UTF-8 | 873 | 3.90625 | 4 | [] | no_license | CREATE TABLE customer
(
id VARCHAR(10) PRIMARY KEY,
name VARCHAR(50) NOT NULL,
address VARCHAR(50) NOT NULL
);
CREATE TABLE item
(
code VARCHAR(10) PRIMARY KEY,
description VARCHAR(50) NOT NULL,
unit_price DECIMAL NOT NULL,
qty_on_hand INT NOT NULL
);
CREATE TABLE `order`
(
id VARCHAR(10) PRIMARY KEY,
date DATE NOT NULL,
customer_id VARCHAR(10) NOT NULL,
CONSTRAINT FOREIGN KEY (customer_id) REFERENCES customer (id)
);
CREATE TABLE order_detail
(
order_id VARCHAR(10) NOT NULL,
item_code VARCHAR(10) NOT NULL,
qty INT NOT NULL,
unit_price DECIMAL NOT NULL,
CONSTRAINT PRIMARY KEY (order_id, item_code),
CONSTRAINT FOREIGN KEY (order_id) REFERENCES `order` (id),
CONSTRAINT FOREIGN KEY (item_code) REFERENCES item (code)
)
| true |
b545de9a02c04244d04542211ca091b4a586ef31 | SQL | jbredow/sql-queries | /manual_reporting/new vict2 process/08 PR_VICT2_SLS_CAT.sql | UTF-8 | 12,901 | 2.578125 | 3 | [] | no_license | TRUNCATE TABLE PRICE_MGMT.PR_VICT2_SALES_MSTR_MAN;
DROP TABLE PRICE_MGMT.PR_VICT2_SALES_MSTR_MAN;
CREATE TABLE PRICE_MGMT.PR_VICT2_SALES_MSTR_MAN
NOLOGGING
AS
SELECT DISTINCT
V.YEARMONTH,
V.ACCOUNT_NUMBER,
V.ACCOUNT_NAME,
V.WAREHOUSE_NUMBER,
V.INVOICE_NUMBER_NK,
V.TYPE_OF_SALE,
V.SALESREP_NK,
V.SALESREP_NAME,
V.SHIP_VIA_NAME,
V.OML_ASSOC_INI,
V.OML_FL_INI,
V.OML_ASSOC_NAME,
V.WRITER,
V.WR_FL_INI,
V.ASSOC_NAME,
V.DISCOUNT_GROUP_NK,
V.DISCOUNT_GROUP_NAME,
V.CHANNEL_TYPE,
V.INVOICE_LINE_NUMBER,
V.MANUFACTURER,
V.PRODUCT_GK,
V.PRODUCT_NK,
V.ALT1_CODE,
V.PRODUCT_NAME,
V.STATUS,
V.SHIPPED_QTY,
V.EXT_SALES_AMOUNT,
V.EXT_AVG_COGS_AMOUNT,
V.CORE_ADJ_AVG_COST,
V.REPLACEMENT_COST,
V.UNIT_INV_COST,
V.PRICE_CODE,
--V.COST_CODE_IND,
V.PRICE_CATEGORY,
V.PRICE_CATEGORY_OVR_PR,
V.PRICE_CATEGORY_OVR_GR,
V.GR_OVR,
V.PR_OVR,
V.PRICE_FORMULA,
V.UNIT_NET_PRICE_AMOUNT,
V.UM,
V.SELL_MULT,
V.PACK_QTY,
V.LIST_PRICE,
V.MATRIX_PRICE,
V.MATRIX,
CASE
WHEN V.PRICE_CATEGORY_OVR_PR IS NOT NULL THEN V.PR_OVR
ELSE NULL
END
PR_TRIM_FORM,
CASE
WHEN V.PRICE_CATEGORY_OVR_PR IS NOT NULL
THEN
V.PR_OVR_BASIS
ELSE
NULL
END
PR_OVR_BASIS,
CASE
WHEN V.PRICE_CATEGORY_OVR_GR IS NOT NULL THEN V.GR_OVR
ELSE NULL
END
GR_TRIM_FORM,
V.ORDER_CODE,
V.SOURCE_SYSTEM,
V.CONSIGN_TYPE,
V.CUSTOMER_ACCOUNT_GK,
V.MAIN_CUSTOMER_NK,
V.CUSTOMER_NK,
V.CUSTOMER_NAME,
V.PRICE_COLUMN,
V.CUSTOMER_TYPE,
V.REF_BID_NUMBER,
V.SOURCE_ORDER,
V.ORDER_ENTRY_DATE,
V.COPY_SOURCE_HIST,
V.CONTRACT_DESCRIPTION,
V.CONTRACT_NUMBER,
V.INVOICE_DATE,
V.MASTER_VENDOR_NAME,
V.BASE_GROUP_FORM,
V.JOB_GROUP_FORM,
V.BASE_PROD_FORM,
V.JOB_PROD_FORM,
V.INVOICE_NUMBER_GK
FROM (SELECT SP_HIST.*,
GR_OVR_BASE.FORMULA
BASE_GROUP_FORM,
GR_OVR_JOB.FORMULA
JOB_GROUP_FORM,
PR_OVR_BASE.FORMULA
BASE_PROD_FORM,
PR_OVR_JOB.FORMULA
JOB_PROD_FORM,
CASE
WHEN SP_HIST.PRICE_CODE IN ('R', 'N/A', 'Q')
THEN
CASE
WHEN SP_HIST.ORDER_ENTRY_DATE BETWEEN COALESCE (
PR_OVR_JOB.INSERT_TIMESTAMP
- 1,
PR_OVR_BASE.INSERT_TIMESTAMP
- 1)
AND COALESCE (
PR_OVR_JOB.EXPIRE_DATE,
PR_OVR_BASE.EXPIRE_DATE,
SP_HIST.ORDER_ENTRY_DATE)
THEN
CASE
WHEN SP_HIST.UNIT_NET_PRICE_AMOUNT =
COALESCE (PR_OVR_JOB.MULTIPLIER,
PR_OVR_BASE.MULTIPLIER)
THEN
'OVERRIDE'
WHEN SP_HIST.UNIT_NET_PRICE_AMOUNT =
( TRUNC (
COALESCE (PR_OVR_JOB.MULTIPLIER,
PR_OVR_BASE.MULTIPLIER),
2)
+ .01)
THEN
'OVERRIDE'
WHEN SP_HIST.UNIT_NET_PRICE_AMOUNT =
(ROUND (
COALESCE (PR_OVR_JOB.MULTIPLIER,
PR_OVR_BASE.MULTIPLIER),
2))
THEN
'OVERRIDE'
WHEN SP_HIST.UNIT_NET_PRICE_AMOUNT =
( TRUNC (
COALESCE (PR_OVR_JOB.MULTIPLIER,
PR_OVR_BASE.MULTIPLIER),
1)
+ .1)
THEN
'OVERRIDE'
WHEN SP_HIST.UNIT_NET_PRICE_AMOUNT =
FLOOR (
COALESCE (PR_OVR_JOB.MULTIPLIER,
PR_OVR_BASE.MULTIPLIER))
+ 1
THEN
'OVERRIDE'
WHEN TO_CHAR (SP_HIST.UNIT_NET_PRICE_AMOUNT) =
COALESCE (PR_OVR_JOB.FORMULA,
PR_OVR_BASE.FORMULA)
THEN
'OVERRIDE'
WHEN REPLACE (SP_HIST.PRICE_FORMULA,
'0.',
'.') =
REPLACE (
COALESCE (PR_OVR_JOB.FORMULA,
PR_OVR_BASE.FORMULA),
'0.',
'.')
THEN
'OVERRIDE'
END
END
END
PRICE_CATEGORY_OVR_PR,
CASE
WHEN SP_HIST.PRICE_CODE IN ('R', 'N/A', 'Q')
THEN
CASE
WHEN SP_HIST.ORDER_ENTRY_DATE BETWEEN COALESCE (
GR_OVR_JOB.INSERT_TIMESTAMP
- 1,
GR_OVR_BASE.INSERT_TIMESTAMP
- 1)
AND COALESCE (
GR_OVR_JOB.EXPIRE_DATE,
GR_OVR_BASE.EXPIRE_DATE,
SP_HIST.ORDER_ENTRY_DATE)
THEN
CASE
WHEN REPLACE (SP_HIST.PRICE_FORMULA,
'0.',
'.') =
REPLACE (
COALESCE (GR_OVR_JOB.FORMULA,
GR_OVR_BASE.FORMULA),
'0.',
'.')
THEN
'OVERRIDE'
ELSE
NULL
END
END
END
PRICE_CATEGORY_OVR_GR,
COALESCE (PR_OVR_JOB.FORMULA, PR_OVR_BASE.FORMULA)
PR_OVR,
REPLACE (COALESCE (PR_OVR_JOB.FORMULA, PR_OVR_BASE.FORMULA),
'0.',
'.')
PR_TRIM_FORM,
COALESCE (PR_OVR_JOB.BASIS, PR_OVR_BASE.BASIS)
PR_OVR_BASIS,
COALESCE (GR_OVR_JOB.FORMULA, GR_OVR_BASE.FORMULA)
GR_OVR,
REPLACE (COALESCE (GR_OVR_JOB.FORMULA, GR_OVR_BASE.FORMULA),
'0.',
'.')
GR_TRIM_FORM,
COALESCE (PR_OVR_JOB.INSERT_TIMESTAMP,
PR_OVR_BASE.INSERT_TIMESTAMP)
PR_CCOR_CREATE,
COALESCE (PR_OVR_JOB.EXPIRE_DATE, PR_OVR_BASE.EXPIRE_DATE)
PR_CCOR_EXPIRE,
COALESCE (GR_OVR_JOB.INSERT_TIMESTAMP,
GR_OVR_BASE.INSERT_TIMESTAMP)
GR_CCOR_CREATE,
COALESCE (GR_OVR_JOB.EXPIRE_DATE, GR_OVR_BASE.EXPIRE_DATE)
GR_CCOR_EXPIRE,
COALESCE (PR_OVR_JOB.INSERT_TIMESTAMP,
GR_OVR_JOB.INSERT_TIMESTAMP,
PR_OVR_BASE.INSERT_TIMESTAMP,
GR_OVR_BASE.INSERT_TIMESTAMP)
CCOR_CREATE,
COALESCE (PR_OVR_JOB.EXPIRE_DATE,
GR_OVR_JOB.EXPIRE_DATE,
PR_OVR_BASE.EXPIRE_DATE,
GR_OVR_BASE.EXPIRE_DATE)
CCOR_EXPIRE,
LB.LINEBUY_NAME,
DG.DISCOUNT_GROUP_NAME,
MV.MASTER_VENDOR_NAME,
CORE.COST_CODE_IND,
CORE.VENDOR_NAME,
CORE.VENDOR_AGREEMENT,
CORE.CONTRACT_NAME,
CORE.SUBLINE_QTY,
CORE.SUBLINE_COST,
CORE.CLAIM_AMOUNT
FROM PRICE_MGMT.PR_VICT2_SALES_MAN SP_HIST
LEFT OUTER JOIN DW_FEI.DISCOUNT_GROUP_DIMENSION DG
ON SP_HIST.DISCOUNT_GROUP_NK = DG.DISCOUNT_GROUP_NK
LEFT OUTER JOIN DW_FEI.LINE_BUY_DIMENSION LB
ON SP_HIST.LINEBUY_NK = LB.LINEBUY_NK
LEFT OUTER JOIN DW_FEI.MASTER_VENDOR_DIMENSION MV
ON SP_HIST.MANUFACTURER = MV.MASTER_VENDOR_NK
LEFT OUTER JOIN PRICE_MGMT.GR_OVR_JOB
ON ( SP_HIST.DISCOUNT_GROUP_NK =
(LTRIM (GR_OVR_JOB.DISC_GROUP, '0'))
AND SP_HIST.ACCOUNT_NUMBER = GR_OVR_JOB.BRANCH_NUMBER_NK
AND SP_HIST.CUSTOMER_ACCOUNT_GK = GR_OVR_JOB.CUSTOMER_GK
AND NVL (SP_HIST.CONTRACT_NUMBER, 'DEFAULT_MATCH') =
NVL (GR_OVR_JOB.CONTRACT_ID, 'DEFAULT_MATCH'))
LEFT OUTER JOIN PRICE_MGMT.GR_OVR_BASE
ON ( SP_HIST.DISCOUNT_GROUP_NK =
(LTRIM (GR_OVR_BASE.DISC_GROUP, '0'))
AND SP_HIST.ACCOUNT_NUMBER =
GR_OVR_BASE.BRANCH_NUMBER_NK
AND SP_HIST.MAIN_CUSTOMER_NK = GR_OVR_BASE.CUSTOMER_NK
AND NVL (SP_HIST.CONTRACT_NUMBER, 'DEFAULT_MATCH') =
NVL (GR_OVR_BASE.CONTRACT_ID, 'DEFAULT_MATCH'))
LEFT OUTER JOIN PRICE_MGMT.PR_OVR_JOB
ON ( SP_HIST.PRODUCT_NK = PR_OVR_JOB.MASTER_PRODUCT
AND SP_HIST.ACCOUNT_NUMBER = PR_OVR_JOB.BRANCH_NUMBER_NK
AND SP_HIST.CUSTOMER_ACCOUNT_GK = PR_OVR_JOB.CUSTOMER_GK
AND NVL (SP_HIST.CONTRACT_NUMBER, 'DEFAULT_MATCH') =
NVL (PR_OVR_JOB.CONTRACT_ID, 'DEFAULT_MATCH'))
LEFT OUTER JOIN PRICE_MGMT.PR_OVR_BASE
ON ( SP_HIST.PRODUCT_NK = PR_OVR_BASE.MASTER_PRODUCT
AND SP_HIST.ACCOUNT_NUMBER =
PR_OVR_BASE.BRANCH_NUMBER_NK
AND SP_HIST.MAIN_CUSTOMER_NK = PR_OVR_BASE.CUSTOMER_NK
AND NVL (SP_HIST.CONTRACT_NUMBER, 'DEFAULT_MATCH') =
NVL (PR_OVR_BASE.CONTRACT_ID, 'DEFAULT_MATCH'))
LEFT OUTER JOIN PRICE_MGMT.CORE_CLAIM_VDR CORE
ON SP_HIST.INVOICE_NUMBER_GK = CORE.INVOICE_NUMBER_GK
AND SP_HIST.INVOICE_LINE_NUMBER = CORE.INVOICE_LINE_NUMBER)
V
WHERE TRUNC (V.INVOICE_DATE) >= (SYSDATE - 8);
--GRANT SELECT ON PRICE_MGMT.PR_VICT2_SALES_MSTR TO PUBLIC; | true |
b6724c0566bb991eb1fa9963dd8f9dd34d03b4ed | SQL | 305810827/mooc | /demo1.sql | UTF-8 | 6,162 | 3.234375 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : mysql
Source Server Version : 50725
Source Host : localhost:3306
Source Database : demo1
Target Server Type : MYSQL
Target Server Version : 50725
File Encoding : 65001
Date: 2019-07-30 16:45:46
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for chapter
-- ----------------------------
DROP TABLE IF EXISTS `chapter`;
CREATE TABLE `chapter` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`chapter_name` varchar(255) DEFAULT NULL,
`course_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKhhaina8rg7bpmg1qesiluu8vu` (`course_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of chapter
-- ----------------------------
INSERT INTO `chapter` VALUES ('1', '1', '1');
-- ----------------------------
-- Table structure for course
-- ----------------------------
DROP TABLE IF EXISTS `course`;
CREATE TABLE `course` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`course_name` varchar(255) DEFAULT NULL,
`describe1` varchar(255) DEFAULT NULL,
`difficulty` varchar(255) DEFAULT NULL,
`lecturer` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of course
-- ----------------------------
INSERT INTO `course` VALUES ('1', '11', '11', '11', '11');
-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
`role_id` int(2) NOT NULL AUTO_INCREMENT,
`auth` varchar(255) NOT NULL,
`role_name` varchar(255) NOT NULL,
PRIMARY KEY (`role_id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of role
-- ----------------------------
INSERT INTO `role` VALUES ('1', 'teacher', 'teacher');
INSERT INTO `role` VALUES ('2', 'student', 'student');
INSERT INTO `role` VALUES ('3', 'admin', 'admin');
-- ----------------------------
-- Table structure for section
-- ----------------------------
DROP TABLE IF EXISTS `section`;
CREATE TABLE `section` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`link` varchar(255) DEFAULT NULL,
`picture` varchar(255) DEFAULT NULL,
`section_content` varchar(255) DEFAULT NULL,
`section_name` varchar(255) DEFAULT NULL,
`chapter_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK4ce3ouca101jd5h6xsa3f15pf` (`chapter_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of section
-- ----------------------------
INSERT INTO `section` VALUES ('1', '11', '11', '11', '11', '1');
-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of student
-- ----------------------------
INSERT INTO `student` VALUES ('1', '12345', '12345');
INSERT INTO `student` VALUES ('2', '123456', '123456');
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`email` varchar(50) NOT NULL,
`enabled` bit(1) NOT NULL,
`firstname` varchar(50) NOT NULL,
`lastpasswordresetdate` datetime NOT NULL,
`lastname` varchar(50) NOT NULL,
`password` varchar(100) NOT NULL,
`username` varchar(50) NOT NULL,
`role_role_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_sb8bbouer5wak8vyiiy4pf2bx` (`username`),
KEY `FKs2ym81xl98n65ndx09xpwxm66` (`role_role_id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('2', '305810827@qq.com', '', '1234', '2019-07-28 20:11:46', '1234', '$2a$10$u8cEsrGor339pr6Gh.RaXuawODgHGHLMJSQ9w5KE0y.STaH0oG03y', '123', '2');
INSERT INTO `user` VALUES ('3', '305810827@qq.com', '', 'tatata', '2019-07-28 20:20:57', 'tatata', '$2a$10$igCrg/cGZb4Dg5JzsJMdDeCvqLRd0aMBklzsftKHM4gN5EwS0aW.G', '3333', '1');
INSERT INTO `user` VALUES ('4', '305810827@qq.com', '', 'tatata', '2019-07-28 20:24:20', 'tatata', '$2a$10$yzSwZ2SPdgG3moi6gIsAAuaj6XF/b.E2snAsWd2FDKtFMLL0jZmym', '2222', '3');
INSERT INTO `user` VALUES ('5', '305810827@qq.com', '', '123', '2019-07-28 22:35:40', '123', '$2a$10$.MGBChPNse0gTVtZdF/a7OgjUzDjuYMML4UHU.5J2JeOsUxorONuy', '12344', '3');
INSERT INTO `user` VALUES ('6', '305810827@qq.com', '', 'tatata', '2019-07-28 22:36:45', 'tatata', '$2a$10$/gOUOWDK6cTyCpImsH4wve6NnfgNWxF6SY0XYOw0LDHwhnkAzMHiW', '123445', '1');
INSERT INTO `user` VALUES ('7', '305810827@qq.com', '', '213', '2019-07-28 22:53:10', '213', '$2a$10$sXuQWLxdgGDPXpLWo1N2Keb3DTG1BixatTjZhTX7ylru60h/y/IQC', '231321', '2');
INSERT INTO `user` VALUES ('8', '305810827@qq.com', '', '123', '2019-07-29 17:53:05', '123', '$2a$10$.8ZARQ94cgrEWe0OmNqHe.7ZWgtcA7bZt0M5wvf/Rq5fP4ozMZWsm', '222111', '2');
INSERT INTO `user` VALUES ('9', '305810827@qq.com', '', '11', '2019-07-29 22:42:32', '11', '$2a$10$IU.YGqh6ycEKZ5.Ep8uZBObuSvgnqy5K6zv/WP1vFDpsaIS8BruP6', '12345', '2');
INSERT INTO `user` VALUES ('10', '305810827@qq.com', '', '5555', '2019-07-29 22:58:36', '5555', '$2a$10$FxO/krQ0sWwSOn4qHaoRSu4fPxXCAgnNQN.DtrQvN8nayFYbPuROS', '5555', '1');
-- ----------------------------
-- Table structure for video
-- ----------------------------
DROP TABLE IF EXISTS `video`;
CREATE TABLE `video` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`video` varchar(255) DEFAULT NULL,
`videoname` varchar(255) DEFAULT NULL,
`videopicture` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of video
-- ----------------------------
INSERT INTO `video` VALUES ('1', '11', '11', '111');
| true |
7199e87a2c3bbdd2ce833c9d86438fb00cefad84 | SQL | HelbertMonteiro/sd_ThorEnt | /BD_Tracker/scp_thorent.sql | UTF-8 | 462 | 3.359375 | 3 | [] | no_license | create database ThorEnt;
use ThorEnt;
create table Peer(
ip char(15) primary key
);
create table Arquivo(
hashArquivo char(33) not null,
nome char(150) not null,
tamanhoArquivo double not null,
tamanhoVetor int not null,
ip char(15) not null,
primary key Arquivo(hashArquivo, ip),
constraint fk_arquivo_peer foreign key Arquivo (ip) references Peer (ip)
on update cascade
on delete cascade
); | true |
6558c2053d1ca3a04cc9ff8f0eaa8f1058c99e6f | SQL | radtek/Telecommunication | /GSM/DataBase/www/REPORT_BALANCE.sql | WINDOWS-1251 | 2,570 | 3.484375 | 3 | [] | no_license | CREATE OR REPLACE PROCEDURE REPORT_BALANCE(
SESSION_ID IN VARCHAR2,
PHONE_NUMBER IN VARCHAR2
) IS
--#Version=1
--
-- 1. . 22.08.11.
--
pDATE_ROWS DBMS_SQL.DATE_TABLE;
pCOST_ROWS DBMS_SQL.NUMBER_TABLE;
pDESCRIPTION_ROWS DBMS_SQL.VARCHAR2_TABLE;
PRIXOD NUMBER;
RASXOD NUMBER;
--
BEGIN
G_STATE.PRINT_EXCEL_HEADERS:=TRUE;
IF SESSION_ID IS NOT NULL THEN
G_STATE.TITLE := ' ' || PHONE_NUMBER || ' ' || TO_CHAR(SYSDATE,'DD.MM.YY');
PRINT_EXCEL_HEADER(G_STATE.TITLE || '.xls');
-- 3
G_STATE.EXCEL_FREEZE_ROWS := 2;
S_BEGIN(SESSION_ID=>SESSION_ID);
IF G_STATE.USER_ID IS NOT NULL THEN
HTP.PRINT('<h2>' || G_STATE.TITLE || '</h2><br>');
PRIXOD:=0;
RASXOD:=0;
SQL_GET_ABONENT_BALANCE_ROWS(
G_STATE.USER_ID,
SYSDATE,
pDATE_ROWS,
pCOST_ROWS,
pDESCRIPTION_ROWS
);
IF pDATE_ROWS.COUNT = 0 THEN
HTP.PRINT('
<center><i><b> .</b></i></center>');
ELSE
HTP.PRINT('
<BR>
<TABLE BORDER=1 WIDTH=1000>
<COLGROUP SPAN=1 ALIGN=CENTER>
<COLGROUP SPAN=2 ALIGN=RIGHT>
<COLGROUP SPAN=1 ALIGN=LEFT>
<TR>
<TH align=center WIDTH=100></TH>
<TH align=center WIDTH=100></TH>
<TH align=center WIDTH=100></TH>
<TH align=center></TH>
</TR>');
FOR I IN pDATE_ROWS.FIRST..pDATE_ROWS.LAST LOOP
IF pCOST_ROWS(I)<0
THEN
HTP.PRINT('
<TR>
<TD>' || TO_CHAR(pDATE_ROWS(I), 'DD.MM.YYYY') || '</TD>
<TD></TD>
<TD>' || COST_TO_CHAR(pCOST_ROWS(I)) || '</TD>
<TD>' || pDESCRIPTION_ROWS(I) || '</TD>
</TR>');
RASXOD:=RASXOD+pCOST_ROWS(I);
ELSE
HTP.PRINT('
<TR>
<TD>' || TO_CHAR(pDATE_ROWS(I), 'DD.MM.YYYY') || '</TD>
<TD>' || COST_TO_CHAR(pCOST_ROWS(I)) || '</TD>
<TD></TD>
<TD>' || pDESCRIPTION_ROWS(I) || '</TD>
</TR>');
PRIXOD:=PRIXOD+pCOST_ROWS(I);
END IF;
END LOOP;
HTP.PRINT('
<TR>
<TD><b>:</b></TD>
<TD><b>' || COST_TO_CHAR(PRIXOD) || '</b></TD>
<TD><b>' || COST_TO_CHAR(RASXOD) || '</b></TD>
<TD></TD>
</TR>
<TR>
<TD COLSPAN=><b>:</b></TD>
<TD><b>' || COST_TO_CHAR(PRIXOD+RASXOD) || '</b></TD>
</TR>
</TABLE>');
END IF;
END IF;
END IF;
S_END;
G_STATE.PRINT_EXCEL_HEADERS:=FALSE;
END;
/
| true |
7227c537e0bf6eb96694e8cce2b59d89799afd8d | SQL | sophiemw898/Algorithm_Basic | /DataBase/1075. Project Employees I.sql | UTF-8 | 201 | 3.4375 | 3 | [] | no_license | # Write your MySQL query statement below
select project_id, round(avg(experience_years),2) as average_years
from Project join Employee
on Project.employee_id = Employee.employee_id
group by project_id
| true |
61e6c9cf9c352eb09dab121268c5f9349f2a7392 | SQL | z1441275629/yiguo1 | /商品表和购物车表.sql | UTF-8 | 812 | 2.515625 | 3 | [] | no_license | --商品表
create table goodsInfo
(
goodsId varchar(10) primary key,
goodsName varchar(100),
goodsType varchar(20),
goodsPrice float,
goodsCount int,
goodsDesc varchar(100),
goodsImg varchar(100),
beiyong1 varchar(100),
beiyong2 varchar(100),
beiyong3 varchar(100),
beiyong4 varchar(100),
beiyong5 varchar(100),
beiyong6 varchar(100),
beiyong7 varchar(100),
beiyong8 varchar(100),
beiyong9 varchar(100),
beiyong10 varchar(100),
beiyong11 varchar(100),
beiyong12 varchar(100),
beiyong13 varchar(100)
);
--购物车表
create table shoppingCart(
vipName varchar(10),
goodsId varchar(10),
goodsCount int
);
select * from shoppingCart | true |
061e2c6814a7236135a50c7a01841e380ad63868 | SQL | janaprasanna/Library-Mgmt-APP-DEV | /dbmodel.sql | UTF-8 | 1,024 | 3.59375 | 4 | [] | no_license | create database master ;
use master;
/*for students */
create table users(id integer primary key auto_increment, name varchar(20), email varchar(20), password varchar(20) );
create table studentbooks_inventory(BookID integer primary key, BookName varchar(20),
TotalBooksBorrowed integer, ReturnDate date,Total_tokens integer,
Available_Tokens integer);
create table borrow_books(book_id integer primary key, student_id integer,
Book_Name varchar(20), Book_Count integer);
/* for admin */
create table adminbooks_inventory(BookID integer primary key, BookName varchar(20) ,
TotalBookCount integer, TotalBooksIssued integer, TotalBooksRegistered integer);
create table admin(admin_id integer primary key,admin_name varchar(20),admin_email varchar(20),admin_password varchar(20));
create table issue_books(student_id integer, book_id integer, issue_date date,\
return_date date, book_count integer,foreign key(student_id) references users(id),\
foreign key(book_id) references adminbooks_inventory(BookID));
| true |
690c0ab6ae3cae7c64c179756784100b59fbb18d | SQL | tiagobarretomc/transmetaisWeb | /scripts/movimentacao_despesa.sql | UTF-8 | 606 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | CREATE TABLE `transmetais`.`movimentacao_despesa` (
`movimentacao_id` BIGINT(20) NOT NULL,
`despesa_id` BIGINT(20) NOT NULL,
PRIMARY KEY (`movimentacao_id`, `despesa_id`),
INDEX `fk_movimentacao_despesa_despesa_idx` (`despesa_id` ASC),
CONSTRAINT `fk_movimentacao_despesa_despesa`
FOREIGN KEY (`despesa_id`)
REFERENCES `transmetais`.`despesa` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_movimentacao_despesa_movimentacao`
FOREIGN KEY (`movimentacao_id`)
REFERENCES `transmetais`.`movimentacao` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
| true |
7d9e13eaa595e1940929419e0e8597d3088dde18 | SQL | luhm2017/neo4j | /data/sql/version1/twodegree/antiFraudTwoDegree_device_myphone.sql | UTF-8 | 17,362 | 3.6875 | 4 | [] | no_license | use knowledge_graph;
--根据二度取关联数据,增加时间日期 , 通配符统一替换关联边
create table temp_degree2_relation_data_device_myphone as
SELECT a.order_id_src,
a.apply_date_src ,
a.cert_no_src,
a.order_id_dst2,
a.apply_date_dst2,
a.cert_no_dst2
FROM fqz.fqz_relation_degree2 a
join temp_contract_data b on a.order_id_src = b.order_id
where edg_type_src1 = 'DEVICE' and edg_type_src2 = 'MYPHONE'
--and a.cert_no_src <> a.cert_no_dst2
GROUP BY
a.order_id_src,
apply_date_src,
a.cert_no_src,
a.order_id_dst2,
apply_date_dst2,
a.cert_no_dst2;
--添加源订单,根据时间范围扩展
create table temp_degree2_relation_data_src_device_myphone as
select
tab.order_id_src,tab.apply_date_src,tab.cert_no_src,
tab.order_id_src as order_id_dst2,tab.apply_date_src as apply_date_dst2, tab.cert_no_src as cert_no_dst2 from
(select a.order_id_src,a.apply_date_src,a.cert_no_src from temp_degree2_relation_data_device_myphone a group by a.order_id_src,a.apply_date_src,a.cert_no_src) tab
union all
select a.order_id_src,a.apply_date_src,a.cert_no_src,a.order_id_dst2,a.apply_date_dst2,a.cert_no_dst2
from temp_degree2_relation_data_device_myphone a;
--关联订单属性 ,增加关联订单号、时间
create table temp_degree2_relation_data_attribute_device_myphone as
select
a.order_id_src,
a.apply_date_src,
a.cert_no_src,
a.order_id_dst2,
a.apply_date_dst2,
--a.cert_no_dst2,
b.loan_pan as loan_pan_dst2,
b.cert_no as cert_no_dst2,
b.email as email_dst2,
b.mobile as mobile_dst2,
regexp_replace(b.comp_phone,'[^0-9]','') as comp_phone_dst2,
b.emergency_contact_mobile as emergency_contact_mobile_dst2,
b.contact_mobile as contact_mobile_dst2,
b.device_id as device_id_dst2,
b.product_name as product_name_dst2,
case when b.product_name = '易分期' then 1 else 0 end as yfq_dst2,
case when b.product_name = '替你还' then 1 else 0 end as tnh_dst2,
case when b.type = 'pass' then 1 else 0 end as pass_contract_dst2,
case when b.performance = 'q_refuse' then 1 else 0 end as q_refuse_dst2,
case when b.current_due_day <=0 then 1 else 0 end as current_overdue0_dst2,
case when b.current_due_day >3 then 1 else 0 end as current_overdue3_dst2,
case when b.current_due_day >30 then 1 else 0 end as current_overdue30_dst2,
case when b.history_due_day <=0 then 1 else 0 end as history_overdue0_dst2,
case when b.history_due_day >3 then 1 else 0 end as history_overdue3_dst2,
case when b.history_due_day >30 then 1 else 0 end as history_overdue30_dst2
from temp_degree2_relation_data_src_device_myphone a
join fqz.fqz_knowledge_graph_data_external b on a.order_id_dst2 = b.order_id;
--================================================================================================
--指标统计
--================================================================================================
--订单合同表现指标
FROM (select * from temp_degree2_relation_data_attribute_device_myphone where order_id_src <> order_id_dst2 ) a
INSERT OVERWRITE TABLE degree2_features partition (title='order_cnt_device_myphone') --二度含自身订单数量,
SELECT a.order_id_src, count(distinct a.order_id_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='pass_contract_cnt_device_myphone') --二度含自身通过合同数量
SELECT a.order_id_src, sum(a.pass_contract_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='q_order_cnt_device_myphone') --二度含自身Q标订单数量
SELECT a.order_id_src, sum(a.q_refuse_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='current_overdue0_contract_cnt_device_myphone') --二度含自身当前无逾期合同数量
select a.order_id_src, sum(a.current_overdue0_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='current_overdue3_contract_cnt_device_myphone') --二度含自身当前3+合同数量
select a.order_id_src, sum(a.current_overdue3_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='current_overdue30_contract_cnt_device_myphone') --二度含自身当前30+合同数量
select a.order_id_src, sum(a.current_overdue30_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='history_overdue0_contract_cnt_device_myphone') --二度含自身历史无逾期合同数量
select a.order_id_src, sum(a.history_overdue0_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='history_overdue3_contract_cnt_device_myphone') --二度含自身历史3+合同数量
select a.order_id_src, sum(a.history_overdue3_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='history_overdue30_contract_cnt_device_myphone') --二度含自身历史30+合同数量
select a.order_id_src, sum(a.history_overdue30_dst2) cnt group by a.order_id_src;
--关联边指标,区别于订单合同表现指标(包含原始订单)
FROM (select * from temp_degree2_relation_data_attribute_device_myphone) a
INSERT OVERWRITE TABLE degree2_features partition (title='cid_cnt_device_myphone') --二度含自身身份证数量
SELECT a.order_id_src, count(distinct a.cert_no_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='mobile_cnt_device_myphone') --二度含自身手机号数量
select a.order_id_src, count(distinct a.mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='bankcard_cnt_device_myphone') --二度含自身银行卡数量
select a.order_id_src, count(distinct a.loan_pan_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='imei_cnt_device_myphone') --二度含自身IMEI数量
select a.order_id_src, count(distinct a.device_id_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='email_cnt_device_myphone') --二度含自身Email数量
select a.order_id_src, count(distinct a.email_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='contact_mobile_cnt_device_myphone') --二度含自身联系人手机数量
select a.order_id_src, count(distinct a.contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='emergency_mobile_cnt_device_myphone') --二度含自身紧联手机数量
select a.order_id_src, count(distinct a.emergency_contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='company_phone_cnt_device_myphone') --二度含自身单电数量
select a.order_id_src, count(distinct a.comp_phone_dst2) cnt group by a.order_id_src
--申请产品指标
INSERT OVERWRITE TABLE degree2_features partition (title='product_cnt_device_myphone') --二度含自身总产品数
select a.order_id_src, count(distinct a.product_name_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='yfq_cnt_device_myphone') --二度含自身yfq数量
select a.order_id_src, sum(a.yfq_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='tnh_cnt_device_myphone') --二度含自身tnh数量
select a.order_id_src, sum(a.tnh_dst2) cnt group by a.order_id_src ;
--关联边小图指标,按时间1\3\7\30切片
--===================================================================================================
FROM (select * from temp_degree2_relation_data_attribute_device_myphone where datediff(apply_date_src,apply_date_dst2) <= 1) a
INSERT OVERWRITE TABLE degree2_features partition (title='cid_cnt1_device_myphone') --二度含自身身份证数量
SELECT a.order_id_src, count(distinct a.cert_no_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='mobile_cnt1_device_myphone') --二度含自身手机号数量
select a.order_id_src, count(distinct a.mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='bankcard_cnt1_device_myphone') --二度含自身银行卡数量
select a.order_id_src, count(distinct a.loan_pan_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='imei_cnt1_device_myphone') --二度含自身IMEI数量
select a.order_id_src, count(distinct a.device_id_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='email_cnt1_device_myphone') --二度含自身Email数量
select a.order_id_src, count(distinct a.email_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='contact_mobile_cnt1_device_myphone') --二度含自身联系人手机数量
select a.order_id_src, count(distinct a.contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='emergency_mobile_cnt1_device_myphone') --二度含自身紧联手机数量
select a.order_id_src, count(distinct a.emergency_contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='company_phone_cnt1_device_myphone') --二度含自身单电数量
select a.order_id_src, count(distinct a.comp_phone_dst2) cnt group by a.order_id_src;
FROM (select * from temp_degree2_relation_data_attribute_device_myphone where datediff(apply_date_src,apply_date_dst2) <= 3) a
INSERT OVERWRITE TABLE degree2_features partition (title='cid_cnt3_device_myphone') --二度含自身身份证数量
SELECT a.order_id_src, count(distinct a.cert_no_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='mobile_cnt3_device_myphone') --二度含自身手机号数量
select a.order_id_src, count(distinct a.mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='bankcard_cnt3_device_myphone') --二度含自身银行卡数量
select a.order_id_src, count(distinct a.loan_pan_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='imei_cnt3_device_myphone') --二度含自身IMEI数量
select a.order_id_src, count(distinct a.device_id_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='email_cnt3_device_myphone') --二度含自身Email数量
select a.order_id_src, count(distinct a.email_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='contact_mobile_cnt3_device_myphone') --二度含自身联系人手机数量
select a.order_id_src, count(distinct a.contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='emergency_mobile_cnt3_device_myphone') --二度含自身紧联手机数量
select a.order_id_src, count(distinct a.emergency_contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='company_phone_cnt3_device_myphone') --二度含自身单电数量
select a.order_id_src, count(distinct a.comp_phone_dst2) cnt group by a.order_id_src;
FROM (select * from temp_degree2_relation_data_attribute_device_myphone where datediff(apply_date_src,apply_date_dst2) <= 7) a
INSERT OVERWRITE TABLE degree2_features partition (title='cid_cnt7_device_myphone') --二度含自身身份证数量
SELECT a.order_id_src, count(distinct a.cert_no_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='mobile_cnt7_device_myphone') --二度含自身手机号数量
select a.order_id_src, count(distinct a.mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='bankcard_cnt7_device_myphone') --二度含自身银行卡数量
select a.order_id_src, count(distinct a.loan_pan_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='imei_cnt7_device_myphone') --二度含自身IMEI数量
select a.order_id_src, count(distinct a.device_id_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='email_cnt7_device_myphone') --二度含自身Email数量
select a.order_id_src, count(distinct a.email_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='contact_mobile_cnt7_device_myphone') --二度含自身联系人手机数量
select a.order_id_src, count(distinct a.contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='emergency_mobile_cnt7_device_myphone') --二度含自身紧联手机数量
select a.order_id_src, count(distinct a.emergency_contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='company_phone_cnt7_device_myphone') --二度含自身单电数量
select a.order_id_src, count(distinct a.comp_phone_dst2) cnt group by a.order_id_src;
FROM (select * from temp_degree2_relation_data_attribute_device_myphone where datediff(apply_date_src,apply_date_dst2) <= 30) a
INSERT OVERWRITE TABLE degree2_features partition (title='cid_cnt30_device_myphone') --二度含自身身份证数量
SELECT a.order_id_src, count(distinct a.cert_no_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='mobile_cnt30_device_myphone') --二度含自身手机号数量
select a.order_id_src, count(distinct a.mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='bankcard_cnt30_device_myphone') --二度含自身银行卡数量
select a.order_id_src, count(distinct a.loan_pan_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='imei_cnt30_device_myphone') --二度含自身IMEI数量
select a.order_id_src, count(distinct a.device_id_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='email_cnt30_device_myphone') --二度含自身Email数量
select a.order_id_src, count(distinct a.email_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='contact_mobile_cnt30_device_myphone') --二度含自身联系人手机数量
select a.order_id_src, count(distinct a.contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='emergency_mobile_cnt30_device_myphone') --二度含自身紧联手机数量
select a.order_id_src, count(distinct a.emergency_contact_mobile_dst2) cnt group by a.order_id_src
INSERT OVERWRITE TABLE degree2_features partition (title='company_phone_cnt30_device_myphone') --二度含自身单电数量
select a.order_id_src, count(distinct a.comp_phone_dst2) cnt group by a.order_id_src;
--关联边命中黑指标
INSERT OVERWRITE TABLE degree2_features partition (title='black_cid_cnt_device_myphone') --二度含自身黑身份证数量
select a.order_id_src,count(distinct a.cert_no_dst2) as cnt from temp_degree2_relation_data_attribute_device_myphone a
join fqz_black_attribute_data b on a.cert_no_dst2 = b.CONTENT
where b.type = 'black_cid' group by a.order_id_src;
INSERT OVERWRITE TABLE degree2_features partition (title='black_mobile_cnt_device_myphone') --二度含自身黑手机数量
select a.order_id_src,count(distinct a.mobile_dst2) as cnt from temp_degree2_relation_data_attribute_device_myphone a
join fqz_black_attribute_data b on a.mobile_dst2 = b.CONTENT
where b.type = 'black_mobile' group by a.order_id_src;
INSERT OVERWRITE TABLE degree2_features partition (title='black_bankcard_cnt_device_myphone') --二度含自身黑银行卡数量
select a.order_id_src,count(distinct a.loan_pan_dst2) as cnt from temp_degree2_relation_data_attribute_device_myphone a
join fqz_black_attribute_data b on a.loan_pan_dst2 = b.CONTENT
where b.type = 'black_bankcard' group by a.order_id_src;
INSERT OVERWRITE TABLE degree2_features partition (title='black_imei_cnt_device_myphone') --二度含自身黑IMEI数量
select a.order_id_src,count(distinct a.device_id_dst2) as cnt from temp_degree2_relation_data_attribute_device_myphone a
join fqz_black_attribute_data b on a.device_id_dst2 = b.CONTENT
where b.type = 'black_imei' group by a.order_id_src;
INSERT OVERWRITE TABLE degree2_features partition (title='black_email_cnt_device_myphone') --二度含自身黑Email数量
select a.order_id_src,count(distinct a.email_dst2) as cnt from temp_degree2_relation_data_attribute_device_myphone a
join fqz_black_attribute_data b on a.email_dst2 = b.CONTENT
where b.type = 'black_email' group by a.order_id_src;
INSERT OVERWRITE TABLE degree2_features partition (title='black_company_phone_cnt_device_myphone') --二度含自身黑单电数量
select a.order_id_src,count(distinct a.comp_phone_dst2) as cnt from temp_degree2_relation_data_attribute_device_myphone a
join fqz_black_attribute_data b on a.comp_phone_dst2 = b.CONTENT
where b.type = 'black_company_phone' group by a.order_id_src; --单电是否正则化处理
INSERT OVERWRITE TABLE degree2_features partition (title='black_contract_cnt_device_myphone') --二度含自身黑合同数量
select a.order_id_src,count(distinct a.order_id_dst2) as cnt from temp_degree2_relation_data_attribute_device_myphone a
join fqz_black_attribute_data b on a.order_id_dst2 = b.CONTENT
where b.type = 'black_contract' group by a.order_id_src; | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.