sql stringlengths 6 1.05M |
|---|
ALTER TABLE users ADD COLUMN service_bodies TEXT DEFAULT NULL;
|
-- AlterTable
ALTER TABLE "Booking" ADD COLUMN "location" TEXT;
|
<gh_stars>10-100
create or replace package body pit_admin
as
/**
Package: PIT_ADMIN Body
Implements PIT administration methods
Author::
<NAME>, ConDeS GmbH
Published under MIT licence
*/
/**
Group: Private type definitions
*/
/**
Type: predefined_error_rec
Record to store details for a named Oracle error
Properties:
source_type - Type of data object in which the error is defined
owner - Owner of the data object that defines the error
package_name - Name of the data object that defines the error
error_name - Name of the error
*/
type predefined_error_rec is record(
source_type pit_util.ora_name_type,
owner pit_util.ora_name_type,
package_name pit_util.ora_name_type,
error_name pit_util.ora_name_type);
/**
Type predefined_error_t
Table that stores all predefined errors <PIT_ADMIN> found within the database
to prevent any overwrites of predefined errors.
*/
type predefined_error_t is table of predefined_error_rec index by binary_integer;
/**
Group: Private constants
*/
/**
Constants: Constants
C_PIT_PARAMETER_GROUP - Parameter group for PIT parameters
C_CONTEXT_PREFIX - Prefix for context names
C_TOGGLE_PREFIX - Prefix for toggle names
C_XLIFF_NS - Namespace of XLIFF
C_MIN_ERROR - First error number PIT uses for error numbering
C_MAX_ERROR - Last error number PIT uses for error numbering
C_FATAL - Level fatal, defined here to avoid dependency on PIT_PKG
C_ERROR - Level error, defined here to avoid dependency on PIT_PKG
C_DEFAULT_LANGUAGE - Sort sequence for the default language
*/
C_PIT_PARAMETER_GROUP constant varchar2(5) := 'PIT';
C_CONTEXT_PREFIX constant varchar2(30) := 'CONTEXT_';
C_TOGGLE_PREFIX constant varchar2(30) := 'TOGGLE_';
C_XLIFF_NS constant varchar2(100) := 'urn:oasis:names:tc:xliff:document:2.0';
C_DEL char(1 byte) := '|';
C_MIN_ERROR constant number := -20999;
C_MAX_ERROR constant number := -20000;
C_FATAL constant binary_integer := 20;
C_ERROR constant binary_integer := 30;
C_DEFAULT_LANGUAGE constant number := 10;
/**
Group: Private package variables
*/
/**
Variables: Package variables
g_predefined_errors - List of predefined errors found in existing packages
g_default_language - ORacle name of the default language
*/
g_predefined_errors predefined_error_t;
g_default_language pit_util.ora_name_type;
-- ERROR messages
C_ERROR_ALREADY_ASSIGNED constant varchar2(200) := 'This Oracle error number is already assigned to message #ERRNO#';
C_MESSAGE_DOES_NOT_EXIST constant varchar2(200) := 'Message #MESSAGE# does not exist.';
/**
Group: Generic helper methods
*/
/**
Procedure: initialize_error_list
Method to collect all predefined error names within the database.
Is called during package initiazation.
*/
procedure initialize_error_list
as
cursor predefined_errors_cur is
with errors as(
select type source_type, owner, name package_name,
upper(substr(text, instr(text, '(') + 1, instr(text, ')') - instr(text, '(') - 1)) init
from all_source a
where (owner in ('SYS') or owner like 'APEX%')
and upper(text) like '%PRAGMA EXCEPTION_INIT%'
-- Next to internal PIT packages, some packages don't adhere to Oracles error strategy. Filter them out!
and name not in ('PIT_ADMIN', 'PIT_UTIL', 'DBMS_BDSQL'))
select source_type, owner, package_name,
-- don't convert to numbers here as it's possible that conversion errors occur
to_number(trim(replace(substr(init, instr(init, ',') + 1), '''', '')), '99999') error_number,
trim(substr(init, 1, instr(init, ',') - 1)) error_name
from errors
where trim(substr(init, 1, instr(init, ',') - 1)) is not null;
l_predefined_error predefined_error_rec;
begin
if g_predefined_errors.count = 0 then
-- scan all_source view for predefined Oracle errors
for err in predefined_errors_cur loop
begin
l_predefined_error.source_type := err.source_type;
l_predefined_error.owner := err.owner;
l_predefined_error.package_name := err.package_name;
l_predefined_error.error_name := err.error_name;
g_predefined_errors(err.error_number) := l_predefined_error;
exception
when others then
dbms_output.put_line('Error when trying to convert error number ' || err.error_number);
end;
end loop;
end if;
end initialize_error_list;
/**
Procedure: check_error
Helper to check whether a predefined Oracle error is to be overwritten.
Is called whenever a new message is inserted into table MESSAGE with an Oracle error number.
The function checks whether the Oracle error number is already a named error, such as -1 and DUP_VAL_ON_INDEX.
If so, the procedure throws an error.
Limitation:
This procedure can only see Exceptions that are defined in packages from SYSTEM or SYS and only
exceptions from non wrapped sources.
Parameters:
p_pms_name - Name of the message to check the error for
p_pms_custom_error - Error number for which a PIT message shall be created
*/
procedure check_error(
p_pms_name in pit_message.pms_name%type,
p_pms_custom_error in pit_message.pms_custom_error%type)
as
l_predefined_error predefined_error_rec;
l_message varchar2(2000);
l_message_length binary_integer;
l_error_regexp varchar2(1000);
C_ERROR_REGEXP constant varchar2(100) := q'~^(#NAME#|#NAME#_ERR)$~';
C_MSG_TOO_LONG constant varchar2(200) :=
q'~Message "#MESSAGE#" must not exceed 26 chars but is #LENGTH#.~';
C_PREDEFINED_ERROR constant varchar2(200) :=
q'~Error number #ERROR# is a predefined Oracle error named #NAME# in #OWNER#.#PKG#. Please don't overwrite Oracle predefined errors.~';
begin
initialize_error_list;
l_message_length := length(p_pms_name);
if l_message_length > pit_util.c_max_length - 4 then
l_message := pit_util.bulk_replace(C_MSG_TOO_LONG, char_table(
'#MESSAGE#', p_pms_name,
'#LENGTH#', l_message_length));
raise_application_error(-20000, l_message);
end if;
if g_predefined_errors.exists(p_pms_custom_error) then
l_error_regexp := replace(C_ERROR_REGEXP, '#NAME#', p_pms_name);
if not regexp_like(g_predefined_errors(p_pms_custom_error).error_name, l_error_regexp) then
l_predefined_error := g_predefined_errors(p_pms_custom_error);
l_message := pit_util.bulk_replace(C_PREDEFINED_ERROR, char_table(
'#ERROR#', p_pms_custom_error,
'#NAME#', l_predefined_error.error_name,
'#OWNER#', l_predefined_error.owner,
'#PKG#', l_predefined_error.package_name));
raise_application_error(-20000, l_message);
end if;
end if;
end check_error;
/**
Function: get_export_group_script
Method to create a script snippet for ex- or importing a message group
Parameter:
p_pmg_name - Optional name of the message to create a script for. If NULL, all message groups are exported
Returns:
Script with a call to <merge_message_group> to import a message group or a list of message groups.
*/
function get_export_group_script(
p_pmg_name in pit_message_group.pmg_name%type)
return varchar2
as
cursor message_group_cur(
p_pmg_name in pit_message_group.pmg_name%type) is
select pmg_name, pmg_description
from pit_message_group pmg
where exists(
select null
from pit_message
where pms_pmg_name = pmg_name)
and pmg_name = p_pmg_name
or p_pmg_name is null
order by pmg_name;
c_merge_group_template constant varchar2(200) := q'~
pit_admin.merge_message_group(
p_pmg_name => '#NAME#',
p_pmg_description => q'^#DESCRIPTION#^');
~';
l_chunk pit_util.max_char;
begin
for pmg in message_group_cur(p_pmg_name) loop
l_chunk := l_chunk
|| pit_util.bulk_replace(c_merge_group_template, char_table(
'#NAME#', pmg.pmg_name,
'#DESCRIPTION#', pmg.pmg_description));
end loop;
return l_chunk;
end get_export_group_script;
/**
Procedure: script_messages
Helper method to generate a message install script. Is called internally by <create_installation_script>
Parameters:
p_pmg_name - Message group to filter output
p_file_name - Out parameter that provides the file name for the Script file
p_script - Out parameter that contains the SQL script created
*/
procedure script_messages(
p_pmg_name in pit_message_group.pmg_name%type,
p_file_name out nocopy pit_util.ora_name_type,
p_script out nocopy clob)
as
cursor message_cur(
p_pmg_name in pit_message_group.pmg_name%type) is
select m.*, rank() over (partition by pms_name order by pml_default_order) rang
from pit_message m
join pit_message_language ml
on m.pms_pml_name = ml.pml_name
where ml.pml_default_order > 0
and (m.pms_pmg_name = p_pmg_name
or p_pmg_name is null)
order by m.pms_name, ml.pml_default_order;
l_chunk pit_util.max_char;
C_START constant varchar2(200) := q'~begin
~';
C_END constant varchar2(200) := q'~
commit;
pit_admin.create_message_package;
end;
/~';
C_MERGE_TEMPLATE constant varchar2(1000) := q'~
pit_admin.merge_message(
p_pms_name => '#NAME#',
p_pms_pmg_name => '#GROUP#',
p_pms_text => q'^#TEXT#^',
p_pms_description => q'^#DESCRIPTION#^',
p_pms_pse_id => #PMS_PSE_ID#,
p_pms_pml_name => '#LANGUAGE#',
p_error_number => #ERRNO#);
~';
C_TRANSLATE_TEMPLATE constant varchar2(200) := q'~
pit_admin.translate_message(
p_pms_name => '#NAME#',
p_pms_text => q'^#TEXT#^',
p_pms_description => q'^#DESCRIPTION#^',
p_pms_pml_name => '#LANGUAGE#');
~';
begin
-- Initialize
p_file_name := 'MessageGroup_' || p_pmg_name || '.sql';
dbms_lob.createtemporary(p_script, false, dbms_lob.call);
pit_util.clob_append(p_script, C_START);
pit_util.clob_append(p_script, get_export_group_script(p_pmg_name));
for msg in message_cur(p_pmg_name) loop
case msg.rang
when 1 then
if l_chunk is not null then
pit_util.clob_append(p_script, l_chunk);
end if;
l_chunk := pit_util.bulk_replace(C_MERGE_TEMPLATE, char_table(
'#NAME#', msg.pms_name,
'#GROUP#', msg.pms_pmg_name,
'#TEXT#', msg.pms_text,
'#DESCRIPTION#', msg.pms_description,
'#PMS_PSE_ID#', to_char(msg.pms_pse_id),
'#LANGUAGE#', msg.pms_pml_name,
'#ERRNO#', coalesce(to_char(msg.pms_custom_error), 'null')));
else
l_chunk := l_chunk
|| pit_util.bulk_replace(C_TRANSLATE_TEMPLATE, char_table(
'#NAME#', msg.pms_name,
'#TEXT#', msg.pms_text,
'#DESCRIPTION#', msg.pms_description,
'#LANGUAGE#', msg.pms_pml_name));
end case;
end loop;
pit_util.clob_append(p_script, l_chunk);
pit_util.clob_append(p_script, C_END);
end script_messages;
/**
Procedure: script_translatable_items
Helper method to generate a translatable items install script. Is called internally by <create_installation_script>
Parameters:
p_pmg_name - Message group to filter output
p_file_name - Out parameter that provides the file name for the Script file
p_script - Out parameter that contains the SQL script created
*/
procedure script_translatable_items(
p_pmg_name in pit_message_group.pmg_name%type default null,
p_file_name out nocopy pit_util.ora_name_type,
p_script out nocopy clob)
as
cursor pti_cur(
p_pmg_name in pit_message_group.pmg_name%type) is
select i.*, rank() over (partition by pti_id order by pml_default_order) rang
from pit_translatable_item i
join pit_message_language ml
on i.pti_pml_name = ml.pml_name
where ml.pml_default_order > 0
and i.pti_pmg_name = p_pmg_name
order by i.pti_id, ml.pml_default_order;
l_chunk pit_util.max_char;
C_START constant varchar2(200) := q'~begin
~';
C_END constant varchar2(200) := q'~
commit;
end;
/~';
C_PTI_TEMPLATE constant varchar2(300) := q'~
pit_admin.merge_translatable_item(
p_pti_id => '#PTI_ID#',
p_pti_pml_name => q'^#PTI_PML_NAME#^',
p_pti_pmg_name => q'^#PTI_PMG_NAME#^',
p_pti_name => q'^#PTI_NAME#^',
p_pti_display_name => q'^#PTI_DISPLAY_NAME#^',
p_pti_description => q'^#PTI_DESCRIPTION_NAME#^'
);
~';
begin
-- Initialize
p_file_name := 'TranslatableItemGroup_' || p_pmg_name || '.sql';
dbms_lob.createtemporary(p_script, false, dbms_lob.call);
pit_util.clob_append(p_script, C_START);
pit_util.clob_append(p_script, get_export_group_script(p_pmg_name));
for pti in pti_cur(p_pmg_name) loop
l_chunk := pit_util.bulk_replace(C_PTI_TEMPLATE, char_table(
'#PTI_ID#', to_char(pti.pti_id),
'#PTI_PML_NAME#', pti.pti_pml_name,
'#PTI_PMG_NAME#', pti.pti_pmg_name,
'#PTI_NAME#', pti.pti_name,
'#PTI_DISPLAY_NAME#', pti.pti_display_name,
'#PTI_DESCRIPTION_NAME#', pti.pti_description
));
pit_util.clob_append(p_script, l_chunk);
end loop;
pit_util.clob_append(p_script, C_END);
end script_translatable_items;
/**
Procedure: analyze_xliff
Method to extract language and group from an XLIFF envelope. Is used to extract information from an XLIFF header.
Parameters:
p_xliff - XLIFF instance
p_pml_name - Language name converted to Oracle language name
p_pmg_name - Group name
*/
procedure analyze_xliff(
p_xliff xmltype,
p_pml_name out nocopy pit_message_language.pml_name%type,
p_pmg_name out nocopy pit_message_group.pmg_name%type)
as
begin
select utl_i18n.map_language_from_iso(pml_name), pmg_name
into p_pml_name, p_pmg_name
from xmltable(
xmlnamespaces(default 'urn:oasis:names:tc:xliff:document:2.0'),
'/xliff'
passing p_xliff
columns
pml_name varchar2(128 byte) path '@trgLang',
pmg_name varchar2(128 byte) path 'file/@id');
end analyze_xliff;
/**
Procedure: translate_messages.
Helper method to extract XLIFF instance into <PIT_MESSAGE>. Is called internally by <apply_translations>.
Parameter:
p_xliff - XLIFF instance to apply
*/
procedure translate_messages(
p_xliff in xmltype)
as
l_pml_name pit_message_language.pml_name%type;
l_pmg_name pit_message_group.pmg_name%type;
begin
analyze_xliff(p_xliff, l_pml_name, l_pmg_name);
merge into pit_message t
using (select d.pms_name as pms_name,
l_pml_name pms_pml_name,
l_pmg_name pms_pmg_name,
-- if only description is translated, get orginal text to avoid NOT NULL constraint error
coalesce(d.text_translation,
(select pms_text
from pit_message o
where o.pms_name = d.pms_name
and o.pms_pml_name = g_default_language)) as pms_text,
d.description_translation as pms_description,
m.pms_pse_id,
m.pms_custom_error
from xmltable(
xmlnamespaces(default 'urn:oasis:names:tc:xliff:document:2.0'),
'/xliff/file/unit'
passing p_xliff
columns
pms_name varchar2(128 byte) path '@id',
text_translation clob path 'segment[@id="TEXT"]/target',
description_translation clob path 'segment[@id="DESC"]/target') d
left join pit_message m
on m.pms_name = d.pms_name
and m.pms_pml_name = l_pml_name
where d.text_translation || d.description_translation is not null) s
on (t.pms_name = s.pms_name
and t.pms_pml_name = s.pms_pml_name)
when matched then update set
t.pms_text = s.pms_text,
t.pms_description = s.pms_description
when not matched then insert
(pms_name, pms_pml_name, pms_pmg_name, pms_text,
pms_description, pms_pse_id, pms_custom_error)
values
(s.pms_name, s.pms_pml_name, s.pms_pmg_name, s.pms_text,
s.pms_description, s.pms_pse_id, s.pms_custom_error);
update pit_message_language
set pml_default_order = greatest(pml_default_order, 50)
where pml_name = l_pml_name;
commit;
exception
when others then
rollback;
raise;
end translate_messages;
/**
Procedure: translate_translatable_items
Helper method to extract XLIFF instance into <PIT_TRANSLATABLE_ITEM>. Is called internally by <apply_translations>.
Parameter
p_xliff - XLIFF instance to apply
*/
procedure translate_translatable_items(
p_xliff in xmltype)
as
l_pml_name pit_message_language.pml_name%type;
l_pmg_name pit_message_group.pmg_name%type;
begin
analyze_xliff(p_xliff, l_pml_name, l_pmg_name);
merge into pit_translatable_item t
using (select pti_id,
l_pml_name pti_pml_name,
l_pmg_name pti_pmg_name,
pti_name,
pti_display_name,
pti_description
from xmltable(
xmlnamespaces(default 'urn:oasis:names:tc:xliff:document:2.0'),
'/xliff/file/unit'
passing p_xliff
columns
pti_id varchar2(128 byte) path '@id',
pti_name clob path 'segment[@id="NAME"]/target',
pti_display_name clob path 'segment[@id="DISP"]/target',
pti_description clob path 'segment[@id="DESC"]/target')) s
on (t.pti_id = s.pti_id
and t.pti_pml_name = s.pti_pml_name)
when matched then update set
t.pti_name = s.pti_name,
t.pti_display_name = s.pti_display_name,
t.pti_description = s.pti_description
when not matched then insert
(pti_id, pti_pml_name, pti_pmg_name,
pti_name, pti_display_name, pti_description)
values
(s.pti_id, s.pti_pml_name, s.pti_pmg_name,
s.pti_name, s.pti_display_name, s.pti_description);
commit;
exception
when others then
rollback;
raise;
end translate_translatable_items;
/**
Function: get_pms_xml
Help method to generate XLIFF compatible translation entries for messages.
<Is called internally by get_translation_xml> to allow for different target types.
Parameters:
p_target_language - Language to translate the messages to
p_pmg_name - Message group to tranlsate
Returns:
XML fragment to incorporate into an XLIFF envelope generated by <get_translation_xml>
*/
function get_pms_xml(
p_target_language in pit_message_language.pml_name%type,
p_pmg_name in pit_message_group.pmg_name%type default null)
return xmltype
as
l_xml xmltype;
begin
with messages as(
select pms_name,
-- pivot test and description to source and target columns
max(
decode(
pms_pml_name,
g_default_language, to_char(pms_text))) source_text,
max(
decode(
pms_pml_name,
p_target_language, to_char(pms_text))) target_text,
max(
decode(
pms_pml_name,
g_default_language, to_char(pms_description))) source_description,
max(
decode(
pms_pml_name,
p_target_language, to_char(pms_description))) target_description
from pit_message m
where pms_pmg_name = p_pmg_name
and pms_pml_name in (g_default_language, p_target_language)
group by pms_name)
select xmlagg(
xmlelement("unit",
xmlattributes(
pms_name "id"),
xmlelement("segment",
xmlattributes(
'TEXT' "id"),
xmlforest(
source_text "source",
target_text "target"
)
),
case when source_description is not null then
xmlelement("segment",
xmlattributes(
'DESC' "id"),
xmlforest(
source_description "source",
target_description "target"
)
)
end
)
)
into l_xml
from messages;
return l_xml;
end get_pms_xml;
/**
Function: get_pti_xml
Help method to generate XLIFF compatible translation entries for translatable items.
Is called internally by <get_translation_xml> to allow for different target types.
Parameters:
p_target_language - Language to translate the translatable items to
p_pmg_name - Translatable items group to tranlsate
Returns:
XML fragment to incorporate into an XLIFF envelope generated by <get_translation_xml>
*/
function get_pti_xml(
p_target_language in pit_message_language.pml_name%type,
p_pmg_name in pit_message_group.pmg_name%type default null)
return xmltype
as
l_xml xmltype;
begin
with messages as(
select pti_id,
-- pivot test and description to source and target columns
max(
decode(
pti_pml_name,
g_default_language, to_char(pti_name))) source_name,
max(
decode(
pti_pml_name,
p_target_language, to_char(pti_name))) target_name,
max(
decode(
pti_pml_name,
g_default_language, to_char(pti_display_name))) source_display_name,
max(
decode(
pti_pml_name,
p_target_language, to_char(pti_display_name))) target_display_name,
max(
decode(
pti_pml_name,
g_default_language, to_char(pti_description))) source_description,
max(
decode(
pti_pml_name,
p_target_language, to_char(pti_description))) target_description
from pit_translatable_item i
where pti_pmg_name = p_pmg_name
and pti_pml_name in (g_default_language, p_target_language)
group by pti_id)
select xmlagg(
xmlelement("unit",
xmlattributes(
pti_id "id"),
xmlelement("segment",
xmlattributes(
'NAME' "id"),
xmlforest(
source_name "source",
target_name "target"
)
),
xmlelement("segment",
xmlattributes(
'DISP' "id"),
xmlforest(
source_display_name "source",
target_display_name "target"
)
),
case when source_description is not null then
xmlelement("segment",
xmlattributes(
'DESC' "id"),
xmlforest(
source_description "source",
target_description "target"
)
)
end
)
)
into l_xml
from messages;
return l_xml;
end get_pti_xml;
/**
Procedure: initialize
Initialization procedure.
Called internally. It has the following functionality:
- Read all predefined oracle errors from the oracle packages
- Read default language
*/
procedure initialize
as
begin
-- Read default language
select pml_name default_language
into g_default_language
from pit_message_language
where pml_default_order > 0
order by pml_default_order
fetch first 1 rows only;
end initialize;
/**
Group: Public administration methods
*/
/**
Procedure: set_language_settings
See <PIT_ADMIN.set_language_settings>
*/
procedure set_language_settings(
p_pml_list in pit_util.max_sql_char)
as
l_pml_list args;
l_pml_default_order pit_message_language.pml_default_order%type;
begin
update pit_message_language
set pml_default_order = 0
where pml_default_order != C_DEFAULT_LANGUAGE;
if p_pml_list is not null then
l_pml_list := pit_util.string_to_table(p_pml_list);
l_pml_default_order := (l_pml_list.count + 1) * 10;
for i in l_pml_list.first .. l_pml_list.last loop
update pit_message_language
set pml_default_order = l_pml_default_order
where pml_name = l_pml_list(i);
l_pml_default_order := l_pml_default_order - 10;
end loop;
end if;
end set_language_settings;
/**
Procedure: create_message_package
See <PIT_ADMIN.create_message_package>
*/
procedure create_message_package (
p_directory varchar2 default null)
as
C_PACKAGE_NAME constant varchar2(30) := 'msg';
C_R constant varchar2(2) := chr(10);
l_sql_text clob := 'create or replace package ' || C_PACKAGE_NAME || ' as' || C_R || ' /** Generated package to provide message constants and exceptions*/' || C_R;
l_constant_template varchar2(200) :=
q'~ #CONSTANT# constant pit_util.ora_name_type := '#CONSTANT#';~' || C_R;
l_exception_template varchar2(200) :=
' #ERROR_NAME# exception;' || C_R;
l_pragma_template varchar2(200) :=
' pragma exception_init(#ERROR_NAME#, #ERROR#);' || C_R;
l_end_clause varchar2(20) := 'end ' || C_PACKAGE_NAME || ';';
l_constants clob := C_R || ' -- CONSTANTS:' || C_R;
l_exceptions clob := C_R || ' -- EXCEPTIONS:' || C_R;
l_pragmas clob := C_R || ' -- EXCEPTION INIT:' || C_R;
cursor message_cur is
with messages as(
select pms_name,
case pms_custom_error when C_MAX_ERROR then pms_active_error else pms_custom_error end pms_custom_error
from pit_message m
where pms_pml_name = g_default_language)
select replace(l_constant_template, '#CONSTANT#', pms_name) constant_chunk,
case when pms_custom_error is not null then
replace (l_exception_template, '#ERROR_NAME#', pit_util.get_error_name(pms_name))
else null end exception_chunk,
case when pms_custom_error is not null then
replace(replace(l_pragma_template, '#ERROR_NAME#', pit_util.get_error_name(pms_name)), '#ERROR#', pms_custom_error)
else null end pragma_chunk
from messages
order by pms_name;
begin
-- persist active error numbers for all errors in message table
merge into pit_message m
using (select pms_name, pms_pml_name, C_MIN_ERROR - 1 + dense_rank() over (order by pms_name) pms_active_error
from pit_message
where pms_pse_id <= 30) v
on (m.pms_name = v.pms_name
and m.pms_pml_name = v.pms_pml_name)
when matched then update set
pms_active_error = v.pms_active_error;
commit;
-- create package code
for msg in message_cur loop
pit_util.clob_append(l_constants, msg.constant_chunk);
pit_util.clob_append(l_exceptions, msg.exception_chunk);
pit_util.clob_append(l_pragmas, msg.pragma_chunk);
end loop;
pit_util.clob_append(l_sql_text, l_constants);
pit_util.clob_append(l_sql_text, l_exceptions);
pit_util.clob_append(l_sql_text, l_pragmas);
pit_util.clob_append(l_sql_text, l_end_clause);
if p_directory is not null then
dbms_xslprocessor.clob2file(l_sql_text, p_directory, C_PACKAGE_NAME || '.pkg');
else
execute immediate l_sql_text;
end if;
end create_message_package;
/**
Function: get_message_text
See <PIT_ADMIN.get_message_text>
*/
function get_message_text(
p_pms_name in pit_message.pms_name%type,
p_pms_pml_name in pit_message_language.pml_name%type := null)
return varchar2
as
l_pms_text pit_message.pms_text%type;
begin
select pms_text
into l_pms_text
from (select pms_text, pms_pse_id,
rank() over (order by pml_default_order desc) ranking
from pit_message
join pit_message_language_v on pms_pml_name = pml_name
where pms_name = coalesce(p_pms_name, g_default_language))
where ranking = 1;
return l_pms_text;
exception
when no_data_found then
return null;
end get_message_text;
/**
Group: Public message maintenance methods
*/
/**
Procedure: validate_message_group
See <PIT_ADMIN.validate_message_group>
*/
procedure validate_message_group(
p_row in pit_message_group%rowtype)
as
begin
null;
end validate_message_group;
/**
Procedure: merge_message_group
See <PIT_ADMIN.merge_message_group>
*/
procedure merge_message_group(
p_pmg_name in pit_message_group.pmg_name%type,
p_pmg_description in pit_message_group.pmg_description%type default null)
as
l_row pit_message_group%rowtype;
begin
l_row.pmg_name := p_pmg_name;
l_row.pmg_description := p_pmg_description;
merge_message_group(l_row);
end merge_message_group;
/**
Procedure: merge_message_group
See <PIT_ADMIN.merge_message_group>
*/
procedure merge_message_group(
p_row in out nocopy pit_message_group%rowtype)
as
begin
-- Initialization
p_row.pmg_name := pit_util.harmonize_sql_name(p_row.pmg_name);
validate_message_group(p_row);
merge into pit_message_group t
using (select p_row.pmg_name pmg_name,
p_row.pmg_description pmg_description
from dual) s
on (t.pmg_name = s.pmg_name)
when matched then update set
pmg_description = s.pmg_description
when not matched then insert(pmg_name, pmg_description)
values(s.pmg_name, s.pmg_description);
end merge_message_group;
/**
Procedure: delete_message_group
See <PIT_ADMIN.delete_message_group>
*/
procedure delete_message_group(
p_pmg_name in pit_message_group.pmg_name%type,
p_force in boolean default false)
as
begin
if p_force then
delete from pit_message
where pms_pmg_name = p_pmg_name;
delete from pit_translatable_item
where pti_pmg_name = p_pmg_name;
end if;
delete from pit_message_group
where pmg_name = p_pmg_name;
end delete_message_group;
/**
Procedure: validate_message
See <PIT_ADMIN.validate_message>
*/
procedure validate_message(
p_row in out nocopy pit_message%rowtype)
as
begin
case
when p_row.pms_pse_id in (C_FATAL, C_ERROR) and p_row.pms_custom_error not between C_MIN_ERROR and C_MAX_ERROR then
check_error(p_row.pms_name, p_row.pms_custom_error);
when p_row.pms_pse_id in (C_FATAL, C_ERROR) then
p_row.pms_custom_error := C_MAX_ERROR;
else
null;
end case;
end validate_message;
/**
Procedure: merge_message
See <PIT_ADMIN.merge_message>
*/
procedure merge_message(
p_pms_name in pit_message.pms_name%type,
p_pms_text in pit_message.pms_text%type,
p_pms_pse_id in pit_message.pms_pse_id%type,
p_pms_description in pit_message.pms_description%type default null,
p_pms_pmg_name in pit_message_group.pmg_name%type default null,
p_pms_pml_name in pit_message_language.pml_name%type default null,
p_error_number in pit_message.pms_custom_error%type default null)
as
l_row pit_message%rowtype;
begin
l_row.pms_name := p_pms_name;
l_row.pms_text := p_pms_text;
l_row.pms_pse_id := p_pms_pse_id;
l_row.pms_description := p_pms_description;
l_row.pms_pmg_name := p_pms_pmg_name;
l_row.pms_pml_name := p_pms_pml_name;
l_row.pms_custom_error := p_error_number;
merge_message(l_row);
end merge_message;
/**
Procedure: merge_message
See <PIT_ADMIN.merge_message>
*/
procedure merge_message(
p_row in out nocopy pit_message%rowtype)
as
begin
-- Initialization
p_row.pms_name := pit_util.harmonize_sql_name(p_row.pms_name);
validate_message(p_row);
merge into pit_message t
using (select p_row.pms_name pms_name,
upper(coalesce(p_row.pms_pml_name, g_default_language)) pms_pml_name,
upper(p_row.pms_pmg_name) pms_pmg_name,
p_row.pms_text pms_text,
p_row.pms_description pms_description,
p_row.pms_pse_id pms_pse_id,
p_row.pms_custom_error pms_custom_error
from dual) s
on (t.pms_name = s.pms_name and t.pms_pml_name = s.pms_pml_name)
when matched then update set
t.pms_pmg_name = s.pms_pmg_name,
t.pms_text = s.pms_text,
t.pms_description = s.pms_description,
t.pms_pse_id = s.pms_pse_id,
t.pms_custom_error = s.pms_custom_error
when not matched then insert
(pms_name, pms_pmg_name, pms_pml_name, pms_text, pms_description, pms_pse_id, pms_custom_error)
values
(s.pms_name, s.pms_pmg_name, s.pms_pml_name, s.pms_text, s.pms_description, s.pms_pse_id, s.pms_custom_error);
commit;
exception
when dup_val_on_index then
-- DUP_VAL_ON_INDEX may occur if a user tries to assign a custom error number twice
select pms_name
into p_row.pms_name
from pit_message
where pms_custom_error = p_row.pms_custom_error
and rownum = 1;
rollback;
raise_application_error(C_MAX_ERROR, replace(C_ERROR_ALREADY_ASSIGNED, '#ERRNO#', p_row.pms_name));
when others then
rollback;
raise;
end merge_message;
/**
Procedure: delete_message
See <PIT_ADMIN.delete_message>
*/
procedure delete_message(
p_pms_name in pit_message.pms_name%type,
p_pms_pml_name in pit_message_language.pml_name%type)
as
begin
delete from pit_message
where pms_name = upper(p_pms_name)
and (pms_pml_name = upper(p_pms_pml_name)
or p_pms_pml_name is null);
end delete_message;
/**
Procedure: delete_all_messages
See <PIT_ADMIN.delete_all_messages>
*/
procedure delete_all_messages(
p_pmg_name in pit_message_group.pmg_name%type default null)
as
begin
delete from pit_message
where pms_pmg_name = p_pmg_name
or p_pmg_name is null;
end delete_all_messages;
/**
Procedure: translate_message
See <PIT_ADMIN.translate_message>
*/
procedure translate_message(
p_pms_name in pit_message.pms_name%type,
p_pms_text in pit_message.pms_text%type,
p_pms_pml_name in pit_message_language.pml_name%type,
p_pms_description in pit_message.pms_description%type default null)
as
l_pms_pse_id pit_message.pms_pse_id%type;
l_error_number pit_message.pms_custom_error%type;
begin
select pms_pse_id, pms_custom_error
into l_pms_pse_id, l_error_number
from pit_message
where pms_name = p_pms_name
and pms_pml_name = g_default_language;
merge_message(
p_pms_name => p_pms_name,
p_pms_text => p_pms_text,
p_pms_description => p_pms_description,
p_pms_pse_id => l_pms_pse_id,
p_pms_pml_name => p_pms_pml_name,
p_error_number => l_error_number);
exception
when no_data_found then
raise_application_error(C_MAX_ERROR, replace(C_MESSAGE_DOES_NOT_EXIST, '#MESSAGE#', p_pms_name));
end translate_message;
/**
Group: Public translatable items maintenance methods
*/
/**
Procedure: validate_translatable_item
See <PIT_ADMIN.validate_translatable_item>
*/
procedure validate_translatable_item(
p_row in pit_translatable_item%rowtype)
as
begin
null;
end validate_translatable_item;
/**
Procedure: merge_translatable_item
See <PIT_ADMIN.merge_translatable_item>
*/
procedure merge_translatable_item(
p_row in out nocopy pit_translatable_item%rowtype)
as
begin
-- Initialize
p_row.pti_id := pit_util.harmonize_sql_name(p_row.pti_id);
validate_translatable_item(p_row);
merge into pit_translatable_item t
using (select p_row.pti_id pti_id,
coalesce(p_row.pti_pml_name, g_default_language) pti_pml_name,
p_row.pti_pmg_name pti_pmg_name,
p_row.pti_name pti_name,
p_row.pti_display_name pti_display_name,
p_row.pti_description pti_description
from dual) s
on (t.pti_id = s.pti_id
and t.pti_pml_name = s.pti_pml_name)
when matched then update set
t.pti_pmg_name = s.pti_pmg_name,
t.pti_name = s.pti_name,
t.pti_display_name = s.pti_display_name,
t.pti_description = s.pti_description
when not matched then insert(pti_id, pti_pmg_name, pti_pml_name, pti_name, pti_display_name, pti_description)
values(s.pti_id, s.pti_pmg_name, s.pti_pml_name, s.pti_name, s.pti_display_name, s.pti_description);
end merge_translatable_item;
/**
Procedure: merge_translatable_item
See <PIT_ADMIN.merge_translatable_item>
*/
procedure merge_translatable_item(
p_pti_id in pit_translatable_item.pti_id%type,
p_pti_pml_name in pit_message_language.pml_name%type,
p_pti_pmg_name in pit_message_group.pmg_name%type,
p_pti_name in pit_translatable_item.pti_name%type,
p_pti_display_name pit_translatable_item.pti_display_name%type default null,
p_pti_description pit_translatable_item.pti_description%type default null)
as
l_row pit_translatable_item%rowtype;
begin
l_row.pti_id := p_pti_id;
l_row.pti_pml_name := p_pti_pml_name;
l_row.pti_pmg_name := p_pti_pmg_name;
l_row.pti_name := p_pti_name;
l_row.pti_display_name := p_pti_display_name;
l_row.pti_description := p_pti_description;
merge_translatable_item(l_row);
end merge_translatable_item;
/**
Procedure: delete_translatable_item
See <PIT_ADMIN.delete_translatable_item>
*/
procedure delete_translatable_item(
p_pti_id in pit_translatable_item.pti_id%type)
as
begin
delete from pit_translatable_item
where pti_id = p_pti_id;
end delete_translatable_item;
/**
Group: Public context maintenanace methods
*/
/**
Procedure: create_context_toggle
See <PIT_ADMIN.create_context_toggle>
*/
procedure create_context_toggle(
p_toggle_name in varchar2,
p_module_list in varchar2,
p_context_name in varchar2,
p_comment in varchar2 default null)
as
l_toggle_name pit_util.ora_name_type;
l_context_name pit_util.ora_name_type;
begin
pit_util.check_toggle_settings(p_toggle_name, p_module_list, p_context_name);
-- Create parameter
l_toggle_name := pit_util.harmonize_name(C_TOGGLE_PREFIX, p_toggle_name);
l_context_name := replace(p_context_name, C_CONTEXT_PREFIX);
param_admin.edit_parameter(
p_par_id => l_toggle_name,
p_par_pgr_id => C_PIT_PARAMETER_GROUP,
p_par_description => p_comment,
p_par_string_value => upper(p_module_list || C_DEL || l_context_name));
end create_context_toggle;
/**
Procedure: delete_context_toggle
See <PIT_ADMIN.delete_context_toggle>
*/
procedure delete_context_toggle(
p_toggle_name in varchar2)
as
begin
param_admin.delete_parameter(
p_par_id => C_TOGGLE_PREFIX || replace(upper(p_toggle_name), C_TOGGLE_PREFIX),
p_par_pgr_id => C_PIT_PARAMETER_GROUP);
end delete_context_toggle;
/**
Procedure: create_named_context
See <PIT_ADMIN.create_named_context>
*/
procedure create_named_context(
p_context_name in varchar2,
p_log_level in number,
p_trace_level in number,
p_trace_timing in boolean,
p_module_list in varchar2,
p_comment in varchar2 default null)
as
l_trace_timing pit_util.flag_type;
l_settings pit_util.max_sql_char;
begin
l_trace_timing := case when p_trace_timing then pit_util.C_TRUE else pit_util.C_FALSE end;
l_settings := pit_util.concatenate(
p_chunk_list => char_table(p_log_level, p_trace_level, l_trace_timing, p_module_list),
p_delimiter => C_DEL);
create_named_context(
p_context_name => p_context_name,
p_settings => l_settings,
p_comment => p_comment);
end create_named_context;
/**
Procedure: create_named_context
See <PIT_ADMIN.create_named_context>
*/
procedure create_named_context(
p_context_name in varchar2,
p_settings in varchar2,
p_comment in varchar2 default null)
as
c_standard_comment constant varchar2(200) := ' [LOG_LEVEL|TRACE_LEVEL|TRACE_TIMING_FLAG (Y,N)|MODULE_LIST]';
begin
pit_util.check_context_settings(
p_context_name => p_context_name,
p_settings => p_settings);
-- Create parameter
param_admin.edit_parameter(
p_par_id => pit_util.harmonize_name(C_CONTEXT_PREFIX, p_context_name),
p_par_pgr_id => C_PIT_PARAMETER_GROUP,
p_par_description => replace(p_comment, c_standard_comment) || c_standard_comment,
p_par_string_value => upper(p_settings));
end create_named_context;
/**
Procedure: delete_named_context
See <PIT_ADMIN.delete_named_context>
*/
procedure delete_named_context(
p_context_name in varchar2)
as
begin
param_admin.delete_parameter(
p_par_id => C_CONTEXT_PREFIX || replace(upper(p_context_name), C_CONTEXT_PREFIX),
p_par_pgr_id => C_PIT_PARAMETER_GROUP);
end delete_named_context;
/**
Group: Public export and translation methods
*/
/**
Procedure: create_installation_script
See <PIT_ADMIN.create_installation_script>
*/
procedure create_installation_script(
p_pmg_name in pit_message_group.pmg_name%type,
p_target in varchar2,
p_file_name out nocopy pit_util.ora_name_type,
p_script out nocopy clob)
as
begin
case p_target
when C_TARGET_PMS then
script_messages(p_pmg_name, p_file_name, p_script);
when C_TARGET_PTI then
script_translatable_items(p_pmg_name, p_file_name, p_script);
when C_TARGET_PAR then
p_script := param_admin.export_parameter_group(p_pmg_name);
p_file_name := 'ParameterGroup_' || p_pmg_name || '.sql';
else
null;
end case;
end create_installation_script;
/**
Function: get_installation_script
See <PIT_ADMIN.get_installation_script>
*/
function get_installation_script(
p_pmg_name in pit_message_group.pmg_name%type,
p_target in varchar2)
return clob
as
l_script clob;
l_file_name pit_util.ora_name_type;
begin
create_installation_script(
p_pmg_name => p_pmg_name,
p_target => p_target,
p_file_name => l_file_name,
p_script => l_script);
return l_script;
end get_installation_script;
/**
Procedure: create_translation_xml
See <PIT_ADMIN.create_translation_xml>
*/
procedure create_translation_xml(
p_target_language in pit_message_language.pml_name%type,
p_pmg_name in pit_message_group.pmg_name%type default null,
p_target in varchar2,
p_file_name out nocopy pit_util.ora_name_type,
p_xliff out nocopy xmltype)
as
begin
case p_target
when C_TARGET_PMS then
p_file_name := 'MessageTranslation_' || p_pmg_name || '_to_' || p_target_language || '.xlf';
p_xliff := get_pms_xml(p_target_language, p_pmg_name);
when C_TARGET_PTI then
p_file_name := 'TranslatableItemsTranslation_' || p_pmg_name || '_to_' || p_target_language || '.xlf';
p_xliff := get_pti_xml(p_target_language, p_pmg_name);
else
null;
end case;
-- Wrap xml in XLIFF envelope
with params as(
select replace(utl_i18n.map_locale_to_iso(g_default_language, null), '_', '-') source_iso_language,
replace(utl_i18n.map_locale_to_iso(p_target_language, null), '_', '-') target_iso_language,
g_default_language source_language,
p_target_language target_language,
C_XLIFF_NS xmlns,
p_file_name file_name,
p_pmg_name pmg_name
from dual)
select xmlroot(
xmlelement("xliff",
xmlattributes(
'2.0' "version",
xmlns "xmlns",
source_iso_language "srcLang",
target_iso_language "trgLang"
),
xmlelement("file",
xmlattributes(
file_name "original",
pmg_name "id"
),
p_xliff
)
),
version '1.0', standalone yes
)
into p_xliff
from params;
end create_translation_xml;
/**
Function: get_translation_xml
See <PIT_ADMIN.get_translation_xml>
*/
function get_translation_xml(
p_target_language in pit_message_language.pml_name%type,
p_pmg_name in pit_message_group.pmg_name%type default null,
p_target in varchar2)
return clob
as
l_xliff xmltype;
l_file_name pit_util.ora_name_type;
begin
create_translation_xml(
p_target_language => p_target_language,
p_pmg_name => p_pmg_name,
p_target => p_target,
p_file_name => l_file_name,
p_xliff => l_xliff);
return l_xliff.getClobVal();
end get_translation_xml;
/**
Procedure: apply_translation
See <PIT_ADMIN.apply_translation>
*/
procedure apply_translation(
p_xliff in xmltype,
p_target in varchar2)
as
begin
case p_target
when C_TARGET_PMS then
translate_messages(p_xliff);
when C_TARGET_PTI then
translate_translatable_items(p_xliff);
else
null;
end case;
end apply_translation;
/**
Procedure: delete_translation
See <PIT_ADMIN.delete_translation>
*/
procedure delete_translation(
p_pml_name in pit_message_language.pml_name%type,
p_target in varchar2)
as
begin
case p_target
when C_TARGET_PMS then
delete from pit_message
where pms_pml_name = upper(p_pml_name);
when C_TARGET_PTI then
delete from pit_translatable_item
where pti_pml_name = upper(p_pml_name);
else
null;
end case;
end delete_translation;
/**
Procedure: register_translation
See <PIT_ADMIN.register_translation>
*/
procedure register_translation(
p_pml_name in pit_message_language.pml_name%type)
as
begin
update pit_message_language
set pml_default_order = 50
where pml_name = p_pml_name
and pml_default_order = 0;
end register_translation;
begin
initialize;
end pit_admin;
/
|
<reponame>jdkoren/sqlite-parser
-- auth.test
--
-- execsql {
-- DROP TABLE tx;
-- DELETE FROM t2 WHERE a=1 AND b=2 AND c=3;
-- SELECT name FROM sqlite_master;
-- }
DROP TABLE tx;
DELETE FROM t2 WHERE a=1 AND b=2 AND c=3;
SELECT name FROM sqlite_master; |
ALTER TABLE project ADD COLUMN owner uuid NOT NULL;
|
UPDATE creature_template SET ScriptName='npc_deathstalker_faerleia' WHERE entry=2058;
|
<gh_stars>0
-- packages/acs-events/sql/timespan-drop.sql
--
-- $Id: timespan-drop.sql,v 1.4 2015/12/04 13:50:03 cvs Exp $
drop package timespan;
drop index timespans_idx;
drop table timespans;
drop package time_interval;
drop table time_intervals;
drop sequence timespan_seq;
|
BEGIN
BEGIN TRY
BEGIN TRANSACTION
declare @@StudentUsi int = 13727; --Student Usi
declare @@ParentUsi int = null;
delete edfi.[Grade] where StudentUSI = @@StudentUsi;
delete edfi.[StudentGradebookEntry] where StudentUsi = @@StudentUsi;
delete edfi.[StudentSectionAssociation] where StudentUSI = @@StudentUsi;
delete edfi.[StudentSchoolAttendanceEvent] where StudentUsi = @@StudentUsi;
delete edfi.[StudentEducationOrganizationAssociationRace] where StudentUsi = @@StudentUsi;
delete edfi.[StudentEducationOrganizationAssociationTelephone] where StudentUsi = @@StudentUsi;
delete edfi.[StudentEducationOrganizationAssociationElectronicMail] where StudentUsi = @@StudentUsi;
delete edfi.[StudentEducationOrganizationAssociation] where StudentUsi = @@StudentUsi;
delete edfi.[StudentDisciplineIncidentAssociation] where StudentUsi = @@StudentUsi;
select @@ParentUsi = ParentUsi from edfi.StudentParentAssociation where StudentUSi = @@StudentUsi;
delete edfi.[ParentElectronicMail] where ParentUsi = @@ParentUsi;
delete edfi.[ParentAddress] where ParentUsi = @@ParentUsi;
delete edfi.[StudentParentAssociation] where StudentUsi = @@StudentUsi;
delete edfi.[Parent] where ParentUsi = @@ParentUsi;
delete edfi.[StudentSchoolAssociation] where StudentUsi = @@StudentUsi;
delete edfi.[Student] where StudentUsi = @@StudentUsi;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION;
DECLARE @Message nvarchar(2048) = ERROR_MESSAGE();
DECLARE @Severity integer = ERROR_SEVERITY();
DECLARE @State integer = ERROR_STATE();
RAISERROR(@Message, @Severity, @State);
END CATCH;
END;
|
select * from reserva
where fecha_entrada between :fecha_entrada1 and :fecha_entrada2 |
-- MariaDB dump 10.17 Distrib 10.5.5-MariaDB, for osx10.15 (x86_64)
--
-- Host: 172.16.31.10 Database: prometeo
-- ------------------------------------------------------
-- Server version 10.3.23-MariaDB-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 utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Current Database: `prometeo`
--
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `prometeo` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `prometeo`;
--
-- Table structure for table `event_types`
--
DROP TABLE IF EXISTS `event_types`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `event_types` (
`event_type` int(11) NOT NULL,
`event_description` varchar(20) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`event_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `events`
--
DROP TABLE IF EXISTS `events`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `events` (
`event_internal_id` int(11) NOT NULL AUTO_INCREMENT,
`event_code` varchar(20) DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`event_type` int(11) DEFAULT NULL,
`fuel_type` int(11) DEFAULT NULL,
`event_date` date DEFAULT NULL,
`init_time` time DEFAULT NULL,
`end_time` time DEFAULT NULL,
`extra_info` varchar(200) DEFAULT NULL,
`location` point DEFAULT NULL,
`deleted_at` varchar(45) DEFAULT NULL,
PRIMARY KEY (`event_internal_id`),
KEY `fk_event_type_idx` (`event_type`),
KEY `fk_event_type_idx1` (`fuel_type`),
KEY `fk_status_idx` (`status`),
CONSTRAINT `fk_event_type` FOREIGN KEY (`event_type`) REFERENCES `event_types` (`event_type`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_fuel_type` FOREIGN KEY (`fuel_type`) REFERENCES `fuel_types` (`fuel_type`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_status` FOREIGN KEY (`status`) REFERENCES `status` (`statusid`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `events_firefighters_devices`
--
DROP TABLE IF EXISTS `events_firefighters_devices`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `events_firefighters_devices` (
`event_internal_id` int(11) NOT NULL,
`firefighter_id` int(11) NOT NULL,
`IntSensorID` int(11) NOT NULL,
PRIMARY KEY (`event_internal_id`,`firefighter_id`,`IntSensorID`),
KEY `fk_firefighters_idx` (`firefighter_id`),
KEY `fk_sensors_idx` (`IntSensorID`),
CONSTRAINT `fk_events` FOREIGN KEY (`event_internal_id`) REFERENCES `events` (`event_internal_id`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `fk_firefighters` FOREIGN KEY (`firefighter_id`) REFERENCES `firefighters` (`firefighter_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_sensors` FOREIGN KEY (`IntSensorID`) REFERENCES `sensors` (`IntSensorID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `feedback`
--
DROP TABLE IF EXISTS `feedback`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `feedback` (
`firefighter_id` int(11) NOT NULL,
`fire_id` int(11) NOT NULL,
`answer1` int(11) DEFAULT NULL,
`answer2` int(11) DEFAULT NULL,
`answer3` int(11) DEFAULT NULL,
`answer4` int(11) DEFAULT NULL,
`deleted_at` varchar(45) DEFAULT NULL,
PRIMARY KEY (`firefighter_id`,`fire_id`),
CONSTRAINT `feedback_ibfk_2` FOREIGN KEY (`firefighter_id`) REFERENCES `firefighters` (`firefighter_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `firefighter_sensor_log`
--
DROP TABLE IF EXISTS `firefighter_sensor_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `firefighter_sensor_log` (
`timestamp_mins` timestamp NOT NULL,
`firefighter_id` varchar(40) NOT NULL,
`device_id` varchar(30) DEFAULT NULL,
`device_battery_level` float DEFAULT NULL,
`temperature` smallint(6) DEFAULT NULL,
`humidity` smallint(6) DEFAULT NULL,
`carbon_monoxide` float DEFAULT NULL,
`nitrogen_dioxide` float DEFAULT NULL,
`formaldehyde` float DEFAULT NULL,
`acrolein` float DEFAULT NULL,
`benzene` float DEFAULT NULL,
`device_timestamp` timestamp NULL DEFAULT NULL,
`device_status_LED` smallint(6) DEFAULT NULL,
PRIMARY KEY (`timestamp_mins`,`firefighter_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `firefighter_status_analytics`
--
DROP TABLE IF EXISTS `firefighter_status_analytics`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `firefighter_status_analytics` (
`timestamp_mins` timestamp NOT NULL,
`firefighter_id` varchar(40) NOT NULL,
`device_id` varchar(30) DEFAULT NULL,
`device_battery_level` float DEFAULT NULL,
`temperature` smallint(6) DEFAULT NULL,
`humidity` smallint(6) DEFAULT NULL,
`carbon_monoxide` float DEFAULT NULL,
`nitrogen_dioxide` float DEFAULT NULL,
`formaldehyde` float DEFAULT NULL,
`acrolein` float DEFAULT NULL,
`benzene` float DEFAULT NULL,
`device_timestamp` timestamp NULL DEFAULT NULL,
`device_status_LED` smallint(6) DEFAULT NULL,
`analytics_status_LED` smallint(6) DEFAULT NULL,
`carbon_monoxide_twa_10min` float DEFAULT NULL,
`carbon_monoxide_twa_30min` float DEFAULT NULL,
`carbon_monoxide_twa_60min` float DEFAULT NULL,
`carbon_monoxide_twa_240min` float DEFAULT NULL,
`carbon_monoxide_twa_480min` float DEFAULT NULL,
`carbon_monoxide_gauge_10min` smallint(6) DEFAULT NULL,
`carbon_monoxide_gauge_30min` smallint(6) DEFAULT NULL,
`carbon_monoxide_gauge_60min` smallint(6) DEFAULT NULL,
`carbon_monoxide_gauge_240min` smallint(6) DEFAULT NULL,
`carbon_monoxide_gauge_480min` smallint(6) DEFAULT NULL,
`nitrogen_dioxide_twa_10min` float DEFAULT NULL,
`nitrogen_dioxide_twa_30min` float DEFAULT NULL,
`nitrogen_dioxide_twa_60min` float DEFAULT NULL,
`nitrogen_dioxide_twa_240min` float DEFAULT NULL,
`nitrogen_dioxide_twa_480min` float DEFAULT NULL,
`nitrogen_dioxide_gauge_10min` smallint(6) DEFAULT NULL,
`nitrogen_dioxide_gauge_30min` smallint(6) DEFAULT NULL,
`nitrogen_dioxide_gauge_60min` smallint(6) DEFAULT NULL,
`nitrogen_dioxide_gauge_240min` smallint(6) DEFAULT NULL,
`nitrogen_dioxide_gauge_480min` smallint(6) DEFAULT NULL,
`formaldehyde_twa_10min` float DEFAULT NULL,
`formaldehyde_twa_30min` float DEFAULT NULL,
`formaldehyde_twa_60min` float DEFAULT NULL,
`formaldehyde_twa_240min` float DEFAULT NULL,
`formaldehyde_twa_480min` float DEFAULT NULL,
`formaldehyde_gauge_10min` smallint(6) DEFAULT NULL,
`formaldehyde_gauge_30min` smallint(6) DEFAULT NULL,
`formaldehyde_gauge_60min` smallint(6) DEFAULT NULL,
`formaldehyde_gauge_240min` smallint(6) DEFAULT NULL,
`formaldehyde_gauge_480min` smallint(6) DEFAULT NULL,
`acrolein_twa_10min` float DEFAULT NULL,
`acrolein_twa_30min` float DEFAULT NULL,
`acrolein_twa_60min` float DEFAULT NULL,
`acrolein_twa_240min` float DEFAULT NULL,
`acrolein_twa_480min` float DEFAULT NULL,
`acrolein_gauge_10min` smallint(6) DEFAULT NULL,
`acrolein_gauge_30min` smallint(6) DEFAULT NULL,
`acrolein_gauge_60min` smallint(6) DEFAULT NULL,
`acrolein_gauge_240min` smallint(6) DEFAULT NULL,
`acrolein_gauge_480min` smallint(6) DEFAULT NULL,
`benzene_twa_10min` float DEFAULT NULL,
`benzene_twa_30min` float DEFAULT NULL,
`benzene_twa_60min` float DEFAULT NULL,
`benzene_twa_240min` float DEFAULT NULL,
`benzene_twa_480min` float DEFAULT NULL,
`benzene_gauge_10min` smallint(6) DEFAULT NULL,
`benzene_gauge_30min` smallint(6) DEFAULT NULL,
`benzene_gauge_60min` smallint(6) DEFAULT NULL,
`benzene_gauge_240min` smallint(6) DEFAULT NULL,
`benzene_gauge_480min` smallint(6) DEFAULT NULL,
PRIMARY KEY (`timestamp_mins`,`firefighter_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `firefighters`
--
DROP TABLE IF EXISTS `firefighters`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `firefighters` (
`firefighter_id` int(11) NOT NULL AUTO_INCREMENT,
`firefighter_code` varchar(40) DEFAULT NULL,
`name` varchar(20) DEFAULT NULL,
`surname` varchar(50) DEFAULT NULL,
`email` varchar(40) DEFAULT NULL,
`deleted_at` varchar(45) DEFAULT NULL,
PRIMARY KEY (`firefighter_id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `fuel_types`
--
DROP TABLE IF EXISTS `fuel_types`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fuel_types` (
`fuel_type` int(11) NOT NULL,
`fuel_description` varchar(20) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`fuel_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `sensors`
--
DROP TABLE IF EXISTS `sensors`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sensors` (
`IntSensorID` int(11) NOT NULL AUTO_INCREMENT,
`SensorID` varchar(30) NOT NULL,
`model` varchar(20) DEFAULT NULL,
`version` varchar(20) DEFAULT NULL,
`deleted_at` varchar(45) DEFAULT NULL,
PRIMARY KEY (`IntSensorID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `status`
--
DROP TABLE IF EXISTS `status`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `status` (
`statusid` int(11) NOT NULL,
`status_description` varchar(20) NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`statusid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_types`
--
DROP TABLE IF EXISTS `user_types`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_types` (
`user_type` int(11) NOT NULL AUTO_INCREMENT,
`description` varchar(20) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`user_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) DEFAULT NULL,
`surname` varchar(40) DEFAULT NULL,
`user_type` int(11) DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`user_id`),
KEY `user_type` (`user_type`),
CONSTRAINT `users_ibfk_1` FOREIGN KEY (`user_type`) REFERENCES `user_types` (`user_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping events for database 'prometeo'
--
--
-- Dumping routines for database 'prometeo'
--
/*!50003 DROP FUNCTION IF EXISTS `sp_count_event_firefighters_devices` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` FUNCTION `sp_count_event_firefighters_devices`(
event_internal_id int(11)
) RETURNS int(11)
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE cuenta INT DEFAULT 0;
DECLARE c1 CURSOR FOR select count(distinct firefighter_id) from events_firefighters_devices t where t.event_internal_id = event_internal_id;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN c1;
FETCH c1 INTO cuenta;
CLOSE c1;
return cuenta;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_all_devices` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_all_devices`( )
BEGIN
select * from sensors where deleted_at is null;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_all_events` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_all_events`(
)
BEGIN
select e.event_internal_id, e.event_code, e.status, s.status_description, e.event_type,t.event_description, e.fuel_type, f.fuel_description, DATE_FORMAT(e.event_date, '%m/%d/%Y'), e.init_time, e.end_time, e.extra_info, ST_x(e.location), ST_y(e.location),
`prometeo`.`sp_count_event_firefighters_devices`(e.event_internal_id)
from events e, status s, event_types t, fuel_types f where e.deleted_at is null and e.status=s.statusid and e.event_type=t.event_type and e.fuel_type=f.fuel_type;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_all_event_types` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_all_event_types`( )
BEGIN
select * from event_types where deleted_at is null;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_all_firefighters` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_all_firefighters`( )
BEGIN
select * from firefighters where deleted_at is null;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_all_fuel_types` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_all_fuel_types`( )
BEGIN
select * from fuel_types where deleted_at is null;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_all_status` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_all_status`( )
BEGIN
select * from status where deleted_at is null;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_device` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_device`(
IN IntSensorID VARCHAR(30)
)
BEGIN
select * from sensors where IntSensorID = IntSensorID;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_event` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_event`(
IN eventid int
)
BEGIN
select event_internal_id, event_code, status, event_type, fuel_type, DATE_FORMAT(event_date, '%m/%d/%Y'), init_time, end_time, extra_info, ST_x(location), ST_y(location) from events where event_internal_id = eventid;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_event_firefighters_devices` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_event_firefighters_devices`(
IN event_internal_id int(11)
)
BEGIN
select t.firefighter_id, f.firefighter_code, t.IntSensorID, s.SensorID from events_firefighters_devices t, sensors s, firefighters f where t.event_internal_id = event_internal_id and t.IntSensorID=s.IntSensorID and t.firefighter_id = f.firefighter_id;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_select_firefighter_status_analytics` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `sp_select_firefighter_status_analytics`(
IN firefighter_id VARCHAR(40),
IN event_date VARCHAR(20),
IN max INT
)
BEGIN
select * from firefighter_status_analytics a where a.firefighter_id = firefighter_id and DATE(a.timestamp_mins) = DATE(event_date) order by timestamp_mins desc limit max;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!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 2020-10-13 15:03:15
|
<reponame>dhaifley/dauth
-- ============================================================================
-- dauth migrations
-- Create the schema for the dauth database.
-- Author: <NAME>
-- Created: 2018-08-01
-- ============================================================================
-- Table: public.perm
-- DROP TABLE public.perm;
CREATE TABLE public.perm
(
id bigint NOT NULL,
service character varying(32) COLLATE pg_catalog."default" NOT NULL,
name character varying(32) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT perm_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.perm
OWNER to dauth;
-- Index: ix_perm_id
-- DROP INDEX public.ix_perm_id;
CREATE UNIQUE INDEX ix_perm_id
ON public.perm USING btree
(id)
TABLESPACE pg_default;
ALTER TABLE public.perm
CLUSTER ON ix_perm_id;
-- Index: ix_perm_name
-- DROP INDEX public.ix_perm_name;
CREATE INDEX ix_perm_name
ON public.perm USING btree
(name COLLATE pg_catalog."default")
TABLESPACE pg_default;
-- Index: ix_perm_service
-- DROP INDEX public.ix_perm_service;
CREATE INDEX ix_perm_service
ON public.perm USING btree
(service COLLATE pg_catalog."default")
TABLESPACE pg_default;
-- Index: ix_perm_service_name
-- DROP INDEX public.ix_perm_service_name;
CREATE UNIQUE INDEX ix_perm_service_name
ON public.perm USING btree
(service COLLATE pg_catalog."default", name COLLATE pg_catalog."default")
TABLESPACE pg_default;
-- Table: public.token
-- DROP TABLE public.token;
CREATE TABLE public.token
(
id bigint NOT NULL,
token character varying(255) COLLATE pg_catalog."default" NOT NULL,
user_id bigint NOT NULL,
created timestamp with time zone,
expires timestamp with time zone,
CONSTRAINT token_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.token
OWNER to dauth;
-- Index: ix_token_created
-- DROP INDEX public.ix_token_created;
CREATE INDEX ix_token_created
ON public.token USING btree
(created)
TABLESPACE pg_default;
-- Index: ix_token_expires
-- DROP INDEX public.ix_token_expires;
CREATE INDEX ix_token_expires
ON public.token USING btree
(expires)
TABLESPACE pg_default;
-- Index: ix_token_id
-- DROP INDEX public.ix_token_id;
CREATE UNIQUE INDEX ix_token_id
ON public.token USING btree
(id)
TABLESPACE pg_default;
ALTER TABLE public.token
CLUSTER ON ix_token_id;
-- Index: ix_token_token
-- DROP INDEX public.ix_token_token;
CREATE UNIQUE INDEX ix_token_token
ON public.token USING btree
(token COLLATE pg_catalog."default")
TABLESPACE pg_default;
-- Index: ix_token_user_id
-- DROP INDEX public.ix_token_user_id;
CREATE INDEX ix_token_user_id
ON public.token USING btree
(user_id)
TABLESPACE pg_default;
-- Table: public."user"
-- DROP TABLE public."user";
CREATE TABLE public."user"
(
id bigint NOT NULL,
"user" character varying(32) COLLATE pg_catalog."default" NOT NULL,
pass character varying(128) COLLATE pg_catalog."default" NOT NULL,
name character varying(64) COLLATE pg_catalog."default",
email character varying(128) COLLATE pg_catalog."default",
CONSTRAINT user_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public."user"
OWNER to dauth;
-- Index: ix_user_email
-- DROP INDEX public.ix_user_email;
CREATE INDEX ix_user_email
ON public."user" USING btree
(email COLLATE pg_catalog."default")
TABLESPACE pg_default;
-- Index: ix_user_id
-- DROP INDEX public.ix_user_id;
CREATE UNIQUE INDEX ix_user_id
ON public."user" USING btree
(id)
TABLESPACE pg_default;
ALTER TABLE public."user"
CLUSTER ON ix_user_id;
-- Index: ix_user_name
-- DROP INDEX public.ix_user_name;
CREATE INDEX ix_user_name
ON public."user" USING btree
(name COLLATE pg_catalog."default")
TABLESPACE pg_default;
-- Index: ix_user_user
-- DROP INDEX public.ix_user_user;
CREATE UNIQUE INDEX ix_user_user
ON public."user" USING btree
("user" COLLATE pg_catalog."default")
TABLESPACE pg_default;
-- Table: public.user_perm
-- DROP TABLE public.user_perm;
CREATE TABLE public.user_perm
(
id bigint NOT NULL,
user_id bigint NOT NULL,
perm_id bigint NOT NULL,
CONSTRAINT user_perm_pkey PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.user_perm
OWNER to dauth;
-- Index: ix_user_perm_id
-- DROP INDEX public.ix_user_perm_id;
CREATE UNIQUE INDEX ix_user_perm_id
ON public.user_perm USING btree
(id)
TABLESPACE pg_default;
ALTER TABLE public.user_perm
CLUSTER ON ix_user_perm_id;
-- Index: ix_user_perm_perm_id
-- DROP INDEX public.ix_user_perm_perm_id;
CREATE INDEX ix_user_perm_perm_id
ON public.user_perm USING btree
(perm_id)
TABLESPACE pg_default;
-- Index: ix_user_perm_user_id
-- DROP INDEX public.ix_user_perm_user_id;
CREATE INDEX ix_user_perm_user_id
ON public.user_perm USING btree
(user_id)
TABLESPACE pg_default;
-- Index: ix_user_perm_user_id_perm_id
-- DROP INDEX public.ix_user_perm_user_id_perm_id;
CREATE UNIQUE INDEX ix_user_perm_user_id_perm_id
ON public.user_perm USING btree
(user_id, perm_id)
TABLESPACE pg_default;
|
<reponame>hcpzhe/foodorder
/*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1
Source Server Version : 50524
Source Host : localhost:3306
Source Database : foodorder
Target Server Type : MYSQL
Target Server Version : 50524
File Encoding : 65001
Date: 2015-01-09 17:23:40
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `fdo_attr`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_attr`;
CREATE TABLE `fdo_attr` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`attr_name` varchar(255) NOT NULL COMMENT '属性名称',
`sort` smallint(5) unsigned NOT NULL DEFAULT '255',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '-1删除 0禁用 1正常',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='筛选属性表';
-- ----------------------------
-- Records of fdo_attr
-- ----------------------------
INSERT INTO `fdo_attr` VALUES ('1', '美食分类', '255', '1');
INSERT INTO `fdo_attr` VALUES ('2', '区域', '255', '1');
INSERT INTO `fdo_attr` VALUES ('3', '测试类别', '255', '1');
-- ----------------------------
-- Table structure for `fdo_attr_val`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_attr_val`;
CREATE TABLE `fdo_attr_val` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '属性值ID',
`attr_id` int(10) unsigned NOT NULL COMMENT '所属属性ID',
`attr_val` varchar(255) NOT NULL COMMENT '属性值',
`sort` smallint(5) unsigned NOT NULL DEFAULT '255' COMMENT '排序',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '-1删除 0禁用 1正常',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='筛选属性可选值表; `筛选属性表`一对多的关系';
-- ----------------------------
-- Records of fdo_attr_val
-- ----------------------------
INSERT INTO `fdo_attr_val` VALUES ('1', '1', '面条米线', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('2', '1', '鲜果', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('3', '1', '快餐', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('4', '1', '休闲零食', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('5', '1', '蛋糕甜点', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('6', '2', '涧西', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('7', '2', '西工', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('8', '2', '老城', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('9', '2', '洛龙区', '255', '0');
INSERT INTO `fdo_attr_val` VALUES ('10', '3', 'A', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('11', '3', 'B', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('12', '1', '饮品', '255', '1');
INSERT INTO `fdo_attr_val` VALUES ('13', '1', '养生粥', '255', '1');
-- ----------------------------
-- Table structure for `fdo_auth_group`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_auth_group`;
CREATE TABLE `fdo_auth_group` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户组id,自增主键',
`module` varchar(20) NOT NULL COMMENT '用户组所属模块',
`type` tinyint(4) NOT NULL COMMENT '组类型',
`title` char(20) NOT NULL DEFAULT '' COMMENT '用户组中文名称',
`description` varchar(80) NOT NULL DEFAULT '' COMMENT '描述信息',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '用户组状态:为1正常,为0禁用,-1为删除',
`rules` varchar(500) NOT NULL DEFAULT '' COMMENT '用户组拥有的规则id,多个规则 , 隔开',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of fdo_auth_group
-- ----------------------------
INSERT INTO `fdo_auth_group` VALUES ('1', 'admin', '1', '默认用户组', '', '1', '1,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,79,80,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,97,100,102,103,105,106');
INSERT INTO `fdo_auth_group` VALUES ('2', 'admin', '1', '测试用户', '测试用户', '1', '1,2,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,79,80,82,83,84,88,89,90,91,92,93,96,97,100,102,103,195');
-- ----------------------------
-- Table structure for `fdo_auth_group_access`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_auth_group_access`;
CREATE TABLE `fdo_auth_group_access` (
`uid` int(10) unsigned NOT NULL COMMENT '用户id',
`group_id` mediumint(8) unsigned NOT NULL COMMENT '用户组id',
UNIQUE KEY `uid_group_id` (`uid`,`group_id`),
KEY `uid` (`uid`),
KEY `group_id` (`group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of fdo_auth_group_access
-- ----------------------------
INSERT INTO `fdo_auth_group_access` VALUES ('2', '1');
-- ----------------------------
-- Table structure for `fdo_auth_rule`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_auth_rule`;
CREATE TABLE `fdo_auth_rule` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '规则id,自增主键',
`module` varchar(20) NOT NULL COMMENT '规则所属module',
`type` tinyint(2) NOT NULL DEFAULT '1' COMMENT '1-url;2-主菜单',
`name` char(80) NOT NULL DEFAULT '' COMMENT '规则唯一英文标识',
`title` char(20) NOT NULL DEFAULT '' COMMENT '规则中文描述',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1:有效)',
`condition` varchar(300) NOT NULL DEFAULT '' COMMENT '规则附加条件',
PRIMARY KEY (`id`),
KEY `module` (`module`,`status`,`type`)
) ENGINE=MyISAM AUTO_INCREMENT=217 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of fdo_auth_rule
-- ----------------------------
INSERT INTO `fdo_auth_rule` VALUES ('1', 'admin', '2', 'Admin/Index/index', '首页', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('2', 'admin', '2', 'Admin/Article/mydocument', '内容', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('3', 'admin', '2', 'Admin/User/index', '用户', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('4', 'admin', '2', 'Admin/Addons/index', '扩展', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('5', 'admin', '2', 'Admin/Config/group', '系统', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('7', 'admin', '1', 'Admin/article/add', '新增', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('8', 'admin', '1', 'Admin/article/edit', '编辑', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('9', 'admin', '1', 'Admin/article/setStatus', '改变状态', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('10', 'admin', '1', 'Admin/article/update', '保存', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('11', 'admin', '1', 'Admin/article/autoSave', '保存草稿', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('12', 'admin', '1', 'Admin/article/move', '移动', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('13', 'admin', '1', 'Admin/article/copy', '复制', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('14', 'admin', '1', 'Admin/article/paste', '粘贴', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('15', 'admin', '1', 'Admin/article/permit', '还原', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('16', 'admin', '1', 'Admin/article/clear', '清空', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('17', 'admin', '1', 'Admin/article/index', '文档列表', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('18', 'admin', '1', 'Admin/article/recycle', '回收站', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('19', 'admin', '1', 'Admin/User/addaction', '新增用户行为', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('20', 'admin', '1', 'Admin/User/editaction', '编辑用户行为', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('21', 'admin', '1', 'Admin/User/saveAction', '保存用户行为', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('22', 'admin', '1', 'Admin/User/setStatus', '变更行为状态', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('23', 'admin', '1', 'Admin/User/changeStatus?method=forbidUser', '禁用会员', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('24', 'admin', '1', 'Admin/User/changeStatus?method=resumeUser', '启用会员', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('25', 'admin', '1', 'Admin/User/changeStatus?method=deleteUser', '删除会员', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('26', 'admin', '1', 'Admin/User/index', '用户信息', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('27', 'admin', '1', 'Admin/User/action', '用户行为', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('28', 'admin', '1', 'Admin/AuthManager/changeStatus?method=deleteGroup', '删除', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('29', 'admin', '1', 'Admin/AuthManager/changeStatus?method=forbidGroup', '禁用', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('30', 'admin', '1', 'Admin/AuthManager/changeStatus?method=resumeGroup', '恢复', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('31', 'admin', '1', 'Admin/AuthManager/createGroup', '新增', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('32', 'admin', '1', 'Admin/AuthManager/editGroup', '编辑', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('33', 'admin', '1', 'Admin/AuthManager/writeGroup', '保存用户组', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('34', 'admin', '1', 'Admin/AuthManager/group', '授权', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('35', 'admin', '1', 'Admin/AuthManager/access', '访问授权', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('36', 'admin', '1', 'Admin/AuthManager/user', '成员授权', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('37', 'admin', '1', 'Admin/AuthManager/removeFromGroup', '解除授权', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('38', 'admin', '1', 'Admin/AuthManager/addToGroup', '保存成员授权', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('39', 'admin', '1', 'Admin/AuthManager/category', '分类授权', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('40', 'admin', '1', 'Admin/AuthManager/addToCategory', '保存分类授权', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('41', 'admin', '1', 'Admin/AuthManager/index', '权限管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('42', 'admin', '1', 'Admin/Addons/create', '创建', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('43', 'admin', '1', 'Admin/Addons/checkForm', '检测创建', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('44', 'admin', '1', 'Admin/Addons/preview', '预览', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('45', 'admin', '1', 'Admin/Addons/build', '快速生成插件', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('46', 'admin', '1', 'Admin/Addons/config', '设置', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('47', 'admin', '1', 'Admin/Addons/disable', '禁用', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('48', 'admin', '1', 'Admin/Addons/enable', '启用', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('49', 'admin', '1', 'Admin/Addons/install', '安装', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('50', 'admin', '1', 'Admin/Addons/uninstall', '卸载', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('51', 'admin', '1', 'Admin/Addons/saveconfig', '更新配置', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('52', 'admin', '1', 'Admin/Addons/adminList', '插件后台列表', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('53', 'admin', '1', 'Admin/Addons/execute', 'URL方式访问插件', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('54', 'admin', '1', 'Admin/Addons/index', '插件管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('55', 'admin', '1', 'Admin/Addons/hooks', '钩子管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('56', 'admin', '1', 'Admin/model/add', '新增', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('57', 'admin', '1', 'Admin/model/edit', '编辑', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('58', 'admin', '1', 'Admin/model/setStatus', '改变状态', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('59', 'admin', '1', 'Admin/model/update', '保存数据', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('60', 'admin', '1', 'Admin/Model/index', '模型管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('61', 'admin', '1', 'Admin/Config/edit', '编辑', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('62', 'admin', '1', 'Admin/Config/del', '删除', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('63', 'admin', '1', 'Admin/Config/add', '新增', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('64', 'admin', '1', 'Admin/Config/save', '保存', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('65', 'admin', '1', 'Admin/Config/group', '网站设置', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('66', 'admin', '1', 'Admin/Config/index', '配置管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('67', 'admin', '1', 'Admin/Channel/add', '新增', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('68', 'admin', '1', 'Admin/Channel/edit', '编辑', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('69', 'admin', '1', 'Admin/Channel/del', '删除', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('70', 'admin', '1', 'Admin/Channel/index', '导航管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('71', 'admin', '1', 'Admin/Category/edit', '编辑', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('72', 'admin', '1', 'Admin/Category/add', '新增', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('73', 'admin', '1', 'Admin/Category/remove', '删除', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('74', 'admin', '1', 'Admin/Category/index', '分类管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('75', 'admin', '1', 'Admin/file/upload', '上传控件', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('76', 'admin', '1', 'Admin/file/uploadPicture', '上传图片', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('77', 'admin', '1', 'Admin/file/download', '下载', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('94', 'admin', '1', 'Admin/AuthManager/modelauth', '模型授权', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('79', 'admin', '1', 'Admin/article/batchOperate', '导入', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('80', 'admin', '1', 'Admin/Database/index?type=export', '备份数据库', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('81', 'admin', '1', 'Admin/Database/index?type=import', '还原数据库', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('82', 'admin', '1', 'Admin/Database/export', '备份', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('83', 'admin', '1', 'Admin/Database/optimize', '优化表', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('84', 'admin', '1', 'Admin/Database/repair', '修复表', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('86', 'admin', '1', 'Admin/Database/import', '恢复', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('87', 'admin', '1', 'Admin/Database/del', '删除', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('88', 'admin', '1', 'Admin/User/add', '新增用户', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('89', 'admin', '1', 'Admin/Attribute/index', '属性管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('90', 'admin', '1', 'Admin/Attribute/add', '新增', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('91', 'admin', '1', 'Admin/Attribute/edit', '编辑', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('92', 'admin', '1', 'Admin/Attribute/setStatus', '改变状态', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('93', 'admin', '1', 'Admin/Attribute/update', '保存数据', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('95', 'admin', '1', 'Admin/AuthManager/addToModel', '保存模型授权', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('96', 'admin', '1', 'Admin/Category/move', '移动', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('97', 'admin', '1', 'Admin/Category/merge', '合并', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('98', 'admin', '1', 'Admin/Config/menu', '后台菜单管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('99', 'admin', '1', 'Admin/Article/mydocument', '内容', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('100', 'admin', '1', 'Admin/Menu/index', '菜单管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('101', 'admin', '1', 'Admin/other', '其他', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('102', 'admin', '1', 'Admin/Menu/add', '新增', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('103', 'admin', '1', 'Admin/Menu/edit', '编辑', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('104', 'admin', '1', 'Admin/Think/lists?model=article', '文章管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('105', 'admin', '1', 'Admin/Think/lists?model=download', '下载管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('106', 'admin', '1', 'Admin/Think/lists?model=config', '配置管理', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('107', 'admin', '1', 'Admin/Action/actionlog', '行为日志', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('108', 'admin', '1', 'Admin/User/updatePassword', '修改密码', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('109', 'admin', '1', 'Admin/User/updateNickname', '修改昵称', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('110', 'admin', '1', 'Admin/action/edit', '查看行为日志', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('205', 'admin', '1', 'Admin/think/add', '新增数据', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('111', 'admin', '2', 'Admin/article/index', '文档列表', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('112', 'admin', '2', 'Admin/article/add', '新增', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('113', 'admin', '2', 'Admin/article/edit', '编辑', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('114', 'admin', '2', 'Admin/article/setStatus', '改变状态', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('115', 'admin', '2', 'Admin/article/update', '保存', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('116', 'admin', '2', 'Admin/article/autoSave', '保存草稿', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('117', 'admin', '2', 'Admin/article/move', '移动', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('118', 'admin', '2', 'Admin/article/copy', '复制', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('119', 'admin', '2', 'Admin/article/paste', '粘贴', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('120', 'admin', '2', 'Admin/article/batchOperate', '导入', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('121', 'admin', '2', 'Admin/article/recycle', '回收站', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('122', 'admin', '2', 'Admin/article/permit', '还原', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('123', 'admin', '2', 'Admin/article/clear', '清空', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('124', 'admin', '2', 'Admin/User/add', '新增用户', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('125', 'admin', '2', 'Admin/User/action', '用户行为', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('126', 'admin', '2', 'Admin/User/addAction', '新增用户行为', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('127', 'admin', '2', 'Admin/User/editAction', '编辑用户行为', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('128', 'admin', '2', 'Admin/User/saveAction', '保存用户行为', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('129', 'admin', '2', 'Admin/User/setStatus', '变更行为状态', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('130', 'admin', '2', 'Admin/User/changeStatus?method=forbidUser', '禁用会员', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('131', 'admin', '2', 'Admin/User/changeStatus?method=resumeUser', '启用会员', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('132', 'admin', '2', 'Admin/User/changeStatus?method=deleteUser', '删除会员', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('133', 'admin', '2', 'Admin/AuthManager/index', '权限管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('134', 'admin', '2', 'Admin/AuthManager/changeStatus?method=deleteGroup', '删除', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('135', 'admin', '2', 'Admin/AuthManager/changeStatus?method=forbidGroup', '禁用', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('136', 'admin', '2', 'Admin/AuthManager/changeStatus?method=resumeGroup', '恢复', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('137', 'admin', '2', 'Admin/AuthManager/createGroup', '新增', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('138', 'admin', '2', 'Admin/AuthManager/editGroup', '编辑', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('139', 'admin', '2', 'Admin/AuthManager/writeGroup', '保存用户组', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('140', 'admin', '2', 'Admin/AuthManager/group', '授权', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('141', 'admin', '2', 'Admin/AuthManager/access', '访问授权', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('142', 'admin', '2', 'Admin/AuthManager/user', '成员授权', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('143', 'admin', '2', 'Admin/AuthManager/removeFromGroup', '解除授权', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('144', 'admin', '2', 'Admin/AuthManager/addToGroup', '保存成员授权', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('145', 'admin', '2', 'Admin/AuthManager/category', '分类授权', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('146', 'admin', '2', 'Admin/AuthManager/addToCategory', '保存分类授权', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('147', 'admin', '2', 'Admin/AuthManager/modelauth', '模型授权', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('148', 'admin', '2', 'Admin/AuthManager/addToModel', '保存模型授权', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('149', 'admin', '2', 'Admin/Addons/create', '创建', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('150', 'admin', '2', 'Admin/Addons/checkForm', '检测创建', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('151', 'admin', '2', 'Admin/Addons/preview', '预览', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('152', 'admin', '2', 'Admin/Addons/build', '快速生成插件', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('153', 'admin', '2', 'Admin/Addons/config', '设置', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('154', 'admin', '2', 'Admin/Addons/disable', '禁用', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('155', 'admin', '2', 'Admin/Addons/enable', '启用', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('156', 'admin', '2', 'Admin/Addons/install', '安装', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('157', 'admin', '2', 'Admin/Addons/uninstall', '卸载', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('158', 'admin', '2', 'Admin/Addons/saveconfig', '更新配置', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('159', 'admin', '2', 'Admin/Addons/adminList', '插件后台列表', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('160', 'admin', '2', 'Admin/Addons/execute', 'URL方式访问插件', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('161', 'admin', '2', 'Admin/Addons/hooks', '钩子管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('162', 'admin', '2', 'Admin/Model/index', '模型管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('163', 'admin', '2', 'Admin/model/add', '新增', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('164', 'admin', '2', 'Admin/model/edit', '编辑', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('165', 'admin', '2', 'Admin/model/setStatus', '改变状态', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('166', 'admin', '2', 'Admin/model/update', '保存数据', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('167', 'admin', '2', 'Admin/Attribute/index', '属性管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('168', 'admin', '2', 'Admin/Attribute/add', '新增', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('169', 'admin', '2', 'Admin/Attribute/edit', '编辑', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('170', 'admin', '2', 'Admin/Attribute/setStatus', '改变状态', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('171', 'admin', '2', 'Admin/Attribute/update', '保存数据', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('172', 'admin', '2', 'Admin/Config/index', '配置管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('173', 'admin', '2', 'Admin/Config/edit', '编辑', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('174', 'admin', '2', 'Admin/Config/del', '删除', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('175', 'admin', '2', 'Admin/Config/add', '新增', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('176', 'admin', '2', 'Admin/Config/save', '保存', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('177', 'admin', '2', 'Admin/Menu/index', '菜单管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('178', 'admin', '2', 'Admin/Channel/index', '导航管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('179', 'admin', '2', 'Admin/Channel/add', '新增', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('180', 'admin', '2', 'Admin/Channel/edit', '编辑', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('181', 'admin', '2', 'Admin/Channel/del', '删除', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('182', 'admin', '2', 'Admin/Category/index', '分类管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('183', 'admin', '2', 'Admin/Category/edit', '编辑', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('184', 'admin', '2', 'Admin/Category/add', '新增', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('185', 'admin', '2', 'Admin/Category/remove', '删除', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('186', 'admin', '2', 'Admin/Category/move', '移动', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('187', 'admin', '2', 'Admin/Category/merge', '合并', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('188', 'admin', '2', 'Admin/Database/index?type=export', '备份数据库', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('189', 'admin', '2', 'Admin/Database/export', '备份', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('190', 'admin', '2', 'Admin/Database/optimize', '优化表', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('191', 'admin', '2', 'Admin/Database/repair', '修复表', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('192', 'admin', '2', 'Admin/Database/index?type=import', '还原数据库', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('193', 'admin', '2', 'Admin/Database/import', '恢复', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('194', 'admin', '2', 'Admin/Database/del', '删除', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('195', 'admin', '2', 'Admin/other', '其他', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('196', 'admin', '2', 'Admin/Menu/add', '新增', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('197', 'admin', '2', 'Admin/Menu/edit', '编辑', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('198', 'admin', '2', 'Admin/Think/lists?model=article', '应用', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('199', 'admin', '2', 'Admin/Think/lists?model=download', '下载管理', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('200', 'admin', '2', 'Admin/Think/lists?model=config', '应用', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('201', 'admin', '2', 'Admin/Action/actionlog', '行为日志', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('202', 'admin', '2', 'Admin/User/updatePassword', '修改密码', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('203', 'admin', '2', 'Admin/User/updateNickname', '修改昵称', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('204', 'admin', '2', 'Admin/action/edit', '查看行为日志', '-1', '');
INSERT INTO `fdo_auth_rule` VALUES ('206', 'admin', '1', 'Admin/think/edit', '编辑数据', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('207', 'admin', '1', 'Admin/Menu/import', '导入', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('208', 'admin', '1', 'Admin/Model/generate', '生成', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('209', 'admin', '1', 'Admin/Addons/addHook', '新增钩子', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('210', 'admin', '1', 'Admin/Addons/edithook', '编辑钩子', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('211', 'admin', '1', 'Admin/Article/sort', '文档排序', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('212', 'admin', '1', 'Admin/Config/sort', '排序', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('213', 'admin', '1', 'Admin/Menu/sort', '排序', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('214', 'admin', '1', 'Admin/Channel/sort', '排序', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('215', 'admin', '1', 'Admin/Category/operate/type/move', '移动', '1', '');
INSERT INTO `fdo_auth_rule` VALUES ('216', 'admin', '1', 'Admin/Category/operate/type/merge', '合并', '1', '');
-- ----------------------------
-- Table structure for `fdo_cart`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_cart`;
CREATE TABLE `fdo_cart` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`member_id` char(40) NOT NULL COMMENT '用户ID',
`store_id` int(10) unsigned NOT NULL COMMENT '店铺ID 标识哪个店铺的订单',
`goods_id` int(10) unsigned NOT NULL COMMENT '商品ID',
`goods_name` varchar(255) DEFAULT NULL,
`price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '单价',
`quantity` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '数量',
PRIMARY KEY (`id`),
KEY `member_id` (`member_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of fdo_cart
-- ----------------------------
INSERT INTO `fdo_cart` VALUES ('1', '3', '2', '20', '小脚牛仔铅笔裤', '129.00', '1');
INSERT INTO `fdo_cart` VALUES ('2', '0', '2', '17', '韩E族百搭修身紧腰休闲长裤【灰色】', '90.00', '1');
INSERT INTO `fdo_cart` VALUES ('3', '0', '2', '19', '罗衣OL气质真丝雪纺百褶裙针织背心裙', '170.00', '1');
-- ----------------------------
-- Table structure for `fdo_category`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_category`;
CREATE TABLE `fdo_category` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cate_name` varchar(128) NOT NULL COMMENT '分类名称',
`parent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父ID',
`store_id` int(10) unsigned NOT NULL COMMENT '所属店铺ID',
`sort` tinyint(3) unsigned NOT NULL DEFAULT '255',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '-1删除 0-禁用 1-正常',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='店铺内商品分类';
-- ----------------------------
-- Records of fdo_category
-- ----------------------------
INSERT INTO `fdo_category` VALUES ('1', 'haha', '0', '3', '255', '1');
INSERT INTO `fdo_category` VALUES ('2', '测试1', '0', '3', '255', '1');
INSERT INTO `fdo_category` VALUES ('3', '测试1_1', '2', '3', '255', '1');
INSERT INTO `fdo_category` VALUES ('4', 'haha_1', '1', '3', '255', '1');
INSERT INTO `fdo_category` VALUES ('5', '饮料', '0', '3', '255', '1');
INSERT INTO `fdo_category` VALUES ('6', '中式', '0', '5', '255', '1');
INSERT INTO `fdo_category` VALUES ('7', '西餐', '0', '5', '255', '1');
INSERT INTO `fdo_category` VALUES ('8', '阿斯a', '0', '2', '255', '-1');
INSERT INTO `fdo_category` VALUES ('9', '111', '0', '2', '255', '1');
INSERT INTO `fdo_category` VALUES ('10', '222', '9', '2', '255', '1');
INSERT INTO `fdo_category` VALUES ('11', 'a1', '0', '2', '255', '1');
INSERT INTO `fdo_category` VALUES ('12', 'bbb', '0', '2', '255', '1');
-- ----------------------------
-- Table structure for `fdo_config`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_config`;
CREATE TABLE `fdo_config` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '配置ID',
`name` varchar(30) NOT NULL DEFAULT '' COMMENT '配置名称',
`type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '配置类型',
`title` varchar(50) NOT NULL DEFAULT '' COMMENT '配置说明',
`group` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '配置分组',
`extra` varchar(255) NOT NULL DEFAULT '' COMMENT '配置值',
`remark` varchar(100) NOT NULL COMMENT '配置说明',
`create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态',
`value` text NOT NULL COMMENT '配置值',
`sort` smallint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_name` (`name`),
KEY `type` (`type`),
KEY `group` (`group`)
) ENGINE=MyISAM AUTO_INCREMENT=38 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of fdo_config
-- ----------------------------
INSERT INTO `fdo_config` VALUES ('1', 'WEB_SITE_TITLE', '1', '网站标题', '1', '', '网站标题前台显示标题', '1378898976', '1379235274', '1', '快点餐订餐平台', '0');
INSERT INTO `fdo_config` VALUES ('2', 'WEB_SITE_DESCRIPTION', '2', '网站描述', '1', '', '网站搜索引擎描述', '1378898976', '1379235841', '1', '快点餐订餐平台', '1');
INSERT INTO `fdo_config` VALUES ('3', 'WEB_SITE_KEYWORD', '2', '网站关键字', '1', '', '网站搜索引擎关键字', '1378898976', '1381390100', '1', '快点餐,订餐平台', '8');
INSERT INTO `fdo_config` VALUES ('4', 'WEB_SITE_CLOSE', '4', '关闭站点', '1', '0:关闭,1:开启', '站点关闭后其他用户不能访问,管理员可以正常访问', '1378898976', '1379235296', '1', '1', '1');
INSERT INTO `fdo_config` VALUES ('9', 'CONFIG_TYPE_LIST', '3', '配置类型列表', '4', '', '主要用于数据解析和页面表单的生成', '1378898976', '1379235348', '1', '0:数字\r\n1:字符\r\n2:文本\r\n3:数组\r\n4:枚举', '2');
INSERT INTO `fdo_config` VALUES ('10', 'WEB_SITE_ICP', '1', '网站备案号', '1', '', '设置在网站底部显示的备案号,如“沪ICP备12007941号-2', '1378900335', '1379235859', '1', '', '9');
INSERT INTO `fdo_config` VALUES ('11', 'DOCUMENT_POSITION', '3', '文档推荐位', '2', '', '文档推荐位,推荐到多个位置KEY值相加即可', '1379053380', '1379235329', '1', '1:列表页推荐\r\n2:频道页推荐\r\n4:网站首页推荐', '3');
INSERT INTO `fdo_config` VALUES ('12', 'DOCUMENT_DISPLAY', '3', '文档可见性', '2', '', '文章可见性仅影响前台显示,后台不收影响', '1379056370', '1379235322', '1', '0:所有人可见\r\n1:仅注册会员可见\r\n2:仅管理员可见', '4');
INSERT INTO `fdo_config` VALUES ('13', 'COLOR_STYLE', '4', '后台色系', '1', 'default_color:默认\r\nblue_color:紫罗兰', '后台颜色风格', '1379122533', '1379235904', '1', 'default_color', '10');
INSERT INTO `fdo_config` VALUES ('20', 'CONFIG_GROUP_LIST', '3', '配置分组', '4', '', '配置分组', '1379228036', '1384418383', '1', '1:基本\r\n2:内容\r\n3:用户\r\n4:系统', '4');
INSERT INTO `fdo_config` VALUES ('21', 'HOOKS_TYPE', '3', '钩子的类型', '4', '', '类型 1-用于扩展显示内容,2-用于扩展业务处理', '1379313397', '1379313407', '1', '1:视图\r\n2:控制器', '6');
INSERT INTO `fdo_config` VALUES ('23', 'OPEN_DRAFTBOX', '4', '是否开启草稿功能', '2', '0:关闭草稿功能\r\n1:开启草稿功能\r\n', '新增文章时的草稿功能配置', '1379484332', '1379484591', '1', '1', '1');
INSERT INTO `fdo_config` VALUES ('24', 'DRAFT_AOTOSAVE_INTERVAL', '0', '自动保存草稿时间', '2', '', '自动保存草稿的时间间隔,单位:秒', '1379484574', '1386143323', '1', '60', '2');
INSERT INTO `fdo_config` VALUES ('25', 'LIST_ROWS', '0', '后台每页记录数', '2', '', '后台数据每页显示记录数', '1379503896', '1380427745', '1', '20', '10');
INSERT INTO `fdo_config` VALUES ('26', 'USER_ALLOW_REGISTER', '4', '是否允许用户注册', '3', '0:关闭注册\r\n1:允许注册', '是否开放用户注册', '1379504487', '1379504580', '1', '1', '3');
INSERT INTO `fdo_config` VALUES ('27', 'CODEMIRROR_THEME', '4', '预览插件的CodeMirror主题', '4', '3024-day:3024 day\r\n3024-night:3024 night\r\nambiance:ambiance\r\nbase16-dark:base16 dark\r\nbase16-light:base16 light\r\nblackboard:blackboard\r\ncobalt:cobalt\r\neclipse:eclipse\r\nelegant:elegant\r\nerlang-dark:erlang-dark\r\nlesser-dark:lesser-dark\r\nmidnight:midnight', '详情见CodeMirror官网', '1379814385', '1384740813', '1', 'ambiance', '3');
INSERT INTO `fdo_config` VALUES ('28', 'DATA_BACKUP_PATH', '1', '数据库备份根路径', '4', '', '路径必须以 / 结尾', '1381482411', '1381482411', '1', './Data/', '5');
INSERT INTO `fdo_config` VALUES ('29', 'DATA_BACKUP_PART_SIZE', '0', '数据库备份卷大小', '4', '', '该值用于限制压缩后的分卷最大长度。单位:B;建议设置20M', '1381482488', '1381729564', '1', '20971520', '7');
INSERT INTO `fdo_config` VALUES ('30', 'DATA_BACKUP_COMPRESS', '4', '数据库备份文件是否启用压缩', '4', '0:不压缩\r\n1:启用压缩', '压缩备份文件需要PHP环境支持gzopen,gzwrite函数', '1381713345', '1381729544', '1', '1', '9');
INSERT INTO `fdo_config` VALUES ('31', 'DATA_BACKUP_COMPRESS_LEVEL', '4', '数据库备份文件压缩级别', '4', '1:普通\r\n4:一般\r\n9:最高', '数据库备份文件的压缩级别,该配置在开启压缩时生效', '1381713408', '1381713408', '1', '9', '10');
INSERT INTO `fdo_config` VALUES ('32', 'DEVELOP_MODE', '4', '开启开发者模式', '4', '0:关闭\r\n1:开启', '是否开启开发者模式', '1383105995', '1383291877', '1', '1', '11');
INSERT INTO `fdo_config` VALUES ('33', 'ALLOW_VISIT', '3', '不受限控制器方法', '0', '', '', '1386644047', '1386644741', '1', '0:article/draftbox\r\n1:article/mydocument\r\n2:Category/tree\r\n3:Index/verify\r\n4:file/upload\r\n5:file/download\r\n6:user/updatePassword\r\n7:user/updateNickname\r\n8:user/submitPassword\r\n9:user/submitNickname\r\n10:file/uploadpicture', '0');
INSERT INTO `fdo_config` VALUES ('34', 'DENY_VISIT', '3', '超管专限控制器方法', '0', '', '仅超级管理员可访问的控制器方法', '1386644141', '1386644659', '1', '0:Addons/addhook\r\n1:Addons/edithook\r\n2:Addons/delhook\r\n3:Addons/updateHook\r\n4:Admin/getMenus\r\n5:Admin/recordList\r\n6:AuthManager/updateRules\r\n7:AuthManager/tree', '0');
INSERT INTO `fdo_config` VALUES ('35', 'REPLY_LIST_ROWS', '0', '回复列表每页条数', '2', '', '', '1386645376', '1387178083', '1', '10', '0');
INSERT INTO `fdo_config` VALUES ('36', 'ADMIN_ALLOW_IP', '2', '后台允许访问IP', '4', '', '多个用逗号分隔,如果不配置表示不限制IP访问', '1387165454', '1387165553', '1', '', '12');
INSERT INTO `fdo_config` VALUES ('37', 'SHOW_PAGE_TRACE', '4', '是否显示页面Trace', '4', '0:关闭\r\n1:开启', '是否显示页面Trace信息', '1387165685', '1387165685', '1', '0', '1');
-- ----------------------------
-- Table structure for `fdo_goods`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_goods`;
CREATE TABLE `fdo_goods` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`store_id` int(10) unsigned NOT NULL COMMENT '所属店铺ID',
`cate_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属分类ID; 0-无分类',
`goods_name` varchar(128) NOT NULL DEFAULT '' COMMENT '商品名称',
`image` varchar(255) DEFAULT NULL COMMENT '商品图片',
`price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '单价',
`sort` tinyint(3) unsigned NOT NULL DEFAULT '255' COMMENT '排序',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '-1删除 0-禁用 1-正常',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='商品表';
-- ----------------------------
-- Records of fdo_goods
-- ----------------------------
INSERT INTO `fdo_goods` VALUES ('1', '2', '0', '测试商品12', '/Uploads/Picture/2014-11-17/5469abf324d28.jpg', '10.00', '255', '1');
INSERT INTO `fdo_goods` VALUES ('2', '4', '0', '测试商品', null, '10.00', '255', '1');
INSERT INTO `fdo_goods` VALUES ('3', '5', '0', '炒面', null, '8.00', '255', '-1');
INSERT INTO `fdo_goods` VALUES ('4', '5', '6', '快餐(二荤一素)', null, '10.00', '255', '1');
INSERT INTO `fdo_goods` VALUES ('5', '2', '0', '123', null, '255.00', '255', '1');
INSERT INTO `fdo_goods` VALUES ('6', '2', '0', '11', '', '255.00', '255', '-1');
INSERT INTO `fdo_goods` VALUES ('7', '2', '0', '22', '/Uploads/Picture/2014-11-16/546786d356f7b.jpg', '22.00', '255', '1');
INSERT INTO `fdo_goods` VALUES ('8', '2', '0', '111', '', '255.00', '255', '-1');
INSERT INTO `fdo_goods` VALUES ('9', '2', '0', '132423', '', '5.00', '255', '-1');
INSERT INTO `fdo_goods` VALUES ('10', '2', '0', 'asd2', '/Uploads/Picture/2014-11-16/546786a38a999.jpg', '11.00', '255', '1');
INSERT INTO `fdo_goods` VALUES ('11', '2', '0', 'ccc', '/Uploads/Picture/2014-11-16/546786ee5d46f.jpg', '11.00', '255', '1');
INSERT INTO `fdo_goods` VALUES ('12', '2', '8', 'fff', '/Uploads/Picture/2014-11-16/54678796a0846.jpg', '11.00', '255', '1');
-- ----------------------------
-- Table structure for `fdo_member`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_member`;
CREATE TABLE `fdo_member` (
`id` char(40) NOT NULL COMMENT '使用unqid函数生成,md5处理',
`account` varchar(32) DEFAULT NULL COMMENT '帐号',
`password` char(32) DEFAULT NULL COMMENT '密码',
`reg_time` int(10) unsigned DEFAULT '0' COMMENT '注册时间',
`last_login` int(10) unsigned DEFAULT '0' COMMENT '上次登录时间',
`last_ip` varchar(32) DEFAULT NULL COMMENT '上次登录IP',
`logins` int(10) unsigned DEFAULT '0' COMMENT '登录次数',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '-1删除 0禁用 1正常',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='普通会员表; 与localstorge同步';
-- ----------------------------
-- Records of fdo_member
-- ----------------------------
INSERT INTO `fdo_member` VALUES ('', null, null, '1420618498', '0', '3232235845', '1', '1');
INSERT INTO `fdo_member` VALUES ('09a2cc5be89311542f6f966c6221d9ba2af9d879', null, null, '1416818170', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('0a3d52730609c7e870e293fff30dd4060703bd7e', null, null, '1416818177', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('0a8591f1eeb702f08a9440f5eeb3853029e86a12', null, null, '1416818203', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('0e2e819b9874f6b51f4d9638dffb3f88ac55da5a', null, null, '1416818166', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('13e48fe20a63947a6ce82ba73e7146098970da12', null, null, '1416818168', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('15d55bb2d631e5af9076fe38b9b12987441a8be2', null, null, '1416818193', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('1cc0b6fec8894c4ea4007cc9bef99bdf266d8545', null, null, '1416818169', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('23cba171df280508877314605757f82cb3253216', null, null, '1416818167', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('268f7d9f28b89bce2643f024a4ebba833b1154d9', 'aaaa', 'a04bbc6ca0d14e50cd9e9b6258b6842a', '1415691576', '0', null, '0', '1');
INSERT INTO `fdo_member` VALUES ('28c5aea86dc2cc77c86bae525913c673ff80e76c', null, null, '1416818184', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('2eb9eb2c2d295abdd0ba9f957f28bff862514025', null, null, '1416818165', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('2ed535c597054035fa09dfab6abf7ce4b2762d10', null, null, '1416818244', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('3068f2fe7e74f55239dd3e52d6eebabbf91d22bf', null, null, '1416818164', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('333d1caded9b69502a93190f4b1968570ed40b11', null, null, '1416818180', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('3a3e46f3cd2c9eabfe2bb1bb7ebbea7b8eec426b', null, null, '1416818188', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('3d629a2a04a474ddfd28e6a10e1b47b044f650da', null, null, '1416818205', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('3ddde2d752a637ba8dc7b469b6f438b974a94bd1', null, null, '1420781773', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('3e5fbc50be6d93a3573f3f3fb13c39379f51c1af', null, null, '1416818171', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('4730e42ed85548332d6367e38a7de8db17aafe88', null, null, '1420620265', '0', '3232235785', '1', '1');
INSERT INTO `fdo_member` VALUES ('484d81475fde736840dba63c8e004ed8efbd3372', null, null, '1416818191', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('488e90e59f1d8211046744e26e91a542777c1f0c', null, null, '1416818185', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('4ee626a7e06883ab66a1312fe501d123e6b78825', null, null, '1416818194', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('4f2274a5b9fbcefe954b3a17b951618997fe0338', null, null, '1416818178', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('52efba2ffdb06495bd6b9544057e7e32f4b8dfc8', null, null, '1417073064', '0', '3232235834', '1', '1');
INSERT INTO `fdo_member` VALUES ('550426ed8d49b8083f336c09e19e9addae7858e6', null, null, '1416818181', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('5a3062b198f059e4d66613ffc7b848785d496e5c', null, null, '1420620222', '0', '3232235845', '1', '1');
INSERT INTO `fdo_member` VALUES ('5a95f2eae29698352ab712541f4eee80564fc78a', null, null, '1416818201', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('5c00826514893b1e1b3d6bcaa60b54bf5a734299', null, null, '1416818163', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('5f82bb2a9d0fb3028d7541f6e7e69750c62b39a9', null, null, '1420621440', '0', '3232235845', '1', '1');
INSERT INTO `fdo_member` VALUES ('6dbeb5b9cb1b601985938d82f132504b3645b779', null, null, '1416818165', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('6e40106d05a16a99bc668480d7423ee62c54ffa1', null, null, '1416818173', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('70945e25778025b0c8382465a99da67539aeccde', null, null, '1416818198', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('7ab1e825ecb4afd8c1fd9a33cf99da7fb5efcbf7', null, null, '1416818183', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('82356acf53d8dac7b80a1568506a083d20b8d00d', null, null, '1417501626', '0', '3232235783', '1', '1');
INSERT INTO `fdo_member` VALUES ('83605fad6e65fc20407b70a5f12d8c7684ed2e53', null, null, '1416818200', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('87683c0cdff442f331d92c03a02f8bfc50ae9ddd', null, null, '1416818189', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('92902bf33785d7bf120f8614bd8fd9f4ffaf3b52', null, null, '1416818162', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('9bc757f1b509fe31a2485a28d7bdac242a5aaab3', null, null, '1416818176', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('9d13d14aa6d313ed41399966205a308a31d162c6', null, null, '1416818108', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('a71658c04c8accd6f2d11294828fcaa151fac4e0', null, null, '1416818161', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('a9918b4f9e64d6cf89db34b73620f64f48602b81', null, null, '1416818204', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('abf9ea5e612bc3b885f837ae5e0cb152d3d64373', null, null, '1416818199', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('ac37226d49775a132f8c787e68119665da89d971', null, null, '1416818192', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('afd090a252592f4d41f353d35aa3819005e6c255', null, null, '1416818164', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('b928bd55efbf543f4eecaff8ba2e954f111d2e48', null, null, '1416818175', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('bab399c741c2e42129dcb99ff5770512b8ce8607', null, null, '1416818174', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('bed94f9a925d693d7cff778624c6e00582a2db5f', null, null, '1416818182', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('c638838e15b2cc4d9508cd94a73643e22fe0ad13', null, null, '1416818163', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('d44c2a8ca2e5258609b71c4a4da8ed9560cded99', null, null, '1416818080', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('d8aacf23dbc8cdca798a9417a96e89a8e76ce32a', null, null, '1418615747', '0', '3232235779', '1', '1');
INSERT INTO `fdo_member` VALUES ('dc47d4b0566368697f665f3f7fafaf407a59e700', null, null, '1416818186', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('df1c3b26a4e743a47b8913eb7085904a77fd4fc9', null, null, '1416818197', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('e60bb2fd72d625aebc47b56bc60af04ddb47f723', null, null, '1416818190', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('e9bc5e955b9fd766c7c6b302f347600bcd3d4ceb', null, null, '1417073793', '0', '3232235780', '1', '1');
INSERT INTO `fdo_member` VALUES ('ee2cf0bc36d06d62034a42abe38e11338a88f0b3', null, null, '1416818196', '0', '2130706433', '1', '1');
INSERT INTO `fdo_member` VALUES ('faf92e32f3823cc15a971e0b04db4f77faac<PASSWORD>', null, null, '1416818160', '0', '2130706433', '1', '1');
-- ----------------------------
-- Table structure for `fdo_menu`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_menu`;
CREATE TABLE `fdo_menu` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL DEFAULT '' COMMENT '标题',
`pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类ID',
`sort` int(10) unsigned NOT NULL DEFAULT '255' COMMENT '排序(同级有效)',
`url` char(255) NOT NULL DEFAULT '' COMMENT '链接地址',
`hide` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否隐藏',
`tip` varchar(255) NOT NULL DEFAULT '' COMMENT '提示',
PRIMARY KEY (`id`),
KEY `pid` (`pid`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of fdo_menu
-- ----------------------------
INSERT INTO `fdo_menu` VALUES ('1', '首页', '0', '255', 'Index/index', '0', '');
INSERT INTO `fdo_menu` VALUES ('2', '会员', '0', '255', '', '0', '');
INSERT INTO `fdo_menu` VALUES ('3', '会员管理', '2', '255', 'Member/lists', '0', '');
INSERT INTO `fdo_menu` VALUES ('4', '新增会员', '2', '255', 'Member/add', '0', '');
INSERT INTO `fdo_menu` VALUES ('5', '店铺', '0', '255', '', '0', '');
INSERT INTO `fdo_menu` VALUES ('6', '店铺管理', '5', '255', 'Store/lists', '0', '');
INSERT INTO `fdo_menu` VALUES ('7', '新增店铺', '5', '255', 'Store/add', '0', '');
INSERT INTO `fdo_menu` VALUES ('8', '订单管理', '0', '255', 'Order/lists', '0', '');
INSERT INTO `fdo_menu` VALUES ('9', '店铺类别', '0', '255', '', '0', '');
INSERT INTO `fdo_menu` VALUES ('10', '类别管理', '9', '255', 'Attr/lists', '0', '');
INSERT INTO `fdo_menu` VALUES ('11', '新增类别', '9', '255', 'Attr/add', '0', '');
INSERT INTO `fdo_menu` VALUES ('12', '新建属性值', '9', '255', 'Attr/valAdd', '0', '');
INSERT INTO `fdo_menu` VALUES ('13', '网站设置', '0', '255', 'Config/group', '0', '');
-- ----------------------------
-- Table structure for `fdo_order`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_order`;
CREATE TABLE `fdo_order` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单ID',
`order_sn` varchar(32) NOT NULL DEFAULT '' COMMENT '订单编号',
`store_id` int(10) unsigned NOT NULL COMMENT '所属店铺ID',
`member_id` char(40) NOT NULL COMMENT '购买用户编号',
`buyer_name` varchar(32) NOT NULL COMMENT '购买者姓名',
`address` varchar(255) NOT NULL COMMENT '地址',
`phone` varchar(32) NOT NULL COMMENT '电话',
`order_note` text COMMENT '用户订单留言',
`amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '合计总金额',
`payment_id` int(10) unsigned NOT NULL COMMENT '支付方式ID',
`add_time` int(10) unsigned NOT NULL COMMENT '订单创建时间',
`update_time` int(10) unsigned NOT NULL COMMENT '订单更新时间',
`pay_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '付款时间',
`pay_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '支付状态 0-否 1-是',
`phone_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '手机验证状态 0-否 1-是',
`store_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '店铺接收订单状态 0-否 1-是',
`store_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '店铺接收时间',
`ship_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '配送状态 0-未开始 1-配送中',
`confirm` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '客户收货确认 0-否 1-是',
`ship_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '发货时间',
`confirm_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '客户收货确认时间',
`confirm_expired` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '确认收货截止时间',
`unreceived` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '用户未收货申请1-是,0-否;必须在收货截止时间内才能申请',
`finish_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单完成时间',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '-1删除 0禁用 1正常',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='订单表';
-- ----------------------------
-- Records of fdo_order
-- ----------------------------
INSERT INTO `fdo_order` VALUES ('1', '12332543', '2', '85fce697249c4be2c1f86418da3b4842683afc65', '哈哈', '洛阳西工区紫金城', '13333333333', null, '31.00', '1', '0', '1416211831', '0', '0', '0', '1', '1416211796', '1', '0', '1416211831', '0', '0', '0', '0', '1');
INSERT INTO `fdo_order` VALUES ('2', '1243795881', '2', '9d13d14aa6d313ed41399966205a308a31d162c6', '123123', '人民大街16号', '15888888888', '', '52.00', '1', '1418871387', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1');
INSERT INTO `fdo_order` VALUES ('3', '1218581070', '2', '9d13d14aa6d313ed41399966205a308a31d162c6', '123123', '人民大街16号', '15888888888', '', '52.00', '1', '1418961496', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1');
INSERT INTO `fdo_order` VALUES ('4', '1208070377', '2', '9d13d14aa6d313ed41399966205a308a31d162c6', '123123', '人民大街16号', '15888888888', '', '32.00', '1', '1419404529', '1420705128', '0', '0', '0', '1', '0', '1', '0', '1420705128', '0', '0', '0', '0', '1');
INSERT INTO `fdo_order` VALUES ('5', '1107779055', '2', '5f82bb2a9d0fb3028d7541f6e7e69750c62b39a9', 'hhhh', 'ggv#hjjhgbbhh', '1333333333', '', '22.00', '1', '1420621480', '1420705213', '0', '0', '0', '1', '0', '1', '0', '1420705213', '0', '0', '0', '0', '1');
-- ----------------------------
-- Table structure for `fdo_order_goods`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_order_goods`;
CREATE TABLE `fdo_order_goods` (
`order_id` int(10) unsigned NOT NULL COMMENT '所属订单ID',
`goods_id` int(10) unsigned NOT NULL COMMENT '所属商品ID',
`quantity` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '数量',
`price` decimal(10,2) NOT NULL COMMENT '单价',
`amount` decimal(10,2) NOT NULL COMMENT '总价',
PRIMARY KEY (`order_id`,`goods_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of fdo_order_goods
-- ----------------------------
INSERT INTO `fdo_order_goods` VALUES ('1', '1', '3', '10.00', '30.00');
INSERT INTO `fdo_order_goods` VALUES ('2', '1', '3', '10.00', '30.00');
INSERT INTO `fdo_order_goods` VALUES ('2', '10', '2', '11.00', '22.00');
INSERT INTO `fdo_order_goods` VALUES ('3', '1', '3', '10.00', '30.00');
INSERT INTO `fdo_order_goods` VALUES ('3', '10', '2', '11.00', '22.00');
INSERT INTO `fdo_order_goods` VALUES ('4', '1', '1', '10.00', '10.00');
INSERT INTO `fdo_order_goods` VALUES ('4', '7', '1', '22.00', '22.00');
INSERT INTO `fdo_order_goods` VALUES ('5', '10', '1', '11.00', '11.00');
INSERT INTO `fdo_order_goods` VALUES ('5', '11', '1', '11.00', '11.00');
-- ----------------------------
-- Table structure for `fdo_payment`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_payment`;
CREATE TABLE `fdo_payment` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'payment_id',
`pay_code` varchar(20) NOT NULL COMMENT '支付代码; 用于连接后台API',
`pay_name` varchar(255) NOT NULL COMMENT '支付方式名称',
`pay_desc` text COMMENT '支付简介',
`pay_config` text COMMENT '支付配置信息',
`is_phone` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否需要验证手机号码 0-否 1-是',
`sort` tinyint(3) unsigned NOT NULL DEFAULT '255' COMMENT '排序',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '-1删除 0禁用 1正常',
PRIMARY KEY (`id`),
UNIQUE KEY `pay_code` (`pay_code`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='支付方式';
-- ----------------------------
-- Records of fdo_payment
-- ----------------------------
INSERT INTO `fdo_payment` VALUES ('1', 'cod', '货到付款', '', null, '0', '255', '0');
-- ----------------------------
-- Table structure for `fdo_phonecode`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_phonecode`;
CREATE TABLE `fdo_phonecode` (
`phone` varchar(255) NOT NULL COMMENT '手机号码',
`code` char(4) NOT NULL COMMENT '验证码',
`send_time` int(10) unsigned NOT NULL COMMENT '发送时间',
`expired_time` int(10) unsigned NOT NULL COMMENT '验证码过期时间',
`class` varchar(12) NOT NULL COMMENT '验证码类型 order;register;'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='手机验证码记录表';
-- ----------------------------
-- Records of fdo_phonecode
-- ----------------------------
-- ----------------------------
-- Table structure for `fdo_store`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_store`;
CREATE TABLE `fdo_store` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`account` varchar(32) NOT NULL COMMENT '帐号',
`password` char(32) NOT NULL COMMENT '密码',
`store_name` varchar(100) NOT NULL COMMENT '店铺名',
`owner_name` varchar(60) DEFAULT NULL COMMENT '店主姓名',
`owner_card` varchar(60) DEFAULT NULL COMMENT '身份证号码',
`address` varchar(255) DEFAULT NULL COMMENT '地铺地址',
`tel` varchar(60) DEFAULT NULL COMMENT '联系电话',
`balance` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '店铺余额',
`rating` decimal(5,1) unsigned NOT NULL DEFAULT '0.0' COMMENT '评价分数; 1-5分; 小于1为无评价',
`min_send` decimal(10,0) unsigned NOT NULL DEFAULT '0' COMMENT '每单最低起送价',
`is_recom` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '推荐 1-是 0-否',
`store_logo` varchar(255) DEFAULT NULL COMMENT '店铺LOGO',
`description` text COMMENT '店铺简介',
`im_qq` varchar(60) DEFAULT NULL COMMENT 'QQ',
`im_ww` varchar(60) DEFAULT NULL COMMENT '旺旺',
`last_login` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上次登录时间',
`last_ip` varchar(32) DEFAULT NULL COMMENT '上次登录IP',
`logins` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '登录次数',
`sort` smallint(5) unsigned NOT NULL DEFAULT '255' COMMENT '排序',
`add_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '入驻时间',
`end_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '到期时间 0-永不到期',
`is_close` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否暂停营业 0-否 1-是',
`close_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '暂停营业原因',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '-1删除 0-禁用 1-正常',
PRIMARY KEY (`id`),
KEY `store_name` (`store_name`),
KEY `account` (`account`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of fdo_store
-- ----------------------------
INSERT INTO `fdo_store` VALUES ('2', 'aaa', 'fa157449ce7b9bbfcb47e4cb70b2ee22', '演示店铺', '张老板', '123456789012345678', '人民大街16号', '010-88886666-8866', '6.00', '2.7', '10', '1', '', '', '', '', '0', null, '0', '22', '1249543819', '0', '0', '', '1');
INSERT INTO `fdo_store` VALUES ('3', 'aaaa', '2b02f38867b04a7120e65394c6d6cba4', '某某快餐店', '李哲', '', '紫金城', '', '0.00', '3.0', '0', '0', '/Uploads/Picture/2014-11-11/54617cce202cc.jpg', null, null, null, '0', null, '0', '255', '1414482653', '0', '0', '', '1');
INSERT INTO `fdo_store` VALUES ('4', 'ceshi', 'c8dbcf6665483e2cc9f2fbc79c1ef875', 'ceshi', 'ceshi', '', '', '', '0.00', '3.0', '0', '0', null, null, null, null, '0', null, '0', '255', '1415674766', '0', '0', '', '1');
INSERT INTO `fdo_store` VALUES ('5', 'ceshi2', '9c97893f2d530f93c5b76841af9af5b6', 'ceshi2', 'ceshi2', '', '', '', '0.00', '3.0', '0', '0', '/Uploads/Picture/2014-11-11/54617db6360be.jpg', null, null, null, '0', null, '0', '255', '1415675318', '0', '0', '', '1');
-- ----------------------------
-- Table structure for `fdo_store_attr`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_store_attr`;
CREATE TABLE `fdo_store_attr` (
`store_id` int(10) unsigned NOT NULL COMMENT '店铺ID',
`attr_val_id` int(10) unsigned NOT NULL COMMENT '属性值ID',
PRIMARY KEY (`store_id`,`attr_val_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='店铺 属性值 关系表; 用于店铺列表筛选;';
-- ----------------------------
-- Records of fdo_store_attr
-- ----------------------------
INSERT INTO `fdo_store_attr` VALUES ('1', '1');
INSERT INTO `fdo_store_attr` VALUES ('1', '2');
INSERT INTO `fdo_store_attr` VALUES ('2', '2');
INSERT INTO `fdo_store_attr` VALUES ('2', '8');
INSERT INTO `fdo_store_attr` VALUES ('3', '2');
INSERT INTO `fdo_store_attr` VALUES ('3', '3');
INSERT INTO `fdo_store_attr` VALUES ('3', '4');
INSERT INTO `fdo_store_attr` VALUES ('3', '5');
INSERT INTO `fdo_store_attr` VALUES ('3', '8');
-- ----------------------------
-- Table structure for `fdo_user`
-- ----------------------------
DROP TABLE IF EXISTS `fdo_user`;
CREATE TABLE `fdo_user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`account` varchar(32) NOT NULL COMMENT '帐号',
`password` char(32) NOT NULL,
`depart_id` int(10) unsigned NOT NULL COMMENT '所属部门ID',
`realname` varchar(32) NOT NULL COMMENT '真实姓名',
`sex` enum('0','1') NOT NULL DEFAULT '1' COMMENT '1男 0女',
`birthday` varchar(32) DEFAULT '0' COMMENT '生日',
`logins` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '登录次数',
`last_login` varchar(32) NOT NULL DEFAULT '0' COMMENT '上次登录时间',
`last_ip` varchar(32) NOT NULL DEFAULT '0' COMMENT '上次登录IP',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '-1:删除 0:禁用 1:正常',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='员工表';
-- ----------------------------
-- Records of fdo_user
-- ----------------------------
INSERT INTO `fdo_user` VALUES ('1', 'admin', '<PASSWORD>', '0', '超管', '1', '0', '7', '1415689341', '3232235819', '1');
INSERT INTO `fdo_user` VALUES ('2', 'administrator', '<PASSWORD>', '0', '超管', '1', '0', '0', '0', '0', '1');
|
CREATE TABLE [dbo].[Telefono] (
[Persona] VARCHAR (9) NOT NULL,
[Telefono] VARCHAR (9) NOT NULL,
[Comentario] VARCHAR (255) NULL,
PRIMARY KEY CLUSTERED ([Persona] ASC, [Telefono] ASC),
CONSTRAINT [TelefonosPersona] FOREIGN KEY ([Persona]) REFERENCES [dbo].[Persona] ([Dni]) ON DELETE CASCADE ON UPDATE CASCADE
);
|
<reponame>kurtjohnson-HS/EdFi-Project-Buzz
-- CREATE A SAMPLE INTERNET ACCESS SURVEY
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_internet_survey(
"timestamp" VARCHAR(255),
StudentUniqueId VARCHAR(255),
FirstName VARCHAR(255),
LastSurName VARCHAR(255),
"Internet Access Type" VARCHAR(255),
"Has School Email Account" VARCHAR(255),
"Has School Student Account" VARCHAR(255),
PRIMARY KEY (StudentUniqueId)
);
DELETE FROM tmp_internet_survey;
INSERT INTO tmp_internet_survey (StudentUniqueId, FirstName, LastSurname)
SELECT DISTINCT s.studentkey AS "StudentUniqueId", s.studentfirstname AS "FirstName", s.studentlastname AS "LastSurname"
FROM buzz.studentschool s
INNER JOIN buzz.studentsection ss ON s.studentschoolkey = ss.studentschoolkey
INNER JOIN buzz.staffsectionassociation ssa ON ss.sectionkey = ssa.sectionkey
WHERE
ssa.staffkey = 1030;
UPDATE tmp_internet_survey
SET
"timestamp" = NOW(),
"Internet Access Type" = CASE floor(RANDOM() * (3-1+1) + 1)::INT WHEN 1 THEN 'High Speed Internet' WHEN 2 THEN 'School provided hot-spot' WHEN 3 THEN 'No Internet' END
, "Has School Email Account" = CASE floor(RANDOM() * (2-1+1) + 1)::INT WHEN 1 THEN 'Yes' WHEN 2 THEN 'No' END
, "Has School Student Account" = CASE floor(RANDOM() * (2-1+1) + 1)::INT WHEN 1 THEN 'Yes' WHEN 2 THEN 'No' END;
SELECT "timestamp" AS "Timestamp" , studentuniqueid AS "StudentUniqueId" , firstname AS "FirstName", lastsurname AS "LastSurname", "Internet Access Type" AS "Internet Access Type", "Has School Email Account" AS "Has School Email Account", "Has School Student Account" AS "Has School Student Account"
FROM tmp_internet_survey ORDER BY 2; |
DROP POLICY {{ conn|qtIdent(policy_name) }} ON {{conn|qtIdent(result.schema, result.table)}};
|
<gh_stars>0
-- Section1: DDL
CREATE TABLE Flights(
FlightID INT PRIMARY KEY,
DepartureTime DATETIME NOT NULL,
ArrivalTime DATETIME NOT NULL,
[Status] VARCHAR(9) NOT NULL CHECK ([Status] IN('Departing', 'Delayed', 'Arrived', 'Cancelled')),
OriginAirportID INT NOT NULL,
DestinationAirportID INT NOT NULL,
AirlineID INT NOT NULL
CONSTRAINT FK_Flights_OriginAirportID_Airports FOREIGN KEY(OriginAirportID)
REFERENCES Airports(AirportID),
CONSTRAINT FK_Flights_DestinationAirportID_Airports FOREIGN KEY(DestinationAirportID)
REFERENCES Airports(AirportID),
CONSTRAINT FK_Flights_AirlineID_Airlines FOREIGN KEY(AirlineID)
REFERENCES Airlines(AirlineID)
)
CREATE TABLE Tickets(
TicketID INT PRIMARY KEY,
Price DECIMAL(8, 2) NOT NULL,
Class VARCHAR(6) NOT NULL CHECK (Class IN('First', 'Second', 'Third')),
Seat VARCHAR(5) NOT NULL,
CustomerID INT NOT NULL,
FlightID INT NOT NULL,
CONSTRAINT FK_Tickets_Customers FOREIGN KEY(CustomerID)
REFERENCES Customers(CustomerID),
CONSTRAINT FK_Tickets_Flights FOREIGN KEY(FlightID)
REFERENCES Flights(FlightID)
)
-- Section 2: DML - 01. Data Insertion
INSERT INTO Flights(
FlightID, DepartureTime, ArrivalTime, [Status], OriginAirportID, DestinationAirportID, AirlineID)
VALUES
(1, CAST('2016-10-13 06:00 AM' AS DateTime), CAST('2016-10-13 10:00 AM' AS DateTime), 'Delayed', 1, 4, 1),
(2, CAST('2016-10-12 12:00 PM' AS DateTime), CAST('2016-10-12 12:01 PM' AS DateTime), 'Departing', 1, 3, 2),
(3, CAST('2016-10-14 03:00 PM' AS DateTime), CAST('2016-10-20 04:00 AM' AS DateTime), 'Delayed', 4, 2, 4),
(4, CAST('2016-10-12 01:24 PM' AS DateTime), CAST('2016-10-12 4:31 PM' AS DateTime), 'Departing', 3, 1, 3),
(5, CAST('2016-10-12 08:11 AM' AS DateTime), CAST('2016-10-12 11:22 PM' AS DateTime), 'Departing', 4, 1, 1),
(6, CAST('1995-06-21 12:30 PM' AS DateTime), CAST('1995-06-22 08:30 PM' AS DateTime), 'Arrived', 2, 3, 5),
(7, CAST('2016-10-12 11:34 PM' AS DateTime), CAST('2016-10-13 03:00 AM' AS DateTime), 'Departing', 2, 4, 2),
(8, CAST('2016-11-11 01:00 PM' AS DateTime), CAST('2016-11-12 10:00 PM' AS DateTime), 'Delayed', 4, 3, 1),
(9, CAST('2015-10-01 12:00 PM' AS DateTime), CAST('2015-12-01 01:00 AM' AS DateTime), 'Arrived', 1, 2, 1),
(10, CAST('2016-10-12 07:30 PM' AS DateTime), CAST('2016-10-13 12:30 PM' AS DateTime), 'Departing', 2, 1, 7)
INSERT INTO Tickets(TicketID, Price, Class, Seat, CustomerID, FlightID)
VALUES
(1, 3000.00, 'First','233-A', 3, 8),
(2, 1799.90, 'Second', '123-D', 1, 1),
(3, 1200.50, 'Second', '12-Z', 2, 5),
(4, 410.68, 'Third', '45-Q', 2, 8),
(5, 560.00, 'Third', '201-R', 4, 6),
(6, 2100.00, 'Second', '13-T', 1, 9),
(7, 5500.00, 'First', '98-O', 2, 7)
-- Section 2: DML - 02. Update Arrived Flights
UPDATE [dbo].[Flights]
SET [AirlineID] = 1
WHERE [Status] = 'Arrived'
-- Section 2: DML - 03. Update Tickets
UPDATE [dbo].[Tickets]
SET [Price] += [Price] * 0.5
WHERE [TicketID] = (SELECT top 1 [AirlineID]
FROM [dbo].[Airlines]
GROUP BY [AirlineID], [Rating]
ORDER BY [Rating])
-- Section 2: DML - 04. Table Creation
CREATE TABLE CustomerReviews(
ReviewID INT PRIMARY KEY,
ReviewContent VARCHAR(255) NOT NULL,
ReviewGrade INT NOT NULL CHECK (ReviewGrade IN(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)),
AirlineID INT NOT NULL,
CustomerID INT NOT NULL
CONSTRAINT FK_CustomerReviews_Airlines FOREIGN KEY(AirlineID)
REFERENCES Airlines(AirlineID),
CONSTRAINT FK_CustomerReviews_Customers FOREIGN KEY(CustomerID)
REFERENCES Customers(CustomerID)
)
CREATE TABLE CustomerBankAccounts(
AccountID INT PRIMARY KEY,
AccountNumber VARCHAR(10) NOT NULL UNIQUE,
Balance DECIMAL(10, 2) NOT NULL,
CustomerID INT NOT NULL
CONSTRAINT FK_CustomerBankAccounts_Customers FOREIGN KEY(CustomerID)
REFERENCES Customers(CustomerID),
)
-- Section 2: DML - 05. Fill the new Tables with Data
INSERT INTO CustomerReviews(ReviewID, ReviewContent, ReviewGrade, AirlineID, CustomerID)
VALUES
(1, 'Me is very happy. Me likey this airline. Me good.', 10, 1, 1),
(2, 'Ja, Ja, Ja... Ja, Gut, Gut, Ja Gut! Sehr Gut!', 10, 1, 4),
(3, 'Meh...', 5, 4, 3),
(4, 'Well Ive seen better, but Ive certainly seen a lot worse...', 7, 3, 5)
INSERT INTO CustomerBankAccounts(AccountID, AccountNumber, Balance, CustomerID)
VALUES
(1, '123456790', 2569.23, 1),
(2, '18ABC23672', 14004568.23, 2),
(3, 'F0RG0100N3', 19345.20, 5)
-- Section 3 - Task 01: Extract All Tickets
SELECT [TicketID], [Price], [Class], [Seat]
FROM [dbo].[Tickets]
ORDER BY [TicketID]
-- Section 3 - Task 02: Extract All Customers
SELECT [CustomerID], CONCAT([FirstName], ' ', [LastName]) AS FullName, [Gender]
FROM [dbo].[Customers]
ORDER BY FullName ASC, [CustomerID] ASC
-- Section 3 - Task 03: Extract Delayed Flights
SELECT [FlightID], [DepartureTime], [ArrivalTime]
FROM [dbo].[Flights]
WHERE [Status] = 'Delayed'
ORDER BY [FlightID] ASC
|
<reponame>compsocial/Popup-Networks
-- MySQL syntax
CREATE DATABASE IF NOT EXISTS api;
USE api;
CREATE TABLE IF NOT EXISTS apps (
id INTEGER UNIQUE KEY AUTO_INCREMENT, -- internal id
app_id VARCHAR(20) PRIMARY KEY, -- universal id
app_short_name VARCHAR(50) NOT NULL,
app_long_name VARCHAR(100) NOT NULL,
app_description VARCHAR(255),
app_version VARCHAR(20) NOT NULL,
app_build_date DATETIME NOT NULL,
app_install_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS users (
id INTEGER UNIQUE KEY AUTO_INCREMENT, -- internal id
user_id VARCHAR(20) PRIMARY KEY, -- universal id
user_name VARCHAR(100) NOT NULL,
user_email VARCHAR (100),
user_address VARCHAR (500),
user_bio VARCHAR(500),
user_picture_path VARCHAR (100),
user_ip VARCHAR(15) NOT NULL,
movein_date DATE,
known_date DATETIME NOT NULL,
join_date DATETIME NOT NULL,
retrieval_date TIMESTAMP
);
CREATE TABLE IF NOT EXISTS vouch (
id INTEGER PRIMARY KEY AUTO_INCREMENT, -- internal id
user_id VARCHAR(20) UNIQUE KEY,
status ENUM('notvouch', 'waiting', 'vouched') NOT NULL DEFAULT "notvouch",
timestamp TIMESTAMP NOT NULL,
FOREIGN KEY (user_id) REFERENCES users(user_id)
);
CREATE TABLE IF NOT EXISTS vouch_code (
id INTEGER PRIMARY KEY AUTO_INCREMENT, -- internal id
user_id VARCHAR(20) UNIQUE KEY,
code VARCHAR(100),
timestamp TIMESTAMP NOT NULL,
FOREIGN KEY (user_id) REFERENCES users(user_id)
);
CREATE TABLE IF NOT EXISTS users_me (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
user_id VARCHAR(20),
user_name VARCHAR(100) NOT NULL,
user_email VARCHAR (100),
user_address VARCHAR (500),
user_bio VARCHAR(500),
user_picture_path VARCHAR(100),
movein_date DATE,
join_date DATETIME NOT NULL,
FOREIGN KEY (user_id) REFERENCES users(user_id)
);
CREATE TABLE IF NOT EXISTS users_me_password (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
user_id VARCHAR(20) UNIQUE KEY,
hash VARCHAR(500),
FOREIGN KEY (user_id) REFERENCES users(user_id)
);
CREATE TABLE IF NOT EXISTS apps_message (
id INTEGER PRIMARY KEY AUTO_INCREMENT, -- internal id
app_id VARCHAR(20) NOT NULL,
author_id VARCHAR(20) NOT NULL,
message VARCHAR(1000),
timestamp TIMESTAMP NOT NULL,
FOREIGN KEY (app_id) REFERENCES apps(app_id),
FOREIGN KEY (author_id) REFERENCES users(user_id)
);
-- use this table for specifying recipients of private messages
CREATE TABLE IF NOT EXISTS apps_message_recipient (
message_id INTEGER NOT NULL,
recipient_id VARCHAR(20) NOT NULL,
FOREIGN KEY (message_id) REFERENCES apps_message(id),
FOREIGN KEY (recipient_id) REFERENCES users(user_id)
);
CREATE TABLE IF NOT EXISTS following_users (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
app_id VARCHAR(20) NOT NULL,
following_id VARCHAR(20) NOT NULL,
FOREIGN KEY (app_id) REFERENCES apps(app_id),
FOREIGN KEY (following_id) REFERENCES users(user_id),
UNIQUE (app_id, following_id)
);
CREATE TABLE IF NOT EXISTS follower_users (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
app_id VARCHAR(20) NOT NULL,
follower_id VARCHAR(20) NOT NULL,
FOREIGN KEY (app_id) REFERENCES apps(app_id),
FOREIGN KEY (follower_id) REFERENCES users(user_id),
UNIQUE (app_id, follower_id)
); |
CREATE SCHEMA [rpt]
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.1.6
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 18 Feb 2021 pada 14.38
-- Versi Server: 5.6.16
-- PHP Version: 5.5.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `dbklinikmedika`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_admin`
--
CREATE TABLE IF NOT EXISTS `tb_admin` (
`id_admin` int(11) NOT NULL AUTO_INCREMENT,
`kode_admin` varchar(20) NOT NULL,
`nama_admin` varchar(100) NOT NULL,
`jenis_kelamin` enum('L','P') NOT NULL,
`role` varchar(50) NOT NULL COMMENT 'Admin,Pimpinan,SuperAdmin',
`create_date` datetime NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(100) NOT NULL,
`view_password` varchar(50) NOT NULL,
`profile_image` varchar(50) NOT NULL,
`status` int(1) NOT NULL,
PRIMARY KEY (`id_admin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data untuk tabel `tb_admin`
--
INSERT INTO `tb_admin` (`id_admin`, `kode_admin`, `nama_admin`, `jenis_kelamin`, `role`, `create_date`, `username`, `password`, `view_password`, `profile_image`, `status`) VALUES
(1, 'ADM-0001', 'Adminstrator', 'L', 'SuperAdmin', '2021-02-07 22:33:24', 'admin', '$2y$10$d/fy7Oo2HJTfwaT1.Q7jLe468jINC1D.pJFmFvnEnqxzu4l32jQJ.', 'admin', '', 0),
(2, 'ADM-0002', 'AdminUser', 'L', 'Admin', '2021-02-07 22:34:12', 'adminuser', '$2y$10$MElhD.zs/D6UuDQjss61iOpNhCu0aDJOuufsHTSATzLW65kwWqNve', 'adminuser', '', 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_barang`
--
CREATE TABLE IF NOT EXISTS `tb_barang` (
`id_barang` int(11) NOT NULL AUTO_INCREMENT,
`kode_barang` varchar(20) NOT NULL,
`id_kategori` int(5) NOT NULL,
`id_satuan` int(5) NOT NULL,
`nama_barang` varchar(150) NOT NULL,
`aturan_pakai` varchar(100) NOT NULL,
`harga_jual` decimal(10,0) NOT NULL,
`jumlah_stok` int(11) NOT NULL,
`tanggal_input` datetime NOT NULL,
`status` int(1) NOT NULL COMMENT '0=AKTIF 1=NON AKTIF',
PRIMARY KEY (`id_barang`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
--
-- Dumping data untuk tabel `tb_barang`
--
INSERT INTO `tb_barang` (`id_barang`, `kode_barang`, `id_kategori`, `id_satuan`, `nama_barang`, `aturan_pakai`, `harga_jual`, `jumlah_stok`, `tanggal_input`, `status`) VALUES
(1, 'OBT-001', 8, 4, 'MEFINAL 500 MG', 'Dikonsumsi sesudah makan.', '42400', 100, '2021-01-16 20:20:09', 0),
(3, 'OBT-003', 8, 4, 'ASAM MEFENAMAT 500 MG', 'Diberikan sesudah makan atau bersama dengan makan', '2300', 17, '2021-01-17 12:21:02', 0),
(4, 'OBT-004', 8, 4, 'CATAFLAM 50 MG', 'Sesudah makan', '64200', 10, '2021-01-17 13:51:39', 0),
(5, 'OBT-005', 11, 4, 'NEURALGIN RX', 'Sesudah makan', '24400', 45, '2021-01-17 18:28:41', 0),
(6, 'OBT-006', 11, 4, 'QWEQ', '', '0', 0, '2021-01-31 11:48:36', 1),
(7, 'OBT-006', 7, 4, 'RHINOS SR', 'Diminum sebelum atau sesudah makan', '59800', 197, '2021-02-04 18:47:54', 0),
(8, 'OBT-007', 7, 4, 'TREMENZA', 'Sesudah makan', '15800', 136, '2021-02-04 19:20:34', 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_barang_masuk`
--
CREATE TABLE IF NOT EXISTS `tb_barang_masuk` (
`id_barang_masuk` int(11) NOT NULL AUTO_INCREMENT,
`no_transaksi` varchar(20) NOT NULL,
`id_supplier` int(11) NOT NULL,
`tanggal_masuk` date NOT NULL,
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL COMMENT '0=AKTIF 1=NON AKTIF',
PRIMARY KEY (`id_barang_masuk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
--
-- Dumping data untuk tabel `tb_barang_masuk`
--
INSERT INTO `tb_barang_masuk` (`id_barang_masuk`, `no_transaksi`, `id_supplier`, `tanggal_masuk`, `create_date`, `status`) VALUES
(1, 'BM-0121-000001', 3, '2021-01-21', '2021-01-21 13:58:53', 0),
(2, 'BM-0121-000002', 3, '2021-01-20', '2021-01-21 13:59:25', 0),
(3, 'BM-0121-000003', 3, '2021-01-19', '2021-01-21 13:59:52', 0),
(4, 'BM-0121-000004', 2, '2021-01-25', '2021-01-25 11:22:02', 0),
(5, 'BM-0121-000005', 2, '2021-01-25', '2021-01-25 18:31:49', 0),
(6, 'BM-0221-000006', 2, '2021-02-04', '2021-02-04 18:57:06', 0),
(7, 'BM-0221-000007', 2, '2021-02-04', '2021-02-04 18:59:56', 0),
(8, 'BM-0221-00008', 2, '2021-02-04', '2021-02-04 19:02:20', 0),
(9, 'BM-0221-00009', 2, '2021-02-04', '2021-02-04 19:25:35', 0),
(10, 'BM-0221-00010', 3, '2021-02-08', '2021-02-08 19:43:51', 0),
(11, 'BM-0221-00011', 2, '2021-02-08', '2021-02-08 20:31:19', 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_daftar_pasien`
--
CREATE TABLE IF NOT EXISTS `tb_daftar_pasien` (
`id_daftar_pasien` int(11) NOT NULL AUTO_INCREMENT,
`no_rekam_medik` varchar(20) NOT NULL,
`nama_pasien` varchar(100) NOT NULL,
`tanggal_lahir` date NOT NULL,
`jenis_kelamin` enum('L','P') NOT NULL,
`golongan_darah` varchar(10) NOT NULL,
`alamat_pasien` varchar(150) NOT NULL,
`no_telepon` varchar(20) NOT NULL,
`tanggal_daftar` date NOT NULL,
`create_date` datetime NOT NULL,
PRIMARY KEY (`id_daftar_pasien`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
--
-- Dumping data untuk tabel `tb_daftar_pasien`
--
INSERT INTO `tb_daftar_pasien` (`id_daftar_pasien`, `no_rekam_medik`, `nama_pasien`, `tanggal_lahir`, `jenis_kelamin`, `golongan_darah`, `alamat_pasien`, `no_telepon`, `tanggal_daftar`, `create_date`) VALUES
(1, 'RM-0010121', '<NAME>', '1980-05-23', 'L', 'AB', 'Dummy Address Lorem Ipsum Sit Amet', '08675848883', '2021-01-28', '2021-01-29 19:32:10'),
(2, 'RM-0020121', '<NAME>', '1989-07-20', 'L', 'o', 'California', '08978765464', '2021-01-28', '2021-01-30 09:10:02'),
(3, 'RM-0030121', 'Covid Taria', '1989-01-01', 'P', 'B', 'Wuhan', '064343452', '2021-01-28', '2021-01-30 09:11:42'),
(4, 'RM-0040121', 'Jaga jarak', '1989-01-30', 'L', 'AB', 'Dimana saja', '0987545433', '2021-01-28', '2021-01-30 10:08:23'),
(5, 'RM-0050121', 'Sosial Distancing', '1989-01-27', 'P', 'B', 'Protokol kesehatan', '06785645634', '2021-01-28', '2021-01-30 10:09:44'),
(6, 'RM-0060121', 'Cuci tangan', '1960-01-01', 'L', 'A', 'Pake sabun', '078563453453', '2021-01-28', '2021-01-30 10:10:27'),
(7, 'RM-0070121', 'Jas hujan', '1980-01-13', 'L', '-', 'Jakarta', '067567453434', '2021-01-28', '2021-01-30 14:25:24'),
(8, 'RM-0080121', 'Ar<NAME>', '1987-01-06', 'L', '-', 'Bandung', '4234234231', '2021-01-28', '2021-01-30 14:26:00'),
(9, 'RM-0090121', 'Sinopak', '1990-01-07', 'L', 'AB', 'Wuhan', '098492428234', '2021-01-31', '2021-01-31 10:44:04');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_daftar_periksa`
--
CREATE TABLE IF NOT EXISTS `tb_daftar_periksa` (
`id_daftar_periksa` int(11) NOT NULL AUTO_INCREMENT,
`no_registrasi` varchar(20) NOT NULL,
`id_daftar_pasien` int(11) NOT NULL,
`id_detail_praktek` int(11) NOT NULL,
`jam_daftar` time NOT NULL,
`no_antrian` int(3) unsigned zerofill NOT NULL,
`tanggal` date NOT NULL,
`status_daftar` int(11) NOT NULL COMMENT '0=MENUNGGU 1=PROSES 2=PENDING 3=SELESAI',
PRIMARY KEY (`id_daftar_periksa`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
--
-- Dumping data untuk tabel `tb_daftar_periksa`
--
INSERT INTO `tb_daftar_periksa` (`id_daftar_periksa`, `no_registrasi`, `id_daftar_pasien`, `id_detail_praktek`, `jam_daftar`, `no_antrian`, `tanggal`, `status_daftar`) VALUES
(1, 'REG-0121-0001', 1, 13, '19:32:10', 001, '2021-01-28', 3),
(2, 'REG-0121-0002', 2, 10, '09:10:02', 001, '2021-01-28', 3),
(3, 'REG-0121-0003', 3, 11, '09:11:42', 001, '2021-01-28', 3),
(4, 'REG-0121-0004', 4, 13, '10:08:23', 002, '2021-01-28', 3),
(5, 'REG-0121-0005', 5, 12, '10:09:44', 001, '2021-01-28', 3),
(6, 'REG-0121-0006', 6, 12, '10:10:27', 002, '2021-01-28', 3),
(7, 'REG-0121-0007', 7, 10, '14:25:24', 002, '2021-01-28', 3),
(8, 'REG-0121-0008', 8, 10, '14:26:00', 003, '2021-01-28', 3),
(9, 'REG-0121-0009', 2, 14, '14:44:58', 001, '2021-01-31', 2),
(10, 'REG-0121-0010', 3, 14, '17:43:59', 002, '2021-01-31', 3),
(11, 'REG-0221-0011', 5, 14, '10:25:22', 003, '2021-01-31', 3),
(12, 'REG-0221-0012', 3, 15, '11:54:26', 001, '2021-02-01', 1),
(13, 'REG-0221-0013', 9, 14, '14:28:47', 004, '2021-01-31', 0),
(14, 'REG-0221-0014', 5, 22, '15:09:44', 001, '2021-02-07', 1),
(15, 'REG-0221-0015', 5, 23, '19:48:07', 001, '2021-02-08', 3),
(16, 'REG-0221-0016', 9, 23, '11:46:22', 002, '2021-02-08', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_detail_masuk`
--
CREATE TABLE IF NOT EXISTS `tb_detail_masuk` (
`id_detail_masuk` int(11) NOT NULL AUTO_INCREMENT,
`id_barang_masuk` int(11) NOT NULL,
`id_barang` int(11) NOT NULL,
`jumlah_masuk` int(11) NOT NULL,
PRIMARY KEY (`id_detail_masuk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;
--
-- Dumping data untuk tabel `tb_detail_masuk`
--
INSERT INTO `tb_detail_masuk` (`id_detail_masuk`, `id_barang_masuk`, `id_barang`, `jumlah_masuk`) VALUES
(1, 1, 5, 2),
(2, 1, 4, 2),
(3, 1, 3, 5),
(4, 2, 5, 5),
(5, 3, 5, 1),
(6, 4, 5, 13),
(7, 4, 4, 3),
(8, 4, 3, 4),
(9, 4, 1, 5),
(10, 5, 5, 2),
(11, 5, 4, 2),
(12, 6, 7, 200),
(13, 7, 5, 23),
(14, 8, 4, 4),
(15, 8, 3, 10),
(16, 9, 8, 100),
(17, 10, 8, 50),
(18, 11, 1, 100);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_detail_praktek`
--
CREATE TABLE IF NOT EXISTS `tb_detail_praktek` (
`id_detail_praktek` int(11) NOT NULL AUTO_INCREMENT,
`id_jadwal` int(11) NOT NULL,
`deskripsi_jadwal` varchar(100) NOT NULL,
`id_dokter` int(11) NOT NULL,
`jam_start` time NOT NULL,
`jam_end` time NOT NULL,
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL,
PRIMARY KEY (`id_detail_praktek`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=24 ;
--
-- Dumping data untuk tabel `tb_detail_praktek`
--
INSERT INTO `tb_detail_praktek` (`id_detail_praktek`, `id_jadwal`, `deskripsi_jadwal`, `id_dokter`, `jam_start`, `jam_end`, `create_date`, `status`) VALUES
(10, 8, 'Pagi', 2, '09:00:00', '10:00:00', '2021-01-28 14:04:59', 0),
(11, 9, 'Siang', 1, '10:00:00', '12:00:00', '2021-01-28 18:42:30', 0),
(12, 8, 'Sore', 1, '16:45:00', '18:00:00', '2021-01-29 16:43:11', 0),
(13, 8, 'Malam', 2, '19:00:00', '22:00:00', '2021-01-29 16:44:28', 0),
(14, 10, 'Malam', 2, '19:00:00', '22:00:00', '2021-01-31 14:44:41', 0),
(15, 11, 'Sore', 5, '17:00:00', '21:00:00', '2021-02-01 11:53:31', 0),
(16, 12, 'Sore', 4, '17:00:00', '21:00:00', '2021-02-01 11:53:52', 1),
(17, 13, 'Sore', 2, '17:00:00', '21:00:00', '2021-02-01 11:54:07', 1),
(18, 13, 'Malam', 4, '19:00:00', '22:00:00', '2021-02-01 19:37:42', 0),
(19, 15, 'Malam', 5, '18:00:00', '22:00:00', '2021-02-02 19:06:32', 0),
(20, 16, 'Malam', 4, '18:00:00', '22:00:00', '2021-02-02 19:06:48', 0),
(21, 17, 'Sore', 5, '17:00:00', '21:00:00', '2021-02-07 15:07:46', 1),
(22, 18, 'Sore', 5, '17:00:00', '21:00:00', '2021-02-07 15:09:23', 0),
(23, 19, 'Malam', 2, '17:00:00', '21:00:00', '2021-02-08 19:47:54', 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_detail_transaksi_periksa`
--
CREATE TABLE IF NOT EXISTS `tb_detail_transaksi_periksa` (
`id_detail_transaksi_periksa` int(11) NOT NULL AUTO_INCREMENT,
`id_transaksi_periksa` int(11) NOT NULL,
`id_barang` int(11) NOT NULL,
`jumlah_obat` int(3) NOT NULL,
`harga_satuan` decimal(10,0) NOT NULL,
`sub_total` decimal(10,0) NOT NULL,
`create_date` datetime NOT NULL,
PRIMARY KEY (`id_detail_transaksi_periksa`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
--
-- Dumping data untuk tabel `tb_detail_transaksi_periksa`
--
INSERT INTO `tb_detail_transaksi_periksa` (`id_detail_transaksi_periksa`, `id_transaksi_periksa`, `id_barang`, `jumlah_obat`, `harga_satuan`, `sub_total`, `create_date`) VALUES
(1, 1, 8, 2, '15800', '31600', '2021-02-06 18:06:16'),
(2, 1, 7, 1, '59800', '59800', '2021-02-06 18:06:16'),
(3, 2, 8, 8, '15800', '126400', '2021-02-06 18:09:06'),
(4, 3, 4, 1, '64200', '64200', '2021-02-06 22:14:17'),
(5, 3, 3, 1, '2300', '2300', '2021-02-06 22:14:17'),
(6, 4, 1, 3, '42400', '127200', '2021-02-06 22:16:14'),
(7, 5, 1, 2, '42400', '84800', '2021-02-06 22:18:22'),
(8, 6, 3, 1, '2300', '2300', '2021-02-06 22:20:00'),
(9, 9, 8, 1, '15800', '15800', '2021-02-07 10:26:58'),
(10, 10, 8, 1, '15800', '15800', '2021-02-07 11:55:35'),
(11, 10, 5, 1, '24400', '24400', '2021-02-07 11:55:35'),
(12, 11, 8, 1, '15800', '15800', '2021-02-08 16:11:31'),
(13, 11, 7, 1, '59800', '59800', '2021-02-08 16:11:31'),
(14, 12, 8, 1, '15800', '15800', '2021-02-08 19:49:51'),
(15, 12, 7, 1, '59800', '59800', '2021-02-08 19:49:51');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_discount_ppn`
--
CREATE TABLE IF NOT EXISTS `tb_discount_ppn` (
`id_discount_ppn` int(2) NOT NULL AUTO_INCREMENT,
`discount` int(2) NOT NULL,
`ppn` int(2) NOT NULL,
PRIMARY KEY (`id_discount_ppn`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data untuk tabel `tb_discount_ppn`
--
INSERT INTO `tb_discount_ppn` (`id_discount_ppn`, `discount`, `ppn`) VALUES
(1, 10, 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_dokter`
--
CREATE TABLE IF NOT EXISTS `tb_dokter` (
`id_dokter` int(11) NOT NULL AUTO_INCREMENT,
`nama_dokter` varchar(100) NOT NULL,
`jenis_kelamin` enum('L','P') NOT NULL,
`tempat_lahir` varchar(100) NOT NULL,
`tanggal_lahir` date NOT NULL,
`alamat` varchar(225) NOT NULL,
`no_telepon` varchar(20) NOT NULL,
`deskripsi` varchar(100) NOT NULL,
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL,
PRIMARY KEY (`id_dokter`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data untuk tabel `tb_dokter`
--
INSERT INTO `tb_dokter` (`id_dokter`, `nama_dokter`, `jenis_kelamin`, `tempat_lahir`, `tanggal_lahir`, `alamat`, `no_telepon`, `deskripsi`, `create_date`, `status`) VALUES
(1, '<NAME>,Dr M.Ked(ped)', 'L', '-', '2021-01-27', '-', '-', 'Dokter anak', '2021-01-27 07:31:10', 0),
(2, 'dr. <NAME>', 'P', '-', '2021-01-27', '-', '-', 'Dokter Umum', '2021-01-27 07:35:11', 0),
(3, 'wer', 'L', 'wer', '2021-01-28', 'werwerw', 'erwer', 'rwer', '2021-01-28 06:54:42', 1),
(4, 'dr.Tirta', 'L', 'Jakarta', '1983-03-02', 'Jakarta', '08488483222', 'Dokter kandungan', '2021-02-01 10:57:03', 0),
(5, 'dr.Abidin', 'L', 'Semarang', '1990-02-07', 'Semarang', '08485738322', 'Dokter Mata', '2021-02-01 11:47:03', 0),
(6, 'dr.Abidin', 'L', 'Semarang', '1990-02-07', 'Semarang', '08485738322', 'Dokter Mata', '2021-02-01 11:47:10', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_informasi_klinik`
--
CREATE TABLE IF NOT EXISTS `tb_informasi_klinik` (
`id_informasi` int(5) NOT NULL AUTO_INCREMENT,
`nama_klinik` varchar(100) NOT NULL,
`alamat_klinik` varchar(225) NOT NULL,
`no_telpon` varchar(20) NOT NULL,
`logo` varchar(50) NOT NULL,
`favicon` varchar(50) NOT NULL,
`bg_login` varchar(50) NOT NULL,
PRIMARY KEY (`id_informasi`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data untuk tabel `tb_informasi_klinik`
--
INSERT INTO `tb_informasi_klinik` (`id_informasi`, `nama_klinik`, `alamat_klinik`, `no_telpon`, `logo`, `favicon`, `bg_login`) VALUES
(1, 'Klinik Medika Narom', 'Jl. Jegang, Jayasampurna, Kec. Serang Baru, Bekasi, Jawa Barat', '(021) 89283669', 'logo.png', 'favicon1.ico', 'bg2.jpg');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_jadwal_praktek`
--
CREATE TABLE IF NOT EXISTS `tb_jadwal_praktek` (
`id_jadwal` int(11) NOT NULL AUTO_INCREMENT,
`id_poliklinik` int(11) NOT NULL,
`tanggal_praktek` date NOT NULL,
`create_date` datetime NOT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id_jadwal`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;
--
-- Dumping data untuk tabel `tb_jadwal_praktek`
--
INSERT INTO `tb_jadwal_praktek` (`id_jadwal`, `id_poliklinik`, `tanggal_praktek`, `create_date`, `status`) VALUES
(8, 2, '2021-01-28', '2021-01-28 14:04:07', 0),
(9, 1, '2021-01-28', '2021-01-28 14:04:20', 0),
(10, 2, '2021-01-31', '2021-01-31 14:44:06', 0),
(11, 5, '2021-02-01', '2021-02-01 11:52:57', 0),
(12, 2, '2021-02-01', '2021-02-01 11:53:02', 1),
(13, 1, '2021-02-01', '2021-02-01 11:53:07', 0),
(14, 2, '2021-02-18', '2021-02-02 18:52:23', 1),
(15, 2, '2021-02-02', '2021-02-02 19:06:07', 0),
(16, 1, '2021-02-02', '2021-02-02 19:06:13', 0),
(17, 5, '2021-02-07', '2021-02-07 15:06:59', 1),
(18, 1, '2021-02-07', '2021-02-07 15:09:05', 0),
(19, 2, '2021-02-08', '2021-02-08 19:47:33', 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_kamar`
--
CREATE TABLE IF NOT EXISTS `tb_kamar` (
`id_kamar` int(11) NOT NULL AUTO_INCREMENT,
`id_kategori` int(11) NOT NULL,
`kode_kamar` varchar(20) NOT NULL,
`nama_kamar` varchar(100) NOT NULL,
`harga_kamar` decimal(10,0) NOT NULL,
`status_ready` enum('1','2','3') NOT NULL COMMENT '1=Ready 2=Booked 3=UnReady',
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL,
PRIMARY KEY (`id_kamar`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data untuk tabel `tb_kamar`
--
INSERT INTO `tb_kamar` (`id_kamar`, `id_kategori`, `kode_kamar`, `nama_kamar`, `harga_kamar`, `status_ready`, `create_date`, `status`) VALUES
(1, 1, 'KM-001', 'Ruangan No 103', '600000', '1', '2021-02-07 11:25:25', 0),
(2, 1, 'KM-002', 'Ruangan No 101', '600000', '1', '2021-02-07 21:20:39', 0),
(3, 1, 'KM-003', 'Ruangan No 102', '600000', '1', '2021-02-07 21:21:13', 0),
(4, 1, 'KM-004', 'eqwe', '3123', '1', '2021-02-07 21:30:49', 1),
(5, 1, 'KM-004', 'Ruangan No 104', '600000', '1', '2021-02-07 21:31:51', 0),
(6, 1, 'KM-005', 'Ruangan No 105', '600000', '1', '2021-02-07 21:32:02', 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_kategori`
--
CREATE TABLE IF NOT EXISTS `tb_kategori` (
`id_kategori` int(5) NOT NULL AUTO_INCREMENT,
`nama_kategori` varchar(150) NOT NULL,
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL COMMENT '0=AKTIF 2=NON AKTIF',
PRIMARY KEY (`id_kategori`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;
--
-- Dumping data untuk tabel `tb_kategori`
--
INSERT INTO `tb_kategori` (`id_kategori`, `nama_kategori`, `create_date`, `status`) VALUES
(1, 'Obat Bebas', '2020-11-19 11:30:10', 1),
(2, 'Obat Bebas Terbatas', '2020-11-19 11:30:10', 1),
(3, 'Obat Keras', '2020-11-19 11:30:10', 1),
(4, 'Obat Fitofarmaka', '2020-11-19 11:30:10', 1),
(5, 'Obat Herbal Terstandar (OHT)', '2020-11-19 11:30:10', 1),
(6, 'Obat Herbal (Jamu)', '2020-11-19 11:30:10', 1),
(7, 'Batuk dan Flu', '2020-11-19 11:30:10', 0),
(8, 'Anti-Nyeri', '2020-11-19 11:30:10', 0),
(11, 'Asma', '2020-11-19 11:30:10', 0),
(12, 'DDD', '2020-11-19 11:30:10', 1),
(13, 'ERWRE', '2020-11-19 11:30:10', 1),
(14, 'ssss', '2021-02-01 18:58:13', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_kategori_kamar`
--
CREATE TABLE IF NOT EXISTS `tb_kategori_kamar` (
`id_kategori` int(11) NOT NULL AUTO_INCREMENT,
`nama_kategori` varchar(100) NOT NULL,
`fasilitas` varchar(225) NOT NULL,
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL,
PRIMARY KEY (`id_kategori`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
--
-- Dumping data untuk tabel `tb_kategori_kamar`
--
INSERT INTO `tb_kategori_kamar` (`id_kategori`, `nama_kategori`, `fasilitas`, `create_date`, `status`) VALUES
(1, 'KELAS VIP', 'Nurse Call, Free Wifi, Bed, Sofabed, Box Bayi, AC, TV LED, Lemari, Bedside Locker, Kulkas, Kamar Mandi, Washtafel, Termos Air Panas & Air Mineral, Parkir Ekslusif, Free Minuman dingin', '2021-02-07 19:27:10', 0),
(2, 'KELAS UTAMA', 'Nurse Call, Free Wifi, Bed, Sofabed, Box Bayi, AC, TV LED, Lemari, Bedside Locker, Kamar Mandi, Washtafel, Termos Air Panas & Air Mineral, Parkir Ekslusif, Ruangan lebih besar dari Kelas Pratama', '2021-02-07 13:26:31', 0),
(3, 'KELAS PRATAMA', 'Nurse Call, Free Wifi, Bed, Sofabed, Box Bayi, AC, TV LED, Lemari, Bedside Locker, Kamar Mandi, Washtafel, Termos Air Panas & Air Mineral.', '2021-02-07 19:27:13', 0),
(4, '<NAME>', 'Nurse Call, Free Wifi, Bed, AC, TV LED, Bedside Locker, Kamar Mandi, Air Mineral', '2021-02-07 19:27:21', 0),
(5, '<NAME>', 'Nurse Call, Free Wifi, Bed, AC, TV LED, Bedside Locker, Kamar Mandi, Air Mineral', '2021-02-07 19:27:29', 0),
(6, '<NAME>', 'Nurse Call, Free Wifi,, AC, Bed, TV, Box Bayi, Bedside Locker, Kamar Mandi, Air Mineral', '2021-02-07 19:27:40', 0),
(7, 'erte', '', '2021-02-07 19:27:53', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_layanan`
--
CREATE TABLE IF NOT EXISTS `tb_layanan` (
`id_layanan` int(11) NOT NULL AUTO_INCREMENT,
`id_poliklinik` int(11) NOT NULL,
`deskripsi_layanan` varchar(100) NOT NULL,
`harga_layanan` float NOT NULL,
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL,
PRIMARY KEY (`id_layanan`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data untuk tabel `tb_layanan`
--
INSERT INTO `tb_layanan` (`id_layanan`, `id_poliklinik`, `deskripsi_layanan`, `harga_layanan`, `create_date`, `status`) VALUES
(1, 1, 'Konsultasi', 150000, '2021-02-01 18:25:32', 0),
(2, 1, 'Periksa', 100000, '2021-02-01 19:06:31', 1),
(3, 2, 'Konsultasi Gigi', 120000, '2021-02-01 19:07:17', 0),
(4, 5, 'Cekup', 100000, '2021-02-01 19:46:45', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_metode_bayar`
--
CREATE TABLE IF NOT EXISTS `tb_metode_bayar` (
`id_metode` int(11) NOT NULL AUTO_INCREMENT,
`deskripsi` varchar(100) NOT NULL,
`title_label` varchar(50) NOT NULL,
`status_form` int(1) NOT NULL COMMENT '0=TANPA FORM 1=MENAMPILKAN FORM',
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL,
PRIMARY KEY (`id_metode`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data untuk tabel `tb_metode_bayar`
--
INSERT INTO `tb_metode_bayar` (`id_metode`, `deskripsi`, `title_label`, `status_form`, `create_date`, `status`) VALUES
(1, 'BPJS Kesehatan', 'No Kartu BPJS', 1, '2021-02-01 20:18:12', 0),
(2, 'Tunai', '', 0, '2021-02-01 20:23:00', 0),
(3, 'Debit BCA', 'No Kartu BCA', 1, '2021-02-01 20:35:31', 0),
(4, 'Debit BRI', 'No Kartu BRI', 1, '2021-02-01 20:35:46', 0),
(5, 'Debit Mandiri', 'No Kartu Mandiri', 1, '2021-02-01 20:36:04', 0),
(6, 'testing', '', 0, '2021-02-01 20:44:50', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_poliklinik`
--
CREATE TABLE IF NOT EXISTS `tb_poliklinik` (
`id_poliklinik` int(11) NOT NULL AUTO_INCREMENT,
`nama_poliklinik` varchar(100) NOT NULL,
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL,
PRIMARY KEY (`id_poliklinik`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
--
-- Dumping data untuk tabel `tb_poliklinik`
--
INSERT INTO `tb_poliklinik` (`id_poliklinik`, `nama_poliklinik`, `create_date`, `status`) VALUES
(1, 'KLINIK UMUM TERPADU', '2021-01-26 20:22:06', 0),
(2, 'KLINIK GIGI DAN MULUT', '2021-01-26 20:24:06', 0),
(3, 'e', '2021-01-26 20:32:39', 1),
(4, 'PANTEK', '2021-01-28 11:03:00', 1),
(5, 'KLINIK DARURAT', '2021-01-28 21:15:20', 0),
(6, 'ddd', '2021-02-01 11:50:50', 1),
(7, '335345', '2021-02-01 11:52:34', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_satuan`
--
CREATE TABLE IF NOT EXISTS `tb_satuan` (
`id_satuan` int(11) NOT NULL AUTO_INCREMENT,
`nama_satuan` varchar(50) NOT NULL,
`create_date` datetime NOT NULL,
`status` int(1) NOT NULL COMMENT '0=AKTIF 1=NON AKTIF',
PRIMARY KEY (`id_satuan`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
--
-- Dumping data untuk tabel `tb_satuan`
--
INSERT INTO `tb_satuan` (`id_satuan`, `nama_satuan`, `create_date`, `status`) VALUES
(1, 'Per Tube', '2021-01-18 13:54:08', 0),
(2, 'Per Tablet', '2021-01-18 13:54:18', 0),
(4, 'Per Strip', '2021-01-18 13:54:36', 0),
(5, 'erwe', '2021-01-31 11:12:26', 1),
(6, 'Per Botol', '2021-01-31 18:33:51', 0),
(7, 'Per 2 Strip', '2021-02-04 18:33:19', 0);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_supplier`
--
CREATE TABLE IF NOT EXISTS `tb_supplier` (
`id_supplier` int(11) NOT NULL AUTO_INCREMENT,
`kode_supplier` varchar(20) NOT NULL,
`nama_supplier` varchar(100) NOT NULL,
`alamat_supplier` varchar(150) NOT NULL,
`telepon` varchar(50) NOT NULL,
`tanggal_input` datetime NOT NULL,
`status` int(1) NOT NULL COMMENT '0=AKTIF 1=NON AKTIF',
PRIMARY KEY (`id_supplier`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data untuk tabel `tb_supplier`
--
INSERT INTO `tb_supplier` (`id_supplier`, `kode_supplier`, `nama_supplier`, `alamat_supplier`, `telepon`, `tanggal_input`, `status`) VALUES
(1, 'SP-001', 'K<NAME>', '-', '02161974095451', '2021-01-17 00:00:00', 0),
(2, 'SP-002', 'Kalbe Farma', '-', '082208255114', '2021-01-18 08:21:11', 0),
(3, 'SP-003', 'Guest', '-', '-', '2021-01-19 13:12:45', 0),
(4, 'SP-004', 'K<NAME>', 'Jl.merdeka jakarta', '0778563534', '2021-01-31 05:02:22', 1),
(5, 'SP-005', 'rwer', 'erwer', 'werwr', '2021-01-31 05:04:25', 1),
(6, 'SP-004', 'EWWE', 'WERWER', 'WERW', '2021-01-31 05:06:56', 1);
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_temporary_masuk`
--
CREATE TABLE IF NOT EXISTS `tb_temporary_masuk` (
`id_temporary` int(11) NOT NULL AUTO_INCREMENT,
`id_supplier` int(11) NOT NULL,
`tanggal_masuk` date NOT NULL,
`id_barang` int(11) NOT NULL,
`jumlah` int(11) NOT NULL,
PRIMARY KEY (`id_temporary`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_temporary_transaksi_periksa`
--
CREATE TABLE IF NOT EXISTS `tb_temporary_transaksi_periksa` (
`id_temporary_transaksi_periksa` int(11) NOT NULL AUTO_INCREMENT,
`id_daftar_periksa` int(11) NOT NULL,
`id_barang` int(11) NOT NULL,
`jumlah_obat` int(3) NOT NULL,
PRIMARY KEY (`id_temporary_transaksi_periksa`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_transaksi_periksa`
--
CREATE TABLE IF NOT EXISTS `tb_transaksi_periksa` (
`id_transaksi_periksa` int(11) NOT NULL AUTO_INCREMENT,
`no_transaksi` varchar(50) NOT NULL,
`id_daftar_periksa` int(11) NOT NULL,
`nama_poliklinik` varchar(100) NOT NULL,
`id_layanan` int(11) NOT NULL,
`biaya_layanan` decimal(10,0) NOT NULL,
`biaya_obat` decimal(10,0) NOT NULL,
`sub_total` decimal(10,0) NOT NULL,
`diskon` int(3) NOT NULL,
`ppn` int(3) NOT NULL,
`bayar` decimal(10,0) NOT NULL,
`id_metode` int(11) NOT NULL,
`atas_nama` varchar(100) NOT NULL COMMENT 'NO KARTU ',
`nama_kasir` varchar(100) NOT NULL,
`jam_transaksi` time NOT NULL,
`tanggal_transaksi` date NOT NULL,
`create_date` datetime NOT NULL,
PRIMARY KEY (`id_transaksi_periksa`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
--
-- Dumping data untuk tabel `tb_transaksi_periksa`
--
INSERT INTO `tb_transaksi_periksa` (`id_transaksi_periksa`, `no_transaksi`, `id_daftar_periksa`, `nama_poliklinik`, `id_layanan`, `biaya_layanan`, `biaya_obat`, `sub_total`, `diskon`, `ppn`, `bayar`, `id_metode`, `atas_nama`, `nama_kasir`, `jam_transaksi`, `tanggal_transaksi`, `create_date`) VALUES
(1, 'TRS-0221-000000001', 8, 'KLINIK GIGI DAN MULUT', 3, '120000', '91400', '211400', 0, 0, '211400', 2, '', 'Admin', '18:06:16', '2021-01-28', '2021-02-07 13:16:26'),
(2, 'TRS-0221-000000002', 7, 'KLINIK GIGI DAN MULUT', 3, '120000', '126400', '246400', 0, 0, '246400', 2, '', 'Admin', '18:09:06', '2021-01-28', '2021-02-07 10:14:06'),
(3, 'TRS-0221-000000003', 6, 'KLINIK GIGI DAN MULUT', 3, '120000', '66500', '186500', 0, 0, '186500', 2, '', 'Admin', '22:14:17', '2021-01-28', '0000-00-00 00:00:00'),
(4, 'TRS-0221-000000004', 5, 'KLINIK GIGI DAN MULUT', 3, '120000', '127200', '247200', 0, 0, '247200', 2, '', 'Admin', '22:16:14', '2021-01-28', '0000-00-00 00:00:00'),
(5, 'TRS-0221-000000005', 4, 'KLINIK GIGI DAN MULUT', 3, '120000', '84800', '204800', 0, 0, '204800', 2, '', 'Admin', '22:18:22', '2021-01-28', '0000-00-00 00:00:00'),
(6, 'TRS-0221-000000006', 3, 'KLINIK UMUM TERPADU', 1, '150000', '2300', '152300', 0, 0, '152300', 2, '', 'Admin', '22:20:00', '2021-01-28', '0000-00-00 00:00:00'),
(8, 'TRS-0221-000000007', 2, 'KLINIK GIGI DAN MULUT', 3, '120000', '0', '120000', 0, 0, '120000', 2, '', 'Admin', '09:51:44', '2021-01-28', '0000-00-00 00:00:00'),
(9, 'TRS-0221-000000008', 1, 'KLINIK GIGI DAN MULUT', 3, '120000', '15800', '135800', 0, 0, '135800', 2, '', 'Admin', '10:26:58', '2021-01-28', '0000-00-00 00:00:00'),
(10, 'TRS-0221-000000009', 11, 'KLINIK GIGI DAN MULUT', 3, '120000', '40200', '160200', 0, 0, '160200', 2, '', 'Admin', '11:55:35', '2021-01-31', '2021-02-07 11:55:35'),
(11, 'TRS-0221-000000010', 10, 'KLINIK GIGI DAN MULUT', 3, '120000', '75600', '195600', 0, 0, '195600', 2, '', 'Admin', '16:11:31', '2021-01-31', '2021-02-08 16:11:31'),
(12, 'TRS-0221-000000011', 15, 'KLINIK GIGI DAN MULUT', 3, '120000', '75600', '195600', 19560, 0, '176040', 2, '', 'Admin', '19:49:51', '2021-02-08', '2021-02-08 19:49: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 */;
|
CREATE TYPE item_type AS ENUM (
'Amulet',
'Belt',
'Quiver',
'Ring',
'Talisman',
'Body Armour',
'Boots',
'Gloves',
'Helmet',
'Large Shield',
'Medium Shield',
'Small Shield',
'Hybrid Flask',
'Life Flask',
'Mana Flask',
'Utility Flask',
'Jewel',
'Abyss Jewel',
'Bow',
'Claw',
'Dagger',
'One Hand Axe',
'One Hand Mace',
'One Hand Sword',
'Sceptre',
'Staff',
'Thrusting One Hand Sword',
'Two Hand Axe',
'Two Hand Mace',
'Two Hand Sword',
'Wand',
'Piece'
);
CREATE TYPE currency_type AS ENUM (
'Net',
'Orb',
'Vial',
'Fossil'
);
CREATE TYPE map_fragment_type AS ENUM (
'Breachstone',
'Misc',
'Mortal',
'Prophecy',
'Sacrifice',
'Scarab',
'Shaper'
);
CREATE TABLE bases (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
drop_level smallint NOT NULL,
drop_enabled boolean NOT NULL DEFAULT true,
item_type item_type NOT NULL,
height smallint NULL,
width smallint NULL,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE uniques (
id serial PRIMARY KEY,
name text NOT NULL,
base text NOT NULL REFERENCES bases(name),
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE maps (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
tier smallint NOT NULL,
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE map_fragments (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
fragment_type map_fragment_type NOT NULL,
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE currency (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
stack_size smallint NOT NULL,
currency_type currency_type NOT NULL,
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE currency_fragments (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
stack_size smallint NOT NULL,
fragment_of text NOT NULL REFERENCES currency(name),
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE essences (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
upgrades_to text NULL REFERENCES essences(name),
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE divination_cards (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE incursion_items (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE resonators (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
reforges boolean NOT NULL,
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
);
CREATE TABLE prophecies (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL,
drop_enabled boolean NOT NULL DEFAULT true,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now()
); |
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 26, 2020 at 06:39 PM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `laravelproject`
--
-- --------------------------------------------------------
--
-- Table structure for table `hosteldata`
--
CREATE TABLE `hosteldata` (
`HID` int(11) NOT NULL,
`UID` int(11) NOT NULL,
`Date` datetime NOT NULL DEFAULT current_timestamp(),
`CheckIn` tinyint(1) NOT NULL,
`CheckOut` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `userdata`
--
CREATE TABLE `userdata` (
`UID` int(11) NOT NULL,
`UName` varchar(20) NOT NULL,
`UEmailID` varchar(40) NOT NULL,
`UPassword` varchar(12) NOT NULL,
`MobileNo` bigint(10) NOT NULL,
`Address` text NOT NULL,
`RegiterDate` datetime NOT NULL DEFAULT current_timestamp(),
`AdharCard` bigint(12) NOT NULL,
`RoomNo` int(11) DEFAULT NULL,
`JoiningDate` date DEFAULT NULL,
`LeavingDate` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `userdata`
--
INSERT INTO `userdata` (`UID`, `UName`, `UEmailID`, `UPassword`, `MobileNo`, `Address`, `RegiterDate`, `AdharCard`, `RoomNo`, `JoiningDate`, `LeavingDate`) VALUES
(1, 'admin', '<EMAIL>', 'adminadmin', 987654321, '<PASSWORD>ku<PASSWORD>', '2020-10-22 23:57:06', 987655434, NULL, NULL, NULL),
(10, 'mummy', '<EMAIL>', 'hiral123', 4567890123, '<PASSWORD>', '2020-10-27 11:55:59', 100000000014, NULL, '2020-11-06', '2020-11-15'),
(12, 'bhayu', '<EMAIL>', '<PASSWORD>', 1234560987, 'dtyhuijopkloijuhytrftgyhuij', '2020-11-02 12:47:44', 1234567893, 5, '2020-11-12', NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `hosteldata`
--
ALTER TABLE `hosteldata`
ADD PRIMARY KEY (`HID`),
ADD UNIQUE KEY `UID` (`UID`);
--
-- Indexes for table `userdata`
--
ALTER TABLE `userdata`
ADD PRIMARY KEY (`UID`),
ADD UNIQUE KEY `UEmailID` (`UEmailID`),
ADD UNIQUE KEY `AdharCard` (`AdharCard`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `hosteldata`
--
ALTER TABLE `hosteldata`
MODIFY `HID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `userdata`
--
ALTER TABLE `userdata`
MODIFY `UID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `hosteldata`
--
ALTER TABLE `hosteldata`
ADD CONSTRAINT `hosteldata_ibfk_1` FOREIGN KEY (`UID`) REFERENCES `userdata` (`UID`);
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 */;
|
-- Revert database-registration-view-data:schemas/public from pg
BEGIN;
-- XXX Add DDLs here.
COMMIT;
|
<filename>jadimasak.sql
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 23 Nov 2017 pada 16.55
-- Versi Server: 10.1.21-MariaDB
-- PHP Version: 7.1.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `jadimasak`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `cart`
--
CREATE TABLE `cart` (
`id_user_cart` int(11) NOT NULL,
`id_resep_cart` int(11) NOT NULL,
`namaresep_cart` varchar(100) NOT NULL,
`harga_cart` varchar(100) NOT NULL,
`stock_cart` int(11) NOT NULL,
`gambar_cart` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur dari tabel `resep`
--
CREATE TABLE `resep` (
`id_resep` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`namaresep` varchar(100) NOT NULL,
`harga` varchar(100) NOT NULL,
`kategori` varchar(100) NOT NULL,
`stock` int(11) NOT NULL,
`deskripsi` text NOT NULL,
`gambar` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `resep`
--
INSERT INTO `resep` (`id_resep`, `id_user`, `namaresep`, `harga`, `kategori`, `stock`, `deskripsi`, `gambar`) VALUES
(2, 1, 'Sayur Asem Jakarta', '50000', 'Berkuah', 4, 'Home\r\nAneka Sayur\r\nResep Sayur Asem Jakarta Enak dan Komplit\r\nResep Sayur Asem Jakarta Enak dan Komplit\r\nResepNona Aneka Sayur\r\n\r\nResep sayur asem jakarta atau sayur asem betawi dengan kuah segar menggugah selera. Sayur asem termasuk dalam salah satu sayuran Nusantara yang mempunyai cita rasa tersendiri. Yap dengan rasanya yang manis dan asem, sehingga sayuran yang satu ini sangat cocok jika dihidangkan bersama ikan goreng, ikan asin, ayam goreng dan sambal tentunya. Resep sayur asem jakarta ini hampir sama dengan resep sayur asem jawa ataupun sunda, yang membedakannya hanya terletak pada beberapa tambahan sayuran dan bumbu. Rasanya pun dijamin enak dan segar.', 'assets/images/resep/resep_Sayur Asem Jakarta.jpg'),
(3, 1, 'Sayur Lodeh', '45000', 'Berkuah', 3, 'Home\r\nAneka Sayur\r\nResep Sayur Lodeh Labu Siam Tempe Gurih dan Nikmat\r\nResep Sayur Lodeh Labu Siam Tempe Gurih dan Nikmat\r\nResepNona Aneka Sayur\r\n\r\nResep Sayur Lodeh Labu Siam Tempe Gurih dan Nikmat – Sayur lodeh terdiri dari berbagai macam variasi, mulai dari sayur lodeh nangka muda (tewel), sayur lodeh labu siam (manisa), sayur lodeh labu kuning dan sayur lodeh terong. Meskipun terdiri dari bermacam-macam jenis, namun yang sering kita jumpai hanya sayur lodeh nangka dan sayur lodeh labu siam. Sebenarnya jika dilihat dari bahan, kuah dan rasanya, setiap jenis sayur lodeh mempunyai cita rasa yang bereda-beda.', 'assets/images/resep/resep_Sayur Lodeh.jpg'),
(4, 1, 'bbb', '666', 'Berkuah', 4, 'fff', 'assets/images/resep/resep_bbb.jpg');
-- --------------------------------------------------------
--
-- Struktur dari tabel `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`mobile_number` varchar(12) NOT NULL,
`level` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `user`
--
INSERT INTO `user` (`id`, `username`, `first_name`, `last_name`, `email`, `password`, `mobile_number`, `level`) VALUES
(1, 'admin', 'Ardia', 'RP', '<EMAIL>', '<PASSWORD>', '081213141516', 'Admin'),
(3, 'putriani1111', 'Putriani', 'Puput', '<EMAIL>', '<PASSWORD>9a45ebba', '089687123476', 'Member');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `resep`
--
ALTER TABLE `resep`
ADD PRIMARY KEY (`id_resep`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `resep`
--
ALTER TABLE `resep`
MODIFY `id_resep` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/* Assignment 5.sql
<NAME>
CS 155A, Fall 2017 */
/* Just copy / paste from mysql command-line to a text editor to do this. */
\W
/* library database */
/* Query 0 */
SELECT user(), current_date(), version(), @@sql_mode\G
/* Query 1 */
CREATE DATABASE IF NOT EXISTS library;
USE library;
/* Query 2 */
CREATE TABLE books (
ISBN VARCHAR(11) NOT NULL,
title VARCHAR (29),
pub_date DATE,
publisher_id INT(1) NOT NULL,
category_name VARCHAR(11) NOT NULL,
PRIMARY KEY (ISBN) ) ENGINE = INNODB;
CREATE TABLE member (
card_no INT (4) NOT NULL,
last_name VARCHAR (8) NOT NULL,
first_name VARCHAR (8) ,
address VARCHAR (20),
city VARCHAR (12) NOT NULL,
state CHAR (2) NOT NULL,
zip INT (5) NOT NULL,
region VARCHAR (2),
PRIMARY KEY (card_no) ) ENGINE = INNODB;
CREATE TABLE branches (
branch_id INT (4) NOT NULL,
branch_name VARCHAR (12),
city VARCHAR (13) NOT NULL,
PRIMARY KEY (branch_id) ) ENGINE = INNODB;
CREATE TABLE bookloans (
ISBN VARCHAR(11) NOT NULL,
branch_id INT (4) NOT NULL,
card_no INT (4) NOT NULL,
date_out DATE,
due_date DATE,
FOREIGN KEY (ISBN) REFERENCES BOOKS (ISBN),
FOREIGN KEY (branch_id) REFERENCES BRANCHES (branch_id),
FOREIGN KEY (card_no) REFERENCES MEMBER (card_no)
) ENGINE = INNODB ;
/* Query 3 */
SOURCE c:\my_scripts\insert_data_library_database.sql
/* Query 4 */
SELECT ISBN, title, publisher_id
FROM books;
DESC books;
/* Query 5 */
ALTER TABLE books
ADD date_added DATETIME;
/* Query 6 */
ALTER TABLE member
MODIFY first_name VARCHAR (20) NOT NULL;
/* Query 7 */
DESC books;
DESC member;
/* Query 8 */
SELECT branch_name, city, branch_id
FROM branches;
|
create or replace package finance_data_account
as
/** IBAN data for iban account number generation.
* @author <NAME>
* @version 0.0.1
* @project RANDOM_NINJA
*/
npg_version varchar2(250) := '1.3.0';
g_w_creditcard_tx_status varchar2(4000) := 'Authorized/Pending Capture[6],Captured/Pending Settlement[2],Authorized/Held Pending Release[2],Could Not Void[1],Refund/Pending Settlement[1],Refund[1],Declined[2],Expired[2],Settled Successfully[82],Voided[1]';
g_w_creditcard_tx_type varchar2(4000) := 'Authorization Only[7],Authorization with Auto Capture[83],Capture Only[2],Credit[2],Offline Sale[2],Prior Authorization Capture[2],Void[2]';
end finance_data_account;
/
|
<filename>CartItem.sql<gh_stars>10-100
SELECT
c.id,c.user_id,c.product_package_id,c.nums,c.checked,pkg.product_id,
p.name AS product_name,pkg.price,pkg.stock,pkg.image_url,pkg.description
FROM
carts c
JOIN
product_packages pkg ON c.product_package_id = pkg.id
JOIN
products p ON pkg.product_id = p.id
WHERE
c.deleted_at IS NULL AND
p.deleted_at IS NULL AND
pkg.deleted_at IS NULL AND
c.user_id = 20003 AND
c.product_package_id = 111111112 |
/*
What if you want to select rows based on multiple conditions where some but not all of the conditions need to be met? For this, SQL has the OR operator.
For example, the following returns all films released in either 1994 or 2000:
SELECT title
FROM films
WHERE release_year = 1994
OR release_year = 2000;
Note that you need to specify the column for every OR condition, so the following is invalid:
SELECT title
FROM films
WHERE release_year = 1994 OR 2000;
When combining AND and OR, be sure to enclose the individual clauses in parentheses, like so:
SELECT title
FROM films
WHERE (release_year = 1994 OR release_year = 1995)
AND (certification = 'PG' OR certification = 'R');
Otherwise, due to SQL's precedence rules, you may not get the results you're expecting!
What does the OR operator do?
*/
Display only rows that meet at least one of the specified conditions. |
alter table fanfiction_authorinfo add primary key(uid,field);
alter table fanfiction_blocks drop index block_name;
alter table fanfiction_blocks add unique index block_name (block_name);
alter table fanfiction_categories drop index category;
alter table fanfiction_categories drop index parentcatid;
create index byparent on fanfiction_categories (parentcatid,displayorder);
create index forstoryblock on fanfiction_chapters (sid,validated);
create index byname on fanfiction_classes (class_type,class_name,class_id);
alter table fanfiction_classtypes drop index classtype_title;
create unique index classtype_name on fanfiction_classtypes(classtype_name);
create index code_type on fanfiction_codeblocks(code_type);
alter table fanfiction_comments drop index nid;
alter table fanfiction_comments add index commentlist (nid,time);
alter table fanfiction_favorites drop index uid;
create unique index byitem on fanfiction_favorites (item,type,uid);
create unique index byuid on fanfiction_favorites (uid,type,item);
alter table fanfiction_inseries drop index seriesid;
alter table fanfiction_inseries drop index inorder;
alter table fanfiction_inseries add index (seriesid,inorder);
alter table fanfiction_inseries drop index sid;
alter table fanfiction_inseries add primary key (sid,seriesid);
create index message_name on fanfiction_messages (message_name);
alter table fanfiction_pagelinks drop index link_text;
alter table fanfiction_panels drop index panel_hidden;
alter table fanfiction_panels drop index panel_type;
alter table fanfiction_panels add index panel_type (panel_type,panel_name);
create index avgrating on fanfiction_reviews(type,item,rating);
alter table fanfiction_reviews drop index sid;
create index bychapter on fanfiction_reviews (chapid,rating);
alter table fanfiction_reviews add index byuid (uid,item,type);
alter table fanfiction_series drop index owner;
create index owner on fanfiction_series (uid,title);
alter table fanfiction_stories drop index validated;
create index validateduid on fanfiction_stories (validated,uid);
create index recent on fanfiction_stories (updated,validated); |
/* Delete task which imports all licences */
DELETE FROM "water"."scheduler";
|
<reponame>SamuelSouza2020/BancodeDados
create DATABASE cadastro
DEFAULT character set utf8
DEFAULT COLLATE utf8_general_ci;
use cadastro;
CREATE TABLE pessoas
(
id int NOT NULL AUTO_INCREMENT,
Nome Varchar (30) NOT null,
Nascimento date,
Sexo enum ('M' , 'F'),
Peso decimal (5,2),
Altura decimal (3,2),
Nacionalidade varchar (20) DEFAULT 'Brasil',
PRIMARY KEY(id)
)DEFAULT charset = utf8; |
<reponame>goldmansachs/obevo-kata
CREATE FUNCTION func649() RETURNS integer
LANGUAGE plpgsql
AS $$ DECLARE val INTEGER; BEGIN val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE205);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE299);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE176);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW29);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW71);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW10);CALL FUNC830(MYVAR);CALL FUNC717(MYVAR);CALL FUNC358(MYVAR);CALL FUNC744(MYVAR);END $$;
GO |
<reponame>Bahmni/openmrs-data
set @concept_id = 0;
set @concept_name_short_id = 0;
set @concept_name_full_id = 0;
call add_concept(@concept_id, @concept_name_short_id, @concept_name_full_id, 'Admission', 'Admission', 'N/A', 'Misc', true);
call add_concept_word(@concept_id, @concept_name_short_id, 'Admission', 1);
|
-- DROP PROCEDURE [dbo].[dbx_tests_syntax_empty]
-- @Name Empty
CREATE PROCEDURE [dbo].[dbx_tests_syntax_empty]
AS
; |
<gh_stars>1-10
-- exercise services
CREATE TABLE exercise_services (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
deleted_at TIMESTAMP WITH TIME ZONE,
name VARCHAR(255) NOT NULL,
slug VARCHAR(255) NOT NULL UNIQUE,
public_url VARCHAR(255) NOT NULL,
internal_url VARCHAR(255)
);
CREATE TRIGGER set_timestamp BEFORE
UPDATE ON exercise_services FOR EACH ROW EXECUTE PROCEDURE trigger_set_timestamp();
COMMENT ON TABLE exercise_services IS 'Implements an exercise type. Tasks and user interfaces unique to the exercise type are delegated to these services.';
-- exercise_service_endpoints
CREATE TABLE exercise_service_info (
exercise_service_id UUID PRIMARY KEY REFERENCES exercise_services,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
editor_iframe_path VARCHAR(255) NOT NULL,
exercise_iframe_path VARCHAR(255) NOT NULL,
grade_endpoint_path VARCHAR(255) NOT NULL
);
CREATE TRIGGER set_timestamp BEFORE
UPDATE ON exercise_service_info FOR EACH ROW EXECUTE PROCEDURE trigger_set_timestamp();
COMMENT ON TABLE exercise_service_info IS 'Information that exercise service has reported. Contains for example endpoints where the functionalities of this service can be accessed.';
|
<reponame>joaomfas/BDDAD-2019-2020
-- ** inserir dados nas tabelas **
-- ## tabela Editores ##
INSERT INTO editoras(id_editora, nome)
VALUES (1, 'BMG');
INSERT INTO editoras(id_editora, nome)
VALUES (2, '4AD');
INSERT INTO editoras(id_editora, nome)
VALUES (3, 'Polydor');
INSERT INTO editoras(id_editora, nome)
VALUES (4, 'Universal Music');
INSERT INTO editoras(id_editora, nome)
VALUES (5, 'Warner Music');
INSERT INTO editoras(id_editora, nome)
VALUES (6, 'Island Records');
INSERT INTO editoras(id_editora, nome)
VALUES (7, 'Parlaphone');
INSERT INTO editoras(id_editora, nome)
VALUES (8, 'ADF');
INSERT INTO editoras(id_editora, nome)
VALUES (9, '<NAME>');
-- ## tabela CD ##
INSERT INTO cd(cod_cd, id_editora, titulo, data_compra, valor_pago, local_compra)
VALUES (1, 8, 'Punkzilla', TO_DATE('22/Abril/2011','DD/MON/YY'), 55.00 , 'FNAC');
INSERT INTO cd(cod_cd, id_editora, titulo, data_compra, valor_pago, local_compra)
VALUES (2, 1, 'Classic Duets', TO_DATE('21/Maio/2017','DD/MON/YY'), 30.50, 'Worten');
INSERT INTO cd(cod_cd, id_editora, titulo, data_compra, valor_pago, local_compra)
VALUES (3, 7, 'The Wall', TO_DATE('22/Abril/2011','DD/MON/YY'), 25.80, 'FNAC');
INSERT INTO cd(cod_cd, id_editora, titulo, data_compra, valor_pago, local_compra)
VALUES (4, 1, 'Hits 4', TO_DATE('10/Setembro/2017','DD/MON/YY'), 42.30, 'Worten');
INSERT INTO cd(cod_cd, id_editora, titulo, data_compra, valor_pago, local_compra)
VALUES (5, 6, 'Songs of Experience', TO_DATE('1/Janeiro/2018','DD/MON/YY'), 10.99, NULL);
INSERT INTO cd(cod_cd, id_editora, titulo, data_compra, valor_pago, local_compra)
VALUES (6, 5, 'Giesta 2', TO_DATE('15/Junho/2017','DD/MON/YY'), 9.10, NULL);
INSERT INTO cd(cod_cd, id_editora, titulo, data_compra, valor_pago, local_compra)
VALUES (7, 4, 'O Mundo ao Contrário', TO_DATE('01/Janeiro/2004','DD/MON/YY'), 12.90, 'FNAC');
INSERT INTO cd(cod_cd, id_editora, titulo, data_compra, valor_pago, local_compra)
VALUES (8, 3, 'Born to Die', TO_DATE('27/Janeiro/2012','DD/MON/YY'), 9.90, 'iTunes');
-- ## tabela Musicas ##
--CD 1
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (1, 1, 'Dream of Waking', 'AFI', 3.05);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (2, 1, 'Still', 'Rufio', 3.02);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (3, 1, 'Behind the Music', 'The Vandals', 2.41);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (4, 1, 'Why Are You Alive', 'The Vandals', 2.34);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (5, 1, 'Vandals', 'The Vandals', 4.01);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (6, 1, 'Days of the Phoenix', 'AFI', 3.28);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (7, 1, 'Wester', 'AFI', 3.02);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (8, 1, 'Blue Jeans', 'Lana Del Rey', 3.29);
--CD 2
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (1, 2, 'Bizet: Les pécheurs de perles...', 'Orquestra Filarmónica Real', 5.24);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (2, 2, 'Verdi: Otello/Act 2', 'Orquestra Sinfónica Chicago', 6.47);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (3, 2, 'Verdi: Aida/Act 4', 'Loring Maazel', 4.38);
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (4, 2, 'Puccini: Turandot', 'Zubin Mehta', 3.08);
--CD 3
INSERT INTO musicas(nr_musica, cod_cd, titulo, interprete, duracao)
VALUES (1, 3, 'In the Flesh', 'Pink Floyd', 3.02);
INSERT INTO musicas
VALUES (2, 3, 'The Thin Lee', 'Pink Floyd', 2.30);
INSERT INTO musicas
VALUES (3, 3, 'Mother', 'Pink Floyd', 5.34);
INSERT INTO musicas
VALUES (4, 3, 'Don''t Leave Me Now', 'Pink Floyd', 4.21);
INSERT INTO musicas
VALUES (5, 3, 'Young Lust', 'Pink Floyd', 3.19);
--CD 4
INSERT INTO musicas
VALUES (1, 4, 'It''s Alright(Baby''s Coming Back)', 'Eurythmics', 3.05);
INSERT INTO musicas
VALUES (2, 4, 'Hounds of Love' , 'Kate Bush', 3.02);
INSERT INTO musicas
VALUES (3, 4, 'Calling America', 'Electric Light Orchestra', 2.41);
INSERT INTO musicas
VALUES (4, 4, 'Suspicious Minds', 'Fine Young Cannibals', 2.34);
INSERT INTO musicas
VALUES (5, 4, 'I''m Your Man', 'Wham!', 3.28);
INSERT INTO musicas
VALUES (6, 4, 'Blue Jeans', 'Lana Del Rey', 3.29);
--CD 5
INSERT INTO musicas
VALUES (1, 5, 'Love is All We Have Left', 'U2', 2.41);
INSERT INTO musicas
VALUES (2, 5, 'Lights of Home' , 'U2', 4.16);
INSERT INTO musicas
VALUES (3, 5, 'You''re the Best Thing About Me', 'U2', 3.45);
INSERT INTO musicas
VALUES (4, 5, 'Get Out of Your Own Way', 'U2', 3.58);
INSERT INTO musicas
VALUES (5, 5, 'American Soul', 'U2', 4.21);
INSERT INTO musicas
VALUES (6, 5, 'Summer of Love', 'U2', 3.24);
INSERT INTO musicas
VALUES (7, 5, 'Red Flag Day', 'U2', 3.19);
INSERT INTO musicas
VALUES (8, 5, 'The Showman', 'U2', 3.23);
--CD 6
INSERT INTO musicas
VALUES (1, 6, 'Valsa em Espiral', '<NAME>', 3.34);
INSERT INTO musicas
VALUES (2, 6, '1987' , '<NAME>', 4.12);
INSERT INTO musicas
VALUES (3, 6, '<NAME>', '<NAME>', 3.13);
INSERT INTO musicas
VALUES (4, 6, '<NAME>', '<NAME>', 3.35);
INSERT INTO musicas
VALUES (5, 6, 'Sangemil', '<NAME>', 4.03);
INSERT INTO musicas
VALUES (6, 6, '<NAME>', '<NAME>', 4.41);
INSERT INTO musicas
VALUES (7, 6, '<NAME>', '<NAME>', 5.03);
INSERT INTO musicas
VALUES (8, 6, '20% Mais', '<NAME>', 1.20);
INSERT INTO musicas
VALUES (9, 6, 'Vândalo', '<NAME>', 4.45);
INSERT INTO musicas
VALUES (10, 6, '<NAME>', '<NAME>', 4.45);
--CD 7
INSERT INTO musicas
VALUES (1, 7, 'Desejo', 'Xutos e Pontapés', 3.25);
INSERT INTO musicas
VALUES (2, 7, 'Diz-me' , 'Xutos e Pontapés', 4.37);
INSERT INTO musicas
VALUES (3, 7, 'Ai Se Ele Cai', 'Xutos e Pontapés', 3.12);
INSERT INTO musicas
VALUES (4, 7, 'Pequeno Pormenor', 'Xutos e Pontapés', 2.58);
INSERT INTO musicas
VALUES (5, 7, 'Zona Limite', 'Xutos e Pontapés', 3.27);
INSERT INTO musicas
VALUES (6, 7, 'Fim de Semana', 'Xutos e Pontapés', 5.27);
INSERT INTO musicas
VALUES (7, 7, 'Gota a Gota', 'Xutos e Pontapés', 2.35);
INSERT INTO musicas
VALUES (8, 7, 'Teimosia', 'Xutos e Pontapés', 4.13);
INSERT INTO musicas
VALUES (9, 7, 'O Mundo ao Contrário', 'Xutos e Pontapés', 4.18);
INSERT INTO musicas
VALUES (10, 7, 'Sombra Colorida', 'Xutos e Pontapés', 2.38);
--CD 8
INSERT INTO musicas
VALUES (1, 8, 'Born to Die', 'Lana Del Rey', 4.46);
INSERT INTO musicas
VALUES (2, 8, 'Off the Races' , 'Lana Del Rey', 4.59);
INSERT INTO musicas
VALUES (3, 8, 'Blue Jeans', 'Lana Del Rey', 3.29);
INSERT INTO musicas
VALUES (4, 8, 'Video Games', 'Lana Del Rey', 4.41);
INSERT INTO musicas
VALUES (5, 8, 'Diet Mountain Dew', 'Lana Del Rey', 3.42);
INSERT INTO musicas
VALUES (6, 8, 'National Anthen', 'Lana Del Rey', 3.50);
INSERT INTO musicas
VALUES (7, 8, 'Dark Paradise', 'Lana Del Rey', 4.03);
INSERT INTO musicas
VALUES (8, 8, 'Radio', 'Lana Del Rey', 3.34);
INSERT INTO musicas
VALUES (9, 8, 'Carmen', 'Lana Del Rey', 4.08);
INSERT INTO musicas
VALUES (10, 8, 'Million Dollar Man', 'Lana Del Rey', 3.50);
INSERT INTO musicas
VALUES (11, 8, 'Summertime Sadness', 'Lana Del Rey', 4.24);
INSERT INTO musicas
VALUES (12, 8, 'This Is What Make Us Girls', 'Lana Del Rey', 4.00);
|
WITH
at_tumour AS
(SELECT TUMOURID, LSOA11_CODE, GRADE, AGE, SEX, CREG_CODE, SCREENINGSTATUSFULL_CODE, ER_STATUS, ER_SCORE, PR_STATUS, PR_SCORE, HER2_STATUS, GLEASON_PRIMARY, GLEASON_SECONDARY, GLEASON_TERTIARY, GLEASON_COMBINED, LATERALITY, DIAGNOSISDATEBEST, SITE_ICD10_O2, SITE_ICD10_O2_3CHAR, MORPH_ICD10_O2, BEHAVIOUR_ICD10_O2, T_BEST, N_BEST, M_BEST, STAGE_BEST, STAGE_BEST_SYSTEM
FROM AV2017.AT_TUMOUR_ENGLAND
WHERE (diagnosisdatebest BETWEEN '01-JAN-2013' AND '31-DEC-2017') AND STATUSOFREGISTRATION = 'F' AND CTRY_CODE = 'E' AND DEDUP_FLAG = 1),
at_tumour_exp AS
(SELECT TUMOURID, CANCERCAREPLANINTENT, PERFORMANCESTATUS, CNS, ACE27, DATE_FIRST_SURGERY
FROM AV2017.AT_TUMOUR_EXPERIMENTAL_ENGLAND),
population_ref AS
(SELECT multi_depr_index.QUINTILE_2015, at_tumour.GRADE, at_tumour.AGE, at_tumour.SEX, at_tumour.CREG_CODE, at_tumour.SCREENINGSTATUSFULL_CODE, at_tumour.ER_STATUS, at_tumour.ER_SCORE, at_tumour.PR_STATUS, at_tumour.PR_SCORE, at_tumour.HER2_STATUS, at_tumour.GLEASON_PRIMARY, at_tumour.GLEASON_SECONDARY, at_tumour.GLEASON_TERTIARY, at_tumour.GLEASON_COMBINED, at_tumour.LATERALITY, at_tumour.DIAGNOSISDATEBEST, at_tumour.SITE_ICD10_O2, at_tumour.SITE_ICD10_O2_3CHAR, at_tumour.MORPH_ICD10_O2, at_tumour.BEHAVIOUR_ICD10_O2, at_tumour.T_BEST, at_tumour.N_BEST, at_tumour.M_BEST, at_tumour.STAGE_BEST, at_tumour.STAGE_BEST_SYSTEM, at_tumour_exp.CANCERCAREPLANINTENT, at_tumour_exp.PERFORMANCESTATUS, at_tumour_exp.CNS, at_tumour_exp.ACE27, at_tumour_exp.DATE_FIRST_SURGERY
FROM at_tumour
LEFT JOIN at_tumour_exp
ON at_tumour.tumourid = at_tumour_exp.tumourid
LEFT JOIN IMD.ID2015 multi_depr_index
ON at_tumour.LSOA11_CODE = multi_depr_index.LSOA11_CODE),
population_sim_final AS (SELECT * FROM analysispaulclarke.sim_av_tumour_final),
population_sim_mid AS (SELECT * FROM analysispaulclarke.SIM_AV_TUMOUR),
population_sim_newest AS (SELECT * FROM analysispaulclarke.SIM_AV_TUMOUR_SIMII),
totals_ref AS
(SELECT 'GRADE' AS column_name, TO_CHAR(GRADE) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY GRADE UNION ALL SELECT 'AGE' AS column_name, TO_CHAR(AGE) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY AGE UNION ALL SELECT 'SEX' AS column_name, TO_CHAR(SEX) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY SEX UNION ALL SELECT 'CREG_CODE' AS column_name, TO_CHAR(CREG_CODE) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY CREG_CODE UNION ALL SELECT 'SCREENINGSTATUSFULL_CODE' AS column_name, TO_CHAR(SCREENINGSTATUSFULL_CODE) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY SCREENINGSTATUSFULL_CODE UNION ALL SELECT 'ER_STATUS' AS column_name, TO_CHAR(ER_STATUS) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY ER_STATUS UNION ALL SELECT 'ER_SCORE' AS column_name, TO_CHAR(ER_SCORE) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY ER_SCORE UNION ALL SELECT 'PR_STATUS' AS column_name, TO_CHAR(PR_STATUS) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY PR_STATUS UNION ALL SELECT 'PR_SCORE' AS column_name, TO_CHAR(PR_SCORE) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY PR_SCORE UNION ALL SELECT 'HER2_STATUS' AS column_name, TO_CHAR(HER2_STATUS) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY HER2_STATUS UNION ALL SELECT 'CANCERCAREPLANINTENT' AS column_name, TO_CHAR(CANCERCAREPLANINTENT) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY CANCERCAREPLANINTENT UNION ALL SELECT 'PERFORMANCESTATUS' AS column_name, TO_CHAR(PERFORMANCESTATUS) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY PERFORMANCESTATUS UNION ALL SELECT 'CNS' AS column_name, TO_CHAR(CNS) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY CNS UNION ALL SELECT 'ACE27' AS column_name, TO_CHAR(ACE27) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY ACE27 UNION ALL SELECT 'GLEASON_PRIMARY' AS column_name, TO_CHAR(GLEASON_PRIMARY) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY GLEASON_PRIMARY UNION ALL SELECT 'GLEASON_SECONDARY' AS column_name, TO_CHAR(GLEASON_SECONDARY) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY GLEASON_SECONDARY UNION ALL SELECT 'GLEASON_TERTIARY' AS column_name, TO_CHAR(GLEASON_TERTIARY) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY GLEASON_TERTIARY UNION ALL SELECT 'GLEASON_COMBINED' AS column_name, TO_CHAR(GLEASON_COMBINED) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY GLEASON_COMBINED UNION ALL SELECT 'DATE_FIRST_SURGERY' AS column_name, TO_CHAR(DATE_FIRST_SURGERY) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY DATE_FIRST_SURGERY UNION ALL SELECT 'LATERALITY' AS column_name, TO_CHAR(LATERALITY) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY LATERALITY UNION ALL SELECT 'QUINTILE_2015' AS column_name, TO_CHAR(QUINTILE_2015) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY QUINTILE_2015 UNION ALL SELECT 'DIAGNOSISDATEBEST' AS column_name, TO_CHAR(DIAGNOSISDATEBEST) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY DIAGNOSISDATEBEST UNION ALL SELECT 'SITE_ICD10_O2' AS column_name, TO_CHAR(SITE_ICD10_O2) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY SITE_ICD10_O2 UNION ALL SELECT 'SITE_ICD10_O2_3CHAR' AS column_name, TO_CHAR(SITE_ICD10_O2_3CHAR) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY SITE_ICD10_O2_3CHAR UNION ALL SELECT 'MORPH_ICD10_O2' AS column_name, TO_CHAR(MORPH_ICD10_O2) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY MORPH_ICD10_O2 UNION ALL SELECT 'BEHAVIOUR_ICD10_O2' AS column_name, TO_CHAR(BEHAVIOUR_ICD10_O2) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY BEHAVIOUR_ICD10_O2 UNION ALL SELECT 'T_BEST' AS column_name, TO_CHAR(T_BEST) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY T_BEST UNION ALL SELECT 'N_BEST' AS column_name, TO_CHAR(N_BEST) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY N_BEST UNION ALL SELECT 'M_BEST' AS column_name, TO_CHAR(M_BEST) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY M_BEST UNION ALL SELECT 'STAGE_BEST' AS column_name, TO_CHAR(STAGE_BEST) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY STAGE_BEST UNION ALL SELECT 'STAGE_BEST_SYSTEM' AS column_name, TO_CHAR(STAGE_BEST_SYSTEM) AS val, COUNT(*) AS counts_ref FROM population_ref GROUP BY STAGE_BEST_SYSTEM),
totals_sim_final AS
(SELECT 'GRADE' AS column_name, TO_CHAR(GRADE) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY GRADE UNION ALL SELECT 'AGE' AS column_name, TO_CHAR(AGE) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY AGE UNION ALL SELECT 'SEX' AS column_name, TO_CHAR(SEX) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY SEX UNION ALL SELECT 'CREG_CODE' AS column_name, TO_CHAR(CREG_CODE) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY CREG_CODE UNION ALL SELECT 'SCREENINGSTATUSFULL_CODE' AS column_name, TO_CHAR(SCREENINGSTATUSFULL_CODE) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY SCREENINGSTATUSFULL_CODE UNION ALL SELECT 'ER_STATUS' AS column_name, TO_CHAR(ER_STATUS) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY ER_STATUS UNION ALL SELECT 'ER_SCORE' AS column_name, TO_CHAR(ER_SCORE) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY ER_SCORE UNION ALL SELECT 'PR_STATUS' AS column_name, TO_CHAR(PR_STATUS) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY PR_STATUS UNION ALL SELECT 'PR_SCORE' AS column_name, TO_CHAR(PR_SCORE) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY PR_SCORE UNION ALL SELECT 'HER2_STATUS' AS column_name, TO_CHAR(HER2_STATUS) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY HER2_STATUS UNION ALL SELECT 'CANCERCAREPLANINTENT' AS column_name, TO_CHAR(CANCERCAREPLANINTENT) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY CANCERCAREPLANINTENT UNION ALL SELECT 'PERFORMANCESTATUS' AS column_name, TO_CHAR(PERFORMANCESTATUS) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY PERFORMANCESTATUS UNION ALL SELECT 'CNS' AS column_name, TO_CHAR(CNS) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY CNS UNION ALL SELECT 'ACE27' AS column_name, TO_CHAR(ACE27) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY ACE27 UNION ALL SELECT 'GLEASON_PRIMARY' AS column_name, TO_CHAR(GLEASON_PRIMARY) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY GLEASON_PRIMARY UNION ALL SELECT 'GLEASON_SECONDARY' AS column_name, TO_CHAR(GLEASON_SECONDARY) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY GLEASON_SECONDARY UNION ALL SELECT 'GLEASON_TERTIARY' AS column_name, TO_CHAR(GLEASON_TERTIARY) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY GLEASON_TERTIARY UNION ALL SELECT 'GLEASON_COMBINED' AS column_name, TO_CHAR(GLEASON_COMBINED) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY GLEASON_COMBINED UNION ALL SELECT 'DATE_FIRST_SURGERY' AS column_name, TO_CHAR(DATE_FIRST_SURGERY) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY DATE_FIRST_SURGERY UNION ALL SELECT 'LATERALITY' AS column_name, TO_CHAR(LATERALITY) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY LATERALITY UNION ALL SELECT 'QUINTILE_2015' AS column_name, TO_CHAR(QUINTILE_2015) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY QUINTILE_2015 UNION ALL SELECT 'DIAGNOSISDATEBEST' AS column_name, TO_CHAR(DIAGNOSISDATEBEST) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY DIAGNOSISDATEBEST UNION ALL SELECT 'SITE_ICD10_O2' AS column_name, TO_CHAR(SITE_ICD10_O2) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY SITE_ICD10_O2 UNION ALL SELECT 'SITE_ICD10_O2_3CHAR' AS column_name, TO_CHAR(SITE_ICD10_O2_3CHAR) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY SITE_ICD10_O2_3CHAR UNION ALL SELECT 'MORPH_ICD10_O2' AS column_name, TO_CHAR(MORPH_ICD10_O2) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY MORPH_ICD10_O2 UNION ALL SELECT 'BEHAVIOUR_ICD10_O2' AS column_name, TO_CHAR(BEHAVIOUR_ICD10_O2) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY BEHAVIOUR_ICD10_O2 UNION ALL SELECT 'T_BEST' AS column_name, TO_CHAR(T_BEST) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY T_BEST UNION ALL SELECT 'N_BEST' AS column_name, TO_CHAR(N_BEST) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY N_BEST UNION ALL SELECT 'M_BEST' AS column_name, TO_CHAR(M_BEST) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY M_BEST UNION ALL SELECT 'STAGE_BEST' AS column_name, TO_CHAR(STAGE_BEST) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY STAGE_BEST UNION ALL SELECT 'STAGE_BEST_SYSTEM' AS column_name, TO_CHAR(STAGE_BEST_SYSTEM) AS val, COUNT(*) AS counts_sim_final FROM population_sim_final GROUP BY STAGE_BEST_SYSTEM),
totals_sim_mid AS
(SELECT 'GRADE' AS column_name, TO_CHAR(GRADE) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY GRADE UNION ALL SELECT 'AGE' AS column_name, TO_CHAR(AGE) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY AGE UNION ALL SELECT 'SEX' AS column_name, TO_CHAR(SEX) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY SEX UNION ALL SELECT 'CREG_CODE' AS column_name, TO_CHAR(CREG_CODE) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY CREG_CODE UNION ALL SELECT 'SCREENINGSTATUSFULL_CODE' AS column_name, TO_CHAR(SCREENINGSTATUSFULL_CODE) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY SCREENINGSTATUSFULL_CODE UNION ALL SELECT 'ER_STATUS' AS column_name, TO_CHAR(ER_STATUS) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY ER_STATUS UNION ALL SELECT 'ER_SCORE' AS column_name, TO_CHAR(ER_SCORE) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY ER_SCORE UNION ALL SELECT 'PR_STATUS' AS column_name, TO_CHAR(PR_STATUS) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY PR_STATUS UNION ALL SELECT 'PR_SCORE' AS column_name, TO_CHAR(PR_SCORE) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY PR_SCORE UNION ALL SELECT 'HER2_STATUS' AS column_name, TO_CHAR(HER2_STATUS) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY HER2_STATUS UNION ALL SELECT 'CANCERCAREPLANINTENT' AS column_name, TO_CHAR(CANCERCAREPLANINTENT) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY CANCERCAREPLANINTENT UNION ALL SELECT 'PERFORMANCESTATUS' AS column_name, TO_CHAR(PERFORMANCESTATUS) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY PERFORMANCESTATUS UNION ALL SELECT 'CNS' AS column_name, TO_CHAR(CNS) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY CNS UNION ALL SELECT 'ACE27' AS column_name, TO_CHAR(ACE27) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY ACE27 UNION ALL SELECT 'GLEASON_PRIMARY' AS column_name, TO_CHAR(GLEASON_PRIMARY) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY GLEASON_PRIMARY UNION ALL SELECT 'GLEASON_SECONDARY' AS column_name, TO_CHAR(GLEASON_SECONDARY) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY GLEASON_SECONDARY UNION ALL SELECT 'GLEASON_TERTIARY' AS column_name, TO_CHAR(GLEASON_TERTIARY) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY GLEASON_TERTIARY UNION ALL SELECT 'GLEASON_COMBINED' AS column_name, TO_CHAR(GLEASON_COMBINED) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY GLEASON_COMBINED UNION ALL SELECT 'DATE_FIRST_SURGERY' AS column_name, TO_CHAR(DATE_FIRST_SURGERY) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY DATE_FIRST_SURGERY UNION ALL SELECT 'LATERALITY' AS column_name, TO_CHAR(LATERALITY) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY LATERALITY UNION ALL SELECT 'QUINTILE_2015' AS column_name, TO_CHAR(QUINTILE_2015) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY QUINTILE_2015 UNION ALL SELECT 'DIAGNOSISDATEBEST' AS column_name, TO_CHAR(DIAGNOSISDATEBEST) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY DIAGNOSISDATEBEST UNION ALL SELECT 'SITE_ICD10_O2' AS column_name, TO_CHAR(SITE_ICD10_O2) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY SITE_ICD10_O2 UNION ALL SELECT 'SITE_ICD10_O2_3CHAR' AS column_name, TO_CHAR(SITE_ICD10_O2_3CHAR) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY SITE_ICD10_O2_3CHAR UNION ALL SELECT 'MORPH_ICD10_O2' AS column_name, TO_CHAR(MORPH_ICD10_O2) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY MORPH_ICD10_O2 UNION ALL SELECT 'BEHAVIOUR_ICD10_O2' AS column_name, TO_CHAR(BEHAVIOUR_ICD10_O2) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY BEHAVIOUR_ICD10_O2 UNION ALL SELECT 'T_BEST' AS column_name, TO_CHAR(T_BEST) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY T_BEST UNION ALL SELECT 'N_BEST' AS column_name, TO_CHAR(N_BEST) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY N_BEST UNION ALL SELECT 'M_BEST' AS column_name, TO_CHAR(M_BEST) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY M_BEST UNION ALL SELECT 'STAGE_BEST' AS column_name, TO_CHAR(STAGE_BEST) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY STAGE_BEST UNION ALL SELECT 'STAGE_BEST_SYSTEM' AS column_name, TO_CHAR(STAGE_BEST_SYSTEM) AS val, COUNT(*) AS counts_sim_mid FROM population_sim_mid GROUP BY STAGE_BEST_SYSTEM),
totals_sim_newest AS
(SELECT 'GRADE' AS column_name, TO_CHAR(GRADE) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY GRADE UNION ALL SELECT 'AGE' AS column_name, TO_CHAR(AGE) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY AGE UNION ALL SELECT 'SEX' AS column_name, TO_CHAR(SEX) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY SEX UNION ALL SELECT 'CREG_CODE' AS column_name, TO_CHAR(CREG_CODE) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY CREG_CODE UNION ALL SELECT 'SCREENINGSTATUSFULL_CODE' AS column_name, TO_CHAR(SCREENINGSTATUSFULL_CODE) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY SCREENINGSTATUSFULL_CODE UNION ALL SELECT 'ER_STATUS' AS column_name, TO_CHAR(ER_STATUS) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY ER_STATUS UNION ALL SELECT 'ER_SCORE' AS column_name, TO_CHAR(ER_SCORE) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY ER_SCORE UNION ALL SELECT 'PR_STATUS' AS column_name, TO_CHAR(PR_STATUS) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY PR_STATUS UNION ALL SELECT 'PR_SCORE' AS column_name, TO_CHAR(PR_SCORE) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY PR_SCORE UNION ALL SELECT 'HER2_STATUS' AS column_name, TO_CHAR(HER2_STATUS) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY HER2_STATUS UNION ALL SELECT 'CANCERCAREPLANINTENT' AS column_name, TO_CHAR(CANCERCAREPLANINTENT) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY CANCERCAREPLANINTENT UNION ALL SELECT 'PERFORMANCESTATUS' AS column_name, TO_CHAR(PERFORMANCESTATUS) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY PERFORMANCESTATUS UNION ALL SELECT 'CNS' AS column_name, TO_CHAR(CNS) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY CNS UNION ALL SELECT 'ACE27' AS column_name, TO_CHAR(ACE27) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY ACE27 UNION ALL SELECT 'GLEASON_PRIMARY' AS column_name, TO_CHAR(GLEASON_PRIMARY) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY GLEASON_PRIMARY UNION ALL SELECT 'GLEASON_SECONDARY' AS column_name, TO_CHAR(GLEASON_SECONDARY) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY GLEASON_SECONDARY UNION ALL SELECT 'GLEASON_TERTIARY' AS column_name, TO_CHAR(GLEASON_TERTIARY) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY GLEASON_TERTIARY UNION ALL SELECT 'GLEASON_COMBINED' AS column_name, TO_CHAR(GLEASON_COMBINED) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY GLEASON_COMBINED UNION ALL SELECT 'DATE_FIRST_SURGERY' AS column_name, TO_CHAR(DATE_FIRST_SURGERY) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY DATE_FIRST_SURGERY UNION ALL SELECT 'LATERALITY' AS column_name, TO_CHAR(LATERALITY) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY LATERALITY UNION ALL SELECT 'QUINTILE_2015' AS column_name, TO_CHAR(QUINTILE_2015) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY QUINTILE_2015 UNION ALL SELECT 'DIAGNOSISDATEBEST' AS column_name, TO_CHAR(DIAGNOSISDATEBEST) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY DIAGNOSISDATEBEST UNION ALL SELECT 'SITE_ICD10_O2' AS column_name, TO_CHAR(SITE_ICD10_O2) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY SITE_ICD10_O2 UNION ALL SELECT 'SITE_ICD10_O2_3CHAR' AS column_name, TO_CHAR(SITE_ICD10_O2_3CHAR) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY SITE_ICD10_O2_3CHAR UNION ALL SELECT 'MORPH_ICD10_O2' AS column_name, TO_CHAR(MORPH_ICD10_O2) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY MORPH_ICD10_O2 UNION ALL SELECT 'BEHAVIOUR_ICD10_O2' AS column_name, TO_CHAR(BEHAVIOUR_ICD10_O2) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY BEHAVIOUR_ICD10_O2 UNION ALL SELECT 'T_BEST' AS column_name, TO_CHAR(T_BEST) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY T_BEST UNION ALL SELECT 'N_BEST' AS column_name, TO_CHAR(N_BEST) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY N_BEST UNION ALL SELECT 'M_BEST' AS column_name, TO_CHAR(M_BEST) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY M_BEST UNION ALL SELECT 'STAGE_BEST' AS column_name, TO_CHAR(STAGE_BEST) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY STAGE_BEST UNION ALL SELECT 'STAGE_BEST_SYSTEM' AS column_name, TO_CHAR(STAGE_BEST_SYSTEM) AS val, COUNT(*) AS counts_sim_newest FROM population_sim_newest GROUP BY STAGE_BEST_SYSTEM),
join_table1 AS
(SELECT
NVL(totals_ref.column_name, totals_sim_final.column_name) AS column_name,
NVL(totals_ref.val, NVL(totals_sim_final.val, 'None')) AS val,
NVL(counts_ref, 0) AS counts_ref,
NVL(counts_sim_final, 0) AS counts_sim_final
FROM totals_ref
FULL OUTER JOIN totals_sim_final
ON ((totals_ref.column_name = totals_sim_final.column_name AND (totals_ref.val = totals_sim_final.val OR (totals_ref.val IS NULL AND totals_sim_final.val IS NULL)))
OR (totals_ref.column_name = 'CREG_CODE' AND totals_sim_final.column_name = 'CREG_CODE' AND SUBSTR(totals_ref.val, 2) = SUBSTR(totals_sim_final.val, 2))
OR (totals_ref.column_name = 'QUINTILE_2015' AND totals_sim_final.column_name = 'QUINTILE_2015' AND SUBSTR(totals_ref.val, 1, 1) = SUBSTR(totals_sim_final.val, 1, 1)))),
join_table2 AS
(SELECT
NVL(join_table1.column_name, totals_sim_mid.column_name) AS column_name,
NVL(join_table1.val, NVL(totals_sim_mid.val, 'None')) AS val,
NVL(counts_ref, 0) AS counts_ref,
NVL(counts_sim_final, 0) AS counts_sim_final,
NVL(counts_sim_mid, 0) AS counts_sim_mid
FROM join_table1
FULL OUTER JOIN totals_sim_mid
ON ((join_table1.column_name = totals_sim_mid.column_name AND (join_table1.val = totals_sim_mid.val OR (join_table1.val IS NULL AND totals_sim_mid.val IS NULL)))
OR (join_table1.column_name = 'CREG_CODE' AND totals_sim_mid.column_name = 'CREG_CODE' AND SUBSTR(join_table1.val, 2) = SUBSTR(totals_sim_mid.val, 2))
OR (join_table1.column_name = 'QUINTILE_2015' AND totals_sim_mid.column_name = 'QUINTILE_2015' AND SUBSTR(join_table1.val, 1, 1) = SUBSTR(totals_sim_mid.val, 1, 1)))),
join_table3 AS
(SELECT
NVL(join_table2.column_name, totals_sim_newest.column_name) AS column_name,
NVL(join_table2.val, NVL(totals_sim_newest.val, 'None')) AS val,
NVL(counts_ref, 0) AS counts_ref,
NVL(counts_sim_final, 0) AS counts_sim_final,
NVL(counts_sim_mid, 0) AS counts_sim_mid,
NVL(counts_sim_newest, 0) AS counts_sim_newest
FROM join_table2
FULL OUTER JOIN totals_sim_newest
ON ((join_table2.column_name = totals_sim_newest.column_name AND (join_table2.val = totals_sim_newest.val OR (join_table2.val IS NULL AND totals_sim_newest.val IS NULL)))
OR (join_table2.column_name = 'CREG_CODE' AND totals_sim_newest.column_name = 'CREG_CODE' AND SUBSTR(join_table2.val, 2) = SUBSTR(totals_sim_newest.val, 2))
OR (join_table2.column_name = 'QUINTILE_2015' AND totals_sim_newest.column_name = 'QUINTILE_2015' AND SUBSTR(join_table2.val, 1, 1) = SUBSTR(totals_sim_newest.val, 1, 1))))
SELECT * FROM join_table3
|
update bench.sample_one set country = 'Brazil'
where country = 'Peru'; |
<reponame>lucianobajr/banco
ALTER TABLE carro ADD numerodevalvulas INT NOT NULL DEFAULT 8;
UPDATE carro SET numerodevalvulas=16 WHERE modelo="Punto" AND versao="T-JET";
UPDATE carro SET numerodevalvulas=16 WHERE modelo="Fusion" AND versao="SEL2.5";
UPDATE carro SET numerodevalvulas=24 WHERE modelo="Fusion" AND versao="SELV6"; |
-- attach ruptures info to shakemap extents table
SELECT
a.scenario,
--b.rupture_name,
b.magnitude,
CAST(b.rake AS NUMERIC),
CAST(b.lon AS NUMERIC),
CAST(b.lat AS NUMERIC),
CAST(b.depth AS NUMERIC),
a.geom
INTO gmf.shakemap_scenario_extents_tbl
FROM gmf.shakemap_scenario_extents_temp a
LEFT JOIN ruptures.rupture_table b on a.scenario = b.rupture_name;
-- fix invalid projection
ALTER TABLE gmf.shakemap_scenario_extents_tbl
ALTER COLUMN geom TYPE geometry(POLYGON,4326) USING ST_SetSRID(geom,4326);
-- create shakemap extents view
DROP VIEW IF EXISTS gmf.shakemap_scenario_extents CASCADE;
CREATE VIEW gmf.shakemap_scenario_extents AS
SELECT * FROM gmf.shakemap_scenario_extents_tbl;
-- create index
CREATE INDEX IF NOT EXISTS shakemap_scenario_extents_idx ON gmf.shakemap_scenario_extents_tbl USING GIST(geom);
DROP TABLE IF EXISTS gmf.shakemap_scenario_extents_temp;
-- create index on master dsra table
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_assetid_idx ON dsra.dsra_all_scenarios_tbl(assetid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_sauid_idx ON dsra.dsra_all_scenarios_tbl(sauid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_pruid_idx ON dsra.dsra_all_scenarios_tbl(pruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_eruid_idx ON dsra.dsra_all_scenarios_tbl(eruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_cduid_idx ON dsra.dsra_all_scenarios_tbl(cduid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_csduid_idx ON dsra.dsra_all_scenarios_tbl(csduid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_fsauid_idx ON dsra.dsra_all_scenarios_tbl(fsauid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_dauid_idx ON dsra.dsra_all_scenarios_tbl(dauid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_geom_idx ON dsra.dsra_all_scenarios_tbl USING GIST(geom_point);
-- create master dsra building view
DROP VIEW IF EXISTS dsra.dsra_all_scenarios_building CASCADE;
CREATE VIEW dsra.dsra_all_scenarios_building AS
SELECT * FROM dsra.dsra_all_scenarios_tbl ORDER BY assetid,sh_rupname;
-- create master dsra sauid view
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_sauid_tbl_temp CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_sauid_tbl_temp AS
(
SELECT
a.sauid,
a.dauid,
a.csduid,
a.csdname,
a.cduid,
a.cdname,
a.fsauid,
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake
FROM dsra.dsra_all_scenarios_tbl a
GROUP BY sauid,dauid,csduid,csdname,cduid,cdname,fsauid,eruid,ername,pruid,prname,sh_rupname,sh_rupabbr,sh_mag,sh_hypolon,sh_hypolat,sh_hypodepth,sh_rake);
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_sauid_tbl CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_sauid_tbl AS
(
SELECT
a.sauid,
a.dauid,
a.csduid,
a.csdname,
a.cduid,
a.cdname,
a.fsauid,
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake,
b.geom
FROM dsra.dsra_all_scenarios_sauid_tbl_temp a
LEFT JOIN boundaries."Geometry_SAUID" b ON a.sauid = b."SAUIDt");
-- create index on master dsra sauid table
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_sauid_sauid_idx ON dsra.dsra_all_scenarios_sauid_tbl(sauid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_sauid_dauid_idx ON dsra.dsra_all_scenarios_sauid_tbl(dauid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_sauid_csduid_idx ON dsra.dsra_all_scenarios_sauid_tbl(csduid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_sauid_fsauid_idx ON dsra.dsra_all_scenarios_sauid_tbl(fsauid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_sauid_cduid_idx ON dsra.dsra_all_scenarios_sauid_tbl(cduid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_sauid_eruid_idx ON dsra.dsra_all_scenarios_sauid_tbl(eruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_sauid_pruid_idx ON dsra.dsra_all_scenarios_sauid_tbl(pruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_sauid_geom_idx ON dsra.dsra_all_scenarios_sauid_tbl USING GIST(geom);
-- create master dsra sauid view
DROP VIEW IF EXISTS dsra.dsra_all_scenarios_sauid CASCADE;
CREATE VIEW dsra.dsra_all_scenarios_sauid AS
SELECT * FROM dsra.dsra_all_scenarios_sauid_tbl ORDER BY sauid,sh_rupname;
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_sauid_tbl_temp CASCADE;
-- create master dsra dauid view
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_dauid_tbl_temp CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_dauid_tbl_temp AS
(
SELECT
a.dauid,
a.csduid,
a.csdname,
a.cduid,
a.cdname,
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake
FROM dsra.dsra_all_scenarios_tbl a
LEFT JOIN boundaries."Geometry_DAUID" b ON a.dauid = b."DAUID"
GROUP BY dauid,csduid,csdname,cduid,cdname,eruid,ername,pruid,prname,sh_rupname,sh_rupabbr,sh_mag,sh_hypolon,sh_hypolat,sh_hypodepth,sh_rake);
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_dauid_tbl CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_dauid_tbl AS
(
SELECT
a.dauid,
a.csduid,
a.csdname,
a.cduid,
a.cdname,
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake,
b.geom
FROM dsra.dsra_all_scenarios_dauid_tbl_temp a
LEFT JOIN boundaries."Geometry_DAUID" b ON a.dauid = b."DAUID");
-- create index on master dsra dauid table
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_dauid_dauid_idx ON dsra.dsra_all_scenarios_dauid_tbl(dauid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_dauid_csduid_idx ON dsra.dsra_all_scenarios_dauid_tbl(csduid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_dauid_cduid_idx ON dsra.dsra_all_scenarios_dauid_tbl(cduid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_dauid_eruid_idx ON dsra.dsra_all_scenarios_dauid_tbl(eruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_dauid_pruid_idx ON dsra.dsra_all_scenarios_dauid_tbl(pruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_dauid_geom_idx ON dsra.dsra_all_scenarios_dauid_tbl USING GIST(geom);
-- create master dsra dauid view
DROP VIEW IF EXISTS dsra.dsra_all_scenarios_dauid CASCADE;
CREATE VIEW dsra.dsra_all_scenarios_dauid AS
SELECT * FROM dsra.dsra_all_scenarios_dauid_tbl ORDER BY dauid,sh_rupname;
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_dauid_tbl_temp CASCADE;
-- create master dsra csduid view
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_csduid_tbl_temp CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_csduid_tbl_temp AS
(
SELECT
a.csduid,
a.csdname,
a.cduid,
a.cdname,
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake
FROM dsra.dsra_all_scenarios_tbl a
GROUP BY csduid,csdname,cduid,cdname,eruid,ername,pruid,prname,sh_rupname,sh_rupabbr,sh_mag,sh_hypolon,sh_hypolat,sh_hypodepth,sh_rake);
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_csduid_tbl CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_csduid_tbl AS
(
SELECT
a.csduid,
a.csdname,
a.cduid,
a.cdname,
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake,
b.geom
FROM dsra.dsra_all_scenarios_csduid_tbl_temp a
LEFT JOIN boundaries."Geometry_CSDUID" b ON a.csduid = b."CSDUID");
-- create index on master dsra csduid table
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_csduid_csduid_idx ON dsra.dsra_all_scenarios_csduid_tbl(csduid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_csduid_cduid_idx ON dsra.dsra_all_scenarios_csduid_tbl(cduid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_csduid_eruid_idx ON dsra.dsra_all_scenarios_csduid_tbl(eruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_csduid_pruid_idx ON dsra.dsra_all_scenarios_csduid_tbl(pruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_csduid_geom_idx ON dsra.dsra_all_scenarios_csduid_tbl USING GIST(geom);
-- create master dsra csduid view
DROP VIEW IF EXISTS dsra.dsra_all_scenarios_csduid CASCADE;
CREATE VIEW dsra.dsra_all_scenarios_csduid AS
SELECT * FROM dsra.dsra_all_scenarios_csduid_tbl ORDER BY csduid,sh_rupname;
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_csduid_tbl_temp CASCADE;
-- create master dsra fsauid view
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_fsauid_tbl_temp CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_fsauid_tbl_temp AS
(
SELECT
a.fsauid,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake
FROM dsra.dsra_all_scenarios_tbl a
GROUP BY fsauid,pruid,prname,sh_rupname,sh_rupabbr,sh_mag,sh_hypolon,sh_hypolat,sh_hypodepth,sh_rake);
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_fsauid_tbl CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_fsauid_tbl AS
(
SELECT
a.fsauid,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake,
b.geom
FROM dsra.dsra_all_scenarios_fsauid_tbl_temp a
LEFT JOIN boundaries."Geometry_FSAUID" b ON a.fsauid = b."CFSAUID");
-- create index on master dsra fsauid table
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_fsauid_fsauid_idx ON dsra.dsra_all_scenarios_fsauid_tbl(fsauid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_fsauid_pruid_idx ON dsra.dsra_all_scenarios_fsauid_tbl(pruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_fsauid_geom_idx ON dsra.dsra_all_scenarios_fsauid_tbl USING GIST(geom);
-- create master dsra fsauid view
DROP VIEW IF EXISTS dsra.dsra_all_scenarios_fsauid CASCADE;
CREATE VIEW dsra.dsra_all_scenarios_fsauid AS
SELECT * FROM dsra.dsra_all_scenarios_fsauid_tbl ORDER BY fsauid,sh_rupname;
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_fsauid_tbl_temp CASCADE;
-- create master dsra cduid view
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_cduid_tbl_temp CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_cduid_tbl_temp AS
(
SELECT
a.cduid,
a.cdname,
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake
FROM dsra.dsra_all_scenarios_tbl a
GROUP BY cduid,cdname,eruid,ername,pruid,prname,sh_rupname,sh_rupabbr,sh_mag,sh_hypolon,sh_hypolat,sh_hypodepth,sh_rake);
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_cduid_tbl CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_cduid_tbl AS
(
SELECT
a.cduid,
a.cdname,
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake,
b.geom
FROM dsra.dsra_all_scenarios_cduid_tbl_temp a
LEFT JOIN boundaries."Geometry_CDUID" b ON a.cduid = b."CDUID");
-- create index on master dsra cduid table
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_cduid_cduid_idx ON dsra.dsra_all_scenarios_cduid_tbl(cduid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_cduid_eruid_idx ON dsra.dsra_all_scenarios_cduid_tbl(eruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_cduid_pruid_idx ON dsra.dsra_all_scenarios_cduid_tbl(pruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_cduid_geom_idx ON dsra.dsra_all_scenarios_cduid_tbl USING GIST(geom);
-- create master dsra cduid view
DROP VIEW IF EXISTS dsra.dsra_all_scenarios_cduid CASCADE;
CREATE VIEW dsra.dsra_all_scenarios_cduid AS
SELECT * FROM dsra.dsra_all_scenarios_cduid_tbl ORDER BY cduid,sh_rupname;
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_cduid_tbl_temp CASCADE;
-- create master dsra eruid view
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_eruid_tbl_temp CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_eruid_tbl_temp AS
(
SELECT
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake
FROM dsra.dsra_all_scenarios_tbl a
GROUP BY eruid,ername,pruid,prname,sh_rupname,sh_mag,sh_rupabbr,sh_hypolon,sh_hypolat,sh_hypodepth,sh_rake);
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_eruid_tbl CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_eruid_tbl AS
(
SELECT
a.eruid,
a.ername,
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake,
b.geom
FROM dsra.dsra_all_scenarios_eruid_tbl_temp a
LEFT JOIN boundaries."Geometry_ERUID" b ON a.eruid = b."ERUID");
-- create index on master dsra eruid table
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_eruid_eruid_idx ON dsra.dsra_all_scenarios_eruid_tbl(eruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_eruid_pruid_idx ON dsra.dsra_all_scenarios_eruid_tbl(pruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_eruid_geom_idx ON dsra.dsra_all_scenarios_eruid_tbl USING GIST(geom);
-- create master dsra eruid view
DROP VIEW IF EXISTS dsra.dsra_all_scenarios_eruid CASCADE;
CREATE VIEW dsra.dsra_all_scenarios_eruid AS
SELECT * FROM dsra.dsra_all_scenarios_eruid_tbl ORDER BY eruid,sh_rupname;
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_eruid_tbl_temp CASCADE;
-- create master dsra pruid view
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_pruid_tbl_temp CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_pruid_tbl_temp AS
(
SELECT
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake
FROM dsra.dsra_all_scenarios_tbl a
GROUP BY pruid,prname,sh_rupname,sh_rupabbr,sh_mag,sh_hypolon,sh_hypolat,sh_hypodepth,sh_rake);
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_pruid_tbl CASCADE;
CREATE TABLE dsra.dsra_all_scenarios_pruid_tbl AS
(
SELECT
a.pruid,
a.prname,
a.sh_rupname,
a.sh_rupabbr,
a.sh_mag,
a.sh_hypolon,
a.sh_hypolat,
a.sh_hypodepth,
a.sh_rake,
b.geom
FROM dsra.dsra_all_scenarios_pruid_tbl_temp a
LEFT JOIN boundaries."Geometry_PRUID" b ON a.pruid = b."PRUID");
-- create index on master dsra pruid table
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_pruid_pruid_idx ON dsra.dsra_all_scenarios_pruid_tbl(pruid);
CREATE INDEX IF NOT EXISTS dsra_all_scenarios_pruid_geom_idx ON dsra.dsra_all_scenarios_pruid_tbl USING GIST(geom);
-- create master dsra pruid view
DROP VIEW IF EXISTS dsra.dsra_all_scenarios_pruid CASCADE;
CREATE VIEW dsra.dsra_all_scenarios_pruid AS
SELECT * FROM dsra.dsra_all_scenarios_pruid_tbl ORDER BY pruid,sh_rupname;
DROP TABLE IF EXISTS dsra.dsra_all_scenarios_pruid_tbl_temp CASCADE; |
alter table "public"."group_pricing" add column "group_id" bigint
not null;
|
/*
SQLyog Community v13.1.5 (32 bit)
MySQL - 5.7.36 : Database - retailmart
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`retailmart` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `retailmart`;
/*Table structure for table `cart` */
DROP TABLE IF EXISTS `cart`;
CREATE TABLE `cart` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ssnorderid` varchar(255) NOT NULL,
`orderid` int(11) unsigned NOT NULL DEFAULT '0',
`itemid` int(11) unsigned NOT NULL DEFAULT '0',
`name` varchar(255) NOT NULL,
`price` decimal(10,2) NOT NULL DEFAULT '0.00',
`qty` int(11) unsigned NOT NULL DEFAULT '0',
`isfree` enum('0','1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=31 DEFAULT CHARSET=latin1;
/*Data for the table `cart` */
insert into `cart`(`id`,`ssnorderid`,`orderid`,`itemid`,`name`,`price`,`qty`,`isfree`) values
(1,'cf1ba65f-c64f-4c5f-a33b-9637b5502a04',0,2,'Vegetables ',50.00,3,'0'),
(18,'1b88eceb-8d11-4ddd-b374-df688f9885c4',0,2,'Vegetables ',50.00,1,'0'),
(3,'cf1ba65f-c64f-4c5f-a33b-9637b5502a04',0,3,'Ready to Eatables',75.00,3,'0'),
(4,'cf1ba65f-c64f-4c5f-a33b-9637b5502a04',0,2,'Vegetables ',50.00,1,'0'),
(5,'cf1ba65f-c64f-4c5f-a33b-9637b5502a04',0,5,'Bakery item',30.00,4,'0'),
(6,'cf1ba65f-c64f-4c5f-a33b-9637b5502a04',0,4,'Grocery ',25.00,2,'0'),
(7,'cf1ba65f-c64f-4c5f-a33b-9637b5502a04',0,4,'Grocery ',25.00,1,'0'),
(8,'cf1ba65f-c64f-4c5f-a33b-9637b5502a04',0,4,'Grocery ',25.00,1,'0'),
(10,'cf1ba65f-c64f-4c5f-a33b-9637b5502a04',0,1,'Fruits ',100.00,1,'0'),
(20,'5c952ec6-937f-469a-8da5-2d3efcaea892',0,1,'Fruits ',100.00,3,'0'),
(19,'1b88eceb-8d11-4ddd-b374-df688f9885c4',0,3,'Ready to Eatables',75.00,1,'0'),
(17,'1b88eceb-8d11-4ddd-b374-df688f9885c4',0,1,'Fruits ',100.00,1,'0'),
(21,'5c952ec6-937f-469a-8da5-2d3efcaea892',0,1,'Fruits ',100.00,1,'0'),
(22,'5c952ec6-937f-469a-8da5-2d3efcaea892',0,1,'Fruits ',100.00,1,'0'),
(23,'5c952ec6-937f-469a-8da5-2d3efcaea892',0,1,'Fruits ',100.00,1,'0'),
(24,'5c952ec6-937f-469a-8da5-2d3efcaea892',0,6,'Dry Fruits',300.00,1,'0'),
(25,'cafa9226-6660-4ac7-9664-3058edde25e0',0,1,'Fruits ',100.00,1,'0'),
(26,'cafa9226-6660-4ac7-9664-3058edde25e0',0,2,'Vegetables ',50.00,1,'0'),
(27,'cafa9226-6660-4ac7-9664-3058edde25e0',0,3,'Ready to Eatables',75.00,1,'0'),
(28,'cafa9226-6660-4ac7-9664-3058edde25e0',0,4,'Grocery ',25.00,1,'0'),
(29,'cafa9226-6660-4ac7-9664-3058edde25e0',0,6,'Dry Fruits',300.00,3,'0'),
(30,'cafa9226-6660-4ac7-9664-3058edde25e0',0,5,'Bakery item',0.00,1,'1');
/*Table structure for table `items` */
DROP TABLE IF EXISTS `items`;
CREATE TABLE `items` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`price` decimal(10,2) NOT NULL,
`status` enum('0','1') NOT NULL DEFAULT '0' COMMENT '0-In Active,1-Active',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*Data for the table `items` */
insert into `items`(`id`,`name`,`price`,`status`) values
(1,'Fruits ',100.00,'1'),
(2,'Vegetables ',50.00,'1'),
(3,'Ready to Eatables',75.00,'1'),
(4,'Grocery ',25.00,'1'),
(5,'Bakery item',30.00,'1'),
(6,'Dry Fruits',300.00,'1');
/*Table structure for table `orderidgen` */
DROP TABLE IF EXISTS `orderidgen`;
CREATE TABLE `orderidgen` (
`orderid` int(11) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`orderid`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*Data for the table `orderidgen` */
insert into `orderidgen`(`orderid`) values
(1);
/*Table structure for table `orders` */
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ssnorderid` varchar(255) NOT NULL,
`orderid` int(11) unsigned NOT NULL DEFAULT '0',
`total` decimal(10,2) NOT NULL DEFAULT '0.00',
`discamt` decimal(10,2) NOT NULL DEFAULT '0.00',
`cashdisc` decimal(10,2) NOT NULL DEFAULT '0.00',
`amttopay` decimal(10,2) NOT NULL DEFAULT '0.00',
`paytype` enum('0','1','2') NOT NULL DEFAULT '0' COMMENT '0-None,1-Cash,2-Credit',
`paidstatus` enum('0','1') NOT NULL DEFAULT '0' COMMENT '0-UnPaid,1-Paid',
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQUE` (`ssnorderid`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*Data for the table `orders` */
insert into `orders`(`id`,`ssnorderid`,`orderid`,`total`,`discamt`,`cashdisc`,`amttopay`,`paytype`,`paidstatus`) values
(1,'cf1ba65f-c64f-4c5f-a33b-9637b5502a04',0,745.00,74.50,0.00,0.00,'0','0'),
(6,'1b88eceb-8d11-4ddd-b374-df688f9885c4',0,225.00,0.00,0.00,225.00,'2','1'),
(7,'5c952ec6-937f-469a-8da5-2d3efcaea892',0,900.00,90.00,16.20,793.80,'1','1'),
(8,'cafa9226-6660-4ac7-9664-3058edde25e0',1,1150.00,115.00,0.00,1035.00,'2','1');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
SELECT [Description],
c.[Name] AS [CategoryName]
FROM Reports AS r
JOIN Categories AS c ON c.Id = r.CategoryId
ORDER BY [Description],
c.[Name] |
-- test: basic
CREATE TABLE test(a PRIMARY KEY);
SELECT name, sql FROM __genji_catalog WHERE type = "table" AND name = "test";
/* result:
{
"name": "test",
"sql": "CREATE TABLE test (a ANY NOT NULL, CONSTRAINT test_pk PRIMARY KEY (a))"
}
*/
-- test: with type
CREATE TABLE test(a INT PRIMARY KEY);
SELECT name, sql FROM __genji_catalog WHERE type = "table" AND name = "test";
/* result:
{
"name": "test",
"sql": "CREATE TABLE test (a INTEGER NOT NULL, CONSTRAINT test_pk PRIMARY KEY (a))"
}
*/
-- test: twice
CREATE TABLE test(a INT PRIMARY KEY PRIMARY KEY);
-- error:
-- test: duplicate
CREATE TABLE test(a INT PRIMARY KEY, b INT PRIMARY KEY);
-- error:
-- test: table constraint: one field
CREATE TABLE test(a INT, PRIMARY KEY(a));
SELECT name, sql FROM __genji_catalog WHERE type = "table" AND name = "test";
/* result:
{
"name": "test",
"sql": "CREATE TABLE test (a INTEGER NOT NULL, CONSTRAINT test_pk PRIMARY KEY (a))"
}
*/
-- test: table constraint: multiple fields
CREATE TABLE test(a INT, b INT, PRIMARY KEY(a, b));
SELECT name, sql FROM __genji_catalog WHERE type = "table" AND name = "test";
/* result:
{
"name": "test",
"sql": "CREATE TABLE test (a INTEGER NOT NULL, b INTEGER NOT NULL, CONSTRAINT test_pk PRIMARY KEY (a, b))"
}
*/
-- test: table constraint: nested fields
CREATE TABLE test(a (b INT), PRIMARY KEY(a.b));
SELECT name, sql FROM __genji_catalog WHERE type = "table" AND name = "test";
/* result:
{
"name": "test",
"sql": "CREATE TABLE test (a (b INTEGER NOT NULL), CONSTRAINT test_pk PRIMARY KEY (a.b))"
}
*/
-- test: table constraint: undeclared fields
CREATE TABLE test(a INT, b INT, PRIMARY KEY(a, b, c));
-- error:
-- test: table constraint: same field twice
CREATE TABLE test(a INT, b INT, PRIMARY KEY(a, a));
-- error:
-- test: table constraint: same field twice, field constraint + table constraint
CREATE TABLE test(a INT PRIMARY KEY, b INT, PRIMARY KEY(a));
-- error:
-- test: table constraint: duplicate
CREATE TABLE test(a INT PRIMARY KEY, b INT, PRIMARY KEY(b));
-- error:
|
<gh_stars>1-10
USE PasswordWeb
GO
-- Insert rows into table 'School'
INSERT INTO School
( -- columns to insert data into
[Name]
)
VALUES
( -- first row: values for the columns in the list above
'Bethesda Elementary School'
),
( -- second row: values for the columns in the list above
'Burton Magnet Elementary School'
),
(
'C.C. Spaulding Elementary'
),
(
'Club Boulevard Magnet Elementary'
),
(
'Creekside Elementary'
),
(
'E.K. Powe Elementary School'
)
-- add more rows here
GO
-- Insert rows into table 'Teacher'
INSERT INTO Teacher
( -- columns to insert data into
[Name]
)
VALUES
(
'<NAME>'
),
(
'<NAME>'
),
(
'<NAME>'
),
(
'<NAME>'
),
(
'<NAME>'
),
(
'<NAME>'
)
-- add more rows here
GO
-- Insert rows into table 'TeachesAt'
INSERT INTO TeachesAt
( -- columns to insert data into
[SchoolId], [TeacherId]
)
VALUES
(
1, 1
),
(
1, 2
),
(
3, 3
),
(
4, 4
),
(
5, 5
),
(
6, 6
)
-- add more rows here
GO |
<gh_stars>10-100
SELECT *
FROM `a`
UNION
SELECT *
FROM `b`;
|
<filename>src/hg/lib/transRegCodeMotif.sql
# dnaMotif.sql was originally generated by the autoSql program, which also
# generated dnaMotif.c and dnaMotif.h. This creates the database representation of
# an object which can be loaded and saved from RAM in a fairly
# automatic way.
#A gapless DNA motif
CREATE TABLE transRegCodeMotif (
name varchar(255) not null, # Motif name.
columnCount int not null, # Count of columns in motif.
aProb longblob not null, # Probability of A's in each column.
cProb longblob not null, # Probability of C's in each column.
gProb longblob not null, # Probability of G's in each column.
tProb longblob not null, # Probability of T's in each column.
#Indices
PRIMARY KEY(name(32))
);
|
CREATE OR REPLACE PROCEDURE SP_DELETE_SERVER_TOKEN
(
P_CONSUMER_KEY IN VARCHAR2,
P_USER_ID IN NUMBER,
P_TOKEN IN VARCHAR2,
P_USER_IS_ADMIN IN NUMBER, --0:NO; 1:YES
P_RESULT OUT NUMBER
)
AS
-- Delete a token we obtained from a server.
BEGIN
P_RESULT := 0;
IF P_USER_IS_ADMIN = 1 THEN
DELETE FROM OAUTH_CONSUMER_TOKEN
WHERE OCT_TOKEN = P_TOKEN
AND OCT_OCR_ID_REF IN (SELECT OCR_ID FROM OAUTH_CONSUMER_REGISTRY WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY);
ELSIF P_USER_IS_ADMIN = 0 THEN
DELETE FROM OAUTH_CONSUMER_TOKEN
WHERE OCT_TOKEN = P_TOKEN
AND OCT_USA_ID_REF = P_USER_ID
AND OCT_OCR_ID_REF IN (SELECT OCR_ID FROM OAUTH_CONSUMER_REGISTRY WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY);
END IF;
EXCEPTION
WHEN OTHERS THEN
-- CALL THE FUNCTION TO LOG ERRORS
ROLLBACK;
P_RESULT := 1; -- ERROR
END;
/
|
INSERT INTO `tiny_id_token`(`id`, `token`, `biz_type`, `remark`, `create_time`, `update_time`) VALUES (1, '0f673adf80504e2eaa552f5d791b644c', 'test', '1', '2017-12-14 16:36:46', '2017-12-14 16:36:48');
INSERT INTO `tiny_id_token`(`id`, `token`, `biz_type`, `remark`, `create_time`, `update_time`) VALUES (2, '0f673adf80504e2eaa552f5d791b644c', 'test_odd', '1', '2017-12-14 16:36:46', '2017-12-14 16:36:48');
|
<reponame>reclada/db<gh_stars>0
DROP FUNCTION IF EXISTS reclada.validate_json;
CREATE OR REPLACE FUNCTION reclada.validate_json
(
_data jsonb,
_function text
)
RETURNS void AS $$
DECLARE
_schema jsonb;
BEGIN
-- select reclada.raise_exception('JSON invalid: ' || _data >> '{}')
select schema
from reclada.v_DTO_json_schema
where _function = function
into _schema;
IF (_schema is null ) then
RAISE EXCEPTION 'DTOJsonSchema for function: % not found',
_function;
END IF;
IF (NOT(public.validate_json_schema(_schema, _data))) THEN
RAISE EXCEPTION 'JSON invalid: %, schema: %, function: %',
_data #>> '{}' ,
_schema #>> '{}' ,
_function;
END IF;
END;
$$ LANGUAGE PLPGSQL STABLE; |
elapsedtime on;
create table users (id int, name String, age int) using column options();
insert into users values(1,'abc',23),(2,'aaa',54),(3,'bbb',43),(4,'ccc',35);
|
<filename>crosswalk_csv/reports_for_mapping.sql
-- chartevents.itemid with context for more mapping:
-- current MIMIC IV mapping
-- previous MIMIC III mapping
-- top 5 values associated with the itemid
-- row counts for the itemid
-- 2021-05-17
-- -------------------------------------------------------------------------
-- chartevents itemid analysis
-- -------------------------------------------------------------------------
CREATE OR REPLACE TABLE `odysseus-mimic-dev`.mimiciv_analysis.chartevents_to_concept AS
WITH
d_item AS
(
SELECT
src.itemid AS itemid,
COUNT(*) AS row_count -- 2226
FROM
`physionet-data`.mimic_icu.chartevents src
GROUP BY
src.itemid
-- lk_chartevents_concept -- meas, voc = 'mimiciv_meas_chart'
),
d_values AS
(
SELECT
src.itemid AS itemid,
src.value AS value,
COUNT(*) AS row_count -- 2226
FROM
`physionet-data`.mimic_icu.chartevents src
GROUP BY
src.itemid, src.value
),
ranked_values AS
(
-- # 1 - prepared source data
SELECT
itemid,
value,
row_count,
ROW_NUMBER() OVER (
PARTITION BY itemid
ORDER BY row_count DESC, value
) AS row_num
FROM
d_values
),
pivot_values AS
(
SELECT *
FROM
ranked_values
PIVOT
(
-- # 2 - aggregate
MAX(value) AS value,
MAX(row_count) AS row_count
-- # 3
FOR row_num IN (1, 2, 3, 4, 5)
)
),
d_source_concept AS
(
SELECT
src.itemid AS itemid,
COALESCE(cl.measurement_concept_id, co.concept_id) AS iii_concept_id,
COALESCE(cl.measurement_concept_id, co.concept_id, vc.concept_id) AS source_concept_id
FROM
d_item src
LEFT JOIN
`physionet-data`.mimic_icu.d_items di
ON src.itemid = di.itemid
LEFT JOIN
`replace-it-with-actual-mimiciii-loaded-mapping-dataset`.chart_label_to_concept cl
ON cl.d_label = di.label
LEFT JOIN
`replace-it-with-actual-mimiciii-loaded-mapping-dataset`.chart_observation_to_concept co
ON src.itemid = co.itemid
LEFT JOIN
`replace-it-with-actual-cdm-dataset-name`.concept vc
ON di.label = vc.concept_code
AND vc.vocabulary_id IN (
'mimiciv_meas_chart', -- MIMIC IV measurement mapping
'mimiciv_mimic_generated' -- MIMIC III 2bil mapping
)
)
SELECT
-- d_items data
di.itemid AS itemid,
di.linksto AS linksto,
di.category AS category,
di.label AS label,
di.unitname AS unitname,
di.param_type AS param_type,
-- examples of values
pv.value_1 AS value_1,
pv.value_2 AS value_2,
pv.value_3 AS value_3,
pv.value_4 AS value_4,
pv.value_5 AS value_5,
-- mimic iii mapping
cl.label_type AS iii_label_type,
cl.value_lb AS iii_value_lb,
cl.value_ub AS iii_value_ub,
cl.unit_concept_id AS iii_unit_concept_id,
vc_unit.concept_name AS unit_concept_name,
-- source concept data
vc.vocabulary_id AS source_vocabulary_id,
vc.domain_id AS source_domain_id,
vc.concept_id AS source_concept_id,
vc.concept_name AS source_concept_name,
-- target concept data
vc2.vocabulary_id AS target_vocabulary_id,
vc2.domain_id AS target_domain_id,
vc2.concept_id AS target_concept_id,
vc2.concept_name AS target_concept_name,
vc2.standard_concept AS target_standard_concept, -- for double-check
src.row_count AS row_count
FROM
d_item src
LEFT JOIN
`physionet-data`.mimic_icu.d_items di
ON src.itemid = di.itemid
LEFT JOIN
`replace-it-with-actual-mimiciii-loaded-mapping-dataset`.chart_label_to_concept cl
ON cl.d_label = di.label
LEFT JOIN
d_source_concept sc
ON sc.itemid = src.itemid
LEFT JOIN
pivot_values pv
ON src.itemid = pv.itemid
LEFT JOIN
`replace-it-with-actual-cdm-dataset-name`.concept vc
ON sc.source_concept_id = vc.concept_id
LEFT JOIN
`replace-it-with-actual-cdm-dataset-name`.concept_relationship vcr
ON vc.concept_id = vcr.concept_id_1
AND vcr.relationship_id = 'Maps to'
LEFT JOIN
`replace-it-with-actual-cdm-dataset-name`.concept vc2
ON vc2.concept_id = vcr.concept_id_2
AND vc2.standard_concept = 'S'
AND vc2.invalid_reason IS NULL
LEFT JOIN
`replace-it-with-actual-cdm-dataset-name`.concept vc_unit
ON vc_unit.concept_id = cl.unit_concept_id
AND vc_unit.standard_concept = 'S'
AND vc_unit.invalid_reason IS NULL
ORDER BY
src.row_count DESC
;
-- -- debug pivot
-- WITH
-- d_values AS
-- (
-- SELECT
-- src.itemid AS itemid,
-- src.value AS value,
-- COUNT(*) AS row_count -- 2226
-- FROM
-- `physionet-data`.mimic_icu.chartevents src
-- GROUP BY
-- src.itemid, src.value
-- ),
-- ranked_values AS
-- (
-- -- # 1 - prepared source data
-- SELECT
-- itemid,
-- value,
-- row_count,
-- ROW_NUMBER() OVER (
-- PARTITION BY itemid
-- ORDER BY row_count DESC, value
-- ) AS row_num
-- FROM
-- d_values
-- ),
-- pivot_values AS
-- (
-- SELECT *
-- FROM
-- ranked_values
-- PIVOT
-- (
-- -- # 2 - aggregate
-- MAX(value) AS value,
-- MAX(row_count) AS row_count
-- -- # 3
-- FOR row_num IN (1, 2, 3)
-- )
-- )
-- SELECT itemid, value_1, value_2, value_3
-- FROM pivot_values
-- ;
--------------------------
-- ranks are not applicable here
--
-- SELECT
-- src.itemid AS itemid,
-- src.value AS value,
-- RANK() OVER (
-- PARTITION BY itemid, value
-- ORDER BY itemid, value
-- ) AS rank_num,
-- DENSE_RANK() OVER (
-- PARTITION BY itemid, value
-- ORDER BY itemid, value
-- ) AS rankD_num,
-- PERCENT_RANK() OVER (
-- PARTITION BY itemid, value
-- ORDER BY itemid, value
-- ) AS rank_percent,
-- CUME_DIST() OVER (
-- PARTITION BY itemid, value
-- ORDER BY itemid, value
-- ) AS rank_cume_dist
-- FROM
-- `physionet-data`.mimic_icu.chartevents src
-- ORDER BY
-- src.itemid, src.value
-- ;
|
ALTER TABLE remotes
ADD COLUMN enabled BOOLEAN NOT NULL DEFAULT TRUE;
|
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Máy chủ: 127.0.0.1:3306
-- Thời gian đã tạo: Th5 11, 2020 lúc 08:18 AM
-- Phiên bản máy phục vụ: 5.7.26
-- Phiên bản PHP: 7.2.18
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Cơ sở dữ liệu: `dienthoai`
--
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `banner`
--
DROP TABLE IF EXISTS `banner`;
CREATE TABLE IF NOT EXISTS `banner` (
`MaBanner` int(11) NOT NULL AUTO_INCREMENT,
`TenBanner` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`Ngay` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`Hidden` int(11) NOT NULL,
PRIMARY KEY (`MaBanner`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `banner`
--
INSERT INTO `banner` (`MaBanner`, `TenBanner`, `Ngay`, `Hidden`) VALUES
(1, 'banner1.jpg', '2019-06-01 09:17:13', 0),
(2, 'banner1.jpg\r\n', '2019-06-01 09:17:33', 0),
(3, 'banner1.jpg\r\n', '2019-06-01 09:18:29', 0),
(4, 'banner1.jpg', '2019-06-01 09:19:04', 0);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `chitiethoadon`
--
DROP TABLE IF EXISTS `chitiethoadon`;
CREATE TABLE IF NOT EXISTS `chitiethoadon` (
`id_hoadon` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`MaDienThoai` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`soluong` int(11) NOT NULL,
`price` int(11) NOT NULL,
`ngaytaohoadon` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `chitiethoadon`
--
INSERT INTO `chitiethoadon` (`id_hoadon`, `MaDienThoai`, `soluong`, `price`, `ngaytaohoadon`) VALUES
('15', '22', 1, 30000000, '2019-06-15 09:39:00'),
('15', '21', 1, 30000000, '2019-06-15 09:39:00'),
('16', '22', 1, 30000000, '2019-06-15 09:40:07');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `dienthoai`
--
DROP TABLE IF EXISTS `dienthoai`;
CREATE TABLE IF NOT EXISTS `dienthoai` (
`MaDienThoai` int(11) NOT NULL AUTO_INCREMENT,
`MaLoaiDienThoai` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`TenDienThoai` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`HinhAnh` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`Hidden` int(1) NOT NULL,
`GhiChu` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`Gia` int(11) NOT NULL,
`Ngay` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`MaDienThoai`)
) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `dienthoai`
--
INSERT INTO `dienthoai` (`MaDienThoai`, `MaLoaiDienThoai`, `TenDienThoai`, `HinhAnh`, `Hidden`, `GhiChu`, `Gia`, `Ngay`) VALUES
(1, '1', 'Iphone X', '1.jpg', 0, '123213', 90000000, '2019-06-15 08:35:21'),
(2, '1', 'Iphone 9', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(3, '1', 'Iphone X', '1.jpg', 0, '123213', 95000000, '2019-06-15 08:35:34'),
(4, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(5, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(6, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(7, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(8, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(9, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(10, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(11, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(12, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(13, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(14, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(15, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(16, '1', 'Iphone X', '1.jpg', 0, '123213', 40000000, '2019-06-01 10:14:16'),
(17, '3', 'Oppo', '3.jpg', 0, '123213', 40000000, '2019-06-11 12:36:41'),
(18, '2', 'SAMSUNG', '2.jpg', 0, '', 80000000, '2019-06-11 12:04:33'),
(19, '2', 'SAMSUNG', '2.jpg', 0, '', 80000000, '2019-06-11 12:04:33'),
(20, '4', 'Nokia 730', '4.jpg', 0, '', 30000000, '2019-06-15 09:29:49'),
(21, '4', 'Nokia 720', '4.jpg', 0, '', 30000000, '2019-06-15 09:29:51'),
(23, '4', 'Nokia c2', 'c2.png', 0, '<p>132465465645</p>\r\n', 4000000, '2019-06-27 16:41:50');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `hoadon`
--
DROP TABLE IF EXISTS `hoadon`;
CREATE TABLE IF NOT EXISTS `hoadon` (
`name` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`diachi` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`sdt` int(11) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`gioitinh` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=19 DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `hoadon`
--
INSERT INTO `hoadon` (`name`, `diachi`, `sdt`, `id`, `gioitinh`) VALUES
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 18, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 2, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 3, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 4, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 5, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 6, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 7, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 8, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 9, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 11, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 12, 'Nam'),
('Trịnh Quang Trường', '159 Trần Văn Quang', 934085293, 13, 'Nam');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `loaidienthoai`
--
DROP TABLE IF EXISTS `loaidienthoai`;
CREATE TABLE IF NOT EXISTS `loaidienthoai` (
`MaLoaiDienThoai` int(11) NOT NULL AUTO_INCREMENT,
`logo` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`TenLoaiDienThoai` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`MaLoaiDienThoai`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `loaidienthoai`
--
INSERT INTO `loaidienthoai` (`MaLoaiDienThoai`, `logo`, `TenLoaiDienThoai`) VALUES
(1, '', 'Apple'),
(2, '', 'Samsung\r\n'),
(3, '', 'Oppo\r\n'),
(4, '', 'Nokia'),
(5, '', 'ASUS\r\n'),
(6, 'huawei.jpg', 'Huawei');
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `nhanvien`
--
DROP TABLE IF EXISTS `nhanvien`;
CREATE TABLE IF NOT EXISTS `nhanvien` (
`MaNhanVien` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
`TenNhanVien` varchar(255) COLLATE utf32_unicode_ci NOT NULL,
PRIMARY KEY (`MaNhanVien`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `nhanvien`
--
INSERT INTO `nhanvien` (`MaNhanVien`, `username`, `password`, `TenNhanVien`) VALUES
(1, 'truong', '<PASSWORD>', 'Trịnh Quang Trường'),
(2, 'truong2', '<PASSWORD>', 'Trịnh Quang Trường'),
(3, 'truong3', '<PASSWORD>', 'Trịnh Quang Trường'),
(4, 'truong12345', '<PASSWORD>152d234b70', '<NAME>');
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 */;
|
<gh_stars>0
CREATE TABLE `user`
(
`id` int PRIMARY KEY,
`first_name` text,
`last_name` text,
`email` text,
`password` text,
`img` text,
`role_id` int,
`created_at` bigint,
`is_active` boolean
);
CREATE TABLE `user_token`
(
`id` int PRIMARY KEY,
`email` text,
`token` text
);
CREATE TABLE `role`
(
`id` int PRIMARY KEY,
`name` text
); |
create table HawksInSalesforce
(
bandNumber text,
salesforceID text primary key not null
);
|
/*
Aqui está o trabalho de Banco de dados, do meu estudo feito pelo material e projetos da universidade.
*/
create database spotmidt;
use spotmidt;
-- Tb Nacionalidade
CREATE TABLE Tb_Nacionalidade (
cod_nacionalidade INTEGER PRIMARY KEY,
nacionalidade VARCHAR(20)
);
-- Tb cidade
CREATE TABLE Tb_Cidade (
cod_cidade INTEGER PRIMARY KEY UNIQUE,
nome_da_cidade VARCHAR(20),
nome_do_pais varchar(20)
);
-- tb user
CREATE TABLE Tb_User (
cod_user int PRIMARY KEY UNIQUE,
nome VARCHAR(15),
sobrenome VARCHAR(20),
data_de_Nascimento DATE
);
alter table Tb_User
add column cod_nacionalidade int;
alter table Tb_User
add column cod_cidade int;
alter table Tb_User
add foreign key (cod_nacionalidade)
references Tb_Nacionalidade(cod_nacionalidade);
alter table Tb_User
add foreign key (cod_cidade)
references Tb_Cidade(cod_cidade);
-- tb Canal Podcast
CREATE TABLE Tb_Canal_Podcast (
cod_canal_podcast INTEGER PRIMARY KEY UNIQUE,
nome_do_canal VARCHAR(20),
descricao_do_canal VARCHAR(100),
cod_nacionalidade integer
);
alter table Tb_Canal_Podcast
add constraint fk_nacionalidade_podcast foreign key(cod_nacionalidade) references Tb_Nacionalidade(cod_nacionalidade);
-- tb follow canal podcast
CREATE TABLE Tb_Follow_Canal_Podcast (
cod_follow_podcast INTEGER PRIMARY KEY UNIQUE,
data_follow_podcast DATE,
hora_follow_podcast TIME,
cod_user int,
cod_canal_podcast int
);
alter table Tb_Follow_Canal_Podcast
add foreign key (cod_user)
references Tb_User(cod_user);
alter table Tb_Follow_Canal_Podcast
add foreign key (cod_canal_podcast)
references Tb_Canal_Podcast(cod_canal_podcast);
-- Tb episodio podcast
CREATE TABLE Tb_Episodios_Podcast (
cod_episodio_podcast INTEGER PRIMARY KEY UNIQUE,
titulo_do_episodio_podcast VARCHAR(50),
duracao_do_episodio_podcast TIME,
cod_canal_podcast INTEGER
);
ALTER TABLE Tb_Episodios_Podcast ADD CONSTRAINT FK_dono_do_episodio
FOREIGN KEY (cod_canal_podcast)
REFERENCES Tb_Canal_Podcast(cod_canal_podcast);
-- Tb episódio podast baixado
CREATE TABLE Tb_Podcast_Episodio_Baixado (
cod_download_episodio INTEGER PRIMARY KEY UNIQUE,
data_download_episodio_podcast DATE,
hora_download_episodio_podcast TIME,
cod_user INTEGER,
cod_episodio_podcast INTEGER
);
ALTER TABLE Tb_Podcast_Episodio_Baixado ADD CONSTRAINT FK_Tb_Podcast_Episodio_Baixado_3
FOREIGN KEY (cod_episodio_podcast)
REFERENCES Tb_Episodios_Podcast(cod_episodio_podcast);
alter table Tb_Podcast_Episodio_Baixado add constraint FK_usuario_download_episodio
foreign key (cod_user)
references Tb_User(cod_user);
-- Tb artista banda
CREATE TABLE Tb_Artista_Banda (
cod_artista_banda INTEGER PRIMARY KEY UNIQUE,
nome_da_banda VARCHAR(40),
cod_nacionalidade INTEGER
);
ALTER TABLE Tb_Artista_Banda ADD CONSTRAINT FK_nacionalidade_artista
FOREIGN KEY (cod_nacionalidade)
REFERENCES Tb_Nacionalidade(cod_nacionalidade);
-- Tb musicas
CREATE TABLE Tb_Musica (
cod_musica INTEGER PRIMARY KEY UNIQUE,
nome_da_musica VARCHAR(40),
duracao_da_musica TIME,
cod_artista_banda INTEGER
);
ALTER TABLE Tb_Musica ADD CONSTRAINT FK_artista_dono_musica
FOREIGN KEY (cod_artista_banda)
REFERENCES Tb_Artista_Banda(cod_artista_banda);
-- Tb Album
CREATE TABLE Tb_Album (
cod_album INTEGER PRIMARY KEY UNIQUE,
nome_do_album VARCHAR(40),
cod_artista_banda INTEGER
);
ALTER TABLE Tb_Album ADD CONSTRAINT FK_artista_do_album
FOREIGN KEY (cod_artista_banda)
REFERENCES Tb_Artista_Banda(cod_artista_banda);
-- Tb Follow Artista
CREATE TABLE Tb_Follow_Artista (
cod_follow_artista INTEGER PRIMARY KEY UNIQUE,
data_follow_artista DATE,
hora_follow_artista TIME,
cod_user INTEGER,
cod_artista_banda INTEGER
);
ALTER TABLE Tb_Follow_Artista ADD CONSTRAINT FK_follow_artista_usuario
FOREIGN KEY (cod_user)
REFERENCES Tb_User(cod_user);
ALTER TABLE Tb_Follow_Artista ADD CONSTRAINT FK_artista_seguido
FOREIGN KEY (cod_artista_banda)
REFERENCES Tb_Artista_Banda(cod_artista_banda);
-- Tb musica favoritada
CREATE TABLE Tb_Musica_Favoritada (
cod_favoritamento_musica INTEGER PRIMARY KEY UNIQUE,
data_favoritamento_musica DATE,
hora_favoritamento_musica TIME,
cod_user INTEGER,
cod_musica INTEGER
);
ALTER TABLE Tb_Musica_Favoritada ADD CONSTRAINT FK_favoritada_pelo_user
FOREIGN KEY (cod_user)
REFERENCES Tb_User(cod_user);
alter table Tb_Musica_Favoritada add constraint FK_musica_favoritada
foreign key (cod_musica)
references Tb_Musica(cod_musica);
-- Tb Musica baixada
CREATE TABLE Tb_Download_Musica (
cod_download_musica INTEGER PRIMARY KEY UNIQUE,
data_download_musica DATE,
hora_download_musica TIME,
cod_user INTEGER,
cod_musica INTEGER
);
ALTER TABLE Tb_Download_Musica ADD CONSTRAINT FK_usuario_download_musica
FOREIGN KEY (cod_user)
REFERENCES Tb_User(cod_user);
ALTER TABLE Tb_Download_Musica ADD CONSTRAINT FK_musica_baixada
foreign key (cod_musica)
references Tb_Musica(cod_musica);
-- Tb Album baixado
CREATE TABLE Tb_Album_Baixado (
cod_download_album INTEGER PRIMARY KEY UNIQUE,
data_download_album DATE,
hora_download_album TIME,
cod_user INTEGER,
cod_album INTEGER
);
ALTER TABLE Tb_Album_Baixado ADD CONSTRAINT FK_baixado_pelouser
FOREIGN KEY (cod_user)
REFERENCES Tb_User(cod_user);
ALTER TABLE Tb_Album_Baixado ADD CONSTRAINT FK_album_baixado
FOREIGN KEY (cod_album)
REFERENCES Tb_Album(cod_album);
/*
População das tabelas:
*/
-- População de cidades:
insert into Tb_Cidade values
('1', 'Curitiba', 'Brazil'),
('2', 'São Paulo', 'Brazil'),
('3', 'Belo Horizonte', 'Brazil'),
('4', 'Brasília', 'Brazil'),
('5', 'Porto Alegre', 'Brazil'),
('6', 'Florianópolis', 'Brazil'),
('7', 'Chapecó', 'Brazil'),
('8', 'New York', 'USA'),
('9', 'Chicago', 'USA'),
('10', 'London', 'UK'),
('11', 'Barcelona', 'Spain'),
('12', 'Madrid', 'Spain'),
('13', 'Berlin', 'Germany'),
('14', 'Munich', 'Germany'),
('15', 'Geneve', 'Switzerland'),
('16', 'Moscow', 'Russia'),
('17', 'Tokyo', 'Japan'),
('18', 'Shanghai', 'China'),
('19', 'Miami', 'USA'),
('20', 'San Francisco', 'USA'),
('21', 'Los Angeles', 'USA'),
('22', 'Hueston', 'USA'),
('23', 'Phoenix', 'USA'),
('24', 'San Diego', 'USA'),
('25', 'Dallas', 'USA'),
('26', 'Paris', 'France'),
('27', 'Bern', 'Switzerland'),
('28', 'Brussels', 'Belgium'),
('29', 'Tallin', 'Estonia'),
('30', 'Rome', 'Italy');
select * from Tb_Cidade;
-- População de Nacionalidades:
insert into Tb_Nacionalidade values
('1', 'Brazilian'),
('2', 'American'),
('3', 'British'),
('4', 'German'),
('5', 'Japanese'),
('6', 'Chinese'),
('7', 'French'),
('8', 'Italian'),
('9', 'Swiss'),
('10', 'Belgian'),
('11', 'Estonian'),
('12', 'Russian'),
('13', 'Chinese'),
('14', 'Spanish');
-- População da tabela Tb_User
insert into Tb_User values
('1', 'Alessandro', 'Schmidt', '2001-04-28', '3', '10'),
('2', 'Godoy', 'Arthur', '1998-07-21', '14', '11'),
('3', 'Thiago', 'Andretta', '1970-12-03', '8', '30'),
('4', 'Peter', 'Parker', '1950-02-11', '1', '1'),
('5', 'José', 'Oliver', '2004-10-30', '1', '2'),
('6', 'Gustavo', 'Cardona', '2005-02-25', '2', '9'),
('7', 'Thomas', 'Chiari', '1999-02-25', '3', '10'),
('8', 'Mary', 'Jane', '1970-02-21', '3', '10'),
('9', 'Heloísa', 'Lorenzet', '1980-11-30', '7', '26'),
('10', 'Lotta', 'Öbenstein', '1996-07-25', '4', '13'),
('11', 'Maria', 'Angelica', '1979-09-19', '4', '14'),
('12', 'Klaus', 'Blumenstein', '1960-08-13', '12', '16'),
('13', 'Heirich', 'Dreässen', '1963-07-03', '5', '17'),
('14', 'Harry', 'Osbourn', '1950-01-29', '6', '18'),
('15', 'James', 'Potter', '1999-03-20', '8', '30'),
('16', 'Robert', '<NAME>', '1954-06-12', '9', '15'),
('17', 'Benjamin', 'Loveheart', '2005-09-14', '10', '28'),
('18', 'Olivia', 'Kraussberg', '2009-07-28', '11', '29'),
('19', 'Oliver', 'Stiglitz', '2010-02-09', '14', '12'),
('20', 'Noah', 'Jordan', '2015-08-02', '3', '10'),
('21', 'Noah', 'Banes', '2003-11-01', '3', '10'),
('22', 'Lucas', 'Rodrigues', '2011-12-06', '2', '8'),
('23', 'Alexander', 'The Great', '1986-02-06', '2', '25'),
('24', 'Janusz', 'Groner', '1982-06-12', '9', '27'),
('25', 'Ava', 'Maciel', '1984-04-18', '9', '15'),
('26', 'Amelia', 'Brandelero', '1993-03-14', '1', '3'),
('27', 'Harper', 'Hassem', '2001-07-19', '2', '24'),
('28', 'Mia', 'Smith', '2002-07-17', '1', '4'),
('29', 'Evelyn', 'Johnson', '1991-02-13', '3', '10'),
('30', 'Moritz', 'Zimmerman', '1999-05-15', '1', '5'),
('31', 'Ben', 'Carlson', '2000-12-17', '3', '10'),
('32', 'Quentinn', 'Tarantino', '1940-03-11', '2', '24'),
('33', 'Sophia', 'Glockheart', '1981-07-25', '3', '10'),
('34', 'Ana', 'Maria', '1967-11-29', '3', '10'),
('35', 'Ana', 'Dumbledore', '1990-09-30', '3', '10'),
('36', 'May', 'Parker', '1973-02-22', '2', '8'),
('37', 'Charlotte', 'Of Edinburg', '1920-12-14', '11', '29'),
('38', 'Alice', 'Wonderland', '1993-07-27', '1', '6'),
('39', 'Metthew', 'Perry', '1998-04-14', '1', '7'),
('40', 'David', 'Schwimmer', '2001-02-11', '2', '24'),
('41', 'Joey', 'Tribbiani', '2017-07-21', '2', '23'),
('42', 'Phoebe', 'Bupphay', '2005-11-15', '3', '10'),
('43', 'Ted', 'Mosby', '2013-02-21', '3', '10'),
('44', 'Luke', 'Skywalker', '1978-07-11', '10', '28'),
('45', 'Leia', 'Skywalker', '1978-07-19', '10', '28');
select * from Tb_User;
-- População Tb_Artista
insert into Tb_Artista_Banda values
('1', 'The Beatles', '3'),
('2', '<NAME>', '3'),
('3', '<NAME>', '3'),
('4', '<NAME>', '1'),
('5', 'Titãs', '1'),
('6', 'Legião Urbana', '1'),
('7', 'Selvagens a Procura da Lei', '1'),
('8', 'Resgate', '1'),
('9', 'The Red Army Choir', '12'),
('10', 'Feduk', '12'),
('11', '<NAME>','4'),
('12', 'Miksu', '4'),
('13', 'Marteria', '4'),
('14', '<NAME>', '4'),
('15','Revolverhead','4'),
('16', '<NAME>', '4'),
('17','<NAME>','4'),
('18','Oasis','3'),
('19','The Who','3'),
('20', '<NAME>', '3'),
('21','<NAME>','2'),
('22','<NAME>','2'),
('23','<NAME>','2'),
('24','Green Day','2'),
('25','Aerosmith','2'),
('26','Guns N Roses','2'),
('27','<NAME>','2'),
('28','Eagles','2'),
('29','<NAME>','4'),
('30','Paralamas do Sucesso','1'),
('31','Queen','3');
-- População da tabela Tb_Album
select * from Tb_Album;
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('1', 'Rubber Soul', '1');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('2', 'Tatoo You', '2');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('3', 'New', '3');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('4', 'Caravanas', '4');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('5', 'Cabeça Dinossauro', '5');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('6', 'Que país é esse?', '6');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('7', 'Aprendendo a mentir', '7');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('8', 'Este lado para cima', '8');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('9', 'Songs of war', '9');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('10', 'Zanadyie', '10');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('11', 'Die Lieferaten - live', '11');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('12', 'Roundtrip', '12');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('13', '<NAME>', '13');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('14', 'Raum um Raum', '14');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('15', 'Tropfmeist', '15');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('16', 'Deutsch Akustik: <NAME>', '16');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('17', 'Bendzko: Live MTV', '17');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('18', 'Champagnat Supernova', '18');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('19', 'Who are you', '19');
INSERT INTO `spotmidt`.`Tb_Album` (`cod_album`, `nome_do_album`, `cod_artista_banda`) VALUES ('20', 'The Wall', '20');
-- População da Tabela Música
select * from Tb_Musica;
desc Tb_Musica;
insert into Tb_Musica values
('1', 'Help', '', '1'),
('2', 'Star me up', '', '2'),
('3', 'Brazil', '', '3'),
('4', 'Construção', '', '4'),
('5', 'AA UU', '', '5'),
('6', 'Ainda é cedo', '', '6'),
('7', 'Tropa da Elite', '', '7'),
('8', 'Meu caminho', '', '8'),
('9', 'Smuglianka', '', '9'),
('10', 'Trabuji', '', '10'),
('11', 'Eine neue Klasse', '', '11'),
('12', 'Wirkstein', '', '12'),
('13', 'Kids', '', '13'),
('14', 'In die Nähe', '', '14'),
('15', '38 miles', '', '15'),
('16', 'Dies ist dein lied', '', '16'),
('17', 'Neu In DE', '', '17'),
('18', 'Wonderwall', '', '18'),
('19', 'Main_The_Who', '', '19'),
('20', 'Time', '', '20'),
('21', 'Cocaine', '', '21'),
('22', 'Like a Rolling', '', '22'),
('23', 'Born in the USA', '', '23'),
('24', 'American Idiot', '', '24'),
('25', 'Crazy', '', '25'),
('26', 'Welcome to the', '', '26'),
('27', 'Hello Darkness', '', '27'),
('28', 'Hotel California', '', '28'),
('29', 'Au Revoir', '', '29'),
('30', '<NAME> afogados', '', '30'),
('31', '<NAME>', '', '31'),
('32', '<NAME>', '', '1'),
('33', 'I can Get No', '', '2'),
('34', 'Once upon a time', '', '3'),
('35', 'Jogo de bola', '', '4'),
('36', '<NAME>', '', '5'),
('37', 'Tempo perdido', '', '6'),
('38', 'Massarandupió', '', '4'),
('39', 'Amantes', '', '4'),
('40', '<NAME>', '', '1'),
('41', 'Norweigian Wood', '', '1'),
('42', '<NAME>', '', '11'),
('43', '<NAME>', '', '4'),
('44', 'Die Haus ist forbei', '', '13'),
('45', 'Die fünfte Beatle', '', '13'),
('46', 'Retrato em preto e branco', '', '4'),
('47', 'You wont see me', '', '1'),
('48', '<NAME>', '', '13'),
('49', 'Theres a Light', '', '18'),
('50', 'Die Tropftremmer', '', '13'),
('51', 'Aquela menina', '', '4'),
('52', 'Se eu soubesse', '', '4'),
('53', 'Tax Man', '', '1'),
('54', 'Lucy in the Sky', '', '1'),
('55', 'Paratodos', '', '4'),
('56', 'Eu te amo', '', '4'),
('57', 'In my life', '', '1'),
('58', 'Hello Goodbye', '', '1'),
('59', 'Back in the USSR', '', '1'),
('60', 'Girl', '', '1'),
('61', 'Nowhere man ', '', '1');
-- População da TB_musica_favoritada
desc Tb_Musica_Favoritada;
insert into Tb_Musica_Favoritada values
('1', '2020-9-30', '1:0:0', '1', '1'),
('2', '2020-9-30', '1:1:1', '2', '1'),
('3', '2020-9-30', '1:2:2', '3', '1'),
('4', '2020-9-30', '1:3:3', '4', '1'),
('5', '2020-9-30', '1:4:4', '5', '1'),
('6', '2020-9-30', '1:5:5', '6', '1'),
('7', '2020-9-30', '1:6:6', '7', '1'),
('8', '2020-9-30', '1:7:7', '8', '1'),
('9', '2020-9-30', '0:8:8', '9', '1'),
('10', '2020-9-30', '1:0:9', '10', '1'),
('11', '2020-10-1', '2:1:10', '11', '1'),
('12', '2020-10-1', '3:2:11', '12', '1'),
('13', '2020-10-1', '4:3:12', '13', '1'),
('14', '2020-10-1', '5:4:13', '14', '1'),
('15', '2020-10-1', '6:5:14', '15', '1'),
('16', '2020-10-6', '7:6:15', '16', '1'),
('17', '2020-10-7', '8:7:16', '17', '1'),
('18', '2020-11-8', '9:8:17', '18', '1'),
('19', '2020-11-8', '10:9:18', '19', '1'),
('20', '2020-11-8', '11:10:19', '20', '3'),
('21', '2020-11-8', '12:11:20', '21', '3'),
('22', '2020-11-8', '13:12:21', '22', '3'),
('23', '2020-11-8', '14:13:22', '23', '3'),
('24', '2020-11-8', '15:14:23', '24', '4'),
('25', '2020-11-8', '16:15:24', '25', '4'),
('26', '2020-11-8', '17:0:25', '26', '4'),
('27', '2020-11-8', '18:1:26', '27', '4'),
('28', '2020-11-8', '19:2:27', '28', '4'),
('29', '2020-12-9', '20:3:28', '29', '5'),
('30', '2020-12-9', '21:4:29', '30', '5'),
('31', '2020-12-9', '22:5:30', '31', '1'),
('32', '2020-12-9', '23:6:31', '32', '12'),
('33', '2020-12-9', '0:7:32', '33', '12'),
('34', '2020-12-12', '0:8:33', '34', '14'),
('35', '2020-12-12', '1:9:34', '35', '14'),
('36', '2020-12-12', '2:10:35', '36', '14'),
('37', '2020-12-23', '3:11:36', '37', '14'),
('38', '2020-12-23', '4:12:37', '38', '14'),
('39', '2020-12-23', '5:13:38', '1', '24'),
('40', '2020-12-24', '6:14:39', '1', '14'),
('41', '2020-12-24', '7:15:40', '41', '24'),
('42', '2020-12-25', '8:16:41', '42', '24'),
('43', '2020-12-26', '9:17:42', '43', '24'),
('44', '2020-12-30', '10:18:43', '29', '24'),
('45', '2021-1-1', '11:19:44', '44', '61'),
('46', '2021-1-2', '12:20:45', '2', '61'),
('47', '2021-1-2', '13:21:46', '2', '60'),
('48', '2021-1-3', '14:22:47', '2', '59'),
('49', '2021-1-3', '15:23:48', '2', '58'),
('50', '2021-1-3', '16:24:49', '3', '59'),
('51', '2021-1-4', '17:25:50', '3', '58'),
('52', '2021-1-4', '18:26:51', '3', '57'),
('53', '2021-1-4', '19:27:52', '3', '56'),
('54', '2021-1-5', '20:28:53', '4', '57'),
('55', '2021-2-1', '21:29:0', '4', '56'),
('56', '2021-2-2', '22:30:1', '4', '55'),
('57', '2021-2-2', '23:31:2', '5', '54'),
('58', '2021-2-2', '0:32:3', '5', '53'),
('59', '2021-2-2', '1:33:4', '5', '52'),
('60', '2021-2-2', '2:34:5', '6', '51'),
('61', '2021-2-3', '3:35:6', '6', '61'),
('62', '2021-2-3', '4:36:7', '6', '60'),
('63', '2021-2-3', '5:37:8', '7', '41'),
('64', '2021-2-3', '6:38:9', '7', '61'),
('65', '2021-3-4', '7:39:10', '7', '40'),
('66', '2021-3-4', '8:40:11', '8', '40'),
('67', '2021-3-4', '9:41:12', '8', '41'),
('68', '2021-3-4', '10:42:13', '1', '14'),
('69', '2021-3-5', '11:43:14', '8', '32'),
('70', '2021-3-5', '12:44:15', '33', '57'),
('71', '2021-4-5', '13:45:16', '3', '57'),
('72', '2021-4-5', '14:46:17', '33', '33'),
('73', '2021-4-6', '15:47:18', '12', '25'),
('74', '2021-5-6', '16:48:19', '12', '26'),
('75', '2021-5-6', '17:49:20', '12', '27'),
('76', '2021-5-6', '18:50:21', '12', '28'),
('77', '2021-5-29', '19:51:22', '12', '29'),
('78', '2021-5-30', '20:52:23', '15', '30'),
('79', '2021-6-12', '21:53:24', '15', '31'),
('80', '2021-6-13', '22:54:25', '15', '32'),
('81', '2021-6-14', '23:55:26', '15', '33'),
('82', '2021-6-15', '0:56:27', '15', '34'),
('83', '2021-6-17', '1:57:28', '30', '35'),
('84', '2021-6-30', '2:1:29', '30', '61'),
('85', '2021-7-1', '3:1:30', '30', '21'),
('86', '2021-7-1', '4:1:31', '18', '14'),
('87', '2021-7-1', '5:1:32', '18', '14'),
('88', '2021-7-1', '6:1:33', '18', '48'),
('89', '2021-7-1', '7:1:34', '1', '56'),
('90', '2021-7-1', '8:1:35', '8', '48'),
('91', '2021-7-1', '9:1:36', '39', '1'),
('92', '2021-7-1', '10:1:37', '39', '2'),
('93', '2021-7-1', '11:1:38', '39', '3'),
('94', '2021-7-1', '12:1:39', '39', '4'),
('95', '2021-7-1', '12:1:40', '39', '5'),
('96', '2021-7-1', '12:1:41', '39', '6'),
('97', '2021-7-1', '12:1:42', '39', '7'),
('98', '2021-7-1', '12:1:43', '39', '18'),
('99', '2021-7-1', '12:1:44', '39', '17'),
('100', '2021-7-1', '13:1:45', '39', '19'),
('101', '2021-7-1', '13:0:46', '39', '20'),
('102', '2021-7-1', '13:1:47', '40', '1'),
('103', '2021-7-1', '13:2:48', '40', '2'),
('104', '2021-7-1', '14:3:49', '40', '3'),
('105', '2021-8-1', '14:4:50', '40', '14'),
('106', '2021-8-1', '14:4:51', '38', '14'),
('107', '2021-8-1', '14:4:51', '2', '14'),
('108', '2021-8-1', '14:4:51', '3', '14'),
('109', '2021-8-1', '14:4:51', '4', '14'),
('110', '2021-8-1', '14:4:51', '5', '14'),
('111', '2021-8-1', '14:4:51', '6', '14'),
('112', '2021-8-1', '14:4:51', '7', '14'),
('113', '2021-8-1', '14:4:51', '8', '14'),
('114', '2021-8-1', '14:4:51', '9', '14'),
('115', '2021-8-1', '14:4:51', '10', '14'),
('116', '2021-8-1', '14:4:51', '11', '14'),
('117', '2021-8-1', '14:4:51', '12', '14'),
('118', '2021-8-1', '14:4:51', '13', '14'),
('119', '2021-8-2', '14:4:52', '14', '14');
insert into Tb_Musica_Favoritada values('120', '2021-9-1', '13:5:3', '14', '2');
insert into Tb_Musica_Favoritada values('121', '2021-9-1', '13:5:3', '14', '8');
select * from Tb_Musica_Favoritada;
-- População Tb_Download_Musica
insert into Tb_Download_Musica values
('1', '2020-10-30', '1:0:0', '1', '1'),
('2', '2020-10-30', '1:1:1', '2', '1'),
('3', '2020-10-30', '1:2:2', '3', '1'),
('4', '2020-10-30', '1:3:3', '4', '1'),
('5', '2020-10-30', '1:4:4', '5', '1'),
('6', '2020-10-30', '1:5:5', '6', '1'),
('7', '2020-10-30', '1:6:6', '7', '1'),
('8', '2020-10-30', '1:7:7', '8', '1'),
('9', '2020-10-30', '0:8:8', '9', '1'),
('10', '2020-10-30', '1:0:9', '10', '1'),
('11', '2020-11-1', '2:1:10', '11', '1'),
('12', '2020-11-1', '3:2:11', '12', '1'),
('13', '2020-11-1', '4:3:12', '13', '1'),
('14', '2020-11-1', '5:4:13', '14', '1'),
('15', '2020-11-1', '6:5:14', '15', '1'),
('16', '2020-11-6', '7:6:15', '16', '1'),
('17', '2020-11-7', '8:7:16', '17', '1'),
('18', '2020-11-8', '9:8:17', '18', '1'),
('19', '2020-11-8', '10:9:18', '19', '1'),
('20', '2020-12-8', '11:10:19', '20', '3'),
('21', '2020-12-8', '12:11:20', '21', '3'),
('22', '2020-12-8', '13:12:21', '22', '3'),
('23', '2020-12-8', '14:13:22', '23', '3'),
('24', '2020-12-8', '15:14:23', '24', '4'),
('25', '2020-12-8', '16:15:24', '25', '4'),
('26', '2020-12-8', '17:0:25', '26', '4'),
('27', '2020-12-8', '18:1:26', '27', '4'),
('28', '2020-12-8', '19:2:27', '28', '4'),
('29', '2020-12-9', '20:3:28', '29', '5'),
('30', '2020-12-9', '21:4:29', '30', '5'),
('31', '2020-12-9', '22:5:30', '31', '1'),
('32', '2020-12-9', '23:6:31', '32', '12'),
('33', '2020-12-9', '0:7:32', '33', '12'),
('34', '2020-12-12', '0:8:33', '34', '14'),
('35', '2020-12-12', '1:9:34', '35', '14'),
('36', '2020-12-12', '2:10:35', '36', '14'),
('37', '2020-12-23', '3:11:36', '37', '14'),
('38', '2020-12-23', '4:12:37', '38', '14'),
('39', '2020-12-23', '5:13:38', '1', '24'),
('40', '2020-12-24', '6:14:39', '1', '14'),
('41', '2020-12-24', '7:15:40', '41', '24'),
('42', '2020-12-25', '8:16:41', '42', '24'),
('43', '2020-12-26', '9:17:42', '43', '24'),
('44', '2020-12-30', '10:18:43', '29', '24'),
('45', '2021-1-1', '11:19:44', '44', '61'),
('46', '2021-1-2', '12:20:45', '2', '61'),
('47', '2021-1-2', '13:21:46', '2', '60'),
('48', '2021-1-3', '14:22:47', '2', '59'),
('49', '2021-1-3', '15:23:48', '2', '58'),
('50', '2021-2-3', '16:24:49', '3', '59'),
('51', '2021-2-4', '17:25:50', '3', '58'),
('52', '2021-2-4', '18:26:51', '3', '57'),
('53', '2021-2-4', '19:27:52', '3', '56'),
('54', '2021-2-5', '20:28:53', '4', '57'),
('55', '2021-3-1', '21:29:0', '4', '56'),
('56', '2021-3-2', '22:30:1', '4', '55'),
('57', '2021-3-2', '23:31:2', '5', '54'),
('58', '2021-3-2', '0:32:3', '5', '53'),
('59', '2021-3-2', '1:33:4', '5', '52'),
('60', '2021-3-2', '2:34:5', '6', '51'),
('61', '2021-3-3', '3:35:6', '6', '61'),
('62', '2021-3-3', '4:36:7', '6', '60'),
('63', '2021-3-3', '5:37:8', '7', '41'),
('64', '2021-3-3', '6:38:9', '7', '61'),
('65', '2021-3-4', '7:39:10', '7', '40'),
('66', '2021-3-4', '8:40:11', '8', '40'),
('67', '2021-3-4', '9:41:12', '8', '41'),
('68', '2021-3-4', '10:42:13', '1', '14'),
('69', '2021-3-5', '11:43:14', '8', '32'),
('70', '2021-3-5', '12:44:15', '33', '57'),
('71', '2021-3-5', '13:45:16', '3', '57'),
('72', '2021-3-5', '14:46:17', '33', '33'),
('73', '2021-3-6', '15:47:18', '12', '25'),
('74', '2021-3-6', '16:48:19', '12', '26'),
('75', '2021-3-6', '17:49:20', '12', '27'),
('76', '2021-3-6', '18:50:21', '12', '28'),
('77', '2021-3-29', '19:51:22', '12', '29'),
('78', '2021-3-30', '20:52:23', '15', '30'),
('79', '2021-4-12', '21:53:24', '15', '31'),
('80', '2021-4-13', '22:54:25', '15', '32'),
('81', '2021-4-14', '23:55:26', '15', '33'),
('82', '2021-4-15', '0:56:27', '15', '34'),
('83', '2021-4-17', '1:57:28', '30', '35'),
('84', '2021-4-30', '2:1:29', '30', '61'),
('85', '2021-4-1', '3:1:30', '30', '21'),
('86', '2021-4-1', '4:1:31', '18', '14'),
('87', '2021-4-1', '5:1:32', '18', '14'),
('88', '2021-4-1', '6:1:33', '18', '48'),
('89', '2021-5-1', '7:1:34', '1', '56'),
('90', '2021-5-1', '8:1:35', '8', '48'),
('91', '2021-5-1', '9:1:36', '39', '1'),
('92', '2021-5-1', '10:1:37', '39', '2'),
('93', '2021-5-1', '11:1:38', '39', '3'),
('94', '2021-5-1', '12:1:39', '39', '4'),
('95', '2021-5-1', '12:1:40', '39', '5'),
('96', '2021-5-1', '12:1:41', '39', '6'),
('97', '2021-5-1', '12:1:42', '39', '7'),
('98', '2021-5-1', '12:1:43', '39', '18'),
('99', '2021-5-1', '12:1:44', '39', '17'),
('100', '2021-5-1', '13:1:45', '39', '19'),
('101', '2021-5-1', '13:0:46', '39', '20'),
('102', '2021-5-1', '13:1:47', '40', '1'),
('103', '2021-5-1', '13:2:48', '40', '2'),
('104', '2021-5-1', '14:3:49', '40', '3'),
('105', '2021-5-1', '14:4:50', '40', '14');
desc Tb_Download_Musica;
select * from Tb_Download_Musica;
-- População Tabela Tb_Album_Baixado
desc Tb_Album_Baixado; -- 20 albuns registrados
insert into Tb_Album_Baixado values
('1', '2020-10-30', '1:0:0', '1', '1'),
('2', '2020-10-30', '1:1:1', '2', '1'),
('3', '2020-10-30', '1:2:2', '3', '1'),
('4', '2020-10-30', '1:3:3', '4', '1'),
('5', '2020-10-30', '1:4:4', '5', '1'),
('6', '2020-10-30', '1:5:5', '6', '1'),
('7', '2020-10-30', '1:6:6', '7', '1'),
('8', '2020-10-30', '1:7:7', '8', '1'),
('9', '2020-10-30', '0:8:8', '9', '1'),
('10', '2020-10-30', '1:0:9', '10', '1'),
('11', '2020-11-1', '2:1:10', '11', '1'),
('12', '2020-11-1', '3:2:11', '12', '1'),
('13', '2020-11-1', '4:3:12', '13', '1'),
('14', '2020-11-1', '5:4:13', '14', '1'),
('15', '2020-11-1', '6:5:14', '15', '1'),
('16', '2020-11-6', '7:6:15', '16', '1'),
('17', '2020-11-7', '8:7:16', '17', '1'),
('18', '2020-11-8', '9:8:17', '18', '1'),
('19', '2020-11-8', '10:9:18', '19', '1'),
('20', '2020-12-8', '11:10:19', '20', '1'),
('21', '2020-12-8', '12:11:20', '21', '1'),
('22', '2020-12-8', '13:12:21', '22', '1'),
('23', '2020-12-8', '14:13:22', '23', '1'),
('24', '2020-12-8', '15:14:23', '24', '1'),
('25', '2020-12-8', '16:15:24', '25', '1'),
('26', '2020-12-8', '17:0:25', '26', '1'),
('27', '2020-12-8', '18:1:26', '27', '1'),
('28', '2020-12-8', '19:2:27', '28', '1'),
('29', '2020-12-9', '20:3:28', '29', '1'),
('30', '2020-12-9', '21:4:29', '30', '1'),
('31', '2020-12-9', '22:5:30', '31', '1'),
('32', '2020-12-9', '23:6:31', '32', '1'),
('33', '2020-12-9', '0:7:32', '33', '1'),
('34', '2020-12-12', '0:8:33', '34', '1'),
('35', '2020-12-12', '1:9:34', '35', '1'),
('36', '2020-12-12', '2:10:35', '36', '1'),
('37', '2020-12-23', '3:11:36', '37', '1'),
('38', '2020-12-23', '4:12:37', '38', '1'),
('39', '2020-12-23', '5:13:38', '39', '1'),
('40', '2020-12-24', '6:14:39', '40', '1'),
('41', '2020-12-24', '7:15:40', '41', '1'),
('42', '2020-12-25', '8:16:41', '42', '1'),
('43', '2020-12-26', '9:17:42', '43', '1'),
('44', '2020-12-30', '10:18:43', '44', '1'),
('45', '2021-1-1', '11:19:44', '45', '1'),
('46', '2021-1-2', '12:20:45', '1', '2'),
('47', '2021-1-2', '13:21:46', '2', '3'),
('48', '2021-1-3', '14:22:47', '3', '4'),
('49', '2021-1-3', '15:23:48', '4', '5'),
('50', '2021-2-3', '16:24:49', '5', '6'),
('51', '2021-2-4', '17:25:50', '6', '7'),
('52', '2021-2-4', '18:26:51', '7', '8'),
('53', '2021-2-4', '19:27:52', '8', '9'),
('54', '2021-2-5', '20:28:53', '9', '10'),
('55', '2021-3-1', '21:29:0', '10', '11'),
('56', '2021-3-2', '22:30:1', '11', '12'),
('57', '2021-3-2', '23:31:2', '12', '13'),
('58', '2021-3-2', '0:32:3', '13', '14'),
('59', '2021-3-2', '1:33:4', '14', '2'),
('60', '2021-3-2', '2:34:5', '15', '2'),
('61', '2021-3-3', '3:35:6', '16', '2'),
('62', '2021-3-3', '4:36:7', '17', '2'),
('63', '2021-3-3', '5:37:8', '18', '2'),
('64', '2021-3-3', '6:38:9', '19', '2'),
('65', '2021-3-4', '7:39:10', '20', '2'),
('66', '2021-3-4', '8:40:11', '21', '2'),
('67', '2021-3-4', '9:41:12', '22', '2'),
('68', '2021-3-4', '10:42:13', '23', '2'),
('69', '2021-3-5', '11:43:14', '24', '2'),
('70', '2021-3-5', '12:44:15', '25', '2'),
('71', '2021-3-5', '13:45:16', '26', '2'),
('72', '2021-3-5', '14:46:17', '27', '2'),
('73', '2021-3-6', '15:47:18', '28', '2'),
('74', '2021-3-6', '16:48:19', '29', '2'),
('75', '2021-3-6', '17:49:20', '30', '2'),
('76', '2021-3-6', '18:50:21', '31', '2'),
('77', '2021-3-29', '19:51:22', '32', '3'),
('78', '2021-3-30', '20:52:23', '33', '3'),
('79', '2021-4-12', '21:53:24', '34', '3'),
('80', '2021-4-13', '22:54:25', '35', '3'),
('81', '2021-4-14', '23:55:26', '36', '3'),
('82', '2021-4-15', '0:56:27', '37', '3'),
('83', '2021-4-17', '1:57:28', '38', '3'),
('84', '2021-4-30', '2:1:29', '39', '3'),
('85', '2021-4-1', '3:1:30', '40', '3'),
('86', '2021-4-1', '4:1:31', '41', '3'),
('87', '2021-4-1', '5:1:32', '42', '3'),
('88', '2021-4-1', '6:1:33', '43', '3'),
('89', '2021-5-1', '7:1:34', '1', '3'),
('90', '2021-5-1', '8:1:35', '1', '4'),
('91', '2021-5-1', '9:1:36', '2', '6'),
('92', '2021-5-1', '10:1:37', '2', '7'),
('93', '2021-5-1', '11:1:38', '3', '8'),
('94', '2021-5-1', '12:1:39', '3', '9'),
('95', '2021-5-1', '12:1:40', '4', '10'),
('96', '2021-5-1', '12:1:41', '4', '7'),
('97', '2021-5-1', '12:1:42', '5', '9'),
('98', '2021-5-1', '12:1:43', '5', '15'),
('99', '2021-5-1', '12:1:44', '6', '15'),
('100', '2021-5-1', '13:1:45', '6', '16'),
('101', '2021-5-1', '13:0:46', '7', '20'),
('102', '2021-5-1', '13:1:47', '7', '3'),
('103', '2021-5-1', '13:2:48', '8', '2'),
('104', '2021-5-1', '14:3:49', '8', '3'),
('105', '2021-5-1', '14:4:50', '9', '14'),
('106', '2021-5-1', '15:0:0', '10', '20'),
('107', '2021-5-1', '16:0:1', '10', '19'),
('108', '2021-5-1', '17:0:2', '20', '18'),
('109', '2021-5-1', '18:1:3', '20', '19'),
('110', '2021-5-1', '19:2:4', '15', '18'),
('111', '2021-5-1', '20:3:45', '15', '19'),
('112', '2021-5-1', '21:4:46', '25', '11'),
('113', '2021-5-1', '22:5:47', '25', '12'),
('114', '2021-5-1', '22:6:48', '23', '12'),
('115', '2021-5-1', '2:1:49', '23', '11'),
('116', '2021-5-2', '22:2:12', '31', '11'),
('117', '2021-5-2', '23:13:13', '3', '11'),
('118', '2021-5-2', '0:4:14', '11', '11'),
('119', '2021-5-2', '0:4:15', '12', '11'),
('120', '2021-5-2', '0:5:16', '13', '11'),
('121', '2021-5-2', '0:2:17', '14', '11'),
('122', '2021-5-2', '0:23:18', '15', '11'),
('123', '2021-5-3', '0:15:19', '16', '11');
-- População Tb_Follow Artista
desc Tb_Follow_Artista;
insert into Tb_Follow_Artista values
('1', '2020-10-30', '1:0:0', '1', '1'),
('2', '2020-10-30', '1:1:1', '1', '2'),
('3', '2020-10-30', '1:2:2', '1', '3'),
('4', '2020-10-30', '1:3:3', '1', '4'),
('5', '2020-10-30', '1:4:4', '1', '5'),
('6', '2020-10-30', '1:5:5', '1', '6'),
('7', '2020-10-30', '1:6:6', '1', '7'),
('8', '2020-10-30', '1:7:7', '1', '8'),
('9', '2020-10-30', '0:8:8', '1', '9'),
('10', '2020-10-30', '1:0:9', '1', '10'),
('11', '2020-11-1', '2:1:10', '1', '11'),
('12', '2020-11-1', '3:2:11', '1', '12'),
('13', '2020-11-1', '4:3:12', '1', '13'),
('14', '2020-11-1', '5:4:13', '1', '14'),
('15', '2020-11-1', '6:5:14', '1', '15'),
('16', '2020-11-6', '7:6:15', '1', '16'),
('17', '2020-11-7', '8:7:16', '1', '17'),
('18', '2020-11-8', '9:8:17', '1', '18'),
('19', '2020-11-8', '10:9:18', '1', '19'),
('20', '2020-12-8', '11:10:19', '1', '20'),
('21', '2020-12-8', '12:11:20', '1', '21'),
('22', '2020-12-8', '13:12:21', '1', '22'),
('23', '2020-12-8', '14:13:22', '1', '23'),
('24', '2020-12-8', '15:14:23', '1', '24'),
('25', '2020-12-8', '16:15:24', '1', '25'),
('26', '2020-12-8', '17:0:25', '1', '26'),
('27', '2020-12-8', '18:1:26', '1', '27'),
('28', '2020-12-8', '19:2:27', '1', '28'),
('29', '2020-12-9', '20:3:28', '1', '29'),
('30', '2020-12-9', '21:4:29', '1', '30'),
('31', '2020-12-9', '22:5:30', '1', '31'),
('32', '2020-12-9', '23:6:31', '2', '1'),
('33', '2020-12-9', '0:7:32', '2', '2'),
('34', '2020-12-12', '0:8:33', '2', '3'),
('35', '2020-12-12', '1:9:34', '2', '4'),
('36', '2020-12-12', '2:10:35', '2', '5'),
('37', '2020-12-23', '3:11:36', '2', '6'),
('38', '2020-12-23', '4:12:37', '2', '7'),
('39', '2020-12-23', '5:13:38', '2', '8'),
('40', '2020-12-24', '6:14:39', '3', '2'),
('41', '2020-12-24', '7:15:40', '3', '3'),
('42', '2020-12-25', '8:16:41', '3', '4'),
('43', '2020-12-26', '9:17:42', '3', '5'),
('44', '2020-12-30', '10:18:43', '3', '6'),
('45', '2021-1-1', '11:19:44', '3', '7'),
('46', '2021-1-2', '12:20:45', '3', '8'),
('47', '2021-1-2', '13:21:46', '3', '9'),
('48', '2021-1-3', '14:22:47', '3', '10'),
('49', '2021-1-3', '15:23:48', '3', '11'),
('50', '2021-2-3', '16:24:49', '3', '12'),
('51', '2021-2-4', '17:25:50', '3', '13'),
('52', '2021-2-4', '18:26:51', '4', '3'),
('53', '2021-2-4', '19:27:52', '4', '9'),
('54', '2021-2-5', '20:28:53', '4', '10'),
('55', '2021-3-1', '21:29:0', '4', '11'),
('56', '2021-3-2', '22:30:1', '4', '12'),
('57', '2021-3-2', '23:31:2', '4', '13'),
('58', '2021-3-2', '0:32:3', '4', '14'),
('59', '2021-3-2', '1:33:4', '4', '15'),
('60', '2021-3-2', '2:34:5', '4', '16'),
('61', '2021-3-3', '3:35:6', '4', '17'),
('62', '2021-3-3', '4:36:7', '4', '18'),
('63', '2021-3-3', '5:37:8', '4', '19'),
('64', '2021-3-3', '6:38:9', '5', '7'),
('65', '2021-3-4', '7:39:10', '20', '8'),
('66', '2021-3-4', '8:40:11', '21', '9'),
('67', '2021-3-4', '9:41:12', '22', '10'),
('68', '2021-3-4', '10:42:13', '23', '11'),
('69', '2021-3-5', '11:43:14', '24', '12'),
('70', '2021-3-5', '12:44:15', '25', '13'),
('71', '2021-3-5', '13:45:16', '26', '14'),
('72', '2021-3-5', '14:46:17', '27', '15'),
('73', '2021-3-6', '15:47:18', '28', '16'),
('74', '2021-3-6', '16:48:19', '29', '17'),
('75', '2021-3-6', '17:49:20', '30', '18'),
('76', '2021-3-6', '18:50:21', '6', '2'),
('77', '2021-3-29', '19:51:22', '7', '2'),
('78', '2021-3-30', '20:52:23', '8', '2'),
('79', '2021-4-12', '21:53:24', '9', '2'),
('80', '2021-4-13', '22:54:25', '10', '2'),
('81', '2021-4-14', '23:55:26', '11', '2'),
('82', '2021-4-15', '0:56:27', '12', '2'),
('83', '2021-4-17', '1:57:28', '13', '2'),
('84', '2021-4-30', '2:1:29', '14', '2'),
('85', '2021-4-1', '3:1:30', '15', '2'),
('86', '2021-4-1', '4:1:31', '16', '2'),
('87', '2021-4-1', '5:1:32', '17', '2'),
('88', '2021-4-1', '6:1:33', '18', '2'),
('89', '2021-5-1', '7:1:34', '19', '2'),
('90', '2021-5-1', '8:1:35', '20', '2'),
('91','2021-5-1', '8:1:35', '20', '11');
-- PODCASTS
-- População Tb_Canal_Podcast
desc Tb_Canal_Podcast;
select * from Tb_Canal_Podcast;
INSERT INTO Tb_Canal_Podcast values
('1', 'Bons de bola', 'Bate papo sobre jogos do Brasileirão', '1'),
('2', 'Amigos para vida', 'Um bate papo do Vampeta com o Edilson, ex jogadores, sobre temas da atualidade', '1'),
('3', 'Biblia hoje', 'Um respiro de paz na sua semana', '1'),
('4', '<NAME>', 'Americas favorite comedian, now in Podcast', '2'),
('5', 'Quentinn and etc', 'The famous director Tarantino talks about new movies', '2'),
('6', 'Deutsche Welle', 'Jeden Tag, Neuigkeit und Humor', '4'),
('7', 'DeutscheTag', 'Alles über DE Politik und Wirtschaft ', '4'),
('8', 'Daily Mail ', 'Englands oldest media', '3'),
('9', 'Imperial Radio', 'UKs favorite podcast about history', '3'),
('10', 'Queens Daily News', 'News about the Royal Family', '3'),
('11', 'Tv Rai Italia ', 'Un podcast sui paesi di lingua italiana', '8'),
('12', 'Freedom Radio', 'Podcast Eesti ajaloost ja vabadusvõitlusest.', '11'),
('13', 'Un nuevo dia', 'Un podcast que habla sobre las notícias de toda la Europa', '14');
-- População Tb_Episodios_Podcast
desc Tb_Episodios_Podcast;
select * from Tb_Episodios_Podcast;
INSERT INTO Tb_Episodios_Podcast VALUES
('1', 'Rodada 01', '01:23:00', '1'),
('2', 'Rodada 02', '02:25:23', '1'),
('3', 'Histórias de Seleção', '03:04:01', '2'),
('4', 'Histórias do Vanpeta', '00:49:10', '2'),
('5', 'Salmos', '1:9:3', '3'),
('6', 'O evangelho', '1:5:34', '3'),
('7', 'Inglorious Day: 09/11 perspective', '01:01:01', '4'),
('8', 'New Politics', '00:15:13', '4'),
('9', 'Grown Ups: best movie', '10:03:11', '5'),
('10', '<NAME> Interview', '03:10:15', '5'),
('11', '<NAME> ', '01:02:13', '6'),
('12', 'Guten Apetit!', '05:14:11', '6'),
('13', 'Deutsche Akzent ', '1:1:3', '7'),
('14', 'Gescwendigkeitsbegrenzung', '02:11:55', '7'),
('15', 'London Now ep1 ', '00:55:19', '8'),
('16', 'Technology in the UK', '00:49:59', '9'),
('17', 'Queens New Hat', '00:14:49', '10'),
('18', '<NAME>', '01:09:11', '10'),
('19', 'History of the UK ', '03:11:12', '10'),
('20', 'UKS best universities', '00:49:50', '10'),
('21', 'Great day today', '01:00:19', '10'),
('22', '<NAME>', '00:33:27', '10'),
('23', 'England, UK and Commonwealth', '00:15:19', '10'),
('24', '<NAME>', '02:09:14', '11'),
('25', 'Tallin und Europa', '03:11:45', '12'),
('26', 'Banco de dados, una realidad', '00:59:59', '13');
-- Populando TB_Follow_Canal_Podcast:
desc Tb_Follow_Canal_Podcast;
insert into Tb_Follow_Canal_Podcast values
('1', '2020-10-30', '1:0:0', '2', '1'),
('2', '2020-10-30', '1:1:1', '2', '2'),
('3', '2020-10-30', '1:2:2', '2', '3'),
('4', '2020-10-30', '1:3:3', '2', '4'),
('5', '2020-10-30', '1:4:4', '2', '5'),
('6', '2020-10-30', '1:5:5', '2', '6'),
('7', '2020-10-30', '1:6:6', '2', '7'),
('8', '2020-10-30', '1:7:7', '2', '8'),
('9', '2020-10-30', '0:8:8', '2', '9'),
('10', '2020-10-30', '1:0:9', '2', '10'),
('11', '2020-11-1', '2:1:10', '2', '11'),
('12', '2020-11-1', '3:2:11', '2', '12'),
('13', '2020-11-1', '4:3:12', '2', '13'),
('14', '2020-11-1', '5:4:13', '1', '9'),
('15', '2020-11-1', '6:5:14', '3', '9'),
('16', '2020-11-6', '7:6:15', '4', '9'),
('17', '2020-11-7', '8:7:16', '5', '9'),
('18', '2020-11-8', '9:8:17', '6', '9'),
('19', '2020-11-8', '10:9:18', '7', '9'),
('20', '2020-12-8', '11:10:19', '8', '9'),
('21', '2020-12-8', '12:11:20', '9', '9'),
('22', '2020-12-8', '13:12:21', '10', '9'),
('23', '2020-12-8', '14:13:22', '11', '9'),
('24', '2020-12-8', '15:14:23', '12', '9'),
('25', '2020-12-8', '16:15:24', '13', '9'),
('26', '2020-12-8', '17:0:25', '14', '9'),
('27', '2020-12-8', '18:1:26', '15', '9'),
('28', '2020-12-8', '19:2:27', '16', '9'),
('29', '2020-12-9', '20:3:28', '17', '9'),
('30', '2020-12-9', '21:4:29', '18', '9'),
('31', '2020-12-9', '22:5:30', '19', '9'),
('32', '2020-12-9', '23:6:31', '20', '9'),
('33', '2020-12-9', '0:7:32', '21', '9'),
('34', '2020-12-12', '0:8:33', '22', '9'),
('35', '2020-12-12', '1:9:34', '23', '9'),
('36', '2020-12-12', '2:10:35', '24', '9'),
('37', '2020-12-23', '3:11:36', '25', '9'),
('38', '2020-12-23', '4:12:37', '26', '9'),
('39', '2020-12-23', '5:13:38', '27', '9'),
('40', '2020-12-24', '6:14:39', '28', '9'),
('41', '2020-12-24', '7:15:40', '29', '9'),
('42', '2020-12-25', '8:16:41', '30', '9'),
('43', '2020-12-26', '9:17:42', '31', '9'),
('44', '2020-12-30', '10:18:43', '32', '9'),
('45', '2021-1-1', '11:19:44', '33', '9'),
('46', '2021-1-2', '12:20:45', '34', '9'),
('47', '2021-1-2', '13:21:46', '35', '9'),
('48', '2021-1-3', '14:22:47', '36', '9'),
('49', '2021-1-3', '15:23:48', '37', '9'),
('50', '2021-2-3', '16:24:49', '38', '9'),
('51', '2021-2-4', '17:25:50', '39', '9'),
('52', '2021-2-4', '18:26:51', '40', '9'),
('53', '2021-2-4', '19:27:52', '41', '9'),
('54', '2021-2-5', '20:28:53', '42', '9'),
('55', '2021-3-1', '21:29:0', '43', '9'),
('56', '2021-3-2', '22:30:1', '3', '1'),
('57', '2021-3-2', '23:31:2', '3', '5'),
('58', '2021-3-2', '0:32:3', '3', '6'),
('59', '2021-3-2', '1:33:4', '3', '13'),
('60', '2021-3-2', '2:34:5', '3', '11'),
('61', '2021-3-3', '3:35:6', '4', '1'),
('62', '2021-3-3', '4:36:7', '4', '2'),
('63', '2021-3-3', '5:37:8', '4', '4'),
('64', '2021-3-3', '6:38:9', '4', '5'),
('65', '2021-3-4', '7:39:10', '4', '6'),
('66', '2021-3-4', '8:40:11', '4', '7'),
('67', '2021-3-4', '9:41:12', '8', '8'),
('68', '2021-3-4', '10:42:13', '9', '10'),
('69', '2021-3-5', '11:43:14', '9', '11'),
('70', '2021-3-5', '12:44:15', '9', '12'),
('71', '2021-3-5', '13:45:16', '9', '13'),
('72', '2021-3-5', '14:46:17', '9', '8'),
('73', '2021-3-6', '15:47:18', '9', '7'),
('74', '2021-3-6', '16:48:19', '9', '6'),
('75', '2021-3-6', '17:49:20', '9', '5'),
('76', '2021-3-6', '18:50:21', '9', '4'),
('77', '2021-3-29', '19:51:22', '9', '1'),
('78', '2021-3-30', '20:52:23', '9', '2'),
('79', '2021-4-12', '21:53:24', '5', '1'),
('80', '2021-4-13', '22:54:25', '5', '2'),
('81', '2021-4-14', '23:55:26', '5', '3'),
('82', '2021-4-15', '0:56:27', '5', '4'),
('83', '2021-4-17', '1:57:28', '5', '5'),
('84', '2021-4-30', '2:1:29', '5', '6'),
('85', '2021-4-1', '3:1:30', '5', '7'),
('86', '2021-4-1', '4:1:31', '5', '8'),
('87', '2021-4-1', '5:1:32', '5', '10'),
('88', '2021-4-1', '6:1:33', '5', '11'),
('89', '2021-5-1', '7:1:34', '5', '12'),
('90', '2021-5-1', '8:1:35', '5', '13'),
('91', '2021-5-1', '9:1:36', '44', '1'),
('92', '2021-5-1', '10:1:37', '45', '2'),
('93', '2021-5-1', '11:1:38', '45', '3'),
('94', '2021-5-1', '12:1:39', '45', '4'),
('95', '2021-5-1', '12:1:40', '45', '5'),
('96', '2021-5-1', '12:1:41', '45', '6'),
('97', '2021-5-1', '12:1:42', '45', '7'),
('98', '2021-5-1', '12:1:43', '45', '13'),
('99', '2021-5-1', '12:1:44', '45', '12'),
('100', '2021-5-1', '13:1:45', '45', '9'),
('101', '2021-5-1', '13:0:46', '44', '8'),
('102', '2021-5-1', '13:1:47', '44', '1'),
('103', '2021-5-1', '13:2:48', '44', '2'),
('104', '2021-5-1', '14:3:49', '44', '3'),
('105', '2021-5-1', '14:4:50', '44', '13');
-- Populando a Tb_Podcast_Episodio_Baixado:
insert into Tb_Podcast_Episodio_Baixado values
('1', '2020-10-30', '1:0:0', '45', '1'),
('2', '2020-10-30', '1:1:1', '45', '2'),
('3', '2020-10-30', '1:2:2', '45', '3'),
('4', '2020-10-30', '1:3:3', '45', '4'),
('5', '2020-10-30', '1:4:4', '45', '5'),
('6', '2020-10-30', '1:5:5', '45', '6'),
('7', '2020-10-30', '1:6:6', '45', '7'),
('8', '2020-10-30', '1:7:7', '45', '8'),
('9', '2020-10-30', '0:8:8', '45', '9'),
('10', '2020-10-30', '1:0:9', '45', '10'),
('11', '2020-11-1', '2:1:10', '44', '2'),
('12', '2020-11-1', '3:2:11', '44', '3'),
('13', '2020-11-1', '4:3:12', '44', '4'),
('14', '2020-11-1', '5:4:13', '44', '5'),
('15', '2020-11-1', '6:5:14', '44', '6'),
('16', '2020-11-6', '7:6:15', '44', '7'),
('17', '2020-11-7', '8:7:16', '44', '8'),
('18', '2020-11-8', '9:8:17', '44', '9'),
('19', '2020-11-8', '10:9:18', '44', '10'),
('20', '2020-12-8', '11:10:19', '44', '11'),
('21', '2020-12-8', '12:11:20', '43', '12'),
('22', '2020-12-8', '13:12:21', '43', '14'),
('23', '2020-12-8', '14:13:22', '43', '15'),
('24', '2020-12-8', '15:14:23', '42', '16'),
('25', '2020-12-8', '16:15:24', '42', '17'),
('26', '2020-12-8', '17:0:25', '42', '18'),
('27', '2020-12-8', '18:1:26', '42', '19'),
('28', '2020-12-8', '19:2:27', '1', '20'),
('29', '2020-12-9', '20:3:28', '1', '21'),
('30', '2020-12-9', '21:4:29', '1', '22'),
('31', '2020-12-9', '22:5:30', '1', '23'),
('32', '2020-12-9', '23:6:31', '1', '24'),
('33', '2020-12-9', '0:7:32', '1', '25'),
('34', '2020-12-12', '0:8:33', '1', '26'),
('35', '2020-12-12', '1:9:34', '1', '1'),
('36', '2020-12-12', '2:10:35', '1', '2'),
('37', '2020-12-23', '3:11:36', '1', '3'),
('38', '2020-12-23', '4:12:37', '1', '4'),
('39', '2020-12-23', '5:13:38', '1', '5'),
('40', '2020-12-24', '6:14:39', '5', '1'),
('41', '2020-12-24', '7:15:40', '5', '2'),
('42', '2020-12-25', '8:16:41', '5', '3'),
('43', '2020-12-26', '9:17:42', '5', '4'),
('44', '2020-12-30', '10:18:43', '5', '5'),
('45', '2021-1-1', '11:19:44', '5', '6'),
('46', '2021-1-2', '12:20:45', '5', '7'),
('47', '2021-1-2', '13:21:46', '6', '8'),
('48', '2021-1-3', '14:22:47', '6', '9'),
('49', '2021-1-3', '15:23:48', '6', '10'),
('50', '2021-2-3', '16:24:49', '6', '11'),
('51', '2021-2-4', '17:25:50', '6', '12'),
('52', '2021-2-4', '18:26:51', '8', '13'),
('53', '2021-2-4', '19:27:52', '8', '14'),
('54', '2021-2-5', '20:28:53', '8', '15'),
('55', '2021-3-1', '21:29:0', '8', '16'),
('56', '2021-3-2', '22:30:1', '8', '17'),
('57', '2021-3-2', '23:31:2', '8', '18'),
('58', '2021-3-2', '0:32:3', '8', '19'),
('59', '2021-3-2', '1:33:4', '10', '20'),
('60', '2021-3-2', '2:34:5', '10', '21'),
('61', '2021-3-3', '3:35:6', '10', '22'),
('62', '2021-3-3', '4:36:7', '10', '23'),
('63', '2021-3-3', '5:37:8', '10', '24'),
('64', '2021-3-3', '6:38:9', '10', '25'),
('65', '2021-3-4', '7:39:10', '31', '26'),
('66', '2021-3-4', '8:40:11', '31', '1'),
('67', '2021-3-4', '9:41:12', '31', '2'),
('68', '2021-3-4', '10:42:13', '31', '3'),
('69', '2021-3-5', '11:43:14', '31', '4'),
('70', '2021-3-5', '12:44:15', '31', '5'),
('71', '2021-3-5', '13:45:16', '31', '7'),
('72', '2021-3-5', '14:46:17', '31', '8'),
('73', '2021-3-6', '15:47:18', '15', '9'),
('74', '2021-3-6', '16:48:19', '15', '10'),
('75', '2021-3-6', '17:49:20', '15', '12'),
('76', '2021-3-6', '18:50:21', '15', '13'),
('77', '2021-3-29', '19:51:22', '15', '15'),
('78', '2021-3-30', '20:52:23', '15', '17'),
('79', '2021-4-12', '21:53:24', '15', '19'),
('80', '2021-4-13', '22:54:25', '15', '20'),
('81', '2021-4-14', '23:55:26', '2', '8'),
('82', '2021-4-15', '0:56:27', '7', '8'),
('83', '2021-4-17', '1:57:28', '8', '8'),
('84', '2021-4-30', '2:1:29', '9', '8'),
('85', '2021-4-1', '3:1:30', '39', '8'),
('86', '2021-4-1', '4:1:31', '39', '9'),
('87', '2021-4-1', '5:1:32', '39', '10'),
('88', '2021-4-1', '6:1:33', '39', '11'),
('89', '2021-5-1', '7:1:34', '39', '12'),
('90', '2021-5-1', '8:1:35', '39', '13'),
('91', '2021-5-1', '9:1:36', '39', '11'),
('92', '2021-5-1', '10:1:37', '20', '1'),
('93', '2021-5-1', '11:1:38', '20', '3'),
('94', '2021-5-1', '12:1:39', '20', '5'),
('95', '2021-5-1', '12:1:40', '20', '6'),
('96', '2021-5-1', '12:1:41', '20', '7'),
('97', '2021-5-1', '12:1:42', '12', '10'),
('98', '2021-5-1', '12:1:43', '12', '1'),
('99', '2021-5-1', '12:1:44', '12', '2'),
('100', '2021-5-1', '13:1:45', '12', '3'),
('101', '2021-5-1', '13:0:46', '12', '7'),
('102', '2021-5-1', '13:1:47', '12', '4'),
('103', '2021-5-1', '13:2:48', '12', '9'),
('104', '2021-5-1', '14:3:49', '13', '10'),
('105', '2021-5-1', '14:4:50', '43', '10');
-- Informações a serem extraídas:
-- 1ª: Qual o número de usuários cadastrados na plataforma; (45 usuários)
select count(cod_user) from Tb_User;
-- 2ª: Quantos usuários possuem mais de 30 anos de idade; (21 usuários)
select count(cod_user) from Tb_User
where data_de_Nascimento between '1900-01-01' and '1991-12-31';
-- 3ª: Qual a música mais favoritada; (Música In die Nähe, com 23 favoritamentos)
select m.nome_da_musica, count(f.cod_musica)
from Tb_Musica_Favoritada as f join Tb_Musica as m
on m.cod_musica = f.cod_musica
group by m.cod_musica
order by count(f.cod_musica) desc
limit 1;
-- 4ª: Qual a música com mais downloads; (Música Help, com 22 downloads)
select m.nome_da_musica, count(d.cod_musica)
from Tb_Download_Musica as d join Tb_Musica as m
on m.cod_musica = d.cod_musica
group by d.cod_musica
order by count(d.cod_musica) desc
limit 1;
-- 5ª: Qual o Artista/Banda mais seguido? (<NAME> - 18 follows)
select b.nome_da_banda, count(f.cod_artista_banda)
from Tb_Follow_Artista as f join Tb_Artista_Banda as b
on f.cod_artista_banda = b.cod_artista_banda
group by f.cod_artista_banda
order by count(f.cod_artista_banda) desc
limit 1;
-- 6ª: Qual o álbum com mais downloads? (Rub<NAME> - 45 downloads)
select a.nome_do_album, count(b.cod_album)
from Tb_Album_Baixado as b join Tb_Album as a
on b.cod_album = a.cod_album
group by b.cod_album
order by count(b.cod_album) desc
limit 1;
-- 7ª: Qual a banda mais seguida da Alemanha? (<NAME> - 5 follows)
select b.nome_da_banda, p.nacionalidade ,count(f.cod_artista_banda)
from Tb_Follow_Artista as f join Tb_Artista_Banda as b join Tb_Nacionalidade as p
on f.cod_artista_banda = b.cod_artista_banda and p.cod_nacionalidade = b.cod_nacionalidade
where p.nacionalidade = "German"
group by f.cod_artista_banda
order by count(f.cod_artista_banda) desc
limit 1;
-- 8ª: Qual a cidade com mais usuários? (London - 12 usuários)
select c.nome_da_cidade, count(u.cod_cidade)
from Tb_Cidade as c join Tb_User as u
on c.cod_cidade = u.cod_cidade
group by u.cod_cidade
order by count(u.cod_cidade) desc
limit 1;
-- 9º Qual a música de Artista brasileiro mais favoritada? (Construção - <NAME> - 6 favoritamentos)
select m.nome_da_musica, a.nome_da_banda ,n.nacionalidade, count(f.cod_musica)
from Tb_Musica_Favoritada as f join Tb_Nacionalidade as n join Tb_Musica as m join Tb_Artista_Banda as a
on m.cod_musica = f.cod_musica and a.cod_nacionalidade = n.cod_nacionalidade and a.cod_artista_banda = m.cod_artista_banda
where n.nacionalidade = 'Brazilian'
group by f.cod_musica
order by count(f.cod_musica) desc
limit 1;
-- 10ª: Qual a banda mais seguida em Londres? (Rolling Stones - 4 follows na cidade de usuários que residem em Londres)
select c.nome_da_cidade, a.nome_da_banda, count(f.cod_artista_banda)
from Tb_Cidade as c join Tb_Artista_Banda as a join Tb_Follow_Artista as f join Tb_User as u
on c.cod_cidade = u.cod_cidade and u.cod_user = f.cod_user and f.cod_artista_banda = a.cod_artista_banda
where c.nome_da_cidade = 'London'
group by f.cod_artista_banda
order by count(f.cod_artista_banda) desc
limit 1;
-- 11ª: Quais são as músicas registradas que não foram nem favoritadas nem baixadas pelos usuários?
-- Deve necessitar da operação da diferença entre conjuntos envolvendo pelo menos 3 tabelas (21 músicas não foram baixadas ou favoritadas)
select m.nome_da_musica as 'Música', a.nome_da_banda as 'Artista'
from Tb_Musica as m join Tb_Artista_Banda as a
on m.cod_artista_banda = a.cod_artista_banda
where m.cod_musica not in (select m.cod_musica from Tb_Musica_Favoritada as m) and m.cod_musica not in (select m.cod_musica from Tb_Download_Musica as m);
-- 12ª: Qual o nome do canal de podcast com o episodio mais baixados? e qual o nome do episodio e seu origem?
-- Deve usar produto cartesiano envolvendo mais de três tabelas
select c.nome_do_canal, e.titulo_do_episodio_podcast, n.nacionalidade, count(b.cod_download_episodio) as 'Número de Downloads'
from Tb_Canal_Podcast as c, Tb_Episodios_Podcast as e, Tb_Nacionalidade as n, Tb_Podcast_Episodio_Baixado as b
where c.cod_canal_podcast = e.cod_canal_podcast and c.cod_nacionalidade = n.cod_nacionalidade and b.cod_episodio_podcast = e.cod_episodio_podcast
group by c.nome_do_canal, e.titulo_do_episodio_podcast, n.nacionalidade
order by count(b.cod_download_episodio) desc
limit 1;
-- 13º: Quais os três episódios mais baixados de um podcast nacional? (Histórias de Seleção, rodada 02 e rodada 01)
-- Join com três tabelas
select e.titulo_do_episodio_podcast, c.nome_do_canal, count(b.cod_episodio_podcast)
from Tb_Podcast_Episodio_Baixado as b join Tb_Episodios_Podcast as e join Tb_Nacionalidade as n join Tb_Canal_Podcast as c
on b.cod_episodio_podcast = e.cod_episodio_podcast and n.cod_nacionalidade = c.cod_nacionalidade and c.cod_canal_podcast = e.cod_canal_podcast
where n.nacionalidade = 'Brazilian'
group by b.cod_episodio_podcast
order by count(b.cod_episodio_podcast) desc
limit 3;
-- 14ª: Qual a música de artista brasileiro que possui mais de 5 downloads? (Música Construção do chico Buarque)
-- Deve utilizar a cláusula 'having'
select m.nome_da_musica, a.nome_da_banda
from Tb_Musica as m inner join Tb_Artista_Banda as a join Tb_Nacionalidade as n join Tb_Download_Musica as d
on a.cod_nacionalidade = n.cod_nacionalidade and m.cod_artista_banda = a.cod_artista_banda and d.cod_musica = m.cod_musica
where n.nacionalidade = 'Brazilian'
group by d.cod_musica
having count(m.nome_da_musica)>5;
-- 15ª: Quais as múscias que foram favoritadas mas que não foram baixadas? (música 'Meu caminho' da Banda Resgate)
-- deve adotar a vizualização de views
create view musicas_baixadas as
select b.cod_musica from Tb_Download_Musica as b;
select * from musicas_baixadas;
select m.nome_da_musica, a.nome_da_banda
from Tb_Musica as m inner join Tb_Musica_Favoritada as mf join Tb_Artista_Banda as a
on m.cod_musica = mf.cod_musica and a.cod_artista_banda = m.cod_artista_banda
where m.cod_musica not in (select * from musicas_baixadas);
/*
Fim do código.
*/ |
<filename>database/best-remedies.sql
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 01, 2020 at 06:22 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.2.26
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: `best-remedies`
--
-- --------------------------------------------------------
--
-- Table structure for table `aboutus`
--
CREATE TABLE `aboutus` (
`idaboutUs` int(11) NOT NULL,
`bodyText` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `additionalremedy`
--
CREATE TABLE `additionalremedy` (
`remedy_idremedy` int(11) NOT NULL,
`testimony_idtestimony` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`idadmin` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`surname` varchar(45) DEFAULT NULL,
`username` varchar(45) DEFAULT NULL,
`password` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `article`
--
CREATE TABLE `article` (
`idarticle` int(11) NOT NULL,
`seo_title` varchar(60) DEFAULT NULL,
`seo_description` varchar(160) DEFAULT NULL,
`seo_keywords` varchar(300) DEFAULT NULL,
`thumbnailImage` varchar(200) DEFAULT NULL,
`imageAltText` varchar(100) DEFAULT NULL,
`sources` text DEFAULT NULL,
`reviewerId` int(11) DEFAULT NULL,
`authorId` int(11) DEFAULT NULL,
`editor_idEditor` int(11) NOT NULL,
`category` varchar(45) DEFAULT NULL,
`articleUrl` varchar(400) DEFAULT NULL,
`clicks` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `articlepart`
--
CREATE TABLE `articlepart` (
`idarticlePart` int(11) NOT NULL,
`title` varchar(300) DEFAULT NULL,
`body` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `articlesuccess`
--
CREATE TABLE `articlesuccess` (
`idarticleSuccess` int(11) NOT NULL,
`sucessRating` varchar(45) DEFAULT NULL,
`article_idarticle` int(11) NOT NULL,
`user_iduser` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `availability`
--
CREATE TABLE `availability` (
`idavailability` int(11) NOT NULL,
`country` varchar(45) DEFAULT NULL,
`state` varchar(45) DEFAULT NULL,
`localCommonName` varchar(45) DEFAULT NULL,
`localScientificName` varchar(45) DEFAULT NULL,
`remedy_idremedy` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `brands`
--
CREATE TABLE `brands` (
`idbrands` int(11) NOT NULL,
`name` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `citedbrands`
--
CREATE TABLE `citedbrands` (
`testimony_idtestimony` int(11) NOT NULL,
`brands_idbrands` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `comment`
--
CREATE TABLE `comment` (
`idcomment` int(11) NOT NULL,
`datePosted` datetime DEFAULT NULL,
`comment` text DEFAULT NULL,
`user_iduser` int(11) NOT NULL,
`testimony_idtestimony` int(11) NOT NULL,
`editDate` datetime DEFAULT NULL,
`comment_idcomment` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `countries`
--
CREATE TABLE `countries` (
`id` int(5) NOT NULL,
`countryCode` varchar(2) NOT NULL DEFAULT '',
`countryName` varchar(100) NOT NULL DEFAULT '',
`currencyCode` varchar(3) DEFAULT NULL,
`fipsCode` varchar(2) DEFAULT NULL,
`isoNumeric` varchar(4) DEFAULT NULL,
`north` varchar(30) DEFAULT NULL,
`south` varchar(30) DEFAULT NULL,
`east` varchar(30) DEFAULT NULL,
`west` varchar(30) DEFAULT NULL,
`capital` varchar(30) DEFAULT NULL,
`continentName` varchar(100) DEFAULT NULL,
`continent` varchar(2) DEFAULT NULL,
`languages` varchar(100) DEFAULT NULL,
`isoAlpha3` varchar(3) DEFAULT NULL,
`geonameId` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `disclaimer`
--
CREATE TABLE `disclaimer` (
`idDisclaimer` int(11) NOT NULL,
`title` varchar(200) DEFAULT NULL,
`body` text DEFAULT NULL,
`shortName` varchar(300) DEFAULT NULL,
`date` date DEFAULT NULL,
`legalVettingName` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `dosageunit`
--
CREATE TABLE `dosageunit` (
`iddosageUnit` int(11) NOT NULL,
`unitName` varchar(45) DEFAULT NULL,
`unitShortName` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `duration`
--
CREATE TABLE `duration` (
`idduration` int(11) NOT NULL,
`unit` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `editor`
--
CREATE TABLE `editor` (
`idEditor` int(11) NOT NULL,
`firstName` varchar(45) DEFAULT NULL,
`surname` varchar(45) DEFAULT NULL,
`title` varchar(45) DEFAULT NULL,
`bio` text DEFAULT NULL,
`education` text DEFAULT NULL,
`role` varchar(45) DEFAULT NULL,
`profilePic` varchar(100) DEFAULT NULL,
`username` varchar(45) DEFAULT NULL,
`password` varchar(45) DEFAULT NULL,
`email` varchar(70) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `featuredremedies`
--
CREATE TABLE `featuredremedies` (
`article_idarticle` int(11) NOT NULL,
`remedy_idremedy` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `featuredsicknesses`
--
CREATE TABLE `featuredsicknesses` (
`article_idarticle` int(11) NOT NULL,
`sickness_idsickness` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `homepage`
--
CREATE TABLE `homepage` (
`idhomePage` int(11) NOT NULL,
`mission` text DEFAULT NULL,
`bannerText` varchar(400) DEFAULT NULL,
`videoUrl` varchar(400) DEFAULT NULL,
`qualityPromise` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `metatags`
--
CREATE TABLE `metatags` (
`idmetaTags` int(11) NOT NULL,
`pageName` varchar(100) DEFAULT NULL,
`title` varchar(60) DEFAULT NULL,
`description` text DEFAULT NULL,
`keywords` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `questioncategory`
--
CREATE TABLE `questioncategory` (
`idquestionCategory` int(11) NOT NULL,
`name` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `questions`
--
CREATE TABLE `questions` (
`idQuestion` int(11) NOT NULL,
`questionCategory_idquestionCategory` int(11) NOT NULL,
`user_iduser` int(11) NOT NULL,
`details` text DEFAULT NULL,
`dateTime` datetime DEFAULT NULL,
`resolve` tinytext DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `relieftype`
--
CREATE TABLE `relieftype` (
`idrelief` int(11) NOT NULL,
`type` varchar(120) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `remedy`
--
CREATE TABLE `remedy` (
`idremedy` int(11) NOT NULL,
`type` varchar(60) DEFAULT NULL,
`name` varchar(120) DEFAULT NULL,
`shortName` varchar(60) DEFAULT NULL,
`link` varchar(45) DEFAULT NULL,
`picture` varchar(200) DEFAULT NULL,
`pictureAltText` varchar(200) DEFAULT NULL,
`expertAdvice` text DEFAULT NULL,
`sellerLink` varchar(250) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `sickness`
--
CREATE TABLE `sickness` (
`idsickness` int(11) NOT NULL,
`commonName` varchar(300) DEFAULT NULL,
`scientificName` varchar(300) DEFAULT NULL,
`searchCount` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `testimony`
--
CREATE TABLE `testimony` (
`idtestimony` int(11) NOT NULL,
`date` date DEFAULT NULL,
`user_iduser` int(11) NOT NULL,
`sickness_idsickness` int(11) NOT NULL,
`remedy_idremedy` int(11) NOT NULL,
`relief_idrelief` int(11) NOT NULL,
`story` text DEFAULT NULL,
`dosage` varchar(45) DEFAULT NULL,
`administeredTo` varchar(45) DEFAULT NULL,
`administeredBy` varchar(45) DEFAULT NULL,
`warnings` text DEFAULT NULL,
`additionalInfo` tinytext DEFAULT NULL,
`country` varchar(45) DEFAULT NULL,
`state` varchar(45) DEFAULT NULL,
`expertComment` text DEFAULT NULL,
`overallExperience` varchar(100) DEFAULT NULL,
`testimonyUrl` varchar(400) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `topdiseases`
--
CREATE TABLE `topdiseases` (
`idtopDiseases` int(11) NOT NULL,
`topDiseasescol` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `treatmentrecurrence`
--
CREATE TABLE `treatmentrecurrence` (
`idtreatmentRecurrence` int(11) NOT NULL,
`recurrence` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `trendingsearches`
--
CREATE TABLE `trendingsearches` (
`idtrendingSearches` int(11) NOT NULL,
`homePage_idhomePage` int(11) NOT NULL,
`trendTitle` varchar(45) DEFAULT NULL,
`trendPic` varchar(45) DEFAULT NULL,
`positiveTestimonies` int(11) DEFAULT NULL,
`url` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`iduser` int(11) NOT NULL,
`firstName` varchar(45) NOT NULL,
`lastName` varchar(45) NOT NULL,
`screenName` varchar(100) NOT NULL,
`Address` varchar(45) DEFAULT NULL,
`City` varchar(45) DEFAULT NULL,
`Country` varchar(45) DEFAULT NULL,
`email` varchar(60) NOT NULL,
`mobileNo` varchar(45) DEFAULT NULL,
`status` varchar(45) DEFAULT NULL,
`dateReg` datetime DEFAULT NULL,
`dob` date DEFAULT NULL,
`gender` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `aboutus`
--
ALTER TABLE `aboutus`
ADD PRIMARY KEY (`idaboutUs`);
--
-- Indexes for table `additionalremedy`
--
ALTER TABLE `additionalremedy`
ADD KEY `fk_additionalRemedy_remedy1_idx` (`remedy_idremedy`),
ADD KEY `fk_additionalRemedy_testimony1_idx` (`testimony_idtestimony`);
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`idadmin`);
--
-- Indexes for table `article`
--
ALTER TABLE `article`
ADD PRIMARY KEY (`idarticle`),
ADD KEY `fk_article_editor1_idx` (`editor_idEditor`);
--
-- Indexes for table `articlepart`
--
ALTER TABLE `articlepart`
ADD PRIMARY KEY (`idarticlePart`);
--
-- Indexes for table `articlesuccess`
--
ALTER TABLE `articlesuccess`
ADD PRIMARY KEY (`idarticleSuccess`),
ADD KEY `fk_articleSuccess_article1_idx` (`article_idarticle`),
ADD KEY `fk_articleSuccess_user1_idx` (`user_iduser`);
--
-- Indexes for table `availability`
--
ALTER TABLE `availability`
ADD PRIMARY KEY (`idavailability`),
ADD KEY `fk_availability_remedy1_idx` (`remedy_idremedy`);
--
-- Indexes for table `brands`
--
ALTER TABLE `brands`
ADD PRIMARY KEY (`idbrands`);
--
-- Indexes for table `citedbrands`
--
ALTER TABLE `citedbrands`
ADD KEY `fk_citedBrands_testimony1_idx` (`testimony_idtestimony`),
ADD KEY `fk_citedBrands_brands1_idx` (`brands_idbrands`);
--
-- Indexes for table `comment`
--
ALTER TABLE `comment`
ADD PRIMARY KEY (`idcomment`),
ADD KEY `fk_comment_user1_idx` (`user_iduser`),
ADD KEY `fk_comment_testimony1_idx` (`testimony_idtestimony`),
ADD KEY `fk_comment_comment1_idx` (`comment_idcomment`);
--
-- Indexes for table `countries`
--
ALTER TABLE `countries`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `disclaimer`
--
ALTER TABLE `disclaimer`
ADD PRIMARY KEY (`idDisclaimer`);
--
-- Indexes for table `dosageunit`
--
ALTER TABLE `dosageunit`
ADD PRIMARY KEY (`iddosageUnit`);
--
-- Indexes for table `duration`
--
ALTER TABLE `duration`
ADD PRIMARY KEY (`idduration`);
--
-- Indexes for table `editor`
--
ALTER TABLE `editor`
ADD PRIMARY KEY (`idEditor`);
--
-- Indexes for table `featuredremedies`
--
ALTER TABLE `featuredremedies`
ADD KEY `fk_featuredRemedies_article1_idx` (`article_idarticle`),
ADD KEY `fk_featuredRemedies_remedy1_idx` (`remedy_idremedy`);
--
-- Indexes for table `featuredsicknesses`
--
ALTER TABLE `featuredsicknesses`
ADD KEY `fk_featuredSicknesses_article1_idx` (`article_idarticle`),
ADD KEY `fk_featuredSicknesses_sickness1_idx` (`sickness_idsickness`);
--
-- Indexes for table `homepage`
--
ALTER TABLE `homepage`
ADD PRIMARY KEY (`idhomePage`);
--
-- Indexes for table `metatags`
--
ALTER TABLE `metatags`
ADD PRIMARY KEY (`idmetaTags`);
--
-- Indexes for table `questioncategory`
--
ALTER TABLE `questioncategory`
ADD PRIMARY KEY (`idquestionCategory`);
--
-- Indexes for table `questions`
--
ALTER TABLE `questions`
ADD PRIMARY KEY (`idQuestion`),
ADD KEY `fk_complaints_user1_idx` (`user_iduser`),
ADD KEY `fk_questions_questionCategory1_idx` (`questionCategory_idquestionCategory`);
--
-- Indexes for table `relieftype`
--
ALTER TABLE `relieftype`
ADD PRIMARY KEY (`idrelief`);
--
-- Indexes for table `remedy`
--
ALTER TABLE `remedy`
ADD PRIMARY KEY (`idremedy`);
--
-- Indexes for table `sickness`
--
ALTER TABLE `sickness`
ADD PRIMARY KEY (`idsickness`);
--
-- Indexes for table `testimony`
--
ALTER TABLE `testimony`
ADD PRIMARY KEY (`idtestimony`),
ADD KEY `fk_testimony_user_idx` (`user_iduser`),
ADD KEY `fk_testimony_remedy1_idx` (`remedy_idremedy`),
ADD KEY `fk_testimony_relief1_idx` (`relief_idrelief`),
ADD KEY `fk_testimony_sickness1_idx` (`sickness_idsickness`);
--
-- Indexes for table `topdiseases`
--
ALTER TABLE `topdiseases`
ADD PRIMARY KEY (`idtopDiseases`);
--
-- Indexes for table `treatmentrecurrence`
--
ALTER TABLE `treatmentrecurrence`
ADD PRIMARY KEY (`idtreatmentRecurrence`);
--
-- Indexes for table `trendingsearches`
--
ALTER TABLE `trendingsearches`
ADD PRIMARY KEY (`idtrendingSearches`),
ADD KEY `fk_trendingSearches_homePage1_idx` (`homePage_idhomePage`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`iduser`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `idadmin` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `article`
--
ALTER TABLE `article`
MODIFY `idarticle` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `articlepart`
--
ALTER TABLE `articlepart`
MODIFY `idarticlePart` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `articlesuccess`
--
ALTER TABLE `articlesuccess`
MODIFY `idarticleSuccess` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `availability`
--
ALTER TABLE `availability`
MODIFY `idavailability` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `brands`
--
ALTER TABLE `brands`
MODIFY `idbrands` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `comment`
--
ALTER TABLE `comment`
MODIFY `idcomment` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `countries`
--
ALTER TABLE `countries`
MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=251;
--
-- AUTO_INCREMENT for table `disclaimer`
--
ALTER TABLE `disclaimer`
MODIFY `idDisclaimer` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `dosageunit`
--
ALTER TABLE `dosageunit`
MODIFY `iddosageUnit` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `duration`
--
ALTER TABLE `duration`
MODIFY `idduration` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `editor`
--
ALTER TABLE `editor`
MODIFY `idEditor` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `homepage`
--
ALTER TABLE `homepage`
MODIFY `idhomePage` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `metatags`
--
ALTER TABLE `metatags`
MODIFY `idmetaTags` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `questioncategory`
--
ALTER TABLE `questioncategory`
MODIFY `idquestionCategory` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `questions`
--
ALTER TABLE `questions`
MODIFY `idQuestion` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `relieftype`
--
ALTER TABLE `relieftype`
MODIFY `idrelief` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `remedy`
--
ALTER TABLE `remedy`
MODIFY `idremedy` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sickness`
--
ALTER TABLE `sickness`
MODIFY `idsickness` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `testimony`
--
ALTER TABLE `testimony`
MODIFY `idtestimony` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `treatmentrecurrence`
--
ALTER TABLE `treatmentrecurrence`
MODIFY `idtreatmentRecurrence` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `trendingsearches`
--
ALTER TABLE `trendingsearches`
MODIFY `idtrendingSearches` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `iduser` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `additionalremedy`
--
ALTER TABLE `additionalremedy`
ADD CONSTRAINT `fk_additionalRemedy_remedy1` FOREIGN KEY (`remedy_idremedy`) REFERENCES `remedy` (`idremedy`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_additionalRemedy_testimony1` FOREIGN KEY (`testimony_idtestimony`) REFERENCES `testimony` (`idtestimony`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `article`
--
ALTER TABLE `article`
ADD CONSTRAINT `fk_article_editor1` FOREIGN KEY (`editor_idEditor`) REFERENCES `editor` (`idEditor`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `articlesuccess`
--
ALTER TABLE `articlesuccess`
ADD CONSTRAINT `fk_articleSuccess_article1` FOREIGN KEY (`article_idarticle`) REFERENCES `article` (`idarticle`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_articleSuccess_user1` FOREIGN KEY (`user_iduser`) REFERENCES `user` (`iduser`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `availability`
--
ALTER TABLE `availability`
ADD CONSTRAINT `fk_availability_remedy1` FOREIGN KEY (`remedy_idremedy`) REFERENCES `remedy` (`idremedy`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `citedbrands`
--
ALTER TABLE `citedbrands`
ADD CONSTRAINT `fk_citedBrands_brands1` FOREIGN KEY (`brands_idbrands`) REFERENCES `brands` (`idbrands`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_citedBrands_testimony1` FOREIGN KEY (`testimony_idtestimony`) REFERENCES `testimony` (`idtestimony`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `comment`
--
ALTER TABLE `comment`
ADD CONSTRAINT `fk_comment_comment1` FOREIGN KEY (`comment_idcomment`) REFERENCES `comment` (`idcomment`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_comment_testimony1` FOREIGN KEY (`testimony_idtestimony`) REFERENCES `testimony` (`idtestimony`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_comment_user1` FOREIGN KEY (`user_iduser`) REFERENCES `user` (`iduser`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `featuredremedies`
--
ALTER TABLE `featuredremedies`
ADD CONSTRAINT `fk_featuredRemedies_article1` FOREIGN KEY (`article_idarticle`) REFERENCES `article` (`idarticle`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_featuredRemedies_remedy1` FOREIGN KEY (`remedy_idremedy`) REFERENCES `remedy` (`idremedy`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `featuredsicknesses`
--
ALTER TABLE `featuredsicknesses`
ADD CONSTRAINT `fk_featuredSicknesses_article1` FOREIGN KEY (`article_idarticle`) REFERENCES `article` (`idarticle`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_featuredSicknesses_sickness1` FOREIGN KEY (`sickness_idsickness`) REFERENCES `sickness` (`idsickness`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `questions`
--
ALTER TABLE `questions`
ADD CONSTRAINT `fk_complaints_user1` FOREIGN KEY (`user_iduser`) REFERENCES `user` (`iduser`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_questions_questionCategory1` FOREIGN KEY (`questionCategory_idquestionCategory`) REFERENCES `questioncategory` (`idquestionCategory`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `testimony`
--
ALTER TABLE `testimony`
ADD CONSTRAINT `fk_testimony_relief1` FOREIGN KEY (`relief_idrelief`) REFERENCES `relieftype` (`idrelief`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_testimony_remedy1` FOREIGN KEY (`remedy_idremedy`) REFERENCES `remedy` (`idremedy`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_testimony_sickness1` FOREIGN KEY (`sickness_idsickness`) REFERENCES `sickness` (`idsickness`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_testimony_user` FOREIGN KEY (`user_iduser`) REFERENCES `user` (`iduser`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `trendingsearches`
--
ALTER TABLE `trendingsearches`
ADD CONSTRAINT `fk_trendingSearches_homePage1` FOREIGN KEY (`homePage_idhomePage`) REFERENCES `homepage` (`idhomePage`) ON DELETE NO ACTION ON UPDATE NO ACTION;
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 */;
|
<filename>additional/public_transport/setpublictransportwaitlinks.sql
CREATE FUNCTION setpublictransportwaitlinks() RETURNS void
LANGUAGE plpgsql
AS $$
/*
Add waiting links between public transport stops for connecting services.
Each waiting link is assumed to linking services that are between 5 and 20 minutes after each other, in order to cope with delays to services.
May take a while...
NOTE geometry SRID hardcoded
PARAMS
n/a
RETURNS void
*/
DECLARE
BEGIN
--Get the stops where you can access another line, and add a cost for waiting
WITH x AS (
SELECT DISTINCT
b.file_id,
a.route_id || ' ' || b.route_id AS route_id,
a.route_link_id || ' ' || b.route_link_id AS route_link_id,
a.direction || ' ' || b.direction AS direction,
a.target AS source, --Yeah, it looks weird
b.source AS target, --but this a new link, so the end of one route section is the start, and vice versa
ST_SetSRID(
ST_MakeLine(ARRAY[
v.the_geom,
ST_SetSRID(ST_MakePoint(ST_X(v.the_geom) + 0.0000001, ST_Y(v.the_geom)), 27700),
ST_SetSRID(ST_MakePoint(ST_X(v.the_geom) , ST_Y(v.the_geom) + 0.0000001), 27700)
])
, 27700) AS geom,
a.line_name || ' ' || b.line_name AS line_name,
b.operator_name,
b.public_transport_route_id,
b.route_description,
b.route_direction,
a.target_public_transport_route_stop_id AS source_public_transport_route_stop_id,
a.target_atco_code AS source_atco_code,
a.target_public_transport_stop_id AS source_public_transport_stop_id,
a.target_naptan_code AS source_naptan_code,
a.target_stop_name AS source_stop_name,
a.target_stop_landmark AS source_stop_landmark,
a.target_timing_status AS source_timing_status,
a.target_cluster_id AS source_cluster_id,
a.target_geom AS source_geom,
b.source_public_transport_route_stop_id AS target_public_transport_route_stop_id,
b.source_atco_code AS target_atco_code,
b.source_public_transport_stop_id AS target_public_transport_stop_id,
b.source_naptan_code AS target_naptan_code,
b.source_stop_name AS target_stop_name,
b.source_stop_landmark AS target_stop_landmark,
b.source_timing_status AS target_timing_status,
b.source_cluster_id AS target_cluster_id,
b.source_geom AS target_geom,
a.journey_pattern_section_id || ' ' || b.journey_pattern_section_id AS journey_pattern_section_id,
a.journey_pattern_timing_id || ' ' || b.journey_pattern_timing_id AS journey_pattern_timing_id,
b.stop_time - a.stop_time AS runtime,
b.stop_time - a.stop_time AS agg_runtime,
b.vehicle_journey_code,
b.vehicle_service_code,
b.service_code,
b.departure_time,
b.stop_time,
b.monday,
b.tuesday,
b.wednesday,
b.thursday,
b.friday,
b.saturday,
b.sunday,
b.public_transport_route_way_id,
'wait' AS transport_mode,
ST_Length(ST_SetSRID(
ST_MakeLine(ARRAY[
v.the_geom,
ST_SetSRID(ST_MakePoint(ST_X(v.the_geom) + 0.0000001, ST_Y(v.the_geom)), 27700),
ST_SetSRID(ST_MakePoint(ST_X(v.the_geom) , ST_Y(v.the_geom) + 0.0000001), 27700)
])
, 27700)) AS length_m,
a.endaltitude AS startaltitude,
b.startaltitude AS endaltitude,
0 AS totalascent,
0 AS totaldescent,
0 AS curveindex,
EXTRACT(EPOCH FROM (b.stop_time - a.stop_time)) AS cost,
10000000 AS reverse_cost,
EXTRACT(EPOCH FROM (b.stop_time - a.stop_time)) AS cost_time,
EXTRACT(EPOCH FROM (b.stop_time - a.stop_time)) AS reverse_cost_time,
getMetCost('met_07040', EXTRACT(EPOCH FROM (b.stop_time - a.stop_time))) AS cost_met,
getMetCost('met_07040', EXTRACT(EPOCH FROM (b.stop_time - a.stop_time))) AS reverse_cost_met,
1 AS oneway,
1 As speed,
1.0 AS terrain_index,
0.0 AS percentslope,
0.0 AS reversepercentslope,
0.0 AS angleslope,
0.0 AS reverseangleslope
FROM public_transport_route_times a
CROSS JOIN public_transport_route_times b
JOIN public_transport_route_times_vertices_pgr v ON a.target = v.id
WHERE a.route_id != b.route_id
AND a.line_name != b.line_name
AND a.target_public_transport_stop_id = b.source_public_transport_stop_id
AND (a.stop_time + 5::double precision * '00:01:00'::interval) < b.stop_time
AND (b.stop_time - a.stop_time) < (20::double precision * '00:01:00'::interval)
)
INSERT INTO public_transport_route_times
(
file_id, route_id, route_link_id, direction, source, target, geom, line_name, operator_name,
public_transport_route_id, route_description, route_direction,
source_public_transport_route_stop_id, source_atco_code, source_public_transport_stop_id, source_naptan_code, source_stop_name, source_stop_landmark, source_timing_status, source_cluster_id, source_geom,
target_public_transport_route_stop_id, target_atco_code, target_public_transport_stop_id, target_naptan_code, target_stop_name, target_stop_landmark, target_timing_status, target_cluster_id, target_geom,
journey_pattern_section_id, journey_pattern_timing_id, runtime, agg_runtime, vehicle_journey_code, vehicle_service_code, service_code, departure_time, stop_time,
monday, tuesday, wednesday, thursday, friday, saturday, sunday, public_transport_route_way_id, transport_mode, length_m,
startaltitude, endaltitude, totalascent, totaldescent, curveindex, cost, reverse_cost, cost_time, reverse_cost_time, cost_met, reverse_cost_met, oneway, speed, terrain_index,
percentslope, reversepercentslope, angleslope, reverseangleslope
)
SELECT
x.file_id, x.route_id, x.route_link_id, x.direction, x.source, x.target, x.geom, x.line_name, x.operator_name,
x.public_transport_route_id, x.route_description, x.route_direction,
x.source_public_transport_route_stop_id, x.source_atco_code, x.source_public_transport_stop_id, x.source_naptan_code, x.source_stop_name, x.source_stop_landmark, x.source_timing_status, x.source_cluster_id, x.source_geom,
x.target_public_transport_route_stop_id, x.target_atco_code, x.target_public_transport_stop_id, x.target_naptan_code, x.target_stop_name, x.target_stop_landmark, x.target_timing_status, x.target_cluster_id, x.target_geom,
x.journey_pattern_section_id, x.journey_pattern_timing_id, x.runtime, x.agg_runtime, x.vehicle_journey_code, x.vehicle_service_code, x.service_code, x.departure_time, x.stop_time,
x.monday, x.tuesday, x.wednesday, x.thursday, x.friday, x.saturday, x.sunday, x.public_transport_route_way_id, x.transport_mode, x.length_m,
x.startaltitude, x.endaltitude, x.totalascent, x.totaldescent, x.curveindex, x.cost, x.reverse_cost, x.cost_time, x.reverse_cost_time, x.cost_met, x.reverse_cost_met, x.oneway, x.speed, x.terrain_index,
x.percentslope, x.reversepercentslope, x.angleslope, x.reverseangleslope
FROM x;
END
$$;
ALTER FUNCTION setpublictransportwaitlinks() OWNER TO postgres; |
CREATE TABLE [dbo].[Images] AS FILETABLE FILESTREAM_ON [PastryFiles]
WITH (FILETABLE_COLLATE_FILENAME = Romanian_CI_AS, FILETABLE_DIRECTORY = N'Images');
|
<reponame>Eythorsson-dev/repo-pattern-template
CREATE TABLE [dbo].[LOG_TAB]
(
[LogId] BIGINT NOT NULL PRIMARY KEY IDENTITY,
[LogLevel] INT NOT NULL,
[LogType] INT NOT NULL,
[LogDate] DATETIME NOT NULL,
[Message] VARCHAR(MAX) NOT NULL,
[Stacktrace] VARCHAR(MAX) NULL,
[ReferanceId] BIGINT NULL,
[ReferanceName] VARCHAR(50) NULL,
[ReferanceFriendlyName] VARCHAR(50) NULL,
)
|
--Task - delete duplicates from table.
--Create table.
CREATE TABLE users(
id SERIAL PRIMARY KEY,
name VARCHAR(20));
--Add elements to the table.
INSERT INTO users(name) VALUES('Duke');
INSERT INTO users(name) VALUES('Alex');
INSERT INTO users(name) VALUES('Duke');
INSERT INTO users(name) VALUES('Kate');
INSERT INTO users(name) VALUES('Duke');
--Decision #1 - delete all duplicates from the table.
DELETE FROM users WHERE name = (SELECT name
FROM users
group by name
HAVING count(*) > 1);
---Decision №2 (create table and add unique elements).
--Create table
CREATE TABLE user1(
name VARCHAR(20)
);
--Add unique in the user1 from users.
INSERT INTO user1 (name) SELECT DISTINCT users.name FROM users;
--Clear users.
DELETE FROM users
--Copy elements in the users from user1.
INSERT INTO users (name) SELECT name FROM user1
-- Drop user1.
Drop Table user1
|
<gh_stars>0
ALTER TABLE `product` ADD COLUMN `type` CHAR(10) DEFAULT "single" |
DROP FUNCTION IF EXISTS core.is_valid_office_id(integer);
CREATE FUNCTION core.is_valid_office_id(integer)
RETURNS boolean
AS
$$
BEGIN
IF EXISTS(SELECT 1 FROM core.offices WHERE office_id=$1) THEN
RETURN true;
END IF;
RETURN false;
END
$$
LANGUAGE plpgsql;
SELECT core.is_valid_office_id(1); |
#include "postgres.h"
...
char buffer[40]; /* our source data */
...
text *destination = (text *) palloc(VARHDRSZ + 40);
SET_VARSIZE(destination, VARHDRSZ + 40);
memcpy(destination->data, buffer, 40);
...
|
<reponame>Zhaojia2019/cubrid-testcases<gh_stars>1-10
create class test_class (date_col date, time_col time, timestamp_col timestamp, datetime_col datetimeltz);
insert into test_class(datetime_col) values (datetimeltz '1-1-1 00:00:00.000');
insert into test_class(datetime_col) values (datetimeltz '0001-01-01 00:00:00.000');
insert into test_class(datetime_col) values (datetimeltz '1970-01-01 00:00:00.000');
insert into test_class(datetime_col) values (datetimeltz '1990-01-02 23:59:59.999');
insert into test_class(datetime_col) values (datetimeltz '2990-01-02 23:59:59.999');
insert into test_class(datetime_col) values (datetimeltz '1970-01-01 00:00:00');
insert into test_class(datetime_col) values (datetimeltz '1990-01-02 23:59:59');
insert into test_class(datetime_col) values (datetimeltz '2990-01-02 23:59:59');
insert into test_class(datetime_col) values (datetimeltz '01/01/1970 00:00:00.000');
insert into test_class(datetime_col) values (datetimeltz '01/02/1990 23:59:59.999');
insert into test_class(datetime_col) values (datetimeltz '01/02/2990 23:59:59.999');
insert into test_class(datetime_col) values (datetimeltz '01/01/1970 00:00:00');
insert into test_class(datetime_col) values (datetimeltz '01/02/1990 23:59:59');
insert into test_class(datetime_col) values (datetimeltz '01/02/2990 23:59:59');
insert into test_class(date_col) values (DATE '01/01/1970');
insert into test_class(date_col) values (DATE '01/02/1990');
insert into test_class(date_col) values (DATE '01/02/2990');
select * from test_class where datetime_col = NULL;
select * from test_class where datetime_col <> NULL;
select * from test_class where datetime_col is NULL order by 1;
select * from test_class where datetime_col is not NULL order by 4;
drop class test_class; |
<filename>pictionnary.sql
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1:3306
-- Généré le : mar. 15 mai 2018 à 20:40
-- Version du serveur : 5.7.19
-- Version de PHP : 7.1.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `pictionnary`
--
-- --------------------------------------------------------
--
-- Structure de la table `words`
--
DROP TABLE IF EXISTS `words`;
CREATE TABLE IF NOT EXISTS `words` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`word` varchar(255) DEFAULT NULL,
`lang` varchar(255) DEFAULT NULL,
`verified` tinyint(1) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=459 DEFAULT CHARSET=latin1;
--
-- Déchargement des données de la table `words`
--
INSERT INTO `words` (`id`, `word`, `lang`, `verified`, `createdAt`, `updatedAt`) VALUES
(1, 'voiture', 'fr', 1, '2018-03-16 19:23:06', '2018-03-16 19:23:06'),
(2, 'car', 'en', 1, '2018-03-16 19:23:50', '2018-03-16 19:23:50'),
(3, 'bateau', 'fr', 1, '2018-03-16 19:23:50', '2018-03-16 19:23:50'),
(4, 'boat', 'en', 1, '2018-03-16 19:24:01', '2018-03-16 19:24:01'),
(5, 'cat', 'en', 1, '2018-05-05 11:06:28', '2018-05-05 11:06:28'),
(6, 'sun', 'en', 1, '2018-05-05 11:06:28', '2018-05-05 11:06:28'),
(7, 'cup', 'en', 1, '2018-05-05 11:07:25', '2018-05-05 11:07:25'),
(8, 'ghost', 'en', 1, '2018-05-05 11:07:25', '2018-05-05 11:07:25'),
(9, 'flower', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(10, 'pie', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(11, 'cow', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(12, 'banana', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(13, 'snowflake', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(14, 'bug', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(15, 'book', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(16, 'jar', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(17, 'snake', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(18, 'light', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(19, 'lips', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(20, 'apple', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(21, 'slide', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(22, 'socks', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(23, 'smile', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(24, 'swing', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(25, 'coat', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(26, 'shoe', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(27, 'water', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(28, 'heart', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(29, 'hat', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(30, 'ocean', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(31, 'kite', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(32, 'dog', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(33, 'mouth', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(34, 'milk', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(35, 'duck', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(36, 'eyes', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(37, 'skateboard', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(38, 'bird', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(39, 'boy', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(40, 'person', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(41, 'girl', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(42, 'mouse', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(43, 'ball', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(44, 'house', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(45, 'star', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(46, 'nose', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(47, 'bed', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(48, 'whale', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(49, 'jacket', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(50, 'shirt', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(51, 'hippo', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(52, 'beach', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(53, 'egg', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(54, 'face', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(55, 'cookie', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(56, 'cheese', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(57, 'ice cream cone', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(58, 'drum', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(59, 'circle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(60, 'spoon', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(61, 'worn', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(62, 'spider web', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(63, 'bridge', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(64, 'bone', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(65, 'grapes', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(66, 'bell', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(67, 'jellyfish', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(68, 'bunny', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(69, 'truck', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(70, 'grass', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(71, 'door', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(72, 'monkey', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(73, 'spider', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(74, 'bread', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(75, 'ears', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(76, 'bowl', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(77, 'bracelet', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(78, 'alligator', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(79, 'bat', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(80, 'clock', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(81, 'lollipop', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(82, 'moon', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(83, 'doll', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(84, 'orange', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(85, 'basketball', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(86, 'bike', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(87, 'airplane', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(88, 'pen', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(89, 'inchworm', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(90, 'seashell', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(91, 'rocket', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(92, 'cloud', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(93, 'bear', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(94, 'corn', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(95, 'chicken', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(96, 'purse', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(97, 'glasses', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(98, 'blocks', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(99, 'carrot', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(100, 'turtle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(101, 'pencil', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(102, 'horse', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(103, 'dinosaur', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(104, 'head', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(105, 'lamp', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(106, 'snowman', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(107, 'ant', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(108, 'girafe', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(109, 'cupcake', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(110, 'chair', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(111, 'leaf', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(112, 'bunk bed', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(113, 'snail', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(114, 'baby', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(115, 'balloon', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(116, 'bus', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(117, 'cherry', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(118, 'crab', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(119, 'football', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(120, 'branch', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(121, 'robot', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(122, 'song', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(123, 'trip', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(124, 'backbone', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(125, 'bomb', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(126, 'round', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(127, 'treasure', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(128, 'garbage', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(129, 'park', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(130, 'pirate', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(131, 'ski', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(132, 'state', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(133, 'whistle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(134, 'palace', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(135, 'baseball', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(136, 'coal', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(137, 'queen', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(138, 'dominoes', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(139, 'photograph', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(140, 'computer', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(141, 'hockey', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(142, 'aircraft', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(143, 'hot dog', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(144, 'salt and pepper', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(145, 'key', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(146, 'whisk', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(147, 'frog', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(148, 'lawnmower', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(149, 'mattress', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(150, 'pinwheel', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(151, 'cake', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(152, 'circus', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(153, 'battery', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(154, 'mailman', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(155, 'cowboy', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(156, 'password', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(157, 'bicycle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(158, 'skate', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(159, 'electricity', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(160, 'lightsaber', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(161, 'thief', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(162, 'teapot', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(163, 'deep', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(164, 'spring', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(165, 'nature', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(166, 'shallow', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(167, 'toast', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(168, 'outside', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(169, 'America', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(170, 'roller blading', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(171, 'gingerbread man', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(172, 'bowtie', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(173, 'half', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(174, 'spare', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(175, 'wax', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(176, 'light bulb', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(177, 'platypus', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(178, 'music', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(179, 'sailboat', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(180, 'popsicle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(181, 'brain', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(182, 'skirt', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(183, 'birthday cake', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(184, 'knee', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(185, 'pineapple', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(186, 'tusk', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(187, 'spinkler', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(188, 'money', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(189, 'spool', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(190, 'lighthouse', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(191, 'doormat', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(192, 'flute', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(193, 'rug', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(194, 'snowball', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(195, 'owl', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(196, 'gate', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(197, 'suitcase', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(198, 'stomach', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(199, 'doghouse', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(200, 'pajamas', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(201, 'peach', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(202, 'newspaper', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(203, 'watering can', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(204, 'hook', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(205, 'school', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(206, 'beaver', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(207, 'french fries', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(208, 'beehive', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(209, 'artist', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(210, 'flagpole', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(211, 'camera', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(212, 'hair dryer', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(213, 'mushroom', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(214, 'toe', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(215, 'pretzel', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(216, 'TV', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(217, 'quilt', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(218, 'chalk', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(219, 'dollar', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(220, 'soda', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(221, 'chin', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(222, 'garden', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(223, 'ticket', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(224, 'boot', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(225, 'cello', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(226, 'rain', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(227, 'clam', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(228, 'pelican', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(229, 'stingray', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(230, 'fur', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(231, 'blowfish', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(232, 'rainbow', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(233, 'happy', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(234, 'fist', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(235, 'base', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(236, 'storm', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(237, 'mitten', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(238, 'easel', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(239, 'nail', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(240, 'sheep', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(241, 'stoplight', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(242, 'coconut', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(243, 'crib', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(244, 'hippopotamus', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(245, 'ring', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(246, 'seesaw', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(247, 'plate', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(248, 'fishing pole', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(249, 'hopscotch', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(250, 'bell pepper', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(251, 'front porch', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(252, 'cheek', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(253, 'video camera', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(254, 'washing machine', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(255, 'telephone', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(256, 'silverware', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(257, 'barn', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(258, 'bib', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(259, 'flashlight', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(260, 'muffin', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(261, 'sunflower', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(262, 'swimming pool', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(263, 'radish', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(264, 'peanut', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(265, 'poodle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(266, 'potato', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(267, 'shark', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(268, 'fang', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(269, 'waist', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(270, 'bottle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(271, 'mail', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(272, 'lobster', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(273, 'ice', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(274, 'lawn mower', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(275, 'bubble', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(276, 'cheeseburger', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(277, 'rocking chair', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(278, 'popcorn', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(279, 'yo-yo', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(280, 'seahorse', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(281, 'spine', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(282, 'desk', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(283, 'snag', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(284, 'jungle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(285, 'important', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(286, 'mime', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(287, 'peasant', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(288, 'baggage', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(289, 'hail', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(290, 'clog', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(291, 'pizza sauce', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(292, 'scream', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(293, 'newsletter', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(294, 'pharmacist', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(295, 'lie', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(296, 'catalog', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(297, 'ringleader', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(298, 'husband', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(299, 'laser', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(300, 'diagonal', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(301, 'comfy', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(302, 'myth', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(303, 'dorsal', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(304, 'biscuit', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(305, 'hydrogen', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(306, 'macaroni', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(307, 'rubber', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(308, 'darkness', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(309, 'yolk', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(310, 'exercise', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(311, 'vegetarian', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(312, 'shrew', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(313, 'chestnut', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(314, 'ditch', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(315, 'wobble', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(316, 'glitter', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(317, 'neighborhood', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(318, 'dizzy', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(319, 'fireside', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(320, 'retail', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(321, 'drawback', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(322, 'logo', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(323, 'fabric', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(324, 'mirror', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(325, 'barber', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(326, 'jazz', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(327, 'migrate', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(328, 'drought', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(329, 'commercial', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(330, 'dashboard', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(331, 'bargain', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(332, 'double', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(333, 'download', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(334, 'professor', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(335, 'landscape', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(336, 'ski goggles', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(337, 'vitamin', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(338, 'cardboard', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(339, 'oar', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(340, 'baby-sitter', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(341, 'drip', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(342, 'shampoo', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(343, 'point', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(344, 'time machine', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(345, 'yardstick', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(346, 'think', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(347, 'lace', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(348, 'darts', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(349, 'world', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(350, 'avocado', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(351, 'bleach', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(352, 'shower curtain', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(353, 'dent', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(354, 'lap', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(355, 'sandbox', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(356, 'bruise', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(357, 'quicksand', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(358, 'fog', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(359, 'gasoline', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(360, 'pocket', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(361, 'honk', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(362, 'sponge', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(363, 'rim', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(364, 'bride', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(365, 'wig', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(366, 'zipper', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(367, 'wag', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(368, 'letter opener', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(369, 'fiddle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(370, 'water buffalo', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(371, 'pilot', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(372, 'brand', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(373, 'pail', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(374, 'baguette', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(375, 'rib', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(376, 'mascot', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(377, 'zoo', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(378, 'sushi', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(379, 'fizz', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(380, 'ceiling fan', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(381, 'bald', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(382, 'banister', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(383, 'punk', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(384, 'post office', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(385, 'season', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(386, 'internet', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(387, 'chess', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(388, 'puppet', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(389, 'chime', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(390, 'ivy', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(391, 'full', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(392, 'koala', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(393, 'dentist', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(394, 'baseboards', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(395, 'ping pong', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(396, 'bonnet', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(397, 'mast', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(398, 'hut', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(399, 'welder', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(400, 'dryer sheets', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(401, 'sunburn', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(402, 'houseboat', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(403, 'sleep', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(404, 'kneel', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(405, 'crust', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(406, 'grandpa', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(407, 'speakers', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(408, 'cheerleader', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(409, 'dust bunny', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(410, 'salmon', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(411, 'cabin', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(412, 'handle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(413, 'swamp', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(414, 'cruise', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(415, 'wedding cake', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(416, 'macho', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(417, 'drain', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(418, 'foil', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(419, 'orbit', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(420, 'dream', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(421, 'recycle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(422, 'raft', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(423, 'gold', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(424, 'plank', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(425, 'cliff', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(426, 'sweater vest', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(427, 'cape', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(428, 'safe', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(429, 'picnic', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(430, 'shrink ray', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(431, 'leak', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(432, 'boa constrictor', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(433, 'mold', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(434, 'CD', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(435, 'tiptoe', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(436, 'hurdle', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(437, 'knight', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(438, 'loveseat', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(439, 'cloak', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(440, 'bedbug', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(441, 'bobsled', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(442, 'hot tub', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(443, 'firefighter', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(444, 'beanstalk', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(445, 'nightmare', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(446, 'coach', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(447, 'moth', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(448, 'sneeze', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(449, 'wooly mammoth', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(450, 'pigpen', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(451, 'swarm', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(452, 'goblin', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(453, 'chef', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(454, 'applause', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(455, 'wax', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(456, 'sheep dog', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(457, 'plow', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53'),
(458, 'runt', 'en', 1, '2018-05-05 11:56:53', '2018-05-05 11:56:53');
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 */;
|
/* Leave this unchanged doe MS compatibility
l:see LICENSE file
g:utility
v:131117.1000\s.zaglio:more detailed dbg info and enlarged @files.key size
v:131021\s.zaglio:some correction near use of @kp
v:131018\s.zaglio:corrected a bug if under mssql2k5
v:131016.1000,131015,131014\s.zaglio: adding list of sub directory and unicode support
v:130906,130904\s.zaglio: better help;added more debug info and (net) errors check
v:130424,130227\s.zaglio: avoid #files when used with shortkey(* option);a small bug near full search
v:130115,121116\s.zaglio: added grp: option;a bug near extra drop of #src
v:121010\s.zaglio: in * opt, search _word% and word% added @isql
v:120926,120919\s.zaglio: print instead of select and +select option;added # has wild char
v:120918,120828,120209\s.zaglio: #files.size to bigint;added option *;remove #objs
v:120112\s.zaglio: added read of format date from registry
v:120111\s.zaglio: adapted to new #files format and a remake
v:111103\s.zaglio: used fn__ntext_to_lines and dir when english settings
v:110316\s.zaglio: adapted to last sp__write_ntext_to_lines upd
v:100919.1115,100919.1100\s.zaglio: compatible with mssql2k;added special syntax
v:100919.1000\s.zaglio: a bug in list of db objs and added out to #files
v:100509,100508\s.zaglio: added @subdir;added DR flag and directory distinction
v:100410,100405,100402\s.zaglio: added db search;added @out;a remake
t:sp__dir '*str*',@dbg=1
t:sp__dir '%temp%\*.*',@dbg=1
t:sp__dir 'c:\*.ini',@opt='s',@dbg=1 -- 16 sec by cmdline, 18 by sp
t:sp__dir @opt='*',@path='util'
t:job
t:sp__dir '\\lupin\tecnico\_SCRIPTS\SINTESI\3\3.02'
*/
CREATE proc [dbo].[sp__dir]
@path nvarchar(512) =null,
@isql nvarchar(1024) =null,
@opt sysname =null,
@dbg int =0
as
begin
set nocount on
declare @proc sysname,@ret int
select @proc=object_name(@@procid),@ret=0,
@opt=dbo.fn__Str_quote(isnull(@opt,''),'|')
declare
@cmd nvarchar(4000),@d datetime,
@db sysname,@sch sysname,@obj sysname,
@sql nvarchar(4000),@file nvarchar(4000),
@n int,@i int, @path_ex sysname,
@top sysname,@oby sysname,
@psep nvarchar(2),@dsep nvarchar(2),
@fmt sysname,@select bit,@grp bit,@s bit,
@blob varbinary(max),@text nvarchar(max),
@start int,@end int,@dir nvarchar(4000),
@lng char,@rid int,@files_id int,
@kp bit -- keep path in name
declare @obj_order table(xt varchar(4),ord tinyint)
insert @obj_order
select 'u',10 union
select 'tr',15 union
select 'p',20 union
select 'v',30 union
select 'if',40 union
select 'tf',50 union
select 'fn',60 union
select 'sn',70 union
select 'pk',80 union
select 'f',90 union
select 'd',100
select
@files_id=isnull(object_id('tempdb..#files'),0),
@dsep=':',
@select=charindex('|select|',@opt)|charindex('|sel|',@opt),
@grp=charindex('|grp|',@opt),
@s=charindex('|s|',@opt)|charindex('|sub|',@opt),
@kp=charindex('|kp|',@opt)|1-@select|1-cast(@files_id as bit),
@psep=psep,
@path=case charindex('|*|',@opt)
when 0
then @path
else replace(@path,'#','*')+'*'
end,
-- full search
@path_ex=case charindex('|*|',@opt)
when 0 then ''
else '*'+replace(@path,'#','*')+'*'
end
from fn__sym()
if left(@path,4)='grp:' select @grp=1,@path=substring(@path,5,len(@path)-4)
declare @stdout table (lno int identity primary key,line nvarchar(4000))
declare @dirs table(s int,e int,dir nvarchar(4000))
declare @files table (
id int identity primary key,
[key] nvarchar(446),sdt nvarchar(32),dt datetime,
sfsize nvarchar(64) null ,n bigint null, flags smallint,
rid int null
)
declare @objs table (
id int identity primary key,
obj sysname,
xtype nvarchar(2)
)
if @path is null goto help
create table #src(lno int identity primary key,line nvarchar(4000))
if @grp=1
begin
select
*
from fn__script_info(default,'g',0)
where cast(val1 as sysname) like replace(@path,'*','%')
goto ret
end
-- =========================================================== list from disk ==
if charindex(@dsep,@path)>0 or charindex(@psep,@path)>0
begin
-- temp file for output of dir
exec sp__get_temp_dir @file out
select @file=@file+@psep+replace(convert(sysname,newid()),'-','_')
if @dbg>0 exec sp__elapsed @d out
-- this is the faster method found
select @cmd ='cmd /u /c dir /4'+case @s when 1 then '/s' else '' end
+' "'+@path+'" >'+@file+'.txt' -- 11 secs x 250000
+' 2>'+@file+'.err'
if @dbg>1 exec sp__printf '%s',@cmd
delete from @stdout
insert @stdout exec master..xp_cmdshell @cmd
select @sql=null
select top 1 @sql=line from @stdout where line is not null
if not @sql is null goto err_dir
if @dbg>0
exec sp__elapsed @d out,'-- dir&err listed into %s in ',@v1=@file
-- ======================================================= load and split txt ==
select @blob=null,@text=null
select @sql='select @blob=BulkColumn '
+'from openrowset(bulk '''+@file+'.txt'', single_blob) as x'
exec sp_executesql @sql,N'@blob varbinary(max) out',@blob=@blob out
select @text=cast(@blob as nvarchar(max))
if @dbg>0 exec sp__elapsed @d out,'-- file TXT readed into memory'
if @@error<>0
exec sp__printf '%s','>>> If error 4861, see http://msdn.microsoft.com/en-us/library/ms188365.aspx'
truncate table #src
insert #src(line) select line from fn__ntext_to_lines(@text,0)
-- 111102\s.zaglio:deprecated sp__write_ntext_to_lines
if @dbg>0 exec sp__elapsed @d out,'-- TXT splitted into lines'
if @dbg>1
begin
select '#src' [#src],* from #src
exec sp__elapsed @d out,'-- after show of #src'
end
-- ======================================================= load and split err ==
select @blob=null,@text=null
select @sql='select @blob=BulkColumn '
+'from openrowset(bulk '''+@file+'.err'', single_blob) as x'
exec sp_executesql @sql,N'@blob varbinary(max) out',@blob=@blob out
select @text=cast(@blob as nvarchar(max))
if @dbg>0 exec sp__elapsed @d out,'-- file ERR readed into memory'
if @@error<>0
exec sp__printf '%s','>>> If error 4861, see http://msdn.microsoft.com/en-us/library/ms188365.aspx'
delete from @stdout
insert @stdout(line) select line from fn__ntext_to_lines(@text,0)
-- 111102\s.zaglio:deprecated sp__write_ntext_to_lines
if @dbg>0 exec sp__elapsed @d out,'-- ERR splitted into lines'
if @dbg>1 select 'stdout' [stdout],* from @stdout
select @sql=null
select top 1 @sql=line from @stdout where line is not null
if not @sql is null goto err_dir
-- ======================================================== delete temp files ==
select @cmd='del /q '+@file+'.txt&del /q '+@file+'.err'
exec master..xp_cmdshell @cmd,no_output
-- ======================================================== split directories ==
-- t:sp__dir 'c:\*.ini',@opt='s|select' ,@dbg=1
-- t:sp__dir 'c:\*.ini',@opt='s' ,@dbg=1
-- t:'sp__dir ''i:\temp\*'',@opt=''s'',@dbg=1'
-- t:'sp__dir ''c:\*.ini'',@opt=''s'',@dbg=1'
select @n=1
if @s=0
begin
insert @dirs
select min(lno),max(lno),
case @kp when 1 then @path else '' end from #src
goto skip_with
end
-- mssql 2k5 do not support with under if
;with dirs(lno,dir) as (
select lno,right(line,charindex(' ',reverse(line),
len(line)-charindex(@psep,line))-1
) dir
from #src where line like ' %directory %'+@psep+'%'
)
insert @dirs(s,e,dir)
select
s.lno+1 s_lno,
isnull((select top 1 lno from dirs e where e.lno>s.lno),
(select max(lno) from #src))-1
as e_lno,
s.dir
from dirs s
select @n=@@rowcount
if @dbg>0 exec sp__elapsed @d out,'-- %d direcotries',@v1=@n
skip_with:
if @dbg>0 exec sp__elapsed @d out,'-- tmp file deleted and split or dirs'
-- ============================================================= check region ==
-- get local date format
exec master.. xp_regread
'HKEY_CURRENT_USER','Control Panel\International',
'sShortDate',
@fmt out
-- or by cmd: REG QUERY "HKCU\Control Panel\International" /v sShortDate&
-- exec master..xp_regenumvalues 'HKEY_CURRENT_USER','Control Panel\International'
-- GRANT EXECUTE ON sys.xp cmdshell TO [BUILTIN\Users];
/* old solution by inspecting content
if exists(
select top 1 line
from #src
where substring(line,19,2) in ('PM','AM') -- english setting
)
select @eng=1
else
select @eng=0
*/
if @fmt like 'd%/m%/y%' select @lng='I'
if @fmt like 'm%/d%/y%' select @lng='E'
if @lng is null goto err_fmt
-- ====================================================== list files with dir ==
-- 18 by sp, 17 without fn__dir_parse_list
declare cs cursor local for
select s,e,dir
from @dirs
where 1=1
open cs
while 1=1
begin
fetch next from cs into @start,@end,@dir
if @@fetch_status!=0 break
select @rid=0
insert @files(rid,sdt,sfsize,[key])
select @rid,sdt,sfsize,case @kp when 1 then @dir+'\'+name else name end
from #src cross apply fn__dir_parse_list(line,@lng)
where line like '[0-9]%'
and not line like '%.'
and not line is null
and lno between @start and @end
end -- cursor cs
close cs
deallocate cs
if @dbg>2 select '@files' [@files],* from @files
-- convert strings
update @files set
[n]=case
when isnumeric(sfsize)=1
then convert(bigint,sfsize)
else null
end,
[dt]=convert(datetime,sdt),
flags=case when sfsize='<dir>' then 32 else 0 end
select @n=@@rowcount
if @dbg>0 exec sp__elapsed @d out,'-- %d files parsed in',@v1=@n
if @dbg>2 select top 100 'top 100 upd' step,* from @files
if @files_id=0 or charindex('|*|',@opt)>0
begin
if @select=1
select
[key] as path,
flags,
dt as creation_date,
n as bytes
from @files
-- order by rid,[key]
else
begin
-- insert #files([key],flags,dt,n)
select id,[key],flags,dt,n
into #files
from @files
-- order by rid,[key]
exec sp__select_astext '
select
dt as creation_date,n as bytes,flags,[key] as path
from #files
order by path'
end
end
else
begin
insert #files([key],flags,dt,n)
select [key],flags,dt,n from @files
-- create an index on name
if not exists(
select null from tempdb..sysindexes
where id=@files_id and name='#ix_files'
)
create index #ix_files on #files(rid,[key])
end
end -- list files
-- ============================================================= list objects ==
else
begin
select @path=replace(@path,'_','[_]')
select @path=replace(@path,'%','[%]')
select @path=replace(@path,'?','_')
select @path=replace(@path,'*','%')
select @path_ex=replace(@path_ex,'_','[_]')
select @path_ex=replace(@path_ex,'%','[%]')
select @path_ex=replace(@path_ex,'?','_')
select @path_ex=replace(@path_ex,'*','%')
-- sp__dir @opt='*',@path='file'
-- exec sp__printf 'p:%s, e:%s',@path,@path_ex
-- sp__dir 'rep*','print ''%obj%'''
insert @objs(obj,xtype)
select [name],xtype
from sysobjects
where [name] like @path
or [name] like @path_ex
order by 2,1
if isnull(@isql,'')!=''
begin
insert #src(line)
select replace(@isql,'%obj%',obj)
from @objs
order by isnull(
(select ord from @obj_order where xt=xtype),
ascii(xtype)
), obj
if @select=1 select line from #src order by lno
else exec sp__print_table '#src'
end
else
begin
if object_id('tempdb..#files') is null or charindex('|*|',@opt)>0
begin
if @select=1
select * from @objs
order by isnull(
(select ord from @obj_order where xt=xtype),
ascii(xtype)
), obj
else
begin
select identity(int,1,1) id,obj,xtype
into #objs
from @objs
order by isnull(
(select ord from @obj_order where xt=xtype),
ascii(xtype)
), obj
exec sp__select_astext 'select * from #objs order by 1'
drop table #objs
end
end
else
insert #files([key],flags)
select
obj,
convert(smallint,cast(cast(xtype as varchar(2)) as binary(2)))
from @objs
end -- !@isql
-- select @db=db,@sch=sch,@obj=obj from dbo.fn__parsename(@what,0,1)
end -- db objs
dispose:
drop table #src
-- #files is dropped by engine
goto ret
-- =================================================================== errors ==
err_fmt: exec @ret=sp__err 'unknown date setting %s',@proc,@p1=@fmt goto ret
err_dir: exec @ret=sp__err '%s',@proc,@p1=@sql goto ret
-- ===================================================================== help ==
help:
exec sp__usage @proc,'
Scope
list objects or files of a db or dir
(sp__ftp uses the same #files format)
Notes
I normally associate this SP to CTRL+4 as "sp__dir @opt=''*'',@path="
Parameters
@path can be a dir path or name of object of db
store the list into #files if exists
accept wild card *,? for both objects
if begin with "grp:" or grp option is specified,
search into group names of db objects
create table #files (
id int identity primary key,
rid int default(0), -- for subdirs
[flags] smallint, -- if &32=32 is a <DIR>
[key] nvarchar(446), -- obj name
dt datetime, -- creation date
n bigint null -- size in bytes
)
@isql macro code that is printed instead of list where %obj% were replaced
@opt options
* consider automtically @path as "@path% or %[_]@path%"
to attach to a shortkey of SSMS; # can used as jolly char
select select instead of print results
grp see @path parameter info
s same as /s of dir, run recursivelly into sub directories
sub alias of option s
kp keep path in name (key)
@dbg 1 show base info and statistics
2 show also internal tables content
Notes
where bytes is null, there is a <DIR>
and index #ix_files will created on rid,key
Examples
exec sp__dir ''c:\test_if_exists''
create table #files ...
exec sp__dir ''c:\'',@dbg=1
select * from #files
drop table #files
'
-- ===================================================================== exit ==
ret:
return @ret
end -- sp__dir |
<reponame>SachiraChin/Vulcan<filename>Vulcan.Core.Auth.Database/StoredProcedures/auth_Roles_GetByUserSystemId.sql
CREATE PROCEDURE [auth].[auth_Roles_GetByUserSystemId]
@userSystemId bigint
AS
select r.[Id], r.[Name], r.[Title], r.[IsHidden], r.[Type],
r.[CreatedDate], r.[CreatedByUserId], r.[CreatedByClientId],
r.[UpdatedByUserId], r.[UpdatedByClientId], r.[UpdatedDate]
from [Roles] r, [ApiUserRoles] acr, [ApiUsers] au
where r.[Id] = acr.[RoleId] and acr.[ApiUserId] = au.[Id] and au.[SystemId]=@userSystemId
|
insert into usuarios(nome, email, idade) values(
"Usuario de Teste 4",
"<EMAIL>",
7
);
|
<filename>src/schemas/clans.sql<gh_stars>0
CREATE TABLE clans (
id SERIAL PRIMARY KEY,
name varchar(255) UNIQUE NOT NULL,
game varchar(255) NOT NULL
); |
-- initial schema
-- Migration SQL that makes the change goes here.
CREATE TABLE cs_users (
uid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
ulogin VARCHAR(30) NOT NULL UNIQUE,
uemail VARCHAR(128) NOT NULL UNIQUE,
ufname VARCHAR(128) NOT NULL,
uname VARCHAR(128) NOT NULL,
ucryptsum VARCHAR(60) NOT NULL, -- blowfish hash
ujoined DATETIME NOT NULL,
ulocation VARCHAR(128) NOT NULL,
upublic TINYINT NOT NULL, -- 1
utoken VARCHAR(32) NOT NULL UNIQUE, -- md5 hash
uactive TINYINT NOT NULL
);
CREATE TABLE cs_mate (
mid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
cuid INTEGER NOT NULL REFERENCES cs_users(uid),
mdate DATETIME NOT NULL
);
CREATE TABLE cs_coffees (
cid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
cuid INTEGER NOT NULL REFERENCES cs_users(uid),
cdate DATETIME NOT NULL
);
CREATE TABLE cs_actions (
aid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
cuid INTEGER NOT NULL REFERENCES cs_users(uid),
acode VARCHAR(32) NOT NULL UNIQUE,
created DATETIME NOT NULL,
validuntil DATETIME NOT NULL,
atype INTEGER NOT NULL,
adata TEXT
);
-- add some indexes to improve query performance
CREATE INDEX cs_users_upublic_idx ON cs_users(upublic);
CREATE INDEX cs_users_ujoined_idx ON cs_users(ujoined);
CREATE INDEX cs_users_uactive_idx ON cs_users(uactive);
CREATE INDEX cs_mate_cuid_idx ON cs_mate(cuid);
CREATE INDEX cs_mate_mdate_idx ON cs_mate(mdate);
CREATE INDEX cs_coffees_cuid_idx ON cs_coffees(cuid);
CREATE INDEX cs_coffees_cdate_idx ON cs_coffees(cdate);
CREATE INDEX cs_actions_cuid_idx ON cs_actions(cuid);
CREATE INDEX cs_actions_atype_idx ON cs_actions(atype);
CREATE INDEX cs_actions_validuntil_idx ON cs_actions(validuntil);
-- @UNDO
-- SQL to undo the change goes here.
DROP TABLE cs_actions;
DROP TABLE cs_coffees;
DROP TABLE cs_mate;
DROP TABLE cs_users;
|
INSERT INTO eg_module(id, name, enabled, contextroot, parentmodule, displayname, ordernumber) VALUES (nextval('SEQ_EG_MODULE'), 'Registration Unit', true, 'mrs', (select id from eg_module where name='MR-Masters'), 'Registration Unit', 4);
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'Create Registration unit', '/masters/mrregistrationunit/new', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 1, 'Create Registration unit', true, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'Create Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'Create Registration unit'));
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'Create-Registration unit', '/masters/mrregistrationunit/create', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 1, 'Create-Registration unit', false, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'Create-Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'Create-Registration unit'));
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'Result-Registration unit', '/masters/mrregistrationunit/result', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 2, 'Result-Registration unit', false, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'Result-Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'Result-Registration unit'));
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'Search and View-Registration unit', '/masters/mrregistrationunit/search/view', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 2, 'View Registration unit', true, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'Search and View-Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'Search and View-Registration unit'));
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'View-Registration unit', '/masters/mrregistrationunit/view', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 2, 'View-Registration unit', false, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'View-Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'View-Registration unit'));
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'Search and View Result Registration unit', '/masters/mrregistrationunit/ajaxsearch/view', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 2, 'Search and View Result Registration unit', false, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'Search and View Result Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'Search and View Result Registration unit'));
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'Search and Edit-Registration unit', '/masters/mrregistrationunit/search/edit', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 3, 'Update Registration unit', true, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'Search and Edit-Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'Search and Edit-Registration unit'));
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'Search and Edit Result Registration unit', '/masters/mrregistrationunit/ajaxsearch/edit', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 3, 'Search and Edit Result Registration unit', false, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'Search and Edit Result Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'Search and Edit Result Registration unit'));
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'Edit-Registration unit', '/masters/mrregistrationunit/edit', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 2, 'Edit-Registration unit', false, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'Edit-Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'Edit-Registration unit'));
INSERT INTO eg_action (id, name, url, queryparams, parentmodule, ordernumber, displayname, enabled, contextroot, "version", createdby, createddate, lastmodifiedby, lastmodifieddate, application) VALUES (nextval('seq_eg_action'), 'update-Registration unit', '/masters/mrregistrationunit/update', NULL, (SELECT id FROM eg_module WHERE name = 'Registration Unit'), 3, 'update-Registration unit', false, 'mrs', 0, 1, now(), 1, now(), (select id from eg_module where name='Marriage Registration'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Super User'), (SELECT id FROM eg_action WHERE name = 'update-Registration unit'));
INSERT INTO EG_ROLEACTION (roleid, actionid) VALUES ((SELECT id FROM eg_role WHERE name = 'Marriage Registration Admin'), (SELECT id FROM eg_action WHERE name = 'update-Registration unit'));
alter table egmrs_registration add column RegistrationUnit bigint ;
alter table egmrs_registration add CONSTRAINT fk_reg_registrationunit FOREIGN KEY (RegistrationUnit) REFERENCES egmrs_registrationunit (id); |
CREATE TABLE Ambient
(id INTEGER PRIMARY KEY AUTOINCREMENT,
Temperature REAL NOT NULL,
Humidity REAL NOT NULL,
Timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP)
CREATE TABLE Report
(id INTEGER PRIMARY KEY AUTOINCREMENT,
ReportName TEXT NOT NULL UNIQUE,
StartDate TIMESTAMP NOT NULL,
StopDate TIMESTAMP NOT NULL,
Temperature INTEGER NOT NULL,
Humidity INTEGER NOT NULL,
Timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP) |
--
-- Database v5
--
-- remove account start date column
ALTER TABLE moany.accounts DROP COLUMN start_date;
-- add budget
CREATE TABLE moany.budgetitems (
uuid varchar(255) NOT NULL,
amount decimal(19,2) NOT NULL,
day_of_period int(11) NOT NULL,
description varchar(255) DEFAULT NULL,
end_date date DEFAULT NULL,
last_modified_date datetime NOT NULL,
period_type varchar(255) NOT NULL,
start_date date NOT NULL,
account varchar(255) NOT NULL,
category varchar(255) DEFAULT NULL,
PRIMARY KEY ( uuid ),
KEY account_key ( account ),
KEY category_key ( category )
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UPDATE moany.system_info SET value = '5' WHERE name = 'db_version';
COMMIT;
|
<gh_stars>1-10
ALTER TABLE user_programs DROP COLUMN record_id;
DROP TABLE user_program_pbs;
DROP TABLE user_program_records;
|
\set QUIET on
\echo 'INFO:Overriding some PG system settings'
-- Not strictly necessary for linting dev/CI.
-- We're not explicitly **not** targetting HDD-backed databases or
-- non-replicated databases BTW.
ALTER SYSTEM SET wal_compression = true;
ALTER SYSTEM SET wal_level = 'minimal';
ALTER SYSTEM SET max_wal_senders = 0;
ALTER SYSTEM SET log_line_prefix = '';
ALTER SYSTEM SET log_statement = 'ddl';
ALTER SYSTEM SET synchronous_commit = off;
-- Make sure our code plays nice.
ALTER SYSTEM SET lock_timeout = '50ms';
ALTER SYSTEM SET log_min_duration_statement = 50; -- ms
ALTER SYSTEM SET idle_in_transaction_session_timeout = '2s';
|
<filename>src/test/resources/sql/create_type/e4b1c060.sql<gh_stars>10-100
-- file:alter_table.sql ln:2065 expect:true
CREATE TYPE mytype AS (a int)
|
<gh_stars>10-100
DROP TABLE IF EXISTS simulation_models; |
<filename>platform/migrations/migrations/20180903222426-views-field.sql
up:
alter table questions add views int unsigned not null default 0 after score;
down:
alter table questions drop column views;
|
<filename>App/WingtipSaaSDatabase/WingtipTenantDB/dbo/Views/rawTickets.sql
CREATE VIEW [dbo].[rawTickets] AS
SELECT v.VenueId, Convert(int, HASHBYTES('md5',c.Email)) AS CustomerEmailId,
tp.TicketPurchaseId, tp.PurchaseDate, tp.PurchaseTotal, tp.RowVersion AS TicketPurchaseRowVersion,
e.EventId, t.RowNumber, t.SeatNumber
FROM [dbo].[TicketPurchases] AS tp
INNER JOIN [dbo].[Tickets] AS t ON t.TicketPurchaseId = tp.TicketPurchaseId
INNER JOIN [dbo].[Events] AS e ON t.EventId = e.EventId
INNER JOIN [dbo].[Customers] AS c ON tp.CustomerId = c.CustomerId
INNER join [dbo].[Venue] as v on 1=1
GO |
<gh_stars>0
-- This is Greenplum dialect
-- Checks all magic squares with square numbers in center and corners
-- with the value in center <= 10**16
-- and the arithmetic progressions at the diagonals correspond to *primitive* pythagorean triples.
-- No such squares with seven square numbers :'(
drop table if exists numbers;
create table numbers as
select x
from generate_series(1, 10000) as x
distributed by (x);
drop table if exists progressions;
create table progressions as
select (m::numeric(32) * m + n::numeric(32) * n)*(m::numeric(32) * m + n::numeric(32) * n) as b2,
4 * m::numeric(32) * n * (m::numeric(32) * m - n::numeric(32) * n) as d
from numbers as m(m)
cross join numbers as n(n)
where m > n
distributed by (b2);
with
squares as (
select b2 as a_11,
b2 - diagonal_one.d as a_00,
b2 + diagonal_one.d as a_22,
b2 - diagonal_two.d as a_02,
b2 + diagonal_two.d as a_20,
b2 + diagonal_one.d + diagonal_two.d as a_01,
b2 + diagonal_one.d - diagonal_two.d as a_10,
b2 - diagonal_one.d + diagonal_two.d as a_12,
b2 - diagonal_one.d - diagonal_two.d as a_21
from progressions as diagonal_one
inner join progressions as diagonal_two using (b2)
where diagonal_one.d < diagonal_two.d
and diagonal_one.d + diagonal_two.d < b2
),
squares_with_flags as (
select *,
((sqrt(a_01)::bigint)^2 = a_01)::int as a_01_flg,
((sqrt(a_10)::bigint)^2 = a_10)::int as a_10_flg,
((sqrt(a_12)::bigint)^2 = a_12)::int as a_12_flg,
((sqrt(a_21)::bigint)^2 = a_21)::int as a_21_flg
from squares
)
select 5 + a_01_flg + a_10_flg + a_12_flg + a_21_flg as square_cnt,
3*a_11 as s,
a_00, a_01, a_02, a_10, a_11, a_12, a_20, a_21, a_22
from squares_with_flags
where (a_01_flg + a_10_flg + a_12_flg + a_21_flg) > 0
order by square_cnt desc, s asc;
|
<reponame>madsenmj/iot-adventureworks
select
fc.ProductKey,
fc.CustomerKey,
fc.OrderDateKey,
fc.ShipDateKey,
fc.SalesOrderNumber,
REPLACE(dc.AddressLine1, ',' ,' ' ) as AddressLine1,
dc.AddressLine2,
dg.City,
dg.StateProvinceName,
dg.EnglishCountryRegionName
from FactInternetSales as fc
JOIN DimCustomer as dc on fc.CustomerKey=dc.CustomerKey
and fc.ProductKey IN ( 220, 221, 222 )
JOIN DimGeography as dg on dc.GeographyKey=dg.GeographyKey |
CREATE TABLE IF NOT EXISTS `spring_security`.`user` (
`id` INT NOT NULL AUTO_INCREMENT,
`username` VARCHAR(45) NOT NULL,
`password` TEXT NOT NULL,
`password_encoder_type` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`));
CREATE TABLE IF NOT EXISTS `spring_security`.`authority` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`user` INT NOT NULL,
PRIMARY KEY (`id`));
CREATE TABLE IF NOT EXISTS `spring_security`.`health_record` (
`id` INT NOT NULL AUTO_INCREMENT,
`username` VARCHAR(45) NOT NULL,
`name` VARCHAR(45) NOT NULL,
`value` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`));
|
CREATE INDEX "CTNOMENCLATURAL_CODE_INDEX1" ON "CTNOMENCLATURAL_CODE" ("SORT_ORDER")
|
<gh_stars>1-10
-- MySQL Script generated by MySQL Workbench
-- Fri Mar 29 18:22:01 2019
-- 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='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema dbdelivery
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema dbdelivery
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `dbdelivery` DEFAULT CHARACTER SET utf8 ;
USE `dbdelivery` ;
-- -----------------------------------------------------
-- Table `dbdelivery`.`tbl_usuario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbdelivery`.`tbl_usuario` (
`usu_id` INT NOT NULL AUTO_INCREMENT,
`usu_nome` VARCHAR(100) NOT NULL,
`usu_login` VARCHAR(80) NOT NULL,
`usu_senha` VARCHAR(100) NOT NULL,
PRIMARY KEY (`usu_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbdelivery`.`tbl_cliente`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbdelivery`.`tbl_cliente` (
`cli_id` INT NOT NULL AUTO_INCREMENT,
`cli_telefone` VARCHAR(20) NOT NULL,
`cli_nome` VARCHAR(80) NOT NULL,
`cli_cpf_cnpj` VARCHAR(45) NULL,
`cli_email` VARCHAR(100) NULL,
`cli_observacao` VARCHAR(255) NULL,
`cli_endereco` VARCHAR(120) NULL,
`cli_numero` VARCHAR(5) NULL,
`cli_complemento` VARCHAR(45) NULL,
`cli_bairro` VARCHAR(100) NULL,
`cli_cidade` VARCHAR(100) NULL,
`cli_estado` VARCHAR(2) NULL,
`cli_cep` VARCHAR(10) NULL,
`cli_taxa_de_entrega` DECIMAL(25,2) NULL,
PRIMARY KEY (`cli_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbdelivery`.`tbl_status_pedido`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbdelivery`.`tbl_status_pedido` (
`sta_ped_id` INT NOT NULL AUTO_INCREMENT,
`sta_ped_descricao` VARCHAR(100) NULL,
PRIMARY KEY (`sta_ped_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbdelivery`.`tbl_pagamento`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbdelivery`.`tbl_pagamento` (
`pag_id` INT NOT NULL AUTO_INCREMENT,
`pag_descricao` VARCHAR(100) NULL,
PRIMARY KEY (`pag_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbdelivery`.`tbl_pedido`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbdelivery`.`tbl_pedido` (
`ped_id` INT NOT NULL AUTO_INCREMENT,
`ped_data` DATE NOT NULL,
`ped_valor_bruto` DECIMAL(25,2) NOT NULL,
`ped_desconto` DECIMAL(25,2) NOT NULL,
`ped_cli_id` INT NOT NULL,
`ped_sta_ped_id` INT NOT NULL,
`ped_usu_id` INT NOT NULL,
`ped_pag_id` INT NOT NULL,
PRIMARY KEY (`ped_id`, `ped_cli_id`, `ped_sta_ped_id`, `ped_usu_id`, `ped_pag_id`),
INDEX `fk_tbl_pedido_tbl_cliente_idx` (`ped_cli_id` ASC),
INDEX `fk_tbl_pedido_tbl_status_pedido1_idx` (`ped_sta_ped_id` ASC),
INDEX `fk_tbl_pedido_tbl_usuario1_idx` (`ped_usu_id` ASC),
INDEX `fk_tbl_pedido_tbl_pagamento1_idx` (`ped_pag_id` ASC),
CONSTRAINT `fk_tbl_pedido_tbl_cliente`
FOREIGN KEY (`ped_cli_id`)
REFERENCES `dbdelivery`.`tbl_cliente` (`cli_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tbl_pedido_tbl_status_pedido1`
FOREIGN KEY (`ped_sta_ped_id`)
REFERENCES `dbdelivery`.`tbl_status_pedido` (`sta_ped_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tbl_pedido_tbl_usuario1`
FOREIGN KEY (`ped_usu_id`)
REFERENCES `dbdelivery`.`tbl_usuario` (`usu_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tbl_pedido_tbl_pagamento1`
FOREIGN KEY (`ped_pag_id`)
REFERENCES `dbdelivery`.`tbl_pagamento` (`pag_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbdelivery`.`tbl_produto`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbdelivery`.`tbl_produto` (
`pro_id` INT NOT NULL AUTO_INCREMENT,
`pro_nome` VARCHAR(100) NOT NULL,
`pro_valor_custo` DECIMAL(25,2) NOT NULL,
`pro_valor_venda` DECIMAL(25,2) NOT NULL,
`pro_estoque` INT NOT NULL,
PRIMARY KEY (`pro_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `dbdelivery`.`tbl_produtos_pedido`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `dbdelivery`.`tbl_produtos_pedido` (
`pro_ped_id` INT NOT NULL AUTO_INCREMENT,
`pro_ped_valor` DECIMAL(25,2) NOT NULL,
`pro_ped_quatidade` INT NOT NULL,
`pro_ped_ped_id` INT NOT NULL,
`pro_ped_cli_id` INT NOT NULL,
`pro_ped_pro_id` INT NOT NULL,
PRIMARY KEY (`pro_ped_id`, `pro_ped_ped_id`, `pro_ped_cli_id`, `pro_ped_pro_id`),
INDEX `fk_tbl_pedido_tbl_pedido1_idx` (`pro_ped_ped_id` ASC, `pro_ped_cli_id` ASC),
INDEX `fk_tbl_pedido_tbl_produto1_idx` (`pro_ped_pro_id` ASC),
CONSTRAINT `fk_tbl_pedido_tbl_pedido1`
FOREIGN KEY (`pro_ped_ped_id` , `pro_ped_cli_id`)
REFERENCES `dbdelivery`.`tbl_pedido` (`ped_id` , `ped_cli_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tbl_pedido_tbl_produto1`
FOREIGN KEY (`pro_ped_pro_id`)
REFERENCES `dbdelivery`.`tbl_produto` (`pro_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
CREATE TABLE ${0} (id int, str text, num int);
|
<filename>packages/hasura/migrations/default/1619194326507_alter_table_public_tis_add_column_nb_mesures/up.sql
ALTER TABLE "public"."tis" ADD COLUMN "nb_mesures" integer NULL;
|
-- Begin the transaction
BEGIN;
-- The `multi_addresses` table keeps track of all ever encountered multi addresses
-- some of these multi addresses can be associated with a country or cloud provider.
CREATE TABLE multi_addresses
(
-- A unique id that identifies this multi_address
id SERIAL,
-- The multi address in the form of `/ip4/123.456.789.123/tcp/4001`
maddr VARCHAR(200) NOT NULL,
-- The derived IPv4 or IPv6 address that was used to determine the country/cloud provider
addr INET,
-- The country that this multi address belongs to in the form of a two to three letter country code
country VARCHAR(3),
-- The cloud provider that this multi address can be associated with
cloud_provider VARCHAR(16),
-- When was this multi address updated the last time
updated_at TIMESTAMPTZ NOT NULL,
-- When was this multi address created
created_at TIMESTAMPTZ NOT NULL,
-- There should only ever be distinct multi addresses here
CONSTRAINT uq_multi_addresses_address UNIQUE (maddr),
PRIMARY KEY (id)
);
CREATE INDEX idx_multi_addresses_maddr ON multi_addresses (maddr);
-- End the transaction
COMMIT;
|
<gh_stars>0
CREATE TABLE classes (
cid SERIAL UNIQUE NOT NULL,
ancestors INT[] NOT NULL DEFAULT '{}'::int[],
classname TEXT NOT NULL,
module TEXT NOT NULL,
PRIMARY KEY (cid)
);
CREATE UNIQUE INDEX classes_lookup ON classes (module, classname);
CREATE INDEX classes_ancestors ON classes USING GIN(ancestors gin__int_ops);
CREATE OR REPLACE FUNCTION get_cid(TEXT, TEXT) RETURNS INT AS
$$
DECLARE
res INT;
BEGIN
SELECT cid INTO res FROM classes c WHERE c.module = $1 AND c.classname = $2;
IF NOT FOUND THEN
INSERT INTO classes (module, classname) VALUES ($1, $2) RETURNING cid INTO res;
END IF;
RETURN res;
END;
$$
LANGUAGE plpgsql;
CREATE TABLE objects (
oid BIGSERIAL UNIQUE NOT NULL,
cid INT NOT NULL REFERENCES classes,
created TIMESTAMPTZ NOT NULL DEFAULT now(),
saved TIMESTAMPTZ,
fields JSONB,
PRIMARY KEY (oid)
);
CREATE INDEX objects_by_class ON objects (cid);
CREATE TABLE object_archive (
oid BIGINT REFERENCES objects,
saved TIMESTAMPTZ NOT NULL DEFAULT now(),
fields JSONB,
PRIMARY KEY (oid, saved)
);
CREATE TABLE field_index_names (
fid SERIAL UNIQUE NOT NULL,
cid INT NOT NULL REFERENCES classes,
field_name TEXT NOT NULL,
PRIMARY KEY (fid)
);
CREATE OR REPLACE FUNCTION object_upsert_fields(BIGINT, JSONB) RETURNS TIMESTAMPTZ AS
$$
DECLARE
old_fields JSONB;
ts TIMESTAMPTZ;
BEGIN
SELECT o.fields, o.saved into old_fields, ts FROM objects o WHERE oid = $1;
IF old_fields = $2 THEN
UPDATE object_archive SET saved = now() where oid = $1 and saved = ts RETURNING saved into ts;
UPDATE objects SET saved = ts WHERE oid = $1;
RETURN ts;
ELSE
UPDATE objects SET saved = now(), fields = $2 WHERE oid = $1 RETURNING saved into ts;
INSERT INTO object_archive (oid, fields, saved) VALUES ($1, $2, ts);
RETURN ts;
END IF;
END;
$$
LANGUAGE plpgsql;
CREATE UNIQUE INDEX field_id_index ON field_index_names USING btree(cid, field_name);
CREATE OR REPLACE FUNCTION get_field_index(INT, VARCHAR) RETURNS INT AS
$$
DECLARE
res INT;
BEGIN
SELECT fid INTO res FROM field_index_names f WHERE f.cid = $1 AND f.field_name = $2;
IF NOT FOUND THEN
INSERT INTO field_index_names (cid, field_name) VALUES ($1, $2) RETURNING fid INTO res;
END IF;
RETURN res;
END;
$$
LANGUAGE plpgsql;
CREATE TABLE snapshot(
sid INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
freq BOOLEAN NOT NULL DEFAULT true,
hourly BOOLEAN NOT NULL DEFAULT false,
daily BOOLEAN NOT NULL DEFAULT false,
weekly BOOLEAN NOT NULL DEFAULT false,
monthly BOOLEAN NOT NULL DEFAULT false,
yearly BOOLEAN NOT NULL DEFAULT false,
taken TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE TABLE snapshot_fields (
sid INT NOT NULL REFERENCES snapshot ON DELETE CASCADE,
oid BIGINT NOT NULL,
saved TIMESTAMPTZ NOT NULL,
PRIMARY KEY (sid, oid),
FOREIGN KEY (oid, saved) REFERENCES object_archive (oid, saved) ON UPDATE CASCADE ON DELETE RESTRICT
);
CREATE UNIQUE INDEX snapshot_by_time ON snapshot USING btree(taken);
CREATE INDEX snapshot_fields_fkey_index ON snapshot_fields USING btree(oid,saved);
CREATE FUNCTION take_snapshot(boolean, boolean, boolean, boolean, boolean, boolean) RETURNS TIMESTAMPTZ AS
$$
DECLARE
new_sid INT;
taken_value TIMESTAMPTZ;
BEGIN
INSERT INTO snapshot (freq, hourly, daily, weekly, monthly, yearly) VALUES ($1, $2, $3, $4, $5, $6) RETURNING sid,taken INTO new_sid,taken_value;
INSERT INTO snapshot_fields (sid, oid, saved)
SELECT new_sid, objects.oid, objects.saved FROM objects;
return taken_value;
END;
$$
LANGUAGE plpgsql;
CREATE TABLE singletons (
cid INT UNIQUE NOT NULL REFERENCES classes,
oid BIGINT UNIQUE NOT NULL REFERENCES objects,
PRIMARY KEY(cid)
);
CREATE TABLE logfile (
time TIMESTAMPTZ NOT NULL default NOW(),
level SMALLINT NOT NULL,
module TEXT,
description TEXT,
backtrace TEXT
);
CREATE INDEX ON logfile USING btree(time desc);
CREATE INDEX ON logfile USING btree(module);
CREATE TABLE auth (
seq UUID NOT NULL DEFAULT uuid_generate_v1mc(),
sig BYTEA NOT NULL,
oid BIGINT NOT NULL REFERENCES objects,
issued TIMESTAMPTZ NOT NULL DEFAULT now(),
expires TIMESTAMPTZ,
session BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY(seq)
);
CREATE INDEX ON auth USING btree(oid);
CREATE INDEX ON auth USING btree(expires) WHERE expires IS NOT NULL;
CREATE TABLE metadata (
id TEXT NOT NULL UNIQUE,
val JSONB NOT NULL,
PRIMARY KEY(id)
);
INSERT INTO metadata VALUES ('database-version', '4'::jsonb);
|
alter table "public"."ContentGroup" drop constraint "ContentGroup_originatingDataId_fkey";
|
<gh_stars>0
SELECT
TO_DATE(CONCAT(SPLIT_PART("8", ' ', 1), SPLIT_PART("8", ' ', 2)), 'Month YYYY') AS data_date
, processed_at
, document_id
FROM {{ source('tcjs_jail_population_report', 'serious_incidents') }}
WHERE "8" LIKE '%Serious Incident%'
|
<reponame>ioneone/junhong
create table post(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
time_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
title VARCHAR(255) NOT NULL,
body TEXT NOT NULL
); |
create database db_super_trunfo;
use db_super_trunfo;
-- MySQL dump 10.13 Distrib 5.7.12, for Win32 (AMD64)
--
-- Host: localhost Database: db_super_trunfo
-- ------------------------------------------------------
-- Server version 5.7.17-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `tb_carta`
--
DROP TABLE IF EXISTS `tb_carta`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_carta` (
`cd_carta` int(11) NOT NULL AUTO_INCREMENT,
`ic_tipo` varchar(20) DEFAULT NULL,
`nm_carta` varchar(30) DEFAULT NULL,
`vl_att_a` decimal(10,0) DEFAULT NULL,
`vl_att_b` decimal(10,0) DEFAULT NULL,
`vl_att_c` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`cd_carta`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_carta`
--
LOCK TABLES `tb_carta` WRITE;
/*!40000 ALTER TABLE `tb_carta` DISABLE KEYS */;
INSERT INTO `tb_carta` VALUES (1,'tubarao','Tubarão Branco',7,2500,40),(2,'tubarao','Tubarão Martelo',5,410,25),(3,'tubarao','Tubarão Limão',7,980,30),(4,'tubarao','Tubarão Baleia',12,4800,12),(5,'tubarao','Tubarão-Cabeça-Chata',3,700,45),(6,'tubarao','Tubarão Tigre',4,360,36),(7,'tubarao','Tubarão Fantasma',3,275,18),(8,'tubarao','Tubarão Duende',4,250,15),(9,'tubarao','Tubarão Lixa',3,180,20),(10,'tubarao','Tubarão Azul',7,1300,27),(11,'carro','BMW i8',250,255,490300),(12,'carro','Audi A6',210,183,120550),(13,'carro','Citroen C4',190,202,60400),(14,'carro','Hyundai Veloster',450,103,210600),(15,'carro','Chevrolet Camaro',275,171,650500),(16,'carro','Ferrari Red',310,287,950500),(17,'carro','Porsche Carrera',300,143,995000),(18,'carro','<NAME> 500',210,109,125000),(19,'carro','Chevrolet Onix',230,214,80300),(20,'carro','Gol 1000',170,296,7500);
/*!40000 ALTER TABLE `tb_carta` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tb_jogador`
--
DROP TABLE IF EXISTS `tb_jogador`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_jogador` (
`cd_jogador` int(11) NOT NULL AUTO_INCREMENT,
`cd_jogo` int(11) DEFAULT NULL,
PRIMARY KEY (`cd_jogador`),
KEY `fk_jogador_jogo` (`cd_jogo`),
CONSTRAINT `fk_jogador_jogo` FOREIGN KEY (`cd_jogo`) REFERENCES `tb_jogo` (`cd_jogo`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_jogador`
--
LOCK TABLES `tb_jogador` WRITE;
/*!40000 ALTER TABLE `tb_jogador` DISABLE KEYS */;
INSERT INTO `tb_jogador` VALUES (1,1),(2,1);
/*!40000 ALTER TABLE `tb_jogador` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tb_jogador_carta`
--
DROP TABLE IF EXISTS `tb_jogador_carta`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_jogador_carta` (
`cd_jogador` int(11) DEFAULT NULL,
`cd_carta` int(11) DEFAULT NULL,
KEY `fk_jogador_carta_jogador` (`cd_jogador`),
KEY `fk_jogador_carta_carta` (`cd_carta`),
CONSTRAINT `fk_jogador_carta_carta` FOREIGN KEY (`cd_carta`) REFERENCES `tb_carta` (`cd_carta`),
CONSTRAINT `fk_jogador_carta_jogador` FOREIGN KEY (`cd_jogador`) REFERENCES `tb_jogador` (`cd_jogador`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_jogador_carta`
--
LOCK TABLES `tb_jogador_carta` WRITE;
/*!40000 ALTER TABLE `tb_jogador_carta` DISABLE KEYS */;
INSERT INTO `tb_jogador_carta` VALUES (1,9),(1,8),(1,10),(1,7),(1,2),(2,5),(2,4),(2,6),(2,1),(2,3);
/*!40000 ALTER TABLE `tb_jogador_carta` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tb_jogo`
--
DROP TABLE IF EXISTS `tb_jogo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_jogo` (
`cd_jogo` int(11) NOT NULL AUTO_INCREMENT,
`ic_vez` int(11) DEFAULT NULL,
PRIMARY KEY (`cd_jogo`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_jogo`
--
LOCK TABLES `tb_jogo` WRITE;
/*!40000 ALTER TABLE `tb_jogo` DISABLE KEYS */;
INSERT INTO `tb_jogo` VALUES (1,1);
/*!40000 ALTER TABLE `tb_jogo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping events for database 'db_super_trunfo'
--
--
-- Dumping routines for database 'db_super_trunfo'
--
/*!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-10-04 23:21:25
|
CREATE TABLE IF NOT EXISTS {table_prefix}Languages (
`lastModified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`lastUserModified` mediumint(9) NULL DEFAULT 0,
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
`languagename` varchar(64) DEFAULT '' NOT NULL,
`languagefamily` varchar(64) DEFAULT '' NOT NULL,
`iso639_1` varchar(2) DEFAULT '' NOT NULL,
`iso639_2` varchar(3) DEFAULT '' NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
UNIQUE KEY `languagename` (`languagename`),
UNIQUE KEY `iso639_1` (`iso639_1`),
UNIQUE KEY `iso639_2` (`iso639_2`),
FULLTEXT KEY `full_language_languagename` (`languagename`),
FULLTEXT KEY `full_language_languagefamily` (`languagefamily`),
FULLTEXT KEY `full_language_iso639_1` (`iso639_1`),
FULLTEXT KEY `full_language_iso639_2` (`iso639_2`)
) ENGINE=InnoDB;
|
<reponame>EDTestBank/edtestbank-service
-- --------------------------------------------------------
-- Host: 192.168.0.201
-- Server version: 10.3.22-MariaDB-0+deb10u1 - Raspbian 10
-- Server OS: debian-linux-gnueabihf
-- HeidiSQL Version: 11.1.0.6116
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- Dumping database structure for edtestbank
CREATE DATABASE IF NOT EXISTS `edtestbank` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `edtestbank`;
-- Dumping structure for table edtestbank.QDescription
CREATE TABLE IF NOT EXISTS `QDescription` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`qIndex_id` bigint(20) NOT NULL,
`descriptionCtx` varchar(1024) NOT NULL,
`dateC` datetime NOT NULL,
`dateM` datetime NOT NULL,
`uuid` varchar(64) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `FK_QDescription_QIndex` (`qIndex_id`) USING BTREE,
CONSTRAINT `FK_QDescription_QIndex` FOREIGN KEY (`qIndex_id`) REFERENCES `QIndex` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
<reponame>DIBS-Payment-Services/opencart_dibseasy
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Vært: mysql14.gigahost.dk
-- Genereringstid: 13. 10 2020 kl. 06:15:45
-- Serverversion: 5.7.28
-- PHP-version: 5.6.27-0+deb8u1
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: `your_database_name`
--
-- --------------------------------------------------------
--
-- Struktur-dump for tabellen `tbl_events`
--
CREATE TABLE `tbl_events` (
`fldID` int(255) NOT NULL,
`fldEvent` varchar(50) DEFAULT NULL,
`fldDescription` text,
`fldSort` int(3) DEFAULT NULL,
`fldStatus` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Data dump for tabellen `tbl_events`
--
INSERT INTO `tbl_events` (`fldID`, `fldEvent`, `fldDescription`, `fldSort`, `fldStatus`) VALUES
(1, 'payment.created', 'When a payment is created.', 1, 1),
(2, 'payment.reservation.created', 'When a customer successfully has reserved.', 4, 0),
(3, 'payment.reservation.created.v2', 'When a customer successfully has reserved.', 3, 0),
(4, 'payment.checkout.completed', 'When Checkout is completed.', 2, 0),
(5, 'payment.charge.created', 'When a payment has been charged. Partially or fully.', 5, 0),
(6, 'payment.charge.created.v2', 'When a payment has been charged. Partially or fully.', 6, 0),
(7, 'payment.charge.failed', 'When a charge has failed.', 7, 0),
(8, 'payment.refund.initiated', 'When a refund is initiated.', 8, 0),
(9, 'payment.refund.initiated.v2', 'When a refund is initiated.', 9, 0),
(10, 'payment.refund.failed', 'When a refund has not gone through.', 10, 0),
(11, 'payment.refund.completed', 'When a refund has successfully been completed.', 11, 0),
(12, 'payment.cancel.created', 'When a reservation has been canceled.', 12, 0),
(13, 'payment.cancel.failed', 'When a cancellation did not go through.', 13, 0);
-- --------------------------------------------------------
--
-- Struktur-dump for tabellen `tbl_webhooks`
--
CREATE TABLE `tbl_webhooks` (
`fldID` int(255) NOT NULL,
`fldMID` int(10) DEFAULT NULL,
`fldPID` varchar(50) DEFAULT NULL,
`fldDate` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktur-dump for tabellen `tbl_webhook_events`
--
CREATE TABLE `tbl_webhook_events` (
`fldID` int(255) NOT NULL,
`fldHookID` int(255) NOT NULL,
`fldEID` varchar(50) DEFAULT NULL,
`fldEvent` varchar(100) DEFAULT NULL,
`fldData` text,
`fldSort` int(4) NOT NULL DEFAULT '0',
`fldStamp` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Begrænsninger for dumpede tabeller
--
--
-- Indeks for tabel `tbl_events`
--
ALTER TABLE `tbl_events`
ADD PRIMARY KEY (`fldID`);
--
-- Indeks for tabel `tbl_webhooks`
--
ALTER TABLE `tbl_webhooks`
ADD PRIMARY KEY (`fldID`);
--
-- Indeks for tabel `tbl_webhook_events`
--
ALTER TABLE `tbl_webhook_events`
ADD PRIMARY KEY (`fldID`);
--
-- Brug ikke AUTO_INCREMENT for slettede tabeller
--
--
-- Tilføj AUTO_INCREMENT i tabel `tbl_events`
--
ALTER TABLE `tbl_events`
MODIFY `fldID` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- Tilføj AUTO_INCREMENT i tabel `tbl_webhooks`
--
ALTER TABLE `tbl_webhooks`
MODIFY `fldID` int(255) NOT NULL AUTO_INCREMENT;
--
-- Tilføj AUTO_INCREMENT i tabel `tbl_webhook_events`
--
ALTER TABLE `tbl_webhook_events`
MODIFY `fldID` int(255) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<gh_stars>100-1000
SELECT
*
FROM
superverylongtablenamereallyreally1
WHERE
long_varname_to_trigger_Rule_L016_id in (SELECT distinct id FROM superverylongtablenamereallyreally2 WHERE deletedat IS NULL)
|
Create Procedure [dbo].[uspApprenticeshipFrameworkDelete]
@frameworkId int
As
Begin
Delete From ApprenticeshipFramework
Where ApprenticeshipFrameworkId = @frameworkId
End |
<reponame>radrex/SoftuniCourses
USE master
GO
/*--- TASK 1 --------- EMPLOYEE SUMMARY ---------------------------*/
USE SoftUni
SELECT FirstName + ' ' + LastName AS [Full Name]
,JobTitle
,Salary
FROM Employees
/*--- TASK 2 --------- HIGHEST PEAK -------------------------------*/
USE Geography
CREATE VIEW v_HighestPeak AS
SELECT TOP (1) *
FROM Peaks
ORDER BY Elevation DESC
/*--- TASK 3 --------- UPDATE PROJECT -----------------------------*/
USE SoftUni
UPDATE Projects
SET EndDate = '2017-01-23'
WHERE EndDate IS NULL |
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE TABLE "public"."samples"("id" uuid NOT NULL DEFAULT gen_random_uuid(), "url" text NOT NULL, "user_id" uuid NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON UPDATE restrict ON DELETE restrict);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.