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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
65dfd220ead688b7400022a43a07860df4231dbf
|
SQL
|
greekbookhero/pl_sql_correct_move
|
/chess_correct.sql
|
UTF-8
| 7,561
| 3.625
| 4
|
[] |
no_license
|
SET SERVEROUTPUT ON;
CREATE OR REPLACE TYPE horizontal IS VARRAY(8) OF VARCHAR2(1);
CREATE OR REPLACE TYPE GAME_TABLE_TYPE IS VARRAY(8) OF horizontal;
CREATE OR REPLACE PROCEDURE PRINT_MATRIX (GAME_TABLE IN GAME_TABLE_TYPE) IS
BEGIN
DBMS_OUTPUT.PUT_LINE('A B C D E F G H');
for i in 1..8 loop
for j in 1..8 loop
DBMS_OUTPUT.PUT(GAME_TABLE(i)(j) || ' ' );
end loop;
DBMS_OUTPUT.PUT_LINE(i);
end loop;
DBMS_OUTPUT.PUT_LINE(' ');
END;
declare
game_table GAME_TABLE_TYPE:= GAME_TABLE_TYPE(horizontal('w','b','w','b','w','b','w','b'),horizontal('b','w','b','w','b','w','b','w'),horizontal('w','b','w','b','w','b','w','b'),horizontal('b','w','b','w','b','w','b','w'),horizontal('w','b','w','b','w','b','w','b'),horizontal('b','w','b','w','b','w','b','w'),horizontal('w','b','w','b','w','b','w','b'),horizontal('b','w','b','w','b','w','b','w'));
type_of_figure VARCHAR2(10);
horiz_start CHAR;
horiz_start_int number;
vert_start number;
horiz_end CHAR;
horiz_end_int number;
vert_end number;
start_pos game_move;
end_pos game_move;
begin
PRINT_MATRIX(game_table);
DBMS_OUTPUT.PUT_LINE('Please enter figure between');
DBMS_OUTPUT.PUT_LINE('King, Queen, Bishop, Knight, Rook, Pawn');
type_of_figure := '&type_of_figure';
horiz_start := '&horiz_start';
horiz_start_int := ASCII(lower(horiz_start))-96;
vert_start := &vert_start;
horiz_end := '&horiz_end';
horiz_end_int := ASCII(lower(horiz_end))-96;
vert_end := &vert_end;
if(vert_start>8 or horiz_start_int >8 or vert_start<0 or horiz_start_int <0) then
dbms_output.put_line('Wrong input');
else
change_pos(horiz_start, vert_start, game_table, type_of_figure);
PRINT_MATRIX(game_table);
if(isRightMove( horiz_start_int, vert_start, horiz_end_int, vert_end, type_of_figure) = true) then
change_pos(horiz_end, vert_end, game_table, type_of_figure);
print_matrix(game_table);
else
dbms_output.put_line('You cannot make this move');
end if;
end if;
end;
/
CREATE OR REPLACE PROCEDURE change_pos (horiz in number, vert in number, game_table in OUT game_table_type, figure in VARCHAR2)
IS
begin
case lower(figure)
when 'king' then
game_table(vert)(int_horiz) := 'K';
when 'queen' then
game_table(vert)(int_horiz) := 'Q';
when 'bishop' then
game_table(vert)(int_horiz) := 'B';
when 'knight' then
game_table(vert)(int_horiz) := 'k';
when 'rook' then
game_table(vert)(int_horiz) := 'r';
when 'pawn' then
game_table(vert)(int_horiz) := 'p';
else
dbms_output.put_line('error, please enter right figure name');
end case;
end;
CREATE OR REPLACE FUNCTION pawn (horiz_start_int in number, vert_start in number, horiz_end_int in number, vert_end in number)
RETURN BOOLEAN
IS
horiz_diff number;
vert_diff number;
BEGIN
horiz_diff := (horiz_start_int-horiz_end_int);
vert_diff := (vert_start-vert_end);
if ( horiz_diff = 0 and vert_diff = 1 ) then
return true;
else
return false;
end if;
end;
CREATE OR REPLACE FUNCTION rook (horiz_start_int in number, vert_start in number, horiz_end_int in number, vert_end in number)
RETURN BOOLEAN
IS
horiz_diff number;
vert_diff number;
BEGIN
horiz_diff := (horiz_start_int-horiz_end_int);
vert_diff := (vert_start-vert_end);
if ( horiz_diff = 0 and vert_diff < 9 ) then
return true;
elsif(vert_diff = 0 and horiz_diff < 9) then
return true;
else
return false;
end if;
end;
CREATE OR REPLACE FUNCTION knight (horiz_start_int in number, vert_start in number, horiz_end_int in number, vert_end in number)
RETURN BOOLEAN
IS
horiz_diff number;
vert_diff number;
BEGIN
horiz_diff := ABS(horiz_start_int-horiz_end_int);
vert_diff := ABS(vert_start-vert_end);
if ( horiz_diff = 1 and vert_diff = 2 ) then
return true;
ELSIF ( horiz_diff = 2 and vert_diff = 1 ) then
return true;
elsif(vert_diff = 2 and horiz_diff = 1) then
return true;
elsif(vert_diff = 1 and horiz_diff = 2) then
return true;
else
return false;
end if;
end;
CREATE OR REPLACE FUNCTION bishop (horiz_start_int in number, vert_start in number, horiz_end_int in number, vert_end in number)
RETURN BOOLEAN
IS
horiz_diff number;
vert_diff number;
BEGIN
horiz_diff := ABS(horiz_start_int-horiz_diff);
vert_diff := ABS(vert_start-vert_end);
if ( vert_diff= horiz_diff ) then
return true;
else
return false;
end if;
end;
CREATE OR REPLACE FUNCTION king (horiz_start_int in number, vert_start in number, horiz_end_int in number, vert_end in number)
RETURN BOOLEAN
IS
horiz_diff number;
vert_diff number;
BEGIN
horiz_diff := ABS(horiz_start_int-horiz_end_int);
vert_diff := ABS(vert_start-vert_end);
if ( horiz_diff = 1 and vert_diff= 0 ) then
return true;
elsif ( horiz_diff = 0 and vert_diff= 1 ) then
return true;
elsif ( horiz_diff = 1 and vert_diff= 1 ) then
return true;
else
return false;
end if;
end;
CREATE OR REPLACE FUNCTION queen (horiz_start_int in number, vert_start in number, horiz_end_int in number, vert_end in number)
RETURN BOOLEAN
IS
horiz_diff number;
vert_diff number;
BEGIN
horiz_diff := ABS(horiz_start_int-horiz_end_int);
vert_diff := ABS(vert_start-vert_end);
if ( horiz_diff = 0 and vert_diff < 9 ) then
return true;
elsif(vert_diff = 0 and horiz_diff < 9) then
return true;
elsif( vert_diff = horiz_diff) then
return true;
else
return false;
end if;
end;
create or replace FUNCTION isRightMove(horiz_start_int in number, vert_start in number, horiz_end_int in number, vert_end in number, figure VARCHAR2)
return BOOLEAN
IS
begin
case lower(figure)
when 'king' then
if(king(horiz_start_int,vert_start,horiz_end_int,vert_end)) then
return true;
else
return false;
end if;
when 'queen' then
if(queen(horiz_start_int,vert_start,horiz_end_int,vert_end)) then
return true;
else
return false;
end if;
when 'bishop' then
if(bishop(horiz_start_int,vert_start,horiz_end_int,vert_end)) then
return true;
else
return false;
end if;
when 'knight' then
if(knight(horiz_start_int,vert_start,horiz_end_int,vert_end)) then
return true;
else
return false;
end if;
when 'rook' then
if(rook(horiz_start_int,vert_start,horiz_end_int,vert_end)) then
return true;
else
return false;
end if;
when 'pawn' then
if(pawn(horiz_start_int,vert_start,horiz_end_int,vert_end)) then
return true;
else
return false;
end if;
else
dbms_output.put_line('error, please write to programmer ');
end case;
end;
| true
|
f08af8287ebb99f2299dc7f53e494cfd6d52595b
|
SQL
|
WackyChomp/DBMS-Social-Network
|
/Update.sql
|
UTF-8
| 446
| 2.53125
| 3
|
[] |
no_license
|
/* 1 */
update account set bdate = null where userid ='ADMIN';
/* 2 */
update friend set fid = 'NotABot' where fid ='ADMIN';
/* 3 */
update category set categoryname = 'produce' where categoryid =1;
/* 4 */
update post set title= 'Like this ' where postid= '1000000001';
/* 5 */
update advertisement set enddate = '2020-06-25' where a_id= '#1';
/* 6 */
update company set companyname ='Wonder Bread' where companynumber ='11111111';
| true
|
f1eeefc94a510766cc53216a9cfd8f066b4e4b92
|
SQL
|
SilencedH/java
|
/project/youzule-service/src/main/resources/sql/blog/blog.sql
|
UTF-8
| 3,906
| 3.59375
| 4
|
[] |
no_license
|
DROP DATABASE IF EXISTS `blog`;
#数据库blog
CREATE DATABASE `blog`
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE blog;
#菜单表
DROP TABLE IF EXISTS menu;
CREATE TABLE menu (
code INT(2) PRIMARY KEY AUTO_INCREMENT UNIQUE COMMENT '菜单编码',
name VARCHAR(20) COMMENT '菜单名称',
create_time DATETIME COMMENT '创建时间',
create_user VARCHAR(20) COMMENT '创建人'
);
#二级菜单表
DROP TABLE IF EXISTS sub_menu;
CREATE TABLE sub_menu (
code INT(2) PRIMARY KEY AUTO_INCREMENT UNIQUE COMMENT '编号',
name VARCHAR(20) COMMENT '名称',
menu_code INT(2) COMMENT '上级菜单',
create_time DATETIME COMMENT '创建时间',
create_user VARCHAR(20) COMMENT '创建人'
);
#专题表
DROP TABLE IF EXISTS subject;
CREATE TABLE subject (
code INT(2) PRIMARY KEY AUTO_INCREMENT UNIQUE COMMENT '编号',
name VARCHAR(20) COMMENT '名称',
sub_menu_code INT(2) COMMENT '二级菜单编号',
create_time DATETIME COMMENT '创建时间',
create_user VARCHAR(20) COMMENT '创建人'
);
#关键字表
DROP TABLE IF EXISTS key_word;
CREATE TABLE key_word (
code INT(5) PRIMARY KEY AUTO_INCREMENT UNIQUE COMMENT '编号',
name VARCHAR(20) COMMENT '名称',
subject_code INT(2) COMMENT '所属专题编号',
create_time DATETIME COMMENT '创建时间',
create_user VARCHAR (20) COMMENT '创建人'
);
#文档表
DROP TABLE IF EXISTS document;
CREATE TABLE document (
code INT(8) PRIMARY KEY AUTO_INCREMENT UNIQUE COMMENT '文档编码',
title VARCHAR(32) COMMENT '文档标题',
author VARCHAR(20) COMMENT '作者',
type VARCHAR(10) COMMENT '文档类型:原创、转载',
create_time DATETIME COMMENT '文档创建时间',
create_user VARCHAR (20) COMMENT '创建人',
subject_code INT(2) COMMENT '文档所属主题编号',
content_markdown MEDIUMTEXT COMMENT '文档内容,markdown格式',
content_html MEDIUMTEXT COMMENT '文档内容,html格式',
content MEDIUMTEXT COMMENT '文档内容,纯内容文本格式',
views INT(11) COMMENT '浏览次数'
);
#文档评论表
DROP TABLE IF EXISTS comment;
CREATE TABLE comment (
code INT(8) PRIMARY KEY AUTO_INCREMENT UNIQUE COMMENT '评论编码',
document_code INT(8) COMMENT '所属文档',
name VARCHAR(32) COMMENT '评论人姓名',
email VARCHAR(32) COMMENT '评论人邮箱',
ip VARCHAR(16) COMMENT '评论人ip',
content MEDIUMTEXT COMMENT '评论内容',
create_time DATETIME COMMENT '时间'
);
#subject增加字段 document_count
ALTER TABLE `subject` ADD COLUMN document_count INT(11) DEFAULT 0;
#创建mq消息表
DROP TABLE IF EXISTS mq_message;
CREATE TABLE mq_message (
code INT(11) PRIMARY KEY AUTO_INCREMENT UNIQUE COMMENT '编号',
id VARCHAR(36) UNIQUE COMMENT 'id',
queue_name VARCHAR(20) COMMENT '队列名字',
body TEXT COMMENT '内容',
time DATETIME COMMENT '时间'
) COMMENT 'mq消息表';
#请求表
DROP TABLE IF EXISTS request;
CREATE TABLE request (
code INT(11) PRIMARY KEY AUTO_INCREMENT UNIQUE COMMENT '编号',
id VARCHAR(36) UNIQUE COMMENT 'id',
servlet_path VARCHAR(64) COMMENT '请求接口',
request_time DATETIME COMMENT '请求时间',
ip VARCHAR(16) COMMENT 'ip地址',
country VARCHAR(32) COMMENT '国家',
area VARCHAR(16) COMMENT '地区',
region VARCHAR(16) COMMENT '',
city VARCHAR(16) COMMENT '城市',
county VARCHAR(10) COMMENT '',
isp VARCHAR(10) COMMENT '运营商',
country_id VARCHAR(10) COMMENT '国家id',
area_id VARCHAR(10) COMMENT '省id',
region_id VARCHAR(10) COMMENT '地区id',
city_id VARCHAR(10) COMMENT '城市id',
county_id VARCHAR(10) COMMENT '',
isp_id VARCHAR(10) COMMENT '运营商id',
response_time DATETIME COMMENT '响应时间',
elapsed_time VARCHAR(16) COMMENT '耗时'
)COMMENT '请求信息表';
#创建uuid32位函数
/*DELIMITER //
CREATE FUNCTION uuid32()
returns VARCHAR(32)
BEGIN
declare uuid varchar(32);
SELECT replace((SELECT uuid()),'-','') into uuid;
RETURN uuid;
END//
DELIMITER ;*/
| true
|
f0efd93a03954332969cc17cde193b85259060da
|
SQL
|
MorozovAlexanderr/sql-course
|
/lab7/lab7.sql
|
UTF-8
| 5,961
| 4.125
| 4
|
[] |
no_license
|
# 1. Вивести значення наступних колонок: назва книги, ціна, назва видавництва, формат.
CREATE PROCEDURE select_books ()
SELECT b.Name,
b.Price,
p.PubName,
b.Format
FROM books AS b
JOIN publishers AS p
ON p.Id = b.PublisherId;
CALL select_books()
# 2. Вивести значення наступних колонок: тема, категорія, назва книги, назва видавництва. Фільтр по темам і категоріям.
CREATE PROCEDURE select_books_2 ()
SELECT b.Name,
t.ThemeName,
c.CatName,
p.PubName
FROM books AS b
JOIN themes as t
ON t.Id = b.ThemeId
JOIN categorys AS c
ON c.Id = b.CategoryId
JOIN publishers AS p
ON p.Id = b.PublisherId
ORDER BY t.ThemeName, c.CatName;
CALL select_books_2()
# 3. Вивести книги видавництва 'BHV', видані після 2000 р
CREATE PROCEDURE select_books_3 (IN pub_name VARCHAR(50), IN pub_year INT)
SELECT b.Name,
p.PubName
FROM books AS b
JOIN publishers AS p
ON p.Id = b.PublisherId
WHERE p.PubName = pub_name
AND YEAR(b.PublishingDate) >= pub_year;
CALL select_books_3('BHV С.-Петербург', 2000)
# 4. Вивести загальну кількість сторінок по кожній назві категорії. Фільтр по спадаючій / зростанню кількості сторінок.
CREATE PROCEDURE select_books_4 ()
SELECT c.CatName,
SUM(b.Pages) AS Pages
FROM books AS b
JOIN categorys AS c
ON c.Id = b.CategoryId
GROUP BY c.CatName
ORDER BY Pages DESC;
CALL select_books_4()
# 5. Вивести середню вартість книг по темі 'Використання ПК' і категорії 'Linux'.
CREATE PROCEDURE select_books_5 (IN t_name VARCHAR(50), IN c_name VARCHAR(50))
SELECT AVG(b.Price) AS AveragePrice,
t.ThemeName,
c.CatName
FROM books AS b
JOIN themes as t
ON t.Id = b.ThemeId
JOIN categorys AS c
ON c.Id = b.CategoryId
GROUP BY t.ThemeName, c.CatName
HAVING t.ThemeName = t_name OR c.CatName = c_name;
CALL select_books_5('Використання ПК в цілому', 'Linux')
# 6. Вивести всі дані універсального відношення.
CREATE PROCEDURE select_books_6 ()
SELECT *
FROM books AS b
JOIN themes as t
ON t.Id = b.ThemeId
JOIN categorys AS c
ON c.Id = b.CategoryId
JOIN publishers AS p
ON p.Id = b.PublisherId;
CALL select_books_6()
# 7. Вивести пари книг, що мають однакову кількість сторінок.
CREATE PROCEDURE select_books_7 ()
SELECT b1.Name AS FirstBook,
b2.Name AS SecondBook,
b1.Pages
FROM books b1, books b2
WHERE b1.Pages = b2.Pages
AND b1.N != b2.N
GROUP BY Pages;
CALL select_books_7()
# 8. Вивести тріади книг, що мають однакову ціну.
CREATE PROCEDURE select_books_8 ()
SELECT b1.Name AS FirstBook,
b2.Name AS SecondBook,
b3.Name AS ThirdBook,
b1.Price
FROM books b1, books b2, books b3
WHERE b1.Price = b2.Price
AND b1.Price = b3.Price
AND b1.N != b2.N
AND b1.N != b3.N
AND b2.N != b3.N
GROUP BY b1.Price;
CALL select_books_8()
# 9. Вивести всі книги категорії 'C ++'.
CREATE PROCEDURE select_books_9 (IN c_name VARCHAR(50))
SELECT * FROM books
WHERE CategoryId = (SELECT Id FROM categorys WHERE CatName = c_name);
CALL select_books_9('C&C++')
# 10. Вивести список видавництв, у яких розмір книг перевищує 400 сторінок.
CREATE PROCEDURE select_books_10 (IN pages INT)
SELECT * FROM publishers p
WHERE p.Id IN (SELECT Id FROM books b WHERE b.PublisherId = p.Id AND b.Pages >= pages);
CALL select_books_10(400)
# 11. Вивести список категорій за якими більше 3-х книг.
CREATE PROCEDURE select_books_11 (IN count_books INT)
SELECT * FROM categorys c
WHERE (SELECT COUNT(Id) FROM books b WHERE b.CategoryId = c.Id) >= count_books;
CALL select_books_11(3)
# 12. Вивести список книг видавництва 'BHV', якщо в списку є хоча б одна книга цього видавництва.
CREATE PROCEDURE select_books_12 (IN pub_name VARCHAR(50))
SELECT * FROM books b
WHERE EXISTS (SELECT * FROM publishers p WHERE b.PublisherId = p.Id AND p.PubName = pub_name);
CALL select_books_12('BHV С.-Петербург')
# 13. Вивести список книг видавництва 'BHV', якщо в списку немає жодної книги цього видавництва.
CREATE PROCEDURE select_books_13 (IN pub_name VARCHAR(50))
SELECT * FROM books b
WHERE NOT EXISTS (SELECT * FROM publishers p WHERE b.PublisherId = p.Id AND p.PubName = pub_name);
CALL select_books_13('BHV С.-Петербург')
# 14. Вивести відсортоване загальний список назв тем і категорій.
CREATE PROCEDURE select_books_14 ()
SELECT ThemeName AS Name
FROM themes
UNION
SELECT CatName AS Name
FROM categorys
ORDER BY Name;
CALL select_books_14()
# 15. Вивести відсортований в зворотному порядку загальний список перших слів назв книг і категорій що не повторюються
CREATE PROCEDURE select_books_15 ()
SELECT LEFT(Name, 1) AS Name
FROM books
UNION
SELECT LEFT(CatName, 1) AS Name
FROM categorys
ORDER BY Name DESC;
CALL select_books_15()
| true
|
70071d9d7362543456cb7eb3c606b448a179b243
|
SQL
|
shmiko/MASTER_SQL
|
/Script 1.sql
|
UTF-8
| 3,697
| 4.1875
| 4
|
[] |
no_license
|
PROCEDURE get_employee_info_by_employee_id
(
p_employee_id NUMBER DEFAULT -1
)
AS
-- You need to query the values you're showing into variables. The
-- variables can have the same name as the column names. Oracle won't
-- be confused by this, but I usually am - that's why I have the "v_"
-- prefix for the variable names here. Finally, when declaring the
-- variable's type, you can reference table.column%TYPE to use the
-- type of an existing column.
v_name Employee.Name%TYPE;
v_email_address Employee.Email_Address%TYPE;
v_hire_date Employee.Hire_Date%TYPE;
v_update_date Employee.Update_Date%TYPE;
BEGIN
-- Just SELECT away, returning column values into the variables. If
-- the employee ID isn't found, Oracle will throw and you can pick
-- up the pieces in the EXCEPTION block below.
SELECT Name, Email_Address, Hire_Date, Update_Date
INTO v_name, v_email_address, v_hire_date, v_update_date
FROM Employee
WHERE Employee_ID = p_employee_id;
-- Fallthrough to here means the query above found one (and only one)
-- row, and therefore it put values into the variables. Print out the
-- variables.
--
-- Also note there wasn't a v_employee_id variable defined, because
-- you can use your parameter value (p_employee_id) for that.
DBMS_OUTPUT.PUT_LINE('Employee ID: ' || p_employee_id);
DBMS_OUTPUT.PUT_LINE('NAME: ' || v_name);
DBMS_OUTPUT.PUT_LINE('EMAIL_ADDRESS: ' || v_email_address);
DBMS_OUTPUT.PUT_LINE('HIRE_DATE: ' || v_hire_date);
DBMS_OUTPUT.PUT_LINE('UPDATE_DATE: ' || v_update_date);
EXCEPTION
-- If the query didn't find a row you'll end up here. In this case
-- there's no need for any type of fancy exception handling; just
-- reporting that the employee wasn't found is enough.
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Employee number ' || p_employee_id || ' not found.');
END;
CREATE OR REPLACE PROCEDURE GROUP_CUST_GET
(gc_customer_in IN rm.rm_cust%TYPE)
AS
CURSOR gc_cur IS
SELECT r.rm_cust, r.rm_name
FROM rm r
WHERE r.rm_cust = gc_customer_in
ORDER BY r.rm_cust;
gc_rec gc_cur%ROWTYPE;
BEGIN
OPEN gc_cur;
FETCH gc_cur INTO gc_rec;
WHILE(gc_cur%FOUND)
LOOP
DBMS_OUTPUT.PUT_LINE(gc_rec.rm_cust || '-' || gc_rec.rm_name);
FETCH gc_cur INTO gc_rec;
END LOOP;
CLOSE gc_cur;
END GROUP_CUST_GET;
EXECUTE GROUP_CUST_GET('RTA')
CREATE OR REPLACE PROCEDURE GROUP_CUST_LIST
(tgc_customer_in IN rm.rm_cust%TYPE)
AS
nCheckpoint NUMBER;
CURSOR tgc_cur IS
SELECT tgc.sCust, tgc.sGroupCust
FROM Tmp_Group_Cust tgc
WHERE tgc.sCust = tgc_customer_in;
tgc_rec tgc_cur%ROWTYPE;
BEGIN
nCheckpoint := 1;
OPEN tgc_cur;
FETCH tgc_cur INTO tgc_rec;
WHILE(tgc_cur%FOUND)
LOOP
DBMS_OUTPUT.PUT_LINE(tgc_rec.sCust || ' ' || tgc_rec.sGroupCust);
FETCH tgc_cur INTO tgc_rec;
END LOOP;
CLOSE tgc_cur;
--EXECUTE IMMEDIATE 'SELECT * FROM Tmp_Group_Cust';
RETURN;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('GROUP_CUST failed at checkpoint ' || nCheckpoint ||
' with error ' || SQLCODE || ' : ' || SQLERRM);
RAISE;
END GROUP_CUST_LIST;
EXECUTE GROUP_CUST_LIST('RTA')
SELECT report_pkg.cust As Customer ,
CASE
WHEN total_orders(report_pkg.cust,report_pkg.status,report_pkg.start_date) > report_pkg.order_limit THEN total_orders(report_pkg.cust,report_pkg.status,report_pkg.start_date)
ELSE NULL
END AS "Todays Orders"
FROM RM
WHERE RM_PARENT = report_pkg.cust
GROUP BY report_pkg.cust
| true
|
0b5b304677d2ede334bb42c6837f0b9474a338c5
|
SQL
|
Dante9527-A/study
|
/month02/day09/t.sql
|
UTF-8
| 1,409
| 4.09375
| 4
|
[
"Apache-2.0"
] |
permissive
|
select sname,caption,avg(number) from
student left join class
on class.cid = student.class_id
left join score
on student.sid = score.student_id
group by sname,caption;
delimiter $$
create function st() returns int
begin
return(select score from cls where id = 1);
end $$
delimiter ;
create function st2() returns int
begin
declare a int;
declare b int;
set a = (select score from cls order by score limit 1);
select score from cls order by score desc limit 1 into b;
return a+b;
end $$
delimiter ;
create function st3(uid int) returns varchar(30)
begin
return (select name from cls where id = uid);
end $$
create function st1(uid1 int,uid2 int) returns int
begin
declare a int;
declare b int;
set a = (select score from cls where id = uid1);
select score from cls where id = uid2 into b;
return a-b;
end $$
delimiter $$
create procedure st()
begin
select name,age from cls;
select name,score from cls order by score desc;
end $$
delimiter ;
create procedure p_out (out num int)
begin
select num;
set num = 199;
select num;
end $$
delimiter $$
create procedure like_draw1(in uname varchar(30))
begin
select * from cls where name = uname;
insert into hobby (name,hobby,price) values (uname,"draw",19987.99);
end $$
delimiter ;
create table words(
id int primary key auto_increment,
word varchar(30),
mean text
);
| true
|
a09fd47c6c48eca0cba6f4094b245c311834eebb
|
SQL
|
limjun92/safe_food
|
/SafeFood_광주_3_선한빛_임준형_MySQL문.sql
|
UTF-8
| 1,463
| 3.375
| 3
|
[] |
no_license
|
create database fooddb;
use fooddb;
create table food (
code int primary key,
name varchar(30),
maker varchar(30),
material varchar(600),
image varchar(50),
supportpereat varchar(30),
calory varchar(30),
carbo varchar(30),
protein varchar(30),
fat varchar(30),
sugar varchar(30),
natrium varchar(30),
chole varchar(30),
fattyacid varchar(30),
transfat varchar(30)
);
select*from food;
drop table food;
create table memtb(
id varchar(20) primary key,
pw varchar(20),
name varchar(20),
addr varchar(200),
email varchar(50),
tel varchar(50),
alinfo varchar(500)
);
create table cart(
cartid int primary key auto_increment,
userid varchar(20),
foodcode int,
amount int
);
select code from food as f join cart as c on c.foodcode= f.code where c.userid='3';
select*from cart;
drop table cart;
INSERT INTO cart VALUES (1, '박구곤', 11, 1);
create table qna(
num int auto_increment primary key,
title varchar(50) not null,
content varchar(2000),
id varchar(20)
);
create table board(
num int auto_increment primary key,
id varchar(20) not null,
title varchar(200),
content varchar(2000)
);
select*from board;
drop table board;
create table comment(
num int auto_increment primary key,
qnanum varchar(20) not null,
content varchar(200),
id varchar(20)
);
select*from comment;
drop table comment;
select* from qna;
drop table qna;
select*from memtb;
delete from memtb where id='ssafy';
drop table memtb;
| true
|
ff794ea6df70b0606f1bc6711f8f6107c87c4bb5
|
SQL
|
AmayaKavirathne/FrontendProjectProposal
|
/project_proposals.sql
|
UTF-8
| 2,608
| 3.203125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 14, 2021 at 07:15 PM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 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 */;
--
-- Database: `gb_projects`
--
-- --------------------------------------------------------
--
-- Table structure for table `project_proposals`
--
CREATE TABLE `project_proposals` (
`proposal_ID` int(11) NOT NULL,
`projectName` varchar(50) NOT NULL,
`budget` double NOT NULL,
`completionDate` varchar(20) NOT NULL,
`productCategory` varchar(20) NOT NULL,
`sellOrNot` varchar(10) NOT NULL,
`description` varchar(400) NOT NULL,
`status` varchar(20) NOT NULL DEFAULT 'pending',
`userID` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `project_proposals`
--
INSERT INTO `project_proposals` (`proposal_ID`, `projectName`, `budget`, `completionDate`, `productCategory`, `sellOrNot`, `description`, `status`, `userID`) VALUES
(10, 'gbproject', 1000, '2020-12-12', 'IT', 'sell', 'description', 'accepted', ''),
(16, 'Project Q', 1000, '2021-12-12', 'category', 'not', 'desc', 'pending', '20'),
(19, 'project', 10000, '2021-05-19', 'category', 'sell', 'desc', 'pending', '5'),
(22, 'QQ', 10000, '2020-11-25', 'aa', 'sell', 'desc', 'pending', '10'),
(23, 'gbproject', 1000, '2020-12-12', 'IT', 'sell', 'description', 'accepted', '15'),
(24, 'project n', 1000, '2021-12-12', 'ss', 'not', 'dfd', 'accepted', '50'),
(25, 'Project A', 100000, '2020-12-12', 'category', 'sell', 'description', 'pending', '10'),
(26, 'Project A', 100000, '2020-12-12', 'category', 'sell', 'description', 'pending', '15'),
(27, 'project B', 1000, '2021', 'category', 'not', 'desc', 'pending', '47');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `project_proposals`
--
ALTER TABLE `project_proposals`
ADD PRIMARY KEY (`proposal_ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `project_proposals`
--
ALTER TABLE `project_proposals`
MODIFY `proposal_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
3426f6c6467fdc391ab8de043b718ff1fb2d97f2
|
SQL
|
jenniwu/CoffeeShopDB
|
/src/cs_database.sql
|
UTF-8
| 6,184
| 3.640625
| 4
|
[] |
no_license
|
-- create database CoffeshopDB_xxxx;
-- go
-- use CoffeshopDB_xxxx;
-- go
drop table track;
-- cascade delete from Manager, Product and Supplier
drop table upon;
-- cascade delete from Transactions and Product
drop table makes;
-- has no dependencies
drop table Transactions;
--cascade delete from Customer and Employee
drop table Customer;
--cascade delete from Vip
drop table Vip;
-- cascade delete from Employee
drop table Employee;
-- cascade delete from Salary and Manager
drop table Salary;
-- has no dependencies
drop table Manager;
-- has no dependencies
drop table Supplier;
-- has no dependencies
drop table Product;
-- has no dependencies
commit;
create table Product
(price int not null,
stockAmount int not null,
returnableFlag varchar(10) not null,
ptype varchar(30) not null,
primary key (ptype));
grant select on Product to public;
create table Supplier
(sphone char(20) not null,
sname varchar(30) not null,
primary key (sphone));
grant select on Supplier to public;
create table Manager
(mmid int not null,
mname varchar(30) not null,
primary key (mmid));
grant select on Manager to public;
create table Salary
(tier int not null,
frequency varchar(30) not null,
bonus int not null,
primary key (tier));
grant select on Salary to public;
create table Employee
(eid int not null,
ename varchar(40) not null,
position varchar(30) not null,
tier int not null,
mmid int not null,
primary key (eid),
foreign key (tier) references Salary ON DELETE CASCADE,
foreign key (mmid) references Manager ON DELETE SET NULL);
grant select on Employee to public;
create table Vip
(phone char(20) not null,
email varchar(40) not null,
loyaltyPoints int not null,
birthday date not null,
dollarBalance int,
eid int,
primary key (phone),
foreign key (eid) references Employee ON DELETE CASCADE);
grant select on Vip to public;
create table Customer
(cid int not null,
cname varchar(30) not null,
phone char(20) not null,
primary key (cid),
foreign key (phone) references Vip ON DELETE CASCADE);
grant select on Customer to public;
create table Transactions
(tid int not null,
tamount int not null,
tday date not null,
ttime varchar(30) not null,
cid int not null,
eid int not null,
primary key (tid),
foreign key (cid) references Customer ON DELETE SET NULL,
foreign key (eid) references Employee ON DELETE SET NULL);
grant select on Transactions to public;
create table makes
(rating int not null);
grant select on makes to public;
create table upon
(tid int not null,
ptype varchar(30) not null,
primary key (tid, ptype),
foreign key (tid) references Transactions ON DELETE CASCADE,
foreign key (ptype) references Product ON DELETE SET NULL);
grant select on upon to public;
create table track
(ptype varchar(30) not null,
sphone char(20) not null,
mmid int not null,
primary key (ptype, sphone, mmid),
foreign key (mmid) references Manager ON DELETE SET NULL,
foreign key (ptype) references Product ON DELETE CASCADE,
foreign key (sphone) references Supplier ON DELETE SET NULL);
grant select on track to public;
commit;
-- insert data into diffrent tables
insert into Product values
--(price,stockamount,return?,ptype)
(20, 10, 'NO', 'coffee');
insert into Product values
(150, 10, 'YES', 'coffee beans');
insert into Product values
(5, 50, 'YES', 'coffee machine');
insert into Supplier values
--(sphone,sname)
('778-893-3079', 'Swagger');
insert into Supplier values
('778-803-5783', 'Malcom');
insert into Supplier values
('778-093-2761', 'Jacob');
insert into Manager values
--(mmid,mname)
(123, 'Knorr');
insert into Manager values
(206, 'Mike');
insert into Salary values
--(tier, frequency, bonus)
(1, 'monthly', 100);
insert into Salary values
(2, 'weekly', 50);
insert into Salary values
(3, 'monthly', 0);
insert into Employee values
--(eid,ename,position,tier,emid)
(1234, 'A', 'sales clerk', 1, 123);
insert into Employee values
(2234, 'B', 'skilled worker', 1, 123);
insert into Employee values
(8265, 'C', 'dustman', 3, 206);
insert into Vip values
--(phone, email, loyaltypoints,birthday,dollarbalance,eid)
('778-681-4862','anna@gmail.com', 21, '1996-1-11', 100, 1234);
insert into Vip values
('778-674-5692','ben@gmail.com', 50, '1995-1-21', 10, 2234);
insert into Vip values
('778-294-3298','chris@gmail.com', 266, '1988-10-1', 200, 8265);
insert into Customer values
--(cid,cname,phone)
(1, 'A. Anna', '778-681-4862');
insert into Customer values
(2, 'B. Ben', '778-674-5692');
insert into Customer values
(3, 'C. Chris', '778-294-3298');
insert into Customer values
(4, 'D. Dennis', '778-123-1342');
insert into Customer values
(5, 'E. Eddie', '778-456-5635');
insert into Customer values
(6, 'F. Frank', '778-723-0985');
insert into Customer values
(7, 'G. Ganster', '778-522-0784');
insert into Customer values
(8, 'H. Henry', '778-678-3985');
insert into Customer values
(9, 'I. Iris', '778-990-6784');
insert into Customer values
(10, 'J. Jenny', '778-255-0275');
insert into Customer values
(11, 'K. Kanye', '778-670-9065');
insert into Customer values
(12, 'L. Leonaldo', '778-359-8391');
insert into Customer values
(13, 'M. Mundo', '778-782-1298');
insert into Customer values
(14, 'N. Natasha', '778-091-1234');
insert into Customer values
(15, 'O. Oliver', '778-123-2345');
insert into Transactions values
--(tid,tamount,tday,ttime,cid,eid)
(12345, 20, '2017-11-15', '20:20:20',1,1234);
insert into Transactions values
(23456, 5, '2017-11-02', '18:30:00',2,2234);
insert into Transactions values
(67821, 50, '2017-08-15', '23:08:36',3,8265);
insert into Transactions values
(85310, 50, '2017-08-19', '21:38:46',1,2234);
insert into makes values
--(rating)
(10);
insert into makes values
(6);
insert into makes values
(5);
insert into upon values
--(tid,ptype)
(12345,'coffee');
insert into upon values
(23456,'coffee beans' );
insert into upon values
(67821,'coffee machine');
insert into upon values
(85310,'coffee machine');
insert into track values
--(ptype,sphone,mmid)
('coffee','778-893-3079',123);
insert into track values
('coffee beans','778-893-3079',123);
insert into track values
('coffee machine','778-803-5783',206);
| true
|
353857c8f4802f78c2d3f003f105716939e201d1
|
SQL
|
poonamgillurkar/DallasCare
|
/SQL/view_REORDER_MEDS.sql
|
UTF-8
| 199
| 2.953125
| 3
|
[] |
no_license
|
CREATE OR REPLACE VIEW ReorderMeds AS(
SELECT medicene_code, medicene_name, quantity, date_of_expiry
FROM PHARMACY
WHERE Date_of_expiry <= DATE_ADD(CURDATE(), INTERVAL 1 month)
OR Quantity < 1000
);
| true
|
2bb8c08695c652712a5d86cf3a1ed2c369111c53
|
SQL
|
arthur-gamboa/database-exercises
|
/adlister_app.sql
|
UTF-8
| 1,517
| 4.75
| 5
|
[] |
no_license
|
CREATE TABLE users
(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR(250) NOT NULL,
email VARCHAR(250) NOT NULL,
password VARCHAR(250) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE ads
(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT UNSIGNED NOT NULL,
title VARCHAR(250) NOT NULL,
description TEXT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (user_id) REFERENCES users (id)
ON DELETE CASCADE
);
CREATE TABLE categories
(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(250) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE ad_categories
(
ad_id INTEGER UNSIGNED NOT NULL,
category_id INTEGER UNSIGNED NOT NULL,
FOREIGN KEY (ad_id) REFERENCES ads (id),
FOREIGN KEY (category_id) REFERENCES categories (id)
);
-- For a given ad, what is the email address of the user that created it?
SELECT u.email AS 'email'
FROM users u
JOIN ads a ON u.id = a.user_id
WHERE a.title = ' ';
-- For a given ad, what category, or categories, does it belong to?
SELECT c.name
FROM categories c
JOIN ad_categories ac ON c.id = ac.category_id
JOIN ads a ON ac.ad_id = a.id
WHERE a.id = ' ';
-- For a given category, show all the ads that are in that category.
SELECT a.title AS 'Ads'
FROM ads a
JOIN ad_categories ac ON a.id = ac.ad_id
JOIN categories c ON ac.category_id = c.id
WHERE c.name = ' ';
-- For a given user, show all the ads they have posted.
SELECT a.title as 'Ads'
FROM ads a
JOIN users u ON a.user_id = u.id
WHERE u.username = ' ';
| true
|
18f34ff797fe454a5240f2dd4f5fd693915aa4b9
|
SQL
|
diegosantos17/php-banco
|
/scripts/queries/aula_2020_12_11_parte1.sql
|
UTF-8
| 4,053
| 4.0625
| 4
|
[] |
no_license
|
SELECT -- PARTE 1: O que eu quero?
veic.placa as 'Placa',
veic.nome as 'Nome Veiculo',
multa_tp.nome as 'Tipo da multa',
multa_tp.pontos,
multa_st.descricacao as 'Situação Multa',
prop.nome as 'Proprietario',
prop.documento as 'CPF do Proprietário',
IFNULL(moto.nome, 'NDA') as 'Motorista'
FROM -- PARTE 2: De onde eu pego?
db_diego_logistica.veiculo_multa veic_multa
INNER JOIN db_diego_logistica.multa_tipo multa_tp ON veic_multa.multa_tipo_id = multa_tp.id
INNER JOIN db_diego_logistica.multa_situacao multa_st ON multa_st.id = veic_multa.multa_situacao_id
LEFT JOIN db_diego_logistica.motorista moto ON moto.id = veic_multa.motorista_responsavel_id
INNER JOIN db_diego_logistica.veiculo veic ON veic.id = veic_multa.veiculo_id
INNER JOIN db_diego_logistica.proprietario prop ON veic.proprietario_id = prop.id
WHERE -- PARTE 3: Quais condições?
veic.placa = 'CJC1752'
-- PARTE 4+
ORDER BY -- PARTE 4 (Opcional)
multa_tp.pontos DESC;
SELECT -- PARTE 1: O que eu quero?
veic.placa as 'Placa',
COUNT(multa_tp.pontos) as 'Quantidade de multas',
SUM(multa_tp.pontos) as 'Total de pontos'
FROM -- PARTE 2: De onde eu pego?
db_diego_logistica.veiculo_multa veic_multa
INNER JOIN db_diego_logistica.multa_tipo multa_tp ON veic_multa.multa_tipo_id = multa_tp.id
INNER JOIN db_diego_logistica.multa_situacao multa_st ON multa_st.id = veic_multa.multa_situacao_id
LEFT JOIN db_diego_logistica.motorista moto ON moto.id = veic_multa.motorista_responsavel_id
INNER JOIN db_diego_logistica.veiculo veic ON veic.id = veic_multa.veiculo_id
INNER JOIN db_diego_logistica.proprietario prop ON veic.proprietario_id = prop.id
-- WHERE -- PARTE 3: Quais condições?
-- veic.placa = 'CJC1752'
-- PARTE 4+
GROUP BY -- PARTE 4 (Opcional)
veic.placa HAVING COUNT(multa_tp.pontos) > 1
;
SELECT
MONTH(veic_multa.data_infracao),
count(*)
FROM
db_diego_logistica.veiculo_multa veic_multa
GROUP BY
MONTH(veic_multa.data_infracao)
;
SELECT
date_format(veic_multa.data_infracao, '%d/%m/%Y') as 'Data', -- Y m d H i s
COUNT(veic_multa.data_infracao)
FROM
db_diego_logistica.veiculo_multa veic_multa
WHERE
veic_multa.data_infracao > '2020-10-11 00:00:00'
AND veic_multa.data_infracao < '2020-12-11 23:59:59'
GROUP BY
date_format(veic_multa.data_infracao, '%d/%m/%Y')
;
SELECT
date_format(veic_multa.data_infracao, '%d/%m/%Y') as 'Data', -- Y m d H i s
COUNT(veic_multa.data_infracao)
FROM
db_diego_logistica.veiculo_multa veic_multa
WHERE
veic_multa.data_infracao BETWEEN '2020-10-11 00:00:00' AND '2020-12-10 23:59:59'
GROUP BY
veic_multa.data_infracao
;
SELECT
date_format(veic_multa.data_infracao, '%d/%m/%Y') as 'Data', -- Y m d H i s
COUNT(veic_multa.data_infracao)
FROM
db_diego_logistica.veiculo_multa veic_multa
WHERE
veic_multa.data_infracao BETWEEN '2020-10-11 00:00:00' AND NOW()
GROUP BY
veic_multa.data_infracao
;
SELECT -- PARTE 1: O que eu quero?
veic.placa as 'Placa',
veic.nome as 'Nome Veiculo',
multa_tp.nome as 'Tipo da multa',
multa_tp.pontos,
multa_st.descricacao as 'Situação Multa',
prop.nome as 'Proprietario',
prop.documento as 'CPF do Proprietário',
IFNULL(moto.nome, 'NDA') as 'Motorista'
FROM -- PARTE 2: De onde eu pego?
db_diego_logistica.veiculo_multa veic_multa
INNER JOIN db_diego_logistica.multa_tipo multa_tp ON veic_multa.multa_tipo_id = multa_tp.id
INNER JOIN db_diego_logistica.multa_situacao multa_st ON multa_st.id = veic_multa.multa_situacao_id
LEFT JOIN db_diego_logistica.motorista moto ON moto.id = veic_multa.motorista_responsavel_id
INNER JOIN db_diego_logistica.veiculo veic ON veic.id = veic_multa.veiculo_id
INNER JOIN db_diego_logistica.proprietario prop ON veic.proprietario_id = prop.id
WHERE -- PARTE 3: Quais condições?
veic.placa = 'DMK3097'
OR moto.nome LIKE '%B%'
-- PARTE 4+
ORDER BY -- PARTE 4 (Opcional)
multa_tp.pontos DESC;
select * from db_diego_logistica.veiculo_multa;
select * from db_diego_logistica.veiculo;
select * from db_diego_logistica.proprietario p where p.nome LIKE '%M%';
| true
|
3e6fde5b30f90e734511717f8d25bbc9c2e2175b
|
SQL
|
EvasiveXkiller/notalmuni
|
/database/schema.sql
|
UTF-8
| 4,439
| 3.375
| 3
|
[
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:10365
-- Generation Time: Mar 20, 2021 at 08:59 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 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 */;
--
-- Database: `almuni`
--
DROP DATABASE IF EXISTS `almuni`;
CREATE DATABASE IF NOT EXISTS `almuni` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `almuni`;
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE IF NOT EXISTS `admin` (
`admin_id` int(11) NOT NULL,
`admin_name` varchar(45) DEFAULT NULL,
`admin_email` varchar(45) DEFAULT NULL,
`admin_password` varchar(1000) NOT NULL,
PRIMARY KEY (`admin_id`),
UNIQUE KEY `admin_id_UNIQUE` (`admin_id`),
UNIQUE KEY `admin_password_UNIQUE` (`admin_password`) USING HASH
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`admin_id`, `admin_name`, `admin_email`, `admin_password`) VALUES
(1, 'Carlson', 'notcarlson@gmail.com', '$2y$10$rfCleVOn0wmYbhCPUPOFbe7YdVon4VU4dbeICyFHkAYpVUkY6Okyi');
-- --------------------------------------------------------
--
-- Table structure for table `annoucements`
--
CREATE TABLE IF NOT EXISTS `annoucements` (
`annouce_id` int(11) NOT NULL AUTO_INCREMENT,
`annouce_title` varchar(45) NOT NULL,
`annouce_content` varchar(1000) NOT NULL,
`annouce_author` varchar(45) NOT NULL,
`timestamp_` datetime NOT NULL,
PRIMARY KEY (`annouce_id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `annoucements`
--
INSERT INTO `annoucements` (`annouce_id`, `annouce_title`, `annouce_content`, `annouce_author`, `timestamp_`) VALUES
(16, 'Welcome To Almuni!', 'We hope that you enjoy your stay here! Feel free to look around for the things that you can do here', 'Carlson', '2021-03-20 15:22:42'),
(17, 'All contacts are securely stored!', 'Your contacts are stored with the latest technology that are all secured. Your password is also hashed too! This means in case of a data breach, your passwords are all still encrypted and non readable. Have fun!', 'Carlson', '2021-03-20 15:24:14'),
(18, 'Lorem ipsum dolor sit amet', 'Yep, that is the announcement that we have to make. We just like you to know that all of us are still human beings and not robots. Have fun!!', 'Carlson', '2021-03-20 15:25:21');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`user_ID` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(1000) NOT NULL,
`user_email` varchar(45) NOT NULL,
`imagepath` varchar(1000) DEFAULT NULL,
`user_identity` varchar(22) DEFAULT NULL,
`user_address` varchar(45) DEFAULT NULL,
`user_gender` varchar(10) DEFAULT NULL,
`user_password` varchar(1000) NOT NULL,
`user_DOB` date DEFAULT NULL,
`main_contact` varchar(20) DEFAULT NULL,
`home_contact` varchar(20) DEFAULT NULL,
`office_contact` varchar(20) DEFAULT NULL,
`user_notes` varchar(1000) DEFAULT NULL,
`status_` varchar(45) DEFAULT NULL,
PRIMARY KEY (`user_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=117 DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_ID`, `username`, `user_email`, `imagepath`, `user_identity`, `user_address`, `user_gender`, `user_password`, `user_DOB`, `main_contact`, `home_contact`, `office_contact`, `user_notes`, `status_`) VALUES
(113, 'Jack Tok', 'jack@gmail.com', 'userimages/113.jpg', '', '', 'male', '$2y$10$M/5pPhGEp/DDC49LuWqFEewAfyCZ7tbypsJVzG3WHLKlfzLwKWdQu', '0000-00-00', '+60123456789', '03-12345678', '03-12345678,126', ' ', 'ok'),
(114, 'Shelia', 'shelia@gmail.com', NULL, '', '', 'female', '$2y$10$0lK0cOLRpbxNX0WEVI8MFeIvzTaFFmqMi9j.YTLiomhBVa6uIg1Di', NULL, NULL, NULL, NULL, NULL, 'pending'),
(115, 'Carlson', 'carlson@gmail.com', NULL, '', '', 'male', '$2y$10$0uJTLMPJATADjl/Wpn83he4B2aB/k7.eIyIqQsCLuLEukwO.yuTFi', NULL, NULL, NULL, NULL, NULL, 'pending');
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
|
13dece38d915c67b88b6e2f757ba1aca8b031de0
|
SQL
|
amanxp001/Protfolio
|
/SQL project.sql
|
UTF-8
| 2,283
| 4.40625
| 4
|
[] |
no_license
|
-- delecting data that we are going to use
select Location, date, total_cases, new_cases, total_deaths, population
from protfolio..covid_deaths$
order by 1,2
--total cases vs total deaths
select Location, date, total_cases, total_deaths, (total_deaths/total_cases)*100 as deathpercentage
from protfolio..covid_deaths$
order by 1,2
-- showing what percentage of population got covid
select Location, date,population, total_cases, total_deaths, (total_cases/population)*100 as percentagepeoplegotcovid
from protfolio..covid_deaths$
order by 1,2
--contries with highest infection rate
select Location, population, max(total_cases) as highestinfectioncount, max((total_cases/population))*100 as percentagepeoplegotcovid
from protfolio..covid_deaths$
group by population, location
order by percentagepeoplegotcovid desc
--countries with highest death count
select Location, max(cast (total_deaths as int)) as totaldeathcount
from protfolio..covid_deaths$
where continent is not null
group by location
order by totaldeathcount desc
-- temp table
drop table if exists #percentpeoplevaccinated
create table #percentpeoplevaccinated
(
continent nvarchar(255),
location nvarchar(255),
date datetime,
population numeric,
new_vaccinations numeric,
totalpeoplevaccinated numeric
)
insert into #percentpeoplevaccinated
select dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations,
sum(cast(vac.new_vaccinations as bigint)) over (partition by dea.location order by dea.location, dea.date) as totalpeoplevaccinated
from protfolio..covid_deaths$ dea
join protfolio..covid_vac$ vac
on dea.location = vac.location
and dea.date = vac.date
--where dea.continent is not null
select *, (totalpeoplevaccinated/population)*100
from #percentpeoplevaccinated
order by 2,3
--creating view
create view percentpeoplevaccinated as
select dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations,
sum(cast(vac.new_vaccinations as bigint)) over (partition by dea.location order by dea.location, dea.date) as totalpeoplevaccinated
from protfolio..covid_deaths$ dea
join protfolio..covid_vac$ vac
on dea.location = vac.location
and dea.date = vac.date
where dea.continent is not null
| true
|
7a21c91fb34e0bbfa26e0f20813928b6ccaa35b9
|
SQL
|
Pirgo/bazy
|
/31.sql
|
UTF-8
| 6,304
| 4.09375
| 4
|
[] |
no_license
|
-- Dla każdego zamówienia podaj łączną liczbę zamówionych
-- jednostek towaru oraz nazwę klienta.
select OD.OrderID, SUM(Quantity), companyname
from [Order Details] as OD
inner join Orders O on OD.OrderID = O.OrderID
inner join Customers C on O.CustomerID = C.CustomerID
group by OD.OrderID, CompanyName
-- Zmodyfikuj poprzedni przykład, aby pokazać tylko takie zamówienia,
-- dla których łączna liczbę zamówionych jednostek jest większa niż
-- 250
select OD.OrderID, SUM(Quantity), companyname
from [Order Details] as OD
inner join Orders O on OD.OrderID = O.OrderID
inner join Customers C on O.CustomerID = C.CustomerID
group by OD.OrderID, CompanyName
having sum(Quantity) > 250
-- Dla każdego zamówienia podaj łączną wartość tego zamówienia oraz
-- nazwę klienta.
select OD.OrderID, SUM(cast(UnitPrice*Quantity*(1-Discount) as decimal(10,2))), companyname
from [Order Details] as OD
inner join Orders O on OD.OrderID = O.OrderID
inner join Customers C on O.CustomerID = C.CustomerID
group by OD.OrderID, CompanyName
-- Zmodyfikuj poprzedni przykład, aby pokazać tylko takie zamówienia,
-- dla których łączna liczba jednostek jest większa niż 250.
select OD.OrderID, SUM(cast(UnitPrice*Quantity*(1-Discount) as decimal(10,2))), companyname
from [Order Details] as OD
inner join Orders O on OD.OrderID = O.OrderID
inner join Customers C on O.CustomerID = C.CustomerID
group by OD.OrderID, CompanyName
having sum(Quantity) > 250
-- Zmodyfikuj poprzedni przykład tak żeby dodać jeszcze imię i
-- nazwisko pracownika obsługującego zamówienie
select OD.OrderID, SUM(cast(UnitPrice*Quantity*(1-Discount) as decimal(10,2))), companyname, e.FirstName, e.LastName
from [Order Details] as OD
inner join Orders O on OD.OrderID = O.OrderID
inner join Customers C on O.CustomerID = C.CustomerID
inner join Employees as e on O.EmployeeID = e.EmployeeID
group by e.FirstName, companyname, OD.OrderID, e.LastName
having sum(Quantity) > 250
-- Dla każdej kategorii produktu (nazwa), podaj łączną liczbę
-- zamówionych przez klientów jednostek towarów z tek kategorii.
select sum(quantity), CategoryName
from Categories as c
inner join Products P on c.CategoryID = P.CategoryID
inner join [Order Details] [O D] on P.ProductID = [O D].ProductID
group by CategoryName
-- Dla każdej kategorii produktu (nazwa), podaj łączną wartość
-- zamówionych przez klientów jednostek towarów z tek kategorii.
select sum(cast([O D].UnitPrice*Quantity*(1-Discount) as decimal(10,2))), CategoryName
from Categories as c
inner join Products P on c.CategoryID = P.CategoryID
inner join [Order Details] [O D] on P.ProductID = [O D].ProductID
group by CategoryName
-- Posortuj wyniki w zapytaniu z poprzedniego punktu wg:
-- a) łącznej wartości zamówień
-- b) łącznej liczby zamówionych przez klientów jednostek towarów.
select sum(cast([O D].UnitPrice*Quantity*(1-Discount) as decimal(10,2))), CategoryName
from Categories as c
inner join Products P on c.CategoryID = P.CategoryID
inner join [Order Details] [O D] on P.ProductID = [O D].ProductID
group by CategoryName
order by sum(cast([O D].UnitPrice*Quantity*(1-Discount) as decimal(10,2)))
select sum(quantity), CategoryName
from Categories as c
inner join Products P on c.CategoryID = P.CategoryID
inner join [Order Details] [O D] on P.ProductID = [O D].ProductID
group by CategoryName
order by sum(quantity)
-- Dla każdego zamówienia podaj jego wartość uwzględniając opłatę za
-- przesyłkę
select OD.OrderID, (sum(cast(UnitPrice*Quantity*(1-Discount) as decimal(10,2))) + sum(cast(Freight as decimal(10,2))))
from [Order Details] as OD
inner join Orders O on OD.OrderID = O.OrderID
group by OD.OrderID
-- Dla każdego przewoźnika (nazwa) podaj liczbę zamówień które
-- przewieźli w 1997r
select CompanyName, COUNT(ShipVia)
from Shippers as s
inner join Orders O on s.ShipperID = O.ShipVia
where year(O.ShippedDate) = 1997
group by CompanyName
-- Który z przewoźników był najaktywniejszy (przewiózł największą
-- liczbę zamówień) w 1997r, podaj nazwę tego przewoźnika
select TOP 1 with ties CompanyName, COUNT(ShipVia)
from Shippers as s
inner join Orders O on s.ShipperID = O.ShipVia
where year(O.ShippedDate) = 1997
group by CompanyName
order by COUNT(ShipVia) desc
-- Dla każdego pracownika (imię i nazwisko) podaj łączną wartość
-- zamówień obsłużonych przez tego pracownika
select e.FirstName, e.LastName, SUM((cast(UnitPrice*Quantity*(1-Discount) as decimal(10,2))))
from Employees as e
inner join Orders O on e.EmployeeID = O.EmployeeID
inner join [Order Details] as OD on O.OrderID = OD.OrderID
group by e.FirstName, e.LastName
-- Który z pracowników obsłużył największą liczbę zamówień w 1997r,
-- podaj imię i nazwisko takiego pracownika
select top 1 e.FirstName, e.LastName, COUNT(*)
from Employees as e
inner join Orders O on e.EmployeeID = O.EmployeeID
where year(O.OrderDate) = 1997
group by e.FirstName, e.LastName
order by COUNT(*) desc
-- Który z pracowników obsłużył najaktywniejszy (obsłużył zamówienia
-- o największej wartości) w 1997r, podaj imię i nazwisko takiego
-- pracownika
select top 1 e.FirstName, e.LastName, sum(cast([O D].UnitPrice*Quantity*(1-Discount) as decimal(10,2)))
from Employees as e
inner join Orders O on e.EmployeeID = O.EmployeeID
inner join [Order Details] [O D] on O.OrderID = [O D].OrderID
where year(O.OrderDate) = 1997
group by e.FirstName, e.LastName
order by COUNT(*) desc
-- Dla każdego pracownika (imię i nazwisko) podaj łączną wartość
-- zamówień obsłużonych przez tego pracownika
select e.firstname, e.LastName, cast(sum(od.UnitPrice*od.Quantity*(1-od.Discount)) as decimal(10,2))
from Employees as e
left join Employees as sub
on sub.ReportsTo = e.EmployeeID
join Orders as o
on o.EmployeeID = e.EmployeeID
join [Order Details] as od
on od.OrderID = o.OrderID
where sub.ReportsTo is not null
group by e.firstname, e.LastName
select e.firstname, e.LastName, cast(sum(od.UnitPrice*od.Quantity*(1-od.Discount)) as decimal(10,2))
from Employees as e
left join Employees as sub
on sub.ReportsTo = e.EmployeeID
join Orders as o
on o.EmployeeID = e.EmployeeID
join [Order Details] as od
on od.OrderID = o.OrderID
where sub.ReportsTo is null
group by e.firstname, e.LastName
| true
|
e0b0536529ac3aac55259467359975b44209f375
|
SQL
|
PratibhaMastud/AddressBookDB
|
/RetriveAllFields.sql
|
UTF-8
| 683
| 3.296875
| 3
|
[] |
no_license
|
select * from Contact
select * from Address
select * from ContactType
SELECT contact_id,first_name,last_name,address,city,state,pincode
FROM Contact INNER JOIN Address
ON Contact.address_id = Address.address_id
SELECT contact_id,first_name,last_name,address,city,state,pincode
FROM Contact LEFT JOIN Address
ON Contact.address_id = Address.address_id
SELECT contact_id,first_name,address,city,state,pincode
FROM Contact RIGHT JOIN Address
ON Contact.address_id = Address.address_id
delete ContactType where contactType_id = 104
SELECT contact_id, first_name, last_name, contactType_name
FROM Contact
INNER JOIN ContactType
ON Contact.contact_id = ContactType.contactType_id
| true
|
46bdaf38943271e8e9625818769c3c8538620066
|
SQL
|
matheus-luiz00/Proway
|
/19-07-22 @ 19-07-26/ParteFinalLocadoraTSQL/SELECT LOCACAO ANO.sql
|
UTF-8
| 194
| 3.765625
| 4
|
[] |
no_license
|
select
YEAR(lo.DateInc) 'Ano',
Count(lo.Id) 'Locacoes'
from Locacao lo
inner join Carros cr on lo.Carro = cr.Id
where lo.Operacao = 2
group by YEAR(lo.DateInc)
order by Locacoes desc
| true
|
28bacb85ea07934b4c70dd8f036fb4e78f547091
|
SQL
|
AzarinSergey/otus_hw
|
/hw/indexes_11.sql
|
UTF-8
| 10,448
| 3.75
| 4
|
[] |
no_license
|
--1.Создать индекс к какой-либо из таблиц вашей БД
--Прислать текстом результат команды explain, в которой используется данный индекс
--ЗАДАЧА: найти рейсы с максимально заполненным бизнесс классом и вывести
--число занятых мест, номер рейса, города и названия аэропортов на английском from(dep)-to(arr)
--ЗАПРОС:
with
fl_count as (
select bfl.flight_id, count(*) as counter from
(
select flight_id, fare_conditions from bookings.ticket_flights
where fare_conditions = 'Business'
) bfl
group by bfl.flight_id
),
fl_count_max as (
select max(fl_count.counter) as maximum from fl_count
)
select
fl_count.counter,
fl_count.flight_id,
air_from.airport_name -> 'en' as from_airport,
air_from.city -> 'en' as from_city,
air_to.airport_name -> 'en' as to_airport,
air_to.city -> 'en' as to_city
from fl_count
right join fl_count_max _m on _m.maximum = fl_count.counter
inner join bookings.flights fl on fl_count.flight_id = fl.flight_id
inner join bookings.airports_data air_from on air_from.airport_code = fl.departure_airport
inner join bookings.airports_data air_to on air_to.airport_code = fl.arrival_airport
--ОТВЕТ: Без индекса в 44 строке Seq scan: (322)
--"Nested Loop (cost=19238.95..19643.13 rows=76 width=140)"
--" CTE fl_count"
--" -> Finalize HashAggregate (cost=18741.68..18894.50 rows=15282 width=12)"
--" Group Key: ticket_flights.flight_id"
--" -> Gather (cost=15379.64..18588.86 rows=30564 width=12)"
--" Workers Planned: 2"
--" -> Partial HashAggregate (cost=14379.64..14532.46 rows=15282 width=12)"
--" Group Key: ticket_flights.flight_id"
--" -> Parallel Seq Scan on ticket_flights (cost=0.00..14161.49 rows=43630 width=4)"
--" Filter: ((fare_conditions)::text = 'Business'::text)"
--" -> Nested Loop (cost=344.31..735.68 rows=76 width=126)"
--" -> Nested Loop (cost=344.17..723.50 rows=76 width=20)"
--" -> Hash Join (cost=343.88..690.48 rows=76 width=12)"
--" Hash Cond: (fl_count.counter = (max(fl_count_1.counter)))"
--" -> CTE Scan on fl_count (cost=0.00..305.64 rows=15282 width=12)"
--" -> Hash (cost=343.86..343.86 rows=1 width=8)"
--" -> Aggregate (cost=343.84..343.85 rows=1 width=8)"
--" -> CTE Scan on fl_count fl_count_1 (cost=0.00..305.64 rows=15282 width=8)"
--" -> Index Scan using flights_pkey on flights fl (cost=0.29..0.43 rows=1 width=12)"
--" Index Cond: (flight_id = fl_count.flight_id)"
--" -> Index Scan using airports_data_pkey on airports_data air_from (cost=0.14..0.16 rows=1 width=114)"
--" Index Cond: (airport_code = fl.departure_airport)"
--" -> Index Scan using airports_data_pkey on airports_data air_to (cost=0.14..0.16 rows=1 width=114)"
--" Index Cond: (airport_code = fl.arrival_airport)"
--Добавим индекс
CREATE INDEX my_first_index ON bookings.ticket_flights (fare_conditions)
-- Его использование видим в 73 строке
--"Nested Loop (cost=12216.68..12620.86 rows=76 width=140)"
--" CTE fl_count"
--" -> HashAggregate (cost=11719.40..11872.22 rows=15282 width=12)"
--" Group Key: ticket_flights.flight_id"
--" -> Bitmap Heap Scan on ticket_flights (cost=1171.94..11195.84 rows=104712 width=4)"
--" Recheck Cond: ((fare_conditions)::text = 'Business'::text)"
--" -> Bitmap Index Scan on my_first_index (cost=0.00..1145.76 rows=104712 width=0)"
--" Index Cond: ((fare_conditions)::text = 'Business'::text)"
--" -> Nested Loop (cost=344.31..735.68 rows=76 width=126)"
--" -> Nested Loop (cost=344.17..723.50 rows=76 width=20)"
--" -> Hash Join (cost=343.88..690.48 rows=76 width=12)"
--" Hash Cond: (fl_count.counter = (max(fl_count_1.counter)))"
--" -> CTE Scan on fl_count (cost=0.00..305.64 rows=15282 width=12)"
--" -> Hash (cost=343.86..343.86 rows=1 width=8)"
--" -> Aggregate (cost=343.84..343.85 rows=1 width=8)"
--" -> CTE Scan on fl_count fl_count_1 (cost=0.00..305.64 rows=15282 width=8)"
--" -> Index Scan using flights_pkey on flights fl (cost=0.29..0.43 rows=1 width=12)"
--" Index Cond: (flight_id = fl_count.flight_id)"
--" -> Index Scan using airports_data_pkey on airports_data air_from (cost=0.14..0.16 rows=1 width=114)"
--" Index Cond: (airport_code = fl.departure_airport)"
--" -> Index Scan using airports_data_pkey on airports_data air_to (cost=0.14..0.16 rows=1 width=114)"
--" Index Cond: (airport_code = fl.arrival_airport)"
--##############################################################################################################
--2. Реализовать индекс для полнотекстового поиска
-- Будем искать пассажиров по ФИ.
-- ВАРИАНТ 1
-- Т.к. интересующая колонка типа "текст" при создании индекса используем
-- to_tsvector функцию с кофигом english и указываем колонку.
-- Конфиг можно и simple, т.к. нету грамматических изысков в ФИ
CREATE INDEX passenger_name_eng_search_index ON bookings.tickets
USING gin(to_tsvector('english', passenger_name));
-- Поиск с использованием индекса:
explain
select * from bookings.tickets
where
to_tsvector('english', passenger_name)
@@ to_tsquery('english','NATALYA & ! KONOVALOVA & ! BELOVA');
-- Выведет всех NATALYA кроме тех у кого фамилия KONOVALOVA или BELOVA.
-- Explain:
--"Bitmap Heap Scan on tickets (cost=46.07..4442.24 rows=1815 width=104)"
--" Recheck Cond: (to_tsvector('english'::regconfig, passenger_name) @@ '''natalya'' & !''konovalova'' & !''belova'''::tsquery)"
--" -> Bitmap Index Scan on passenger_name_eng_search_index (cost=0.00..45.62 rows=1815 width=0)"
--" Index Cond: (to_tsvector('english'::regconfig, passenger_name) @@ '''natalya'' & !''konovalova'' & !''belova'''::tsquery)"
-- ВАРИАНТ 2
-- Нечеткий поиск
-- Добавим экстеншен:
CREATE EXTENSION pg_trgm;
-- Создадим индекс
CREATE INDEX passenger_name_eng_trgm_index ON bookings.tickets
USING gin (passenger_name gin_trgm_ops);
-- Посмотрим что там у нас в индексе
SELECT show_trgm(passenger_name) FROM bookings.tickets LIMIT 10;
-- Установим уровень точночти совпадения, результаты выше которого будут выводиться
SELECT show_limit(), set_limit(0.3);
-- Выполняем запросы и смотрим уровень совпадения
select passenger_name, similarity(passenger_name, 'panov') from bookings.tickets
where passenger_name % 'panov'
--##############################################################################################################
--3. Реализовать индекс на часть таблицы или индекс на поле с функцией
-- Добавим поле с функцией: сумма с учетем скидки в 5%.
alter table bookings.ticket_flights add column
amount_with_discount numeric(10,2) generated always as (amount - (5*amount/100)) stored
-- Добавим индекс чтобы фильтровать по сумме со скидкой:
create index amount_with_discount ON bookings.ticket_flights using btree (amount_with_discount);
-- Выполняем запрос
select * from bookings.ticket_flights
where amount_with_discount > 9000
and amount_with_discount < 12000
-- Проверяем использование индекса:
--"Bitmap Heap Scan on ticket_flights (cost=114.02..8461.77 rows=5229 width=48)"
--" Recheck Cond: ((amount_with_discount > '9000'::numeric) AND (amount_with_discount < '12000'::numeric))"
--" -> Bitmap Index Scan on amount_with_discount (cost=0.00..112.71 rows=5229 width=0)"
--" Index Cond: ((amount_with_discount > '9000'::numeric) AND (amount_with_discount < '12000'::numeric))"
--##############################################################################################################
--4. Создать индекс на несколько полей - не интересно, согласен на минус балл
--##############################################################################################################
--5. Написать комментарии к каждому из индексов - DONE
--##############################################################################################################
--6. Описать что и как делали и с какими проблемами столкнулись
-- Как делал:
-- 1. Пытался смотреть лекцию на тему раза 3, до конца ни разу не удалось досмотреть.
-- Читать всеже быстрее и удобнее. перешел к выполнению задачи.
-- 2. Читал задачу по занятию.
-- 3. Поскольку задачи по занятию АБСТРАКТНЫЕ - придумывал себе задачу на тестовой БД
-- 4. Решал задачу с использованием гугла и https://postgrespro.ru/docs/
-- Основная проблема и самая утомительная часть с которой столкнулся -
-- выдумать для себя задачу на основе абстрактной постановки используя тестовую БД... Это беда...
-- Остальное - не проблемы, а процесс изучения =).
| true
|
80bcf152ee6db8d9e9cf82d6ac528881a90e18be
|
SQL
|
vishwa-deep/php-website-
|
/login/database/login.sql
|
UTF-8
| 22,220
| 3.125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 07, 2020 at 02:02 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `application`
--
CREATE DATABASE IF NOT EXISTS `application` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `application`;
--
-- Database: `blog_application`
--
CREATE DATABASE IF NOT EXISTS `blog_application` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `blog_application`;
-- --------------------------------------------------------
--
-- Table structure for table `tech_blog`
--
CREATE TABLE `tech_blog` (
`articleId` int(30) NOT NULL,
`articleTitle` varchar(300) DEFAULT NULL,
`articleDescrip` text DEFAULT NULL,
`articleContent` longtext DEFAULT NULL,
`articleDate` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `tech_blog_user`
--
CREATE TABLE `tech_blog_user` (
`userid` int(20) NOT NULL,
`username` varchar(300) DEFAULT NULL,
`password` varchar(300) DEFAULT NULL,
`email` varchar(300) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tech_blog`
--
ALTER TABLE `tech_blog`
ADD PRIMARY KEY (`articleId`);
--
-- Indexes for table `tech_blog_user`
--
ALTER TABLE `tech_blog_user`
ADD PRIMARY KEY (`userid`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tech_blog`
--
ALTER TABLE `tech_blog`
MODIFY `articleId` int(30) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tech_blog_user`
--
ALTER TABLE `tech_blog_user`
MODIFY `userid` int(20) NOT NULL AUTO_INCREMENT;
--
-- Database: `login`
--
CREATE DATABASE IF NOT EXISTS `login` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `login`;
-- --------------------------------------------------------
--
-- Table structure for table `post`
--
CREATE TABLE `post` (
`sno` int(11) NOT NULL,
`title` varchar(50) DEFAULT NULL,
`blogdata` longtext DEFAULT NULL,
`timestamp` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `post`
--
INSERT INTO `post` (`sno`, `title`, `blogdata`, `timestamp`) VALUES
(2, 'technology', 'The simplest form of technology is the development and use of basic tools. The prehistoric discovery of how to control fire and the later Neolithic Revolution increased the available sources of food, and the invention of the wheel helped humans to travel in and control their environment. Developments in historic times, including the printing press, the telephone, and the Internet, have lessened physical barriers to communication and allowed humans to interact freely on a global scale', '2020-09-07 15:03:26'),
(3, 'auto mobile', 'The year 1886 is regarded as the birth year of the modern car when German inventor Karl Benz patented his Benz Patent-Motorwagen. Cars became widely available in the early 20th century. One of the first cars accessible to the masses was the 1908 Model T, an American car manufactured by the Ford Motor Company.', '2020-09-07 15:04:30'),
(4, 'Artificial intelligence', 'Artificial intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think like humans and mimic their actions. The term may also be applied to any machine that exhibits traits associated with a human mind such as learning and problem-solving', '2020-09-07 15:05:28'),
(5, 'c programming', 'C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, with a static type system. By design, C provides constructs that map efficiently to typical machine instructions.', '2020-09-07 15:06:07'),
(6, 'java', 'Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible', '2020-09-07 15:12:48'),
(7, 'php', 'PHP is a general-purpose scripting language that is especially suited to web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994; the PHP reference implementation is now produced by The PHP Group.', '2020-09-07 15:13:17'),
(8, 'html', 'Hypertext Markup Language is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets and scripting languages such as JavaScript.', '2020-09-07 15:25:14'),
(10, 'Python', 'Python is an interpreted, high-level and general-purpose programming language. Created by Guido van Rossum and first released in 1991\r\n', '2020-09-07 15:29:35'),
(11, 'c#', 'C# is a general-purpose, multi-paradigm programming language encompassing strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented, and component-oriented programming disciplines.', '2020-09-07 16:37:33'),
(12, 'machine learning', 'Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed. Machine learning focuses on the development of computer programs that can access data and use it learn for themselves.', '2020-09-07 16:38:37'),
(13, 'Deep learning', 'Deep learning is an AI function that mimics the workings of the human brain in processing data for use in detecting objects, recognizing speech, translating languages, and making decisions. Deep learning AI is able to learn without human supervision, drawing from data that is both unstructured and unlabeled.', '2020-09-07 16:39:53'),
(14, 'Robotics', 'Robotics is an interdisciplinary research area at the interface of computer science and engineering. Robotics involves design, construction, operation, and use of robots. The goal of robotics is to design intelligent machines that can help and assist humans in their day-to-day lives and keep everyone safe', '2020-09-07 16:40:20');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(50) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`created at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `created at`) VALUES
(1, 'vishwadeep', '$2y$10$YJsF2kf8EVoyUYnjJWN5ZO1dOXA1ZVGu7Reia8gE4rG7VzbL82svS', '2020-09-05 21:48:09'),
(2, 'mark zukerberg', '$2y$10$vbEHhkA5gRy0hXS4WcS4MuBWL.4j6SM7IDqyuEjAwHSXCPHP7hdVm', '2020-09-06 16:40:58');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `post`
--
ALTER TABLE `post`
ADD PRIMARY KEY (`sno`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `post`
--
ALTER TABLE `post`
MODIFY `sno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- Database: `phpmyadmin`
--
CREATE DATABASE IF NOT EXISTS `phpmyadmin` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
USE `phpmyadmin`;
-- --------------------------------------------------------
--
-- Table structure for table `pma__bookmark`
--
CREATE TABLE `pma__bookmark` (
`id` int(10) UNSIGNED NOT NULL,
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks';
-- --------------------------------------------------------
--
-- Table structure for table `pma__central_columns`
--
CREATE TABLE `pma__central_columns` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`col_name` varchar(64) COLLATE utf8_bin NOT NULL,
`col_type` varchar(64) COLLATE utf8_bin NOT NULL,
`col_length` text COLLATE utf8_bin DEFAULT NULL,
`col_collation` varchar(64) COLLATE utf8_bin NOT NULL,
`col_isNull` tinyint(1) NOT NULL,
`col_extra` varchar(255) COLLATE utf8_bin DEFAULT '',
`col_default` text COLLATE utf8_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Central list of columns';
-- --------------------------------------------------------
--
-- Table structure for table `pma__column_info`
--
CREATE TABLE `pma__column_info` (
`id` int(5) UNSIGNED NOT NULL,
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`table_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`column_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`comment` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`mimetype` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`transformation` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`transformation_options` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`input_transformation` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`input_transformation_options` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column information for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__designer_settings`
--
CREATE TABLE `pma__designer_settings` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`settings_data` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Settings related to Designer';
-- --------------------------------------------------------
--
-- Table structure for table `pma__export_templates`
--
CREATE TABLE `pma__export_templates` (
`id` int(5) UNSIGNED NOT NULL,
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`export_type` varchar(10) COLLATE utf8_bin NOT NULL,
`template_name` varchar(64) COLLATE utf8_bin NOT NULL,
`template_data` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Saved export templates';
-- --------------------------------------------------------
--
-- Table structure for table `pma__favorite`
--
CREATE TABLE `pma__favorite` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`tables` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Favorite tables';
-- --------------------------------------------------------
--
-- Table structure for table `pma__history`
--
CREATE TABLE `pma__history` (
`id` bigint(20) UNSIGNED NOT NULL,
`username` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`db` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`table` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`timevalue` timestamp NOT NULL DEFAULT current_timestamp(),
`sqlquery` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='SQL history for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__navigationhiding`
--
CREATE TABLE `pma__navigationhiding` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`item_name` varchar(64) COLLATE utf8_bin NOT NULL,
`item_type` varchar(64) COLLATE utf8_bin NOT NULL,
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Hidden items of navigation tree';
-- --------------------------------------------------------
--
-- Table structure for table `pma__pdf_pages`
--
CREATE TABLE `pma__pdf_pages` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`page_nr` int(10) UNSIGNED NOT NULL,
`page_descr` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='PDF relation pages for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__recent`
--
CREATE TABLE `pma__recent` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`tables` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Recently accessed tables';
--
-- Dumping data for table `pma__recent`
--
INSERT INTO `pma__recent` (`username`, `tables`) VALUES
('root', '[{\"db\":\"login\",\"table\":\"post\"},{\"db\":\"login\",\"table\":\"users\"},{\"db\":\"blog_application\",\"table\":\"tech_blog_user\"},{\"db\":\"blog_application\",\"table\":\"tech_blog\"},{\"db\":\"blog_admin_db\",\"table\":\"blogs\"},{\"db\":\"blog_admin_db\",\"table\":\"blog_categories\"},{\"db\":\"blog_admin_db\",\"table\":\"links\"},{\"db\":\"blog_admin_db\",\"table\":\"banner_posts\"},{\"db\":\"blog_admin_db\",\"table\":\"visitor_info\"},{\"db\":\"blog_admin_db\",\"table\":\"membership_users\"}]');
-- --------------------------------------------------------
--
-- Table structure for table `pma__relation`
--
CREATE TABLE `pma__relation` (
`master_db` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`master_table` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`master_field` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`foreign_db` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`foreign_table` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`foreign_field` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Relation table';
-- --------------------------------------------------------
--
-- Table structure for table `pma__savedsearches`
--
CREATE TABLE `pma__savedsearches` (
`id` int(5) UNSIGNED NOT NULL,
`username` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`search_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`search_data` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Saved searches';
-- --------------------------------------------------------
--
-- Table structure for table `pma__table_coords`
--
CREATE TABLE `pma__table_coords` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`table_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`pdf_page_number` int(11) NOT NULL DEFAULT 0,
`x` float UNSIGNED NOT NULL DEFAULT 0,
`y` float UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table coordinates for phpMyAdmin PDF output';
-- --------------------------------------------------------
--
-- Table structure for table `pma__table_info`
--
CREATE TABLE `pma__table_info` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`table_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`display_field` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table information for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__table_uiprefs`
--
CREATE TABLE `pma__table_uiprefs` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`prefs` text COLLATE utf8_bin NOT NULL,
`last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Tables'' UI preferences';
-- --------------------------------------------------------
--
-- Table structure for table `pma__tracking`
--
CREATE TABLE `pma__tracking` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`version` int(10) UNSIGNED NOT NULL,
`date_created` datetime NOT NULL,
`date_updated` datetime NOT NULL,
`schema_snapshot` text COLLATE utf8_bin NOT NULL,
`schema_sql` text COLLATE utf8_bin DEFAULT NULL,
`data_sql` longtext COLLATE utf8_bin DEFAULT NULL,
`tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') COLLATE utf8_bin DEFAULT NULL,
`tracking_active` int(1) UNSIGNED NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database changes tracking for phpMyAdmin';
-- --------------------------------------------------------
--
-- Table structure for table `pma__userconfig`
--
CREATE TABLE `pma__userconfig` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`timevalue` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`config_data` text COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User preferences storage for phpMyAdmin';
--
-- Dumping data for table `pma__userconfig`
--
INSERT INTO `pma__userconfig` (`username`, `timevalue`, `config_data`) VALUES
('root', '2020-09-07 10:12:00', '{\"Console\\/Mode\":\"collapse\",\"NavigationWidth\":177}');
-- --------------------------------------------------------
--
-- Table structure for table `pma__usergroups`
--
CREATE TABLE `pma__usergroups` (
`usergroup` varchar(64) COLLATE utf8_bin NOT NULL,
`tab` varchar(64) COLLATE utf8_bin NOT NULL,
`allowed` enum('Y','N') COLLATE utf8_bin NOT NULL DEFAULT 'N'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User groups with configured menu items';
-- --------------------------------------------------------
--
-- Table structure for table `pma__users`
--
CREATE TABLE `pma__users` (
`username` varchar(64) COLLATE utf8_bin NOT NULL,
`usergroup` varchar(64) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and their assignments to user groups';
--
-- Indexes for dumped tables
--
--
-- Indexes for table `pma__bookmark`
--
ALTER TABLE `pma__bookmark`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `pma__central_columns`
--
ALTER TABLE `pma__central_columns`
ADD PRIMARY KEY (`db_name`,`col_name`);
--
-- Indexes for table `pma__column_info`
--
ALTER TABLE `pma__column_info`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`);
--
-- Indexes for table `pma__designer_settings`
--
ALTER TABLE `pma__designer_settings`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `pma__export_templates`
--
ALTER TABLE `pma__export_templates`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `u_user_type_template` (`username`,`export_type`,`template_name`);
--
-- Indexes for table `pma__favorite`
--
ALTER TABLE `pma__favorite`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `pma__history`
--
ALTER TABLE `pma__history`
ADD PRIMARY KEY (`id`),
ADD KEY `username` (`username`,`db`,`table`,`timevalue`);
--
-- Indexes for table `pma__navigationhiding`
--
ALTER TABLE `pma__navigationhiding`
ADD PRIMARY KEY (`username`,`item_name`,`item_type`,`db_name`,`table_name`);
--
-- Indexes for table `pma__pdf_pages`
--
ALTER TABLE `pma__pdf_pages`
ADD PRIMARY KEY (`page_nr`),
ADD KEY `db_name` (`db_name`);
--
-- Indexes for table `pma__recent`
--
ALTER TABLE `pma__recent`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `pma__relation`
--
ALTER TABLE `pma__relation`
ADD PRIMARY KEY (`master_db`,`master_table`,`master_field`),
ADD KEY `foreign_field` (`foreign_db`,`foreign_table`);
--
-- Indexes for table `pma__savedsearches`
--
ALTER TABLE `pma__savedsearches`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `u_savedsearches_username_dbname` (`username`,`db_name`,`search_name`);
--
-- Indexes for table `pma__table_coords`
--
ALTER TABLE `pma__table_coords`
ADD PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`);
--
-- Indexes for table `pma__table_info`
--
ALTER TABLE `pma__table_info`
ADD PRIMARY KEY (`db_name`,`table_name`);
--
-- Indexes for table `pma__table_uiprefs`
--
ALTER TABLE `pma__table_uiprefs`
ADD PRIMARY KEY (`username`,`db_name`,`table_name`);
--
-- Indexes for table `pma__tracking`
--
ALTER TABLE `pma__tracking`
ADD PRIMARY KEY (`db_name`,`table_name`,`version`);
--
-- Indexes for table `pma__userconfig`
--
ALTER TABLE `pma__userconfig`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `pma__usergroups`
--
ALTER TABLE `pma__usergroups`
ADD PRIMARY KEY (`usergroup`,`tab`,`allowed`);
--
-- Indexes for table `pma__users`
--
ALTER TABLE `pma__users`
ADD PRIMARY KEY (`username`,`usergroup`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `pma__bookmark`
--
ALTER TABLE `pma__bookmark`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__column_info`
--
ALTER TABLE `pma__column_info`
MODIFY `id` int(5) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__export_templates`
--
ALTER TABLE `pma__export_templates`
MODIFY `id` int(5) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__history`
--
ALTER TABLE `pma__history`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__pdf_pages`
--
ALTER TABLE `pma__pdf_pages`
MODIFY `page_nr` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pma__savedsearches`
--
ALTER TABLE `pma__savedsearches`
MODIFY `id` int(5) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- Database: `test`
--
CREATE DATABASE IF NOT EXISTS `test` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `test`;
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
|
e722d482032c88ce147d790f2e00f92f45ac2958
|
SQL
|
Dagga78/Pourmiam-
|
/tests/db/test_db.sql
|
UTF-8
| 3,589
| 3.796875
| 4
|
[] |
no_license
|
DROP TABLE IF EXISTS keyword ;
CREATE TABLE keyword (
'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
'name' varchar (255) NOT NULL UNIQUE );
INSERT INTO keyword VALUES (1,'Success');
INSERT INTO keyword VALUES (2,'Technology');
DROP TABLE IF EXISTS users ;
CREATE TABLE "users" (
"id" varchar PRIMARY KEY ASC,
"firstname" varchar(255) NOT NULL,
"lastname" varchar(255) NOT NULL,
"email" varchar(255) NOT NULL,
"password" varchar(255) NOT NULL,
"is_confirmed" boolean
);
--
-- Contenu de la table "users"
--
-- User 1, valide, pwd jano
INSERT INTO "users" VALUES (1,'Jano','Lapin','jano@lapin.net', '$2y$10$x4KDo1NWZA3n8jm8RnpG5OgDG2mIEianft602fLawel1yzsgt9hx2',1);
-- User 2, not finished, pwd guest
INSERT INTO "users" VALUES (2,'Guest','Lapin','guest@lapin.net', '$2y$10$zKOT1Ihgj97y0XEt3UDJueK7cyEpVPGgIw.BZNhM0TFDWWbsJ9tiG',0);
DROP TABLE IF EXISTS auth_tokens ;
CREATE TABLE "auth_tokens" (
"id" integer PRIMARY KEY ASC,
"user_id" integer NOT NULL,
"auth_token" varchar(255) NOT NULL,
"expiration" timestamp NOT NULL
);
--- this token is always valid for user 1, expiration in 2069
INSERT INTO auth_tokens (user_id,auth_token,expiration) VALUES (1,'ABCDEF0123456789','2069-22-09 18:00:00');
--- this token is always old for user 1, expiration in 1969
INSERT INTO auth_tokens (user_id,auth_token,expiration) VALUES (1,'0123456789ABCDEF','1969-22-09 18:00:00');
DROP TABLE IF EXISTS company ;
--Contenu de la table "company"
CREATE TABLE company (
id varchar NOT NULL PRIMARY KEY,
siret varchar (255),
name varchar (255) NOT NULL,
creation_date Date,
people varchar (255),
addr varchar (255),
city varchar (255) NOT NULL,
zip_code varchar (255),
department varchar (255) NOT NULL,
scope varchar (255),
website varchar (255),
presentation varchar (255),
logo varchar
);
-- company 1,
INSERT INTO company (id,siret,name,creation_date,people,addr,city,zip_code,department,scope,website,presentation)
VALUES (1,'1475286391247544','Orange','1992-07-22','01 - 1 ou 2 salariés','6 avenue de westphalie','Montigny le Bretonneux','78180','Yvelines','Ile de france','orange.com','Orange Blabla presentation');
-- company 2,
INSERT INTO company (id,siret,name,creation_date,people,addr,city,zip_code,department,scope,website,presentation)
VALUES (2,'1479865464853798','Options','1997-08-12','01 - 1 ou 2 salariés','10 domaine du val hubert','Longnes','78980','Yvelines','Ile de france','options.com','Options Blabla presentation');
DROP TABLE IF EXISTS company_keyword ;
CREATE TABLE "company_keyword" (
"id" varchar PRIMARY KEY ASC,
"company_id" integer NOT NULL,
"keyword_id" integer NOT NULL
);
INSERT INTO company_keyword (id,company_id,keyword_id) VALUES (1,1,1);
INSERT INTO company_keyword (id,company_id,keyword_id) VALUES (2,1,2);
DROP TABLE IF EXISTS confirm_tokens ;
CREATE TABLE confirm_tokens (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
token varchar ( 255 ) NOT NULL,
expiration timestamp,
type_confirm varchar ( 255 )
);
--- this token is always valid for user 1, expiration in 2069
INSERT INTO confirm_tokens (user_id,token,expiration,type_confirm) VALUES (1,'RESETNOEXPI0123','2069-22-09 18:00:00','reset');
--- this token is always old for user 1, expiration in 1969
INSERT INTO confirm_tokens (user_id,token,expiration,type_confirm) VALUES (1,'3210EXPIRESET','1969-22-09 18:00:00','reset');
--- this token is always valid for user 1, expiration in 2069
INSERT INTO confirm_tokens (user_id,token,expiration,type_confirm) VALUES (3,'ABCDEF0123456789','2069-22-09 18:00:00','init');
| true
|
b7c1c257f7496721ad285be8f179247103877f0d
|
SQL
|
zzSAT2014/grammer
|
/grammer.sql
|
UTF-8
| 434
| 2.734375
| 3
|
[] |
no_license
|
use test;
drop table if exists grammer_bank;
create table grammer_bank (
question_id varchar(30) not null,
type1 int not null default 0,
type2 int not null default 0,
type3 int not null default 0,
type4 int not null default 0,
type5 int not null default 0,
type6 int not null default 0,
type7 int not null default 0,
type8 int not null default 0,
primary key (question_id)
) engine=InnoDB;
| true
|
ba23d80c622eb0b29b08b0e76ff8e1bfe348f829
|
SQL
|
k-mendza/pfinance
|
/src/main/resources/db/migration/V1.03__data.sql
|
UTF-8
| 11,525
| 3.171875
| 3
|
[] |
no_license
|
-- USERS
INSERT INTO app_user (first_name, last_name, email_address, creation_date)
VALUES ('Developer','PFinance','devfinance@fin.com',current_date);
-- TRANSACTION CATEGORY
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Jedzenie','Zakupy spożywcze', current_date);
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Mieszkanie / dom', 'Kredyt, wynajem, czynsz do spółdzielni', current_date);
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Transport','Bilety komunikacji, paliwo', current_date);
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Telekomunikacja','Internet, komórka, telewizja', current_date);
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Opieka zdrowotna', 'Leczenie, konsultacje, badania, leki', current_date);
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Ubranie','Wydatki związane z odzieżą', current_date);
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Higiena', 'Środki czystości, kosmetyki', current_date);
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Dzieci', 'Dzieci', current_date);
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Rozrywka','Rozrywka', current_date);
INSERT INTO transaction_category (name, description, creation_date)
VALUES ('Inne wydatki','Koszty nie ujęte w innych kategoriach', current_date);
-- TRANSACTION SUBCATEGORY
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (1 ,'Jedzenie dom','Jedzenie w domu, składniki itd.', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (1 ,'Jedzenie miasto','Jedzenie na mieście', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (1 ,'Jedzenie praca','Jedzenie w/do pracy', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (1 ,'Wyjścia','Wyjścia ze znajomymi', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (1 ,'Inne','Inne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Czynsz','Czynsz', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Woda i kanalizacja','Woda i kanalizacja', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Prąd','Prąd', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Gaz','Gaz', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Ogrzewanie','Ogrzewanie', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Wywóz śmieci','Wywóz śmieci', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Konserwacja i naprawy','Konserwacja i naprawy', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Wyposażenie','Wyposażenie', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Ubezpieczenie nieruchomości','Ubezpieczenie nieruchomości', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (2 ,'Inne','Inne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (3 ,'Paliwo','Paliwo', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (3 ,'Przeglądy i naprawy auta','Przeglądy i naprawy auta', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (3 ,'Wyposażenie dodatkowe pojazdu','Przeglądy i naprawy auta', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (3 ,'Ubezpieczenie pojazdu','Ubezpieczenie pojazdu', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (3 ,'Bilety komunikacji miejskiej','Bilety komunikacji miejskiej', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (3 ,'Bilet PKP, PKS','Bilet PKP, PKS', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (3 ,'Taxi','Taxi', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (3 ,'Inne','Inne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (4 ,'Telefon komórkowy','Telefon komórkowy', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (4 ,'TV','TV', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (4 ,'Internet','Internet', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (4 ,'Inne','Inne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (5 ,'Lekarz','Lekarz', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (5 ,'Badania','Badania', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (5 ,'Leki','Leki', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (5 ,'Inne','Inne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (6 ,'Ubranie zwykłe','Ubranie zwykłe', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (6 ,'Ubranie sportowe','Ubranie sportowe', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (6 ,'Buty','Buty', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (6 ,'Dodatki','Dodatki', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (6 ,'Inne','Inne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (7 ,'Kosmetyki','Kosmetyki', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (7 ,'Środki czystości','Środki czystości', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (7 ,'Fryzjer','Fryzjer', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (7 ,'Kosmetyczka','Kosmetyczka', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (7 ,'Inne','Inne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (8 ,'Artykuły szkolne','Artykuły szkolne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (8 ,'Dodatkowe zajęcia','Dodatkowe zajęcia', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (8 ,'Wpłaty na szkołę itp.','Wpłaty na szkołę itp.', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (8 ,'Zabawki / gry','Zabawki / gry', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (8 ,'Opieka nad dziećmi','Opieka nad dziećmi', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (8 ,'Inne','Inne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (9 ,'Siłownia / Basen','Siłownia / Basen', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (9 ,'Kino / Teatr','Kino / Teatr', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (9 ,'Koncerty','Koncerty', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (9 ,'Czasopisma','Czasopisma', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (9 ,'Książki','Książki', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (9 ,'Hobby','Hobby', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (9 ,'Hotel / Turystyka','Hotel / Turystyka', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (9 ,'Inne','Inne', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (10 ,'Dobroczynność','Dobroczynność', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (10 ,'Prezenty','Prezenty', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (10 ,'Sprzęt RTV','Sprzęt RTV', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (10 ,'Oprogramowanie','Oprogramowanie', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (10 ,'Edukacja / Szkolenia','Edukacja / Szkolenia', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (10 ,'Inne usługi','Inne usługi', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (10 ,'Podatki','Podatki', current_date);
INSERT INTO transaction_subcategory (category_id, name, description, creation_date)
VALUES (10 ,'Inne','Inne', current_date);
-- PAYEE --
INSERT INTO payee (name, description, creation_date)
VALUES ('Biedronka', 'Sieć sklepów Jeronimo Martins', current_date);
INSERT INTO payee (name, description, creation_date)
VALUES ('Chang Jang', 'Właściciel chinola', current_date);
-- CURRENCY --
INSERT INTO currency (id, description, creation_date)
VALUES ('PLN', 'Polski złoty', current_date);
-- PAY SOURCES --
INSERT INTO pay_source (name, description, creation_date)
VALUES ('Karta IDEA', 'Karta płatnicza IDEA Banku', current_date);
-- TRANSACTIONS --
INSERT INTO transaction (app_user_id, payee_id, pay_source_id, title, description, amount, currency_id, flg_tax, flg_obligatory, flg_cyclical, category_id, creation_date, subcategory_id)
VALUES (1, 1, 1, 'Zakupy', 'Biedronka', 50.0, 'PLN', 'N','N','N', 1, current_date, 1);
INSERT INTO transaction (app_user_id, payee_id, pay_source_id, title, description, amount, currency_id, flg_tax, flg_obligatory, flg_cyclical, category_id, creation_date, subcategory_id)
VALUES (1, 2, 1, 'Obiad', 'Chińczyk', 20.0, 'PLN', 'N','N','N', 1, current_date, 3);
commit;
| true
|
4591156bcc16ad1972bd3220d0dc426ef9b44034
|
SQL
|
pisuduo/Play-with-SQL
|
/Productrelated/Friend_Recommendation.sql
|
UTF-8
| 1,080
| 4.59375
| 5
|
[] |
no_license
|
---Write an SQL query that makes recommendations using the pages that your friends liked.
---Assume you have two tables: a two-column table of users and their friends,
---and a two-column table of users and the pages they liked. It should not recommend pages you already like
CREATE table likes
(
userid int not null,
pageid int not null
);
CREATE table friends
(
userid int not null,
friendid int not null
);
insert into likes VALUES
(1, 101), (1, 201),(1,301),
(2, 201), (2, 301),
(3,101),(3,401);
insert into friends VALUES
(1, 2),(2,3),(2,1),(3,2);
select * from likes;
select * from friends;
------------------ solution ---------------------------------------
select distinct x.userid as users,y.pageid as recom
from friends x
join likes y -- join with likes, to see friend's likes.
on x.friendid=y.userid
left join likes z -- join with likes, to see userid and corresponding likes.
on x.userid=z.userid and y.pageid=z.pageid
where z.pageid IS NULL; -- that selects the pages which are not in your likes, but in your friends' likes.
| true
|
c6bcdf072e89d7bccfc590ecfa245b1f76e56ae0
|
SQL
|
emmanueletti/bootcampx
|
/4_queries/10_most-confusing-assignments.sql
|
UTF-8
| 411
| 4.09375
| 4
|
[] |
no_license
|
-- List each assignment with the total number of assistance requests with it.
-- Select the assignment's id, day, chapter, name and the total assistances.
-- Order by total assistances in order of most to least.
SELECT
a.id,
a.name,
a.day,
a.chapter,
COUNT(*) AS total_requests
FROM assistance_requests a_r
JOIN assignments a
ON a_r.assignment_id = a.id
GROUP BY a.id
ORDER BY total_requests DESC
| true
|
0352298147b934232e18e6f4c863a9a48f3a5663
|
SQL
|
ramonhentges/snmp-monitor
|
/backend/script-bd.sql
|
UTF-8
| 9,170
| 2.75
| 3
|
[] |
no_license
|
CREATE SEQUENCE public.email_id_email_seq;
CREATE TABLE public.email (
id_email INTEGER NOT NULL DEFAULT nextval('public.email_id_email_seq'),
descricao VARCHAR NOT NULL,
email_origem VARCHAR NOT NULL,
email_destino VARCHAR NOT NULL,
host_smtp VARCHAR NOT NULL,
porta_smtp INTEGER NOT NULL,
criptografia BOOLEAN NOT NULL,
usuario VARCHAR NOT NULL,
senha VARCHAR NOT NULL,
CONSTRAINT id_email PRIMARY KEY (id_email)
);
ALTER SEQUENCE public.email_id_email_seq OWNED BY public.email.id_email;
CREATE SEQUENCE public.usuario_id_usuario_seq;
CREATE TABLE public.usuario (
id_usuario INTEGER NOT NULL DEFAULT nextval('public.usuario_id_usuario_seq'),
nome_completo VARCHAR NOT NULL,
usuario VARCHAR NOT NULL,
senha VARCHAR NOT NULL,
CONSTRAINT id_usuario PRIMARY KEY (id_usuario)
);
ALTER SEQUENCE public.usuario_id_usuario_seq OWNED BY public.usuario.id_usuario;
CREATE SEQUENCE public.severidade_id_severidade_seq_1;
CREATE TABLE public.severidade (
id_severidade INTEGER NOT NULL DEFAULT nextval('public.severidade_id_severidade_seq_1'),
descricao VARCHAR NOT NULL,
CONSTRAINT id_severidade PRIMARY KEY (id_severidade)
);
ALTER SEQUENCE public.severidade_id_severidade_seq_1 OWNED BY public.severidade.id_severidade;
CREATE SEQUENCE public.template_id_template_seq;
CREATE TABLE public.template (
id_template INTEGER NOT NULL DEFAULT nextval('public.template_id_template_seq'),
descricao VARCHAR NOT NULL,
CONSTRAINT id_template PRIMARY KEY (id_template)
);
ALTER SEQUENCE public.template_id_template_seq OWNED BY public.template.id_template;
CREATE SEQUENCE public.sensor_id_sensor_seq;
CREATE TABLE public.sensor (
id_sensor INTEGER NOT NULL DEFAULT nextval('public.sensor_id_sensor_seq'),
descricao VARCHAR NOT NULL,
oid VARCHAR NOT NULL,
ativo BOOLEAN NOT NULL,
intervalo INTEGER NOT NULL,
id_template INTEGER NOT NULL,
tipo VARCHAR NOT NULL,
CONSTRAINT id_sensor PRIMARY KEY (id_sensor)
);
ALTER SEQUENCE public.sensor_id_sensor_seq OWNED BY public.sensor.id_sensor;
CREATE SEQUENCE public.trigger_id_trigger_seq;
CREATE TABLE public.trigger (
id_trigger INTEGER NOT NULL DEFAULT nextval('public.trigger_id_trigger_seq'),
descricao VARCHAR NOT NULL,
id_sensor INTEGER NOT NULL,
id_severidade INTEGER NOT NULL,
ativo BOOLEAN NOT NULL,
enviar_email BOOLEAN NOT NULL,
valor_comparado VARCHAR NOT NULL,
comparacao VARCHAR NOT NULL,
CONSTRAINT id_trigger PRIMARY KEY (id_trigger)
);
ALTER SEQUENCE public.trigger_id_trigger_seq OWNED BY public.trigger.id_trigger;
CREATE SEQUENCE public.grupo_id_grupo_seq;
CREATE TABLE public.grupo (
id_grupo INTEGER NOT NULL DEFAULT nextval('public.grupo_id_grupo_seq'),
descricao VARCHAR NOT NULL,
CONSTRAINT id_grupo PRIMARY KEY (id_grupo)
);
ALTER SEQUENCE public.grupo_id_grupo_seq OWNED BY public.grupo.id_grupo;
CREATE SEQUENCE public.host_id_host_seq;
CREATE TABLE public.host (
id_host INTEGER NOT NULL DEFAULT nextval('public.host_id_host_seq'),
nome VARCHAR NOT NULL,
ip VARCHAR NOT NULL,
porta INTEGER NOT NULL,
comunidade VARCHAR NOT NULL,
CONSTRAINT id_host PRIMARY KEY (id_host)
);
ALTER SEQUENCE public.host_id_host_seq OWNED BY public.host.id_host;
CREATE SEQUENCE public.dados_sensor_host_id_dados_sensor_host_seq;
CREATE TABLE public.dados_sensor_host (
id_dados_sensor_host INTEGER NOT NULL DEFAULT nextval('public.dados_sensor_host_id_dados_sensor_host_seq'),
id_host INTEGER NOT NULL,
id_sensor INTEGER NOT NULL,
valor VARCHAR NOT NULL,
data_hora TIMESTAMP NOT NULL,
CONSTRAINT id_dados_sensor_host PRIMARY KEY (id_dados_sensor_host)
);
ALTER SEQUENCE public.dados_sensor_host_id_dados_sensor_host_seq OWNED BY public.dados_sensor_host.id_dados_sensor_host;
CREATE SEQUENCE public.problemas_id_problemas_seq;
CREATE TABLE public.problemas (
id_problemas INTEGER NOT NULL DEFAULT nextval('public.problemas_id_problemas_seq'),
id_trigger INTEGER NOT NULL,
id_dados_sensor_host INTEGER NOT NULL,
data_hora_inicial TIMESTAMP NOT NULL,
data_hora_final TIMESTAMP,
CONSTRAINT id_problemas PRIMARY KEY (id_problemas)
);
ALTER SEQUENCE public.problemas_id_problemas_seq OWNED BY public.problemas.id_problemas;
CREATE TABLE public.template_host (
id_host INTEGER NOT NULL,
id_template INTEGER NOT NULL,
CONSTRAINT id_template_host PRIMARY KEY (id_host, id_template)
);
CREATE TABLE public.grupo_host (
id_grupo INTEGER NOT NULL,
id_host INTEGER NOT NULL,
CONSTRAINT id_grupo_host PRIMARY KEY (id_grupo, id_host)
);
ALTER TABLE public.trigger ADD CONSTRAINT severidade_trigger_fk
FOREIGN KEY (id_severidade)
REFERENCES public.severidade (id_severidade)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.template_host ADD CONSTRAINT template_template_host_fk
FOREIGN KEY (id_template)
REFERENCES public.template (id_template)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.sensor ADD CONSTRAINT template_sensor_fk
FOREIGN KEY (id_template)
REFERENCES public.template (id_template)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.dados_sensor_host ADD CONSTRAINT sensor_dados_sensor_host_fk
FOREIGN KEY (id_sensor)
REFERENCES public.sensor (id_sensor)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.trigger ADD CONSTRAINT sensor_trigger_fk
FOREIGN KEY (id_sensor)
REFERENCES public.sensor (id_sensor)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.problemas ADD CONSTRAINT trigger_problemas_fk
FOREIGN KEY (id_trigger)
REFERENCES public.trigger (id_trigger)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.grupo_host ADD CONSTRAINT grupo_grupo_host_fk
FOREIGN KEY (id_grupo)
REFERENCES public.grupo (id_grupo)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.grupo_host ADD CONSTRAINT host_grupo_host_fk
FOREIGN KEY (id_host)
REFERENCES public.host (id_host)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.template_host ADD CONSTRAINT host_template_host_fk
FOREIGN KEY (id_host)
REFERENCES public.host (id_host)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.dados_sensor_host ADD CONSTRAINT host_dados_sensor_host_fk
FOREIGN KEY (id_host)
REFERENCES public.host (id_host)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.problemas ADD CONSTRAINT dados_sensor_host_problemas_fk
FOREIGN KEY (id_dados_sensor_host)
REFERENCES public.dados_sensor_host (id_dados_sensor_host)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
CREATE SEQUENCE public.indisponibilidade_id_indisponibilidade_seq;
CREATE TABLE public.indisponibilidade (
id_indisponibilidade INTEGER NOT NULL DEFAULT nextval('public.indisponibilidade_id_indisponibilidade_seq'),
id_host INTEGER NOT NULL,
data_hora_inicial TIMESTAMP NOT NULL,
data_hora_final TIMESTAMP,
CONSTRAINT id_indisponibilidade PRIMARY KEY (id_indisponibilidade)
);
ALTER SEQUENCE public.indisponibilidade_id_indisponibilidade_seq OWNED BY public.indisponibilidade.id_indisponibilidade;
ALTER TABLE public.indisponibilidade ADD CONSTRAINT host_indisponibilidade_fk
FOREIGN KEY (id_host)
REFERENCES public.host (id_host)
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE;
ALTER TABLE public.host
ADD COLUMN email_indisponibilidade boolean NOT NULL
DEFAULT false;
ALTER TABLE public.sensor
ADD COLUMN expressao VARCHAR NULL;
ALTER TABLE public.sensor
ADD COLUMN dias_armazenado INTEGER NOT NULL;
INSERT INTO email (descricao, email_origem, email_destino, host_smtp, porta_smtp, criptografia, usuario, senha) VALUES ('desc', 'teste@teste.com', 'teste@teste.com', 'teste.com', 587, true, 'usuario', 'senha');
INSERT INTO severidade (descricao) VALUES ('Aviso');
INSERT INTO severidade (descricao) VALUES ('Problema');
INSERT INTO usuario (nome_completo, usuario, senha) VALUES ('admin', 'admin', 'e10adc3949ba59abbe56e057f20f883e');
| true
|
4803b875e9a005d00eef0650d9a55f42b285873e
|
SQL
|
avifiqri/vermaks-pakazzam
|
/vermaks.sql
|
UTF-8
| 1,912
| 3.046875
| 3
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.8.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 28 Bulan Mei 2020 pada 16.57
-- Versi server: 10.1.33-MariaDB
-- Versi PHP: 7.2.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `vermaks`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(288) NOT NULL,
`password` varchar(255) NOT NULL,
`date_created` int(11) NOT NULL,
`is_active` int(11) NOT NULL,
`handphone` varchar(12) NOT NULL,
`role_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `user`
--
INSERT INTO `user` (`id`, `name`, `email`, `password`, `date_created`, `is_active`, `handphone`, `role_id`) VALUES
(2, 'andi', 'andi@gmail.com', 'yusuf123', 1590554808, 1, '+62888343434', 1),
(3, 'aku', 'avifiqriy@gmail.com', '1', 1590555046, 1, '086348354334', 0),
(5, 'M Yusuf Avifiqri', 'myusufavifiqri@gmail.com', '$2y$10$OZfKtt.fTsLbjJB6iuQ/E.JJV.NMqk24DuB6f66zzyfHX9.K4IxTe', 1590561352, 1, '087896443672', 1),
(6, 'ngarang', 'ngarang@gmail.com', '1', 1590561464, 0, '+62888343434', 2);
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
26fd06cbe5ab3402379389494e6728d1c98137de
|
SQL
|
jephmann/worksearch
|
/_sql/profile.sql
|
UTF-8
| 1,950
| 3.3125
| 3
|
[] |
no_license
|
DROP TABLE IF EXISTS `profile`;
CREATE TABLE `profile` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date_created` datetime NOT NULL,
`date_updated` datetime NOT NULL,
`remarks` varchar(255) COLLATE utf8_unicode_ci,
`address_building` varchar(255) COLLATE utf8_unicode_ci,
`address_city` varchar(255) COLLATE utf8_unicode_ci,
`address_state` varchar(2) COLLATE utf8_unicode_ci,
`address_street` varchar(255) COLLATE utf8_unicode_ci,
`address_unit` varchar(255) COLLATE utf8_unicode_ci,
`address_zip4` varchar(4) COLLATE utf8_unicode_ci,
`address_zip5` varchar(5) COLLATE utf8_unicode_ci,
`date_birth` datetime,
`drivers_license` varchar(25) COLLATE utf8_unicode_ci,
`drivers_state` varchar(2) COLLATE utf8_unicode_ci,
`email` varchar(255) COLLATE utf8_unicode_ci,
`fax` varchar(10) COLLATE utf8_unicode_ci,
`gender` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'O',
`id_name_suffix` int(11),
`id_salutation` int(11),
`id_user` int(11) NOT NULL,
`name_first` varchar(255) COLLATE utf8_unicode_ci,
`name_last` varchar(255) COLLATE utf8_unicode_ci,
`name_middle` varchar(255) COLLATE utf8_unicode_ci,
`phone` varchar(10) COLLATE utf8_unicode_ci,
`phone_extension` varchar(5) COLLATE utf8_unicode_ci,
`phone_mobile` varchar(10) COLLATE utf8_unicode_ci,
`skype` varchar(255) COLLATE utf8_unicode_ci,
`social_security_number` varchar(9) COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
CREATE TRIGGER `profile_insert`
BEFORE INSERT ON `profile`
FOR EACH ROW SET
NEW.date_created = UTC_TIMESTAMP,
NEW.date_updated = '0000-00-00 00:00:00';
CREATE TRIGGER `profile_update`
BEFORE UPDATE ON `profile`
FOR EACH ROW SET
NEW.date_updated = UTC_TIMESTAMP,
NEW.date_created = OLD.date_created;
| true
|
4245c212d7506b93f2716b643a470bec6ac98652
|
SQL
|
ReciPull/recipull.github.io
|
/Non-React Stuff/DatabaseTesting/getIngredientsFromRecipe.sql
|
UTF-8
| 365
| 3.0625
| 3
|
[
"MIT"
] |
permissive
|
/* Rhianna So and Alexis Cole */
SELECT recipes.ingredient1, recipes.ingredient2, recipes.ingredient3, recipes.ingredient4, recipes.ingredient5, recipes.ingredient6, recipes.ingredient7, recipes.ingredient8, recipes.ingredient9, recipes.ingredient10
FROM recipes
WHERE recipes.recipe_name = "recipeName";
/* where recipeName is the name of the recipe being searched */
| true
|
9bdfd4cfa747f034f231401ebe2ef80a132d587d
|
SQL
|
cssat/sql_dev
|
/POCLabs Documentation/Query Example for Form Data.sql
|
UTF-8
| 3,996
| 4.28125
| 4
|
[] |
no_license
|
/* This query finds all the Housing Survey forms for each Case and returns the County, Number of People in Household, Monthly Income, and Service Date question responses. */
/* The keys for forms and questions in this query do not correspond to actual data records. This query was written before the database existed and is to be used as an example only. */
SELECT
AI.CaseKey
,FS.FormSubmissionKey
/* We need to use the MAX() function because the table structure will return one row for each of the questions,
which must be reduced to eliminate NULL values and give us one row per form with the responses for the questions that were answered.
If we want to supply a default, it should come in an ISNULL() function outside the MAX() function, not inside the MAX() function,
otherwise the MAX() function will use the default we've suppied and possibly eliminate good data. */
,ISNULL(MAX(IIF(FD.QuestionKey = 8582, DI1.DataItemValue, NULL)), 'None Entered') [County]
/* Multiple Choice and Multiple Answer questions must be handled differently. Multiple Choice questions will have one answer,
but Multiple Answer questions need to account for every option that could be chosen, so they must all be considered as possible answer columns. */
,IIF(MAX(IIF(FD.QuestionKey = 5028, DI1.DataItemKey, NULL)) IS NULL, 'Not Answered', ISNULL(MAX(IIF(FD.QuestionKey = 5028 AND DI1.DataItemKey = 118, 'Yes', NULL)), 'No')) [RemovedAbuse]
,IIF(MAX(IIF(FD.QuestionKey = 5028, DI1.DataItemKey, NULL)) IS NULL, 'Not Answered', ISNULL(MAX(IIF(FD.QuestionKey = 5028 AND DI1.DataItemKey = 119, 'Yes', NULL)), 'No')) [RemovedNeglect]
,IIF(MAX(IIF(FD.QuestionKey = 5028, DI1.DataItemKey, NULL)) IS NULL, 'Not Answered', ISNULL(MAX(IIF(FD.QuestionKey = 5028 AND DI1.DataItemKey = 203, 'Yes', NULL)), 'No')) [RemovedDrugs]
,MAX(IIF(FD.QuestionKey = 3352, DI2.DataIntValue, NULL)) [NumberOfPeopleInHousehold]
,MAX(IIF(FD.QuestionKey = 3353, DI3.DataMoneyValue, NULL)) [MonthlyIncome]
,MAX(IIF(FD.QuestionKey = 4152, DI8.DataDate, NULL)) [ServiceDate]
FROM dbo.FormSubmission FS
INNER JOIN dbo.Form F ON
F.FormKey = FS.FormKey
/* We need to make sure we are pulling data for the right form regardless of the version of the form used. */
AND F.FormNameKey = 9253 -- Housing Survey
INNER JOIN dbo.ActivityInstanceFormSubmitted AIFS ON
AIFS.FormSubmittedKey = FS.FormSubmittedKey
INNER JOIN dbo.ActivityInstance AI ON
AI.ActivityInstanceKey = AIFS.ActivityInstanceKey
/* We don't want forms that may still be around from instances of activities that were, for one reason or another, deleted after they were created. */
AND AI.DeletedDate IS NULL
INNER JOIN dbo.Activity A ON
A.ActivityKey = AI.ActivityKey
/* We want to ensure at least one of the questions were answered, so we INNER JOIN.
If we wanted all forms regardless of the number of questions answered, we would LEFT JOIN to the FormData table. */
INNER JOIN dbo.FormData FD ON
FD.FormSubmissionKey = FS.FormSubmissionKey
AND FD.QuestionKey IN (
8582 -- County -- Multiple Choice
,5028 -- Removal Reasons -- Multiple Answer
,3352 -- Number of people in household -- Integer
,3353 -- Monthly Income -- Money
,4152 -- Service Date -- Date
)
/* Each data table will likely have records with the same key value as in the other tables,
so we need to filter to the correct DataTypeKey supplied in FormData for the table we are joining to. */
LEFT JOIN dbo.DataItem DI1 ON
DI1.DataItemKey = FD.DataValueKey
AND FD.DataTypeKey = 1 -- Multiple Choice/Answer Data
LEFT JOIN dbo.DataInt DI2 ON
DI2.DataIntKey = FD.DataValueKey
AND FD.DataTypeKey = 2 -- Integer Data
LEFT JOIN dbo.DataMoney DM3 ON
DM3.DataMoneyKey = FD.DataValueKey
AND FD.DataTypeKey = 3 -- Money Data
LEFT JOIN dbo.DataDate DD8 ON
DD8.DataDateKey = FD.DataValueKey
AND FD.DataTypeKey = 8 -- Date Data
/* We don't want forms that were deleted after they were created. */
WHERE FS.DeletedDate IS NULL
GROUP BY
AI.CaseKey
,FS.FormSubmittedKey
| true
|
0e477df7676530f485ffade0b0fec02f1c8e4949
|
SQL
|
equivi/mailsy-application-controller
|
/target/classes/db/V1_1__create_app_registry.sql
|
UTF-8
| 470
| 2.546875
| 3
|
[] |
no_license
|
DROP TABLE IF EXISTS `app_registry`;
CREATE TABLE `app_registry` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`customer_name` varchar(255) DEFAULT NULL,
`registry_key` varchar(255) DEFAULT NULL,
`expiry_date` datetime DEFAULT NULL,
`created_by` bigint(20) DEFAULT NULL,
`created_datetime` datetime DEFAULT NULL,
`last_updated_datetime` datetime DEFAULT NULL,
`updated_by` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| true
|
d5f7a59e2a6bfacfc6188d0d9322737219295625
|
SQL
|
declan-1992/Data_Analysis_with_SQL
|
/calculate_churn.sql
|
UTF-8
| 849
| 4.25
| 4
|
[] |
no_license
|
SELECT 1.0 *
(
SELECT COUNT(*) --calculate number of customers that cancelled their subscription in January 2017
FROM subscriptions
WHERE subscription_start < '2017-01-01' --ensure the customer had the subscription before January 2017
AND (
subscription_end --obtain customers who ended their subscriptions between January 1st and January 31st
BETWEEN '2017-01-01'
AND '2017-01-31'
)
) / (
SELECT COUNT(*) --divide by the total number of customers who have a subscription in January 2017
FROM subscriptions
WHERE subscription_start < '2017-01-01' --ensure the customer had the subscription before January 2017
AND (
(subscription_end >= '2017-01-01')
OR (subscription_end IS NULL) --get customers who ended their subsciption after January 1st OR they still have the subscription
)
)
AS result;
| true
|
50968e2a3159949b71b26e0b968fc6b70fc169d6
|
SQL
|
vinhking/EmployeeDirectory
|
/Config/employee_directory (2).sql
|
UTF-8
| 6,545
| 3.21875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jul 25, 2016 at 05:30 AM
-- Server version: 10.1.13-MariaDB
-- PHP Version: 7.0.6
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: `employee_directory`
--
-- --------------------------------------------------------
--
-- Table structure for table `departments`
--
CREATE TABLE `departments` (
`id` int(11) NOT NULL,
`name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `departments`
--
INSERT INTO `departments` (`id`, `name`, `created`, `modified`) VALUES
(1, 'engineering', '2016-07-14 09:10:36', '2016-07-14 09:10:36'),
(5, 'accountant', '2016-07-14 09:12:09', '2016-07-14 09:12:09'),
(12, 'Human Resources', '2016-07-15 03:33:01', '2016-07-15 03:33:01'),
(13, 'ttttttttttttt', '2016-07-25 04:49:03', '2016-07-25 05:00:03'),
(14, 'sxedrftvgyhu', '2016-07-25 04:53:35', '2016-07-25 04:53:35');
-- --------------------------------------------------------
--
-- Table structure for table `employees`
--
CREATE TABLE `employees` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`birth` date DEFAULT NULL,
`gender` tinyint(1) DEFAULT NULL,
`position` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`department_id` int(11) UNSIGNED NOT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `employees`
--
INSERT INTO `employees` (`id`, `name`, `email`, `birth`, `gender`, `position`, `department_id`, `created`, `modified`) VALUES
(1, 'vinh', 'nguyenquangvinh.bkhn@gmail.com', '2016-07-14', 1, 'developer', 1, '2016-07-14 10:32:14', '2016-07-14 10:32:14'),
(2, 'Hân ', 'adaddadad@gmail.com', '2016-07-14', 0, 'manager', 5, '2016-07-14 10:43:04', '2016-07-14 10:43:04'),
(3, 'Linh', 'cdbcdbc@gmail.com', '2016-07-15', 0, 'assistant', 12, '2016-07-15 08:37:54', '2016-07-15 08:37:54'),
(6, 'ppppppppppppppppp', 'tntntnnt@gmail.com', '2016-07-15', 0, 'zdfgh', 5, '2016-07-15 05:56:29', '2016-07-25 04:55:49');
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`username` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`display_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`avatar` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
`role` tinyint(2) UNSIGNED DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `email`, `display_name`, `avatar`, `role`, `created`, `modified`) VALUES
(1, 'aaa', '$2a$10$OWoRNX79CT/AkulIaa8T5Os7622dtxYwJaDhIY/HMU.4QFCMHVkoO', '', NULL, NULL, 0, '2016-07-08 04:09:15', '2016-07-12 10:02:47'),
(38, 'vinhking', '$2a$10$nSB.5rXHx4eHlYhYJj0HIem9Vb3qX.NrGXdh9TVbm9wz7zSKd3d1q', 'nguyenquangvinh.bkhn@gmail.com', 'vinhking', NULL, 1, '2016-07-13 05:50:27', '2016-07-13 05:50:27'),
(42, 'acacacaca', '$2a$10$gbtqMSbESA.2PHIQh.X33e0qiffuj33YMR2I8LnksrRwa9/iDUoXG', 'acacacacac@gmail.com', 'accacacaca', 'img/webimages/users/chankailoon.jpg', 0, '2016-07-24 12:24:52', '2016-07-24 12:24:52'),
(43, 'avavavav', '$2a$10$2FCDclClKqvYTCT605Jj8uR84gfjMxINMphK7zgu6uC9OsE4Zc3le', 'khongtenkhongtuoi.102102@gmail.com', 'avavavavv', 'img/webimages/users/phongtran.gif', 0, '2016-07-24 12:32:36', '2016-07-24 12:32:36'),
(44, 'tytytytyty', '$2a$10$0Z4sdHQV.RLQdYZ.3oHhVuFjdSeERTtT2Bf.PztuHz9Zka.cjy1ea', 'tytytytyy@gmail.com', 'ththhhtth', NULL, 1, '2016-07-24 17:01:40', '2016-07-24 17:01:40'),
(45, 'uujujjuujuj', '$2a$10$SPwhTqtQuDBBiGnt38mhvOs/.D.We2uV3zNgBCNAVvSt8WjGlJRvC', 'ukkukuku@gmail.com', 'kyykykkyk', NULL, 1, '2016-07-24 17:09:32', '2016-07-24 17:09:32'),
(46, 'xrdcfvgh', '$2a$10$8AUNQPQnwJ.qs7GtZiLBxupZiGBOkmhDCJpyVcm5QevSlYCIbgMSu', 'dxgfvh@gmail.com', 'dcfvghjnk', 'img/webimages/users/chankailoon.jpg', 1, '2016-07-24 18:06:48', '2016-07-24 18:06:48'),
(47, 'tfvghbjknm', '$2a$10$EIfdcf6V2h4SpAP3EWscBu4Lg7XahkeDrDvgfcr/ka1NaAVlBuMmK', 'tcfgvhbj@gmail.com', 'dcfgvhbj', 'img/webimages/users/phongtran.gif', 1, '2016-07-24 18:07:52', '2016-07-24 18:07:52'),
(48, 'drxcfvgbhj', '$2a$10$5iPfa4.cShjzqzeFeK.V2e686GnFbXuXH93nW88fR7uYu9H1lfB2C', 'esxdrcfvghb@gmail.com', 'sexdcfgvhb', 'img/webimages/users/chankailoon.jpg', 1, '2016-07-25 03:35:33', '2016-07-25 03:35:33');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `departments`
--
ALTER TABLE `departments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `employees`
--
ALTER TABLE `employees`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51;
/*!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
|
ac9862486d280c4566df0a04d3af22478db810bc
|
SQL
|
calebdenby/StoryBlend
|
/SQL TABLES/story_list.sql
|
UTF-8
| 1,697
| 2.984375
| 3
|
[
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Feb 14, 2017 at 06:09 PM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 5.5.38
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: `id695241_storyblenddb`
--
-- --------------------------------------------------------
--
-- Table structure for table `story_list`
--
CREATE TABLE `story_list` (
`id` int(50) NOT NULL,
`created_by_id` int(50) NOT NULL,
`story_name` varchar(100) NOT NULL,
`story_description` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `story_list`
--
INSERT INTO `story_list` (`id`, `created_by_id`, `story_name`, `story_description`) VALUES
(9, 1, 'fgfdddgd', 'dfsfdsfsdfs'),
(10, 1, 'fdgfrtet3rtrtrert43rt', 't5432ty5434554356545'),
(11, 2, 'look at me', 'A story about corbin'),
(12, 2, 'dsfghj', 'dfghj'),
(13, 2, 'adsfgh', 'asdfhg');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `story_list`
--
ALTER TABLE `story_list`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `story_list`
--
ALTER TABLE `story_list`
MODIFY `id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
/*!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
|
1b181d707085db1cf029025fc73872bdfedbf1b2
|
SQL
|
SimonJ92/ECE-Java-Project---Planning
|
/planning.sql
|
UTF-8
| 13,035
| 3.15625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jun 06, 2020 at 08:50 PM
-- Server version: 8.0.18
-- PHP Version: 7.3.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `planning`
--
-- --------------------------------------------------------
--
-- Table structure for table `cours`
--
DROP TABLE IF EXISTS `cours`;
CREATE TABLE IF NOT EXISTS `cours` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`NOM` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `NOM` (`NOM`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `cours`
--
INSERT INTO `cours` (`ID`, `NOM`) VALUES
(1, 'Electromagnetisme'),
(6, 'Electronique'),
(4, 'Optique'),
(2, 'POO Java'),
(5, 'Programmation C++'),
(3, 'Robotique');
-- --------------------------------------------------------
--
-- Table structure for table `enseignant`
--
DROP TABLE IF EXISTS `enseignant`;
CREATE TABLE IF NOT EXISTS `enseignant` (
`ID_UTILISATEUR` int(11) NOT NULL,
`ID_COURS` int(11) NOT NULL,
PRIMARY KEY (`ID_UTILISATEUR`,`ID_COURS`),
KEY `ID_COURS` (`ID_COURS`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `enseignant`
--
INSERT INTO `enseignant` (`ID_UTILISATEUR`, `ID_COURS`) VALUES
(2, 1),
(3, 2),
(1, 3),
(2, 4),
(3, 5),
(1, 6);
-- --------------------------------------------------------
--
-- Table structure for table `etudiant`
--
DROP TABLE IF EXISTS `etudiant`;
CREATE TABLE IF NOT EXISTS `etudiant` (
`ID_UTILISATEUR` int(11) NOT NULL,
`NUMERO` int(11) NOT NULL,
`ID_GROUPE` int(11) NOT NULL,
PRIMARY KEY (`ID_UTILISATEUR`),
UNIQUE KEY `NUMERO` (`NUMERO`),
KEY `ID_GROUPE` (`ID_GROUPE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `etudiant`
--
INSERT INTO `etudiant` (`ID_UTILISATEUR`, `NUMERO`, `ID_GROUPE`) VALUES
(6, 1, 1),
(7, 2, 1),
(8, 3, 2),
(9, 4, 2),
(10, 5, 3),
(11, 6, 3),
(12, 7, 4),
(13, 8, 4),
(14, 9, 5),
(15, 10, 5),
(16, 11, 6),
(17, 12, 6);
-- --------------------------------------------------------
--
-- Table structure for table `groupe`
--
DROP TABLE IF EXISTS `groupe`;
CREATE TABLE IF NOT EXISTS `groupe` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`NOM` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`IDPROMOTION` int(11) NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `NOM` (`NOM`,`IDPROMOTION`),
KEY `IDPROMOTION` (`IDPROMOTION`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `groupe`
--
INSERT INTO `groupe` (`ID`, `NOM`, `IDPROMOTION`) VALUES
(1, 'TD1', 1),
(2, 'TD2', 1),
(3, 'TD3', 2),
(4, 'TD4', 2),
(5, 'TD5', 3),
(6, 'TD6', 3);
-- --------------------------------------------------------
--
-- Table structure for table `promotion`
--
DROP TABLE IF EXISTS `promotion`;
CREATE TABLE IF NOT EXISTS `promotion` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`NOM` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `NOM` (`NOM`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `promotion`
--
INSERT INTO `promotion` (`ID`, `NOM`) VALUES
(1, '2022'),
(2, '2023'),
(3, '2024');
-- --------------------------------------------------------
--
-- Table structure for table `salle`
--
DROP TABLE IF EXISTS `salle`;
CREATE TABLE IF NOT EXISTS `salle` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`NOM` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`CAPACITE` int(11) NOT NULL,
`ID_SITE` int(11) NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `NOM` (`NOM`,`ID_SITE`),
KEY `ID_SITE` (`ID_SITE`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `salle`
--
INSERT INTO `salle` (`ID`, `NOM`, `CAPACITE`, `ID_SITE`) VALUES
(1, 'EM 0009', 100, 1),
(2, 'EM 0010', 100, 1),
(3, 'P445', 75, 2),
(4, 'P440', 35, 2),
(5, 'G 0002', 60, 4),
(6, 'G 0010', 30, 4);
-- --------------------------------------------------------
--
-- Table structure for table `seance`
--
DROP TABLE IF EXISTS `seance`;
CREATE TABLE IF NOT EXISTS `seance` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`SEMAINE` int(11) NOT NULL,
`DATE` date NOT NULL,
`HEURE_DEBUT` time NOT NULL,
`HEURE_FIN` time NOT NULL,
`ETAT` tinyint(1) UNSIGNED NOT NULL,
`ID_COURS` int(11) NOT NULL,
`ID_TYPE` int(11) NOT NULL,
PRIMARY KEY (`ID`),
KEY `ID_COURS` (`ID_COURS`),
KEY `ID_TYPE` (`ID_TYPE`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `seance`
--
INSERT INTO `seance` (`ID`, `SEMAINE`, `DATE`, `HEURE_DEBUT`, `HEURE_FIN`, `ETAT`, `ID_COURS`, `ID_TYPE`) VALUES
(1, 23, '2020-06-04', '08:30:00', '10:00:00', 3, 1, 2),
(10, 23, '2020-06-05', '10:15:00', '11:45:00', 2, 6, 7),
(13, 53, '2020-06-03', '08:30:00', '10:00:00', 1, 5, 1),
(14, 23, '2020-06-04', '12:00:00', '13:45:00', 2, 4, 2),
(15, 53, '2019-10-01', '10:15:00', '11:45:00', 1, 1, 5),
(16, 53, '2019-10-01', '08:39:00', '10:00:00', 1, 1, 1),
(17, 53, '2019-10-04', '08:30:00', '11:45:00', 1, 6, 3);
-- --------------------------------------------------------
--
-- Table structure for table `seance_enseignants`
--
DROP TABLE IF EXISTS `seance_enseignants`;
CREATE TABLE IF NOT EXISTS `seance_enseignants` (
`ID_SEANCE` int(11) NOT NULL,
`ID_ENSEIGNANT` int(11) NOT NULL,
PRIMARY KEY (`ID_SEANCE`,`ID_ENSEIGNANT`),
KEY `seance_enseignants_ibfk_2` (`ID_ENSEIGNANT`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `seance_enseignants`
--
INSERT INTO `seance_enseignants` (`ID_SEANCE`, `ID_ENSEIGNANT`) VALUES
(10, 1),
(17, 1),
(14, 2),
(15, 2);
-- --------------------------------------------------------
--
-- Table structure for table `seance_groupes`
--
DROP TABLE IF EXISTS `seance_groupes`;
CREATE TABLE IF NOT EXISTS `seance_groupes` (
`ID_SEANCE` int(11) NOT NULL,
`ID_GROUPE` int(11) NOT NULL,
PRIMARY KEY (`ID_SEANCE`,`ID_GROUPE`),
KEY `ID_GROUPE` (`ID_GROUPE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `seance_groupes`
--
INSERT INTO `seance_groupes` (`ID_SEANCE`, `ID_GROUPE`) VALUES
(10, 1),
(13, 1),
(15, 1),
(16, 1),
(10, 2),
(1, 4),
(14, 5),
(17, 5),
(14, 6);
-- --------------------------------------------------------
--
-- Table structure for table `seance_salles`
--
DROP TABLE IF EXISTS `seance_salles`;
CREATE TABLE IF NOT EXISTS `seance_salles` (
`ID_SEANCE` int(11) NOT NULL,
`ID_SALLE` int(11) NOT NULL,
PRIMARY KEY (`ID_SEANCE`,`ID_SALLE`),
KEY `ID_SALLE` (`ID_SALLE`),
KEY `ID_SEANCE` (`ID_SEANCE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `seance_salles`
--
INSERT INTO `seance_salles` (`ID_SEANCE`, `ID_SALLE`) VALUES
(15, 1),
(16, 1),
(10, 2),
(1, 4),
(14, 4),
(13, 6),
(17, 6);
-- --------------------------------------------------------
--
-- Table structure for table `site`
--
DROP TABLE IF EXISTS `site`;
CREATE TABLE IF NOT EXISTS `site` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`NOM` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `NOM` (`NOM`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `site`
--
INSERT INTO `site` (`ID`, `NOM`) VALUES
(1, 'Eiffel 1'),
(2, 'Eiffel 2'),
(3, 'Eiffel 3'),
(4, 'Eiffel 4');
-- --------------------------------------------------------
--
-- Table structure for table `type_cours`
--
DROP TABLE IF EXISTS `type_cours`;
CREATE TABLE IF NOT EXISTS `type_cours` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`NOM` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `NOM` (`NOM`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `type_cours`
--
INSERT INTO `type_cours` (`ID`, `NOM`) VALUES
(1, 'Cours interactif'),
(2, 'Cours magistral'),
(7, 'Devoir sur table'),
(5, 'Soutenance de projet'),
(6, 'Soutien'),
(4, 'TD'),
(3, 'TP');
-- --------------------------------------------------------
--
-- Table structure for table `utilisateur`
--
DROP TABLE IF EXISTS `utilisateur`;
CREATE TABLE IF NOT EXISTS `utilisateur` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`EMAIL` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`PASSWD` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`NOM` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`PRENOM` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`DROIT` tinyint(1) UNSIGNED NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `EMAIL` (`EMAIL`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `utilisateur`
--
INSERT INTO `utilisateur` (`ID`, `EMAIL`, `PASSWD`, `NOM`, `PRENOM`, `DROIT`) VALUES
(1, 'tminot@gmail.com', 'tm', 'Minot', 'Thierry', 3),
(2, 'waleed.mouhali@ece.fr', 'wm', 'Mouhali', 'Waleed', 3),
(3, 'jean-pierre.segado@ece.fr', 'jps', 'Segado', 'Jean-Pierre', 3),
(4, 'simon.jolly.92@gmail.com', 'admin', 'Admin', 'Admin', 1),
(5, 'edt@ece.fr', 'gestion', 'ECE', 'Paris', 2),
(6, 'simon.jolly@edu.ece.fr', 'password', 'Jolly', 'Simon', 4),
(7, 'pierre.duong@edu.ece.fr', 'motdepasse', 'Duong', 'Pierre', 4),
(8, 'gilles.liso@edu.ece.fr', 'mdp', 'Liso', 'Gilles', 4),
(9, 'bob.kek@edu.ece.fr', 'azerty', 'Kek', 'Bob', 4),
(10, 'john.doe@edu.ece.fr', '123', 'Doe', 'John', 4),
(11, 'armand.rousseau@edu.ece.fr', '010199', 'Rousseau', 'Armand', 4),
(12, 'pascal.rodrigue@edu.ece.fr', 'ytreza', 'Rodrigue', 'Pascal', 4),
(13, 'cerise.parrot@edu.ece.fr', 'azertyuiop', 'Parrot', 'Cerise', 4),
(14, 'daniel.louis@edu.ece.fr', '2468', 'Louis', 'Daniel', 4),
(15, 'laurent.dastous@edu.ece.fr', '123456789', 'Dastous', 'Laurent', 4),
(16, 'yves.vaillancourt@edu.ece.fr', 'pwd', 'Vaillantcourt', 'Yves', 4),
(17, 'adrien.dupuis@edu.ece.fr', 'passwd', 'Dupuis', 'Adrien', 4);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `enseignant`
--
ALTER TABLE `enseignant`
ADD CONSTRAINT `enseignant_ibfk_1` FOREIGN KEY (`ID_COURS`) REFERENCES `cours` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `enseignant_ibfk_2` FOREIGN KEY (`ID_UTILISATEUR`) REFERENCES `utilisateur` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `etudiant`
--
ALTER TABLE `etudiant`
ADD CONSTRAINT `etudiant_ibfk_1` FOREIGN KEY (`ID_UTILISATEUR`) REFERENCES `utilisateur` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `etudiant_ibfk_2` FOREIGN KEY (`ID_GROUPE`) REFERENCES `groupe` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `groupe`
--
ALTER TABLE `groupe`
ADD CONSTRAINT `groupe_ibfk_1` FOREIGN KEY (`IDPROMOTION`) REFERENCES `promotion` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `salle`
--
ALTER TABLE `salle`
ADD CONSTRAINT `salle_ibfk_1` FOREIGN KEY (`ID_SITE`) REFERENCES `site` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `seance`
--
ALTER TABLE `seance`
ADD CONSTRAINT `seance_ibfk_1` FOREIGN KEY (`ID_COURS`) REFERENCES `cours` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `seance_ibfk_2` FOREIGN KEY (`ID_TYPE`) REFERENCES `type_cours` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `seance_enseignants`
--
ALTER TABLE `seance_enseignants`
ADD CONSTRAINT `seance_enseignants_ibfk_1` FOREIGN KEY (`ID_SEANCE`) REFERENCES `seance` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `seance_enseignants_ibfk_2` FOREIGN KEY (`ID_ENSEIGNANT`) REFERENCES `utilisateur` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `seance_groupes`
--
ALTER TABLE `seance_groupes`
ADD CONSTRAINT `seance_groupes_ibfk_1` FOREIGN KEY (`ID_GROUPE`) REFERENCES `groupe` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `seance_groupes_ibfk_2` FOREIGN KEY (`ID_SEANCE`) REFERENCES `seance` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `seance_salles`
--
ALTER TABLE `seance_salles`
ADD CONSTRAINT `seance_salles_ibfk_1` FOREIGN KEY (`ID_SALLE`) REFERENCES `salle` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `seance_salles_ibfk_2` FOREIGN KEY (`ID_SEANCE`) REFERENCES `seance` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
12d39c9210a60d0011f59e6dc3a2896e8a6e9ef7
|
SQL
|
TasosSisman/SQL_Exercises
|
/SQLQuery5.sql
|
UTF-8
| 2,731
| 4.375
| 4
|
[] |
no_license
|
-- Exercise #1
select CategoryName, Description from Categories;
-- Exercise #2
select ContactName, CustomerID, CompanyName from Customers where (City = 'London');
-- Exercise #3
select * from Suppliers where Fax is not null;
-- Exercise #4
select CustomerID from Orders where OrderDate between '1997-1-1' and '1998-1-1' and Freight < 100;
-- Exercise #5
select CompanyName, ContactName from Customers where Country in ('Mexico', 'Sweden', 'Germany');
-- Exercise #6
select count(*) from Products where Discontinued = 1;
-- Exercise #7
select CategoryName, Description from Categories where CategoryName like ('Co%');
-- Exercise #8
select CompanyName, City, Country, PostalCode
from Suppliers
where Address like('%rue%')
order by CompanyName desc;
-- Exercise #9
select ProductID, sum(Quantity) as Quantity from [Order Details] group by ProductID;
-- Exercise #10
select DISTINCT ContactName, Address from Customers where CustomerID in
(select CustomerID from Orders where ShipVia in
(select ShipVia from Shippers where CompanyName = 'Speedy Express'));
SELECT DISTINCT Customers.ContactName, Customers.Address
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID
INNER JOIN Shippers
ON Orders.ShipVia = Shippers.ShipperID
WHERE Shippers.CompanyName = 'Speedy Express';
-- Exercise #11
select * from Suppliers
where CompanyName is not null and
ContactName is not null and
ContactTitle is not null and
Region is not null;
-- Exercise #12
-- First Way
select ProductName from Products where CategoryID in
(select CategoryID from Categories where CategoryName = 'Condiments');
-- Second Way
SELECT Products.ProductName
FROM Products
INNER JOIN Categories
ON Products.CategoryID = Categories.CategoryID
WHERE Categories.CategoryName = 'Condiments';
-- Exercise #13
select ContactName from Customers where CustomerID not in
(select distinct CustomerID from Orders);
-- Exercise #14
select * from Shippers;
insert into Shippers(CompanyName) Values ('Amazon');
Insert into Shippers(CompanyName, Phone)
values ('ELTA', '210232325');
UPDATE Shippers
SET Phone = '21034353'
WHERE CompanyName = 'Amazon';
DELETE FROM Shippers
WHERE CompanyName = 'ELTA';
-- Exercise #15
UPDATE Shippers
SET CompanyName = 'Amazon Prime Shipping'
WHERE CompanyName = 'Amazon';
SELECT Orders.OrderID, Shippers.CompanyName, Shippers.Phone
FROM Orders
INNER JOIN Shippers
ON Orders.ShipVia = Shippers.ShipperID;
SELECT Categories.CategoryName, AVG(Products.UnitPrice) as [Average Price]
FROM Products
INNER JOIN Categories
ON Products.CategoryID = Categories.CategoryID
GROUP BY Categories.CategoryName;
| true
|
545d8f299042643446ef402b45454f72364bb6aa
|
SQL
|
TonyKartony/BI-Lab-2017
|
/_0. DWH/Projects/Mikita_Tur/dwso/bl_cl/cls_tables.sql
|
UTF-8
| 2,369
| 3.15625
| 3
|
[] |
no_license
|
DROP TABLE CLS_COUNTRY;
CREATE TABLE CLS_COUNTRY
(
COUNTRY_SRCID NUMBER(8) ,
COUNTRY_NAME VARCHAR2 (100) NOT NULL,
COUNTRY_CODE VARCHAR2 (100) NOT NULL
);
CREATE TABLE CE_COUNTRY
(
COUNTRY_SRCID NUMBER(8) NOT NULL primary key ,
COUNTRY_NAME VARCHAR2 (100) NOT NULL,
COUNTRY_CODE VARCHAR2 (100) NOT NULL
);
------------------------------
DROP TABLE CLS_ATE;
CREATE TABLE CLS_ATE
(
ATE_SRCID NUMBER (8) ,
ATE_NAME VARCHAR2 (100) NOT NULL,
country_code varchar2(100),
COUNTRY_SRCID NUMBER (8)
);
------------------------------
DROP TABLE CLS_CITY;
CREATE TABLE CLS_CITY
(
CITY_SRCID NUMBER (8) ,
CITY VARCHAR2 (100) NOT NULL,
ATE_NAME varchar2(100),
ATE_SRCID NUMBER (8)
);
------------------------------
DROP TABLE CLS_ADDRESS;
CREATE TABLE CLS_ADDRESS
(
ADDRESS_SRCID NUMBER (8) ,
ADDRESS VARCHAR2 (100),
POSTAL_CODE VARCHAR2(100),
CITY varchar2(100),
CITY_SRCID NUMBER (8)
);
------------------------------
DROP TABLE CLS_CUSTOMER;
CREATE TABLE CLS_CUSTOMER
(
CUSTOMER_SRCID NUMBER (8),
FIRST_NAME VARCHAR2 (100),
MIDDLE_NAME VARCHAR2 (100),
LAST_NAME VARCHAR2 (100),
AGE NUMBER (4),
GENDER VARCHAR2 (10),
EMAIL VARCHAR2 (100),
PHONE varchar2 (20),
address VARCHAR2(100),
ADDRESS_SRCID NUMBER (8)
);
------------------------------
DROP TABLE cls_product_category;
CREATE TABLE cls_product_category
(
category_srcid NUMBER(8),
category_name VARCHAR2(100)
);
------------------------------
drop TABLE cls_product_subcategory ;
CREATE TABLE cls_product_subcategory
(
subcategory_srcid number(8),
subcategory_name varchar2(100),
category_srcid NUMBER(8),
category_name VARCHAR2(100)
);
drop table cls_product;
create table cls_product
(
PRODUCT_SRCID NUMBER (8) ,
PRODUCT_NAME VARCHAR2 (100),
PRODUCT_PRICE NUMBER (8) ,
PRODUCT_PACKAGE VARCHAR2 (100),
SUBCATEGORY_SRCID NUMBER (8) ,
SUPPLIER_SRCID NUMBER (8) ,
START_DT DATE ,
END_DT DATE ,
IS_ACTIVE VARCHAR2 (10)
);
| true
|
9ea3130318405756e7d0794160ed31aaaadd384e
|
SQL
|
ahmdk/CS_304_LiquorStore
|
/insert_values.sql
|
UTF-8
| 12,914
| 2.703125
| 3
|
[] |
no_license
|
-- This file will populate the tables with simple data.
-- SHOULD NOT BE RUN UNTIL DROP AND CREATE HAVE BEEN RUN IN SUCCESSION
insert into stores values (1,'123 Fake Street','Liquor Store 1','604-123-4567');
insert into stores values (2,'2395 Lower Avenue','Central Liquor Store','778-234-5679');
commit;
insert into items values (1000,'Budweiser 6pk',0.15,0.30,12.00,'Cheap American beer');
insert into items values (1001,'Kokanee 6pk',0.15,0.30,11.50,'Other cheap American beer');
insert into items values (1002,'Granville Island Pale Ale',0.15,0.30,14.50,'English Bay Pale Ale');
insert into items values (1003,'Granville Island Lager',0.15,0.30,14.50,'GI Lager');
insert into items values (1004,'Granville Island Honey Lager',0.15,0.30,14.50,'GI Honey');
insert into items values (1005,'Granville Island Winter Ale',0.15,0.30,14.50,'Lions Bay Winter Ale');
insert into items values (1006,'Like This',0.15,0.05,4.50,'Superflux Like This');
insert into items values (1007,'Like That',0.15,0.05,4.50,'Superflux Like That');
insert into items values (1008,'Driftwood Fat Tug',0.15,0.05,7.50,'Driftwood Fat Tug IPA');
insert into items values (1009,'Driftwood White Bark',0.15,0.05,7.50,'Driftwood White Bark Witbier');
insert into items values (1010,'Mission Hill 5 Vineyards',0.15,0.05,14.50,'MH5 Sauvignon Blanc');
insert into items values (1011,'Naked Grape Sauvignon Blanc',0.15,0.05,12.75,'NG Sauv Blanc');
insert into items values (1012,'Naked Grape Pinot Grigio',0.15,0.05,12.75,'NG PG');
insert into items values (1013,'Naked Grape Luscious Red',0.15,0.05,12.75,'NG Luscious Red');
insert into items values (1014,'Screw It Sauvignon Blanc',0.15,0.05,12.75,'Screw It Sauv Blanc');
insert into items values (1015,'Screw It Pinot Grigio',0.15,0.05,12.75,'Screw It PG');
insert into items values (1016,'Screw It Pinot Grigio 1.5L',0.15,0.10,24.50,'Screw It PG 1.5L');
insert into items values (1017,'Screw It Shiraz',0.15,0.05,12.75,'Screw It Shiraz');
insert into items values (1018,'Johhny Q Shiraz',0.15,0.05,22.70,'Johhny Q Shiraz');
insert into items values (1019,'JT Merlot',0.15,0.05,14.50,'Jackson Triggs Merlot');
insert into items values (1020,'JT Cabernet Sauvignon',0.15,0.05,14.50,'Jackson Triggs Cab Sauv');
insert into items values (1021,'Coke 2L',0.15,0.20,4.00,'Coke 2L');
insert into items values (1022,'Tonic Water 355mL',0.15,0.05,1.25,'Canada Dry Tonic Water');
insert into items values (1023,'Doritos',0.12,0.00,5.00,'Doritos Nacho Cheese Flavor');
insert into items values (1024,'Doritos Cool Ranch',0.12,0.00,5.00,'Doritos Cool Ranch');
commit;
insert into beers values (1000,'Budweiser','America',5.0,'Lager',355,6);
insert into beers values (1001,'Kokanee','America',5.0,'Lager',355,6);
insert into beers values (1002,'Granville Island','Vancouver,BC',5.0,'Pale Ale',355,6);
insert into beers values (1003,'Granville Island','Vancouver,BC',5.0,'Lager',355,6);
insert into beers values (1004,'Granville Island','Vancouver,BC',5.0,'Honey Lager',355,6);
insert into beers values (1005,'Granville Island','Vancouver,BC',5.0,'Specialty',355,6);
insert into beers values (1006,'Superflux','Vancouver,BC',5.5,'IPA',473,1);
insert into beers values (1007,'Superflux','Vancouver,BC',5.5,'IPA',473,1);
insert into beers values (1008,'Driftwood','Victoria,BC',7.0,'IPA',750,1);
insert into beers values (1009,'Driftwood','Victoria,BC',7.0,'Witbier',750,1);
commit;
insert into wines values (1010,'Mission Hill','Kelowna,BC',12.0,'White',750,'Sauvignon Blanc');
insert into wines values (1011,'Naked Grape','Ontario',12.0,'White',750,'Sauvignon Blanc');
insert into wines values (1012,'Naked Grape','Ontario',12.0,'White',750,'Pinot Grigio');
insert into wines values (1013,'Naked Grape','Ontario',12.0,'Red',750,'Red Blend');
insert into wines values (1014,'Screw It','West Coast',12.0,'White',750,'Sauvignon Blanc');
insert into wines values (1015,'Screw It','West Coast',12.0,'White',750,'Pinot Grigio');
insert into wines values (1016,'Screw It','West Coast',12.0,'White',1500,'Pinot Grigio');
insert into wines values (1017,'Screw It','Shiraz',12.0,'Red',750,'Shiraz');
insert into wines values (1018,'Johnny Q','Australia',12.0,'Red',750,'Shiraz');
insert into wines values (1019,'Jackson Triggs','Okanagan,BC',12.0,'Red',750,'Merlot');
insert into wines values (1020,'Jackson Triggs','Okanagan,BC',12.0,'Red',750,'Cabernet Sauvignon');
commit;
insert into storeitems values (1000,1,20);
insert into storeitems values (1001,1,20);
insert into storeitems values (1002,1,20);
insert into storeitems values (1003,1,18);
insert into storeitems values (1004,1,20);
insert into storeitems values (1005,1,20);
insert into storeitems values (1006,1,48);
insert into storeitems values (1007,1,48);
insert into storeitems values (1008,1,24);
insert into storeitems values (1009,1,24);
insert into storeitems values (1010,1,12);
insert into storeitems values (1011,1,23);
insert into storeitems values (1012,1,24);
insert into storeitems values (1013,1,24);
insert into storeitems values (1014,1,21);
insert into storeitems values (1015,1,24);
insert into storeitems values (1016,1,16);
insert into storeitems values (1017,1,27);
insert into storeitems values (1018,1,12);
insert into storeitems values (1019,1,24);
insert into storeitems values (1020,1,24);
insert into storeitems values (1021,1,4);
insert into storeitems values (1022,1,6);
insert into storeitems values (1023,1,5);
insert into storeitems values (1024,1,5);
insert into storeitems values (1000,2,20);
insert into storeitems values (1001,2,17);
insert into storeitems values (1002,2,20);
insert into storeitems values (1003,2,18);
insert into storeitems values (1004,2,35);
insert into storeitems values (1005,2,20);
insert into storeitems values (1006,2,36);
insert into storeitems values (1007,2,48);
insert into storeitems values (1008,2,45);
insert into storeitems values (1009,2,24);
commit;
insert into employees values (1,'John Manage','jmanage','password1',100.00,1,'Manager');
insert into employees values (3,'Michael C','mc','password3',70.00,1,'Clerk');
insert into employees values (2,'Jane Doe','jd','password2',70.00,1,'Clerk');
insert into employees values (4,'Tiffany Sales','tsales','password4',100.00,2,'Manager');
insert into employees values (5,'Butch Cassidy','bc','password5',70.00,2,'Clerk');
insert into employees values (6,'Sundance Kid','sk','password6',70.00,2,'Clerk');
insert into employees values (7,'Temp1','t1','password7',70.00,1,'Clerk');
insert into employees values (8,'Temp2','t2','password8',70.00,2,'Clerk');
commit;
insert into orders values (100,'Granville Island','2017-10-30 10:00','2017-10-31 11:00',1);
insert into orders values (101,'Superflux','2017-11-08 10:00',null,1);
insert into orders values (102,'Mission Hill','2017-11-01 12:00','2017-11-05 10:00',1);
insert into orders values (103,'Jackson Triggs','2017-11-01 12:00','2017-11-05 10:00',1);
insert into orders values (104,'Kokanee','2017-11-01 10:00','2017-11-02 10:00',1);
insert into orders values (105,'Driftwood','2017-11-08 10:00','2017-11-10 12:00',1);
insert into orders values (106,'Naked Grape','2017-11-08 10:00','2017-11-10 12:00',1);
insert into orders values (107,'Granville Island','2017-11-12 10:00','2017-11-14 12:00',1);
insert into orders values (108,'Screw It','2017-11-15 10:00','2017-11-20 10:00',1);
insert into orders values (109,'Johnny Q','2017-11-08 10:00',null,1);
insert into orders values (110,'Superflux','2017-11-09 10:00','2017-11-11 10:00',4);
insert into orders values (111,'Granville Island','2017-11-02 10:00',null,4);
insert into orders values (112,'Mission Hill','2017-11-01 12:00','2017-11-05 10:00',4);
insert into orders values (113,'Jackson Triggs','2017-11-01 12:00','2017-11-05 10:00',4);
insert into orders values (114,'Naked Grape','2017-11-08 10:00','2017-11-10 12:00',4);
insert into orders values (115,'Screw It','2017-11-15 10:00','2017-11-20 10:00',4);
insert into orders values (116,'Superflux','2017-11-08 10:00',null,4);
commit;
insert into orderitems values (1002,100,4);
insert into orderitems values (1003,100,4);
insert into orderitems values (1004,100,4);
insert into orderitems values (1006,101,24);
insert into orderitems values (1007,101,24);
insert into orderitems values (1010,102,12);
insert into orderitems values (1019,103,12);
insert into orderitems values (1020,103,12);
insert into orderitems values (1001,104,10);
insert into orderitems values (1008,105,12);
insert into orderitems values (1009,105,12);
insert into orderitems values (1011,106,12);
insert into orderitems values (1012,106,12);
insert into orderitems values (1013,106,12);
insert into orderitems values (1002,107,4);
insert into orderitems values (1003,107,4);
insert into orderitems values (1004,107,4);
insert into orderitems values (1014,108,12);
insert into orderitems values (1015,108,12);
insert into orderitems values (1016,108,6);
insert into orderitems values (1017,108,12);
insert into orderitems values (1018,109,12);
insert into orderitems values (1006,110,24);
insert into orderitems values (1007,110,24);
insert into orderitems values (1002,111,8);
insert into orderitems values (1003,111,8);
insert into orderitems values (1004,111,8);
insert into orderitems values (1010,112,12);
insert into orderitems values (1019,113,12);
insert into orderitems values (1011,114,12);
insert into orderitems values (1012,114,24);
insert into orderitems values (1013,114,12);
insert into orderitems values (1014,115,12);
insert into orderitems values (1015,115,12);
insert into orderitems values (1006,116,24);
insert into orderitems values (1007,116,24);
commit;
insert into store_sales values (100,14.10,'Credit','2017-11-05 12:30',3);
insert into store_sales values (101,26.03,'Debit','2017-11-05 12:35',3);
insert into store_sales values (102,29.43,'Debit','2017-11-05 12:50',3);
insert into store_sales values (103,16.05,'Cash','2017-11-05 13:00',3);
insert into store_sales values (104,328.60,'Debit','2017-11-08 12:50',2);
insert into store_sales values (105,784.80,'Credit','2017-10-31 17:00',2);
insert into store_sales values (106,416.64,'Debit','2017-11-01 10:00',2);
insert into store_sales values (107,2822.50,'Debit','2017-11-02 12:00',2);
insert into store_sales values (108,3395.00,'Cash','2017-11-04 13:00',2);
insert into store_sales values (109,3345.00,'Credit','2017-11-15 10:00',2);
insert into store_sales values (110,14.10,'Credit','2017-11-05 12:30',5);
insert into store_sales values (111,26.03,'Debit','2017-11-05 12:35',5);
insert into store_sales values (112,29.43,'Debit','2017-11-05 12:50',5);
insert into store_sales values (113,16.05,'Cash','2017-11-05 13:00',5);
insert into store_sales values (114,328.60,'Debit','2017-11-08 12:50',6);
insert into store_sales values (115,784.80,'Credit','2017-10-31 17:00',6);
insert into store_sales values (116,416.64,'Debit','2017-11-01 10:00',6);
insert into store_sales values (117,2822.50,'Debit','2017-11-02 12:00',6);
insert into store_sales values (118,3395.00,'Cash','2017-11-04 13:00',6);
insert into store_sales values (119,3345.00,'Credit','2017-11-15 10:00',6);
commit;
insert into saleitems values (1000,100,1);
insert into saleitems values (1008,101,3);
insert into saleitems values (1017,102,2);
insert into saleitems values (1006,103,1);
insert into saleitems values (1007,103,1);
insert into saleitems values (1023,103,1);
insert into saleitems values (1000,104,10);
insert into saleitems values (1001,104,10);
insert into saleitems values (1006,104,5);
insert into saleitems values (1007,104,5);
insert into saleitems values (1018,105,30);
insert into saleitems values (1008,106,24);
insert into saleitems values (1009,106,24);
insert into saleitems values (1016,107,100);
insert into saleitems values (1002,108,50);
insert into saleitems values (1003,108,50);
insert into saleitems values (1004,108,50);
insert into saleitems values (1005,108,50);
insert into saleitems values (1019,109,100);
insert into saleitems values (1020,109,100);
insert into saleitems values (1000,110,1);
insert into saleitems values (1008,111,3);
insert into saleitems values (1017,112,2);
insert into saleitems values (1006,113,1);
insert into saleitems values (1007,113,1);
insert into saleitems values (1023,113,1);
insert into saleitems values (1000,114,10);
insert into saleitems values (1001,114,10);
insert into saleitems values (1006,114,5);
insert into saleitems values (1007,114,5);
insert into saleitems values (1018,115,30);
insert into saleitems values (1008,116,24);
insert into saleitems values (1009,116,24);
insert into saleitems values (1016,117,100);
insert into saleitems values (1002,118,50);
insert into saleitems values (1003,118,50);
insert into saleitems values (1004,118,50);
insert into saleitems values (1005,118,50);
insert into saleitems values (1019,119,100);
insert into saleitems values (1020,119,100);
commit;
insert into reports values (1,'2017-11-05','2017-11-05',1,85.61,0.00,170.00);
| true
|
1237044530479d43b55250074ce1e735371e7500
|
SQL
|
google-code/ace-armor
|
/dist/sql/address2012-09-09 20-29-05.sql
|
UTF-8
| 1,447
| 3.3125
| 3
|
[] |
no_license
|
USE ims;
CREATE TABLE `address` (
`AddressID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`DoorNo` varchar(45) DEFAULT NULL,
`Street1` varchar(45) DEFAULT NULL,
`Street2` varchar(45) DEFAULT NULL,
`City` varchar(45) DEFAULT NULL,
`State` varchar(45) DEFAULT NULL,
`Country` varchar(45) DEFAULT NULL,
`Pincode` varchar(45) DEFAULT NULL,
`PhoneNo` varchar(45) DEFAULT NULL,
`PersonID` int(11) unsigned DEFAULT NULL,
`AddressTypeID` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`AddressID`),
KEY `Person_idx` (`PersonID`),
KEY `Address_Person_FK_idx` (`PersonID`),
KEY `Address_AddresType_FK_idx` (`AddressTypeID`),
KEY `Address_Person_FK_idx1` (`PersonID`),
CONSTRAINT `Address_AddresType_FK` FOREIGN KEY (`AddressTypeID`) REFERENCES `address_type` (`AddressTypeID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `Address_Person_FK` FOREIGN KEY (`PersonID`) REFERENCES `person` (`PersonID`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
INSERT INTO `ims`.`address`(`AddressID`,`DoorNo`,`Street1`,`Street2`,`City`,`State`,`Country`,`Pincode`,`PhoneNo`,`PersonID`,`AddressTypeID`) VALUES (1,'as','as','as','as','as','asdsd','asd','sada',null,null)
, (2,'ada','sad','sd','sads','asd','asd','asd','12321',null,null)
, (3,'ASD','ASD','ASZXCD','ZXCsada','asdasd','asd','adsasd','asd',null,null)
, (5,null,null,null,null,null,null,null,null,null,null);
| true
|
c058caa0f3a81a50fedf0f790d094d3a5c128cd7
|
SQL
|
OlafMd/MedCon1.0
|
/mm-libs/dbaccess/Level 3/CL3_ProductCustomization/Atomic/Retrieval/SQL/cls_Get_Customizations_for_ProductID.sql
|
UTF-8
| 1,094
| 3.390625
| 3
|
[] |
no_license
|
SELECT cmn_pro_cus_customizations.CMN_PRO_CUS_CustomizationID,
cmn_pro_cus_customizations.InstantiatedFrom_CustomizationTemplate_RefID,
cmn_pro_cus_customizations.Product_RefID,
cmn_pro_cus_customizations.Customization_Name_DictID,
cmn_pro_cus_customizations.Customization_Description_DictID,
cmn_pro_cus_customizations.OrderSequence,
cmn_pro_cus_customization_variants.CMN_PRO_CUS_Customization_VariantID,
cmn_pro_cus_customization_variants.CustomizationVariant_Name_DictID,
cmn_pro_cus_customization_variants.OrderSequence as VariantOrderSequence
FROM cmn_pro_cus_customizations
LEFT JOIN cmn_pro_cus_customization_variants ON cmn_pro_cus_customizations.CMN_PRO_CUS_CustomizationID = cmn_pro_cus_customization_variants.Customization_RefID
AND cmn_pro_cus_customization_variants.Tenant_RefID = @TenantID
AND cmn_pro_cus_customization_variants.IsDeleted = 0
WHERE cmn_pro_cus_customizations.Tenant_RefID = @TenantID
AND cmn_pro_cus_customizations.IsDeleted = 0
AND cmn_pro_cus_customizations.Product_RefID=@ProductID
| true
|
90ed56ccebb8a54a3054f8914b8d23ac376bb164
|
SQL
|
gitter-badger/higgs
|
/higgs-data-meta/src/main/resources/sql/2.create_table.sql
|
UTF-8
| 2,164
| 3.5625
| 4
|
[
"Apache-2.0"
] |
permissive
|
DROP TABLE IF EXISTS agent;
DROP TABLE IF EXISTS agent_configuration;
DROP TABLE IF EXISTS agent_threaddump;
create table agent
(
id bigint not null PRIMARY KEY,
name varchar(80) not null,
original_name VARCHAR(80) null
description varchar(200) null,
type tinyint null comment '1 Java, 3 Browser, 4 PHP',
app_id bigint not null,
tier_id bigint not null,
token varchar(32) not null,
config_version int default '0' null,
agent_fingerprint varchar(120) null,
last_health_check_time datetime DEFAULT CURRENT_TIMESTAMP,
status tinyint default '0' null comment '0 offline , 1 online',
enabled tinyint default '1' null,
is_visible tinyint default '1' null comment 'visible/count in some specific condition',
is_deleted tinyint DEFAULT '0' null comment 'is current object deleted, 0 not deleted, 1 deleted',
create_time datetime DEFAULT CURRENT_TIMESTAMP,
update_time datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE INDEX uni_idx_token (token)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
create table agent_configuration
(
id bigint not null PRIMARY KEY,
agent_id bigint not null,
configuration_name varchar(100) not null,
configuration_key varchar(100) not null,
configuration_value varchar(2000) not null,
configuration_unit varchar(20) null,
configuration_level tinyint(3) unsigned not null comment '0 default , 1 app , 2 tier, 3 instance',
configuration_type tinyint(3) unsigned not null comment '0 common , 1 java, 3 browser, 4 php',
visible tinyint default '0' not null comment '0 invisible , 1 visible',
INDEX idx_agent_id (agent_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
create table agent_threaddump
(
id bigint auto_increment PRIMARY KEY,
submit_time datetime not null,
start_time datetime null,
app_id bigint not null,
agent_id bigint not null,
agent_token varchar(20) not null,
dump_interval int not null comment 'unit ms',
status tinyint not null comment '0 prepare, 1 running, 2 complete, 3 cancel, 4 timeout after 15 min',
deliver_status tinyint not null comment '0 no, 1 yes',
INDEX idx_agent_token (agent_token)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
| true
|
c35d90c5ab2a38fd44eff6e618f3e0575586c470
|
SQL
|
jusinche/JusFramework
|
/AppFramework/DataBasePackage/Framework/Administracion/pkg_adm_comun.sql
|
UTF-8
| 928
| 3.3125
| 3
|
[] |
no_license
|
CREATE OR REPLACE PACKAGE PKG_ADM_COMUN AS
/*Obiene la fecha del sistema*/
function fnc_obt_fecha_actual return date;
/*Elimina un grupo de registro dado el nombre de la tabla y el nombre del padre id*/
procedure PRC_ELIMINAR(ec_tabla varchar2, ec_campo varchar2, en_id number );
END PKG_ADM_COMUN;
CREATE OR REPLACE PACKAGE BODY PKG_ADM_COMUN AS
/*Obiene la fecha del sistema*/
function fnc_obt_fecha_actual return date is
ln_fecha date;
begin
select sysdate into ln_fecha from dual;
return ln_fecha;
end fnc_obt_fecha_actual;
procedure PRC_ELIMINAR(ec_tabla varchar2, ec_campo varchar2, en_id number ) IS
lc_delete varchar2(300);
BEGIN
lc_delete:= 'DELETE '||ec_tabla || ' WHERE '|| ec_campo||' = ' ||en_id;
EXECUTE IMMEDIATE lc_delete;
END PRC_ELIMINAR;
END PKG_ADM_COMUN;
| true
|
07dda0e594f512d37fae7bfdec02f7346db01e6c
|
SQL
|
sprokushev/Delphi
|
/MASTER/_DATABASE/Constraints/KLS_RIGHTS_NonFK.sql
|
UTF-8
| 201
| 3.078125
| 3
|
[] |
no_license
|
--
-- Non Foreign Key Constraints for Table KLS_RIGHTS
--
ALTER TABLE MASTER.KLS_RIGHTS ADD (
CONSTRAINT PK_KLS_RIGHTS
PRIMARY KEY
(ID)
USING INDEX MASTER.PK_KLS_RIGHTS
ENABLE VALIDATE);
| true
|
d2608ce07088d774600747d453d47ee04484b0ee
|
SQL
|
lupeordaz/csctoss
|
/tasks/7120/notes.sql
|
UTF-8
| 3,972
| 2.9375
| 3
|
[] |
no_license
|
--Notes
select *
from radreply
where attribute = 'Class'
and value = '44361';
id | username | attribute | op | value | priority
-------+----------------------+-----------+----+-------+----------
77327 | 3472630942@vzw3g.com | Class | = | 44361 | 10
(1 row)
select billing_entity_id
,radius_username
from line
where line_id = 44361;
billing_entity_id | radius_username
-------------------+----------------------
577 | 3472630942@vzw3g.com
(1 row)
select username, billing_entity_id
from username
where username = '3472630942@vzw3g.com';
username | billing_entity_id
----------------------+-------------------
3472630942@vzw3g.com | 577
(1 row)
select line_id, billing_entity_id
,radius_username
from line
where line_id = 44361;
line_id | billing_entity_id | radius_username
---------+-------------------+----------------------
44361 | 577 | 3472630942@vzw3g.com
select username
,billing_entity_id
from username
where username = '3472630942@vzw3g.com';
username | billing_entity_id
----------------------+-------------------
3472630942@vzw3g.com | 577
select l.line_id
,em.carrier
,l.billing_entity_id as line_billilng_entity
,sip.billing_entity_id as sip_billing_entity_id
from line l
join line_equipment le on le.line_id = l.line_id
join equipment e on e.equipment_id = le.equipment_id
join equipment_model em on em.equipment_model_id = e.equipment_model_id
join static_ip_pool sip on sip.line_id = l.line_id
where l.end_date is null
and l.billing_entity_id <> sip.billing_entity_id
order by 1;
select l.line_id
,l.billing_entity_id as line_billilng_entity
,u.billing_entity_id as user_billing_entity_id
from line l
join username u on u.username = l.radius_username
where l.end_date is null
and l.billing_entity_id <> u.billing_entity_id
order by 1;
line_id | line_billilng_entity | user_billing_entity_id
---------+----------------------+------------------------
86 | 11 | 1
1553 | 47 | 1
2683 | 101 | 1
3391 | 65 | 1
3436 | 135 | 1
3454 | 116 | 1
3763 | 65 | 1
3783 | 99 | 1
4056 | 99 | 1
4177 | 69 | 1
4549 | 101 | 1
4787 | 101 | 1
4801 | 101 | 1
4928 | 65 | 1
.
.
.
40109 | 717 | 340
40110 | 717 | 340
40111 | 717 | 340
40366 | 416 | 473
40982 | 47 | 42
42324 | 749 | 221
42332 | 749 | 221
42346 | 748 | 112
42399 | 748 | 112
43071 | 755 | 1
43510 | 760 | 460
43627 | 239 | 2
(556 rows)
update username
set billing_entity_id =
SELECT mr.master_radacctid
,mr.source_hostname
.
.
.
,mr.acctstarttime
,mr.acctstoptime
.
.
.
FROM master_radacct mr
INNER JOIN
(select username, max(acctstarttime) as acctstarttime
from master_radacct
group by username
order by username) mr2 on mr.username = mr2.username
and mr.acctstarttime = mr2.acctstarttime ;" > ${TMPFILE}
| true
|
a09fc3f95af5b5bbb6d1fcae3739d1a7ac075075
|
SQL
|
radtek/abs3
|
/sql/mmfo/bars/Table/kf70.sql
|
WINDOWS-1251
| 3,770
| 2.953125
| 3
|
[] |
no_license
|
PROMPT =====================================================================================
PROMPT *** Run *** ========== Scripts /Sql/BARS/Table/KF70.sql =========*** Run *** ========
PROMPT =====================================================================================
PROMPT *** ALTER_POLICY_INFO to KF70 ***
BEGIN
execute immediate
'begin
bpa.alter_policy_info(''KF70'', ''CENTER'' , null, null, null, null);
bpa.alter_policy_info(''KF70'', ''FILIAL'' , null, null, null, null);
bpa.alter_policy_info(''KF70'', ''WHOLE'' , null, null, null, null);
null;
end;
';
END;
/
PROMPT *** Create table KF70 ***
begin
execute immediate '
CREATE TABLE BARS.KF70
( KOD CHAR(2),
NAIM VARCHAR2(45)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
TABLESPACE BRSDYND ';
exception when others then
if sqlcode=-955 then null; else raise; end if;
end;
/
PROMPT *** ALTER_POLICIES to KF70 ***
exec bpa.alter_policies('KF70');
COMMENT ON TABLE BARS.KF70 IS ' i i #70';
COMMENT ON COLUMN BARS.KF70.KOD IS '';
COMMENT ON COLUMN BARS.KF70.NAIM IS '';
PROMPT *** Create constraint XPK_KF70 ***
begin
execute immediate '
ALTER TABLE BARS.KF70 ADD CONSTRAINT XPK_KF70 PRIMARY KEY (KOD)
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
TABLESPACE BRSDYNI ENABLE';
exception when others then
if sqlcode=-2260 or sqlcode=-2261 or sqlcode=-2264 or sqlcode=-2275 or sqlcode=-1442 then null; else raise; end if;
end;
/
PROMPT *** Create constraint SYS_C007392 ***
begin
execute immediate '
ALTER TABLE BARS.KF70 MODIFY (KOD NOT NULL ENABLE)';
exception when others then
if sqlcode=-2260 or sqlcode=-2261 or sqlcode=-2264 or sqlcode=-2275 or sqlcode=-1442 then null; else raise; end if;
end;
/
PROMPT *** Create index XPK_KF70 ***
begin
execute immediate '
CREATE UNIQUE INDEX BARS.XPK_KF70 ON BARS.KF70 (KOD)
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
TABLESPACE BRSDYNI ';
exception when others then
if sqlcode=-955 then null; else raise; end if;
end;
/
PROMPT *** Create grants KF70 ***
grant DELETE,INSERT,SELECT,UPDATE on KF70 to ABS_ADMIN;
grant SELECT on KF70 to BARSREADER_ROLE;
grant DELETE,INSERT,SELECT,UPDATE on KF70 to BARS_ACCESS_DEFROLE;
grant SELECT on KF70 to BARS_DM;
grant SELECT on KF70 to RPBN002;
grant DELETE,INSERT,SELECT,UPDATE on KF70 to SALGL;
grant SELECT on KF70 to START1;
grant SELECT on KF70 to UPLD;
grant DELETE,FLASHBACK,INSERT,SELECT,UPDATE on KF70 to WR_ALL_RIGHTS;
PROMPT *** Create SYNONYM to KF70 ***
CREATE OR REPLACE PUBLIC SYNONYM KF70 FOR BARS.KF70;
PROMPT =====================================================================================
PROMPT *** End *** ========== Scripts /Sql/BARS/Table/KF70.sql =========*** End *** ========
PROMPT =====================================================================================
| true
|
d87aabea9c8611148022f5998e4e6505e5601fee
|
SQL
|
FlarrowVerse/DBMS
|
/HospitalManagement/setScript.sql
|
UTF-8
| 6,680
| 2.9375
| 3
|
[] |
no_license
|
-- set data for Doctor table
insert into Doctor values ('D0001', 'Animesh', 'Shastri', 'Heart', 10, 9009009001);
insert into Doctor values ('D0002', 'Suresh', 'Ghosh', 'ENT', 20, 9009009002);
insert into Doctor values ('D0003', 'Jane', 'Doe', 'Brain', 5, 9009009003);
insert into Doctor values ('D0004', 'John', 'Smith', 'Dermatology', 4, 9009009004);
insert into Doctor values ('D0005', 'Jack', 'Ryan', 'Immunology', 4, 9009009004);
-- set data for Primary_Doctor table
insert into Primary_Doctor values ('D0001');
insert into Primary_Doctor values ('D0002');
insert into Primary_Doctor values ('D0003');
insert into Primary_Doctor values ('D0004');
insert into Primary_Doctor values ('D0005');
-- set data for Specialist table
insert into Specialist values ('D0001');
insert into Specialist values ('D0002');
insert into Specialist values ('D0003');
insert into Specialist values ('D0004');
insert into Specialist values ('D0005');
-- set data for Patient table
insert into Patient values ('P0001','Jack','Bauer','201 M.G. Road',to_date('22-01-1996','DD-MM-YYYY'),'D0004');
insert into Patient values ('P0002','Abhishek','Ghosh','51, VS Sarani',to_date('26-01-1999','DD-MM-YYYY'),'D0004');
insert into Patient values ('P0003', 'Ramesh', 'Das', '102, Behala', to_date('03-10-1961','DD-MM-YYYY'),'D0002');
insert into Patient values ('P0004', 'Suresh', 'Mitra', '12C/1, New Town', to_date('03-05-1961','DD-MM-YYYY'),'D0001');
insert into Patient values ('P0005', 'Vivek', 'Santra', '21/1, Sealdah', to_date('26-11-2000','DD-MM-YYYY'),'D0002');
-- set data for Medicine
insert into Medicine values ('Vitamin', 5, 'Yes');
insert into Medicine values ('Calpol-650', 2, 'No');
insert into Medicine values ('Aspirin', 6, 'Yes');
insert into Medicine values ('Pan-D', 12, 'No');
insert into Medicine values ('Atenalol', 4, 'Yes');
-- set data for Prescription
insert into Prescription values ('Pr001', to_date('10-10-2018','DD-MM-YYYY'), 'D0002', 'P0001');
insert into Prescription values ('Pr002', to_date('20-10-2017','DD-MM-YYYY'), 'D0003', 'P0002');
insert into Prescription values ('Pr003', to_date('10-05-2015','DD-MM-YYYY'), 'D0005', 'P0003');
insert into Prescription values ('Pr004', to_date('20-04-2019','DD-MM-YYYY'), 'D0004', 'P0004');
insert into Prescription values ('Pr005', to_date('02-01-2020','DD-MM-YYYY'), 'D0002', 'P0005');
insert into Prescription values ('Pr006', to_date('10-10-2018','DD-MM-YYYY'), 'D0002', 'P0001');
insert into Prescription values ('Pr007', to_date('20-10-2017','DD-MM-YYYY'), 'D0003', 'P0002');
insert into Prescription values ('Pr008', to_date('10-05-2015','DD-MM-YYYY'), 'D0005', 'P0003');
insert into Prescription values ('Pr009', to_date('20-04-2019','DD-MM-YYYY'), 'D0004', 'P0004');
insert into Prescription values ('Pr010', to_date('02-01-2020','DD-MM-YYYY'), 'D0002', 'P0005');
insert into Prescription values ('Pr011', to_date('10-10-2018','DD-MM-YYYY'), 'D0002', 'P0001');
insert into Prescription values ('Pr012', to_date('20-10-2017','DD-MM-YYYY'), 'D0003', 'P0002');
insert into Prescription values ('Pr013', to_date('10-05-2015','DD-MM-YYYY'), 'D0005', 'P0003');
insert into Prescription values ('Pr014', to_date('20-04-2019','DD-MM-YYYY'), 'D0004', 'P0004');
insert into Prescription values ('Pr015', to_date('02-01-2020','DD-MM-YYYY'), 'D0002', 'P0005');
insert into Prescription values ('Pr016', to_date('10-10-2018','DD-MM-YYYY'), 'D0002', 'P0001');
insert into Prescription values ('Pr017', to_date('20-10-2017','DD-MM-YYYY'), 'D0003', 'P0002');
insert into Prescription values ('Pr018', to_date('10-05-2015','DD-MM-YYYY'), 'D0005', 'P0003');
insert into Prescription values ('Pr019', to_date('20-04-2019','DD-MM-YYYY'), 'D0004', 'P0004');
insert into Prescription values ('Pr020', to_date('02-01-2020','DD-MM-YYYY'), 'D0002', 'P0005');
insert into Prescription values ('Pr021', to_date('10-10-2018','DD-MM-YYYY'), 'D0002', 'P0001');
insert into Prescription values ('Pr022', to_date('20-10-2017','DD-MM-YYYY'), 'D0003', 'P0002');
insert into Prescription values ('Pr023', to_date('10-05-2015','DD-MM-YYYY'), 'D0005', 'P0003');
insert into Prescription values ('Pr024', to_date('20-04-2019','DD-MM-YYYY'), 'D0004', 'P0004');
insert into Prescription values ('Pr025', to_date('02-01-2020','DD-MM-YYYY'), 'D0002', 'P0005');
-- set data for Prescription_Medicine
insert into Prescription_Medicine values ('Pr001', 'Vitamin', 20);
insert into Prescription_Medicine values ('Pr002', 'Pan-D', 30);
insert into Prescription_Medicine values ('Pr003', 'Atenalol', 10);
insert into Prescription_Medicine values ('Pr004', 'Aspirin', 20);
insert into Prescription_Medicine values ('Pr005', 'Pan-D', 30);
insert into Prescription_Medicine values ('Pr001', 'Aspirin', 20);
insert into Prescription_Medicine values ('Pr002', 'Calpol-650', 30);
insert into Prescription_Medicine values ('Pr003', 'Vitamin', 20);
insert into Prescription_Medicine values ('Pr004', 'Vitamin', 20);
insert into Prescription_Medicine values ('Pr005', 'Calpol-650', 10);
insert into Prescription_Medicine values ('Pr001', 'Pan-D', 20);
insert into Prescription_Medicine values ('Pr002', 'Vitamin', 30);
insert into Prescription_Medicine values ('Pr003', 'Aspirin', 10);
insert into Prescription_Medicine values ('Pr004', 'Calpol-650', 15);
insert into Prescription_Medicine values ('Pr005', 'Vitamin', 10);
insert into Prescription_Medicine values ('Pr006', 'Vitamin', 20);
insert into Prescription_Medicine values ('Pr007', 'Vitamin', 30);
insert into Prescription_Medicine values ('Pr008', 'Vitamin', 10);
insert into Prescription_Medicine values ('Pr009', 'Vitamin', 15);
insert into Prescription_Medicine values ('Pr010', 'Vitamin', 10);
insert into Prescription_Medicine values ('Pr011', 'Vitamin', 20);
insert into Prescription_Medicine values ('Pr012', 'Vitamin', 30);
insert into Prescription_Medicine values ('Pr013', 'Vitamin', 10);
insert into Prescription_Medicine values ('Pr014', 'Vitamin', 15);
insert into Prescription_Medicine values ('Pr015', 'Vitamin', 10);
insert into Prescription_Medicine values ('Pr016', 'Vitamin', 20);
insert into Prescription_Medicine values ('Pr017', 'Vitamin', 30);
insert into Prescription_Medicine values ('Pr018', 'Vitamin', 10);
insert into Prescription_Medicine values ('Pr019', 'Vitamin', 15);
insert into Prescription_Medicine values ('Pr020', 'Vitamin', 10);
insert into Prescription_Medicine values ('Pr021', 'Vitamin', 20);
insert into Prescription_Medicine values ('Pr022', 'Vitamin', 30);
insert into Prescription_Medicine values ('Pr023', 'Vitamin', 10);
insert into Prescription_Medicine values ('Pr024', 'Vitamin', 15);
insert into Prescription_Medicine values ('Pr025', 'Vitamin', 10);
| true
|
6daed405b6fee3bccb6843951beab8f2a07db2db
|
SQL
|
princo19/sql-cursor
|
/cuu.sql
|
UTF-8
| 230
| 3.015625
| 3
|
[] |
no_license
|
declare
cursor c1 is select ename,sal from emp where deptno=&dno;
begin
for i in c1
loop
dbms_output.put_line(i.ename || ' has salary ' || i.sal);
end loop;
dbms_output.put_line('total rows fetched' || c1%rowcount);
end;
| true
|
186fafb530fefadbace0dd04464c93645b289f26
|
SQL
|
BralexMtz/global-home-bd
|
/Scripts/s-11-tr-borrar-mensajes.sql
|
UTF-8
| 1,327
| 3.796875
| 4
|
[] |
no_license
|
--@Autor: Parada Pérez Jesús Bryan, Brayan Alexis Martinez Vazquez
--@Fecha creación: 3/02/2021
--@Descripción: Creacion de trigger para borrar más de un mensaje masivamente
create or replace trigger tr_delete_mensajes
for delete on mensaje
compound trigger
type mensaje_eliminar_type is record(
mensaje_id mensaje.mensaje_id%type,
titulo mensaje.titulo%type,
cuerpo mensaje.cuerpo%type,
leido mensaje.leido%type,
mensaje_previo mensaje.mensaje_previo%type,
vivienda_id mensaje.vivienda_id%type,
usuario_id mensaje.usuario_id%type
);
type mensaje_list_type is table of mensaje_eliminar_type;
mensajes_list mensaje_list_type := mensaje_list_type();
before each row is
v_index number;
begin
mensajes_list.extend;
v_index := mensajes_list.last;
mensajes_list(v_index).mensaje_id := :old.mensaje_id;
mensajes_list(v_index).titulo := :old.titulo;
mensajes_list(v_index).cuerpo := :old.cuerpo;
mensajes_list(v_index).leido := :old.leido;
mensajes_list(v_index).mensaje_previo := :old.mensaje_previo;
mensajes_list(v_index).vivienda_id := :old.vivienda_id;
mensajes_list(v_index).usuario_id := :old.usuario_id;
end before each row;
after statement is
begin
forall i in mensajes_list.first .. mensajes_list.last
delete from mensaje where mensaje_id = mensajes_list(i).mensaje_id;
end after statement;
end;
/
show errors
| true
|
f37d0295d19c6256128dbe559e2b0b42ed5c3e95
|
SQL
|
slowvodka/SQL---MySQL-for-Data-Analytics-and-Business-Intelligence
|
/procedures and functions.sql
|
UTF-8
| 1,953
| 4.625
| 5
|
[] |
no_license
|
/*
Create a procedure that will provide the average salary of all employees.
Then, call the procedure.
*/
use employees;
drop procedure if exists avr_salary;
delimiter $$
create procedure avr_salary()
begin
select avg(salary) from salaries;
end$$
delimiter ;
call employees.avr_salary();
/*
Create a procedure called ‘emp_info’ that uses as parameters the first and the last name of an individual,
and returns their employee number.
*/
drop procedure if exists emp_info;
delimiter $$
create procedure emp_info(in p_fn varchar(40), in p_ln varchar(40), out p_emp_no integer)
begin
SELECT
p.emp_no
INTO p_emp_no FROM
employees p
WHERE
first_name = p_fn AND last_name = p_ln;
end$$
delimiter ;
/*
Create a variable, called ‘v_emp_no’, where you will store the output of the procedure you created in the last exercise.
Call the same procedure, inserting the values ‘Aruna’ and ‘Journel’ as a first and last name respectively.
Finally, select the obtained output.
*/
set @v_emp_no = 0;
call emp_info('Aruna','Journel',@v_emp_no);
select @v_emp_no;
/*
Create a function called ‘emp_info’ that takes for parameters the first and last name of an employee,
and returns the salary from the newest contract of that employee.
Hint: In the BEGIN-END block of this program, you need to declare and use two variables –
v_max_from_date that will be of the DATE type, and v_salary, that will be of the DECIMAL (10,2) type.
Finally, select this function.
*/
drop function if exists emp_info;
delimiter $$
create function emp_info(p_first_name varchar(40), p_last_name varchar(40) ) returns decimal (10,2)
DETERMINISTIC
begin
declare v_salar decimal (10,2);
select s.salary into v_salar
from employees e join salaries s on e.emp_no = s.emp_no
where e.first_name = p_first_name and e.last_name = p_last_name and s.to_date = '9999-01-01';
return v_salar;
end$$
delimiter ;
select emp_info('Aruna','Journel');
| true
|
6a23b0230b61accf1f8738017cbec7960b888b12
|
SQL
|
deflaux/bigquery-examples
|
/pgp/sql/schema-comparisons/record-sample-counts.sql
|
UTF-8
| 292
| 2.640625
| 3
|
[
"Apache-2.0"
] |
permissive
|
# Confirm that we are correctly expanding reference-matching blocks into our variants.
SELECT
MAX(num_sample_ids) as max_samples_per_record,
FROM (
SELECT
COUNT(call.callset_name) WITHIN RECORD AS num_sample_ids,
FROM
[google.com:biggene:test.pgp_gvcf_variants_expanded2]
)
| true
|
62abaca8d49d38f4388e0ffd707e5ea5cda91207
|
SQL
|
priyadarsanmahendiran/BLOK
|
/Database/gblock (1).sql
|
UTF-8
| 10,808
| 3.046875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 05, 2020 at 11:00 AM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `gblock`
--
-- --------------------------------------------------------
--
-- Table structure for table `booking`
--
CREATE TABLE `booking` (
`hallnumber` varchar(5) NOT NULL,
`period` int(11) NOT NULL,
`date` date NOT NULL,
`day` varchar(10) NOT NULL,
`class_code` int(11) NOT NULL,
`roll_no` varchar(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `booking`
--
INSERT INTO `booking` (`hallnumber`, `period`, `date`, `day`, `class_code`, `roll_no`) VALUES
('G409', 5, '2020-06-15', 'Monday', 1, '18z256'),
('G504', 5, '2020-05-26', 'Tuesday', 1, '18z256'),
('G603', 5, '2020-05-25', 'Monday', 1, '18z256'),
('G607', 5, '2020-06-15', 'Monday', 1, '18z256');
-- --------------------------------------------------------
--
-- Table structure for table `bookingclub`
--
CREATE TABLE `bookingclub` (
`hallnumber` varchar(4) NOT NULL,
`period` int(11) NOT NULL,
`date` date NOT NULL,
`day` varchar(10) DEFAULT NULL,
`roll_no` varchar(6) DEFAULT NULL,
`reason` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `class`
--
CREATE TABLE `class` (
`class_code` int(11) NOT NULL,
`department` varchar(15) NOT NULL,
`year` int(11) NOT NULL,
`section` varchar(2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `class`
--
INSERT INTO `class` (`class_code`, `department`, `year`, `section`) VALUES
(1, 'CSE', 2, 'G1'),
(2, 'CSE', 2, 'G2'),
(3, 'Automobile', 1, ''),
(4, 'Biotechnology', 1, ''),
(5, 'Biomedical', 1, ''),
(6, 'Civil', 1, ''),
(7, 'CSE', 1, 'G1'),
(8, 'CSE', 1, 'G2'),
(9, 'MechSW', 1, ''),
(10, 'RAE', 1, ''),
(11, 'Textile', 1, ''),
(12, 'FDM', 2, ''),
(13, 'Automobile', 2, ''),
(14, 'Civil', 2, ''),
(15, 'EEESW', 2, ''),
(16, 'ECE', 2, 'G1'),
(17, 'FT', 2, ''),
(18, 'IT', 2, 'G1'),
(19, 'ICE', 2, ''),
(20, 'MechSW', 2, ''),
(21, 'Metallurgy', 2, ''),
(22, 'ProductionSW', 2, ''),
(23, 'RAE', 2, ''),
(24, 'Textile', 2, ''),
(25, 'FDM', 3, ''),
(26, 'Automobile', 3, ''),
(27, 'BioTechnology', 3, ''),
(28, 'BioMedical', 3, ''),
(29, 'Civil', 3, ''),
(30, 'EEESW', 3, ''),
(31, 'ECE', 3, 'G1'),
(32, 'FT', 3, ''),
(33, 'IT', 3, 'G1'),
(34, 'ICE', 3, ''),
(35, 'MechSW', 3, ''),
(36, 'ProductionSW', 3, ''),
(37, 'RAE', 3, ''),
(38, 'Textile', 3, '');
-- --------------------------------------------------------
--
-- Table structure for table `friday`
--
CREATE TABLE `friday` (
`hallnumber` varchar(10) NOT NULL,
`startingperiod` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `friday`
--
INSERT INTO `friday` (`hallnumber`, `startingperiod`) VALUES
('G306', 1),
('G306', 2),
('G306', 3),
('G306', 4),
('G306', 5),
('G306', 6),
('G306', 7),
('G306', 8),
('G306', 9),
('G402', 2),
('G402', 3),
('G402', 4),
('G402', 7),
('G402', 8),
('G406', 1),
('G406', 2),
('G406', 7),
('G406', 8),
('G406', 9),
('G407', 1),
('G407', 5),
('G407', 8),
('G408', 1),
('G408', 2),
('G408', 3),
('G408', 4),
('G408', 5),
('G408', 6),
('G408', 7),
('G408', 8),
('G408', 9),
('G409', 5),
('G409', 7),
('G409', 8),
('G502', 6),
('G502', 7),
('G502', 8),
('G502', 9),
('G503', 3),
('G503', 4),
('G503', 8),
('G503', 9),
('G506', 1),
('G506', 2),
('G506', 3),
('G506', 4),
('G506', 7),
('G506', 8),
('G506', 9),
('G508', 6),
('G508', 7),
('G508', 8),
('G602', 3),
('G602', 4),
('G602', 7),
('G602', 8),
('G603', 7),
('G603', 9),
('G606', 1),
('G606', 5),
('G606', 6),
('G606', 7),
('G606', 9),
('G607', 1),
('G607', 2),
('G607', 3),
('G607', 4),
('G607', 8),
('G607', 9),
('G608', 5),
('G608', 6),
('G608', 7),
('G608', 8),
('G608', 9),
('G609', 7),
('G609', 8);
-- --------------------------------------------------------
--
-- Table structure for table `monday`
--
CREATE TABLE `monday` (
`hallnumber` varchar(20) NOT NULL,
`startingperiod` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `monday`
--
INSERT INTO `monday` (`hallnumber`, `startingperiod`) VALUES
('G304', 7),
('G304', 8),
('G304', 9),
('G306', 1),
('G306', 2),
('G306', 3),
('G306', 4),
('G306', 5),
('G306', 6),
('G306', 7),
('G402', 1),
('G402', 3),
('G402', 4),
('G402 ', 5),
('G402', 7),
('G402', 8),
('G406', 1),
('G406', 7),
('G406', 8),
('G406', 9),
('G407', 1),
('G407', 3),
('G407', 4),
('G407', 5),
('G407', 6),
('G407', 7),
('G407', 8),
('G408', 3),
('G408', 4),
('G408', 6),
('G409', 5),
('G409', 6),
('G409', 7),
('G409', 8),
('G502', 1),
('G502', 3),
('G502', 4),
('G502', 8),
('G502', 9),
('G502', 10),
('G503', 5),
('G503', 6),
('G504', 1),
('G504', 6),
('G504', 8),
('G506', 8),
('G506', 9),
('G508', 1),
('G508', 3),
('G508', 4),
('G508', 8),
('G602', 1),
('G602', 4),
('G603', 5),
('G603', 6),
('G603', 7),
('G603', 8),
('G603', 9),
('G606', 1),
('G606', 5),
('G606', 8),
('G606', 9),
('G607', 5),
('G607', 6),
('G607', 7),
('G607', 8),
('G607', 9),
('G608', 1),
('G608', 3),
('G608', 4),
('G608', 5),
('G608', 6),
('G608', 8),
('G608', 9);
-- --------------------------------------------------------
--
-- Table structure for table `thursday`
--
CREATE TABLE `thursday` (
`hallnumber` varchar(5) NOT NULL,
`startingperiod` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `thursday`
--
INSERT INTO `thursday` (`hallnumber`, `startingperiod`) VALUES
('G306', 1),
('G306', 2),
('G306', 3),
('G306', 4),
('G306', 5),
('G306', 6),
('G306', 7),
('G306', 8),
('G306', 9),
('G402', 3),
('G402', 4),
('G402', 7),
('G402', 8),
('G406', 3),
('G406', 4),
('G406', 6),
('G406', 7),
('G406', 8),
('G406', 9),
('G407', 5),
('G407', 6),
('G407', 7),
('G407', 8),
('G408', 1),
('G408', 2),
('G408', 8),
('G408', 9),
('G409', 1),
('G409', 2),
('G409', 3),
('G409', 4),
('G409', 8),
('G502', 5),
('G502', 6),
('G502', 7),
('G502', 8),
('G502', 9),
('G503', 5),
('G503', 6),
('G503', 7),
('G503', 8),
('G503', 9),
('G506', 1),
('G506', 5),
('G506', 6),
('G506', 7),
('G506', 8),
('G506', 9),
('G508', 5),
('G508', 6),
('G508', 7),
('G508', 8),
('G509', 8),
('G602', 2),
('G602', 8),
('G603', 1),
('G603', 2),
('G603', 3),
('G603', 4),
('G603', 7),
('G603', 8),
('G603', 9),
('G606', 1),
('G606', 8),
('G606', 9),
('G607', 9),
('G609', 5),
('G609', 6),
('G609', 7),
('G609', 8);
-- --------------------------------------------------------
--
-- Table structure for table `tuesday`
--
CREATE TABLE `tuesday` (
`hallnumber` varchar(5) NOT NULL,
`startingperiod` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tuesday`
--
INSERT INTO `tuesday` (`hallnumber`, `startingperiod`) VALUES
('G304', 1),
('G304', 2),
('G304', 7),
('G304', 8),
('G304', 9),
('G306', 1),
('G306', 2),
('G306', 3),
('G306', 4),
('G306', 5),
('G306', 6),
('G402', 7),
('G402', 8),
('G406', 1),
('G406', 8),
('G406', 9),
('G407', 5),
('G407', 6),
('G407', 8),
('G408', 3),
('G408', 4),
('G408', 6),
('G408', 7),
('G408', 8),
('G408', 9),
('G409', 5),
('G409', 6),
('G409', 7),
('G409', 8),
('G502', 3),
('G502', 6),
('G502', 7),
('G502', 8),
('G502', 9),
('G503', 8),
('G503', 9),
('G504', 5),
('G504', 7),
('G506', 5),
('G506', 6),
('G506', 7),
('G506', 8),
('G506', 9),
('G508', 1),
('G508', 2),
('G508', 3),
('G508', 4),
('G508', 8),
('G509', 5),
('G509', 6),
('G509', 7),
('G509', 8),
('G602', 1),
('G602', 2),
('G602', 3),
('G602', 4),
('G602', 8),
('G602', 9),
('G603', 3),
('G603', 4),
('G603', 5),
('G603', 6),
('G603', 7),
('G603', 8),
('G603', 9),
('G606', 1),
('G606', 3),
('G606', 4),
('G606', 8),
('G606', 9),
('G608', 1),
('G608', 3),
('G608', 4),
('G608', 6),
('G608', 9),
('G609', 1),
('G609', 3),
('G609', 4),
('G609', 7),
('G609', 8);
-- --------------------------------------------------------
--
-- Table structure for table `wednesday`
--
CREATE TABLE `wednesday` (
`hallnumber` varchar(5) NOT NULL,
`startingperiod` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `wednesday`
--
INSERT INTO `wednesday` (`hallnumber`, `startingperiod`) VALUES
('G304', 3),
('G304', 4),
('G304', 8),
('G304', 9),
('G306', 1),
('G306', 2),
('G306', 3),
('G306', 4),
('G402', 5),
('G402', 6),
('G402', 7),
('G402', 8),
('G402', 9),
('G406', 3),
('G406', 4),
('G406', 5),
('G406', 6),
('G406', 7),
('G406', 8),
('G406', 9),
('G407', 1),
('G407', 5),
('G407', 8),
('G408', 1),
('G408', 2),
('G408', 3),
('G408', 4),
('G409', 7),
('G409', 8),
('G502', 6),
('G502', 7),
('G502', 8),
('G502', 9),
('G503', 6),
('G503', 7),
('G503', 9),
('G506', 1),
('G506', 7),
('G506', 8),
('G506', 9),
('G508', 4),
('G508', 7),
('G508', 8),
('G509', 1),
('G509', 2),
('G509', 3),
('G509', 4),
('G509', 5),
('G602', 5),
('G602', 6),
('G602', 7),
('G602', 8),
('G606', 6),
('G606', 7),
('G606', 8),
('G606', 9),
('G607', 9),
('G608', 5),
('G608', 6),
('G608', 7),
('G608', 9),
('G609', 1),
('G609', 2),
('G609', 3),
('G609', 4),
('G609', 8);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `booking`
--
ALTER TABLE `booking`
ADD PRIMARY KEY (`hallnumber`,`period`,`date`),
ADD KEY `class_code` (`class_code`);
--
-- Indexes for table `bookingclub`
--
ALTER TABLE `bookingclub`
ADD PRIMARY KEY (`hallnumber`,`period`,`date`);
--
-- Indexes for table `class`
--
ALTER TABLE `class`
ADD PRIMARY KEY (`class_code`);
--
-- Indexes for table `friday`
--
ALTER TABLE `friday`
ADD PRIMARY KEY (`hallnumber`,`startingperiod`);
--
-- Indexes for table `monday`
--
ALTER TABLE `monday`
ADD PRIMARY KEY (`hallnumber`,`startingperiod`);
--
-- Indexes for table `thursday`
--
ALTER TABLE `thursday`
ADD PRIMARY KEY (`hallnumber`,`startingperiod`);
--
-- Indexes for table `tuesday`
--
ALTER TABLE `tuesday`
ADD PRIMARY KEY (`hallnumber`,`startingperiod`);
--
-- Indexes for table `wednesday`
--
ALTER TABLE `wednesday`
ADD PRIMARY KEY (`hallnumber`,`startingperiod`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `booking`
--
ALTER TABLE `booking`
ADD CONSTRAINT `booking_ibfk_1` FOREIGN KEY (`class_code`) REFERENCES `class` (`class_code`);
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
|
07a51bf87abc5098fcebb7cfe8596335dcd4c73a
|
SQL
|
bellmit/origin
|
/family_order/sql/TD_S_COMMPARA/SEL_SALEACTIVE_GOTGGCARD_NUM.sql
|
UTF-8
| 245
| 2.6875
| 3
|
[] |
no_license
|
select nvl(sum(a.rsrv_str3),0) haved_num from tf_f_user_other a
where a.partition_id=mod(:USER_ID,10000)
and a.user_id=:USER_ID
and a.rsrv_value_code='GET_GGCARD_NUM'
and a.rsrv_Str1=:PRODUCT_ID
and a.rsrv_Str2=:PACKAGE_ID
and a.end_date>sysdate
| true
|
3180729f67f46e4d36aed5b4ce316b12337c08ec
|
SQL
|
KPCE/lhl_midterm
|
/db/seeds/02_stories.sql
|
UTF-8
| 2,134
| 2.640625
| 3
|
[] |
no_license
|
-- stories table seeds here
INSERT INTO stories (cretor_id, story_title, story_beginning, is_complete, cover_photo_url) VALUES (1, 'This is the title of my first story', 'This is the beginning of my first story.', false, '#');
INSERT INTO stories (cretor_id, story_title, story_beginning, is_complete, cover_photo_url) VALUES (1, 'This is the title of my second story', 'This is the beginning of my second story.', true, '#');
INSERT INTO stories (cretor_id, story_title, story_beginning, is_complete, cover_photo_url) VALUES (2, 'This is the title of the other story', 'This is the beginning of another story.', false, '#');
INSERT INTO stories (cretor_id, story_title, story_beginning, is_complete, cover_photo_url) VALUES (2, 'THE COUNT OF MONTE CRISTO', 'On the 24th of February, 1815, the look-out at Notre-Dame de la Garde signalled the three-master, the Pharaon from Smyrna, Trieste, and Naples.', false, 'https://www.gutenberg.org/files/1184/1184-h/images/0011m.jpg');
INSERT INTO stories (cretor_id, story_title, story_beginning, is_complete, cover_photo_url) VALUES (2, 'Frankenstein; or, the Modern Prometheus',
'Letter 1
To Mrs. Saville, England.
St. Petersburgh, Dec. 11th, 17—.
You will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking.
', false, 'https://upload.wikimedia.org/wikipedia/commons/c/c2/Frankenstein%2C_pg_7.jpg');
INSERT INTO stories (cretor_id, story_title, story_beginning, is_complete, cover_photo_url) VALUES (2, 'By Robert William Service','There are strange things done in the midnight sun
By the men who moil for gold;
The Arctic trails have their secret tales
That would make your blood run cold;
The Northern Lights have seen queer sights,
But the queerest they ever did see
Was that night on the marge of Lake Lebarge
I cremated Sam McGee.', true, 'https://opentextbc.ca/provincialenglish/wp-content/uploads/sites/297/2019/05/rservice.jpg');
| true
|
fdee0ba98f4349d9a10beabe503f33fb79783d37
|
SQL
|
Forthofferl/Jeu_de_persuasion
|
/schema_bdd.sql
|
UTF-8
| 5,140
| 3.484375
| 3
|
[] |
no_license
|
--
-- Base de données : `persuasion_game`
--
-- --------------------------------------------------------
--
-- Structure de la table `pp_arguments`
--
CREATE TABLE IF NOT EXISTS `pp_arguments` (
`idArg` int(11) NOT NULL AUTO_INCREMENT,
`message` varchar(255) NOT NULL,
`idPartie` int(11) NOT NULL,
`idJoueur` int(11) NOT NULL,
`nbVote` int(11) NOT NULL,
PRIMARY KEY (`idArg`),
KEY `idPartie` (`idPartie`),
KEY `idJoueur1` (`idJoueur`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
-- --------------------------------------------------------
--
-- Structure de la table `pp_coter_sujet`
--
CREATE TABLE IF NOT EXISTS `pp_coter_sujet` (
`idPartie` int(11) NOT NULL,
`idJoueur` int(11) NOT NULL,
`coter` int(11) NOT NULL,
PRIMARY KEY (`idPartie`,`idJoueur`),
KEY `pp_coter_sujet_fk_idJoueur` (`idJoueur`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `pp_joueurs`
--
CREATE TABLE IF NOT EXISTS `pp_joueurs` (
`idJoueur` int(11) NOT NULL AUTO_INCREMENT,
`pseudo` varchar(20) NOT NULL,
`sexe` char(1) NOT NULL,
`age` int(10) unsigned NOT NULL,
`nbV` int(10) unsigned NOT NULL,
`nbD` int(10) unsigned NOT NULL,
`pwd` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`active` varchar(255) NOT NULL,
`resetToken` varchar(255) DEFAULT NULL,
`resetCompleted` varchar(3) DEFAULT 'Non',
PRIMARY KEY (`idJoueur`),
UNIQUE KEY `pseudo` (`pseudo`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
-- --------------------------------------------------------
--
-- Structure de la table `pp_parties`
--
CREATE TABLE IF NOT EXISTS `pp_parties` (
`idPartie` int(11) NOT NULL,
`idSujet` int(11) NOT NULL,
`nbArg` int(10) unsigned NOT NULL,
`idJoueurGagnant` int(11) DEFAULT NULL,
`idJoueurPerdant` int(11) DEFAULT NULL,
PRIMARY KEY (`idPartie`),
UNIQUE KEY `idSujet` (`idSujet`),
UNIQUE KEY `idJoueurPerdant` (`idJoueurPerdant`),
KEY `idJoueurGagnant` (`idJoueurGagnant`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table `pp_partie_en_attente`
--
CREATE TABLE IF NOT EXISTS `pp_partie_en_attente` (
`idPartie_en_attente` int(11) NOT NULL AUTO_INCREMENT,
`idJoueur` int(11) NOT NULL,
`idSujet` int(11) NOT NULL,
`coterSujet` varchar(10) NOT NULL,
`enAttenteDeJoueur` varchar(3) NOT NULL DEFAULT 'OUI',
`placeSpectateurRestant` int(4) NOT NULL,
PRIMARY KEY (`idPartie_en_attente`),
UNIQUE KEY `idJoueur` (`idJoueur`),
KEY `idSujet` (`idSujet`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
-- --------------------------------------------------------
--
-- Structure de la table `pp_partie_temporaire`
--
CREATE TABLE IF NOT EXISTS `pp_partie_temporaire` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idSujet` int(11) NOT NULL,
`joueur1` int(11) DEFAULT NULL,
`joueur2` int(11) DEFAULT NULL,
`tourJoueur1` varchar(3) NOT NULL,
`tourJoueur2` varchar(3) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `joueur1` (`joueur1`),
UNIQUE KEY `joueur2` (`joueur2`),
UNIQUE KEY `joueur1_2` (`joueur1`,`joueur2`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=153 ;
-- --------------------------------------------------------
--
-- Structure de la table `pp_sujets`
--
CREATE TABLE IF NOT EXISTS `pp_sujets` (
`idSujet` int(11) NOT NULL AUTO_INCREMENT,
`nom` varchar(255) NOT NULL,
`nomTheme` varchar(40) NOT NULL,
PRIMARY KEY (`idSujet`),
UNIQUE KEY `nom` (`nom`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `pp_arguments`
--
ALTER TABLE `pp_arguments`
ADD CONSTRAINT `fk_idPartie_pp_arguments` FOREIGN KEY (`idPartie`) REFERENCES `pp_parties` (`idPartie`) ON DELETE CASCADE,
ADD CONSTRAINT `pp_arguments_ibfk_2` FOREIGN KEY (`idJoueur`) REFERENCES `pp_joueurs` (`idJoueur`) ON DELETE CASCADE;
--
-- Contraintes pour la table `pp_coter_sujet`
--
ALTER TABLE `pp_coter_sujet`
ADD CONSTRAINT `pp_coter_sujet_fk_idJoueur` FOREIGN KEY (`idJoueur`) REFERENCES `pp_joueurs` (`idJoueur`) ON DELETE CASCADE,
ADD CONSTRAINT `pp_coter_sujet_fk_idPartie` FOREIGN KEY (`idPartie`) REFERENCES `pp_parties` (`idPartie`) ON DELETE CASCADE;
--
-- Contraintes pour la table `pp_parties`
--
ALTER TABLE `pp_parties`
ADD CONSTRAINT `pp_parties_ibfk_3` FOREIGN KEY (`idJoueurGagnant`) REFERENCES `pp_joueurs` (`idJoueur`) ON DELETE CASCADE,
ADD CONSTRAINT `pp_parties_ibfk_4` FOREIGN KEY (`idSujet`) REFERENCES `pp_sujets` (`idSujet`) ON DELETE CASCADE,
ADD CONSTRAINT `pp_parties_ibfk_5` FOREIGN KEY (`idJoueurPerdant`) REFERENCES `pp_joueurs` (`idJoueur`) ON DELETE CASCADE;
--
-- Contraintes pour la table `pp_partie_en_attente`
--
ALTER TABLE `pp_partie_en_attente`
ADD CONSTRAINT `pp_partie_en_attente_fk_idJoueur` FOREIGN KEY (`idJoueur`) REFERENCES `pp_joueurs` (`idJoueur`) ON DELETE CASCADE,
ADD CONSTRAINT `pp_partie_en_attente_fk_idSujet` FOREIGN KEY (`idSujet`) REFERENCES `pp_sujets` (`idSujet`) ON DELETE CASCADE;
| true
|
22b1d2b238eb44dd524084619c1f7476aaada0f6
|
SQL
|
sqlfluff/sqlfluff
|
/test/fixtures/dialects/sqlite/create_index.sql
|
UTF-8
| 411
| 2.9375
| 3
|
[
"MIT"
] |
permissive
|
CREATE INDEX li1 ON entries_data(id, LENGTH(chunk));
CREATE INDEX acctchng_magnitude ON account_change(acct_no, abs(amt));
CREATE INDEX t2xy ON t2(x+y);
CREATE UNIQUE INDEX team_leader ON person(team_id) WHERE is_team_leader;
CREATE INDEX ex1 ON tab1(a,b) WHERE a=5 OR b=6;
CREATE INDEX po_parent ON purchaseorder(parent_po) WHERE parent_po IS NOT NULL;
CREATE INDEX ex2 ON tab2(b,c) WHERE c IS NOT NULL;
| true
|
997768ee5cbb280ca2df2d691f95f1c42f18c811
|
SQL
|
Ibarra11/codewars
|
/kata6/tableTotal.sql
|
UTF-8
| 434
| 3.71875
| 4
|
[] |
no_license
|
-- Codewars LInk: https://www.codewars.com/kata/sql-basics-simple-table-totaling/sql
-- Challenge: create a querty to display each unique clan with their total points and ranked by theri total points
SELECT ROW_NUMBER() OVER() AS "rank", *
FROM(
SELECT CASE WHEN clan = '' THEN '[no clan specified]' else clan END, SUM(points) AS "total_points", COUNT(id) AS "total_people"
FROM people
GROUP BY 1
ORDER BY 2 DESC
) AS "x"
| true
|
26e5004f702f3c76a131a6cb56ab4ee4ab21b806
|
SQL
|
vkscorpio3/atg_training
|
/workspace/modules/ClothingStore/build/atgsql/DCS/Versioned/sql/db_components/oracle/versioned_promotion_ddl.sql
|
UTF-8
| 8,024
| 2.8125
| 3
|
[] |
no_license
|
-- @version $Id: //product/DCS/version/11.2/templates/DCS/sql/promotion_ddl.xml#2 $$Change: 1179550 $
-- Add the DCS_PRM_FOLDER table, promotionFolder
create table dcs_prm_folder (
asset_version number(19) not null,
workspace_id varchar2(40) not null,
branch_id varchar2(40) not null,
is_head number(1) not null,
version_deleted number(1) not null,
version_editable number(1) not null,
pred_version number(19) null,
checkin_date timestamp null,
folder_id varchar2(40) not null,
name varchar2(254) not null,
parent_folder varchar2(40) null
,constraint dcs_prm_folder_p primary key (folder_id,asset_version));
create index dcs_prm_folder_wsx on dcs_prm_folder (workspace_id);
create index dcs_prm_folder_cix on dcs_prm_folder (checkin_date);
create table dcs_stacking_rule (
asset_version number(19) not null,
workspace_id varchar2(40) not null,
branch_id varchar2(40) not null,
is_head number(1) not null,
version_deleted number(1) not null,
version_editable number(1) not null,
pred_version number(19) null,
checkin_date timestamp null,
stacking_rule_id varchar2(40) not null,
display_name varchar2(254) null,
order_limits number(10) null,
last_modified timestamp null
,constraint dcs_sr_p primary key (stacking_rule_id,asset_version));
create index dcs_stacking_r_wsx on dcs_stacking_rule (workspace_id);
create index dcs_stacking_r_cix on dcs_stacking_rule (checkin_date);
create table dcs_excl_stacking_rules (
asset_version number(19) not null,
stacking_rule_id varchar2(40) not null,
excl_stacking_rule_id varchar2(40) not null);
create table dcs_promotion (
asset_version number(19) not null,
workspace_id varchar2(40) not null,
branch_id varchar2(40) not null,
is_head number(1) not null,
version_deleted number(1) not null,
version_editable number(1) not null,
pred_version number(19) null,
checkin_date timestamp null,
promotion_id varchar2(40) not null,
version integer not null,
creation_date timestamp null,
start_date timestamp null,
end_date timestamp null,
display_name varchar2(254) null,
description varchar2(254) null,
promotion_type integer null,
enabled number(1,0) null,
begin_usable timestamp null,
end_usable timestamp null,
priority integer null,
evaluation_limit number(10) null,
global number(1,0) null,
anon_profile number(1,0) null,
allow_multiple number(1,0) null,
uses integer null,
rel_expiration number(1,0) null,
time_until_expire integer null,
template varchar2(254) null,
ui_access_lvl integer null,
parent_folder varchar2(40) null,
last_modified timestamp null,
pmdl_version integer null,
eval_target_items_first number(1) null,
qualifier varchar2(254) null,
stacking_rule varchar2(40) null,
fil_Qual_Discounted_By_Any number(1) null,
fil_Qual_Discounted_By_Current number(1) null,
fil_Qual_Acted_As_Qual number(1) null,
fil_Qual_On_Sale number(1) null,
fil_Qual_Zero_Prices number(1) null,
fil_Qual_Neg_Prices number(1) null,
fil_Tar_Acted_As_Qual number(1) null,
fil_Tar_Discounted_By_Current number(1) null,
fil_Tar_Discounted_By_Any number(1) null,
fil_Target_On_Sale number(1) null,
fil_Tar_Zero_Prices number(1) null,
fil_Tar_Neg_Prices number(1) null,
fil_Tar_Price_LTOET_Prm_Price number(1) null
,constraint dcs_promotion_p primary key (promotion_id,asset_version)
,constraint dcs_promotion1_c check (enabled in (0,1))
,constraint dcs_promotion2_c check (global in (0,1))
,constraint dcs_promotion3_c check (anon_profile in (0,1))
,constraint dcs_promotion4_c check (allow_multiple in (0,1))
,constraint dcs_promotion5_c check (rel_expiration in (0,1))
,constraint dcs_promotion6_c check (eval_target_items_first in (0,1)));
create index prmo_bgin_use_idx on dcs_promotion (begin_usable);
create index prmo_end_dte_idx on dcs_promotion (end_date);
create index prmo_end_use_idx on dcs_promotion (end_usable);
create index prmo_strt_dte_idx on dcs_promotion (start_date);
create index dcs_promotion_wsx on dcs_promotion (workspace_id);
create index dcs_promotion_cix on dcs_promotion (checkin_date);
create table dcs_promo_media (
asset_version number(19) not null,
promotion_id varchar2(40) not null,
tag varchar2(42) not null,
media_id varchar2(40) not null
,constraint dcs_promo_media_p primary key (promotion_id,tag,asset_version));
create index promo_mdia_pid_idx on dcs_promo_media (promotion_id);
create table dcs_promo_payment (
asset_version number(19) not null,
promotion_id varchar2(40) not null,
payment_type varchar2(40) not null);
create table dcs_discount_promo (
asset_version number(19) not null,
promotion_id varchar2(40) not null,
calculator varchar2(254) null,
adjuster number(19,7) null,
pmdl_rule clob not null,
one_use number(1,0) null
,constraint dcs_discount_pro_p primary key (promotion_id,asset_version)
,constraint dcs_discount_pro_c check (one_use in (0, 1)));
create table dcs_promo_upsell (
asset_version number(19) not null,
promotion_id varchar2(40) not null,
upsell number(1,0) null
,constraint dcs_promo_upsell_p primary key (promotion_id,asset_version)
,constraint dcs_promo_upsell_c check (upsell in (0, 1)));
create table dcs_upsell_action (
asset_version number(19) not null,
workspace_id varchar2(40) not null,
branch_id varchar2(40) not null,
is_head number(1) not null,
version_deleted number(1) not null,
version_editable number(1) not null,
pred_version number(19) null,
checkin_date timestamp null,
action_id varchar2(40) not null,
version number(10) not null,
name varchar2(40) not null,
upsell_prd_grp clob null
,constraint dcs_upsell_actn_p primary key (action_id,asset_version));
create index dcs_upsell_act_wsx on dcs_upsell_action (workspace_id);
create index dcs_upsell_act_cix on dcs_upsell_action (checkin_date);
create table dcs_close_qualif (
asset_version number(19) not null,
workspace_id varchar2(40) not null,
branch_id varchar2(40) not null,
is_head number(1) not null,
version_deleted number(1) not null,
version_editable number(1) not null,
pred_version number(19) null,
checkin_date timestamp null,
close_qualif_id varchar2(40) not null,
version number(10) not null,
name varchar2(254) not null,
priority number(10) null,
qualifier clob null,
upsell_media varchar2(40) null,
upsell_action varchar2(40) null
,constraint dcs_close_qualif_p primary key (close_qualif_id,asset_version));
create index dcs_close_qual_wsx on dcs_close_qualif (workspace_id);
create index dcs_close_qual_cix on dcs_close_qualif (checkin_date);
create table dcs_prm_cls_qlf (
sec_asset_version number(19) not null,
asset_version number(19) not null,
promotion_id varchar2(40) not null,
closeness_qualif varchar2(40) not null);
create table dcs_prm_sites (
asset_version number(19) not null,
promotion_id varchar2(40) not null,
site_id varchar2(40) not null);
create table dcs_prm_site_grps (
asset_version number(19) not null,
promotion_id varchar2(40) not null,
site_group_id varchar2(40) not null);
create table dcs_prm_tpl_vals (
asset_version number(19) not null,
promotion_id varchar2(40) not null,
placeholder varchar2(40) not null,
placeholderValue clob null
,constraint dcs_prm_tpl_vals_p primary key (promotion_id,placeholder,asset_version));
create table dcs_prm_cls_vals (
asset_version number(19) not null,
close_qualif_id varchar2(40) not null,
placeholder varchar2(40) not null,
placeholderValue clob null
,constraint dcs_prm_cls_vals_p primary key (close_qualif_id,placeholder,asset_version));
create table dcs_upsell_prods (
asset_version number(19) not null,
action_id varchar2(40) not null,
product_id varchar2(40) not null,
sequence_num number(10) not null
,constraint dcs_upsell_prods_p primary key (action_id,product_id,asset_version));
create table dcs_excl_promotions (
asset_version number(19) not null,
promotion_id varchar2(40) not null,
excl_promotion_id varchar2(40) not null);
create table dcs_incl_promotions (
asset_version number(19) not null,
promotion_id varchar2(40) not null,
incl_promotion_id varchar2(40) not null);
| true
|
f55c9ddc07eb09af3a7c01fb514f2720b4180d23
|
SQL
|
sv9rxw/FreqMngr
|
/FreqMngr.WPF/TableGroupsTreeHierarchy.sql
|
UTF-8
| 1,346
| 3.96875
| 4
|
[] |
no_license
|
UPDATE TableGroups SET depth = 0
WHERE parentId IS NULL;
WHILE EXISTS (SELECT * FROM TableGroups WHERE Depth IS NULL)
UPDATE T SET T.Depth = P.Depth + 1
FROM TableGroups AS T INNER JOIN TableGroups AS P
ON (T.ParentId = P.Id)
WHERE P.Depth >= 0
AND T.Depth IS NULL;
UPDATE TableGroups SET PathIndex = 0, NumericalMapping = '0.0'
WHERE ParentId IS NULL;
;WITH x AS
(
SELECT Id, rank() over (partition by ParentId order by Id) as PathIndex
FROM TableGroups
WHERE ParentId IS NOT NULL
)
UPDATE TableGroups
SET PathIndex = x.PathIndex
FROM x
WHERE TableGroups.Id = x.Id;
UPDATE TableGroups
SET Numericalmapping = PathIndex
WHERE depth = 1;
WHILE EXISTS (SELECT * FROM TableGroups WHERE NumericalMapping Is Null)
UPDATE T SET T.NumericalMapping = cast(P.Numericalmapping as
varchar(256)) + '.' +
cast(T.PathIndex as varchar(256))
FROM TableGroups AS T INNER JOIN TableGroups AS P
ON (T.ParentId = P.Id)
WHERE P.PathIndex >= 0
AND T.NumericalMapping IS NULL;
WITH Items(Id, Name, ParentId, Depth, PathIndex, ItemNumber)
AS
(
SELECT Id, Name, ParentId, depth, PathIndex, NumericalMapping
FROM TableGroups
)
SELECT *
FROM Items
ORDER BY CONVERT(hierarchyid, '/' + ItemNumber + '/')
| true
|
22091afebf3025178279528a1a6fd022f967e1f4
|
SQL
|
Vershal-Igor/REST-task
|
/src/main/resources/schema.sql
|
UTF-8
| 2,993
| 3.109375
| 3
|
[] |
no_license
|
-- MySQL Script generated by MySQL Workbench
-- Tue Dec 22 00:37:08 2020
-- Model: New Model Version: 1.0
-- 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 itransition
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema itransition
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `itransition` DEFAULT CHARACTER SET utf8 ;
USE `itransition` ;
-- -----------------------------------------------------
-- Table `itransition`.`User`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `itransition`.`User` (
`id` INT NOT NULL AUTO_INCREMENT,
`full_name` VARCHAR(100) NULL,
`address` VARCHAR(100) NULL,
`phone` VARCHAR(45) NULL,
`region_support` INT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-- -----------------------------------------------------
-- Data for table `itransition`.`User`
-- -----------------------------------------------------
START TRANSACTION;
USE `itransition`;
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (1, 'Иван Иванов Иванович', 'Minsk, Victory 10', '+375291111111', 1);
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (2, 'Пётр Петров Петрович', 'Minsk, Victory 22', '+375292222222', 1);
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (3, 'Михаил Круг Александрович', 'Moscow, Red Place 3', '+375773333333', 2);
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (4, 'Владимир Путин Владимирович', 'Moscow, Red Place 1', '+375770000000', 2);
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (5, 'Дмитрий Медведев Анатольевич', 'Moscow, Red Place 2', '+375776000002', 2);
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (6, 'Николай Басков Николаевич', 'Moscow, War 4', '+375775677789', 2);
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (7, 'Борак Обама Махмудович', 'USA, Wall street', '+456330010007', 0);
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (8, 'Пётр Первый Великий', 'St.Petersburg, Coin', '+100347673711', 2);
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (9, 'Ким Чин Ин', 'North Korea, Pyongyang', '+000166678172', 0);
INSERT INTO `itransition`.`User` (`id`, `full_name`, `address`, `phone`, `region_support`) VALUES (10, 'Юлия Темошенко Викторовна', 'Ukraine, Freedom street', '+367998022344', 0);
COMMIT;
| true
|
c0764b113e84e88a1e74e77ca5d7f062a20e40e9
|
SQL
|
ilpython/oracle19c-labs
|
/solutions/Access_Paths/create_cust_year_of_birth_index.sql
|
UTF-8
| 118
| 2.59375
| 3
|
[] |
no_license
|
set echo on
CREATE INDEX cust_cust_year_of_birth_idx
ON customers(cust_year_of_birth)
NOLOGGING COMPUTE STATISTICS;
| true
|
223d9cf1b147b79d2e52344c992dbd300345095a
|
SQL
|
miths1108/PiGen
|
/codd-data-gen/resources/cdgclient/postgresOld/sqlqueriesProj/q124.sql
|
UTF-8
| 302
| 2.90625
| 3
|
[] |
no_license
|
select distinct(i_brand_id,i_class_id,i_category_id)
from web_sales
,item
,date_dim
where ws_item_sk = i_item_sk
and ws_sold_date_sk = d_date_sk
and d_year = 2000+2
and d_moy = 11
;
-- end query 69 in stream 0 using template query14.tpl
| true
|
09fc0b2101bf8bcb74fdaf8b75aae5dad4e31e6a
|
SQL
|
green-fox-academy/gosireka
|
/week-09/day-2/todo.sql
|
UTF-8
| 557
| 3.5625
| 4
|
[] |
no_license
|
CREATE DATABASE todo;
CREATE TABLE todos(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(200) NOT NULL,
done BOOLEAN NULL
);
ALTER TABLE todos
MODIFY COLUMN done BOOLEAN DEFAULT 0;
INSERT INTO todos
VALUES (1, 'shopping', false);
INSERT INTO todos (title, done)
VALUES ('cooking', false);
VALUES ('watching the videos', true);
INSERT INTO todos (title)
VALUES ('do the laundry'), ('eat orange'), ('buy catfood'), ('play with the cat');;
DELETE FROM todos WHERE id=5;
UPDATE todos
SET done = 1
WHERE id = 7;
SELECT * FROM todos;
| true
|
7d9debce3db43af9b99fd84567806a5922cbfe90
|
SQL
|
dpi209/CSB7.0
|
/csb/csb-installer/tables/1_sessions.sql
|
UTF-8
| 413
| 2.515625
| 3
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
CREATE TABLE `sessions` (
`id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`user_id` int(11) DEFAULT NULL,
`ip_address` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`user_agent` text COLLATE utf8_unicode_ci,
`payload` text COLLATE utf8_unicode_ci NOT NULL,
`last_activity` int(11) NOT NULL,
UNIQUE KEY `sessions_id_unique` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
| true
|
dfcf0155e8a90526b8f49df1e3d7976e415108ca
|
SQL
|
x2p/x2p_api
|
/api/resources/sql/get_ora_freespace.sql
|
UTF-8
| 789
| 3.734375
| 4
|
[] |
no_license
|
-- Get space usage for each datafiles
connect / as sysdba
set serveroutput on
set pagesize 1000
set linesize 255
set feedback off
select substr(df.tablespace_name,1,20) "Tablespace Name", substr(df.file_name,1,40) "File Name", round(df.bytes/1024/1024,2) "Size (M)", round(e.used_bytes/1024/1024,2) "Used (M)", round(f.free_bytes/1024/1024,2) "Free (M)", Rpad(' '|| Rpad('X',round(e.used_bytes*10/df.bytes,0), 'X'),11,'-') "% Used" from DBA_DATA_FILES DF, (select file_id, sum(Decode(bytes,NULL,0,bytes)) used_bytes from dba_extents group by file_id) E, (select Max(bytes) free_bytes, file_id from dba_free_space group by file_id) f where e.file_id (+) = df.file_id and df.file_id = f.file_id (+) order by df.tablespace_name, df.file_name;
prompt
set feedback on
set pagesize 18
exit
| true
|
e0118807d0a071b94bd5412960b2ad961707a297
|
SQL
|
robert-virtual/EbayApp
|
/EbayApp/DataAccess/dbscript.sql
|
UTF-8
| 2,150
| 3.65625
| 4
|
[] |
no_license
|
-- dapper - mini orm - realiza las consultas
create DATABASE ebaydb
use ebaydb
create table Categories(
CategoryId int PRIMARY KEY IDENTITY,
Name NVARCHAR(25)
)
create table Products(
ProductId int PRIMARY KEY IDENTITY,
Name NVARCHAR(25),
Price money,
CategoryFk int FOREIGN KEY REFERENCES Categories(CategoryId),
Activo bit DEFAULT 1,
CreatedAt DATETIME DEFAULT GETDATE()
)
select * from Products
select * from Categories
insert into Categories(Name) VALUES('Beverages')
insert into Products(Name,Price,CategoryFk) VALUES('cocacola',60,1)
create table Customers(
DNI NVARCHAR(13) PRIMARY KEY,
Name NVARCHAR(50),
Phone NVARCHAR(8),
Address NVARCHAR(100),
CreatedAt DATETIME DEFAULT GETDATE()
)
create table Roles(
RolId int PRIMARY KEY IDENTITY,
Name nvarchar(50)
)
create table Employees(
DNI NVARCHAR(13) PRIMARY KEY,
Name NVARCHAR(50),
Password NVARCHAR(450),
Phone NVARCHAR(8),
Address NVARCHAR(100),
RolFk int FOREIGN KEY REFERENCES Roles(RolId),
Birthday DATE,
HiredAt DATE DEFAULT GETDATE(),
FiredAt DATE,
Activo bit DEFAULT 1,
)
insert into Roles VALUES('admin'),('sells')
--
create table Sells(
SellId int PRIMARY KEY,
EmployeeFk NVARCHAR(13) FOREIGN KEY REFERENCES Employees(DNI),
CustomerFk NVARCHAR(13) FOREIGN KEY REFERENCES Customers(DNI),
CreatedAt DATETIME DEFAULT GETDATE()
)
create table SellDetails(
SellFk int FOREIGN KEY REFERENCES Sells(SellId),
ProductFk int FOREIGN KEY REFERENCES Products(ProductId),
Amout int,
Price money,
Descount money
)
create table Suppliers(
SupplierId int PRIMARY KEY IDENTITY,
Name NVARCHAR(50)
)
--
create table Purchases(
PurchaseId int PRIMARY KEY IDENTITY,
EmployeeFk NVARCHAR(13) FOREIGN KEY REFERENCES Employees(DNI),
SupplierFk int FOREIGN KEY REFERENCES Suppliers(SupplierId),
CreatedAt DATETIME DEFAULT GETDATE()
)
create table PurchaseDetails(
PurchaseFk int FOREIGN KEY REFERENCES Purchases(PurchaseId),
ProductFk int FOREIGN KEY REFERENCES Products(ProductId),
Amout int,
Price money,
)
| true
|
7263ed8f28e4726efc4df52330e2d4db7c3b7fd5
|
SQL
|
apexcollege/dotnet2018
|
/ecommerce/ecommerce.data/db scripts/Student.sql
|
UTF-8
| 162
| 2.515625
| 3
|
[
"MIT"
] |
permissive
|
CREATE TABLE Student
(
Id INT PRIMARY KEY IDENTITY(1,1) NOT NULL,
Name NVARCHAR(MAX),
RollNo INT,
Grade NVARCHAR(50),
EnrolDate DATE,
Active BIT
)
| true
|
c3a92846af1b93f27a9178033ecdb16dfd25e51a
|
SQL
|
harabbi/MBK
|
/scripts/create_vm_merged_products.sql
|
UTF-8
| 1,784
| 2.625
| 3
|
[] |
no_license
|
create database if not exists vm_merged;
create table if not exists vm_merged_products (
`v_productprice` double,
`v_listprice` double,
`v_categoryid` bigint,
`v_categoryids` text,
`v_productcode` text,
`v_productname` text,
`v_saleprice` double,
`v_productweight` double,
`v_productmanufacturer` text,
`v_taxableproduct` text,
`v_productdescription` text,
`v_productdescriptionshort` text,
`v_productfeatures` text,
`v_stockstatus` int,
`v_metatag_title` text,
`v_metatag_description` text,
`v_hideproduct` text,
`v_stocklowqtyalarm` bigint,
`v_maxqty` bigint,
`v_howtogetsaleprice` text,
`v_discountedprice_level1` double,
`v_discountedprice_level3` double,
`v_yahoo_category` text,
`v_displaybegindate` datetime,
`v_vendor_price` double,
`m_price` double,
`m_mbk_retail_price` double,
`m_category_ids` text,
`m_sku` text,
`m_mbk_product_code` text,
`m_name` text,
`m_special_price` double,
`m_weight` double,
`m_manufacturer` text,
`m_tax_class_id` bigint,
`m_description` text,
`m_short_description` text,
`m_mbk_features_area` text,
`m_qty` bigint,
`m_meta_title` text,
`m_meta_description` text,
`m_status` int,
`m_notify_stock_qty` bigint,
`m_max_sale_qty` bigint,
`m_mbk_map_price` double,
`m__tier_price_price` double,
`m_cost` double,
`mbk_import_update` tinyint(1) DEFAULT '0',
`mbk_import_new` tinyint(1) DEFAULT '0',
`mbk_ready_to_import` tinyint(1) DEFAULT '0',
`mbk_updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
`mbk_created_at` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
| true
|
54a36221dc98f30887bdceaf37894895df4ee71d
|
SQL
|
LilyAsk/LilyAsk
|
/LilyAsk/sys/db/comment_info.sql
|
UTF-8
| 899
| 2.71875
| 3
|
[] |
no_license
|
/*
Navicat MySQL Data Transfer
Source Server : Hiki
Source Server Version : 50633
Source Host : localhost:3306
Source Database : lilyask
Target Server Type : MYSQL
Target Server Version : 50633
File Encoding : 65001
Date: 2016-10-23 09:22:59
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for comment_info
-- ----------------------------
DROP TABLE IF EXISTS `comment_info`;
CREATE TABLE `comment_info` (
`cid` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`aid` int(11) NOT NULL,
`comment` text NOT NULL,
`c_time` datetime NOT NULL,
`agree_num` int(10) unsigned NOT NULL,
`oppose_num` int(10) unsigned NOT NULL,
`comment_num` int(10) NOT NULL,
PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of comment_info
-- ----------------------------
| true
|
13aa64ce74a761673ceaa2da3abb534c3d62acce
|
SQL
|
BillyHao/Azure_DataEngineer
|
/SQLQuery #Q13.sql
|
UTF-8
| 990
| 3.890625
| 4
|
[] |
no_license
|
USE WideWorldImporters
SELECT a.StockGroupName, total_purchase, total_sale, (total_purchase-total_sale) AS Remaining
FROM
(SELECT StockGroupName,sg.StockGroupID,SUM(ws.QuantityPerOuter * po.OrderedOuters) AS total_purchase
FROM Warehouse.StockItems AS ws
JOIN Purchasing.PurchaseOrderLines AS po ON ws.StockItemID = po.StockItemID
JOIN Warehouse.StockItemStockGroups AS sisg ON ws.StockItemID = sisg.StockItemID
JOIN Warehouse.StockGroups AS sg ON sisg.StockGroupID = sg.StockGroupID
GROUP BY StockGroupName,sg.StockGroupID) AS a
JOIN
(SELECT StockGroupName,sgg.StockGroupID,SUM(Quantity) AS total_sale
FROM Warehouse.StockItems AS ws
JOIN Sales.OrderLines AS ol ON ws.StockItemID = ol.StockItemID
JOIN Warehouse.StockItemStockGroups AS sisg ON ws.StockItemID = sisg.StockItemID
JOIN Warehouse.StockGroups AS sgg ON sisg.StockGroupID = sgg.StockGroupID
GROUP BY StockGroupName,sgg.StockGroupID) AS b
ON a.StockGroupID = b.StockGroupID;
| true
|
3287c5605bae2efdc6cefaf5f39b88a209d14eb2
|
SQL
|
ayesh99747/SSWD-Codesprint
|
/codesprint.sql
|
UTF-8
| 6,446
| 3.203125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 10, 2020 at 09:18 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.3.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `codesprint`
--
-- --------------------------------------------------------
--
-- Table structure for table `messages`
--
CREATE TABLE `messages` (
`msgID` int(10) NOT NULL,
`userId` int(4) NOT NULL,
`message` varchar(1000) DEFAULT NULL,
`state` varchar(10) NOT NULL,
`submitTime` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
CREATE TABLE `orders` (
`orderNo` int(4) NOT NULL,
`userId` int(4) NOT NULL,
`orderDateTime` datetime NOT NULL,
`orderTotal` decimal(8,2) DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `tests`
--
CREATE TABLE `tests` (
`testId` int(4) NOT NULL,
`testName` varchar(30) NOT NULL,
`testPicNameSmall` varchar(100) NOT NULL,
`testPicNameLarge` varchar(100) NOT NULL,
`testDescripShort` varchar(1000) DEFAULT NULL,
`testDescripLong` varchar(3000) DEFAULT NULL,
`testPrice` decimal(6,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tests`
--
INSERT INTO `tests` (`testId`, `testName`, `testPicNameSmall`, `testPicNameLarge`, `testDescripShort`, `testDescripLong`, `testPrice`) VALUES
(1, 'Spelling Test', 'spelling.jpg', 'spelling.jpg', 'Do these spelling tests and really improve your spelling. These can also help your reading by listening and reading along.', 'Correct spelling says a lot about a person. And it says a lot about you as a jobseeker as well, especially when you are not spelling correctly.', '250.00'),
(2, 'Antonym Test', 'antonym.jpg', 'antonym.jpg', 'Do these spelling tests and really improve your spelling. These can also help your reading by listening and reading along.', 'Antonym tests are standardized psychometric assessment tests that provide the employing organization with information about a candidate\\\'s knowledge of the English language.', '170.00'),
(3, 'Synoynm Test', 'synonym.jpg', 'synonym.jpg', 'Do these spelling tests and really improve your spelling. These can also help your reading by listening and reading along.', 'Synonym tests are standardized psychometric assessment tests that provide the employing organization with information about a candidate\\\'s knowledge of the English language.', '150.00');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`userId` int(4) NOT NULL,
`userType` varchar(1) NOT NULL,
`userFName` varchar(50) NOT NULL,
`userSName` varchar(50) NOT NULL,
`userAddress` varchar(50) NOT NULL,
`userPostCode` varchar(50) NOT NULL,
`userTelNo` varchar(50) NOT NULL,
`userEmail` varchar(50) NOT NULL,
`userPassword` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`userId`, `userType`, `userFName`, `userSName`, `userAddress`, `userPostCode`, `userTelNo`, `userEmail`, `userPassword`) VALUES
(1, 'C', 'Jessica', 'Bale', 'Colombo, Sri Lanka', '06500', '0112345678', 'jess@gmail.com', 'qwe'),
(2, 'C', 'Jane', 'Doe', 'Colombo, Sri Lanka', '01500', '1234567891', 'jane@gmail.com', 'asd'),
(3, 'C', 'Max', 'Loe', 'Colombo, Sri Lanka', '01400', '1234567891', 'maxie@gmail.com', 'rfv'),
(4, 'C', 'Alex', 'Bass', 'Colombo, Sri Lanka', '01400', '1234567891', 'bass@gmail.com', '9876'),
(5, 'A', 'Anita', 'Basil', 'Colombo, Sri Lanka', '01500', '9876543210', 'anita@gmail.com', 'wer');
-- --------------------------------------------------------
--
-- Table structure for table `wishlist`
--
CREATE TABLE `wishlist` (
`testId` int(4) NOT NULL,
`userId` int(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `wishlist`
--
INSERT INTO `wishlist` (`testId`, `userId`) VALUES
(1, 2),
(2, 2),
(3, 2);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
ADD PRIMARY KEY (`msgID`),
ADD KEY `message_userid_fk` (`userId`);
--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`orderNo`),
ADD KEY `userid_orders_fk` (`userId`);
--
-- Indexes for table `tests`
--
ALTER TABLE `tests`
ADD PRIMARY KEY (`testId`),
ADD UNIQUE KEY `prodname_product_unique` (`testName`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`userId`);
--
-- Indexes for table `wishlist`
--
ALTER TABLE `wishlist`
ADD PRIMARY KEY (`testId`,`userId`),
ADD KEY `wishlist_userid_fk` (`userId`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
MODIFY `msgID` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `orderNo` int(4) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tests`
--
ALTER TABLE `tests`
MODIFY `testId` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `userId` int(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `messages`
--
ALTER TABLE `messages`
ADD CONSTRAINT `message_userid_fk` FOREIGN KEY (`userId`) REFERENCES `users` (`userId`);
--
-- Constraints for table `orders`
--
ALTER TABLE `orders`
ADD CONSTRAINT `userid_orders_fk` FOREIGN KEY (`userId`) REFERENCES `users` (`userId`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `wishlist`
--
ALTER TABLE `wishlist`
ADD CONSTRAINT `wishlist_testid_fk` FOREIGN KEY (`testId`) REFERENCES `tests` (`testId`),
ADD CONSTRAINT `wishlist_userid_fk` FOREIGN KEY (`userId`) REFERENCES `users` (`userId`);
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
|
cea202223925cc8dc475abd0fbe8c3e6c2d5658d
|
SQL
|
sarahneuburger/java_logica
|
/Banco de Dados/aula01_exercicio4.sql
|
UTF-8
| 3,051
| 4.25
| 4
|
[] |
no_license
|
# 1 - Criar uma base de dados
CREATE DATABASE exercicio04;
# 2 - Selecionar a base de dados criada anteriormente
USE exercicio04;
# 3 - Cria uma tabela
CREATE TABLE cursos(
codigo INT PRIMARY KEY AUTO_INCREMENT,
curso VARCHAR(30),
valor DOUBLE,
area VARCHAR(30),
dificuldade INT
);
# 4 - Cadastrar os cursos:
INSERT INTO cursos VALUES
(1, 'PHP', 700, 'Back-End', 3),
(2, 'Oracle', 2500, 'Banco de Dados', 1),
(4, 'Java', 1700, 'Back-End', 3),
(5, 'Spring MVC', 2500, 'Back-End', 2),
(6, 'MySQL', 400, 'Banco de Dados', 1),
(7, 'Excel Básico', 500, 'Utilidades', 1),
(8, 'Excel Avançado', 400, 'Utilidades', 2),
(9, 'Excel Dashboard', 600, 'Utilidades', 2),
(10, 'C#', 1600, 'Back-End', 3),
(11, 'Python', 780, 'Back-End', 3),
(12, 'JavaScript', 500, 'Back-End', 2),
(13, 'NodeJS', 900, 'Back-End', 3);
SELECT * FROM cursos;
# 5 - Exibir o nome dos cursos, valor e o nível de dificuldade. Os níveis de dificuldade deverão ser exibidos em formato de texto, sendo assim 1 significa iniciante, 2 intermediário e 3 avançado
# 6 - Para alterar o número para o texto utilize a função case
SELECT curso, valor, dificuldade,
CASE
WHEN dificuldade = 1 THEN 'Iniciante'
WHEN dificuldade = 2 THEN 'Intermediário'
ELSE 'Avançado'
END AS 'Nível de dificuldade'
FROM cursos;
# 7 - Exibir a quantidade de cursos através da área
SELECT area, COUNT(*) FROM cursos GROUP BY area;
# 8 - Listar nome e valor dos cursos, ordene do maior valor para o menor
SELECT curso, valor FROM cursos ORDER BY valor ASC;
# 9 - Exibir o nome dos cursos de maior valor
SELECT curso FROM cursos ORDER BY curso ASC;
# 10 - Quantidade de cursos cadastrados por dificuldade
SELECT COUNT(*),
CASE
WHEN dificuldade = 1 THEN 'Iniciante'
WHEN dificuldade = 2 THEN 'Intermediário'
ELSE 'Avançado'
END AS 'Nível de dificuldade'
FROM cursos GROUP BY dificuldade;
# 11 - Exibir todos os cursos de nível 2 ou 3 e que sejam da área de back-end e com valor mínimo de R$1.000,00
# não deu certo
SELECT curso FROM cursos WHERE dificuldade
=
(SELECT 2 OR dificuldade = 3 FROM cursos)
AND
(SELECT area = 'Back-End' AND valor >= 1000 FROM cursos);
# 12 - Remover todos os cursos onde a área seja utilidades
DELETE FROM cursos WHERE area = 'Utilidades';
# Habilitar a alteração de dados
SET SQL_SAFE_UPDATES = 0;
# 13 - Exibir os cinco cursos mais baratos
SELECT * FROM cursos WHERE valor ORDER BY valor ASC LIMIT 5;
# 14 - Exibir o nome e o valor de todos os cursos que não sejam da área de back-end
SELECT curso, valor FROM cursos WHERE area <> 'Back-End';
# 15 - Exibir a quantidade de cursos registrados, exiba a data e hora da pesquisa realizada. Para exibir a data e hora utilize a função NOW()
SELECT COUNT(*), NOW() AS 'Data' FROM cursos;
# 16 - Exibir todos os dados do curso, onde o nome dele contenha a letra y
SELECT * FROM cursos WHERE curso LIKE '%y%';
# 17 - Excluir a tabela cursos
DROP TABLE cursos;
# 18 - Excluir a base de dados
DROP DATABASE exercicio04;
| true
|
30ce1ba8bc7c12f634e21dfc4a2896aa4c0645b4
|
SQL
|
prasanth260295/mysql
|
/coresoft-product-database/src/main/resources/oracle/4.3.0-13/Loans_Add_Collections_History_3.sql
|
UTF-8
| 1,511
| 3.28125
| 3
|
[] |
no_license
|
--creating table display all transactions in collection history screen.
CREATE TABLE COLLECTION_MASTER_HISTORY
(
COLLECTION_MASTER_HISTORY_ID NUMBER(15,5) NOT NULL ENABLE,
ACCOUNT_NO VARCHAR2(20),
DATE_POSTED DATE,
TIME_POSTED VARCHAR2(20),
NAME VARCHAR2(20),
HISTORY_TYPE NUMBER(5),
NOTES VARCHAR2(1029),
DATE_NEXT_CONTACT DATE,
MODULE NUMBER(4),
CUSTOMER_NAME VARCHAR2(30),
CONSTRAINT COLLECTION_MASTER_HISTORY_PK PRIMARY KEY (COLLECTION_MASTER_HISTORY_ID));
--sequence for COLLECTION_MASTER_HISTORY
CREATE SEQUENCE COLLECTION_MASTER_HISTORY_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE;
CREATE TABLE HISTORY_TYPE_LOOKUP
(
HISTORY_TYPE_LOOKUP_ID NUMBER(5) NOT NULL ENABLE,
DESCRIPTION VARCHAR2(20),
PRIMARY KEY (HISTORY_TYPE_LOOKUP_ID));
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(1,'Left Message');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(2,'Promise To Pay');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(3,'Repo');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(4,'Foreclosure');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(5,'Comment');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(6,'W/O');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(7,'W/O Payment');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(8,'W/O Comments');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(9,'Bankruptcy Comm');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(10,'W/O Coll Comment');
INSERT INTO HISTORY_TYPE_LOOKUP VALUES(99,'Auto Letter');
| true
|
0580347b0e82858ac2ca245604a2e9ed57ba5167
|
SQL
|
barcern/cfg-sql
|
/project/spare.sql
|
UTF-8
| 1,313
| 3.953125
| 4
|
[] |
no_license
|
# wrong
SELECT
COUNT(g.fk_goal_assist_player1),
COUNT(g.fk_goal_assist_player2),
#(SELECT COUNT(fk_goal_assist_player1) FROM goals GROUP BY fk_goal_assist_player1),
#(SELECT COUNT(g.fk_goal_assist_player2) FROM goals g GROUP BY g.fk_goal_assist_player2),
(SELECT COUNT(g.fk_goal_assist_player1) FROM goals GROUP BY g.fk_goal_assist_player1) +
(SELECT COUNT(g.fk_goal_assist_player2) FROM goals GROUP BY g.fk_goal_assist_player2) total_assists,
((SELECT COUNT(g.fk_goal_assist_player1)) +
(SELECT COUNT(g.fk_goal_assist_player2)))/players.games_played total_assists_per_games,
g.fk_goal_assist_player1,
players.games_played,
players.player_name
FROM goals g
INNER JOIN players ON g.fk_goal_assist_player1 = players.player_id
GROUP BY players.player_id
ORDER BY total_assists_per_games DESC;
SELECT COUNT(fk_goal_assist_player2) FROM goals WHERE fk_goal_assist_player2 = 'p6';
SELECT COUNT(fk_goal_assist_player1) FROM goals WHERE fk_goal_assist_player1 = 'p6';
SELECT COUNT(g.fk_goal_assist_player1), fk_goal_assist_player1 FROM goals g GROUP BY g.fk_goal_assist_player1;
(SELECT COUNT(g.fk_goal_assist_player2), fk_goal_assist_player2 FROM goals g GROUP BY g.fk_goal_assist_player2);
SELECT * FROM goals;
# Query with subquery - worst nationalities per games played
| true
|
3eb692e824ee1a0383c9d22500f6ce0b6b0cd944
|
SQL
|
p-dim-popov/NVNA-Databases
|
/Database-Basics/KR1/1-TABLES-CREATION.sql
|
UTF-8
| 1,515
| 3.75
| 4
|
[] |
no_license
|
-- DROP TABLES IF EXIST --
DROP TABLE ORDER_DETAILS;
DROP TABLE ORDERS;
DROP TABLE CLIENTS;
DROP TABLE PRODUCTS;
DROP TABLE PROD_CATEGORIES;
--------------------------
CREATE TABLE PROD_CATEGORIES
(
CAT_ID NUMBER,
CAT_DESCR VARCHAR2(30) NOT NULL,
CONSTRAINT PK_PRODCAT_CID PRIMARY KEY (CAT_ID)
);
CREATE TABLE PRODUCTS
(
PROD_ID NUMBER,
CAT_ID NUMBER NOT NULL,
PROD_DESCR VARCHAR(30) NOT NULL,
PROD_PRICE NUMBER(8,2) NOT NULL,
CONSTRAINT PK_PRODS_PID
PRIMARY KEY (PROD_ID),
CONSTRAINT FK_PRODS_CID_PRODCAT_CID
FOREIGN KEY (CAT_ID)
REFERENCES PROD_CATEGORIES(CAT_ID)
);
CREATE TABLE CLIENTS
(
CLIENT_ID NUMBER,
CLIENT_FIRST_NAME VARCHAR2(20) NOT NULL,
CLIENT_LAST_NAME VARCHAR2(20) NOT NULL,
CLIENT_UCN CHAR(10),
CONSTRAINT PK_CLNTS_CLID
PRIMARY KEY (CLIENT_ID)
);
CREATE TABLE ORDERS
(
ORDER_ID NUMBER,
CLIENT_ID NUMBER NOT NULL,
ORDER_DATE DATE NOT NULL,
CONSTRAINT PK_ORDRS_OID
PRIMARY KEY (ORDER_ID),
CONSTRAINT FK_ORDRS_OID_CLNTS_CLID
FOREIGN KEY (CLIENT_ID)
REFERENCES CLIENTS(CLIENT_ID)
);
CREATE TABLE ORDER_DETAILS
(
ORDER_ID NUMBER NOT NULL,
PROD_ID NUMBER NOT NULL,
PROD_COUNT NUMBER NOT NULL,
CONSTRAINT FK_ORDRDET_OID_ORDRS_OID
FOREIGN KEY (ORDER_ID)
REFERENCES ORDERS(ORDER_ID),
CONSTRAINT FK_ORDRDET_PID_PRODS_PID
FOREIGN KEY (PROD_ID)
REFERENCES PRODUCTS(PROD_ID)
);
| true
|
ba1758d92d3cfe4196c599d30e31635f33d04661
|
SQL
|
Olave/bigdata
|
/hive/dw/dwd_log.sql
|
UTF-8
| 6,043
| 3.265625
| 3
|
[] |
no_license
|
drop table if exists dwd_start_log;
create external table dwd_start_log
(
`area_code` string comment '地区编码',
`brand` string comment '手机品牌',
`channel` string comment '渠道',
`model` string comment '手机型号',
`mid_id` string comment '设备id',
`os` string comment '操作系统',
`user_id` string comment '会员id',
`version_code` string comment 'app版本号',
`entry` string comment ' icon手机图标 notice 通知 install 安装后启动',
`loading_time` bigint comment '启动加载时间',
`open_ad_id` string comment '广告页id ',
`open_ad_ms` bigint comment '广告总共播放时间',
`open_ad_skip_ms` bigint comment '用户跳过广告时点',
`ts` bigint comment '时间'
) comment '启动日志表'
partitioned by (dt string) -- 按照时间创建分区
stored as parquet -- 采用parquet列式存储
location '/warehouse/gmall/dwd/dwd_start_log' -- 指定在hdfs上存储位置
tblproperties ('parquet.compression' = 'lzo');
drop table if exists dwd_page_log;
create external table dwd_page_log
(
`area_code` string comment '地区编码',
`brand` string comment '手机品牌',
`channel` string comment '渠道',
`model` string comment '手机型号',
`mid_id` string comment '设备id',
`os` string comment '操作系统',
`user_id` string comment '会员id',
`version_code` string comment 'app版本号',
`during_time` bigint comment '持续时间毫秒',
`page_item` string comment '目标id ',
`page_item_type` string comment '目标类型',
`last_page_id` string comment '上页类型',
`page_id` string comment '页面id ',
`source_type` string comment '来源类型',
`ts` bigint
) comment '页面日志表'
partitioned by (dt string)
stored as parquet
location '/warehouse/gmall/dwd/dwd_page_log'
tblproperties ('parquet.compression' = 'lzo');
drop table if exists dwd_action_log;
create external table dwd_action_log
(
`area_code` string comment '地区编码',
`brand` string comment '手机品牌',
`channel` string comment '渠道',
`model` string comment '手机型号',
`mid_id` string comment '设备id',
`os` string comment '操作系统',
`user_id` string comment '会员id',
`version_code` string comment 'app版本号',
`during_time` bigint comment '持续时间毫秒',
`page_item` string comment '目标id ',
`page_item_type` string comment '目标类型',
`last_page_id` string comment '上页类型',
`page_id` string comment '页面id ',
`source_type` string comment '来源类型',
`action_id` string comment '动作id',
`item` string comment '目标id ',
`item_type` string comment '目标类型',
`ts` bigint comment '时间'
) comment '动作日志表'
partitioned by (dt string)
stored as parquet
location '/warehouse/gmall/dwd/dwd_action_log'
tblproperties ('parquet.compression' = 'lzo');
drop table if exists dwd_display_log;
create external table dwd_display_log
(
`area_code` string comment '地区编码',
`brand` string comment '手机品牌',
`channel` string comment '渠道',
`model` string comment '手机型号',
`mid_id` string comment '设备id',
`os` string comment '操作系统',
`user_id` string comment '会员id',
`version_code` string comment 'app版本号',
`during_time` bigint comment 'app版本号',
`page_item` string comment '目标id ',
`page_item_type` string comment '目标类型',
`last_page_id` string comment '上页类型',
`page_id` string comment '页面id ',
`source_type` string comment '来源类型',
`display_type` string comment '曝光类型',
`item` string comment '曝光对象id ',
`item_type` string comment 'app版本号',
`order` bigint comment '出现顺序',
`ts` bigint comment 'app版本号'
) comment '曝光日志表'
partitioned by (dt string)
stored as parquet
location '/warehouse/gmall/dwd/dwd_display_log'
tblproperties ('parquet.compression' = 'lzo');
drop table if exists dwd_error_log;
create external table dwd_error_log
(
`area_code` string comment '地区编码',
`brand` string comment '手机品牌',
`channel` string comment '渠道',
`model` string comment '手机型号',
`mid_id` string comment '设备id',
`os` string comment '操作系统',
`user_id` string comment '会员id',
`version_code` string comment 'app版本号',
`page_item` string comment '目标id ',
`page_item_type` string comment '目标类型',
`last_page_id` string comment '上页类型',
`page_id` string comment '页面id ',
`source_type` string comment '来源类型',
`entry` string comment ' icon手机图标 notice 通知 install 安装后启动',
`loading_time` string comment '启动加载时间',
`open_ad_id` string comment '广告页id ',
`open_ad_ms` string comment '广告总共播放时间',
`open_ad_skip_ms` string comment '用户跳过广告时点',
`actions` string comment '动作',
`displays` string comment '曝光',
`error_code` string comment '错误码',
`msg` string comment '错误信息',
`ts` string comment '时间'
) comment '错误日志表'
partitioned by (dt string)
stored as parquet
location '/warehouse/gmall/dwd/dwd_error_log'
tblproperties ('parquet.compression' = 'lzo');
| true
|
2e9f4ec073f6b699869f7c7be7b38ca4992e2529
|
SQL
|
200921-USF-ROCP1/Swovick_code
|
/SQLscripts/HackerRankProblems.sql
|
UTF-8
| 1,260
| 4.21875
| 4
|
[] |
no_license
|
create table students (
id serial primary key,
name varchar(20)
);
create table friends(
id serial primary key,
friend_id integer
);
create table packages(
id serial primary key,
salary numeric (7, 2)
);
insert into students (name) values
('Ashley'),
('Samantha'),
('Julia'),
('Scarlet');
insert into friends (friend_id) values
(2),
(3),
(4),
(1);
insert into packages (salary) values
(15.20),
(10.06),
(11.55),
(12.12);
--This does not quite work
select s1.name from students AS s1
join packages as p1 on s1.id=p1.id
where exists
(select * from packages as p2, friends
--join friends on friends.friend_id = p2.id
where p2.id = friends.friend_id and p2.salary>p1.salary)
order by p2.salary;
--This works
select s1.name from students AS s1
join packages as p1 on s1.id=p1.id
join friends as f1 on s1.id = f1.id
join packages as p2 on p2.id = f1.friend_id
where p2.salary>p1.salary;
select * from students AS s1
join packages as p1 on s1.id=p1.id
join friends as f1 on s1.id = f1.id
join packages as p2 on p2.id = f1.friend_id
select * from packages as p2
join friends on friends.friend_id = p2.id;
select * from packages as p2, friends
where friends.friend_id = p2.id;
select * from students AS s1
join packages as p1 on s1.id=p1.id;
| true
|
6b2ea0ba2cd5c2d57c59d2f826670510a242c437
|
SQL
|
Jasonc8901/Earnings-Bot
|
/flaskr/schema.sql
|
UTF-8
| 556
| 3.421875
| 3
|
[] |
no_license
|
DROP TABLE IF EXISTS Company;
DROP TABLE IF EXISTS EarningsDate;
CREATE TABLE Company (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
name TEXT NOT NULL,
body TEXT NOT NULL,
FOREIGN KEY (author_id) REFERENCES user (id)
);
CREATE TABLE EarningsDate (
id INTEGER PRIMARY KEY AUTOINCREMENT,
company_id INTEGER PRIMARY KEY AUTOINCREMENT,
quarter INTEGER PRIMARY KEY AUTOINCREMENT,
earnings_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (company_id) REFERENCES Company (id)
);
| true
|
02958a5007406a1a702d6ebae7c07d4e8e4c02a7
|
SQL
|
kjhoon1994/kjh
|
/03.JDBC/20190408_jdbc/src/jdbc003/rlawogns.sql
|
UTF-8
| 530
| 2.96875
| 3
|
[] |
no_license
|
-- id_, age, first_, last_
CREATE TABLE employees(
id_ NUMBER
,age NUMBER
,first_ VARCHAR(20)
,last_ VARCHAR(20)
);
INSERT INTO Employees(id_, age, first_, last_) VALUES (100, 18, 'Zara', 'Ali');
INSERT INTO Employees(id_, age, first_, last_) VALUES (101, 25, 'Mahnaz', 'Fatma');
INSERT INTO Employees(id_, age, first_, last_) VALUES (102, 30, 'Zaid', 'Khan');
INSERT INTO Employees(id_, age, first_, last_) VALUES (103, 28, 'Sumit', 'Mittal');
COMMIT;
SELECT id_, age, first_, last_
FROM employees;
| true
|
997876d34571478ec0e6d7e4211a9b13f93a9ef2
|
SQL
|
shalimski/ClickHouseTools
|
/CH-Databases-Info/Секции таблиц.sql
|
UTF-8
| 988
| 2.625
| 3
|
[
"MIT"
] |
permissive
|
-- https://clickhouse.tech/docs/en/operations/system-tables/parts/
select
partition,
name,
part_type,
active,
marks,
rows,
bytes_on_disk,
data_compressed_bytes,
data_uncompressed_bytes,
marks_bytes,
modification_time,
remove_time,
refcount,
min_date,
max_date,
min_time,
max_time,
partition_id,
min_block_number,
max_block_number,
level,
data_version,
primary_key_bytes_in_memory,
primary_key_bytes_in_memory_allocated,
is_frozen,
database,
table,
engine,
disk_name,
path,
hash_of_all_files,
hash_of_uncompressed_files,
uncompressed_hash_of_compressed_files,
delete_ttl_info_min,
delete_ttl_info_max,
`move_ttl_info.expression`,
`move_ttl_info.min`,
`move_ttl_info.max`,
default_compression_codec
from system.parts
| true
|
be0bf6b99b8ff29939925e3d2151db7c4d6cd44c
|
SQL
|
fabiomigliorini/MGdb
|
/SQLs/Estoque - Transferencia Circular.sql
|
UTF-8
| 1,539
| 3.671875
| 4
|
[] |
no_license
|
select --distinct
orig.codestoquemes
, dest.codestoquemes
, orig.saidaquantidade
, dest.entradaquantidade
, dest.codestoquemovimento
, orig.codestoquemovimento
, torig.sigla
, tdest.sigla
--'wget http://localhost/MGLara/estoque/calcula-custo-medio/' || cast(dest.codestoquemes as varchar) as comando
--, orig.saidavalor
--, dest.entradavalor
from tblestoquemovimento dest
inner join tblestoquemovimento orig on (orig.codestoquemovimento = dest.codestoquemovimentoorigem)
inner join tblestoquemovimentotipo torig on (torig.codestoquemovimentotipo = orig.codestoquemovimentotipo)
inner join tblestoquemovimentotipo tdest on (tdest.codestoquemovimentotipo = dest.codestoquemovimentotipo)
inner join tblestoquemes mes on (mes.codestoquemes = orig.codestoquemes)
inner join tblestoquesaldo sld on (sld.codestoquesaldo = mes.codestoquesaldo)
where orig.codestoquemes = dest.codestoquemes
and dest.manual = false
and dest.codestoquemovimentotipo not in (3002, 2002) -- Devolucao de venda, Devolucao de compra
and sld.fiscal = false
--and dest.codestoquemes = 864560
--and abs(coalesce(orig.saidavalor, 0) - coalesce(dest.entradavalor, 0)) > 0.01
order by 1 desc
--limit 500
--select codestoquemovimentotipo from tblestoquemovimento t where codestoquemovimento in (17826112, 17762715)
--select * from tblestoquemovimentotipo t2 where codestoquemovimentotipo in (3001, 3002)
select * from tblestoquemovimentotipo t order by sigla
select * from tblmovimentotitulo t where codtitulo = :codtitulo order by codmovimentotitulo
| true
|
40579989ceb60e35a61a99234dfb0b6416a33bb0
|
SQL
|
LakeLove/catch-em-all-sql-edition-LakeLove
|
/answers/part3question4.sql
|
UTF-8
| 167
| 3.609375
| 4
|
[] |
no_license
|
# How many pokemon have a secondary type `Poison`
SELECT COUNT(pokemons.id) FROM pokemons JOIN types ON pokemons.secondary_type = types.id WHERE types.name = "Poison";
| true
|
3f63e2acc34c51862653e729500c625be2d068b1
|
SQL
|
WilliamRolim/SQL
|
/Banco de Dados Cruzeiro/11ExibindoDados_JOINS_EXERCICIOS.sql
|
UTF-8
| 10,861
| 4.03125
| 4
|
[] |
no_license
|
CREATE DATABASE banco;
USE banco;
CREATE TABLE agencia (/*Terceira tabela a ser criada por ter FK porém a tabela estado já foi criada*/
id_banco INT,
id_agencia INT,
nm_agencia VARCHAR(10) NOT NULL,
nr_digito_agencia INT NOT NULL,
nr_endereco VARCHAR (15) NOT NULL,
id_cep CHAR(8) NOT NULL,
CONSTRAINT Agencia_idbanco_idagencia_PK PRIMARY KEY (id_banco,id_agencia),
CONSTRAINT Agencia_Logradouro_idcep_FK FOREIGN KEY (id_cep)
REFERENCES logradouro (id_cep),
CONSTRAINT Agencia_Banco_id_banco_FK FOREIGN KEY (id_banco)
REFERENCES banco(id_banco)
);
CREATE TABLE banco (/*primeira tabela a ser criada por não ter FK*/
id_banco INT,
nm_banco VARCHAR(20) NOT NULL,
CONSTRAINT Banco_idbanco_PK PRIMARY KEY (id_banco)
);
CREATE TABLE logradouro(/*QUarta tabela a ser criada por ter FK porém a tabela Municipio já foi criada*/
id_cep CHAR(8),
id_municipio INT ,
ds_tipo VARCHAR(10),
ds_titulo VARCHAR(14),
nm_nome VARCHAR(20) NOT NULL,
CONSTRAINT Logradouro_idcep_PK PRIMARY KEY (id_cep),
CONSTRAINT Lougradouro_Municipio_idmunicipio_FK FOREIGN KEY (id_municipio)
REFERENCES municipio(id_municipio)
);
CREATE TABLE municipio(/*Terceira tabela a ser criada por ter FK porém a tabela estado já foi criada*/
id_municipio INT,
id_uf CHAR(2) NOT NULL,
nm_municipio VARCHAR(15)NOT NULL,
CONSTRAINT Municipio_idmunicipio_PK PRIMARY KEY (id_municipio),
CONSTRAINT Municipio_Estado_iduf_FK FOREIGN KEY (id_uf)
REFERENCES estado (id_uf)
);
CREATE TABLE estado(/*segunda tabela a ser criada por não ter FK*/
id_uf CHAR(2),
nm_uf VARCHAR(10)NOT NULL,
CONSTRAINT Estado_iduf_PK PRIMARY KEY (id_uf)
);
CREATE TABLE correntista(/*Quinta tabela a ser criada por ter FK porém a tabela MUNICIPIO E LOGRADOURO já foi criada*/
id_correntista INT,
nm_nome VARCHAR(14),
dt_nascimento DATE,
ds_sexo CHAR(1),
nr_numero VARCHAR(14),
id_municipio INT,
id_cep CHAR(8),
CONSTRAINT Correntista_idcorrentista_PK PRIMARY KEY (id_correntista),
CONSTRAINT Correntista_Municipio_id_municipio_FK FOREIGN KEY (id_municipio)
REFERENCES municipio(id_municipio),
CONSTRAINT Correntista_Logradouro_id_cep_FK FOREIGN KEY (id_cep)
REFERENCES logradouro(id_cep)
);
CREATE TABLE conta (
id_correntista INT,
id_banco INT,
id_conta VARCHAR(5),
id_agencia INT,
nr_digito_conta CHAR(1) NOT NULL,
id_tipo_conta INT ,
cd_tipo_correntista CHAR(1) NOT NULL,
vl_saldo FLOAT NOT NULL,
CONSTRAINT Conta_idconta_PK PRIMARY KEY (id_conta),
CONSTRAINT Conta_Agencia_idagencia_idbanco_FK FOREIGN KEY (id_agencia,id_banco)
REFERENCES agencia (id_agencia,id_banco),
CONSTRAINT Conta_Correntista_id_correntista_FK FOREIGN KEY(id_correntista)
REFERENCES correntista (id_correntista),
CONSTRAINT Conta_Banco_idbanco_FK FOREIGN KEY (id_banco)
REFERENCES banco(id_banco),
CONSTRAINT Conta_Tipoconta_idtipoconta_FK FOREIGN KEY (id_tipo_conta)
REFERENCES tipoconta(id_tipo_conta)
);
SHOW TABLES;
CREATE TABLE tipoconta(/*Sexta tabela a ser criada por não ter nenhuma FK*/
id_tipo_conta INT,
nm_tipo_conta VARCHAR(10),
CONSTRAINT Tipoconta_idtipoconta_PK PRIMARY KEY (id_tipo_conta)
);
DROP TABLE tipoconta;
SHOW TABLES;
/*VERSION 2 Refazendo exercicios*/
/*1) Selecionar o número da conta, dígito da conta,
saldo, nome do banco, nome da agencia, e o tipo da conta
do correntista "ADALTON ISIDORO". (1,0)*/
SELECT c.ID_TIPO_CONTA, c.NR_DIGITO_CONTA, c.vl_saldo,b.NM_BANCO,ba.NM_AGENCIA,c.ID_TIPO_CONTA, co.NM_NOME
FROM tab_correntista co
INNER JOIN tab_conta c
ON co.ID_CORRENTISTA = c.ID_CORRENTISTA
INNER JOIN TAB_BANCO_AGENCIA ba
ON c.ID_BANCO = ba.ID_BANCO AND
c.ID_AGENCIA = ba.ID_AGENCIA
INNER JOIN TAB_BANCO b
ON ba.ID_BANCO = b.ID_BANCO
WHERE co.NM_NOME = 'ADALTON ISIDORO';
/*2)Exibir a quantidade de municipios por unidade federativa,
mostrando o nome da unidade e a quantidade de municipios,
ordenado pelo nome da unidade federativa*/
SELECT COUNT(m.ID_UF) as "Contagem De Estados por UF",e.NM_UF as "nome da UF"
FROM TAB_MUNICIPIO m
INNER JOIN TAB_ESTADO e
ON m.ID_UF = e.ID_UF
GROUP BY e.nm_uF
ORDER BY e.NM_UF;
/*3) Exibir o nome do correntista, o município de nascimento,
a descrição da UF de nascimento, a data de nascimento, endereço
(tipo, e nome) e o número do endereço dos correntistas que nasceram
no ano de 1971. (1,0)*/
SELECT co.NM_NOME, m.ID_MUNICIPIO, m.NM_MUNICIPIO,co.DT_NASCIMENTO,l.DS_TITULO ,l.NM_NOME,co.NR_NUMERO
FROM TAB_CORRENTISTA co
INNER JOIN TAB_CONTA c
on co.ID_CORRENTISTA = c.ID_CORRENTISTA
INNER JOIN TAB_MUNICIPIO m
ON co.ID_MUNICIPIO = m.ID_MUNICIPIO
INNER JOIN TAB_ESTADO e
on m.ID_UF = e.ID_UF
INNER JOIN TAB_LOGRADOURO l
on co.ID_CEP = l.ID_CEP
WHERE co.DT_NASCIMENTO LIKE '%/71';
/*4)Exibir a quantidade de contas por tipo de conta, exibindo o tipo e a quantidade,
somente dos tipos que tiverem mais de 100 contas por tipo de conta */
SELECT COUNT(c.ID_TIPO_CONTA) as "Contagem tipo conta", tc.NM_TIPO_CONTA
from TAB_CONTA c
INNER JOIN TAB_CORRENTISTA co
on co.id_correntista = c.id_correntista
INNER JOIN TAB_TIPO_CONTA tc
ON c.ID_TIPO_CONTA = tc.ID_TIPO_CONTA
GROUP BY tc.NM_TIPO_CONTA
HAVING COUNT(c.ID_TIPO_CONTA) > 100;
/*5)Exibir os correntistas (Número da conta, nome do correntista, nome do banco, data de nascimento, saldo,
endereço da agencia e número do endereço da agencia) das agências com nome "MONTE MOR". */
SELECT TTC.NM_TIPO_CONTA,COUNT(TC.ID_TIPO_CONTA) FROM TAB_CONTA TC LEFT JOIN TAB_TIPO_CONTA TTC ON TTC.ID_TIPO_CONTA = TC.ID_TIPO_CONTA
GROUP BY TTC.NM_TIPO_CONTA
HAVING COUNT(TC.ID_TIPO_CONTA) >100;
/*6) Exibir os correntistas que morem no município de "SAO PAULO"
e que nasceram no município de “CARAGUATATUBA”,
mostrando o nome do mesmo, data de nascimento,
endereço, número do endereço, número da conta, saldo e tipo de conta. (1,0)*/
select * from TAB_CORRENTISTA;select * from TAB_LOGRADOURO;select * from TAB_CONTA;select * from TAB_TIPO_CONTA, m.nm_municipio;
SELECT co.NM_NOME, co.DT_NASCIMENTO, co.DT_NASCIMENTO, l.NM_NOME, co.NR_NUMERO ,c.ID_CONTA,c.VL_SALDO, tp.NM_TIPO_CONTA,m.NM_MUNICIPIO,m.ID_UF
FROM TAB_CONTA c
INNER JOIN TAB_CORRENTISTA co
ON c.ID_CORRENTISTA = co.ID_CORRENTISTA
INNER JOIN TAB_LOGRADOURO l
ON co.ID_CEP= l.ID_CEP
INNER JOIN TAB_TIPO_CONTA tp
ON c.ID_TIPO_CONTA = tp.ID_TIPO_CONTA
INNER JOIN TAB_MUNICIPIO m
ON co.ID_MUNICIPIO = m.ID_MUNICIPIO
where m.nm_municipio ='CARAGUATATUBA' and m.ID_UF = 'SP';
/*7)Exibir a quantidade de clientes Júridicos e Físicos. (Em um único select )
CD_TIPO_CORRENTISTA = F -> Físico
CD_TIPO_CORRENTISTA = J -> Jurídico. (1,0)
*/
SELECT CD_TIPO_CORRENTISTA, COUNT(CD_TIPO_CORRENTISTA) AS "Tipos de Correntistas "
FROM TAB_CONTA
GROUP BY CD_TIPO_CORRENTISTA
HAVING (CD_TIPO_CORRENTISTA) = 'F' OR (CD_TIPO_CORRENTISTA) = 'J';
/*8)Exibir a quantidade de contas, a média, o maior, o menor e a somatória
do saldo por agência, mostrando o nome da agência e os totais acima. (1,0)*/
SELECT COUNT(c.id_conta),AVG(c.VL_SALDO),MAX(c.vl_saldo),MIN(c.vl_saldo), SUM(c.vl_saldo),ba.NM_AGENCIA
FROM TAB_CONTA c
LEFT JOIN TAB_BANCO_AGENCIA ba
ON c.ID_AGENCIA = ba.ID_AGENCIA
and c.ID_BANCO = ba.ID_BANCO
GROUP BY ba.NM_AGENCIA;
/*13) Exibir a quantidade de correntistas existentes por mês de aniversário,
mostrando o mês e a quantidade de correntistas. (1,0)*/
/*14) Exibir as agências do "BANCO DO BRASIL S/A", mostrando o nome da agência,
o endereço, número do endereço, município e nome da UF. (1,0)*/
SELECT ba.NM_AGENCIA, l.NM_NOME,ba.NR_ENDERECO, m.ID_UF, e.NM_UF
FROM TAB_BANCO_AGENCIA ba
INNER JOIN TAB_LOGRADOURO l
ON ba.ID_CEP = l.ID_CEP
INNER JOIN TAB_MUNICIPIO m
ON l.ID_MUNICIPIO = m.ID_MUNICIPIO
INNER JOIN TAB_ESTADO e
ON m.ID_UF = e.ID_UF
INNER JOIN TAB_BANCO b
ON ba.ID_AGENCIA = b.ID_BANCO
WHERE b.NM_BANCO = 'BANCO DO BRASIL S/A';
/*15) Exibir os correntistas (Número da conta, nome do correntista,
nome do banco, data de nascimento, saldo, endereço da agencia e número
do endereço da agencia) das agências do município de "SAO PAULO" e que
tenham saldo maior que R$ 2400,00 (1,0)*/
SELECT c.ID_CONTA, co.NM_NOME, b.NM_BANCO, co.DT_NASCIMENTO, c.VL_SALDO,l.NM_NOME, BA.NR_ENDERECO, co.NR_NUMERO, e.NM_UF
FROM TAB_BANCO_AGENCIA BA
INNER JOIN TAB_CONTA c
ON BA.ID_AGENCIA = c.ID_AGENCIA
AND BA.ID_BANCO = c.ID_BANCO
INNER JOIN TAB_CORRENTISTA co
ON c.ID_CORRENTISTA = co.ID_CORRENTISTA
INNER JOIN TAB_BANCO b
ON c.ID_AGENCIA = b.ID_BANCO
INNER JOIN TAB_MUNICIPIO m
ON co.ID_MUNICIPIO = m.ID_MUNICIPIO
INNER JOIN TAB_ESTADO e
ON e.ID_UF = m.ID_UF
INNER JOIN TAB_LOGRADOURO l
ON co.ID_CEP = l.ID_CEP
AND co.ID_MUNICIPIO = l.ID_MUNICIPIO
WHERE e.NM_UF = 'SAO PAULO' AND c.VL_SALDO > 2400;
/*16Exibir os correntistas que nasceram no município de "SAO JOSE DO RIO PRETO",
mostrando o nome do mesmo, data de nascimento, endereço, número do endereço,
município do endereço, número da conta, saldo e tipo de conta. (1,0)*/
SELECT co.NM_NOME, co.DT_NASCIMENTO, l.NM_NOME, co.NR_NUMERO, m.ID_UF, c.ID_CONTA, c.VL_SALDO, tc.NM_TIPO_CONTA, m.NM_MUNICIPIO
FROM TAB_CONTA c
INNER JOIN TAB_CORRENTISTA co
ON c.ID_CORRENTISTA = co.ID_CORRENTISTA
INNER JOIN TAB_LOGRADOURO l
ON co.ID_CEP = l.ID_CEP
inner join TAB_MUNICIPIO m
ON co.ID_MUNICIPIO = m.ID_MUNICIPIO
INNER JOIN TAB_TIPO_CONTA tc
ON c.ID_TIPO_CONTA = tc.ID_TIPO_CONTA
WHERE m.NM_MUNICIPIO = 'SAO JOSE DO RIO PRETO';
/*17) Exibir a quantidade de clientes por banco, mostrando o nome
do banco e a quantidade de clientes, ordenado pelo nome do banco (1,0)*/
SELECT COUNT(b.ID_BANCO) as "Quantidade de Clientes", b.NM_BANCO as "Nome do Banco"
FROM TAB_BANCO b
INNER JOIN TAB_CONTA c
ON b.ID_BANCO = c.ID_CONTA
GROUP BY b.NM_BANCO
ORDER BY b.NM_BANCO;
/*18) Exibir os correntistas que nasceram em ano bissexto,
mostrando o nome do mesmo, e data de nascimento. (1,0)*/
/*19)Exibir os correntistas que tem saldo superior
a R$ 2.450,00 mostrando o nome do mesmo,data de nascimento,
endereço, número do endereço,número da conta, saldo e tipo de conta. */
SELECT co.NM_NOME, co.DT_NASCIMENTO, l.NM_NOME, co.NR_NUMERO, c.ID_CONTA, c.VL_SALDO, tc.NM_TIPO_CONTA
FROM TAB_CONTA c
INNER JOIN TAB_CORRENTISTA co
ON c.ID_CORRENTISTA = co.ID_CORRENTISTA
INNER JOIN TAB_LOGRADOURO l
ON co.ID_CEP = l.ID_CEP
INNER JOIN TAB_TIPO_CONTA tc
ON c.ID_TIPO_CONTA = tc.ID_TIPO_CONTA
WHERE c.VL_SALDO > 2450;
select * from tab_banco;/*ID_BANCO NM_BANCO*/
select * from TAB_BANCO_AGENCIA;/* Id_Banco Id_Agencia (c Nm_Agencia Nr_Dig_Agencia Id_Cep Nr_Endereco */
select * from TAB_CONTA;/*Id_Correntista Id_Banco Id_Conta Id_Agencia Nr_Digito_Conta Cd_Tipo_CorrentistaId_Tipo_Conta Vl_Saldo*/
select * from TAB_CORRENTISTA;/*Id_Correntista Nm_Nome Dt_Nascimento Id_Municipio Ds_Sexo Id_Cep Nr_Numero*/
select * from TAB_ESTADO; /*Id_UF Campo Chave Nm_UF*/
select * from TAB_LOGRADOURO;/*Id_Cep Id_Municipio Ds_Tipo Ds_Titulo Nm_Nome */
select * from TAB_MUNICIPIO;/*Id_Municipio Id_UF Nm_Municipio*/
select * from TAB_TIPO_CONTA;/*Id_Tipo_Conta Nm_Tipo_Conta */
| true
|
03e386ca5395b70dccce52f6c4315e9e47862fa3
|
SQL
|
lilith-schwarz/php11MP1
|
/sql/produkte.sql
|
UTF-8
| 7,045
| 3.171875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.5.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Erstellungszeit: 05. Mrz 2017 um 16:38
-- Server-Version: 10.1.19-MariaDB
-- PHP-Version: 7.0.13
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 */;
--
-- Datenbank: `locamole`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `produkte`
--
CREATE TABLE `produkte` (
`id` int(3) NOT NULL,
`name` varchar(100) COLLATE utf8_german2_ci NOT NULL,
`menge` varchar(10) COLLATE utf8_german2_ci NOT NULL,
`preis` float NOT NULL,
`bild` varchar(100) COLLATE utf8_german2_ci NOT NULL,
`beschreibung` varchar(300) COLLATE utf8_german2_ci NOT NULL,
`zutaten` varchar(200) COLLATE utf8_german2_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci;
--
-- Daten für Tabelle `produkte`
--
INSERT INTO `produkte` (`id`, `name`, `menge`, `preis`, `bild`, `beschreibung`, `zutaten`) VALUES
(2, 'Gaucamole', '250g', 4.99, 'images/guacamole.jpg', 'Der Klassiker unter den Molen und das nicht ohne Grund, denn sie ist ebenso lecker wie simpel. Aus frischen Avocados hergestellt und mit Liebe abgeschmeckt, ein Genuss nicht nur als Beilage.', 'Avocados, Tomaten, Zitronensaft, Knoblauch, Salz und Pfeffer'),
(23, 'Mojo Rojo', '200g', 2.99, 'images/mojorojo.jpg', 'Feurig rot erinnert es an sein Herkunftsland. Aber auch der Geschmack kann sich sehen lassen, verleiht es doch den gewissen Kick zu jedem Gericht.', 'Knoblauch, Salz, Kümmel, Paprikapulver, Olivenöl, Essig'),
(24, 'Mojo Verde', '200g', 2.99, 'images/mojoverde.jpg', 'Grün wird nicht ohne Grund mit gesund assoziiert – Mojo Verde hält was die Farbe verspricht. Eine Kräuter Geschmacksexplosion.', 'Knoblauch, Koriander, Olivenöl, Petersilie, Pfeffer, Salz, Zitronensaft'),
(25, 'Hummus', '300g', 3.99, 'images/hummus.jpg', 'Voller und aromatischer Geschmack, der durch die verarbeiteten Kichererbsen eine angenehme Textur auf der Zunge bietet.', 'Kichererbsen, Knoblauch, Olivenöl, Tahin, Kümmel, Salz, Paprikapulver'),
(26, 'Mole Poblano', '200g', 2.99, 'images/molepoblano.jpg', 'Wer Heißhunger auf etwas un- aber außergewöhnliches hat, der ist mit unserer Mole Poblano wohl bestens bedient. Mit der besonderen Mischung aus Schokolade und Chili weiß sie zu überzeugen.', 'Chilischoten, Zwiebeln, Knoblauch, Mandeln, Erdnüsse, Nelken, Pfeffer, Zimt, Anis, Rosinen, Zartbitterschokolade, Öl, Sesam, Tomaten'),
(27, 'Mole Amarillo', '200g', 3.99, 'images/moleamarillo.jpg', 'Auch Gelbe Mole genannt, bietet die Mole Amarillo eine neue farbliche und geschmackliche Nuance. Besonders wird sie durch ihre nussige aber auch orientalische Note.', 'Chilischoten, Nelken, Kümmel, Oregano, Safran, Knoblauch, Zwiebel, Tomatillos, Masa Harina'),
(28, 'Pipian Verde', '200g', 2.99, 'images/pipianverde.jpg', 'Leicht und dennoch mit vollen Geschmack, der durch die Kürbiskerne hervorgerufen wird, kann man die Pipian Verde nicht nur pur genießen, sie schmeckt auch besonders gut zu Reisgerichten.', 'Kürbiskerne, Butter, Zucker, Koriander, Chilischoten, Knoblauch, Zwiebeln, Tomatillos'),
(29, 'Mole Verde', '200g', 1.99, 'images/moleverde.jpg', 'Wer es weniger scharf mag und den runden und herben Geschmack von Spinat liebt, der sollte bei der Mole Verde zugreifen.', 'Tomatillos, Chilischoten, Zwiebel, Blattspinat, Knoblauch'),
(30, 'Mole Adobo', '200g', 2.99, 'images/moleadobo.jpg', 'Nach traditionellem, mexikanischen Rezept hergestellt. Mole Adobo ist besonders geeignet für diejenigen, die einen etwas herzhafteren Geschmack bevorzugen.', 'Tomatenpaste, Guajillo Chili, Zwiebel, Fett, Salz, Essig'),
(31, 'Avocado Mango Salsa', '200g', 4.99, 'images/avocadomangosalsa.jpg', 'Für die, die etwas frisches bevorzugen, kann auch mal eine leckere Salsa auf dem Teller landen.', 'Avocado, Mango, Zwiebel, Tomaten, Chilischoten, Knoblauch, Öl, Zitronensaft'),
(32, 'Mole Negro', '200g', 3.99, 'images/molenegro.jpg', 'Mag man es etwas herber, so kann man sich auch mal an der Mole Negro probieren. Sie ist ebenfalls herzhaft und für manchen vielleicht ein bisschen ungewohnt, aber nicht weniger lecker.', 'Chilischoten, Sesam, Zwiebel, Kidneybohnen, Knoblauch, Erdnüsse, Sultaninen, Schokolade, Zimt'),
(33, 'Salsa classic', '200g', 1.99, 'images/salsaclassic.jpg', 'Der Klassiker, wie man ihn gerne zu Tortillas genießt. Bei diesem Dip kann man eigentlich nichts falsch machen und sollte zugreifen.', 'Tomaten, Schalotten, Limetten, Chilischote, Koriander, Salz'),
(34, 'Salsa Caliente', '200g', 2.99, 'images/salsacaliente.jpg', 'Ähnlich lecker wie die klassische Salsa, aber durch die Créme Fraîche bekommt es den gewissen Touch und sollte definitiv probiert werden.', 'Tomaten, Zwiebeln, Chilischoten, Créme Fraîche, Öl, Limettensaft, Salz'),
(35, 'Mole Coloradito', '200g', 2.99, 'images/molecoloradito.jpg', 'Eine Mischung aus Mole Rojo und Negro ist die Mole Coloradito. Die unterschiedlichen Zutaten ergänzen sich in dieser Mole ideal.', 'Zwiebeln, Knoblauch, Schokolade, Tomaten, Chilischoten, Öl'),
(36, 'Mole Chichilo', '200g', 2.99, 'images/molechichilo.jpg', 'Fans eines intensiveren Geschmackes sollten zur Mole Chichilo greifen. Sie ist herb, herzhaft und lecker!', 'Rinderbrühe, Chilischoten, Guajillos, Knoblauch, Zwiebeln, Masa Harina'),
(37, 'Mole Manchamantel', '150g', 3.99, 'images/molemanchamantel.jpg', 'Die Farbe ist intensiv, ebenso wie der Geschmack. Wer den vollen Geschmack Mexikos probieren möchte, sollte hier zugreifen.', 'Tomaten, Fett, Ancho Chilischoten, Ananas, Zwiebel'),
(38, 'Pipian Rojo', '200g', 3.99, 'images/pipianrojo.jpg', 'Ein netter Kontrast zur Pipian Verde, wird auch der Geschmack der Pipian Rojo dem Gaumen ein Genuss sein.', 'Ancho Chilischoten, Guajillo Chilischoten, Kürbiskerne, Sesam, Zimt, Tomate, Zwiebel, Knoblauch'),
(39, 'Mole Prieto', '200g', 3.59, 'images/moleprieto.jpg', 'Man würde meinen, es kann doch bald keine Molen mehr geben, tatsächlich darf man aber nicht Mole Prieto vergessen, denn lecker ist sie allemal.', 'Zwiebel, Knoblauch, Guajillo Chili, Zimt, Pilze'),
(40, 'Loca Mole', '150g', 4.59, 'images/locamole.jpg', 'Unsere hauseigene Mole nach Geheimrezept. Sie ähnelt einer Guacamole, hat aber noch eine gewisse Extranote.', 'Avocados, Tomaten, Zitronensaft, Knoblauch, Salz und Pfeffer, Limette, Koriander, Petersilie');
--
-- Indizes der exportierten Tabellen
--
--
-- Indizes für die Tabelle `produkte`
--
ALTER TABLE `produkte`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT für exportierte Tabellen
--
--
-- AUTO_INCREMENT für Tabelle `produkte`
--
ALTER TABLE `produkte`
MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
2a53ad0c72f6d566461d48c9686ba463dc1aa072
|
SQL
|
pataga/SAS
|
/sql/updates/already_applied/2013_04_23_sas_user_permission.sql
|
UTF-8
| 1,359
| 2.765625
| 3
|
[
"Apache-2.0"
] |
permissive
|
DROP TABLE IF EXISTS `sas_user_permission`;
CREATE TABLE `sas_user_permission` (
`pid` int(11) unsigned NOT NULL,
`sid` int(11) unsigned NOT NULL,
`uid` int(11) unsigned NOT NULL,
`bitmask` bigint(20) NOT NULL,
PRIMARY KEY (`pid`,`sid`,`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- KONFIGURATION START --
SET @SERVER_ID = 1;
SET @USER_ID = 1;
-- KONFIGURATION ENDE --
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (1, @SERVER_ID, @USER_ID, 255);
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (2, @SERVER_ID, @USER_ID, 255);
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (3, @SERVER_ID, @USER_ID, 255);
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (4, @SERVER_ID, @USER_ID, 255);
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (5, @SERVER_ID, @USER_ID, 255);
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (6, @SERVER_ID, @USER_ID, 255);
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (7, @SERVER_ID, @USER_ID, 255);
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (8, @SERVER_ID, @USER_ID, 255);
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (9, @SERVER_ID, @USER_ID, 255);
INSERT INTO sas_user_permission (pid, sid, uid, bitmask) VALUE (10, @SERVER_ID, @USER_ID, 255);
| true
|
84a3c6b14c0d0918503e9b2c1c415e644e757a34
|
SQL
|
paragasa/GradAPP-Relational-Database
|
/SQLproj.sql
|
UTF-8
| 7,192
| 3.0625
| 3
|
[] |
no_license
|
--Dropping all tables
DROP TABLE IF EXISTS ETH_LINKING;
DROP TABLE IF EXISTS ETHNICITY;
DROP TABLE IF EXISTS PERSONAL_INFO;
DROP TABLE IF EXISTS MILITARY_BRANCH;
DROP TABLE IF EXISTS STATE;
DROP TABLE IF EXISTS VET_STAT;
DROP TABLE IF EXISTS GENDER;
DROP TABLE IF EXISTS PERSONAL_INFO;
DROP TABLE IF EXISTS BK_GROUND;
DROP TABLE IF EXISTS EMP_HIST;
DROP TABLE IF EXISTS EDU_HIST;
DROP TABLE IF EXISTS APPLICATION;
DROP TABLE IF EXISTS ENTRANCE_TESTS;
DROP TABLE IF EXISTS TERM;
DROP TABLE IF EXISTS STUDENT_TYPE;
DROP TABLE IF EXISTS COLLEGE;
DROP TABLE IF EXISTS DEGREE;
DROP TABLE IF EXISTS MAJOR_TYPE;
--DROP TABLE IF EXISTS USR_ACCT;
DROP TABLE IF EXISTS APPLICATION;
/*-----------------APPLICATION-------------------*/
CREATE TABLE IF NOT EXISTS USR_ACCT(
USR_NM VARCHAR(20),
USR_PWD VARCHAR(32),
PRIMARY KEY (USR_NM)
)ENGINE=InnoDB;
CREATE TABLE MAJOR_TYPE(
MAJOR_ID INT NOT NULL,
MAJOR VARCHAR(60) NOT NULL,
PRIMARY KEY (MAJOR_ID)
)ENGINE=InnoDB;
CREATE TABLE DEGREE(
DEGREE_ID INT NOT NULL,
DEGREE VARCHAR(30) NOT NULL,
PRIMARY KEY (DEGREE_ID)
)ENGINE=InnoDB;
CREATE TABLE COLLEGE(
COLLEGE_ID INT NOT NULL,
COLLEGE VARCHAR(50) NOT NULL,
PRIMARY KEY (COLLEGE_ID)
)ENGINE=InnoDB;
CREATE TABLE STUDENT_TYPE(
TYPE_ID INT NOT NULL,
STUDENT_TYPE VARCHAR(30) NOT NULL,
PRIMARY KEY (TYPE_ID)
)ENGINE=InnoDB;
CREATE TABLE TERM(
TERM_ID INT NOT NULL,
TERM VARCHAR(15) NOT NULL,
PRIMARY KEY (TERM_ID)
)ENGINE=InnoDB;
CREATE TABLE ENTRANCE_TESTS(
TEST_TYPE VARCHAR(15) NOT NULL,
TEST_DTE DATE NOT NULL,
PRIMARY KEY (TEST_TYPE)
)ENGINE=InnoDB;
CREATE TABLE APPLICATION(
GRAD_APP_ID INT NOT NULL,
USR_NM VARCHAR(20) NOT NULL,
TYPE_ID INT NOT NULL,
COLLEGE_ID INT NOT NULL,
DEGREE_ID INT NOT NULL,
MAJOR_ID INT NOT NULL,
TERM_ID INT NOT NULL,
PRIMARY KEY (GRAD_APP_ID),
FOREIGN KEY (USR_NM) REFERENCES USR_ACCT(USR_NM),
FOREIGN KEY (MAJOR_ID) REFERENCES MAJOR_TYPE(MAJOR_ID),
FOREIGN KEY (DEGREE_ID) REFERENCES DEGREE(DEGREE_ID),
FOREIGN KEY (COLLEGE_ID) REFERENCES COLLEGE(COLLEGE_ID),
FOREIGN KEY (TYPE_ID) REFERENCES STUDENT_TYPE(TYPE_ID),
FOREIGN KEY (TERM_ID) REFERENCES TERM(TERM_ID)
)ENGINE=InnoDB;
CREATE TABLE EDU_HIST(
INSTITU_HIST VARCHAR(40) NOT NULL,
DEGREE_HIST VARCHAR(30) NOT NULL,
START_DTE_HIST DATE NOT NULL,
MAJOR_HIST VARCHAR(30) NOT NULL,
DEGREE_RECV_DTE DATE NOT NULL,
GRAD_APP_ID INT NOT NULL,
PRIMARY KEY (INSTITU_HIST),
FOREIGN KEY (GRAD_APP_ID) REFERENCES APPLICATION (GRAD_APP_ID)
)ENGINE=InnoDB;
CREATE TABLE EMP_HIST(
EMPLOYER VARCHAR(30) NOT NULL,
CURRENTLY_EMPLOY CHAR(1) NOT NULL,
ORG_ADDR VARCHAR(40) NOT NULL,
ORG_PHONE VARCHAR(12) NOT NULL,
TITLE VARCHAR(30) NOT NULL,
START_DTE DATE NOT NULL,
END_DTE DATE NOT NULL,
PART_OR_FULL VARCHAR(5) NOT NULL,
GRAD_APP_ID INT NOT NULL,
FOREIGN KEY (GRAD_APP_ID) REFERENCES APPLICATION (GRAD_APP_ID)
)ENGINE=InnoDB;
CREATE TABLE BK_GROUND(
FINANCIAL_AID CHAR(1) NOT NULL,
TUITION_ASSIST CHAR(1) NOT NULL,
OTHER_PROG CHAR(1) NOT NULL,
CONVICTED CHAR(1) NOT NULL,
EDU_PROBATION CHAR(1) NOT NULL,
GRAD_APP_ID INT NOT NULL,
FOREIGN KEY (GRAD_APP_ID) REFERENCES APPLICATION (GRAD_APP_ID)
)ENGINE=InnoDB;
CREATE TABLE GENDER(
GENDER_ID INT NOT NULL,
GENDER_OPTION CHAR(6) NOT NULL,
PRIMARY KEY (GENDER_ID)
)ENGINE=InnoDB;
CREATE TABLE VET_STAT(
VET_STAT_ID INT NOT NULL,
VET_STATUS VARCHAR(18) NOT NULL,
PRIMARY KEY (VET_STAT_ID)
)ENGINE=InnoDB;
CREATE TABLE MILITARY_BRANCH(
MIL_ID INT NOT NULL,
MIL_BRANCH VARCHAR(30) NOT NULL,
PRIMARY KEY (MIL_ID)
)ENGINE=InnoDB;
CREATE TABLE STATE(
STATE_ID CHAR(2) NOT NULL,
STATE VARCHAR(20) NOT NULL,
PRIMARY KEY (STATE_ID)
)ENGINE=InnoDB;
CREATE TABLE PERSONAL_INFO(
PERSON_ID INT NOT NULL,
NAME VARCHAR(30) NOT NULL,
PERFER_NM VARCHAR(30),
DOB DATE NOT NULL,
ADDR VARCHAR(30) NOT NULL,
CITY VARCHAR(20) NOT NULL,
STATE_ID CHAR(2) NOT NULL,
ZIP INT NOT NULL,
PHONE_NUM VARCHAR(12) NOT NULL,
US_CITIZEN CHAR(1) NOT NULL,
ENG_LANG_PRIMARY CHAR(1) NOT NULL,
VET_STAT_ID INT NOT NULL,
MIL_ID INT NOT NULL,
GENDER_ID INT NOT NULL,
HISPANIC CHAR(1) NOT NULL,
GRAD_APP_ID INT NOT NULL,
PRIMARY KEY (PERSON_ID),
FOREIGN KEY (GRAD_APP_ID) REFERENCES APPLICATION (GRAD_APP_ID),
FOREIGN KEY (STATE_ID) REFERENCES STATE (STATE_ID),
FOREIGN KEY (GENDER_ID) REFERENCES GENDER (GENDER_ID),
FOREIGN KEY (VET_STAT_ID) REFERENCES VET_STAT (VET_STAT_ID),
FOREIGN KEY (MIL_ID) REFERENCES MILITARY_BRANCH(MIL_ID)
)ENGINE=InnoDB;
/* INSERT INTO PERSONAL_INFO(PERSON_ID,GRAD_APP_ID) VALUES(11,1); */
CREATE TABLE ETHNICITY(
ETH_ID INT NOT NULL,
ETH_CHOICE VARCHAR(35) NOT NULL,
PRIMARY KEY (ETH_ID)
)ENGINE=InnoDB;
CREATE TABLE ETH_LINKING(
PERSON_ID INT NOT NULL,
ETH_ID INT NOT NULL,
PRIMARY KEY (PERSON_ID, ETH_ID),
FOREIGN KEY (PERSON_ID) REFERENCES PERSONAL_INFO(PERSON_ID),
FOREIGN KEY (ETH_ID) REFERENCES ETHNICITY(ETH_ID)
)ENGINE=InnoDB;
INSERT INTO USR_ACCT VALUES('user1',MD5('drowssap'));
INSERT INTO MAJOR_TYPE VALUES(1,'Certificate in Computer Science
Fundamentals'),(2,'Certificate in Software Architecture and
Design'),(3,'Certificate in Software Project Management');
INSERT INTO DEGREE VALUES (1,'Certificates'),(2,'Master\'s');
INSERT INTO COLLEGE VALUES(1,'College of Science and
Engineering'),(2,'Albers School of Business'),(3,'College of Arts and
Sciences'),(4,'College of Education'),(5,'College of
Nursing'),(6,'School of Theology and Ministry');
INSERT INTO STUDENT_TYPE VALUES(1,'Graduate'),(2,'Graduate Non-
Matriculated'),(3,'Graduate readmission');
INSERT INTO TERM VALUES(1,'FALL 2017'),(2,'FALL 2016'),(3,'SUMMER
2016'),(4,'SUMMER 2017');
INSERT INTO ENTRANCE_TESTS (TEST_TYPE) VALUES ('CBEST'),('GMAT'),('GRE
General'),('IELTS'),('MAT'),('PRAXIS'),('TOEFL'),('WEST-B'),('WEST-E')
;
INSERT INTO GENDER VALUES (1,'MALE'), (2,'FEMALE');
INSERT INTO VET_STAT VALUES(1,'Not a veteran'),(2,'Currently
serving'),(3,'Previously served'),(4,'Current dependent');
INSERT INTO MILITARY_BRANCH VALUES(1,'Army'),(2,'Marine
Corp'),(3,'Navy'),(4,'Air Force'),(5,'Coast Guard');
INSERT INTO STATE VALUES ('AL','Alabama'),('AK','Alaska'),('AZ','Arizo
na'),('AR','Arkansas'),('CA','California'),('CO','Colorado'),('CT','Co
nnecticut'),('DE','Delaware'),('FL','Florida'),('GA','Georgia'),('HI',
'Hawaii'),('ID','Idaho'),('IL','Illinois'),('IN','Indiana'),('IA','Iow
a'),('KS','Kansas'),('KY','Kentucky'),('LA','Louisiana'),('ME','Maine'
),('MD','Maryland'),('MA','Massachusetts'),('MI','Michigan'),('MN','Mi
nnesota'),('MS','Mississippi'),('MO','Missouri'),('MT','Montana'),('NE
','Nebraska'),('NV','Nevada'),('NH','New Hampshire'),('NJ','New
Jersey'),('NM','New Mexico'),('NY','New York'),('NC','North
Carolina'),('ND','North Dakota'),('OH','Ohio'),('OK','Oklahoma'),('OR'
,'Oregon'),('PA','Pennsylvania'),('RI','Rhode Island'),('SC','South
Carolina'),('SD','South Dakota'),('TN','Tennessee'),('TX','Texas'),('U
T','Utah'),('VT','Vermont'),('VA','Virginia'),('WA','Washington'),('WV
','West Virginia'),('WI','Wisconsin'),('WY','Wyoming');
INSERT INTO ETHNICITY VALUES (1,'Asian'),(2,'Black/African
American'),(3,'Native Hawaiian/Pacific Islander'),(4,'Native
American/Native Indian'),(5,'White/Middle Estern');
| true
|
bcc1d2766ad61dd4618c0c608f02466987c81c55
|
SQL
|
felipealvescosta/escola
|
/tb_livro.sql
|
UTF-8
| 1,532
| 2.96875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.2.7.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 24-Out-2014 às 02:42
-- Versão do servidor: 5.6.20
-- PHP Version: 5.5.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `escola`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `tb_livro`
--
CREATE TABLE IF NOT EXISTS `tb_livro` (
`titulo` varchar(30) DEFAULT NULL,
`id_livro` int(10) NOT NULL,
`isbn` varchar(30) DEFAULT NULL,
`autor` varchar(30) DEFAULT NULL,
`editora` varchar(30) DEFAULT NULL,
`genero` varchar(30) DEFAULT NULL,
`quantidade` int(10) DEFAULT NULL,
`reg_biblioteca` varchar(30) DEFAULT NULL,
`imagem` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tb_livro`
--
ALTER TABLE `tb_livro`
ADD PRIMARY KEY (`id_livro`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tb_livro`
--
ALTER TABLE `tb_livro`
MODIFY `id_livro` int(10) NOT NULL AUTO_INCREMENT;
/*!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
|
05385851779af40c0ceee32a434079026e12bd9d
|
SQL
|
AimeeStudio/aimeewmt
|
/Full/Install/aimee.sql
|
UTF-8
| 7,303
| 2.796875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 2.11.9.2
-- http://www.phpmyadmin.net
--
-- 主机: 127.0.0.1:3306
-- 生成日期: 2012 年 07 月 04 日 02:24
-- 服务器版本: 5.1.28
-- PHP 版本: 5.2.6
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 */;
--
-- 数据库: `aimee`
--
-- --------------------------------------------------------
--
-- 表的结构 `ai_admin`
--
DROP TABLE IF EXISTS `ai_admin`;
CREATE TABLE IF NOT EXISTS `ai_admin` (
`adminid` int(3) unsigned NOT NULL AUTO_INCREMENT COMMENT '管理员ID',
`adminname` varchar(50) NOT NULL COMMENT '管理员名称',
`adminpassword` varchar(32) NOT NULL COMMENT '管理员密码',
`adminpower` int(1) unsigned NOT NULL COMMENT '管理员权限',
`loginip` varchar(30) DEFAULT NULL COMMENT '登录IP',
`lastlogintime` int(10) unsigned DEFAULT NULL COMMENT '最后登录时间',
`logincount` int(6) unsigned NOT NULL DEFAULT '0' COMMENT '登录次数',
PRIMARY KEY (`adminid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='管理员表' AUTO_INCREMENT=1 ;
--
-- 导出表中的数据 `ai_admin`
--
INSERT INTO `ai_admin` VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, NULL, NULL, 0);
--
-- 表的结构 `ai_setting`
--
DROP TABLE IF EXISTS `ai_setting`;
CREATE TABLE IF NOT EXISTS `ai_setting` (
`item` varchar(30) NOT NULL DEFAULT '0',
`item_key` varchar(30) NOT NULL DEFAULT '',
`item_value` varchar(250) NOT NULL DEFAULT '',
KEY `item` (`item`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='网站配置';
--
-- 导出表中的数据 `ai_setting`
--
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('0', 'timezone', '0');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('0', 'domain', 'http://demo.aimees.net');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('0', 'mail', 'admin@admin.com');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('0', 'siteright', '艾米团队');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('0', 'icp', '阿斯达就');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('0', 'keywords', '丁一,杨雷,李亮,林佳宏,AIMEE');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('0', 'description', '艾米艾米艾米艾米艾米艾米艾米艾米艾米艾米\r\n艾米艾米v艾米艾米\r\n艾米艾米\r\n');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('1', 'sys_update', '1');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('1', 'sys_lang', '3');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('1', 'dir_name', '分类目录名/id.html');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('1', 'file_position', 'html/');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('1', 'cache_time', '300');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('1', 'cache_set', '0');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('1', 'cache_type', '0');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('0', 'sitename', 'Aimee');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('2', 'file_size', '1024');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('2', 'file_type', 'jpg | gif | png | rar | zip | mp3');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('2', 'login_err', '3');
INSERT INTO `ai_setting` (`item`, `item_key`, `item_value`) VALUES ('2', 'admin_log', '1');
--
-- 表的结构 `ai_expand`
--
DROP TABLE IF EXISTS `ai_expand`;
CREATE TABLE IF NOT EXISTS `ai_expand` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`ex_key` varchar(30) NOT NULL DEFAULT '' COMMENT '包箱关键字',
`ex_name` varchar(50) NOT NULL DEFAULT '' COMMENT '包箱名称',
`ex_describe` varchar(250) NOT NULL DEFAULT '' COMMENT '包箱描述',
`ex_state` int(1) unsigned NOT NULL COMMENT '包箱状态',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='扩展包厢表' AUTO_INCREMENT=1 ;
--
-- 表的结构 `ai_channel`
--
DROP TABLE IF EXISTS `ai_channel`;
CREATE TABLE IF NOT EXISTS `ai_channel` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`cl_class` varchar(30) NOT NULL DEFAULT '' COMMENT '所属栏目',
`cl_type` varchar(10) NOT NULL DEFAULT '' COMMENT '类型',
`cl_att` int(1) unsigned NOT NULL COMMENT '属性',
`cl_name` varchar(250) NOT NULL DEFAULT '' COMMENT '栏目名称',
`cl_en_name` varchar(250) NOT NULL DEFAULT '' COMMENT '栏目英文名',
`cl_sort` int(10) unsigned NOT NULL COMMENT '排序',
`cl_exturl` varchar(250) NOT NULL DEFAULT '' COMMENT '外链地址',
`cl_info` varchar(250) NOT NULL DEFAULT '' COMMENT '栏目简介',
`cl_thumb` varchar(50) NOT NULL DEFAULT '' COMMENT '栏目缩略图',
`cl_keyword` varchar(250) NOT NULL DEFAULT '' COMMENT '栏目关键字',
`cl_description` varchar(250) NOT NULL DEFAULT '' COMMENT '栏目描述',
`cl_domain` varchar(250) NOT NULL DEFAULT '' COMMENT '栏目域名',
`cl_tplclass` varchar(100) NOT NULL DEFAULT '' COMMENT '栏目模板',
`cl_tplcontent` varchar(100) NOT NULL DEFAULT '' COMMENT '内容模板',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='分类表' AUTO_INCREMENT=1 ;
--
-- 表的结构 `ai_class_par`
--
DROP TABLE IF EXISTS `ai_class_par`;
CREATE TABLE IF NOT EXISTS `ai_class_par` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`cl_par_attid` varchar(30) NOT NULL DEFAULT '' COMMENT '所属栏目ID',
`cl_par_name` varchar(50) NOT NULL DEFAULT '' COMMENT '字段名称',
`cl_par_key` varchar(250) NOT NULL DEFAULT '' COMMENT '字段标签',
`cl_par_type` varchar(3) NOT NULL DEFAULT '' COMMENT '字段类型',
`cl_par_cnf` varchar(250) NOT NULL DEFAULT '' COMMENT '字段配置',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='分类参数表' AUTO_INCREMENT=1 ;
--
-- 表的结构 `ai_content`
--
DROP TABLE IF EXISTS `ai_content`;
CREATE TABLE IF NOT EXISTS `ai_content` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`nr_att` varchar(30) NOT NULL DEFAULT '' COMMENT '所属栏目',
`nr_good` int(1) unsigned NOT NULL COMMENT '推荐',
`nr_ext` int(1) unsigned NOT NULL COMMENT '外链',
`nr_name` varchar(250) NOT NULL DEFAULT '' COMMENT '内容名称',
`nr_en_name` varchar(250) NOT NULL DEFAULT '' COMMENT '内容英文名',
`nr_exturl` varchar(250) NOT NULL DEFAULT '' COMMENT '外链地址',
`nr_thumb` varchar(50) NOT NULL DEFAULT '' COMMENT '内容缩略图',
`nr_keyword` varchar(250) NOT NULL DEFAULT '' COMMENT '内容关键字',
`nr_description` varchar(250) NOT NULL DEFAULT '' COMMENT '内容描述',
`nr_edit` mediumtext COMMENT '内容编辑',
`nr_info` mediumtext COMMENT '内容简介',
`nr_times` int(10) unsigned DEFAULT NULL COMMENT '内容时间',
`nr_author` varchar(50) NOT NULL DEFAULT '' COMMENT '作者',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='内容表' AUTO_INCREMENT=1 ;
| true
|
794a6ef39f6a91f365e791ffc5f8e905b0ce90a6
|
SQL
|
groovytron/jee-todolist
|
/DB/DB.sql
|
UTF-8
| 6,613
| 2.765625
| 3
|
[] |
no_license
|
-- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: todolist
-- ------------------------------------------------------
-- Server version 5.7.16-log
CREATE DATABASE IF NOT EXISTS todolist ;
USE todolist;
/*!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 `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) NOT NULL,
`password` varchar(80) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` VALUES (3,'julien','721a9b52bfceacc503c056e3b9b93cfa'),(4,'axel','721a9b52bfceacc503c056e3b9b93cfa');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-03-23 12:12:13
-- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: todolist
-- ------------------------------------------------------
-- Server version 5.7.16-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `list`
--
DROP TABLE IF EXISTS `list`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`created_at` datetime DEFAULT NULL,
`name` varchar(80) NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_user_idx` (`user_id`),
CONSTRAINT `fk_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `list`
--
LOCK TABLES `list` WRITE;
/*!40000 ALTER TABLE `list` DISABLE KEYS */;
INSERT INTO `list` VALUES (2,'2017-03-27 00:00:00','Liste des choses à faire pour cette semaine',3),(3,'2017-03-27 00:00:00','Liste d\'Axel',4);
/*!40000 ALTER TABLE `list` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-03-23 12:12:13
-- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: todolist
-- ------------------------------------------------------
-- Server version 5.7.16-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `task`
--
DROP TABLE IF EXISTS `task`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `task` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL,
`description` text,
`deadline` datetime DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`done_at` datetime DEFAULT NULL,
`list_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_list_idx` (`list_id`),
CONSTRAINT `fk_list` FOREIGN KEY (`list_id`) REFERENCES `list` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `task`
--
LOCK TABLES `task` WRITE;
/*!40000 ALTER TABLE `task` DISABLE KEYS */;
INSERT INTO `task` VALUES (3,'Acheter des tomates','Ne pas oublier d\'acheter des tomates à la mère Ducrasse','2017-04-01 00:00:00','2017-03-28 00:00:00',NULL,2),(4,'Supprimer les fichiers inutiles du serveur distant A34WZoRB','URGENT','2017-05-01 00:00:00','2017-03-28 00:00:00',NULL,3);
/*!40000 ALTER TABLE `task` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-03-23 12:12:13
| true
|
ab33e006c2037849b30facb4f8917ccc94792874
|
SQL
|
svn2github/openbiz-cubi
|
/cubi/modules/sms/mod.install.sql
|
UTF-8
| 4,339
| 3.125
| 3
|
[
"BSD-3-Clause"
] |
permissive
|
DROP TABLE IF EXISTS `sms_log`;
CREATE TABLE IF NOT EXISTS `sms_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`provider_id` int(11) NOT NULL,
`mobile` varchar(11) NOT NULL,
`content` longtext NOT NULL,
`schedule` datetime NOT NULL,
`sent_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
DROP TABLE IF EXISTS `sms_provider`;
CREATE TABLE IF NOT EXISTS `sms_provider` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`driver` varchar(50) NOT NULL,
`name` varchar(50) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`site_url` varchar(255) NOT NULL,
`description` text,
`msg_sent_count` int(11) DEFAULT '0' ,
`msg_balance` int(11) DEFAULT '0' ,
`msg_last_sendtime` datetime NOT NULL,
`priority` int(2) DEFAULT '1',
`status` int(2) NOT NULL DEFAULT '1',
`update_by` int(11) NOT NULL,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`create_by` int(11) NOT NULL,
`create_time` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `sms_provider`
--
INSERT INTO `sms_provider` (`id`, `driver`, `name`, `username`, `password`, `type`, `site_url`, `description`, `msg_sent_count`, `msg_balance`, `msg_last_sendtime`, `priority`, `status`, `update_by`, `update_time`, `create_by`, `create_time`) VALUES
(1, 'sms.lib.driver.SP18dx', '八信科技', '', '', '18dx', 'http://www.18dx.cn/', '长沙八信通讯科技有限公司是一家专注于移动通讯领域的科技公司。', 0, 0, '2012-09-06 09:52:03', 50, 0, 1, '2012-09-06 10:55:43', 1, '2012-08-01 23:10:17'),
(2, 'sms.lib.driver.SPc123', '创明短信', '', '', 'c123', 'http://www.c123.com', '上海创明网络科技有限公司是一家专注企业短信、移动商务、无线广告业务的公司', 0, 0, '2012-09-06 09:58:29', 50, 0, 1, '2012-09-06 10:59:11', 1, '0000-00-00 00:00:00');
INSERT INTO `sms_provider` (`id`, `driver`, `name`, `username`, `password`, `type`, `site_url`, `description`, `msg_sent_count`, `msg_balance`, `msg_last_sendtime`, `priority`, `status`, `update_by`, `update_time`, `create_by`, `create_time`) VALUES
(3, 'sms.lib.driver.SPemay', '亿美软通', '', '', 'emay', 'http://www.emay.cn', '北京亿美软通科技有限公司( Beijing Emay Softcom Technology Ltd.)是国际数据集团风险投资(IDG资本)在华注资的高科技企业、全球最大的信用局和数据营销公司Experian(益百利)的中国战略合作伙伴,是具备国际水准的移动商务平台技术和应用方案提供商。', 0, 0,'0000-00-00 00:00:00', 50, 0, 1, '2012-09-08 17:06:57', 1, '0000-00-00 00:00:00'),
(4, 'sms.lib.driver.SPc8686', '八优信息', '', '', 'c8686', 'http://www.c8686.com/', '上海八优信息科技有限公司是一家SP增值、软件开发、技术咨询和网站建设为主要业务的企业。', 0, 0,'0000-00-00 00:00:00', 50, 0, 1, '2012-09-08 17:06:57', 1, '0000-00-00 00:00:00'),
(5, 'sms.lib.driver.SPtclk', '同创凌凯', '', '', 'tclk', 'http://www.bjtclk.com/', '北京同创凌凯信息技术有限公司是以移动商务产品的研发、营销、短信中心平台运营为一体的信息技术科技公司', 0, 0,'0000-00-00 00:00:00', 50, 0, 1, '2012-09-08 17:06:57', 1, '0000-00-00 00:00:00');
DROP TABLE IF EXISTS `sms_queue`;
CREATE TABLE IF NOT EXISTS `sms_queue` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mobile` varchar(11) NOT NULL,
`content` longtext NOT NULL,
`status` enum('pending','sending','sent') DEFAULT 'pending',
`schedule` datetime NOT NULL,
`create_by` int(11) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `flag` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
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 SMS Job', '*', '*', '*', '*', '*', '{APP_HOME}/bin/cronjob/run_svc.php sms.lib.SmsService SendSmsFromQueue', '', 1, 0, 'System SMS Queue Service', 1, 1296586403, 1, '2011-02-01 10:24:31', 1, '2011-02-01 10:51:04');
| true
|
a2475b0d5fc1bdfc69c5a542a7288d42bf51ca9c
|
SQL
|
MaximOkulin/EnergyTechAudit.PowerAccounting
|
/EnergyTechAudit.PowerAccounting.Database/Admin/Admin.User_InstedOfUpdate.sql
|
UTF-8
| 1,356
| 3.4375
| 3
|
[] |
no_license
|
CREATE TRIGGER [Admin].[User_InstedOf_Update]
ON [Admin].[User]
INSTEAD OF UPDATE
NOT FOR REPLICATION
AS
BEGIN
IF NOT EXISTS (SELECT * FROM inserted)
BEGIN
RETURN;
END
OPEN SYMMETRIC KEY [EnergyTechAudit.PowerAccounting.Database.SymmetricKey]
DECRYPTION BY CERTIFICATE [EnergyTechAudit.PowerAccounting.Database.Certificate];
UPDATE [Admin].[User] SET
[RoleId] = [User].[RoleId],
[UserName] = [User].[UserName],
[Email] = [User].[Email],
[Password] = [User].[Password],
[EncryptedPassword] = CONVERT(NCHAR(512), ENCRYPTBYKEY(KEY_GUID(N'[EnergyTechAudit.PowerAccounting.Database.SymmetricKey]'), [User].[Password])),
[CreateDate] = [User].[CreateDate],
[ExpiredDate] = [User].[ExpiredDate],
[IsTemporary] = [User].[IsTemporary],
[IsApproved] = [User].[IsApproved],
[IsOnline] = [User].[IsOnline],
[Description] = [User].[Description],
[CreatedBy] = [User].[CreatedBy],
[UpdatedBy] = [User].[UpdatedBy],
[CreatedDate] = [User].[CreatedDate],
[UpdatedDate] = [User].[UpdatedDate]
FROM inserted [User] WHERE [Admin].[User].[Id] = [User].[Id];
CLOSE SYMMETRIC KEY [EnergyTechAudit.PowerAccounting.Database.SymmetricKey];
SELECT [Id] FROM [Admin].[User] WHERE @@ROWCOUNT > 0 AND [Id] = scope_identity();
END
| true
|
af637c530311056140cd6d299a7a42e7ff35e01b
|
SQL
|
kamehamehaWangzi/zabbix
|
/Aphrodite/src/main/resources/conf/sql/create_tables.sql
|
UTF-8
| 4,988
| 3.65625
| 4
|
[
"Apache-2.0"
] |
permissive
|
DROP TABLE IF EXISTS `monitordata`;
CREATE TABLE `monitordata` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`taskdataid` int(10) NOT NULL DEFAULT '0' COMMENT '外键,对应时间段任务的id',
`hostid` varchar(20) NOT NULL DEFAULT '' COMMENT '对应主机ID',
`monitorType` varchar(10) NOT NULL DEFAULT '0' COMMENT '1-cpu; 2-disk; 3-net; 4-memory',
`itemName` varchar(20) NOT NULL DEFAULT '' COMMENT '对应键值对',
`path` varchar(255) DEFAULT NULL COMMENT '数据存放地址',
PRIMARY KEY (`Id`),
KEY `taskdataid` (`taskdataid`,`hostid`,`monitorType`)
) ENGINE=InnoDB AUTO_INCREMENT=340 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `taskdata`;
CREATE TABLE `taskdata` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`taskId` int(11) DEFAULT NULL,
hosts varchar(255) DEFAULT NULL,
`startTime` varchar(255) DEFAULT NULL,
`endTime` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS task;
CREATE TABLE task (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
project varchar(255) DEFAULT NULL,
hosts varchar(255) DEFAULT NULL,
description varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `project`;
CREATE TABLE project (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
hosts varchar(2000) DEFAULT NULL,
description varchar(2000) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
drop table if exists host;
CREATE TABLE
host
(
id INT(10) unsigned NOT NULL AUTO_INCREMENT,
groups varchar(2000),
templates varchar(2000),
zabbix_hostid bigint unsigned,
name VARCHAR(64) COLLATE utf8_bin NOT NULL,
type VARCHAR(32),
os_type VARCHAR(32),
os_version VARCHAR(64),
ip1 VARCHAR(32),
ip2 VARCHAR(32),
ip3 VARCHAR(32),
ip4 VARCHAR(32),
vendor VARCHAR(64),
model VARCHAR(64),
cpu VARCHAR(64),
disk VARCHAR(64),
memory VARCHAR(64),
sn VARCHAR(64),
description VARCHAR(256),
is_monitor TINYINT DEFAULT '0',
PRIMARY KEY (id)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
drop table if exists app;
CREATE TABLE
app
(
id INT(10) unsigned NOT NULL AUTO_INCREMENT,
name VARCHAR(128) COLLATE utf8_bin NOT NULL,
type VARCHAR(32),
version VARCHAR(128),
description VARCHAR(256),
PRIMARY KEY (id)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
drop table if exists host_app;
CREATE TABLE
host_app
(
id INT(10) unsigned NOT NULL AUTO_INCREMENT,
host_id INT NOT NULL,
app_id INT NOT NULL,
PRIMARY KEY (id)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
drop table if exists salt_job;
CREATE TABLE
salt_job
(
id INT(10) unsigned NOT NULL AUTO_INCREMENT,
job_id VARCHAR(32),
title VARCHAR(256),
host_name VARCHAR(128),
fun VARCHAR(32),
return_value MEDIUMTEXT,
arg VARCHAR(256),
param VARCHAR(256),
status VARCHAR(32) DEFAULT 'wait',
deploy_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
INDEX idx_host_name (host_name)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `script`
-- ----------------------------
DROP TABLE IF EXISTS `script`;
CREATE TABLE `script` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) DEFAULT NULL COMMENT '脚本名称',
`path` varchar(256) CHARACTER SET cp1250 DEFAULT NULL COMMENT '脚本路径',
`type` varchar(32) DEFAULT NULL COMMENT '脚本类型',
`content` text COMMENT '脚本内容',
`description` varchar(256) DEFAULT NULL COMMENT '脚本描述',
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '脚本状态(0-正常 1-作废)',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '脚本创建时间',
PRIMARY KEY (`id`),
KEY `idx_script_name` (`name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
-- ----------------------------
-- Table structure for `script_template`
-- ----------------------------
DROP TABLE IF EXISTS `script_template`;
CREATE TABLE `script_template` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL COMMENT '模板名称',
`type` varchar(32) DEFAULT NULL COMMENT '脚本类型',
`content` text COMMENT '模板内容',
`description` varchar(256) DEFAULT NULL COMMENT '描述',
`os` varchar(256) DEFAULT NULL COMMENT '操作系统',
`createtime` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`status` int(11) DEFAULT '0' COMMENT '模板状态(0-正常 1-作废)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
| true
|
cd840671e2316ba2eec8f34d7fd76b1099f79e30
|
SQL
|
kivitendo/kivitendo-erp
|
/sql/Pg-upgrade2-auth/password_hashing.sql
|
UTF-8
| 254
| 2.671875
| 3
|
[] |
no_license
|
-- @tag: password_hashing
-- @description: Explicitely set a password hashing algorithm
-- @depends:
UPDATE auth."user"
SET password = '{CRYPT}' || password
WHERE NOT (password IS NULL)
AND (password <> '')
AND NOT (password LIKE '{%}%');
| true
|
c44faea765e6346bf8fdcb62aca5e8b6a33efb40
|
SQL
|
Bayuncat/product-star_Spring
|
/spring-jdbc/src/test/resources/contact.sql
|
UTF-8
| 423
| 2.5625
| 3
|
[] |
no_license
|
DROP TABLE IF EXISTS CONTACT;
CREATE TABLE CONTACT (
ID serial primary key ,
NAME varchar(255),
SURNAME varchar(255),
EMAIL varchar (255),
PHONE_NUMBER varchar (255)
);
INSERT INTO CONTACT(ID, NAME, SURNAME, EMAIL, PHONE_NUMBER)
VALUES (1000, 'Ivan', 'Ivanov', 'iivanov@gmail.com', '1234567');
INSERT INTO CONTACT(ID, NAME, SURNAME, EMAIL, PHONE_NUMBER)
VALUES (2000, 'Maria', 'Ivanova', 'mivanova@gmail.com', '7654321');
| true
|
3d06ba34ef0f6ac21d2fe8701c2c924e3fc30b56
|
SQL
|
jakegold/software_project
|
/sql/insert.sql
|
UTF-8
| 1,020
| 3
| 3
|
[] |
no_license
|
--Part B
insert into person(uname, password, fname, lname) values
('AA', md5('AA'), 'Ann', 'Anderson'),
('BB', md5('BB'), 'Bob', 'Baker'),
('CC', md5('CC'), 'Cathy', 'Chang'),
('DD', md5('DD'), 'David', 'Davidson'),
('EE', md5('EE'), 'Ellen', 'Ellenberg'),
('FF', md5('FF'), 'Fred', 'Fox'),
('GG', md5('GG'), 'Gina', 'Gupta'),
('HH', md5('HH'), 'Helen', 'Harper');
insert into friendgroup(owner, gname) values
('AA', 'family'),
('BB', 'family'),
('AA', 'besties');
insert into member(owner, gname, member) values
('AA', 'family', 'AA'),
('AA', 'family', 'CC'),
('AA', 'family', 'DD'),
('AA', 'family', 'EE'),
('BB', 'family', 'BB'),
('BB', 'family', 'FF'),
('BB', 'family', 'EE'),
('AA', 'besties', 'AA'),
('AA', 'besties', 'GG'),
('AA', 'besties', 'HH');
insert into content(cid, uname, name, is_pub) values
(1, 'AA', 'Whiskers', false),
(2, 'AA', 'My birthday party', false),
(3, 'BB', 'Rover', false);
insert into share(cid, owner, gname) values
(1, 'AA', 'family'),
(2, 'AA', 'besties'),
(3, 'BB', 'family');
| true
|
5438555a244c93285aec4a135e82b43890e0c461
|
SQL
|
ml31k/compara
|
/lib/compara70/ensembl/modules/t/test-genome-DBs/homo_sapiens/core/unmapped_object.sql
|
UTF-8
| 2,162
| 3.125
| 3
|
[
"BSD-2-Clause"
] |
permissive
|
-- MySQL dump 10.13 Distrib 5.1.61, for redhat-linux-gnu (x86_64)
--
-- Host: mysql-eg-devel-1.ebi.ac.uk Database: homo_sapiens_core_test_db
-- ------------------------------------------------------
-- Server version 5.1.49-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `unmapped_object`
--
DROP TABLE IF EXISTS `unmapped_object`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `unmapped_object` (
`unmapped_object_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` enum('xref','cDNA','Marker') COLLATE latin1_bin NOT NULL,
`analysis_id` int(10) unsigned NOT NULL,
`external_db_id` int(11) DEFAULT NULL,
`identifier` varchar(255) COLLATE latin1_bin NOT NULL,
`unmapped_reason_id` smallint(5) unsigned NOT NULL,
`query_score` double DEFAULT NULL,
`target_score` double DEFAULT NULL,
`ensembl_id` int(10) unsigned DEFAULT '0',
`ensembl_object_type` enum('RawContig','Transcript','Gene','Translation') COLLATE latin1_bin DEFAULT 'RawContig',
`parent` VARCHAR(255) COLLATE latin1_bin DEFAULT NULL,
PRIMARY KEY (`unmapped_object_id`),
KEY `id_idx` (`identifier`),
KEY `anal_idx` (`analysis_id`),
KEY `anal_exdb_idx` (`analysis_id`,`external_db_id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2012-11-05 10:52:12
| true
|
ec2ade10bb3feb1708970f1337fec2677c39a876
|
SQL
|
arthima/bank-project
|
/CONSTRAINTS.SQL
|
UTF-8
| 595
| 2.96875
| 3
|
[] |
no_license
|
CONSTRAINTS
--To assign a primary key to the BANK_CUST table
ALTER TABLE BANK_CUST ADD CONSTRAINT PK_CUST_ID
PRIMARY KEY (CUST_ID);
--To assign a foreign key to the BANK_CUST_CONTACT table
ALTER TABLE BANK_CUST_CONTACT ADD CONSTRAINT FK_CUST_ID
FOREIGN KEY (CUST_ID) REFERENCES BANK_CUST (CUST_ID)
ON DELETE CASCADE;
--To assign a primary key to the BANK_EMPLOYEE table
ALTER TABLE BANK_EMPLOYEE ADD CONSTRAINT PK_BANK_EMP_ID
PRIMARY KEY (BANK_EMP_ID);
| true
|
053ab3165c5f1232be530ad8baad512523b1e478
|
SQL
|
silence-do-good/stress-test-Postgres-and-MySQL
|
/dump/high/day22/select0407.sql
|
UTF-8
| 177
| 2.59375
| 3
|
[] |
no_license
|
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-21T04:07:00Z' AND timestamp<'2017-11-22T04:07:00Z' AND temperature>=9 AND temperature<=81
| true
|
d2e0b9e1e3110d7157ba86163054385831f4938b
|
SQL
|
krsunyoung/sql
|
/select-basic/NVL.sql
|
UTF-8
| 834
| 3.640625
| 4
|
[] |
no_license
|
--nvl (null 관련 함수)
select nvl(null,0) from dual;
select nvl(1,0) from dual;
select employee_id, nvl(commission_pct, 0),
nvl(commission_pct, 0)*salary from employees;
select nvl2(null, 10, 0) from dual;
select employee_id, nvl2(commission_pct,commission_pct*salary, 0) from employees;
select employee_id,
nvl2(commission_pct,commission_pct*salary+salary, salary)as "지급월급"
from employees;
select nullif(6, 3+2) from dual;
--충돌 ?? 앞에것을 친다?? null을 안만날때까지 다음 파라미터를 찾아낸다.
select coalesce(null, null, 3, 4, 5) from dual;
select coalesce(1, null, 3, 4, 5) from dual;
--숫자지만 문자로 받아들이기 위해서 to_char를 써줌 . 하지만 써줄일은 없다.
select employee_id, nvl(to_char(manager_id), '없음') from employees;
| true
|
2092884771fc1c36b8e6433798c668ec7ddc49b5
|
SQL
|
jump8621/sql-data_engineering
|
/employeeSQL/q4.sql
|
UTF-8
| 358
| 3.953125
| 4
|
[] |
no_license
|
-- List the department of each employee with the following information: employee number, last name, first name, and department name.
--emp #, last_name, first_name, dept_name
SELECT e.emp_no, e.last_name, e.first_name, d.dept_name
FROM dept_emp AS de
INNER JOIN departments AS d
on d.dept_no = de.dept_no
INNER JOIN employees AS e
on e.emp_no = de.emp_no;
| true
|
e92045fa801f29c03bcfd063edd5dd0d02dac6cd
|
SQL
|
mirko2020/STUP_002_IP_Materijali
|
/baza_podataka/001.studiranje.ip.projektni.korisnici.hronologije-test.001.sql
|
UTF-8
| 400
| 2.609375
| 3
|
[] |
no_license
|
use studiranje;
insert into st_user(st_username, st_firstname, st_secondname, st_email_address) values('marko', 'Marko', 'Markovic', 'marko@mtel.com');
update st_user set st_password_hash = 'PASSWORD' WHERE st_username = 'marko';
update st_user set st_username = 'janko' WHERE st_username = 'marko';
delete from st_user where st_username='marko';
delete from st_user where st_username='janko';
| true
|
91b09d0cebeed0494ee1a7b6b02db3d0b05e3ea0
|
SQL
|
yenny07/course_DBP
|
/WebContent/SQL/function.sql
|
UTF-8
| 576
| 3.234375
| 3
|
[] |
no_license
|
CREATE OR REPLACE FUNCTION Date2EnrollSemester(dDate IN DATE)
RETURN NUMBER
IS
month NUMBER := TO_NUMBER(TO_CHAR(dDate, 'MM'));
semester NUMBER := 0;
BEGIN
IF month <= 2 THEN
semester := 1;
ELSIF month <=8 THEN
semester := 2;
ELSE
semester := 1;
END IF;
RETURN semester;
END;
/
CREATE OR REPLACE FUNCTION Date2EnrollYear(dDate IN DATE)
RETURN NUMBER
IS
year NUMBER := 0;
nSEMESTER NUMBER;
BEGIN
year := TO_NUMBER(TO_CHAR(dDate, 'YYYY'));
nSEMESTER := Date2EnrollSemester(dDate);
IF (nSEMESTER = 1) THEN
year := year + 1;
END IF;
RETURN year;
END;
/
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.