text
stringlengths
6
9.38M
--create web IDs for powerschool for all kids who do not have web ids --convention is u: last name, birthday pw: martin birth year --eg u: martin57 pw: martin82 --we use these student usernames and passwords in: --powerschool --accelerated reader --max length username --powerschool: 20 characters total --accelerated reader: XX characters --the clean functions clear out: apostrophes, spaces, periods, commas, the word 'jr' from last names... select student_number ,case when dupe_flag is null then student_web_id when dupe_flag = 1 then alt_student_web_id else null end as student_web_id ,student_web_password ,case when dupe_flag is null then family_web_id when dupe_flag = 1 then alt_family_web_id else null end as family_web_id ,family_web_password ,dupe_flag -- ,dob from (select student_number ,student_web_id ,student_web_password ,family_web_id ,family_web_password ,alt_student_web_id ,alt_family_web_id --a duplicate is defined as someone who has the same web id as the person ABOVE or BELOW them. this logic sets a flag. ,case when (student_web_id = previous OR student_web_id = next) then 1 else null end as dupe_flag ,dob from (select student_number ,student_web_id ,student_web_password ,family_web_id ,family_web_password ,alt_student_web_id ,alt_family_web_id --lag and lead allow us to make in-row comparisons to the previous/next student by last name & DOB. this will determine twin-ness. ,lag(student_web_id,1) over (order by student_web_id) as previous ,lead(student_web_id,1) over (order by student_web_id) as next ,dob from (select student_number --FM is a switch that drops leading or trailing blanks. so abari october 13 comes out as abari 1013 but abari may 7 comes out abari 57 (not 0507). ,case when length(replace(replace(replace(replace(last_name, '''',''),'.',''),' ',''),',','') || to_char(dob,'FMMMDD')) > 12 then lower(substr(replace(replace(replace(replace(last_name, '''',''),'.',''),' ',''),',',''), 1, (12 - length(to_char(dob,'FMMMDD'))))) || to_char(dob,'FMMMDD') || '.student' else lower( replace(replace(replace(replace(last_name, '''',''),'.',''),' ',''),',','') ) || to_char(dob,'FMMMDD') || '.student' end as student_web_id ,lower( replace(replace(replace(replace(last_name, '''',''),'.',''),' ',''),',','') ) || to_char(dob,'YY') as student_web_password ,case when length(replace(replace(replace(replace(last_name, '''',''),'.',''),' ',''),',','') || to_char(dob,'FMMMDD')) > 12 then lower(substr(replace(replace(replace(replace(last_name, '''',''),'.',''),' ',''),',',''), 1, (12 - length(to_char(dob,'FMMMDD'))))) || to_char(dob,'FMMMDD') || '.family' else lower( replace(replace(replace(replace(last_name, '''',''),'.',''),' ',''),',','') ) || to_char(dob,'FMMMDD') || '.family' end as family_web_id ,lower( replace(replace(replace(replace(last_name, '''',''),'.',''),' ',''),',','') ) || to_char(dob,'YY') as family_web_password --alternate web ids that use first name for duplicates ,case when length(replace(replace(replace(replace(first_name, '''',''),'.',''),' ',''),',','') || to_char(dob,'FMMMDD')) > 12 then lower(substr(replace(replace(replace(replace(first_name, '''',''),'.',''),' ',''),',',''), 1, (12 - length(to_char(dob,'FMMMDD'))))) || to_char(dob,'FMMMDD') || '.student' else lower( replace(replace(replace(replace(first_name, '''',''),'.',''),' ',''),',','') ) || to_char(dob,'FMMMDD') || '.student' end as alt_student_web_id ,case when length(replace(replace(replace(replace(first_name, '''',''),'.',''),' ',''),',','') || to_char(dob,'FMMMDD')) > 12 then lower(substr(replace(replace(replace(replace(first_name, '''',''),'.',''),' ',''),',',''), 1, (12 - length(to_char(dob,'FMMMDD'))))) || to_char(dob,'FMMMDD') || '.family' else lower( replace(replace(replace(replace(first_name, '''',''),'.',''),' ',''),',','') ) || to_char(dob,'FMMMDD') || '.family' end as alt_family_web_id ,lastfirst ,first_name ,last_name ,dob from --pre-process all last names to drop the hyphen and only use the first last name. --remove all jrs from last names (select student_number ,replace(lower(case when substr(last_name, 1, instr(last_name,'-',1,1)-1) is null then last_name else substr(last_name, 1, instr(last_name,'-',1,1)-1) end),'jr','') as last_name ,first_name ,lastfirst ,dob from students s where enroll_status <= 0 and web_id is null)))) ;
/* Formatted on 21/07/2014 18:42:16 (QP5 v5.227.12220.39754) */ CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRES_APP_INDICI_COP_TRIM ( VAL_ANNOMESE, VAL_NBV, VAL_GBV, VAL_IND_COP ) AS SELECT val_annomese, val_nbv, val_gbv, 1 - val_nbv / DECODE (val_gbv, 0, 1, val_gbv) val_ind_cop FROM ( SELECT DISTINCT val_annomese, SUM (val_nbv) val_nbv, SUM (val_gbv) val_gbv FROM t_mcres_fen_indici_copertura c, v_mcres_app_lista_trimestri q WHERE q.cod_label_trim = c.val_annomese GROUP BY val_annomese);
CREATE TABLE [SecurityModel].[PrincipalInvoices] ( [PrincipalId] INT NOT NULL, [InvoiceId] INT NOT NULL, CONSTRAINT [PK_PrincipalInvoices] PRIMARY KEY CLUSTERED ([PrincipalId] ASC, [InvoiceId] ASC), CONSTRAINT [FK_PrincipalInvoices_Invoices] FOREIGN KEY ([InvoiceId]) REFERENCES [CoreModel].[Invoices] ([InvoiceId]) ON DELETE CASCADE, CONSTRAINT [FK_PrincipalInvoices_PrincipalInvoices] FOREIGN KEY ([PrincipalId], [InvoiceId]) REFERENCES [SecurityModel].[PrincipalInvoices] ([PrincipalId], [InvoiceId]) );
update metro_entrances set the_geom = ST_SetSRID(ST_MakePoint(lon,lat), 4326) ;
create table TaskVariableImpl ( id number(19,0) not null, modificationDate timestamp, name varchar2(255 char), processId varchar2(255 char), processInstanceId number(19,0), taskId number(19,0), type number(10,0), value varchar2(4000 char), primary key (id) ); create sequence TASK_VAR_ID_SEQ; create table QueryDefinitionStore ( id number(19,0) not null, qExpression clob, qName varchar2(255 char), qSource varchar2(255 char), qTarget varchar2(255 char), primary key (id) ); alter table QueryDefinitionStore add constraint UK_4ry5gt77jvq0orfttsoghta2j unique (qName); create sequence QUERY_DEF_ID_SEQ; create index IDX_VInstLog_pInstId on VariableInstanceLog(processInstanceId); create index IDX_VInstLog_varId on VariableInstanceLog(variableId); create index IDX_VInstLog_pId on VariableInstanceLog(processId); create index IDX_NInstLog_pInstId on NodeInstanceLog(processInstanceId); create index IDX_NInstLog_nodeType on NodeInstanceLog(nodeType); create index IDX_NInstLog_pId on NodeInstanceLog(processId);
create database ale CHARACTER SET utf8 COLLATE utf8_general_ci; create user 'ale-admin'@'%' identified by 'ale2014krakau'; create user 'ale-admin'@'localhost' identified by 'ale2014krakau'; grant all on ale.* to 'ale-admin'@'%'; grant all on ale.* to 'ale-admin'@'localhost'; flush privileges;
DROP TABLE IF EXISTS miasta; CREATE TABLE miasta ( id_miasta INTEGER PRIMARY KEY AUTOINCREMENT, nazwa_miasta TEXT(30), nazwa_wojewodztwa TEXT (35) ); DROP TABLE IF EXISTS mieszkancy; CREATE TABLE mieszkancy ( id_mieszkancy INTEGER PRIMARY KEY AUTOINCREMENT, liczba_mieszkancow INTEGER, liczba_kobiet INTEGER, grupa_wiekowa TEXT(20), data_aktualizacji DATE, id_miasta INTEGER, FOREIGN KEY (id_miasta) REFERENCES miasta(id_miasta) ); DROP TABLE IF EXISTS powierzchnia; CREATE TABLE powierzchnia ( id_powierzchnia INTEGER PRIMARY KEY AUTOINCREMENT, powierzchnia_miasta DECIMAL, powierzchnia_terenow_zielonych INTEGER, data_aktualizacji DATE, id_miasta INTEGER, FOREIGN KEY (id_miasta) REFERENCES miasta(id_miasta) );
CREATE DATABASE IF NOT EXISTS Participants; CREATE USER IF NOT EXISTS participant IDENTIFIED BY 'participant'; GRANT ALL PRIVILEGES ON Participants.* TO participant; USE Participants; CREATE TABLE IF NOT EXISTS participants( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), nom VARCHAR(100), prenom VARCHAR(100), email VARCHAR(100), ok INT, maybe INT, non INT);
REM This script shows top events delta breaked into snapshots - use it between hours or single day REM Usage: @stats_top_event_snaps.sql instance_number date_from date_to REM by Kamil Stawiarski (@ora600pl) set linesize 250 set pagesize 100 alter session set nls_date_format='YYYY-MM-DD:HH24:MI'; set verify off with v_system_class_wait as ( select EVENT, WAIT_CLASS, TIME_WAITED_MICRO-lag(TIME_WAITED_MICRO,1,TIME_WAITED_MICRO) over (partition by event order by sys_ev.SNAP_ID) as waited_micro_diff, sys_ev.snap_id, TIME_WAITED_MICRO from STATS$SYSTEM_EVENT sys_ev, stats$snapshot snap, v$event_name e where sys_ev.snap_id=snap.snap_id and snap.SNAP_TIME between to_date('&&2','YYYY-MM-DD:HH24:MI') and to_date('&&3','YYYY-MM-DD:HH24:MI') and wait_Class not in ('Idle','Other') and sys_ev.instance_number=&&1 and snap.instance_number=&&1 and snap.instance_number=sys_ev.instance_number and sys_ev.event_id=e.event_id ), v_system_rank as ( select snap_id, sum(waited_micro_diff) as sm_waited_micro_diff, dense_rank() over (order by sum(waited_micro_diff) desc) as rnk from v_system_class_wait group by snap_id ) select sr.*, snap2.SNAP_TIME from v_system_rank sr, stats$snapshot snap2 where rnk<=10 and sr.snap_id=snap2.snap_id and snap2.instance_number=&&1 order by rnk /
-- 626. 换座位 -- SQL架构 CREATE TABLE IF NOT EXISTS seat(id INT, student VARCHAR(255)); TRUNCATE TABLE seat; INSERT INTO seat (id, student) VALUES ('1', 'Abbot'); INSERT INTO seat (id, student) VALUES ('2', 'Doris'); INSERT INTO seat (id, student) VALUES ('3', 'Emerson'); INSERT INTO seat (id, student) VALUES ('4', 'Green'); INSERT INTO seat (id, student) VALUES ('5', 'Jeames'); -- 有一张 seat 座位表, -- 平时用来储存学生名字和与他们相对应的座位 id -- 其中纵列的 id 是连续递增的 -- 改变相邻俩学生的座位。 -- 将偶数id-1调整为奇数id SELECT s1.id - 1 AS id, s1.student FROM seat s1 WHERE s1.id MOD 2 = 0 UNION -- 将奇数id + 1调整为偶数id -- 最后一个id除外 SELECT s2.id + 1 AS id, s2.student FROM seat s2 WHERE s2.id MOD 2 = 1 AND s2.id != ( SELECT MAX( s3.id ) FROM seat s3 ) UNION -- 添加最后一名奇数同学 -- 将全部同学id升序排列 SELECT s4.id AS id, s4.student FROM seat s4 WHERE s4.id MOD 2 = 1 AND s4.id = ( SELECT MAX( s5.id ) FROM seat s5 ) ORDER BY id;
drop if procedure exists AddVotingSession; delimiter $$; create procedure AddVotingSession( in intSchoolYearId int, in intUserId int, out itExists int ) begin select count(votingSessionId) into itExists from votingSessions where schoolYearId = intSchoolYearId and statId = 1; if(itExists = 0) then insert into votingSessions( schoolYearId, active, statId, createdById, createdOn ) value( intSchoolYearId, 1, 1, intUserId, now() ); end if; end;
PRAGMA user_version = 1; CREATE TABLE Calendars ( _id INTEGER PRIMARY KEY, account_name TEXT, account_type TEXT, name TEXT, calendar_displayName TEXT, calendar_color INTEGER, calendar_color_index TEXT, visible INTEGER NOT NULL DEFAULT 1, calendar_timezone TEXT, maxReminders INTEGER DEFAULT 5, ); CREATE TABLE Events ( _id INTEGER PRIMARY KEY AUTOINCREMENT, calendar_id INTEGER NOT NULL, title TEXT, eventLocation TEXT, description TEXT, eventStatus INTEGER, dtstart INTEGER, dtend INTEGER, eventTimezone TEXT, duration TEXT, allDay INTEGER NOT NULL DEFAULT 0, accessLevel INTEGER NOT NULL DEFAULT 0, availability INTEGER NOT NULL DEFAULT 0, hasAlarm INTEGER NOT NULL DEFAULT 0, rrule TEXT, rdate TEXT, lastDate INTEGER, hasAttendeeData INTEGER NOT NULL DEFAULT 0, organizer STRING, eventEndTimezone TEXT, ); CREATE TABLE Instances ( _id INTEGER PRIMARY KEY, event_id INTEGER, begin INTEGER, end INTEGER, startDay INTEGER, endDay INTEGER, startMinute INTEGER, endMinute INTEGER, UNIQUE (event_id, begin, end)); CREATE TABLE Attendees ( _id INTEGER PRIMARY KEY, event_id INTEGER, attendeeName TEXT, attendeeEmail TEXT, attendeeStatus INTEGER, attendeeRelationship INTEGER, attendeeType INTEGER, attendeeIdentity TEXT, attendeeIdNamespace TEXT); CREATE TABLE Reminders ( _id INTEGER PRIMARY KEY, event_id INTEGER, minutes INTEGER, method INTEGER NOT NULL DEFAULT 0); CREATE TRIGGER calendar_cleanup DELETE ON Calendars BEGIN DELETE FROM Events WHERE calendar_id=old._id; END; CREATE INDEX eventsCalendarIdIndex ON Events (calendar_id); CREATE INDEX instancesStartDayIndex ON Instances (startDay); CREATE INDEX attendeesEventIdIndex ON Attendees (event_id); CREATE INDEX remindersEventIdIndex ON Reminders (event_id); -- CREATE INDEX calendarAlertsEventIdIndex ON CalendarAlerts (event_id); CREATE VIEW view_events AS SELECT Events._id AS _id, title, description, eventLocation, eventStatus, dtstart, dtend, duration, eventTimezone, eventEndTimezone, allDay, accessLevel, availability, hasAlarm, rrule, rdate, hasAttendeeData, calendar_id, organizer, Calendars.account_name AS account_name, Calendars.account_type AS account_type, calendar_timezone, calendar_displayName, visible, calendar_color, calendar_color_index, maxReminders, FROM Events JOIN Calendars ON (Events.calendar_id=Calendars._id) CREATE TRIGGER events_cleanup_delete DELETE ON Events BEGIN DELETE FROM Instances WHERE event_id=old._id; DELETE FROM Attendees WHERE event_id=old._id; DELETE FROM Reminders WHERE event_id=old._id; END; -- CREATE TRIGGER event_color_update -- UPDATE OF eventColor_index ON Events -- WHEN new.eventColor_index NOT NULL BEGIN -- UPDATE Events SET eventColor=( -- SELECT color FROM Colors WHERE account_name=( -- SELECT account_name FROM Calendars WHERE _id=new.calendar_id) -- AND account_type=( -- SELECT account_type FROM Calendars WHERE _id=new.calendar_id) -- AND color_index=new.eventColor_index AND color_type=1) -- WHERE _id=old._id; -- END; CREATE TRIGGER calendar_color_update UPDATE OF calendar_color_index ON Calendars WHEN new.calendar_color_index NOT NULL BEGIN UPDATE Calendars SET calendar_color=( SELECT color FROM Colors WHERE account_name=new.account_name AND account_type=new.account_type AND color_index=new.calendar_color_index AND color_type=0) WHERE _id=old._id; END;
 CREATE PROC [ERP].[Usp_Sel_Report_CotizacionDetalle_By_ID] --2 @IdCotizacion INT AS BEGIN SELECT CD.Cantidad, UM.Nombre UnidadMedidad, CD.Nombre NombreProducto, P.CodigoReferencia, CD.PorcentajeDescuento, CD.PrecioUnitarioLista PrecioLista, CD.PrecioDescuento, CD.PrecioSubTotal PrecioSubTotal, CD.PrecioTotal PrecioTotal, CAST(0 AS BIT) FlagDescuento, (SELECT [ERP].[ObtenerValorParametroByAbreviaturaFecha](C.IdEmpresa, 'VPU2', C.Fecha)) AS FlagPrecio2Decimal FROM ERP.CotizacionDetalle CD INNER JOIN ERP.Cotizacion C ON C.ID = CD.IdCotizacion INNER JOIN ERP.Producto P ON P.ID = CD.IdProducto LEFT JOIN PLE.T6UnidadMedida UM ON UM.ID = P.IdUnidadMedida WHERE CD.IdCotizacion = @IdCotizacion END
-- phpMyAdmin SQL Dump -- version 4.1.14 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Oct 12, 2015 at 11:11 AM -- Server version: 5.6.17 -- PHP Version: 5.5.12 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: `cai` -- -- -------------------------------------------------------- -- -- Table structure for table `account` -- CREATE TABLE IF NOT EXISTS `account` ( `account_id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(11) NOT NULL, `role_id` int(11) NOT NULL, `username` varchar(20) COLLATE latin1_general_cs NOT NULL, `password` varchar(20) COLLATE latin1_general_cs NOT NULL, `active` int(1) NOT NULL DEFAULT '1', PRIMARY KEY (`account_id`), UNIQUE KEY `PROFILEID` (`profile_id`), UNIQUE KEY `USERNAME` (`username`), KEY `USERS_USERGROUPID_idx` (`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=7 ; -- -- Dumping data for table `account` -- INSERT INTO `account` (`account_id`, `profile_id`, `role_id`, `username`, `password`, `active`) VALUES (1, 1, 1, 'admin', 'admin', 1), (2, 2, 2, 'jervz', 'jervz', 1), (3, 3, 3, 'student', 'student', 1), (4, 5, 2, 'tonylazona', 'lazona', 1), (5, 6, 3, 'joanmariano', 'joanmariano', 1), (6, 7, 2, 'adrianagustin', 'a', 1); -- -------------------------------------------------------- -- -- Table structure for table `game_obj_tbl` -- CREATE TABLE IF NOT EXISTS `game_obj_tbl` ( `user_id` varchar(30) COLLATE latin1_general_cs NOT NULL, `char_id` varchar(20) COLLATE latin1_general_cs NOT NULL, `player_name` varchar(30) COLLATE latin1_general_cs NOT NULL, `player_lvl` int(3) NOT NULL, `game_lvl` int(2) NOT NULL, `unit_id` int(2) NOT NULL, `unit_stat` int(2) NOT NULL, `potion_cnt` int(5) NOT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs; -- -- Dumping data for table `game_obj_tbl` -- INSERT INTO `game_obj_tbl` (`user_id`, `char_id`, `player_name`, `player_lvl`, `game_lvl`, `unit_id`, `unit_stat`, `potion_cnt`) VALUES ('pantera', 'char_1F', 'asdasd', 0, 0, 1, 0, 10), ('user', 'char_3M', 'User', 0, 0, 1, 0, 10), ('user1', 'char_3M', 'sunny', 0, 0, 0, 0, 10); -- -------------------------------------------------------- -- -- Table structure for table `lesson` -- CREATE TABLE IF NOT EXISTS `lesson` ( `unit_id` int(2) NOT NULL, `lesson_id` int(100) NOT NULL AUTO_INCREMENT, `lesson` varchar(100) COLLATE latin1_general_cs NOT NULL, `answer` varchar(100) COLLATE latin1_general_cs NOT NULL, `lesson_stat_id` int(2) NOT NULL, PRIMARY KEY (`lesson_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=12 ; -- -- Dumping data for table `lesson` -- INSERT INTO `lesson` (`unit_id`, `lesson_id`, `lesson`, `answer`, `lesson_stat_id`) VALUES (1, 1, 'm', 'asdfsadf', 1), (2, 2, 'uawdgfuyasdgyu', 'jhfh', 0), (1, 3, 'pangit si marj', 'nope', 0), (1, 4, 'agdhdhsbd', 'hashshua', 0), (4, 5, 'sino ang bayani ng pilipinas', 'Jose Rizal', 1), (5, 6, 'Panget ba si margie', 'yes', 0), (1, 7, 'Pambang prutas', 'mangga', 0), (8, 8, 'GGGGG', 'NNNN', 0), (8, 9, 'JASDH', 'DH', 0), (10, 11, 'asdfsafa', 'adsfdasf1212', 0); -- -------------------------------------------------------- -- -- Table structure for table `profile` -- CREATE TABLE IF NOT EXISTS `profile` ( `profile_id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(20) COLLATE latin1_general_cs NOT NULL, `middle_name` varchar(20) COLLATE latin1_general_cs NOT NULL, `last_name` varchar(20) COLLATE latin1_general_cs NOT NULL, `birth_date` date NOT NULL, `gender` varchar(10) COLLATE latin1_general_cs NOT NULL, `address` varchar(50) COLLATE latin1_general_cs NOT NULL, `contact_no` varchar(20) COLLATE latin1_general_cs NOT NULL, `email` varchar(50) COLLATE latin1_general_cs NOT NULL, PRIMARY KEY (`profile_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=8 ; -- -- Dumping data for table `profile` -- INSERT INTO `profile` (`profile_id`, `first_name`, `middle_name`, `last_name`, `birth_date`, `gender`, `address`, `contact_no`, `email`) VALUES (1, 'admin', 'admin', 'admin', '1992-01-30', 'Male', 'Bulacan City', '09271378298', 'tiraomargie@yahoo.com.ph'), (2, 'Jervy', 'C', 'Calara', '2015-10-14', 'Male', 'Makati City', '09476441262', 'jervycalara@makati.sti.edu'), (3, 'Mark', 'Fortes', 'Tagalag', '1992-01-13', 'Male', 'Bulacan', '7525356', 'marktagalag@yahoo.com'), (4, 'Mark', 'Fortes', 'Tagalag', '1992-01-13', 'Male', 'Bulacan', '7525356', 'marktagalag@yahoo.com'), (5, ' Tony', ' M', ' Lazona', '0000-00-00', 'Male', 'Makati City', '09476441262', 'tony@yahoo.com'), (6, 'Joan', 'M', 'Mariano', '1990-09-11', 'Female', 'Tarlac City', '8888-222', 'joan@yahoo.com'), (7, 'Adrian', 'A', 'Agustin', '0000-00-00', 'Male', 'Makati City', '0929339020', 'adrianagustin@yahoo.com'); -- -------------------------------------------------------- -- -- Table structure for table `role` -- CREATE TABLE IF NOT EXISTS `role` ( `role_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE latin1_general_cs NOT NULL, PRIMARY KEY (`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=4 ; -- -- Dumping data for table `role` -- INSERT INTO `role` (`role_id`, `name`) VALUES (1, 'Administrator'), (2, 'Teacher'), (3, 'Student'); -- -------------------------------------------------------- -- -- Table structure for table `section` -- CREATE TABLE IF NOT EXISTS `section` ( `section_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE latin1_general_cs NOT NULL, `access_code` varchar(8) COLLATE latin1_general_cs NOT NULL, `teacher_id` int(11) NOT NULL, PRIMARY KEY (`section_id`), UNIQUE KEY `access_code` (`access_code`), UNIQUE KEY `access_code_2` (`access_code`), UNIQUE KEY `name` (`name`), UNIQUE KEY `name_2` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=8 ; -- -- Dumping data for table `section` -- INSERT INTO `section` (`section_id`, `name`, `access_code`, `teacher_id`) VALUES (1, '6A', '12345', 1), (3, '6B', '6789', 1), (4, '6C', '9999', 2), (5, 'qweqwe', '0tpam7vi', 1), (7, '6D', '4wc4ygb9', 1); -- -------------------------------------------------------- -- -- Table structure for table `student` -- CREATE TABLE IF NOT EXISTS `student` ( `student_id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(11) NOT NULL, `section_id` int(11) NOT NULL, PRIMARY KEY (`student_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=3 ; -- -- Dumping data for table `student` -- INSERT INTO `student` (`student_id`, `profile_id`, `section_id`) VALUES (1, 3, 1), (2, 6, 1); -- -------------------------------------------------------- -- -- Table structure for table `teacher` -- CREATE TABLE IF NOT EXISTS `teacher` ( `teacher_id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(11) NOT NULL, PRIMARY KEY (`teacher_id`), UNIQUE KEY `teacher_id_2` (`teacher_id`), UNIQUE KEY `teacher_id_3` (`teacher_id`), UNIQUE KEY `profile_id` (`profile_id`), KEY `teacher_id` (`teacher_id`), KEY `profile_id_2` (`profile_id`), KEY `profile_id_3` (`profile_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=4 ; -- -- Dumping data for table `teacher` -- INSERT INTO `teacher` (`teacher_id`, `profile_id`) VALUES (1, 2), (2, 5), (3, 7); -- -------------------------------------------------------- -- -- Table structure for table `unit` -- CREATE TABLE IF NOT EXISTS `unit` ( `unit_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE latin1_general_cs NOT NULL, PRIMARY KEY (`unit_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=11 ; -- -- Dumping data for table `unit` -- INSERT INTO `unit` (`unit_id`, `name`) VALUES (1, 'Unit 1'), (2, 'Unit 2'), (3, 'Unit 3'), (4, 'Unit 4'), (5, 'Unit 5'), (6, 'Unit 6'), (7, 'unit6'), (8, 'unit6'), (9, 'UNIT 7'), (10, 'HLKASFJ'); /*!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 */;
---Exercises:使用和實作 INSERT + SELECT 練習 ---試寫出 INSERT + SELECT,根據 2007 年 10 月份訂單的訂單編號清單,找出這些銷售人員的相關資料,並完成下列需求: ----假設己經有一個預先建立好的資料表 Sales.OrderEmp_200710 (執行下列 T-SQL 來完成),它是用來儲存銷售人員的相關資料 CREATE TABLE Sales.OrderEmp_200710 ( EmpID tinyint, LastName nvarchar(20), SalesAmount money ); -----根據 2007 年 10 月份訂單(如下),找出下列訂單編號的銷售人員,新增到資料表 Sales.OrderEmp_200710 --10689 --10692 --10721 --10723 --資料行 SalesAmount 需存入 unitprice * qty 的統計結果 ---ANSWER: insert into Sales.OrderEmp_200710 select o.empid, e.lastname, od.SubTotal from sales.orders o join sales.OrderDetails od on od.orderid = o.orderid join hr.Employees e on e.empid = o.empid where o.orderid in (10689, 10692, 10721, 10723)
%define STATE_COMPILE 1 %define STATE_INTERPRET 0 section .rodata msg: .no_such_word: db "Word not found: ", 0 section .bss word_buf: resq 512 user_dict: resq 65536 section .data here: dq user_dict fd: dq 0 const "forth-here", here const "forth-last-word", last_word const "forth-is-compiling", state const "forth-input-fd", fd const "forth-stack-start", stack_start colon "bye", bye dq xt_lit, 60 TIMES 6 dq xt_lit, 0 dq xt_syscall %define sys_read_no 0 %define sys_write_no 1 colon "sys-read", sys_read TIMES 3 dq xt_to_r dq xt_lit, sys_read_no TIMES 3 dq xt_from_r TIMES 3 dq xt_lit, 0 dq xt_syscall , xt_drop, xt_exit colon "sys-write", sys_write TIMES 3 dq xt_to_r dq xt_lit, sys_write_no TIMES 3 dq xt_from_r TIMES 3 dq xt_lit, 0 dq xt_syscall , xt_drop, xt_exit colon "stack-cell", stack_cell dq xt_lit, 0, xt_sp, xt_exit ; ( fd - char 1) or ( - 0 ) colon "file-read-char", file_read_char dq xt_to_r, xt_stack_cell, xt_from_r, xt_swap, xt_lit, 1, xt_sys_read branch0 .fail dq xt_lit, 1 .fail : dq xt_exit ; ( fd char - ) colon "file-write-char", file_write_char dq xt_swap, xt_to_r, xt_to_r dq xt_stack_cell, xt_dup, xt_from_r, xt_swap, xt_write_char dq xt_from_r, xt_swap, xt_lit, 1, xt_sys_write, xt_drop, xt_drop, xt_exit colon "string-length", string_length dq xt_dup .loop: dq xt_dup, xt_fetch_char branch0 .exit dq xt_inc branch .loop .exit: dq xt_swap, xt_minus, xt_exit colon "print-cr", print_cr dq xt_lit, 1, xt_lit, 10, xt_file_write_char, xt_exit ; ( str count - ) colon "print-string-counted", print_string_counted dq xt_to_r, xt_to_r, xt_lit, 1, xt_from_r, xt_from_r, xt_sys_write, xt_drop, xt_exit ; ( str -- ) colon "print-string", print_string dq xt_dup, xt_string_length, xt_print_string_counted, xt_exit colon "char-is-space", char_is_space dq xt_to_r dq xt_r_fetch, xt_lit, ' ', xt_equals dq xt_r_fetch, xt_lit, 10, xt_equals, xt_lor dq xt_r_fetch, xt_lit, 13, xt_equals, xt_lor dq xt_from_r, xt_lit, '\t', xt_equals, xt_lor, xt_exit ; ( addr - ) colon "string-terminate", string_terminate dq xt_lit, 0, xt_swap, xt_write_char, xt_exit ; ( fd buffer - ) colon "file-read-word", file_read_word dq xt_dup, xt_to_r, xt_to_r .read_space: dq xt_dup, xt_file_read_char branch0 .eof dq xt_dup, xt_char_is_space branch0 .commit dq xt_drop branch .read_space .read: dq xt_dup, xt_file_read_char branch0 .eof dq xt_dup, xt_char_is_space, xt_not branch0 .end .commit: dq xt_r_fetch, xt_write_char dq xt_from_r, xt_inc, xt_to_r branch .read .end: dq xt_drop .eof: dq xt_drop, xt_r_fetch, xt_string_terminate dq xt_from_r, xt_from_r, xt_minus, xt_exit colon ",", comma dq xt_here, xt_fetch, xt_write dq xt_here, xt_fetch, xt_lit, 8, xt_plus dq xt_here, xt_write, xt_exit colon "c,", char_comma dq xt_here, xt_fetch, xt_write_char dq xt_here, xt_fetch, xt_inc dq xt_here, xt_write, xt_exit colon "2dup", ddup dq xt_to_r, xt_dup, xt_r_fetch, xt_swap, xt_from_r, xt_exit colon "2inc", dinc dq xt_to_r, xt_inc, xt_from_r, xt_inc, xt_exit colon "string-equals", string_equals .start: dq xt_ddup, xt_fetch_char, xt_swap, xt_fetch_char, xt_equals branch0 .no dq xt_dup, xt_fetch_char branch0 .yes dq xt_dinc branch .start .yes: dq xt_drop, xt_drop, xt_lit, 1, xt_exit .no: dq xt_drop, xt_drop, xt_lit, 0, xt_exit colon "forth-dict-word-name", forth_dict_word_name dq xt_lit, 9, xt_plus, xt_exit colon "forth-find-word", forth_find_word dq xt_to_r, xt_last_word, xt_fetch dq xt_state, xt_fetch branch0 .loop dq xt_fetch .loop: dq xt_dup branch0 .not_found dq xt_dup, xt_forth_dict_word_name, xt_r_fetch, xt_string_equals, xt_not branch0 .found dq xt_fetch branch .loop .found: dq xt_lit, 1 .not_found: dq xt_from_r, xt_drop, xt_exit colon "'", forth_tick, 1 dq xt_fd, xt_fetch, xt_lit, word_buf, xt_file_read_word branch0 .eof dq xt_lit, word_buf, xt_forth_find_word branch0 .no_word dq xt_forth_cfa, xt_state branch0 .interp dq xt_lit, xt_lit, xt_comma, xt_comma .interp: dq xt_exit .no_word: dq xt_lit, msg.no_such_word, xt_print_string, xt_print_string, xt_print_cr, xt_exit .eof: dq xt_drop, xt_exit colon "forth-cfa", forth_cfa dq xt_lit, 9, xt_plus dq xt_dup, xt_string_length, xt_plus dq xt_lit, 2, xt_plus, xt_exit ; ( dest source - ) colon "string-copy", string_copy .loop: dq xt_ddup, xt_fetch_char, xt_to_r, xt_r_fetch, xt_swap, xt_write_char dq xt_dinc, xt_from_r, xt_not branch0 .loop dq xt_drop, xt_drop, xt_exit ; ( flags name - ) colon "forth-create", forth_create dq xt_here, xt_fetch ; word start dq xt_last_word, xt_fetch, xt_comma ; fill `link` dq xt_last_word, xt_write ; update `last_word` dq xt_lit, 0, xt_char_comma dq xt_dup, xt_here, xt_fetch, xt_swap, xt_string_copy dq xt_string_length, xt_here, xt_fetch, xt_plus, xt_inc, xt_here, xt_write dq xt_char_comma dq xt_exit colon ":", colon .restart: dq xt_fd, xt_fetch, xt_lit, word_buf, xt_file_read_word branch0 .restart dq xt_lit, 0, xt_lit, word_buf, xt_forth_create dq xt_lit, STATE_COMPILE, xt_state, xt_write dq xt_lit, i_docol, xt_comma, xt_exit colon ";", semicolon, 1 dq xt_lit, STATE_INTERPRET, xt_state, xt_write dq xt_lit, xt_exit, xt_comma, xt_exit colon "char-is-digit", char_is_digit dq xt_to_r dq xt_r_fetch, xt_lit, '9'+1, xt_lt dq xt_lit, '0'-1, xt_r_fetch, xt_lt, xt_land dq xt_from_r, xt_drop, xt_exit colon "drop0", drop0 dq xt_dup branch0 .is_zero dq xt_exit .is_zero: dq xt_drop, xt_exit colon "char-to-digit", char_to_digit dq xt_lit, '0', xt_minus, xt_exit ; ( buf -- num? len ) colon "string-parse-unsigned-number", string_parse_unsigned_number dq xt_dup, xt_to_r dq xt_lit, 0, xt_to_r .loop: dq xt_dup, xt_fetch_char, xt_dup, xt_char_is_digit branch0 .end dq xt_char_to_digit dq xt_lit, 10, xt_from_r, xt_mul, xt_plus, xt_to_r dq xt_inc branch .loop .end: dq xt_drop, xt_from_r, xt_swap, xt_from_r, xt_minus, xt_drop0, xt_exit colon "neg", neg dq xt_lit, 0, xt_swap, xt_minus, xt_exit colon "inc", inc dq xt_lit, 1, xt_plus, xt_exit ; ( buf -- num? len ) colon "string-parse-number", string_parse_number dq xt_dup, xt_fetch_char, xt_dup, xt_char_is_digit, xt_not branch0 .unsigned dq xt_dup, xt_lit, '-', xt_equals, xt_not branch0 .negative dq xt_dup, xt_lit, '+', xt_equals, xt_not branch0 .positive .negative: dq xt_drop dq xt_inc, xt_string_parse_unsigned_number dq xt_dup branch0 .error dq xt_inc dq xt_swap, xt_neg, xt_swap, xt_exit .positive: dq xt_drop dq xt_inc, xt_string_parse_unsigned_number dq xt_dup branch0 .error dq xt_inc, xt_exit .unsigned: dq xt_drop, xt_string_parse_unsigned_number, xt_exit .error: dq xt_drop, xt_lit, 0, xt_exit colon "forth-follows-branch", forth_follows_branch dq xt_here, xt_fetch, xt_lit, 8, xt_minus, xt_fetch dq xt_dup, xt_lit, xt_branch0, xt_equals, xt_swap dq xt_lit, xt_branch, xt_equals, xt_lor, xt_exit ; ( fd -- ) colon "forth-interpret-fd", forth_interpret_fd dq xt_lit, xt_fd, xt_fetch, xt_to_r dq xt_fd, xt_write .loop: dq xt_fd, xt_fetch, xt_lit, word_buf, xt_file_read_word branch0 .eof dq xt_lit, word_buf, xt_forth_interpret branch .loop .eof: dq xt_from_r, xt_fd, xt_write, xt_exit colon "forth-xt-is-immediate", forth_xt_is_immediate dq xt_lit, 1, xt_minus, xt_fetch_char, xt_exit ; ( str - ) colon "forth-interpret", forth_interpret .start: ; ( inbuf ) dq xt_dup, xt_forth_find_word ; find in dict branch0 .number ; ( inbuf dictaddr? 0/1 ) dq xt_swap, xt_drop, xt_forth_cfa ; ( xt ) ; if not compiling dq xt_state, xt_fetch branch0 .interpreting dq xt_dup, xt_forth_xt_is_immediate, xt_not branch0 .interpreting .compiling: dq xt_comma, xt_exit .interpreting: dq xt_execute, xt_exit .number: ; ( inbuf ) dq xt_dup, xt_string_parse_number ; ( inbuf num? 0/len ) branch0 .no_word ; ( inbuf num ) dq xt_swap, xt_drop dq xt_state, xt_fetch ; if interpreting, that's it branch0 .exit dq xt_forth_follows_branch, xt_not branch0 .is_branch .not_branch: dq xt_lit, xt_lit, xt_comma .is_branch: ; ( num prev_xt ) dq xt_comma, xt_exit .no_word: ; ( inbuf ) dq xt_lit, msg.no_such_word, xt_print_string, xt_print_string, xt_print_cr .exit: dq xt_exit native "forth-stack-restore", forth_stack_restore mov rsp, [stack_start] jmp next colon "trap", trap dq xt_lit, wh_trap + 9, xt_print_string, xt_print_cr, xt_exit forth_init: dq xt_lit, 0, xt_forth_interpret_fd, xt_bye
/* Joins */ SELECT * FROM actor, film_text; /* Consultar informacion de dos tablas */ SELECT COUNT(actor.actor_id) FROM actor, film_actor; SELECT city_id, city, country FROM city INNER JOIN country ON city.country_id=country.country_id; SELECT city_id, city, country FROM city, country WHERE city.country_id = country.country_id;
/***初始化如下***/ /***创建表结构***/ create table student(uid bigint auto_increment, uname varchar(50), upassword varchar(30),ulevel int(11),unumber varchar(30)); create table STUDENTGRADE(sid bigint auto_increment,uid bigint,sgrade int(11),stotal int(11)); create table QUESTION(qid bigint auto_increment, qcontent varchar(255),qtopics varchar(100),qdifficulty int(11),qtype int(11)); create table MCQChoice(mid bigint auto_increment, mchoice varchar(100),mvalid boolean,qid bigint); create table OpenQuestion(oqid bigint auto_increment,oqtext varchar(4000),qid bigint); create table ANSWER(aid bigint auto_increment,qid bigint,atext varchar(255)); create table QUIZ(id bigint auto_increment, name varchar(255)); /***初始化测试用户登录数据 1:管理员 2:普通用户***/ insert into student (uname,upassword,ulevel) values ('admin','123',1); insert into student (uname,upassword,ulevel,unumber) values ('front','123',2,141785); /*** 后端手动造数据 使用命令将sql下面的txt后缀的文件导入数据库 CREATE TABLE MYTABLE AS SELECT * FROM CSVREAD('D:/H2/dbbak/20141013.csv'); 前端试卷试题 按照试卷标题 先从数据库里面读取多项选择题或者开放试题按照题目复杂度规则生成试卷,试卷题目保存到文件中,然后做题时从文件中读取使用。
insert into tbl_clob_sql_script ( user_name, script_file ) values ( SYS_CONTEXT ('USERENV', 'SESSION_USER') , 'select CUSTOMER_ADDRESS_ID, CUSTOMER_ID, REGION_ID, STREET,CITY,POSTAL_CODE, CREATEDON from TBL_CUSTOMER_ADDRESS where POSTAL_CODE = <dupa>' ); commit;
PROMPT Создание таблицы ejournal CREATE TABLE ejournal ( ej_id INTEGER, ej_empl INTEGER NOT NULL, ej_timestamp TIMESTAMP NOT NULL, ej_author_id INTEGER NOT NULL, ej_text VARCHAR2(500) NOT NULL ); PROMPT Создание таблицы employee CREATE TABLE employee ( emp_id INTEGER, emp_role INTEGER NOT NULL, emp_name VARCHAR2(50) NOT NULL, emp_surname VARCHAR2(50) NOT NULL, emp_email VARCHAR2(100) NOT NULL, emp_phone VARCHAR2(50) NOT NULL, emp_salary INTEGER NOT NULL, emp_login VARCHAR2(50) NOT NULL, emp_password VARCHAR2(50) NOT NULL ); PROMPT Создание таблицы unit CREATE TABLE unit ( u_id INTEGER, u_serial INTEGER NOT NULL, u_asmy_mng_id INTEGER NOT NULL, u_asmy_work_id INTEGER, u_asmy_cont_id INTEGER, u_asmy_disc_id INTEGER, u_state INTEGER, u_ord_time TIMESTAMP NOT NULL, u_asm_time TIMESTAMP, u_ctrl_time TIMESTAMP, u_disc_time TIMESTAMP ); PROMPT Создание таблицы manlog CREATE TABLE manlog ( ml_id INTEGER, ml_unit_id INTEGER, ml_text VARCHAR2(200), ml_time TIMESTAMP );
--These records are stored in the database to test the Quora Application --Insert values in USERS table INSERT INTO users(id, uuid, firstname, lastname, username, email, password, salt, country, aboutme, dob, role, contactnumber) VALUES (1025, 'database_uuid', 'database_firstname', 'database_lastname', 'database_username', 'database_email', 'database_password', 'database_salt', 'database_country', 'database_aboutme', 'database_dob', 'admin', 'database_contactnumber'); INSERT INTO users(id, uuid, firstname, lastname, username, email, password, salt, country, aboutme, dob, role, contactnumber) VALUES (1026, 'database_uuid1', 'database_firstname1', 'database_lastname1', 'database_username1', 'database_email1', 'database_password1', 'database_salt1', 'database_country1', 'database_aboutme1', 'database_dob1', 'nonadmin', 'database_contactnumber1'); INSERT INTO users(id, uuid, firstname, lastname, username, email, password, salt, country, aboutme, dob, role, contactnumber) VALUES (1027, 'database_uuid2', 'database_firstname2', 'database_lastname2', 'database_username2', 'database_email2', 'database_password2', 'database_salt2', 'database_country2', 'database_aboutme2', 'database_dob2', 'nonadmin', 'database_contactnumber2'); INSERT INTO users(id, uuid, firstname, lastname, username, email, password, salt, country, aboutme, dob, role, contactnumber) VALUES (1028, 'database_uuid3', 'database_firstname3', 'database_lastname3', 'database_username3', 'database_email3', 'database_password3', 'database_salt3', 'database_country3', 'database_aboutme3', 'database_dob3', 'nonadmin', 'database_contactnumber3'); INSERT INTO users(id, uuid, firstname, lastname, username, email, password, salt, country, aboutme, dob, role, contactnumber) VALUES (1029, 'database_uuid4', 'database_firstname4', 'database_lastname4', 'database_username4', 'database_email4', 'database_password4', 'database_salt4', 'database_country4', 'database_aboutme4', 'database_dob4', 'nonadmin', 'database_contactnumber4'); --Insert values in USER_AUTH table insert into user_auth (id, uuid, user_id, access_token, expires_at, login_at, logout_at) values (1024, 'database_uuid', 1025, 'database_accesstoken', '2018-09-17 21:07:02.07', '2018-09-17 13:07:02.07', null); insert into user_auth (id, uuid, user_id, access_token, expires_at, login_at, logout_at) values (1025, 'database_uuid1', 1026, 'database_accesstoken1', '2018-09-17 21:07:02.07', '2018-09-17 13:07:02.07', null); insert into user_auth (id, uuid, user_id, access_token, expires_at, login_at, logout_at) values (1026, 'database_uuid2', 1027, 'database_accesstoken2', '2018-09-17 21:07:02.07', '2018-09-17 13:07:02.07', null); insert into user_auth (id, uuid, user_id, access_token, expires_at, login_at, logout_at) values (1027, 'database_uuid3', 1028, 'database_accesstoken3', '2018-09-17 21:07:02.07', '2018-09-17 13:07:02.07', '2018-09-17 15:07:02.07'); --Insert values in QUESTION table insert into question (id, uuid, content, date, user_id) values (1024, 'database_question_uuid', 'database_question_content', '2018-09-17 19:41:19.593', 1026); --Insert values in ANSWER table insert into answer(id, uuid, ans, date, user_id, question_id) values (1024, 'database_answer_uuid', 'my_answer', '2018-09-17 19:41:19.593', 1026, 1024);
-- 2. Aggregate with a drop and recompute logic DROP TABLE IF EXISTS {{.scratch_schema}}.page_views_join_staged{{.entropy}}; CREATE TABLE {{.scratch_schema}}.page_views_join_staged{{.entropy}} AS( -- using events_staged for other event type WITH link_clicks AS ( SELECT ev.page_view_id, COUNT(ev.event_id) OVER(PARTITION BY ev.page_view_id ORDER BY ev.derived_tstamp desc ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS link_clicks, FIRST_VALUE(lc.target_url) OVER(PARTITION BY ev.page_view_id ORDER BY ev.derived_tstamp desc ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS first_link_target FROM {{.input_schema}}.com_snowplowanalytics_snowplow_link_click_1 lc INNER JOIN {{.scratch_schema}}.events_staged{{.entropy}} ev ON lc.root_id = ev.event_id AND lc.root_tstamp = ev.collector_tstamp WHERE lc.root_tstamp >= (SELECT lower_limit FROM {{.scratch_schema}}.base_run_limits{{.entropy}}) AND lc.root_tstamp <= (SELECT upper_limit FROM {{.scratch_schema}}.base_run_limits{{.entropy}}) ), -- using page_views_staged so needs to run after page views engagement AS ( SELECT page_view_id, CASE WHEN engaged_time_in_s = 0 THEN TRUE ELSE FALSE END AS bounced_page_view, (vertical_percentage_scrolled / 100) * 0.3 + (engaged_time_in_s / 600) * 0.7 AS engagement_score FROM {{.scratch_schema}}.page_views_staged{{.entropy}} ) SELECT ev.page_view_id, link_clicks, first_link_target, bounced_page_view, engagement_score, CASE WHEN ev.refr_medium = 'search' AND (lower(ev.mkt_medium) SIMILAR TO '%(cpc|ppc|sem|paidsearch)%' OR lower(ev.mkt_source) SIMILAR TO '%(cpc|ppc|sem|paidsearch)%') THEN 'paidsearch' WHEN lower(ev.mkt_medium) ILIKE '%paidsearch%' OR lower(ev.mkt_source) ILIKE '%paidsearch%' THEN 'paidsearch' WHEN lower(ev.mkt_source) SIMILAR TO '%(adwords|google_paid|googleads)%' OR lower(ev.mkt_medium) SIMILAR TO '%(adwords|google_paid|googleads)%' THEN 'paidsearch' WHEN ev.mkt_source ILIKE '%google%' AND ev.mkt_medium ILIKE '%ads%' THEN 'paidsearch' WHEN ev.refr_urlhost in ('www.googleadservices.com','googleads.g.doubleclick.net') then 'paidsearch' WHEN lower(ev.mkt_medium) SIMILAR TO '%(cpv|cpa|cpp|content-text|advertising|ads)%' THEN 'advertising' WHEN lower(ev.mkt_medium) SIMILAR TO '%(display|cpm|banner)%' THEN 'display' WHEN ev.refr_medium IS NULL AND ev.page_url NOT ILIKE '%utm_%' THEN 'direct' WHEN (LOWER(ev.refr_medium) = 'search' AND ev.mkt_medium IS NULL) OR (LOWER(ev.refr_medium) = 'search' AND LOWER(ev.mkt_medium) = 'organic') THEN 'organicsearch' WHEN ev.refr_medium = 'social' OR REGEXP_COUNT(LOWER(ev.mkt_source),'^((.*(facebook|linkedin|instagram|insta|slideshare|social|tweet|twitter|youtube|lnkd|pinterest|googleplus|instagram|plus.google.com|quora|reddit|t.co|twitch|viadeo|xing|youtube).*)|(yt|fb|li))$')>0 OR REGEXP_COUNT(LOWER(ev.mkt_medium),'^(.*)(social|facebook|linkedin|twitter|instagram|tweet)(.*)$')>0 THEN 'social' WHEN ev.refr_medium = 'email' OR ev.mkt_medium ILIKE '_mail' THEN 'email' WHEN ev.mkt_medium ILIKE 'affiliate' THEN 'affiliate' WHEN ev.refr_medium = 'unknown' or lower(ev.mkt_medium) ILIKE 'referral' OR lower(ev.mkt_medium) ILIKE 'referal' THEN 'referral' WHEN ev.refr_medium = 'internal' then 'internal' ELSE 'others' END AS channel FROM {{.scratch_schema}}.events_staged{{.entropy}} ev LEFT JOIN link_clicks lc ON lc.page_view_id = ev.page_view_id LEFT JOIN engagement eng ON eng.page_view_id = ev.page_view_id WHERE event_name = 'page_view' );
/* Formatted on 21/07/2014 18:37:20 (QP5 v5.227.12220.39754) */ CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_PCR_GESB ( ID_DPER_GESB, FLG_LAST_RUN, ID_DPER, COD_ABI_ISTITUTO, COD_ABI_CARTOLARIZZATO, COD_NDG, COD_SNDG, GESB_ACC_CONSEGNE, GESB_ACC_CONSEGNE_DT, GESB_UTI_CONSEGNE, GESB_UTI_CONSEGNE_DT, GESB_UTI_SOSTITUZIONI, GESB_UTI_MASSIMALI, GESB_UTI_RISCHI_INDIRETTI, GESB_UTI_SOSTITUZIONI_DT, GESB_UTI_MASSIMALI_DT, GESB_UTI_RISCHI_INDIRETTI_DT, GESB_ACC_SOSTITUZIONI, GESB_ACC_MASSIMALI, GESB_ACC_RISCHI_INDIRETTI, GESB_ACC_SOSTITUZIONI_DT, GESB_ACC_MASSIMALI_DT, GESB_ACC_RISCHI_INDIRETTI_DT, GESB_UTI_CASSA, GESB_UTI_FIRMA, GESB_ACC_CASSA, GESB_ACC_FIRMA, GESB_UTI_CASSA_BT, GESB_UTI_CASSA_MLT, GESB_UTI_SMOBILIZZO, GESB_UTI_FIRMA_DT, GESB_ACC_CASSA_BT, GESB_ACC_CASSA_MLT, GESB_ACC_SMOBILIZZO, GESB_ACC_FIRMA_DT, GESB_TOT_GAR, GESB_DTA_RIFERIMENTO, GESB_ACC_TOT, GESB_UTI_TOT, DTA_INS, DTA_UPD ) AS SELECT ID_DPER_GESB, FLG_LAST_RUN, ID_DPER, COD_ABI_ISTITUTO, COD_ABI_CARTOLARIZZATO, COD_NDG, COD_SNDG, GESB_ACC_CONSEGNE, GESB_ACC_CONSEGNE_DT, GESB_UTI_CONSEGNE, GESB_UTI_CONSEGNE_DT, GESB_UTI_SOSTITUZIONI, GESB_UTI_MASSIMALI, GESB_UTI_RISCHI_INDIRETTI, GESB_UTI_SOSTITUZIONI_DT, GESB_UTI_MASSIMALI_DT, GESB_UTI_RISCHI_INDIRETTI_DT, GESB_ACC_SOSTITUZIONI, GESB_ACC_MASSIMALI, GESB_ACC_RISCHI_INDIRETTI, GESB_ACC_SOSTITUZIONI_DT, GESB_ACC_MASSIMALI_DT, GESB_ACC_RISCHI_INDIRETTI_DT, GESB_UTI_CASSA, GESB_UTI_FIRMA, GESB_ACC_CASSA, GESB_ACC_FIRMA, GESB_UTI_CASSA_BT, GESB_UTI_CASSA_MLT, GESB_UTI_SMOBILIZZO, GESB_UTI_FIRMA_DT, GESB_ACC_CASSA_BT, GESB_ACC_CASSA_MLT, GESB_ACC_SMOBILIZZO, GESB_ACC_FIRMA_DT, GESB_TOT_GAR, GESB_DTA_RIFERIMENTO, GESB_ACC_TOT, GESB_UTI_TOT, DTA_INS, DTA_UPD FROM (SELECT pcr.id_dper id_dper_gesb, 1 FLG_LAST_RUN, xx.id_dper, gesb_acc_consegne, gesb_acc_consegne_dt, gesb_uti_consegne, gesb_uti_consegne_dt, gesb_uti_sostituzioni, gesb_uti_massimali, gesb_uti_rischi_indiretti, gesb_uti_sostituzioni_dt, gesb_uti_massimali_dt, gesb_uti_rischi_indiretti_dt, gesb_acc_sostituzioni, gesb_acc_massimali, gesb_acc_rischi_indiretti, gesb_acc_sostituzioni_dt, gesb_acc_massimali_dt, gesb_acc_rischi_indiretti_dt, gesb_uti_cassa, gesb_uti_firma, gesb_acc_cassa, gesb_acc_firma, gesb_uti_cassa_bt, gesb_uti_cassa_mlt, gesb_uti_smobilizzo, gesb_uti_firma_dt, gesb_acc_cassa_bt, gesb_acc_cassa_mlt, gesb_acc_smobilizzo, gesb_acc_firma_dt, gesb_tot_gar, gesb_dta_riferimento, gesb_acc_cassa + gesb_acc_firma gesb_acc_tot, gesb_uti_cassa + gesb_uti_firma gesb_uti_tot, xx.cod_sndg, xx.cod_abi_istituto, xx.cod_ndg, cod_abi_cartolarizzato, SYSDATE dta_ins, SYSDATE dta_upd FROM ( SELECT pcr.cod_abi_istituto, pcr.cod_sndg, pcr.id_dper, ge.cod_gruppo_economico, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'CO' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_CONSEGNE, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'CO' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_CONSEGNE_DT, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'CO' THEN pcr.val_imp_ACC_gre ELSE 0 END) gesb_ACC_CONSEGNE, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'CO' THEN pcr.val_imp_ACC_gre ELSE 0 END) gesb_ACC_CONSEGNE_DT, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'ST' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_sostituzioni, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'MS' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_massimali, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'RI' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_rischi_indiretti, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'ST' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_sostituzioni, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'MS' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_massimali, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'RI' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_rischi_indiretti, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'ST' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_sostituzioni_dt, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'MS' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_massimali_dt, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'RI' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_rischi_indiretti_dt, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'ST' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_sostituzioni_dt, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'MS' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_massimali_dt, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'RI' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_rischi_indiretti_dt, ---------------------------------------- OLD SUM ( CASE WHEN cl.cod_classe_appl_cf = 'CA' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_cassa, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'FI' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_firma, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'CA' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_cassa, SUM ( CASE WHEN cl.cod_classe_appl_cf = 'FI' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_firma, MAX (val_imp_gar_gre) gesb_tot_gar, --stesso valore su tutte le Forme Tecniche SUM ( CASE WHEN cl.cod_classe_appl_dett = 'CB' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_cassa_bt, SUM ( CASE WHEN cl.cod_classe_appl_dett = 'CM' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_cassa_mlt, SUM ( CASE WHEN cl.cod_classe_appl_dett = 'SM' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_smobilizzo, SUM ( CASE WHEN cl.cod_classe_appl_dett = 'FI' THEN pcr.val_imp_uti_gre ELSE 0 END) gesb_uti_firma_dt, SUM ( CASE WHEN cl.cod_classe_appl_dett = 'CB' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_cassa_bt, SUM ( CASE WHEN cl.cod_classe_appl_dett = 'CM' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_cassa_mlt, SUM ( CASE WHEN cl.cod_classe_appl_dett = 'SM' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_smobilizzo, SUM ( CASE WHEN cl.cod_classe_appl_dett = 'FI' THEN pcr.val_imp_acc_gre ELSE 0 END) gesb_acc_firma_dt, MAX (pcr.dta_riferimento) GESB_dta_riferimento FROM t_mcre0_day_pges pcr, --t_mcre0_app_pcr_ge_sb pcr, t_mcre0_app_natura_ftecnica cl, t_mcre0_dwh_ge ge --t_mcre0_app_gruppo_economico ge WHERE pcr.cod_forma_tecn = cl.cod_ftecnica AND pcr.cod_sndg = ge.cod_sndg --AND pcr.id_dper =(SELECT a.idper --FROM V_MCRE0_ULTIMA_ACQUISIZIONE A --WHERE a.cod_file = 'PCR_GE_SB') GROUP BY pcr.cod_abi_istituto, pcr.cod_sndg, ge.cod_gruppo_economico, pcr.id_dper) pcr, (SELECT id_dper, cod_sndg, cod_abi_cartolarizzato, cod_abi_istituto, cod_ndg FROM t_mcre0_day_fg) xx WHERE xx.cod_sndg = pcr.cod_sndg AND xx.cod_abi_istituto = pcr.cod_abi_istituto);
SELECT TOP(CONVERT(INT, /*topRow*/)) A.MAKER_CUSTOMER_CODE, B.CUSTOMER_ABBR_NAME AS MAKER, A.BRAND, A.TYPE, A.YEAR_OF_MANUFACTURE, A.SECOND_HAND_PRICE, A.MODIFY_DATE FROM SECOND_HAND_VEHICLE_PRICE_MST AS A LEFT JOIN CUSTOMER_MST AS B ON A.MAKER_CUSTOMER_CODE = B.CUSTOMER_CODE WHERE 1 = 1 /*IF (dto.makerSearch != null)*/ AND A.MAKER_CUSTOMER_CODE = /*dto.makerSearch*/ /*END*/ /*IF (dto.brandSearchName != null)*/ AND A.BRAND = /*dto.brandSearchName*/'' /*END*/ /*IF (dto.typeSearch != null)*/ AND A.TYPE LIKE '%'+/*dto.typeSearch*/''+'%' /*END*/ /*IF (dto.yearOfManufactureSearch != null)*/ AND A.YEAR_OF_MANUFACTURE = /*dto.yearOfManufactureSearch*/'' /*END*/ ORDER BY A.MAKER_CUSTOMER_CODE, A.BRAND, A.TYPE
-- 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 fabrica_picoles -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema fabrica_picoles -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `fabrica_picoles` ; USE `fabrica_picoles` ; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`sabores` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`sabores` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`sabores` ( `id` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`tipos_embalagem` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`tipos_embalagem` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`tipos_embalagem` ( `id` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`tipos_picole` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`tipos_picole` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`tipos_picole` ( `id` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`picoles` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`picoles` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`picoles` ( `id` INT NOT NULL AUTO_INCREMENT, `preco` DECIMAL(8,2) NOT NULL, `id_sabor` INT NOT NULL, `id_tipo_embalagem` INT NOT NULL, `id_tipo_picole` INT NOT NULL, PRIMARY KEY (`id`), INDEX `fk_picoles_1_idx` (`id_sabor` ASC), INDEX `fk_picoles_2_idx` (`id_tipo_embalagem` ASC), INDEX `fk_picoles_3_idx` (`id_tipo_picole` ASC), CONSTRAINT `fk_picoles_1` FOREIGN KEY (`id_sabor`) REFERENCES `fabrica_picoles`.`sabores` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_picoles_2` FOREIGN KEY (`id_tipo_embalagem`) REFERENCES `fabrica_picoles`.`tipos_embalagem` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_picoles_3` FOREIGN KEY (`id_tipo_picole`) REFERENCES `fabrica_picoles`.`tipos_picole` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`ingredientes` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`ingredientes` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`ingredientes` ( `id` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`ingredientes_picole` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`ingredientes_picole` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`ingredientes_picole` ( `id` INT NOT NULL AUTO_INCREMENT, `id_ingrediente` INT NOT NULL, `id_picole` INT NOT NULL, PRIMARY KEY (`id`), INDEX `fk_ingredientes_picole_1_idx` (`id_ingrediente` ASC), INDEX `fk_ingredientes_picole_2_idx` (`id_picole` ASC), CONSTRAINT `fk_ingredientes_picole_1` FOREIGN KEY (`id_ingrediente`) REFERENCES `fabrica_picoles`.`ingredientes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_ingredientes_picole_2` FOREIGN KEY (`id_picole`) REFERENCES `fabrica_picoles`.`picoles` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`aditivos_nutritivos` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`aditivos_nutritivos` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`aditivos_nutritivos` ( `id` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(45) NOT NULL, `formula_quimica` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`aditivos_nutritivos_picole` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`aditivos_nutritivos_picole` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`aditivos_nutritivos_picole` ( `id` INT NOT NULL AUTO_INCREMENT, `id_aditivo_nutritivo` INT NOT NULL, `id_picole` INT NOT NULL, PRIMARY KEY (`id`), INDEX `fk_aditivos_nutritivos_picole_1_idx` (`id_aditivo_nutritivo` ASC), INDEX `fk_aditivos_nutritivos_picole_2_idx` (`id_picole` ASC), CONSTRAINT `fk_aditivos_nutritivos_picole_1` FOREIGN KEY (`id_aditivo_nutritivo`) REFERENCES `fabrica_picoles`.`aditivos_nutritivos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_aditivos_nutritivos_picole_2` FOREIGN KEY (`id_picole`) REFERENCES `fabrica_picoles`.`picoles` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`conservantes` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`conservantes` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`conservantes` ( `id` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(45) NOT NULL, `descricao` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`conservantes_picoles` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`conservantes_picoles` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`conservantes_picoles` ( `id` INT NOT NULL AUTO_INCREMENT, `id_conservante` INT NOT NULL, `id_picole` INT NOT NULL, PRIMARY KEY (`id`), INDEX `fk_conservantes_picoles_1_idx` (`id_conservante` ASC), INDEX `fk_conservantes_picoles_2_idx` (`id_picole` ASC), CONSTRAINT `fk_conservantes_picoles_1` FOREIGN KEY (`id_conservante`) REFERENCES `fabrica_picoles`.`conservantes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_conservantes_picoles_2` FOREIGN KEY (`id_picole`) REFERENCES `fabrica_picoles`.`picoles` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`lotes` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`lotes` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`lotes` ( `id` INT NOT NULL AUTO_INCREMENT, `id_tipo_picole` INT NOT NULL, `quantidade` INT NOT NULL, PRIMARY KEY (`id`), INDEX `fk_lotes_1_idx` (`id_tipo_picole` ASC), CONSTRAINT `fk_lotes_1` FOREIGN KEY (`id_tipo_picole`) REFERENCES `fabrica_picoles`.`tipos_picole` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`revendedores` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`revendedores` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`revendedores` ( `id` INT NOT NULL AUTO_INCREMENT, `cnpj` VARCHAR(45) NOT NULL, `razao_social` VARCHAR(100) NOT NULL, `contato` VARCHAR(100) NOT NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`notas_fiscais` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`notas_fiscais` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`notas_fiscais` ( `id` INT NOT NULL AUTO_INCREMENT, `data` DATE NOT NULL, `valor` DECIMAL(8,2) NOT NULL, `numero_serie` VARCHAR(45) NOT NULL, `descricao` VARCHAR(200) NOT NULL, `id_revendedor` INT NOT NULL, PRIMARY KEY (`id`), INDEX `fk_notas_fiscais_1_idx` (`id_revendedor` ASC), CONSTRAINT `fk_notas_fiscais_1` FOREIGN KEY (`id_revendedor`) REFERENCES `fabrica_picoles`.`revendedores` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `fabrica_picoles`.`lotes_nota_fiscal` -- ----------------------------------------------------- DROP TABLE IF EXISTS `fabrica_picoles`.`lotes_nota_fiscal` ; CREATE TABLE IF NOT EXISTS `fabrica_picoles`.`lotes_nota_fiscal` ( `id` INT NOT NULL AUTO_INCREMENT, `id_lote` INT NOT NULL, `id_nota_fiscal` INT NOT NULL, PRIMARY KEY (`id`), INDEX `fk_lotes_nota_fiscal_1_idx` (`id_lote` ASC), INDEX `fk_lotes_nota_fiscal_2_idx` (`id_nota_fiscal` ASC), CONSTRAINT `fk_lotes_nota_fiscal_1` FOREIGN KEY (`id_lote`) REFERENCES `fabrica_picoles`.`lotes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_lotes_nota_fiscal_2` FOREIGN KEY (`id_nota_fiscal`) REFERENCES `fabrica_picoles`.`notas_fiscais` (`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;
--alter table esed_all add column "empty_sum" bool --alter table esed_all add column "zero_sum" bool --alter table esed_all add column "reg_num_cleared" text update esed_all set na_document = quote_literal(na_document) /* set reg_num_cleared = case when (regexp_match(reg_num, '\d{1,4}/\d{2}/\d{1,4}[-/]\d{1,4}'))[1] is null then reg_num else (regexp_match(reg_num, '\d{1,4}/\d{2}/\d{1,4}[-/]\d{1,4}'))[1] end set zero_sum = case when amount_with_vat > 0 or amount_wo_vat > 0 then false else true end set empty_sum = case when amount_with_vat is null and amount_wo_vat is null then true else false end select quote_literal(na_document) from esed_all limit 10*/
ALTER TABLE `webext_permissions` DROP FOREIGN KEY `webext_permissions_file`, CHANGE COLUMN `created` `created` DATETIME (6) NOT NULL, CHANGE COLUMN `modified` `modified` DATETIME (6) NOT NULL, CHANGE COLUMN `permissions` `permissions` LONGTEXT NOT NULL, CHANGE COLUMN `file_id` `file_id` INT (10) UNSIGNED NOT NULL, ADD INDEX `webext_permissions_file_id_a54af0b1_fk_files_id` (`file_id`), ADD CONSTRAINT `webext_permissions_file_id_a54af0b1_fk_files_id` FOREIGN KEY (`file_id`) REFERENCES `files` (`id`);
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; CREATE TABLE IF NOT EXISTS `article` ( `id` int(11) NOT NULL, `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `price` decimal(5,2) NOT NULL, `stock` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `article` (`id`, `name`, `price`, `stock`) VALUES (1, 'Dentifrice', '458.25', 250), (2, 'shampoing', '999.99', 15), (8, 'Produit cool', '45.00', 200), (9, 'Autre produit cool', '20.00', 150), (10, 'Super truc', '12.58', 102), (11, 'Blobby blob', '452.00', 125), (12, 'Accordéon', '485.00', 12), (13, 'Pipeau', '45.00', 12); CREATE TABLE IF NOT EXISTS `article_estimate` ( `id_estimate` int(11) NOT NULL, `id_article` int(11) NOT NULL, `quantity` int(11) NOT NULL DEFAULT '1' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `article_estimate` (`id_estimate`, `id_article`, `quantity`) VALUES (4, 1, 1), (4, 2, 1), (4, 9, 2), (4, 12, 5), (6, 9, 1), (6, 10, 2), (6, 12, 1), (6, 13, 5); CREATE TABLE IF NOT EXISTS `client` ( `id` int(11) NOT NULL, `lastname` varchar(100) CHARACTER SET latin1 NOT NULL, `firstname` varchar(100) CHARACTER SET latin1 NOT NULL, `adresse_rue` varchar(100) CHARACTER SET latin1 NOT NULL, `adresse_cp` varchar(5) CHARACTER SET latin1 DEFAULT NULL, `adresse_ville` varchar(50) CHARACTER SET latin1 NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `client` (`id`, `lastname`, `firstname`, `adresse_rue`, `adresse_cp`, `adresse_ville`) VALUES (1, 'Malkovich', 'Malkovich', '4 Rue des Docks', '75000', 'Paris'), (2, 'Abagnale', 'Daniel', '116 bis Avenue du pré bleu', '13005', 'Marseille'), (3, 'Araignas', 'Lucette', '12 Boulevard Montparnasse', '75000', 'Paris'), (4, 'Araignas', 'Benjamin', '4 Rue des Pierres', '51454', 'Reims'); CREATE TABLE IF NOT EXISTS `estimate` ( `id` int(11) NOT NULL, `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `validated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `status` enum('Brouillon','Validé','En attente','Payé','Annulé') COLLATE utf8_unicode_ci NOT NULL, `reference` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `discount` int(11) NOT NULL, `id_client` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `estimate` (`id`, `created_at`, `validated_at`, `status`, `reference`, `discount`, `id_client`) VALUES (4, '2015-10-04 12:07:36', '2016-10-17 12:07:36', 'Brouillon', 'DE5802', 5, 1), (6, '2016-05-04 12:07:36', '2016-09-05 05:04:12', 'Brouillon', 'FR2580', 0, 2); ALTER TABLE `article` ADD PRIMARY KEY (`id`); ALTER TABLE `article_estimate` ADD PRIMARY KEY (`id_estimate`,`id_article`), ADD KEY `id_estimate` (`id_estimate`), ADD KEY `id_article` (`id_article`); ALTER TABLE `client` ADD PRIMARY KEY (`id`); ALTER TABLE `estimate` ADD PRIMARY KEY (`id`), ADD KEY `id_client` (`id_client`); ALTER TABLE `article` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=14; ALTER TABLE `client` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5; ALTER TABLE `estimate` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7; ALTER TABLE `article_estimate` ADD CONSTRAINT `article_estimate_ibfk_1` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`), ADD CONSTRAINT `article_estimate_ibfk_2` FOREIGN KEY (`id_estimate`) REFERENCES `estimate` (`id`); ALTER TABLE `estimate` ADD CONSTRAINT `estimate_ibfk_1` FOREIGN KEY (`id_client`) REFERENCES `client` (`id`);
DELETE FROM MARKSHEET WHERE roll =4;
ALTER TABLE `livro_caixa_2`.`operacao_bancaria_por_canal` DROP FOREIGN KEY `FK_OPERACAO_BANCARIA_ID` , DROP FOREIGN KEY `FK_CANAL_ATENDIMENTO_ID` ; ALTER TABLE `livro_caixa_2`.`operacao_bancaria_por_canal` DROP COLUMN `data` , ADD COLUMN `id` SMALLINT NOT NULL AUTO_INCREMENT FIRST , DROP PRIMARY KEY , ADD PRIMARY KEY (`id`) , DROP INDEX `FK_CANAL_ATENDIMENTO_ID` ; ALTER TABLE `livro_caixa_2`.`operacao_bancaria_por_canal` ADD CONSTRAINT `FK_POR_OPERACAO_BANCARIA` FOREIGN KEY (`operacao_bancaria_id` ) REFERENCES `livro_caixa_2`.`operacao_bancaria` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION , ADD CONSTRAINT `FK_POR_CANAL_ATENDIMENTO` FOREIGN KEY (`canal_atendimento_id` ) REFERENCES `livro_caixa_2`.`canal_atendimento` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION , ADD INDEX `FK_POR_OPERACAO_BANCARIA` (`operacao_bancaria_id` ASC) , ADD INDEX `FK_POR_CANAL_ATENDIMENTO` (`canal_atendimento_id` ASC) ;
DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `uspCourseDelete`( IN i_CourseCode varchar(100) , IN i_CourseType varchar(1000), IN i_CourseName varchar(1000), IN i_AdminID int, OUT o_iscoursecodeexists int ) BEGIN Declare i_CourseID int; set i_CourseID=(Select CourseID from tblCourseDetails where Coursecode=i_CourseCode); IF EXISTS(Select CourseID from tblCourseDetails where Coursecode=i_CourseCode) THen set o_iscoursecodeexists=1; Update tblcoursedetails set IsActive=0 where CourseID=i_CourseID; else set o_iscoursecodeexists=0; END IF; END$$ DELIMITER ;
/* 13. Sacar la media de sueldos entre todos los vendedores por grupo */ SELECT CEIL(AVG(v.sueldo)), g.nombre, g.ciudad FROM vendedores v INNER JOIN grupos g ON g.id = v.grupo_id GROUP BY grupo_id;
CREATE TABLE public."Album" ( "AlbumId" integer NOT NULL, "Title" character varying(160) NOT NULL, "ArtistId" integer NOT NULL ); CREATE TABLE public."Artist" ( "ArtistId" integer NOT NULL, "Name" character varying(120) ); CREATE TABLE public."Customer" ( "CustomerId" integer NOT NULL, "FirstName" character varying(40) NOT NULL, "LastName" character varying(20) NOT NULL, "Company" character varying(80), "Address" character varying(70), "City" character varying(40), "State" character varying(40), "Country" character varying(40), "PostalCode" character varying(10), "Phone" character varying(24), "Fax" character varying(24), "Email" character varying(60) NOT NULL, "SupportRepId" integer ); CREATE TABLE public."Employee" ( "EmployeeId" integer NOT NULL, "LastName" character varying(20) NOT NULL, "FirstName" character varying(20) NOT NULL, "Title" character varying(30), "ReportsTo" integer, "BirthDate" timestamp without time zone, "HireDate" timestamp without time zone, "Address" character varying(70), "City" character varying(40), "State" character varying(40), "Country" character varying(40), "PostalCode" character varying(10), "Phone" character varying(24), "Fax" character varying(24), "Email" character varying(60) ); CREATE TABLE public."Genre" ( "GenreId" integer NOT NULL, "Name" character varying(120) ); CREATE TABLE public."Invoice" ( "InvoiceId" integer NOT NULL, "CustomerId" integer NOT NULL, "InvoiceDate" timestamp without time zone NOT NULL, "BillingAddress" character varying(70), "BillingCity" character varying(40), "BillingState" character varying(40), "BillingCountry" character varying(40), "BillingPostalCode" character varying(10), "Total" numeric(10,2) NOT NULL ); CREATE TABLE public."InvoiceLine" ( "InvoiceLineId" integer NOT NULL, "InvoiceId" integer NOT NULL, "TrackId" integer NOT NULL, "UnitPrice" numeric(10,2) NOT NULL, "Quantity" integer NOT NULL ); CREATE TABLE public."MediaType" ( "MediaTypeId" integer NOT NULL, "Name" character varying(120) ); CREATE TABLE public."Playlist" ( "PlaylistId" integer NOT NULL, "Name" character varying(120) ); CREATE TABLE public."PlaylistTrack" ( "PlaylistId" integer NOT NULL, "TrackId" integer NOT NULL ); CREATE TABLE public."Track" ( "TrackId" integer NOT NULL, "Name" character varying(200) NOT NULL, "AlbumId" integer, "MediaTypeId" integer NOT NULL, "GenreId" integer, "Composer" character varying(220), "Milliseconds" integer NOT NULL, "Bytes" integer, "UnitPrice" numeric(10,2) NOT NULL ); CREATE TABLE public.test ( id integer NOT NULL, text text NOT NULL ); CREATE SEQUENCE public.test_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER SEQUENCE public.test_id_seq OWNED BY public.test.id; ALTER TABLE ONLY public.test ALTER COLUMN id SET DEFAULT nextval('public.test_id_seq'::regclass); ALTER TABLE ONLY public."Album" ADD CONSTRAINT "PK_Album" PRIMARY KEY ("AlbumId"); ALTER TABLE ONLY public."Artist" ADD CONSTRAINT "PK_Artist" PRIMARY KEY ("ArtistId"); ALTER TABLE ONLY public."Customer" ADD CONSTRAINT "PK_Customer" PRIMARY KEY ("CustomerId"); ALTER TABLE ONLY public."Employee" ADD CONSTRAINT "PK_Employee" PRIMARY KEY ("EmployeeId"); ALTER TABLE ONLY public."Genre" ADD CONSTRAINT "PK_Genre" PRIMARY KEY ("GenreId"); ALTER TABLE ONLY public."Invoice" ADD CONSTRAINT "PK_Invoice" PRIMARY KEY ("InvoiceId"); ALTER TABLE ONLY public."InvoiceLine" ADD CONSTRAINT "PK_InvoiceLine" PRIMARY KEY ("InvoiceLineId"); ALTER TABLE ONLY public."MediaType" ADD CONSTRAINT "PK_MediaType" PRIMARY KEY ("MediaTypeId"); ALTER TABLE ONLY public."Playlist" ADD CONSTRAINT "PK_Playlist" PRIMARY KEY ("PlaylistId"); ALTER TABLE ONLY public."PlaylistTrack" ADD CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY ("PlaylistId", "TrackId"); ALTER TABLE ONLY public."Track" ADD CONSTRAINT "PK_Track" PRIMARY KEY ("TrackId"); ALTER TABLE ONLY public.test ADD CONSTRAINT test_pkey PRIMARY KEY (id); CREATE INDEX "IFK_AlbumArtistId" ON public."Album" USING btree ("ArtistId"); CREATE INDEX "IFK_CustomerSupportRepId" ON public."Customer" USING btree ("SupportRepId"); CREATE INDEX "IFK_EmployeeReportsTo" ON public."Employee" USING btree ("ReportsTo"); CREATE INDEX "IFK_InvoiceCustomerId" ON public."Invoice" USING btree ("CustomerId"); CREATE INDEX "IFK_InvoiceLineInvoiceId" ON public."InvoiceLine" USING btree ("InvoiceId"); CREATE INDEX "IFK_InvoiceLineTrackId" ON public."InvoiceLine" USING btree ("TrackId"); CREATE INDEX "IFK_PlaylistTrackTrackId" ON public."PlaylistTrack" USING btree ("TrackId"); CREATE INDEX "IFK_TrackAlbumId" ON public."Track" USING btree ("AlbumId"); CREATE INDEX "IFK_TrackGenreId" ON public."Track" USING btree ("GenreId"); CREATE INDEX "IFK_TrackMediaTypeId" ON public."Track" USING btree ("MediaTypeId"); ALTER TABLE ONLY public."Album" ADD CONSTRAINT "FK_AlbumArtistId" FOREIGN KEY ("ArtistId") REFERENCES public."Artist"("ArtistId"); ALTER TABLE ONLY public."Customer" ADD CONSTRAINT "FK_CustomerSupportRepId" FOREIGN KEY ("SupportRepId") REFERENCES public."Employee"("EmployeeId"); ALTER TABLE ONLY public."Employee" ADD CONSTRAINT "FK_EmployeeReportsTo" FOREIGN KEY ("ReportsTo") REFERENCES public."Employee"("EmployeeId"); ALTER TABLE ONLY public."Invoice" ADD CONSTRAINT "FK_InvoiceCustomerId" FOREIGN KEY ("CustomerId") REFERENCES public."Customer"("CustomerId"); ALTER TABLE ONLY public."InvoiceLine" ADD CONSTRAINT "FK_InvoiceLineInvoiceId" FOREIGN KEY ("InvoiceId") REFERENCES public."Invoice"("InvoiceId") ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE ONLY public."InvoiceLine" ADD CONSTRAINT "FK_InvoiceLineTrackId" FOREIGN KEY ("TrackId") REFERENCES public."Track"("TrackId"); ALTER TABLE ONLY public."PlaylistTrack" ADD CONSTRAINT "FK_PlaylistTrackPlaylistId" FOREIGN KEY ("PlaylistId") REFERENCES public."Playlist"("PlaylistId"); ALTER TABLE ONLY public."PlaylistTrack" ADD CONSTRAINT "FK_PlaylistTrackTrackId" FOREIGN KEY ("TrackId") REFERENCES public."Track"("TrackId"); ALTER TABLE ONLY public."Track" ADD CONSTRAINT "FK_TrackAlbumId" FOREIGN KEY ("AlbumId") REFERENCES public."Album"("AlbumId"); ALTER TABLE ONLY public."Track" ADD CONSTRAINT "FK_TrackGenreId" FOREIGN KEY ("GenreId") REFERENCES public."Genre"("GenreId"); ALTER TABLE ONLY public."Track" ADD CONSTRAINT "FK_TrackMediaTypeId" FOREIGN KEY ("MediaTypeId") REFERENCES public."MediaType"("MediaTypeId");
select * from software_info
CREATE TABLE `log` ( `log_id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `log_type_id` int(11) NOT NULL, `log_value` varchar(45) NOT NULL, `log_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `create_user` varchar(16) NOT NULL DEFAULT 'ANONYMOUS', `update_user` varchar(16) NOT NULL DEFAULT 'ANONYMOUS', PRIMARY KEY (`log_id`), KEY `log_user_id_fk_idx` (`user_id`), KEY `log_type_id_fk_idx` (`log_type_id`), CONSTRAINT `log_type_id_fk` FOREIGN KEY (`log_type_id`) REFERENCES `log_type` (`log_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `log_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE `log_type` ( `log_type_id` int(11) NOT NULL AUTO_INCREMENT, `log_type_description` varchar(45) NOT NULL, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `create_user` varchar(16) NOT NULL DEFAULT 'ANONYMOUS', `update_user` varchar(16) NOT NULL DEFAULT 'ANONYMOUS', PRIMARY KEY (`log_type_id`), UNIQUE KEY `log_type_description_UNIQUE` (`log_type_description`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; CREATE TABLE `user` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_name` varchar(16) NOT NULL, `user_email` varchar(255) DEFAULT NULL, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `create_user` varchar(16) NOT NULL DEFAULT 'ANONYMOUS', `update_user` varchar(16) NOT NULL DEFAULT 'ANONYMOUS', PRIMARY KEY (`user_id`), UNIQUE KEY `email_UNIQUE` (`user_email`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- phpMyAdmin SQL Dump -- version 4.5.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Sep 12, 2016 at 08:07 AM -- Server version: 10.1.13-MariaDB -- PHP Version: 5.6.21 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: `volunteering` -- -- -------------------------------------------------------- -- -- Table structure for table `beneficiary` -- CREATE TABLE `beneficiary` ( `beneficiaryID` int(11) NOT NULL, `projectID` int(11) NOT NULL, `description` text COLLATE utf8_unicode_ci, `imgID` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `image` -- CREATE TABLE `image` ( `imgID` int(15) NOT NULL, `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `project` -- CREATE TABLE `project` ( `projectID` int(11) NOT NULL, `createdBy` int(11) NOT NULL, `description` int(11) DEFAULT NULL, `expectedStartDate` date DEFAULT NULL, `expectedEndDate` date DEFAULT NULL, `status` int(3) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `resource` -- CREATE TABLE `resource` ( `resourceID` int(11) NOT NULL, `name` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `task` -- CREATE TABLE `task` ( `taskID` int(11) NOT NULL, `projectID` int(11) NOT NULL, `description` text COLLATE utf8_unicode_ci, `status` int(11) DEFAULT NULL, `dueDate` date DEFAULT NULL, `assignedTo` int(11) DEFAULT NULL, `resourceID` int(11) DEFAULT NULL, `imgID` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `task_beneficiary` -- CREATE TABLE `task_beneficiary` ( `id` int(11) NOT NULL, `taskID` int(11) NOT NULL, `beneficiaryID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `userid` int(11) NOT NULL, `roleID` int(11) NOT NULL, `username` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `enabled` tinyint(4) DEFAULT '1', `fullname` varchar(100) COLLATE utf8_bin DEFAULT NULL, `gender` int(1) UNSIGNED DEFAULT NULL, `email` varchar(100) COLLATE utf8_bin DEFAULT NULL, `password` varchar(500) COLLATE utf8_bin DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Table structure for table `user_role` -- CREATE TABLE `user_role` ( `roleID` int(11) NOT NULL, `role` varchar(11) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `user_role` -- INSERT INTO `user_role` (`roleID`, `role`) VALUES (1, 'ADMIN'), (3, 'VOLUNTEER'); -- -------------------------------------------------------- -- -- Table structure for table `volunteer_offer` -- CREATE TABLE `volunteer_offer` ( `offerID` int(11) NOT NULL, `userID` int(11) NOT NULL, `taskID` int(11) NOT NULL, `service` text COLLATE utf8_unicode_ci ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Indexes for dumped tables -- -- -- Indexes for table `beneficiary` -- ALTER TABLE `beneficiary` ADD PRIMARY KEY (`beneficiaryID`), ADD KEY `imgID` (`imgID`), ADD KEY `imgID_2` (`imgID`), ADD KEY `projectID` (`projectID`); -- -- Indexes for table `image` -- ALTER TABLE `image` ADD PRIMARY KEY (`imgID`); -- -- Indexes for table `project` -- ALTER TABLE `project` ADD PRIMARY KEY (`projectID`), ADD KEY `ceatedBy` (`createdBy`); -- -- Indexes for table `resource` -- ALTER TABLE `resource` ADD PRIMARY KEY (`resourceID`); -- -- Indexes for table `task` -- ALTER TABLE `task` ADD PRIMARY KEY (`taskID`), ADD KEY `assignedTo` (`assignedTo`), ADD KEY `projectID` (`projectID`), ADD KEY `imgID` (`imgID`), ADD KEY `resource` (`resourceID`); -- -- Indexes for table `task_beneficiary` -- ALTER TABLE `task_beneficiary` ADD PRIMARY KEY (`id`), ADD KEY `taskID` (`taskID`), ADD KEY `beneficiaryID` (`beneficiaryID`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`userid`), ADD UNIQUE KEY `userid` (`userid`), ADD UNIQUE KEY `userid_2` (`userid`), ADD KEY `roleID` (`roleID`); -- -- Indexes for table `user_role` -- ALTER TABLE `user_role` ADD PRIMARY KEY (`roleID`); -- -- Indexes for table `volunteer_offer` -- ALTER TABLE `volunteer_offer` ADD PRIMARY KEY (`offerID`), ADD KEY `userID` (`userID`), ADD KEY `taskID` (`taskID`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `beneficiary` -- ALTER TABLE `beneficiary` MODIFY `beneficiaryID` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `image` -- ALTER TABLE `image` MODIFY `imgID` int(15) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=87; -- -- AUTO_INCREMENT for table `project` -- ALTER TABLE `project` MODIFY `projectID` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `resource` -- ALTER TABLE `resource` MODIFY `resourceID` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `task` -- ALTER TABLE `task` MODIFY `taskID` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `task_beneficiary` -- ALTER TABLE `task_beneficiary` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `userid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `user_role` -- ALTER TABLE `user_role` MODIFY `roleID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `volunteer_offer` -- ALTER TABLE `volunteer_offer` MODIFY `offerID` int(11) NOT NULL AUTO_INCREMENT; -- -- Constraints for dumped tables -- -- -- Constraints for table `beneficiary` -- ALTER TABLE `beneficiary` ADD CONSTRAINT `beneficiary_ibfk_1` FOREIGN KEY (`imgID`) REFERENCES `image` (`imgID`); -- -- Constraints for table `project` -- ALTER TABLE `project` ADD CONSTRAINT `project_ibfk_1` FOREIGN KEY (`createdBy`) REFERENCES `user` (`userid`); -- -- Constraints for table `task` -- ALTER TABLE `task` ADD CONSTRAINT `task_ibfk_1` FOREIGN KEY (`imgID`) REFERENCES `image` (`imgID`), ADD CONSTRAINT `task_ibfk_2` FOREIGN KEY (`assignedTo`) REFERENCES `user` (`userid`), ADD CONSTRAINT `task_ibfk_3` FOREIGN KEY (`projectID`) REFERENCES `project` (`projectID`), ADD CONSTRAINT `task_ibfk_4` FOREIGN KEY (`resourceID`) REFERENCES `resource` (`resourceID`); -- -- Constraints for table `task_beneficiary` -- ALTER TABLE `task_beneficiary` ADD CONSTRAINT `task_beneficiary_ibfk_1` FOREIGN KEY (`taskID`) REFERENCES `task` (`taskID`), ADD CONSTRAINT `task_beneficiary_ibfk_2` FOREIGN KEY (`beneficiaryID`) REFERENCES `beneficiary` (`beneficiaryID`); -- -- Constraints for table `user` -- ALTER TABLE `user` ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`roleID`) REFERENCES `user_role` (`roleID`); -- -- Constraints for table `volunteer_offer` -- ALTER TABLE `volunteer_offer` ADD CONSTRAINT `volunteer_offer_ibfk_1` FOREIGN KEY (`userID`) REFERENCES `user` (`userid`), ADD CONSTRAINT `volunteer_offer_ibfk_2` FOREIGN KEY (`taskID`) REFERENCES `task` (`taskID`); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
USE `task`; DROP TABLE IF EXISTS `coordinates`; CREATE TABLE `coordinates`( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `task_id` INT UNSIGNED NOT NULL, `coordinates` VARCHAR(50) NOT NULL, `name` VARCHAR (200) NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8;
select count(*) from ( select term x from frequency where docid='10398_txt_earn' and count='1' union select term from frequency where docid='925_txt_trade' and count='1');
-- Lists all genres from hbtn_0d_tvshows and displays the number of shows linked to each. -- First column must be called genre, Second column must be called number_of_shows SELECT tv_genres.name AS genre, COUNT(tv_show_genres.genre_id) AS number_of_shows FROM tv_show_genres INNER JOIN tv_genres ON tv_show_genres.genre_id = tv_genres.id GROUP BY genre ORDER BY number_of_shows DESC;
/* Warnings: - You are about to drop the column `memberId` on the `item` table. All the data in the column will be lost. - You are about to drop the `admin` table. If the table is not empty, all the data it contains will be lost. - You are about to drop the `member` table. If the table is not empty, all the data it contains will be lost. */ -- DropForeignKey ALTER TABLE "item" DROP CONSTRAINT "item_memberId_fkey"; -- AlterTable ALTER TABLE "item" DROP COLUMN "memberId", ADD COLUMN "userId" INTEGER; -- DropTable DROP TABLE "admin"; -- DropTable DROP TABLE "member"; -- CreateTable CREATE TABLE "user" ( "id" SERIAL NOT NULL, "email" VARCHAR(50), "firstName" CHAR(30), "lastName" CHAR(30), "password" TEXT NOT NULL, "createdAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3), CONSTRAINT "user_pkey" PRIMARY KEY ("id") ); -- CreateIndex CREATE UNIQUE INDEX "user_email_key" ON "user"("email"); -- AddForeignKey ALTER TABLE "item" ADD CONSTRAINT "item_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;
# Create Database CREATE DATABASE books; # Select Database USE books; # Import the Data CREATE TABLE booksales ( country VARCHAR(35), genre ENUM('fiction','non-fiction'), year YEAR, sales INT); INSERT INTO booksales VALUES ('Senegal','fiction',2014,12234), ('Senegal','fiction',2015,15647), ('Senegal','non-fiction',2014,64980), ('Senegal','non-fiction',2015,78901), ('Paraguay','fiction',2014,87970), ('Paraguay','fiction',2015,76940), ('Paraguay','non-fiction',2014,8760), ('Paraguay','non-fiction',2015,9030); # Sample 1 SELECT year, SUM(sales) FROM booksales GROUP BY year; # Sample Rollup 1 SELECT year, SUM(sales) FROM booksales GROUP BY year WITH ROLLUP; # Sample 2 SELECT country, year, genre, SUM(sales) FROM booksales GROUP BY country, year, genre; # Sample Rollup 2 SELECT country, year, genre, SUM(sales) FROM booksales GROUP BY country, year, genre WITH ROLLUP;
CREATE DATABASE chat; USE chat; CREATE TABLE Users ( UserID INTEGER PRIMARY KEY, username VARCHAR(50) NOT NULL ); CREATE TABLE Rooms ( RoomID INTEGER PRIMARY KEY, roomname VARCHAR(50) NOT NULL ); CREATE TABLE Messages ( MessageID INTEGER PRIMARY KEY, objectID INTEGER NOT NULL, message VARCHAR(400) NOT NULL, createdAt TIMESTAMP NOT NULL, UserID INTEGER, RoomID INTEGER, FOREIGN KEY (UserID) REFERENCES Users (UserID), FOREIGN KEY (RoomID) REFERENCES Rooms (RoomID) );
-- phpMyAdmin SQL Dump -- version 4.8.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 14, 2019 at 12:08 PM -- Server version: 10.1.31-MariaDB -- PHP Version: 7.2.4 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `furniture` -- -- -------------------------------------------------------- -- -- Table structure for table `admin_contact` -- CREATE TABLE `admin_contact` ( `id` int(3) NOT NULL, `mobile` varchar(11) NOT NULL, `phone` varchar(12) NOT NULL, `email` varchar(50) NOT NULL, `address` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin_contact` -- INSERT INTO `admin_contact` (`id`, `mobile`, `phone`, `email`, `address`) VALUES (1, '9766449791', '9766449791', 'sumitsakpal02@gmail.com', 'Near Zeal College Narhe, Pune'); -- -------------------------------------------------------- -- -- Table structure for table `admin_login` -- CREATE TABLE `admin_login` ( `id` int(3) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin_login` -- INSERT INTO `admin_login` (`id`, `username`, `password`) VALUES (2, 'admin', 'admin'), (3, 'sumit', 'admin'), (8, 'sumit', 'atish'); -- -------------------------------------------------------- -- -- Table structure for table `checkout_address` -- CREATE TABLE `checkout_address` ( `id` int(5) NOT NULL, `firstname` varchar(50) NOT NULL, `lastname` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `address` varchar(1000) NOT NULL, `city` varchar(50) NOT NULL, `pincode` varchar(10) NOT NULL, `contactno` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `checkout_address` -- INSERT INTO `checkout_address` (`id`, `firstname`, `lastname`, `email`, `address`, `city`, `pincode`, `contactno`) VALUES (1, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '9405264157'), (2, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '0940526415'), (3, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '094052'), (4, 'Pankaj', 'Kokate', 'pankaj@gmail.com', 'Pune', 'Pune', '411014', '1234567890'), (5, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '094052'), (6, 'Pankaj', 'Kokate', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '094052456'), (7, 'Pankaj', 'Kokate', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '094052456'), (8, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '9766449791'), (9, '', '', '', '', '', '', ''), (10, 'sds', 'sdf', 'asfawd@gmail.com', 'ssdf', 'efsef', '454545', '4798465123'), (11, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '094052'), (12, 'jbkj', 'hjbjh', 'jhbj@jhbjh.com', 'klnkn', 'klmnlkn', '566665', '1234567890'), (13, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '9405264157'), (14, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '9405264157'), (15, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Pune', 'Pune', '410504', '9405264157'), (16, 'Sumit', 'Sakpal', 'sumitsakpal02@gmail.com', 'Devgad', 'Devgad', '416613', '9405264157'); -- -------------------------------------------------------- -- -- Table structure for table `confirm_order_address` -- CREATE TABLE `confirm_order_address` ( `id` int(5) NOT NULL, `firstname` varchar(50) NOT NULL, `lastname` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `address` varchar(1000) NOT NULL, `city` varchar(50) NOT NULL, `pincode` varchar(10) NOT NULL, `contactno` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `confirm_order_product` -- CREATE TABLE `confirm_order_product` ( `id` int(5) NOT NULL, `order_id` varchar(10) NOT NULL, `product_name` varchar(150) NOT NULL, `product_price` int(5) NOT NULL, `product_qty` int(5) NOT NULL, `product_image` varchar(500) NOT NULL, `product_total` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `product` -- CREATE TABLE `product` ( `id` int(5) NOT NULL, `product_name` varchar(150) NOT NULL, `product_price` int(5) NOT NULL, `product_c_price` int(5) NOT NULL, `product_qty` int(10) UNSIGNED NOT NULL, `product_desc` varchar(1000) NOT NULL, `product_image` varchar(500) NOT NULL, `product_main_category` varchar(50) NOT NULL, `product_primary_category` varchar(50) NOT NULL, `product_secondary_category` varchar(50) NOT NULL, `product_type` varchar(150) NOT NULL, `product_brand` varchar(150) NOT NULL, `tag` varchar(150) NOT NULL, `latest` varchar(50) NOT NULL, `bestseller` varchar(50) NOT NULL, `special` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `product` -- INSERT INTO `product` (`id`, `product_name`, `product_price`, `product_c_price`, `product_qty`, `product_desc`, `product_image`, `product_main_category`, `product_primary_category`, `product_secondary_category`, `product_type`, `product_brand`, `tag`, `latest`, `bestseller`, `special`) VALUES (2, 'Lamp', 899, 1599, 8, 'This is testing', 'product_image/1c0f636b6b06d8343988dc2bb8f0ff07product-7.png', 'Home Decor', 'othershome', 'lampslightning', 'Bajaj', 'urban', 'Natural Lamp, light', 'Latest', '', ''), (6, 'Chair', 599, 899, 10, 'This is testing', 'product_image/02ee07272e0e473bf3ebd9d445d42fafproduct-2.png', 'Furniture', 'livingroom', 'chairs', 'woodchair', 'Bajaj', 'Designning Chair', '', 'BestSeller', ''), (7, 'Lamp', 499, 899, 8, 'This is testing', 'product_image/1a38e3aa6d4c10f3ba661d39bc7f05f5product-1.png', 'Home Decor', 'othershome', 'lampslightning', 'Simple lamp', 'apolo', 'Lamp', 'Latest', '', 'special'), (9, 'Chair', 499, 899, 10, 'This is Testing', 'product_image/4b545b54281a3575925255bfa50f52d0product8.png', 'Furniture', 'livingroom', 'chairs', 'Chair', 'Apolo', 'Chair', '', '', ''), (10, 'Exclusive Lamp', 1499, 2999, 8, 'This is Testing', 'product_image/23b7b424c670315d248ce0d05eea2561product-7.png', 'Home Decor', 'othershome', 'lampslightning', 'Lamp', 'Apolo', 'Exclusive Lamp', '', '', ''), (11, 'Soft Sofa', 799, 1299, 12, 'This is Testing', 'product_image/d141a88f8ee0e58d9da5dd092757040eproduct-4.png', 'Furniture', 'livingroom', 'chairs', 'Seating Sofa', 'Apolo', 'Soft Sofa, Seating chair', '', '', ''), (12, 'Green Lamp', 1499, 1999, 8, 'This is Testing', 'product_image/5b0abf32835fcc4311d9fbb22be6d22fproduct-5.png', 'Home Decor', 'othershome', 'lampslightning', 'Lamp', 'Bajaj', 'Green Lamp', 'Latest', 'BestSeller', ''), (13, 'Red Chair', 1599, 1799, 10, 'This is Testing', 'product_image/2bf39ce07c4a3879646a3e0486c011e8product8.png', 'Furniture', 'livingroom', 'chairs', 'Seating Chair', 'Apolo', 'Seating Chair, Red Chair', '', '', ''), (14, 'Lamp', 599, 799, 8, 'This is Testing ', 'product_image/dd630450cb57294006370f61b9594154product-1.png', 'Home Decor', 'othershome', 'lampslightning', 'Simple Lamp', 'Apolo', 'Simple lamp, brightness', '', '', ''), (15, 'Chair', 499, 599, 10, 'This is Testing', 'product_image/02c50037d905f33b96e756bff192e640product-3.png', 'Furniture', 'livingroom', 'chairs', 'Seating Chair', 'Apolo', 'Seating Chair, Gray Chair', '', '', ''), (16, 'Dove', 400, 500, 10, 'this is testing', 'product_image/4cc9abf3f0c266d18e1cc274be003be7dove.png', 'Home Furnishings', 'bedsheets', 'allbedsheets', 'beuty', 'Dove', 'Shampoo', '', 'BestSeller', 'special'), (17, 'Sofa', 499, 599, 10, 'this is testing', 'product_image/2b1ef112a2ca25ec0bf4f4abeb288aecproduct-4.png', 'Furniture', 'livingroom', 'chairs', 'Sofas', 'Bajaj', 'sofa', '', '', ''), (18, 'Sofa', 899, 999, 10, 'This is testing', 'product_image/0db756ed6818473efa01a0a84ab48fd0product-4.png', 'Furniture', 'livingroom', 'sofasets', 'Sofa', 'Bajaj', 'Sofa', '', '', ''), (19, 'Sofa cum Beds', 1299, 1599, 10, 'This is testing ', 'product_image/0276a2404f795be2080b602fbea381d3product-4.png', 'Furniture', 'livingroom', 'sofacumbeds', 'Sofa', 'Apolo', 'Sofa', '', '', ''), (20, 'Sofa', 799, 899, 15, 'This is testing', 'product_image/d332c5f2fd4c22a4581bba52c3b640d5product-3.png', 'Furniture', 'livingroom', 'seating', 'Seating', 'Apolo', 'Seating Chair, Gray Chair', '', '', ''), (21, 'Table', 1499, 1899, 18, 'This is testing', 'product_image/0e9a2bb92122c82096a16a40d6c2cb41product-2.png', 'Furniture', 'livingroom', 'tables', 'Table', 'Apolo', 'Table', '', '', ''), (22, 'Bed', 5800, 6999, 12, 'This is testing', 'product_image/29ba992b56e2b5f1a8c088ac27a02e03product8.png', 'Furniture', 'bedroom', 'allbeds', 'Bed', 'Bajaj', 'bed', '', '', ''), (23, 'Bed', 5000, 8000, 2, 'this is testing', 'product_image/355373054a421766485fe538845bea3dproduct-2.png', 'Furniture', 'bedroom', 'singlesizebeds', 'sofas', 'Apolo', 'Lamp', '', '', ''), (24, 'Bed', 5000, 8000, 15, 'this is testing', 'product_image/5004ba42a3055810bf1d77cd3e9bc62fproduct-3.png', 'Furniture', 'bedroom', 'doublesizebeds', 'sofas', 'Bajaj', 'sofa', '', '', ''), (25, 'Bed', 7555, 8555, 15, 'this is testing', 'product_image/6c4ce4d8d3d6e4fde7ef7e25f7db4d75product-5.png', 'Furniture', 'bedroom', 'kingsizebeds', 'Bajaj', 'bajaj', 'soft chair', '', '', ''), (26, 'Beds with storage', 799, 999, 10, 'this is testing', 'product_image/84b00c3f297dbf64e2cd62a930b62686product-1.png', 'Furniture', 'bedroom', 'bedswithstorage', 'zigzag', 'apolo', 'soft chair', '', '', ''), (27, 'Kids bEd', 599, 899, 12, 'Tthis is testing', 'product_image/b4b0250566a5ea7f3f8c44c095b4a8d0product8.png', 'Furniture', 'bedroom', 'kidsbeds', 'Lamp', 'Bajaj', 'soft chair', '', '', ''), (28, 'Bed', 899, 1599, 10, 'this is testing', 'product_image/56b9ad6b26ede0a65cb71de2989bedefproduct-3.png', 'Furniture', 'bedroom', 'mattresses', 'sofas', 'Apolo', 'Lamp', '', '', ''), (29, 'dressingTables', 5000, 17977, 2, 'This is testing', 'product_image/2f581b34d4586ae33a545d3484e82e7eproduct-2.png', 'Furniture', 'bedroom', 'dressingtable', 'sofas', 'Apolo', 'Lamp', '', '', ''), (30, 'bed side', 5000, 8000, 11, 'this is testing', 'product_image/3268a2d3be187e809da4e40f996d0fe9product-7.png', 'Furniture', 'bedroom', 'bedsidetables', 'Lamp', 'Bajaj', 'soft chair', '', '', ''), (32, '4seater', 899, 1299, 150, 'this is testing', 'product_image/2835cd21ed12d270144e20d0005b3033product-2.png', 'Furniture', 'diningroom', '4seater', 'sofas', 'werwe', 'Sofa', '', '', ''), (33, '6seater', 499, 599, 10, 'This is testing', 'product_image/63c7369c8d0ee026107dc95b02293bc6product-7.png', 'Furniture', 'diningroom', '6seater', 'zigzag', 'werwe', 'cotton sofa', '', '', ''), (34, '8seater', 899, 1599, 17, 'This is testing', 'product_image/165e0636ca617b750618ca86dbc9aecdproduct-1.png', 'Furniture', 'diningroom', '8seater', 'lamp', 'bajaj', 'soft chair', '', '', ''), (35, 'Dining Table', 4888, 5999, 15, 'this is testing', 'product_image/c6e1c7f3a2727e4fbe3e3ad491fcb494product-4.png', 'Furniture', 'diningroom', 'diningtables', 'lamp', 'werwe', 'cotton sofa', '', '', ''), (36, 'Dining Chair', 4588, 7599, 16, 'this is testing', 'product_image/c9be04c28bd2d1181fb7efbeb7775d19product-2.png', 'Furniture', 'diningroom', 'diningchairs', 'Bajaj', 'werwe', 'Sofa', '', '', ''), (37, 'Bench', 899, 1999, 15, 'this is testing', 'product_image/311b4b2768f941af7eec9e3a4aa2d93dproduct-2.png', 'Furniture', 'diningroom', 'diningbenches', 'Lamp', 'werwe', 'soft chair', '', '', ''), (38, 'Storage', 489, 984, 456, 'this is testing', 'product_image/7f08790753470bc6158b293917bb7210product-2.png', 'Furniture', 'diningroom', 'storage', 'Sofa', 'bajaj', 'chairs', '', '', ''), (39, 'Book shelves', 456, 987, 10, 'This is testing', 'product_image/50ba57f800fb768d474381cf80eea7cdproduct-2.png', 'Furniture', 'studyoffice', 'bookshelves', 'lamp', 'apolo', 'soft chair', '', '', ''), (40, 'magazine', 152, 159, 10, 'This is testing', 'product_image/3743753f5a7ad813e3b76fca0ad27cf2product-3.png', 'Furniture', 'studyoffice', 'magazinefileracks', 'Sofa', 'bajaj', 'lamp', '', '', ''), (41, 'Study Tables', 599, 999, 15, 'This is testing', 'product_image/7c93264821a07b02d0f5b6e46a574743product8.png', 'Furniture', 'studyoffice', 'studytables', 'Lamp', 'Apolo', 'soft chair', '', '', ''), (42, 'Chair', 599, 899, 2, 'This is testing', 'product_image/84e47c745e5571f34c68f5abff669116product-7.png', 'Furniture', 'studyoffice', 'officeTables', 'Bajaj', 'apolo', 'soft chair', '', '', ''), (43, 'Chair', 899, 1799, 15, 'This is testing', 'product_image/6c0f50990323dfe6ca45a9e32be3dbdaproduct-4.png', 'Furniture', 'studyoffice', 'officechairs', 'Lamp', 'Bajaj', 'lamp', '', '', ''), (44, 'Chair', 799, 899, 12, 'This is testing', 'product_image/32b1f0a0858c82198746a205641e6a6bproduct-3.png', 'Furniture', 'studyoffice', 'studychairs', 'Sofa', 'werwe', 'Lamp', '', '', ''), (45, 'Chair', 5000, 8000, 11, 'This is testing', 'product_image/5c5c2375a4e57b0a72dba49d908df010product-7.png', 'Furniture', 'outdoor', 'swings', 'sofas', 'bajaj', 'soft chair', '', '', ''), (46, 'Chair', 799, 899, 2, 'This is testing', 'product_image/8a6a622e1f4e1d741aa92fe974d076feproduct-5.png', 'Furniture', 'outdoor', 'outdoorchairs', 'sofas', 'Apolo', 'soft chair', '', '', ''), (47, 'Chair', 5000, 8000, 11, 'This is testing', 'product_image/6264c845705627934fea85bf6ce1db09product-2.png', 'Furniture', 'outdoor', 'outdoortables', 'sofas', 'Bajaj', 'sofa', '', '', ''), (48, 'Lamp', 599, 999, 12, 'This is testing', 'product_image/0bf667c8b7b0b0d5a16ab564ec1305d8product-5.png', 'Furniture', 'wardrobes', 'allwardrobes', 'Lamp', 'Apolo', 'Lamp', '', '', ''), (49, 'Bed', 899, 999, 15, 'This is testing', 'product_image/2964876d90b799a2d235d8c1048c08c5product-1.png', 'Furniture', 'wardrobes', '2doorw', 'Lamp', 'Bajaj', 'Lamp', '', '', ''), (50, '3door', 5000, 8000, 12, 'This is testing', 'product_image/350fdc2dc91ec04d55c67dcc0be799edproduct-2.png', 'Furniture', 'wardrobes', '3doorw', 'Lamp', 'Bajaj', 'soft chair', '', '', ''), (51, '4door', 5000, 8000, 11, 'This is testing', 'product_image/0b070c345a33dddcc9958c56c05ad2f0product-2.png', 'Furniture', 'wardrobes', '4doorw', 'sofas', 'bajaj', 'soft chair', '', '', ''), (52, 'Chair', 499, 999, 15, 'This is testing', 'product_image/e5f1699be8d30cd1f6c12664ff3a4aa1product8.png', 'Furniture', 'wardrobes', 'slidingdoorw', 'lamp', 'urban', 'Lamp', '', '', ''), (53, 'Bed', 799, 999, 15, 'This is testing', 'product_image/9ba708382b2b0674db9cf3c753d62d8dproduct-2.png', 'Home Furnishings', 'bedsheets', 'allbedsheets', 'sofas', 'werwe', 'soft chair', '', '', ''), (54, 'Bed', 599, 1599, 11, 'This is testing', 'product_image/f1155782fdc49c9de01605fd74483e59product-3.png', 'Home Furnishings', 'bedsheets', 'kingsizebedsheets', 'Bajaj', 'Apolo', 'soft chair', '', '', ''), (55, 'Bed', 799, 5999, 12, 'This is testing', 'product_image/26e54ece241cbe70e6835c803c4eec7fproduct8.png', 'Home Furnishings', 'bedsheets', 'singlebedsheets', 'zigzag', 'bajaj', 'soft chair', '', '', ''), (56, 'Bed', 499, 599, 11, 'This is testing', 'product_image/03fd1a52d65dc262ae7405f3dface1afproduct-2.png', 'Home Furnishings', 'bedsheets', 'fittedbedsheets', 'Sofa', 'urban', 'Lamp', '', '', ''), (57, 'Sofa', 899, 999, 10, 'This is testing', 'product_image/6fd3940d52d0c6ff8b5503878f99a0caproduct-2.png', 'Home Furnishings', 'bedsheets', 'doublebedsheets', 'Bajaj', 'werwe', 'cotton sofa', '', '', ''), (58, 'Chair', 899, 1799, 15, 'This is testing', 'product_image/955f07ce102cee63c42bf136dfd8d1fbproduct-5.png', 'Home Furnishings', 'bedding', 'bedcovers', 'zigzag', 'bajaj', 'soft chair', '', '', ''), (59, 'Bed', 599, 899, 11, 'This is testing', 'product_image/3a71c5e7b13987ef67f919b17076822cproduct-1.png', 'Home Furnishings', 'bedding', 'conforters', 'Sofa', 'urban', 'soft chair', '', '', ''), (60, 'Lamp', 5000, 8000, 15, 'This is testing', 'product_image/fcd63a2cb5385b40348339d2343aff2aproduct-7.png', 'Home Furnishings', 'bedding', 'a/c_quiltsblankets', 'sofas', 'Apolo', 'soft chair', '', '', ''), (61, 'Bed', 799, 8000, 10, 'This is testing', 'product_image/088ebb449d19a2dd7438d5cd635cee95product-2.png', 'Home Furnishings', 'bedding', 'quilts&blankets', 'lamp', 'urban', 'Sofa', '', '', ''), (62, 'Chair', 5000, 8000, 10, 'This is testing', 'product_image/a3b1b93247c1c4acb3155719bc8ebc3cproduct-1.png', 'Home Furnishings', 'pillowscovers', 'bedpillows', 'lamp', 'apolo', 'soft chair', '', '', ''), (63, 'Chair', 5000, 8000, 11, 'This is testing', 'product_image/fa8c6b576e4719cbf5728ace988ca35eproduct-2.png', 'Home Furnishings', 'pillowscovers', 'pillowcovers', 'Bajaj', 'apolo', 'soft chair', '', '', ''), (64, 'Bed', 599, 899, 10, 'This is testing', 'product_image/e445a2cfafd259e449b774f48b1b6915product-4.png', 'Home Furnishings', 'pillowscovers', 'covers&inserts', 'zigzag', 'bajaj', 'cotton sofa', '', '', ''), (65, 'towels', 899, 999, 12, 'This is testing', 'product_image/8211c80a921b53f78811f669efa8b230product-3.png', 'Home Furnishings', 'bathessentails', 'towels', 'sofas', 'werwe', 'sofa', '', '', ''), (66, 'Chair', 5000, 8000, 15, 'This is testing', 'product_image/f4be5a8bfab91a5e5e3dbdca3b9117deproduct8.png', 'Home Furnishings', 'bathessentails', 'bathmats&rugs', 'lamp', 'werwe', 'soft chair', '', '', ''), (67, 'Chair', 499, 899, 11, 'This is testing', 'product_image/b4e0504950be2635481f563a10e218b2product-3.png', 'Home Furnishings', 'bathessentails', 'bathrobes', 'Bajaj', 'werwe', 'soft chair', '', '', ''), (69, 'Bed', 799, 899, 12, 'This is testing', 'product_image/98eb1d898e26de7c457043433e7b162dproduct-2.png', 'Home Decor', 'walldecor', 'paintings', 'zigzag', 'Apolo', 'soft chair', '', '', ''), (70, 'Bed', 899, 999, 12, 'This is testing', 'product_image/326f27d53f17e55957774ae2376722a8product-7.png', 'Home Decor', 'walldecor', 'wallart', 'Bajaj', 'Bajaj', 'lamp', '', '', ''), (71, 'Bed', 799, 999, 10, 'This is testing', 'product_image/8dc9b83f66694db0fcd7c3c67d9ebae7product-7.png', 'Home Decor', 'walldecor', 'wallaccents', 'lamp', 'werwe', 'Sofa', '', '', ''), (72, 'Sofa', 599, 999, 12, 'This is testing', 'product_image/f19e05fe4d79e211f9fe9db76a1e0677product-4.png', 'Home Decor', 'candlesfragrances', 'candles', 'candles', 'apolo', 'sofa', '', '', ''), (73, 'Sofa', 599, 899, 10, 'This is testing', 'product_image/03486688aae6930544934aaf115b61d4product-5.png', 'Home Decor', 'candlesfragrances', 'candleholders', 'lamp', 'bajaj', 'lamp', '', '', ''), (74, 'Bed', 149, 599, 23, 'This is testing', 'product_image/abe1ee4b1124d124c75b99e7fe025df6product-3.png', 'Home Decor', 'candlesfragrances', 'homefragrances', 'Bajaj', 'urban', 'Lamp', '', '', ''), (75, 'Chair', 899, 1299, 12, 'This is testing', 'product_image/9ba65a07b70456e41f6d7a3a7215cbebproduct-2.png', 'Home Decor', 'othershome', 'potsplanters', 'zigzag', 'apolo', 'Lamp', '', '', ''), (76, 'Lamp', 899, 1799, 11, 'This is testing', 'product_image/426748e96049691a676cd22a3aaa8da6product-7.png', 'Home Decor', 'othershome', 'lampslightning', 'Lamp', 'werwe', 'Lamp', '', '', ''), (77, 'Chair', 1499, 899, 15, 'This is testing', 'product_image/2c745e23ff8dda0f27d1cb699a17b991product-2.png', 'Home Decor', 'othershome', 'showpieces', 'zigzag', 'Bajaj', 'soft chair', '', '', ''), (78, 'Chair', 599, 999, 15, 'This is testing', 'product_image/77336d9a2391c7c04d89ff0c69cf318fproduct-5.png', 'Home Decor', 'othershome', 'clocks', 'clocks', 'urban', 'Lamp', '', '', ''), (79, 'Lamp', 1499, 1799, 11, 'This is testing', 'product_image/8ae4898b9176d92950b1b8824038c6c8product-1.png', 'TableWare', 'cofeetea', 'cofeeteaacc', 'Sofa', 'Apolo', 'Lamp', '', '', ''), (80, 'Chair', 799, 899, 11, 'This is testing', 'product_image/df4fef87460fe9120cbdd97f2a30fd56product-2.png', 'TableWare', 'cofeetea', 'mugscups', 'sofas', 'werwe', 'soft chair', '', '', ''), (81, 'Chair', 499, 999, 15, 'This is testing', 'product_image/4ed4b633b0f7c2b058b9c0197e113afeproduct-2.png', 'TableWare', 'cofeetea', 'cofeeteasets', 'Bajaj', 'apolo', 'Lamp', '', '', ''), (82, 'Chair', 5000, 8000, 150, 'This is testing', 'product_image/de0f1ff76f1a406579e4ee68357948adproduct-2.png', 'TableWare', 'cofeetea', 'saucers', 'Sofa', 'werwe', 'soft chair', '', '', ''), (83, 'Lamp', 599, 8000, 2, 'This is testing', 'product_image/f44f7a25c0f3a2eb2bdeea8144d1d6b3product-2.png', 'TableWare', 'serving', 'candles', 'zigzag', 'urban', 'soft chair', '', '', ''), (84, 'Chair', 1499, 1799, 12, 'This is testing', 'product_image/1fe0506b852ee167ebbe43082a3d0924product-2.png', 'TableWare', 'serving', 'candleholders', 'lamp', 'bajaj', 'soft chair', '', '', ''), (85, 'Chair', 1499, 1599, 11, 'This is testing', 'product_image/99a1d5c97fe34daa36a8c1b507cd33e9product-3.png', 'TableWare', 'serving', 'homefragrances', 'Sofa', 'apolo', 'soft chair', '', '', ''), (86, 'Chair', 899, 999, 15, 'This is testing', 'product_image/7601b1959a35cddbee68ca7fe6f1d2daproduct-4.png', 'TableWare', 'tableessentials', 'tablecloths', 'Sofa', 'urban', 'sofa', '', '', ''), (87, 'Sofa', 499, 1799, 15, 'This is testing', 'product_image/f280addebc0191aff141b33ff03218a7product-4.png', 'TableWare', 'tableessentials', 'napkinsholders', 'Sofa', 'bajaj', 'Lamp', '', '', ''), (88, 'Bed', 599, 1799, 2, 'This is testing', 'product_image/cd70c31a6702e3c4661ed2a0d365b69bproduct-3.png', 'TableWare', 'otherstables', 'dinnerssets', 'Bajaj', 'apolo', 'soft chair', '', '', ''), (89, 'Chair', 599, 899, 11, 'This is testing', 'product_image/3ff6e1bafbb5d3f025b700cff408c9e6product8.png', 'TableWare', 'otherstables', 'trays', 'Lamp', 'apolo', 'Lamp', '', '', ''), (90, 'Chair', 499, 899, 12, 'This is testing', 'product_image/67574a0530c2b4b19b83e40dce52443aproduct-4.png', 'TableWare', 'otherstables', 'plates', 'zigzag', 'urban', 'soft chair', '', '', ''), (91, 'Chair', 5000, 8000, 15, 'This is testing', 'product_image/2ee53c4c9a6225242367896a8084b156product-5.png', 'TableWare', 'otherstables', 'bowls', 'Sofa', 'urban', 'soft chair', '', '', ''), (92, 'Chair', 1499, 1599, 10, 'This is testing', 'product_image/ee297ca84467511c2bb941fe86abae77product-3.png', 'KitchenWare', 'kitchen', 'foodstorage', 'lamp', 'Apolo', 'soft chair', '', '', ''), (93, 'Chair', 1499, 1599, 11, 'This is testing', 'product_image/1cf85cef703ebcaf4dab46dc254667f0product-3.png', 'KitchenWare', 'kitchen', 'kitchenorganizers', 'Lamp', 'Apolo', 'Lamp', '', '', ''), (94, 'Chair', 899, 999, 15, 'This is testing', 'product_image/6665e7132d2dba685ca41fa473e931cdproduct8.png', 'KitchenWare', 'kitchen', 'containers', 'Bajaj', 'Apolo', 'soft chair', '', '', ''), (95, 'Bed', 799, 899, 11, 'This is testing', 'product_image/64e0d046c73e72c2ced7ee8269e185adproduct8.png', 'KitchenWare', 'kitchen', 'thermoware', 'zigzag', 'Apolo', 'Lamp', '', '', ''), (96, 'Chair', 799, 999, 11, 'This is testing', 'product_image/225339a76556511d208a106aa92de54aproduct-3.png', 'KitchenWare', 'kitchentoollinen', 'ctools', 'Sofa', 'Bajaj', 'soft chair', '', '', ''), (97, 'Lamp', 899, 999, 23, 'This is testing', 'product_image/82f889840c5cace43aa85aa240bdba1bproduct-4.png', 'KitchenWare', 'kitchentoollinen', 'ptools', 'lamp', 'bajaj', 'soft chair', '', '', ''), (98, 'Bed', 599, 899, 11, 'This is testing', 'product_image/20553334736e1aeddb78de6383389aeaproduct-3.png', 'KitchenWare', 'kitchentoollinen', 'kgears', 'Lamp', 'Apolo', 'soft chair', '', '', ''), (99, 'Sofa', 799, 899, 12, 'This is testing', 'product_image/f4ea398ae5364908fd7127b035921e17product-3.png', 'KitchenWare', 'kitchentoollinen', 'Kitchenlinen', 'Bajaj', 'Apolo', 'soft chair', '', '', ''), (100, 'Bed', 899, 999, 11, 'This is testing', 'product_image/4a66cafbd6cf0505b6b2c1726d7d3329product-3.png', 'KitchenWare', 'appliances', 'chimney', 'zigzag', 'urban', 'soft chair', '', '', ''), (101, 'Lamp', 799, 899, 12, 'This is testing', 'product_image/f4f1aec433a422817d0c68d656a4c535product8.png', 'KitchenWare', 'appliances', 'oven', 'Sofa', 'Bajaj', 'Lamp', '', '', ''), (102, 'Red Chair', 499, 999, 12, 'This is testing', 'product_image/f195651a69619eb4f4f4c5f31a31c9c2product-3.png', 'KitchenWare', 'appliances', 'ctopsburners', 'sofas', 'Apolo', 'soft chair', '', '', ''), (103, 'Chair', 899, 999, 12, 'This is testing', 'product_image/a3da41f4b66ee2d4be42a99ecccfe47cproduct-3.png', 'KitchenWare', 'appliances', 'cooking', 'lamp', 'Apolo', 'soft chair', '', '', ''), (104, 'Chair', 499, 899, 10, 'This is testing', 'product_image/4f8bac9e60abd97d880cd0b524ca43f7product-3.png', 'KitchenWare', 'otherskitchen', 'cleaning', 'sofas', 'Apolo', 'soft chair', '', '', ''), (105, 'Chair', 599, 1799, 12, 'This is testing', 'product_image/54a00f8f366e579142cfd64527ee3cdeproduct8.png', 'KitchenWare', 'otherskitchen', 'laundry', 'Lamp', 'bajaj', 'soft chair', '', '', ''), (106, 'Chair', 499, 899, 11, 'This is testing', 'product_image/0b56654e3707975e391f169e41a1cbd3product-3.png', 'KitchenWare', 'otherskitchen', 'dustbins', 'Lamp', 'Apolo', 'Lamp', '', '', ''), (107, 'Lamp', 499, 599, 2, 'This is testing', 'product_image/9c17ec2752673b0d22c78d675682a0d4product-4.png', 'KitchenWare', 'otherskitchen', 'showercurtains', 'Bajaj', 'Bajaj', 'soft chair', '', '', ''), (108, 'Chair', 1499, 1799, 12, 'This is testing', 'product_image/df70bff9048cefd4fa97d93cc2361345product-2.png', 'Home Furnishings', 'bathessentails', 'showercurtains', 'zigzag', 'apolo', 'soft chair', '', '', ''), (109, 'Chair', 899, 1099, 10, 'this is testing', 'product_image/5f3e3838645cb880da817f8dc85b3d22product8.png', 'Furniture', 'livingroom', 'chairs', 'sofas', 'Apolo', 'soft chair', '', '', ''), (110, 'Chairside', 799, 899, 2, 'this is tesrglk', 'product_image/1e2c8d3d2d66422636f4c73000f0dc4bproduct-2.png', 'Furniture', 'livingroom', 'chairs', 'sofas', 'Apolo', 'Sofa', '', '', ''), (111, 'Chairside2', 799, 999, 12, 'sfbdfhbcgh', 'product_image/749d9189cb2dc98134c1de3dd91dd224product-3.png', 'Furniture', 'livingroom', 'chairs', 'lamp', 'werwe', 'Sofa', 'Latest', '', ''), (112, 'sumit', 1499, 1599, 150, 'xftjhfgh', 'product_image/4493cea8eeb098c8c41016509f8dfac3product-4.png', 'Furniture', 'livingroom', 'chairs', 'sofas', 'Bajaj', 'Sofa', 'Latest', 'BestSeller', ''), (113, 'Favourite', 500, 800, 5, 'this is testing ', 'product_image/deb6dbc7bbedf1e66cab09d0a9e065bddamro.jpg', 'Furniture', 'livingroom', 'sofasets', 'fg', 'ff', 'ff', 'Latest', '', ''); -- -- Indexes for dumped tables -- -- -- Indexes for table `admin_contact` -- ALTER TABLE `admin_contact` ADD PRIMARY KEY (`id`); -- -- Indexes for table `admin_login` -- ALTER TABLE `admin_login` ADD PRIMARY KEY (`id`); -- -- Indexes for table `checkout_address` -- ALTER TABLE `checkout_address` ADD PRIMARY KEY (`id`); -- -- Indexes for table `confirm_order_address` -- ALTER TABLE `confirm_order_address` ADD PRIMARY KEY (`id`); -- -- Indexes for table `confirm_order_product` -- ALTER TABLE `confirm_order_product` ADD PRIMARY KEY (`id`); -- -- Indexes for table `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`id`) USING BTREE; -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admin_contact` -- ALTER TABLE `admin_contact` MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `admin_login` -- ALTER TABLE `admin_login` MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `checkout_address` -- ALTER TABLE `checkout_address` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT for table `confirm_order_address` -- ALTER TABLE `confirm_order_address` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `confirm_order_product` -- ALTER TABLE `confirm_order_product` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `product` -- ALTER TABLE `product` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=114; 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 */;
-- -- PostgreSQL database dump -- -- Dumped from database version 9.5.6 -- Dumped by pg_dump version 9.5.6 ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT IF EXISTS pk_user_id CASCADE; DROP TABLE IF EXISTS public.users; DROP SEQUENCE IF EXISTS public.users_id_seq; CREATE TABLE users ( id serial NOT NULL, username varchar(255) NOT NULL, password varchar(255) NOT NULL, ); ALTER TABLE ONLY users ADD CONSTRAINT pk_user_id PRIMARY KEY (id);
-- phpMyAdmin SQL Dump -- version 4.7.0 -- https://www.phpmyadmin.net/ -- -- Hôte : 127.0.0.1 -- Généré le : mar. 16 avr. 2019 à 00:15 -- Version du serveur : 5.7.17 -- Version de PHP : 5.6.30 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 : `projet` -- -- -------------------------------------------------------- -- -- Structure de la table `demo` -- CREATE TABLE `demo` ( `id` int(11) NOT NULL, `fid` int(11) NOT NULL, `fname` varchar(50) NOT NULL, `ftype` varchar(50) NOT NULL, `desc` varchar(50) NOT NULL, `dispo` varchar(50) NOT NULL, `exp` varchar(50) NOT NULL, `cache` varchar(50) NOT NULL, `pra` varchar(50) NOT NULL, `Filiere` varchar(50) NOT NULL, `annee` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, `Semester` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, `Typed` varchar(50) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `demo` -- INSERT INTO `demo` (`id`, `fid`, `fname`, `ftype`, `desc`, `dispo`, `exp`, `cache`, `pra`, `Filiere`, `annee`, `Semester`, `Typed`) VALUES (1, 22, 'ACTIVITE D2-1.odt', 'application/octet-stream', 'File Transfer', 'attachment', '0', 'must-revalidate', 'public', 'LFT', '1', 'premier semester', 'Examen'), (1, 21, 'steam_api1.txt', 'application/octet-stream', 'File Transfer', 'attachment', '0', 'must-revalidate', 'public', 'LFT', '1', 'premier semester', 'DS'), (1, 20, 'steam_api1.txt', 'application/octet-stream', 'File Transfer', 'attachment', '0', 'must-revalidate', 'public', 'LFT', '1', 'premier semester', 'DS'), (1, 19, 'CPY123.txt', 'application/octet-stream', 'File Transfer', 'attachment', '0', 'must-revalidate', 'public', 'LART', '1', 'choisir une semester', 'Examen'), (1, 29, 'CPY2.txt', 'application/octet-stream', 'File Transfer', 'attachment', '0', 'must-revalidate', 'public', 'LFSI', '2', 'deuxième semester', 'DS'); -- -------------------------------------------------------- -- -- Structure de la table `identi` -- CREATE TABLE `identi` ( `id` int(11) NOT NULL, `nom` varchar(50) DEFAULT NULL, `prenom` varchar(50) NOT NULL, `mail` varchar(50) NOT NULL, `mdp` varchar(50) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `identi` -- INSERT INTO `identi` (`id`, `nom`, `prenom`, `mail`, `mdp`) VALUES (1, 'admin', 'admin', 'admin@admin.com', 'admin'), (4, 'admin1', 'admin1', 'admin@admin.fr', 'admin1'); -- -- Index pour les tables déchargées -- -- -- Index pour la table `demo` -- ALTER TABLE `demo` ADD PRIMARY KEY (`fid`), ADD KEY `id` (`id`); -- -- Index pour la table `identi` -- ALTER TABLE `identi` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT pour les tables déchargées -- -- -- AUTO_INCREMENT pour la table `demo` -- ALTER TABLE `demo` MODIFY `fid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32; -- -- AUTO_INCREMENT pour la table `identi` -- ALTER TABLE `identi` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump -- version 4.7.0 -- https://www.phpmyadmin.net/ -- -- Hôte : 127.0.0.1 -- Généré le : lun. 25 fév. 2019 à 15:26 -- Version du serveur : 5.7.17 -- Version de PHP : 7.1.3 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 : `where_is_my_friend` -- -- -------------------------------------------------------- -- -- Structure de la table `friends` -- CREATE TABLE `friends` ( `idUser` int(11) NOT NULL, `idFriend` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `friends` -- INSERT INTO `friends` (`idUser`, `idFriend`) VALUES (7, 8); -- -------------------------------------------------------- -- -- Structure de la table `messages` -- CREATE TABLE `messages` ( `idMessage` int(11) NOT NULL, `idUserSent` int(11) NOT NULL, `idUserReceived` int(11) NOT NULL, `message` text NOT NULL, `dateSent` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Structure de la table `users` -- CREATE TABLE `users` ( `idUser` int(11) NOT NULL, `email` varchar(50) NOT NULL, `password` varchar(40) NOT NULL, `salt` varchar(50) NOT NULL, `lastName` varchar(50) NOT NULL, `firstName` varchar(50) NOT NULL, `adress` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Déchargement des données de la table `users` -- INSERT INTO `users` (`idUser`, `email`, `password`, `salt`, `lastName`, `firstName`, `adress`) VALUES (7, 'gawen.ackrm@eduge.ch', '8e2de782b390fa219acd03f1a04579c2ba963e11', '2147483647', 'Ackermann', 'Gawen', 'Charmille, 1289, rue de la pigale 47'), (8, 'Jonathane@gmail.comd', '2b6c0cd77101d36cdd75f9042db558dce87b973b', '2147483647', 'Borel-Jaquet', 'Jonathan', 'Rue de Fremis 47, 1241 Puplinge'); -- -- Index pour les tables déchargées -- -- -- Index pour la table `friends` -- ALTER TABLE `friends` ADD PRIMARY KEY (`idUser`,`idFriend`), ADD KEY `idFriend` (`idFriend`); -- -- Index pour la table `messages` -- ALTER TABLE `messages` ADD PRIMARY KEY (`idMessage`), ADD KEY `idUserSent` (`idUserSent`), ADD KEY `idUserReceived` (`idUserReceived`); -- -- Index pour la table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`idUser`); -- -- AUTO_INCREMENT pour les tables déchargées -- -- -- AUTO_INCREMENT pour la table `messages` -- ALTER TABLE `messages` MODIFY `idMessage` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT pour la table `users` -- ALTER TABLE `users` MODIFY `idUser` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- Contraintes pour les tables déchargées -- -- -- Contraintes pour la table `friends` -- ALTER TABLE `friends` ADD CONSTRAINT `friends_ibfk_1` FOREIGN KEY (`idUser`) REFERENCES `users` (`idUser`), ADD CONSTRAINT `friends_ibfk_2` FOREIGN KEY (`idFriend`) REFERENCES `users` (`idUser`); -- -- Contraintes pour la table `messages` -- ALTER TABLE `messages` ADD CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`idUserSent`) REFERENCES `users` (`idUser`), ADD CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`idUserReceived`) REFERENCES `users` (`idUser`); 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 */;
select age, gender, height, id from initial where cust_id = $1
SELECT last_name, first_name, points, points * 10 + 100 AS 'discount factor' FROM customers
CREATE TABLE USERS ( USERNAME VARCHAR(50) PRIMARY KEY, PASSWORD VARCHAR(255) NOT NULL, ENABLED BOOLEAN NOT NULL ); -- password is "password" (no quotes) INSERT INTO USERS (USERNAME, PASSWORD, ENABLED) VALUES ('admin', '$2a$08$tm.em86uS8vNBca1Ljlpv.x9QU122s8PoSWiL21vNNUJWhCWbs8tW', TRUE);
SET ECHO ON -- -- -- Asn3SetupHotels.sql -- Sample data for Comp2714 SQL Assignments -- ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD'; DROP TABLE Booking; DROP TABLE Guest; DROP TABLE Room; DROP TABLE Hotel; -- -- Create Sample Tables for assignment -- NOTE: the following is NOT necessary good practices! -- CREATE TABLE Hotel (hotelNo NUMBER(4) NOT NULL ,hotelName VARCHAR2(16) NOT NULL ,hotelAddress VARCHAR2(40) NOT NULL ,PRIMARY KEY (hotelNo) ); CREATE TABLE Room (hotelNo NUMBER(4) NOT NULL ,roomNo NUMBER(4) NOT NULL ,type VARCHAR2(8) NOT NULL ,price NUMBER(6,2) NOT NULL ,PRIMARY KEY (hotelNo, roomNo) ); CREATE TABLE Guest (guestNo NUMBER(4) NOT NULL ,guestName VARCHAR2(15) NOT NULL ,guestAddress VARCHAR2(40) NOT NULL ,PRIMARY KEY (guestNo) ); CREATE TABLE Booking (hotelNo NUMBER(4) NOT NULL ,guestNo NUMBER(4) NOT NULL ,dateFrom DATE NOT NULL ,dateTo DATE ,roomNo NUMBER(4) NOT NULL ,PRIMARY KEY (hotelNo, guestNo, dateFrom) ); -- -- Insert Sample Data -- INSERT INTO Hotel VALUES (1, 'Grosvenor Hotel', '100 Oxford Road, London'); INSERT INTO Hotel VALUES (2, 'Meridian Hotel', '789 Howe Street, Vancouver'); INSERT INTO Hotel VALUES (3, 'Holiday Inn', '56 Edinburg Square, London'); INSERT INTO Hotel VALUES (4, 'The Ramada', '22 Memorial Avenue, New York'); INSERT INTO Hotel VALUES (5, 'Imperial Palace', '777 Lonsdale, North Vancouver'); INSERT INTO Hotel VALUES (6, 'Park Royal Hotel', '88 JANine Drive, West Vancouver'); INSERT INTO Hotel VALUES (7, 'Delta Inn', '900 Burrard Street, Vancouver'); INSERT INTO Hotel VALUES (8, 'Grosvenor Inn', '123 Granville Street, Vancouver'); INSERT INTO Hotel VALUES (9, 'Royale London', '500 Cambridge Road, London'); INSERT INTO Hotel VALUES (10, 'Olympic Resort', '223 Olympic Street, Whistler'); -- INSERT INTO Room VALUES (1, 1, 'Single', 40); INSERT INTO Room VALUES (1, 2, 'Single', 40); INSERT INTO Room VALUES (1, 3, 'Single', 40); INSERT INTO Room VALUES (1, 4, 'Single', 40); INSERT INTO Room VALUES (1, 5, 'Double', 55); INSERT INTO Room VALUES (1, 6, 'Double', 55); INSERT INTO Room VALUES (1, 7, 'Double', 55); INSERT INTO Room VALUES (1, 8, 'Double', 55); INSERT INTO Room VALUES (1, 9, 'Family', 85); INSERT INTO Room VALUES (1, 10, 'Family', 90); INSERT INTO Room VALUES (1, 11, 'Deluxe', 110); INSERT INTO Room VALUES (1, 12, 'Deluxe', 120); INSERT INTO Room VALUES (1, 13, 'Deluxe', 120); INSERT INTO Room VALUES (2, 1, 'Double', 80); INSERT INTO Room VALUES (2, 2, 'Double', 80); INSERT INTO Room VALUES (2, 3, 'Double', 80); INSERT INTO Room VALUES (2, 4, 'Double', 80); INSERT INTO Room VALUES (2, 5, 'Double', 80); INSERT INTO Room VALUES (2, 6, 'Family', 90); INSERT INTO Room VALUES (2, 7, 'Family', 90); INSERT INTO Room VALUES (2, 8, 'Family', 90); INSERT INTO Room VALUES (2, 9, 'Family', 90); INSERT INTO Room VALUES (2, 10, 'Deluxe', 150); INSERT INTO Room VALUES (2, 11, 'Deluxe', 150); INSERT INTO Room VALUES (2, 12, 'Deluxe', 150); INSERT INTO Room VALUES (3, 1, 'Single', 35); INSERT INTO Room VALUES (3, 2, 'Single', 35); INSERT INTO Room VALUES (3, 3, 'Single', 35); INSERT INTO Room VALUES (3, 4, 'Single', 35); INSERT INTO Room VALUES (3, 5, 'Single', 35); INSERT INTO Room VALUES (3, 6, 'Single', 35); INSERT INTO Room VALUES (3, 7, 'Single', 35); INSERT INTO Room VALUES (3, 8, 'Single', 35); INSERT INTO Room VALUES (3, 9, 'Double', 50); INSERT INTO Room VALUES (3, 10, 'Double', 50); INSERT INTO Room VALUES (3, 11, 'Double', 50); INSERT INTO Room VALUES (3, 12, 'Double', 50); INSERT INTO Room VALUES (3, 13, 'Double', 50); INSERT INTO Room VALUES (3, 14, 'Double', 50); INSERT INTO Room VALUES (4, 1, 'Double', 100); INSERT INTO Room VALUES (4, 2, 'Double', 100); INSERT INTO Room VALUES (4, 3, 'Double', 100); INSERT INTO Room VALUES (4, 4, 'Double', 100); INSERT INTO Room VALUES (4, 5, 'Double', 100); INSERT INTO Room VALUES (4, 6, 'Double', 100); INSERT INTO Room VALUES (4, 7, 'Family', 160); INSERT INTO Room VALUES (4, 8, 'Family', 160); INSERT INTO Room VALUES (4, 9, 'Family', 160); INSERT INTO Room VALUES (4, 10, 'Family', 160); INSERT INTO Room VALUES (4, 11, 'Family', 160); INSERT INTO Room VALUES (4, 12, 'Deluxe', 240); INSERT INTO Room VALUES (4, 13, 'Deluxe', 240); INSERT INTO Room VALUES (4, 14, 'Deluxe', 240); INSERT INTO Room VALUES (4, 15, 'Deluxe', 240); INSERT INTO Room VALUES (4, 16, 'Deluxe', 240); INSERT INTO Room VALUES (5, 1, 'Double', 80); INSERT INTO Room VALUES (5, 2, 'Double', 80); INSERT INTO Room VALUES (5, 3, 'Double', 80); INSERT INTO Room VALUES (5, 4, 'Double', 80); INSERT INTO Room VALUES (5, 5, 'Double', 80); INSERT INTO Room VALUES (5, 6, 'Double', 80); INSERT INTO Room VALUES (5, 7, 'Family', 120); INSERT INTO Room VALUES (5, 8, 'Family', 120); INSERT INTO Room VALUES (5, 9, 'Family', 120); INSERT INTO Room VALUES (5, 10, 'Family', 120); INSERT INTO Room VALUES (5, 11, 'Family', 120); INSERT INTO Room VALUES (5, 12, 'Family', 120); INSERT INTO Room VALUES (5, 13, 'Deluxe', 145); INSERT INTO Room VALUES (5, 14, 'Deluxe', 145); INSERT INTO Room VALUES (5, 15, 'Deluxe', 145); INSERT INTO Room VALUES (5, 16, 'Deluxe', 145); INSERT INTO Room VALUES (5, 17, 'Deluxe', 145); INSERT INTO Room VALUES (5, 18, 'Deluxe', 145); INSERT INTO Room VALUES (6, 1, 'Single', 48); INSERT INTO Room VALUES (6, 2, 'Single', 48); INSERT INTO Room VALUES (6, 3, 'Single', 48); INSERT INTO Room VALUES (6, 4, 'Single', 48); INSERT INTO Room VALUES (6, 5, 'Single', 48); INSERT INTO Room VALUES (6, 6, 'Single', 48); INSERT INTO Room VALUES (6, 7, 'Single', 48); INSERT INTO Room VALUES (6, 8, 'Single', 48); INSERT INTO Room VALUES (6, 9, 'Double', 86); INSERT INTO Room VALUES (6, 10, 'Double', 86); INSERT INTO Room VALUES (6, 11, 'Double', 86); INSERT INTO Room VALUES (6, 12, 'Double', 86); INSERT INTO Room VALUES (6, 13, 'Double', 86); INSERT INTO Room VALUES (6, 14, 'Double', 86); INSERT INTO Room VALUES (6, 15, 'Double', 86); INSERT INTO Room VALUES (6, 16, 'Double', 86); INSERT INTO Room VALUES (7, 1, 'Double', 75); INSERT INTO Room VALUES (7, 2, 'Double', 75); INSERT INTO Room VALUES (7, 3, 'Double', 75); INSERT INTO Room VALUES (7, 4, 'Double', 75); INSERT INTO Room VALUES (7, 5, 'Double', 75); INSERT INTO Room VALUES (7, 6, 'Double', 75); INSERT INTO Room VALUES (7, 7, 'Double', 75); INSERT INTO Room VALUES (7, 8, 'Double', 75); INSERT INTO Room VALUES (7, 9, 'Double', 75); INSERT INTO Room VALUES (7, 10, 'Double', 75); INSERT INTO Room VALUES (7, 11, 'Double', 75); INSERT INTO Room VALUES (7, 12, 'Double', 75); INSERT INTO Room VALUES (8, 1, 'Double', 95); INSERT INTO Room VALUES (8, 2, 'Double', 95); INSERT INTO Room VALUES (8, 3, 'Double', 95); INSERT INTO Room VALUES (8, 4, 'Double', 95); INSERT INTO Room VALUES (8, 5, 'Double', 95); INSERT INTO Room VALUES (8, 6, 'Family', 125); INSERT INTO Room VALUES (8, 7, 'Family', 125); INSERT INTO Room VALUES (8, 8, 'Family', 125); INSERT INTO Room VALUES (8, 9, 'Family', 125); INSERT INTO Room VALUES (8, 10, 'Family', 125); INSERT INTO Room VALUES (8, 11, 'Deluxe', 155); INSERT INTO Room VALUES (8, 12, 'Deluxe', 155); INSERT INTO Room VALUES (8, 13, 'Deluxe', 155); INSERT INTO Room VALUES (8, 14, 'Deluxe', 155); INSERT INTO Room VALUES (8, 15, 'Deluxe', 155); INSERT INTO Room VALUES (8, 16, 'Single', 45); INSERT INTO Room VALUES (8, 17, 'Single', 45); INSERT INTO Room VALUES (8, 18, 'Single', 45); INSERT INTO Room VALUES (8, 19, 'Single', 45); INSERT INTO Room VALUES (8, 20, 'Single', 45); -- INSERT INTO Guest VALUES (1, 'Tony Saunders', '2000 Queens Avenue, Winnipeg'); INSERT INTO Guest VALUES (2, 'Ed Cunningham', '30 Oak Street, Vancouver'); INSERT INTO Guest VALUES (3, 'Dawn Smith', '25 Walton Drive, Banff'); INSERT INTO Guest VALUES (4, 'George Michaels', '30 Hampton Street, London'); INSERT INTO Guest VALUES (5, 'Rick Hamilton', '987 King Edward Road, London'); INSERT INTO Guest VALUES (6, 'Floyd Mann', '8 Wascana Crescent, Regina'); INSERT INTO Guest VALUES (7, 'Thomas Lee', '200 Main Street, Vancouver'); INSERT INTO Guest VALUES (8, 'Sandy Alford', '234 Ontario Street, Montreal'); INSERT INTO Guest VALUES (9, 'Peter Kennedy', '20 Austin Drive, London'); INSERT INTO Guest VALUES (10, 'Gordon Ho', '5 No. 3 Road, Richmond'); INSERT INTO Guest VALUES (11, 'Diana Darby', '50 Robson Street, Vancouver'); INSERT INTO Guest VALUES (12, 'Sundeep Mohan', '1000 Victoria Avenue, London'); INSERT INTO Guest VALUES (13, 'Eileen Reynolds', '100 Willow Stree, Calgary'); INSERT INTO Guest VALUES (14, 'Ken Matsuda', '333 100th Avenue, Vancouver'); INSERT INTO Guest VALUES (15, 'Ivan Pratt', '20 Lincoln Square, London'); -- INSERT INTO Booking VALUES (1, 5, DATE'2016-09-16', DATE'2016-09-18', 7); INSERT INTO Booking VALUES (1, 9, DATE'2016-09-27', DATE'2016-10-04', 5); INSERT INTO Booking VALUES (1, 9, DATE'2016-10-07', DATE'2016-10-14', 5); INSERT INTO Booking VALUES (1, 9, DATE'2016-11-07', DATE'2016-11-14', 5); INSERT INTO Booking VALUES (1, 10, DATE'2016-11-22', DATE'2016-11-30', 1); INSERT INTO Booking VALUES (1, 11, DATE'2016-10-05', DATE'2016-10-22', 3); INSERT INTO Booking VALUES (1, 12, DATE'2016-09-21', DATE'2016-10-24', 4); INSERT INTO Booking VALUES (1, 13, DATE'2016-09-30', NULL, 7); INSERT INTO Booking VALUES (1, 14, DATE'2016-09-25', DATE'2016-09-28', 2); INSERT INTO Booking VALUES (1, 15, DATE'2016-09-22', DATE'2016-10-02', 3); INSERT INTO Booking VALUES (2, 1, DATE'2016-09-21', DATE'2016-09-23', 9); INSERT INTO Booking VALUES (2, 6, DATE'2016-09-21', NULL, 10); INSERT INTO Booking VALUES (3, 2, DATE'2016-09-26', NULL, 3); INSERT INTO Booking VALUES (3, 6, DATE'2016-11-05', DATE'2016-11-07', 12); INSERT INTO Booking VALUES (4, 11, DATE'2016-09-27', DATE'2016-09-28', 14); INSERT INTO Booking VALUES (4, 7, DATE'2016-10-09', DATE'2016-10-11', 4); INSERT INTO Booking VALUES (4, 8, DATE'2016-11-10', DATE'2016-11-18', 7); INSERT INTO Booking VALUES (5, 3, DATE'2016-10-05', DATE'2016-10-08', 17); INSERT INTO Booking VALUES (5, 11, DATE'2016-10-04', NULL, 16); INSERT INTO Booking VALUES (6, 1, DATE'2016-09-30', DATE'2016-10-02', 5); INSERT INTO Booking VALUES (6, 14, DATE'2016-11-06', DATE'2016-11-08', 8); INSERT INTO Booking VALUES (6, 9, DATE'2016-11-06', NULL, 4); INSERT INTO Booking VALUES (7, 15, DATE'2016-10-28', DATE'2016-11-05', 1); INSERT INTO Booking VALUES (7, 4, DATE'2016-10-02', DATE'2016-10-04', 2); INSERT INTO Booking VALUES (8, 1, DATE'2016-10-03', DATE'2016-11-26', 15); INSERT INTO Booking VALUES (8, 12, DATE'2016-10-01', DATE'2016-11-07', 20); INSERT INTO Booking VALUES (8, 5, DATE'2016-09-19', DATE'2016-10-28', 1); -- COMMIT; SPOOL C:\Users\Kunlaya\workspace\COMP2714\Assignments\Sample\asnment4 -- -- ---------------------------------------------------------- -- START C:\Work\Assn3\Asn3_LeeHs.sql -- --------------------------------------------------------- -- COMP 2714 -- SET 2D -- Assignment Asn03 -- Kung, Camillus A00785290 -- Lee, Hansol A00966991 -- email: camillus.kung@gmail.com -- email: hlee379@bcit.ca -- --------------------------------------------------------- -- --------------------------------------------------------- -- Q1. What is the average price of a room in London? -- .a) Do this using JOIN, b) Do this using IN subquery. -- --------------------------------------------------------- -- a) SELECT AVG(r.price) AS "London_Average_price" FROM Hotel h INNER JOIN Room r ON h.hotelNo = r.hotelNo WHERE h.hotelAddress LIKE '%London%' ; -- b) SELECT AVG(r.price) AS "London_Average_price" FROM Room r WHERE hotelNo IN (SELECT hotelNo FROM Hotel h WHERE hotelAddress LIKE '%London%'); -- --------------------------------------------------------- -- Q2. Use the month of 2016-10 instead of August, and do the query -- for each hotel, --listing in hotelName order: i.e. -- How many different guests have made bookings for -- 2016-10 for each hotel? -- --------------------------------------------------------- SELECT h.hotelName, b.dateFrom, b.dateTo, SUM(DISTINCT b.guestNo) AS "countguest" FROM Hotel h INNER JOIN Booking b ON h.hotelNo = b.hotelNo WHERE (dateTo IS NULL OR dateTo >= DATE'2016-10-01') AND dateFrom < DATE'2016-11-01' GROUP BY hotelName, dateFrom, b.dateTo ORDER BY hotelName; -- -------------------------------------------------------- -- Q3. Use 2016-10-06 as today's date. Include all 'Grosvenor' hotels. -- List in hotelNo, roomNo order. -- -------------------------------------------------------- SELECT hotelName, a.roomNo, type, price, guestName FROM (SELECT hotelNo, hotelName, roomNo, type, price FROM Hotel h NATURAL JOIN Room r WHERE hotelName LIKE '%Grosvenor%') a lEFT JOIN (SELECT hotelNo, roomNo, GuestName FROM Booking b LEFT JOIN Guest g ON b.guestNo = g.guestNo where dateFrom <= DATE'2016-10-06' AND (dateTo IS NULL OR dateTo >= DATE'2016-10-06')) b ON a.hotelNo = b.hotelNo AND a.roomNO = b.roomNo ORDER BY a.hotelNo, a.roomNo; -- -------------------------------------------------------- -- Q4. Use 2016-10-06 as today's date. Include all 'Grosvenor' hotels. -- List in hotelNo, roomNo order. Use NOT IN. -- -------------------------------------------------------- SELECT hotelname, hotelNo, roomNo, type, price FROM Hotel NATURAL JOIN Room WHERE hotelName LIKE '%Grosvenor%' AND (hotelNo, roomNo) NOT IN (SELECT hotelNo, roomNo FROM Booking WHERE dateFrom <= DATE'2016-10-06' AND (dateTo IS NULL OR dateTo >= DATE'2016-10-06') ) ORDER BY hotelNo, roomNo; -- -------------------------------------------------------- -- Q5. Use 2016-10-06 as today's date. Include all 'Grosvenor' hotels. -- List in hotelNo, roomNo order. Use NOT EXISTS. -- -------------------------------------------------------- SELECT h.hotelName, h.hotelNo, r.roomNo, r.type, r.price FROM Hotel h INNER JOIN Room r ON h.hotelNo = r.hotelNo WHERE hotelName LIKE '%Grosvenor%' AND NOT EXISTS (SELECT b.hotelNo, b.roomNo FROM Booking b WHERE r.hotelNo = b.hotelNo AND r.roomNo = b.roomNo AND dateFrom <= DATE'2016-10-06' AND (dateTo IS NULL OR dateTo >= DATE'2016-10-06') ) ORDER BY hotelNo, roomNo; -- -------------------------------------------------------- -- !!!!Q6. Use 2016-10-06 as today's date. Include all 'Grosvenor' hotels. -- List in hotelNo, roomNo order. Use LEFT JOIN. -- -------------------------------------------------------- SELECT a.hotelName, a.hotelNo, a.roomNo, a.type, a.price FROM (SELECT hotelName, hotelNo, roomNo, type, price FROM Hotel NATURAL JOIN Room WHERE hotelName LIKE '%Grosvenor%') a LEFT JOIN (SELECT hotelNo, roomNo FROM Booking WHERE dateFrom <= DATE'2016-10-06' AND (dateTo IS NULL OR dateTo >= DATE'2016-10-06')) b ON a.hotelNo = b.hotelNo AND a.roomNo = b.roomNo WHERE b.hotelno IS NULL AND b.roomno IS NULL ORDER BY a.hotelNO, a.roomNo; -- -------------------------------------------------------- -- !!!!Q7. (6.20 - 5 mks) Use 2016-10-06 as today's date. Include all 'Grosvenor' --hotels. List in hotelNo, roomNo order. Use MINUS. -- -------------------------------------------------------- SELECT hotelName, hotelNo, roomNo, type, price FROM Hotel NATURAL JOIN Room WHERE hotelName LIKE '%Grosvenor%' MINUS SELECT hotelName, hotelNo, roomNo, type, price From Hotel NATURAL JOIN Room NATURAL JOIN Booking WHERE dateFrom <= DATE'2016-10-06' AND (dateTo IS NULL OR dateTo >= DATE'2016-10-06') ORDER By hotelNo, roomNo ; -- -------------------------------------------------------- -- Q8. What is the average number of bookings for each hotel -- in 2016-10 -- Use the month of 2016-10 instead of August. --- -------------------------------------------------------- SELECT AVG(COUNT(guestNo)) AS Avg_Bookings FROM Booking b WHERE (dateTo IS NULL OR dateTo >= DATE'2016-10-01') AND dateFrom < DATE'2016-11-01' GROUP BY b.hotelNo; -- -------------------------------------------------------- -- Q9. What is the lost income from unoccupied rooms at each hotel today -- Use 2016-10-06 as today's date. List hotelNo, hotelName and LostIncome, -- in hotelNo order. -- -------------------------------------------------------- SELECT h.hotelName, h.hotelNo, SUM(price) AS LostIncome FROM Hotel h INNER JOIN Room r ON h.hotelNo = r.hotelNo WHERE (r.hotelNo, r.roomNo) NOT IN (SELECT hotelNo, roomNo FROM Booking b WHERE dateFrom <= DATE'2016-10-06' AND (dateTo IS NULL OR dateTo >= DATE'2016-10-06') ) GROUP BY h.hotelNo, h.hotelName ORDER BY h.hotelNo; -- -------------------------------------------------------- -- W10. Use 2016-10-06 as today, and guestAccount as view name. [The account -- info for -- each guest means: Room (roomNo), Name (guestName), Check-in -- (dateFrom), Check-out (dateTo=today), Rate (price), #Days (calculate from -- dateTo and dateFrom), and Total (calculate from dateTo, dateFrom and price).] -- Add a query to test the view -- -------------------------------------------------------- DROP VIEW guestAccount; -- CREATE VIEW guestAccount (Room, Name, CheckIn, CheckOut, Rate, Days, Total) AS SELECT b.roomNo, g.guestName, b.dateFrom, b.dateTo, r.price, b.dateTo - b.dateFrom, (b.dateTo - b.dateFrom) * r.price FROM Hotel h INNER JOIN Room r ON h.hotelNo = r.hotelNo INNER JOIN Booking b ON r.hotelNo = b.hotelNo AND r.roomNo = b.roomNo INNER JOIN Guest g ON b.guestNo = g.guestNo WHERE h.hotelName = 'Grosvenor Hotel' AND dateFrom <= DATE'2016-10-06' AND (dateTo IS NULL OR dateTo >= DATE'2016-10-06'); -- GRANT SELECT ON guestAccount TO system; -- SELECT * FROM guestAccount ORDER BY Room; SPOOL OFF
SELECT a.INVOICE_NO --a.债权号 , a.CANCEL_FLG --a.取消状态 , a.FACTORING_STATUS --a.放款状态 , a.BUYER_REPAY_STATUS --a.债权还款状态 , a.TRADE_EXCEPTION_TYPE --a.账款异常种类 , a.BILLING_DATE --a.开始日 , a.FINISH_STATUS --a.结清状态 , ISNULL(b.CREDIT_NOTE,0) AS CREDIT_NOTE --b.贷项清单 , ISNULL(c.ACCOUNTS_ABNORMAL,0) AS ACCOUNTS_ABNORMAL --c.账款异常 FROM INVOICE_INFO AS a --债权 LEFT JOIN ( SELECT INVOICE_ID --债权ID , COUNT(1) AS CREDIT_NOTE --贷项清单 FROM CREDIT_NOTE_APPLY_INFO --贷项清单 WHERE STATUS = /*applyStatusApplying*/'02' --申请状态 = 02(申请中)) AND DELETE_FLG <> /*codeCancalStateCanceled*/'2' --取消状态 <> 2:取消済 GROUP BY INVOICE_ID ) AS b ON a.INVOICE_ID = b.INVOICE_ID LEFT JOIN ( SELECT INVOICE_ID --债权 ID , COUNT(1) AS ACCOUNTS_ABNORMAL --账款异常 FROM ACCOUNTS_ABNORMAL_APPLY_INFO --账款异常 WHERE ACCOUNTS_ABNORMAL_STATE = /*applyStatusApplying*/'02' --申请状态 = 02(申请中)) AND DELETE_FLG <> /*codeCancalStateCanceled*/'2' --取消状态 <> 2:取消済 GROUP BY INVOICE_ID ) AS c ON a.INVOICE_ID = c.INVOICE_ID WHERE a.INVOICE_ID = /*invoiceId*/('') --a.债权ID = 参数.债权ID数组
DROP TABLE IF EXISTS test_floats; CREATE TABLE test_floats ( f_real real, f_double double precision ); INSERT INTO test_floats (f_real, f_double) VALUES (null, null); INSERT INTO test_floats (f_real, f_double) VALUES (0, 0); INSERT INTO test_floats (f_real, f_double) VALUES (1, 2); INSERT INTO test_floats (f_real, f_double) VALUES (-1, -2);
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 06-03-2019 a las 20:25:08 -- Versión del servidor: 10.1.38-MariaDB -- Versión de PHP: 7.3.2 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de datos: `univer_db` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `alumnos` -- CREATE TABLE `alumnos` ( `codigo` int(11) NOT NULL, `nombre` varchar(100) NOT NULL, `telefono` varchar(10) NOT NULL, `direccion` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=armscii8; -- -- Volcado de datos para la tabla `alumnos` -- INSERT INTO `alumnos` (`codigo`, `nombre`, `telefono`, `direccion`) VALUES (1, 'FERNANDO HERRERA SORIANO', '99498877', 'Colonia el porvenir, cerca del cerro Juana Mendoza'), (2, 'MELISSA FLORES HERRERA', '98883322', 'Provincia de aguas calientes, frente al mercadito los tres hermanos.'), (3, 'HERNANDO RENE VALLEJO', '33223323', 'Departamento Ascapotzalco, por la estacion del metro'), (4, 'MARIA PEREZ SOLANO', '33229988', 'Barranquilla, contiguo a la universidad.'), (5, 'ROSA JIMENEZ PEREIRA', '33221243', 'No tiene direccion'), (6, 'JUAN CARLOS PINEDA', '77435434', 'No tiene direccion'); -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `alumnos` -- ALTER TABLE `alumnos` ADD PRIMARY KEY (`codigo`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `alumnos` -- ALTER TABLE `alumnos` MODIFY `codigo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
drop procedure if exists atualizar; CALL atualizar (170, 'LIVROS', 'tenho', 1); select * from LIVROS where id = 170; DELIMITER $$ CREATE PROCEDURE atualizar( in idInput SMALLINT, in tabela VARCHAR(20), in coluna VARCHAR(20), in valor varchar(100) ) BEGIN set @tab = tabela; set @col = coluna; set @val = valor; set @idIn = idInput; set @concate = concat('update ' + @@tab + ' set ' + @@col + '= ? where id = ?'); PREPARE stm1 FROM @concate; set @a = @val; set @b = @idIn; EXECUTE stm1 using @a, @b; DEALLOCATE PREPARE stm1; END $$ DELIMITER ; Error Code: 1193. Unknown system variable 'tab'
CREATE TABLE BuckerList.table_user( id_user SERIAL PRIMARY KEY, user_name CHAR(45) NULL, user_username CHAR(45) NULL, user_password CHAR(45) NULL );
BEGIN TRANSACTION; PRAGMA foreign_keys = ON; -- metadata table. some blabla mostly for later. CREATE TABLE metadata ( id INTEGER PRIMARY KEY, key TEXT, value TEXT ); INSERT INTO metadata VALUES(1,'Skemapack version',0.1); INSERT INTO metadata VALUES(2,'Generator','<none>'); INSERT INTO metadata VALUES(3,'Description','Basic db used for initialization'); INSERT INTO metadata VALUES(4,'Basedata origin','BaseDb.sqlite'); INSERT INTO metadata VALUES(5,'Title','No data'); -- table containing all teachers to be used by the system. CREATE TABLE teachers ( id INTEGER PRIMARY KEY, initials TEXT, name TEXT ); INSERT INTO teachers( initials, name ) VALUES('MON','Morten'); INSERT INTO teachers( initials, name ) VALUES('PFL','Poul'); INSERT INTO teachers( initials, name ) VALUES('PDA','Per'); INSERT INTO teachers( initials, name ) VALUES('PSS','Peder'); INSERT INTO teachers( initials, name ) VALUES('SUN','Susanne'); INSERT INTO teachers( initials, name ) VALUES('VL','Viggo'); INSERT INTO teachers( initials, name ) VALUES('HHAL','Helge'); INSERT INTO teachers( initials, name ) VALUES('BSZ','Bettina'); INSERT INTO teachers( initials, name ) VALUES('JLU','Jan'); INSERT INTO teachers( initials, name ) VALUES('IMR','Ib'); INSERT INTO teachers( initials, name ) VALUES('KESM','Kent'); INSERT INTO teachers( initials, name ) VALUES('SK','Stig'); INSERT INTO teachers( initials, name ) VALUES('HKR','Henrik'); INSERT INTO teachers( initials, name ) VALUES('NN','Endnu ukendt 1'); INSERT INTO teachers( initials, name ) VALUES('NN2','Endnu ukendt 2'); -- table containing class names CREATE TABLE classes ( id INTEGER PRIMARY KEY, name TEXT, alias_in_tf TEXT, official_denomination TEXT -- The offical name of the class in the schools systems. ); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("1. semester network", "1. Sem B Netværk", "asdf1234"); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("2. semester network", "2. semester Network", "asdf1235"); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("3. semester network", "3. Sem B Netværk", "asdf1236"); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("3. semester network", "3.Networks", "asdf1236"); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("4. semester network", "4. Communication", "asdf1237"); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("1. semester electronics", "1. Sem A Elektronik", "asdf1234"); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("2. semester electronics", "2. Sem Electronics", "asdf1235"); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("3. semester electronics", "3. Electronics", "asdf1236"); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("4. semester electronics", "4. Elektronik og Data", "asdf1237"); INSERT INTO classes( name, alias_in_tf, official_denomination) VALUES("4. semester electronics", "4. Networks", "asdf1237"); -- table containing semester definitions CREATE TABLE semesters ( id INTEGER PRIMARY KEY, long_name TEXT, Short_name TEXT, StartDate date, EndDate date ); -- activity table. -- the table with all activities like courses and vacation. CREATE TABLE activities ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, alias_in_tf TEXT, teacher_id INTEGER, class_id INTEGER, semester_id INTEGER, prep_factor REAL, FOREIGN KEY(teacher_id) REFERENCES teachers(id) FOREIGN KEY(class_id) REFERENCES classes(id) --FOREIGN KEY(semester_id) REFERENCES semesters(id) ); -- Lessons table -- contains the list of which lessons per week CREATE TABLE lessons ( id INTEGER PRIMARY KEY AUTOINCREMENT, activity_id INTEGER, week date, -- this is the date of the monday of the corresponding week number_of_lessons INTEGER, FOREIGN KEY (activity_id) REFERENCES activities( id ) ); COMMIT;
-- MySQL dump 10.13 Distrib 5.6.23, for Win64 (x86_64) -- -- Host: 127.0.0.1 Database: inikierp -- ------------------------------------------------------ -- Server version 5.6.21 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `unitcode` -- DROP TABLE IF EXISTS `unitcode`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `unitcode` ( `unitID` tinyint(5) NOT NULL AUTO_INCREMENT COMMENT '包裝單位代碼', `unitEnDesc` varchar(20) DEFAULT NULL, `unitDesc` varchar(20) NOT NULL COMMENT '包裝單位說明', PRIMARY KEY (`unitID`), KEY `UNITCODE` (`unitID`) ) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `unitcode` -- LOCK TABLES `unitcode` WRITE; /*!40000 ALTER TABLE `unitcode` DISABLE KEYS */; INSERT INTO `unitcode` VALUES (1,'pcs','支'),(2,'pcs','片'),(3,'bag','包'),(4,'pcs','台'),(5,'pcs','本'),(6,'pcs','次'),(7,'pcs','米'),(8,'pcs','卷'),(9,'pcs','個'),(10,'pcs','根'),(11,'pcs','條'),(12,'pcs','瓶'),(13,'pcs','盒'),(14,'pcs','組'),(15,'pcs','管'),(16,'pcs','顆'),(17,'pcs','罐'),(18,'pcs','批'),(19,'pcs','對'),(20,NULL,''),(21,'pcs','套'),(22,'pcs','捲'),(23,'pcs','張'),(24,'pcs','式'),(25,'pcs','箱'),(26,'','罐'); /*!40000 ALTER TABLE `unitcode` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2015-04-21 14:20:34
select * from SF_PD_ProjectImplementStartBook select ProjectNameId from SF_PD_ProjectImplementStartBook group by projectnameid having count(projectnameid)>1 select * from PB_Widget where id='7892ed51-c787-4477-a006-fb2ea7df6ce1' --/PowerPlat/FormXml/zh-CN/SF_PD/SF_ProjectImplementStartBook.htm select * from PLN_project where project_guid not in (select projectnameid from SF_PD_ProjectImplementStartBook) select * from ps_cm_subcontract select * from SF_ProjectImplementStartBook_dtl select * from PS_SubContract_View
SHOW GLOBAL STATUS LIKE 'Created_tmp_disk_tables'; SHOW GLOBAL STATUS LIKE 'Created_tmp_tables'; SHOW GLOBAL VARIABLES LIKE 'tmp_table_size'; SET GLOBAL tmp_table_size = 208003328;
DROP DATABASE IF EXISTS `shop_gen`; CREATE DATABASE `shop_gen`; USE `shop_gen`; CREATE TABLE `user`( `user_id` int NOT NULL AUTO_INCREMENT PRIMARY KEY , `name` varchar(40) NOT NULL , `email` varchar(40) NOT NULL UNIQUE , `password` varchar(60) NOT NULL , `active` boolean NOT NULL DEFAULT true, `registration_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE `shop`( `shop_id` int NOT NULL AUTO_INCREMENT PRIMARY KEY , `user_id` int NOT NULL , `uid` varchar(50) NOT NULL , `name` varchar(50) NOT NULL , `options` json , `shop_url` varchar(80) , `shop_git` varchar(80) ); ALTER TABLE `shop` ADD FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`); INSERT INTO shop (user_id, uid, name, shop_url) values (1, 'shop1-uwvb37vbugvibfguuigfgu', 'shop1', 'https://shop1-uwvb37vbugvibfguuigfgu.heroku.com'); INSERT INTO shop (user_id, uid, name, shop_url) values (1, 'shop2-uwvb37vbugvibfguuigfgu', 'shop2', 'https://shop2-uwvb37vbugvibfguuigfgu.heroku.com'); INSERT INTO shop (user_id, uid, name, shop_url) values (1, 'shop3-uwvb37vbugvibfguuigfgu', 'shop3', 'https://shop3-uwvb37vbugvibfguuigfgu.heroku.com'); SELECT * from user; SELECT * FROM shop;
SELECT --T3.买卖关联ID T1.* --FROM 贷项清单申请情报 T1 FROM CREDIT_NOTE_APPLY_INFO T1 --INNER JOIN 债权 T2 INNER JOIN INVOICE_INFO T2 --ON T1.债权ID = T2.债权ID ON T1.INVOICE_ID = T2.INVOICE_ID WHERE -- T2.债权号 = 参数.债权号 T2.INVOICE_NO =/*invoiceNoOld*/'' --T1. 申请状态 = 02(申请中) AND T1.STATUS = /*codeValueApplyStatusApplying*/'' --T1.取消状态 = 1(未取消) AND T1.DELETE_FLG = /*codeValueDeleteFlgNo*/''
CREATE TABLE Hostales( id int, nombreHostal varchar(32), registroSI varchar(32) NOT NULL, registroCamara varchar(32) NOT NULL, horarioApertura varchar(5) NOT NULL, horarioCierre varchar(5) NOT NULL, CONSTRAINT PKhostales PRIMARY KEY (id), CONSTRAINT FKoperadorHostales FOREIGN KEY (id) REFERENCES Operadores(id) ); CREATE TABLE Hoteles( id int, nombreHotel varchar(32), categoria int NOT NULL, registroSI varchar(32) NOT NULL, registroCamara varchar(32) NOT NULL, CONSTRAINT PKhoteles PRIMARY KEY (id), CONSTRAINT FKoperadorHoteles FOREIGN KEY (id) REFERENCES Operadores(id) ); CREATE TABLE PersonaNatural( id int, vinculo varchar(32) NOT NULL, CONSTRAINT PKpersonaNatural PRIMARY KEY (id), CONSTRAINT FKoperadorPersonaNatural FOREIGN KEY (id) REFERENCES Operadores(id), CONSTRAINT CKvinculoPersonaNat CHECK (vinculo IN ('Estudiante','Padre','Egresado','Empleado','Profesor','Evento','Profesor invitado')) ); CREATE TABLE ViviendaUniversitaria( id int, nombreVivienda varchar(32) NOT NULL, CONSTRAINT PKviviendaUniversitaria PRIMARY KEY (id), CONSTRAINT FKoperadorVivUni FOREIGN KEY (id) REFERENCES Operadores(id) );
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 16 Jun 2019 pada 07.01 -- Versi server: 10.1.31-MariaDB -- Versi PHP: 7.2.3 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: `sekolah` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `alamat` -- CREATE TABLE `alamat` ( `id` int(11) NOT NULL, `rt` varchar(10) DEFAULT NULL, `rw` varchar(10) DEFAULT NULL, `dusun` varchar(20) DEFAULT NULL, `desa` varchar(30) DEFAULT NULL, `kecamatan` varchar(30) DEFAULT NULL, `kabupaten` varchar(30) DEFAULT NULL, `lainnya` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `alamat` -- INSERT INTO `alamat` (`id`, `rt`, `rw`, `dusun`, `desa`, `kecamatan`, `kabupaten`, `lainnya`) VALUES (145, '', '', '', '', '', '', ''), (146, '', '', '', '', '', '', ''), (147, '', '', '', '', '', '', ''), (148, '', '', '', '', '', '', ''), (149, '', '', '', '', '', '', ''), (150, '', '', '', '', '', '', ''), (151, '', '', '', '', '', '', ''), (152, '', '', '', '', '', '', ''), (153, '', '', '', '', '', '', ''), (154, '', '', '', '', '', '', ''), (155, '', '', '', '', '', '', ''), (156, '', '', '', '', '', '', ''), (157, '', '', '', '', '', '', NULL); -- -------------------------------------------------------- -- -- Struktur dari tabel `kelas` -- CREATE TABLE `kelas` ( `id` int(11) NOT NULL, `nama` varchar(5) NOT NULL, `kapasitas` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struktur dari tabel `menu` -- CREATE TABLE `menu` ( `id` int(11) NOT NULL, `role_id` int(11) NOT NULL, `nama` varchar(35) NOT NULL, `path` varchar(40) NOT NULL, `icon` varchar(35) NOT NULL, `urutan` int(11) NOT NULL, `active` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `menu` -- INSERT INTO `menu` (`id`, `role_id`, `nama`, `path`, `icon`, `urutan`, `active`) VALUES (1, 4, 'Dashboard', 'home', 'fa fa-dashboard', 1, 1), (2, 4, 'Pendaftaran Murid Baru', 'home/pendaftaran_murid', 'fa fa-book', 2, 1), (3, 4, 'Seleksi Murid Baru', 'home/seleksi_murid', 'fa fa-calendar', 3, 1), (4, 4, 'Penempatan Murid Baru', 'home/penempatan_murid', 'fa fa-table', 4, 1), (5, 4, 'Berita dan Pemberitahuan', 'home/berita_pemberitahuan', 'fa fa-newspaper-o', 5, 1); -- -------------------------------------------------------- -- -- Struktur dari tabel `murid` -- CREATE TABLE `murid` ( `id` int(11) NOT NULL, `nama_lengkap` varchar(50) DEFAULT NULL, `jenis_kelamin` varchar(20) DEFAULT NULL, `tempat_lahir` varchar(30) DEFAULT NULL, `tanggal_lahir` date DEFAULT NULL, `alamat_id` int(11) DEFAULT NULL, `agama` varchar(20) DEFAULT NULL, `no_hp` varchar(20) DEFAULT NULL, `asal_sekolah` varchar(30) DEFAULT NULL, `tinggal_bersama` varchar(20) DEFAULT NULL, `jumlah_saudara` int(11) DEFAULT NULL, `orangtua_id` int(11) DEFAULT NULL, `wali_id` int(11) DEFAULT NULL, `persyaratan_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `murid` -- INSERT INTO `murid` (`id`, `nama_lengkap`, `jenis_kelamin`, `tempat_lahir`, `tanggal_lahir`, `alamat_id`, `agama`, `no_hp`, `asal_sekolah`, `tinggal_bersama`, `jumlah_saudara`, `orangtua_id`, `wali_id`, `persyaratan_id`) VALUES (33, 'intan destiyanti', 'perempuan', 'indramayu', '2019-06-11', 156, 'islam', '986394834', 'smk n 1 losarang', '', 1, 67, NULL, NULL); -- -------------------------------------------------------- -- -- Struktur dari tabel `orangtua` -- CREATE TABLE `orangtua` ( `id` int(11) NOT NULL, `nama_ibu` varchar(30) DEFAULT NULL, `pendidikan_terakhir_ibu` varchar(20) DEFAULT NULL, `tempat_lahir_ibu` varchar(20) DEFAULT NULL, `tanggal_lahir_ibu` date DEFAULT NULL, `alamat_id_ibu` int(11) DEFAULT NULL, `pekerjaan_ibu` varchar(30) DEFAULT NULL, `nama_ayah` varchar(30) DEFAULT NULL, `pendidikan_terakhir_ayah` varchar(20) DEFAULT NULL, `tempat_lahir_ayah` varchar(20) DEFAULT NULL, `tanggal_lahir_ayah` date DEFAULT NULL, `alamat_id_ayah` int(11) DEFAULT NULL, `pekerjaan_ayah` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `orangtua` -- INSERT INTO `orangtua` (`id`, `nama_ibu`, `pendidikan_terakhir_ibu`, `tempat_lahir_ibu`, `tanggal_lahir_ibu`, `alamat_id_ibu`, `pekerjaan_ibu`, `nama_ayah`, `pendidikan_terakhir_ayah`, `tempat_lahir_ayah`, `tanggal_lahir_ayah`, `alamat_id_ayah`, `pekerjaan_ayah`) VALUES (64, 'pathanah', 'Sarjana', 'bandung', '2019-06-25', 146, 'ibu rumah tangga', 'ade supriyanto', 'SMA', 'jakarta', '2019-06-11', 146, 'wirausaha'), (65, 'pathanah', 'Sarjana', 'bandung', '2019-06-25', 149, 'ibu rumah tangga', 'ade supriyanto', 'SMA', 'jakarta', '2019-06-11', 149, 'wirausaha'), (66, 'pathanah', 'Sarjana', 'bandung', '2019-06-25', 152, 'ibu rumah tangga', 'ade supriyanto', 'SMA', 'jakarta', '2019-06-11', 152, 'wirausaha'), (67, 'pathanah', 'Sarjana', 'bandung', '2019-06-25', 155, 'ibu rumah tangga', 'ade supriyanto', 'SMA', 'jakarta', '2019-06-11', 155, 'wirausaha'); -- -------------------------------------------------------- -- -- Struktur dari tabel `pendaftar` -- CREATE TABLE `pendaftar` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `tanggal_daftar` date NOT NULL, `pembayaran` int(11) NOT NULL, `bukti_pembayaran` varchar(50) NOT NULL, `status_id` int(11) NOT NULL, `murid_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struktur dari tabel `persyaratan` -- CREATE TABLE `persyaratan` ( `id` int(11) NOT NULL, `path_akta` varchar(50) DEFAULT NULL, `path_ijazah` varchar(50) DEFAULT NULL, `path_kk` varchar(50) DEFAULT NULL, `path_pas_foto` varchar(50) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `persyaratan` -- INSERT INTO `persyaratan` (`id`, `path_akta`, `path_ijazah`, `path_kk`, `path_pas_foto`) VALUES (28, '', '', '', ''); -- -------------------------------------------------------- -- -- Struktur dari tabel `role_user` -- CREATE TABLE `role_user` ( `id` int(11) NOT NULL, `nama` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `role_user` -- INSERT INTO `role_user` (`id`, `nama`) VALUES (1, 'guru'), (2, 'wali murid'), (3, 'wali kelas'), (4, 'admin psb'), (5, 'admin keuangan'), (6, 'murid'), (7, 'admin umum'); -- -------------------------------------------------------- -- -- Struktur dari tabel `status_pendaftar` -- CREATE TABLE `status_pendaftar` ( `id` int(11) NOT NULL, `nama` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `status_pendaftar` -- INSERT INTO `status_pendaftar` (`id`, `nama`) VALUES (1, 'baru mendaftar'), (2, 'sudah bayar'), (3, 'ikut seleksi'), (4, 'lolos seleksi'), (5, 'sudah membayar'), (6, 'selesai'), (7, 'gagal'); -- -------------------------------------------------------- -- -- Struktur dari tabel `submenu` -- CREATE TABLE `submenu` ( `id` int(11) NOT NULL, `menu_id` int(11) NOT NULL, `nama` varchar(20) NOT NULL, `path` varchar(40) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Struktur dari tabel `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `nama_awal` varchar(30) NOT NULL, `nama_akhir` varchar(30) NOT NULL, `username` varchar(20) NOT NULL, `password` varchar(256) NOT NULL, `email` varchar(30) NOT NULL, `role_id` int(11) NOT NULL, `created_at` date NOT NULL, `updated_at` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `user` -- INSERT INTO `user` (`id`, `nama_awal`, `nama_akhir`, `username`, `password`, `email`, `role_id`, `created_at`, `updated_at`) VALUES (5, 'intan', 'destiyanti', '087832590662', '$2y$10$ZmDp9n3xllaxCAR4SrbjEOdPnNXn4taDs3pV4EBvOtq6vxOq9YTwe', 'intandesti25@gmail.com', 2, '2019-06-15', '2019-06-15'); -- -------------------------------------------------------- -- -- Struktur dari tabel `wali` -- CREATE TABLE `wali` ( `id` int(11) NOT NULL, `nama_wali` varchar(30) DEFAULT NULL, `pendidikan_terakhir_wali` varchar(20) DEFAULT NULL, `alamat_id_wali` int(11) DEFAULT NULL, `pekerjaan_wali` varchar(30) DEFAULT NULL, `tempat_lahir_wali` varchar(30) DEFAULT NULL, `tanggal_lahir_wali` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `wali` -- INSERT INTO `wali` (`id`, `nama_wali`, `pendidikan_terakhir_wali`, `alamat_id_wali`, `pekerjaan_wali`, `tempat_lahir_wali`, `tanggal_lahir_wali`) VALUES (33, '', 'Sarjana', 157, 'ibu rumah tangga', '', '0000-00-00'); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `alamat` -- ALTER TABLE `alamat` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `kelas` -- ALTER TABLE `kelas` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `menu` -- ALTER TABLE `menu` ADD PRIMARY KEY (`id`), ADD KEY `role_id` (`role_id`); -- -- Indeks untuk tabel `murid` -- ALTER TABLE `murid` ADD PRIMARY KEY (`id`), ADD KEY `alamat_fk` (`alamat_id`), ADD KEY `orangtua_fk` (`orangtua_id`), ADD KEY `wali_fk` (`wali_id`), ADD KEY `persyaratan_fk` (`persyaratan_id`); -- -- Indeks untuk tabel `orangtua` -- ALTER TABLE `orangtua` ADD PRIMARY KEY (`id`), ADD KEY `alamat_fk_ibu` (`alamat_id_ibu`), ADD KEY `alamat_fk_ayah` (`alamat_id_ayah`); -- -- Indeks untuk tabel `pendaftar` -- ALTER TABLE `pendaftar` ADD PRIMARY KEY (`id`), ADD KEY `murid_fk` (`murid_id`), ADD KEY `user_fk` (`user_id`); -- -- Indeks untuk tabel `persyaratan` -- ALTER TABLE `persyaratan` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `role_user` -- ALTER TABLE `role_user` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `status_pendaftar` -- ALTER TABLE `status_pendaftar` ADD PRIMARY KEY (`id`); -- -- Indeks untuk tabel `submenu` -- ALTER TABLE `submenu` ADD PRIMARY KEY (`id`), ADD KEY `menu_id` (`menu_id`); -- -- Indeks untuk tabel `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD KEY `role_id` (`role_id`); -- -- Indeks untuk tabel `wali` -- ALTER TABLE `wali` ADD PRIMARY KEY (`id`), ADD KEY `alamat_fk_wali` (`alamat_id_wali`); -- -- AUTO_INCREMENT untuk tabel yang dibuang -- -- -- AUTO_INCREMENT untuk tabel `alamat` -- ALTER TABLE `alamat` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=158; -- -- AUTO_INCREMENT untuk tabel `kelas` -- ALTER TABLE `kelas` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT untuk tabel `menu` -- ALTER TABLE `menu` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT untuk tabel `murid` -- ALTER TABLE `murid` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34; -- -- AUTO_INCREMENT untuk tabel `orangtua` -- ALTER TABLE `orangtua` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=68; -- -- AUTO_INCREMENT untuk tabel `pendaftar` -- ALTER TABLE `pendaftar` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT untuk tabel `persyaratan` -- ALTER TABLE `persyaratan` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29; -- -- AUTO_INCREMENT untuk tabel `role_user` -- ALTER TABLE `role_user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT untuk tabel `status_pendaftar` -- ALTER TABLE `status_pendaftar` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT untuk tabel `submenu` -- ALTER TABLE `submenu` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT untuk tabel `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT untuk tabel `wali` -- ALTER TABLE `wali` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34; -- -- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables) -- -- -- Ketidakleluasaan untuk tabel `menu` -- ALTER TABLE `menu` ADD CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role_user` (`id`); -- -- Ketidakleluasaan untuk tabel `murid` -- ALTER TABLE `murid` ADD CONSTRAINT `alamat_fk` FOREIGN KEY (`alamat_id`) REFERENCES `alamat` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `orangtua_fk` FOREIGN KEY (`orangtua_id`) REFERENCES `orangtua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `persyaratan_fk` FOREIGN KEY (`persyaratan_id`) REFERENCES `persyaratan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `wali_fk` FOREIGN KEY (`wali_id`) REFERENCES `wali` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Ketidakleluasaan untuk tabel `orangtua` -- ALTER TABLE `orangtua` ADD CONSTRAINT `alamat_fk_ayah` FOREIGN KEY (`alamat_id_ayah`) REFERENCES `alamat` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `alamat_fk_ibu` FOREIGN KEY (`alamat_id_ibu`) REFERENCES `alamat` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Ketidakleluasaan untuk tabel `pendaftar` -- ALTER TABLE `pendaftar` ADD CONSTRAINT `murid_fk` FOREIGN KEY (`murid_id`) REFERENCES `murid` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `user_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Ketidakleluasaan untuk tabel `user` -- ALTER TABLE `user` ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role_user` (`id`) ON DELETE CASCADE; -- -- Ketidakleluasaan untuk tabel `wali` -- ALTER TABLE `wali` ADD CONSTRAINT `alamat_fk_wali` FOREIGN KEY (`alamat_id_wali`) REFERENCES `alamat` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
CREATE TABLE PEOPLE( Id INT PRIMARY KEY IDENTITY, [Name] NVARCHAR(200) NOT NULL, Picture VARBINARY(MAX), Height DECIMAL (3, 2), [Weight] DECIMAL (3, 2), Gender Char(1) NOT NULL, Birthdate DATE NOT NULL, Biography NVARCHAR ) ALTER TABLE PEOPLE ADD CONSTRAINT CHK_PEOPLE_Picture__2MB CHECK (DATALENGTH(Picture) <= 2097152); ALTER TABLE PEOPLE ALTER COLUMN [Weight] DECIMAL(5, 2) ALTER TABLE PEOPLE ALTER COLUMN Biography NVARCHAR(MAX) INSERT INTO PEOPLE VALUES ('Maikal', NULL, 1.85, 112.47, 'M', '1989-12-23', 'BIO'), ('Firmino', NULL, 1.61, 64.6, 'M', '1956-11-23', NULL), ('Novakov', NULL, 1.99, 98.78, 'M', '1939-9-15', 'SOME BIO'), ('HIKIMQN', NULL, 1.53, 57, 'M', '1829-11-7', 'BIOGRAPHY'), ('Anton', NULL, 1.87, 88.45, 'M', '1829-11-19', NULL);
CREATE TABLE debts ( id int PRIMARY KEY, amount real NOT NULL ); CREATE TABLE payment_plans ( id int PRIMARY KEY, debt_id int NOT NULL, amount_to_pay real NOT NULL, installment_frequency text NOT NULL, installment_amount real NOT NULL, start_date double precision NULL, CONSTRAINT fk_debts FOREIGN KEY(debt_id) REFERENCES debts(id) ); CREATE TABLE payments ( payment_plan_id int PRIMARY KEY, amount real NOT NULL, date double precision NOT NULL );
-- auto Generated on 2018-11-21 12:52:13 -- DROP TABLE IF EXISTS `device`; CREATE TABLE device( `id` INTEGER(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'id', `imei` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '设备ID Unique', `alias` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '设备别名', `community_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '社区ID', `device_status` INTEGER(12) UNSIGNED NOT NULL DEFAULT 0 COMMENT '设备状态 0未激活 1已激活(但未使用) 2在线(可使用状态) 3离线', `activate_time` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '设备激活时间', `last_online_time` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '设备最后在线时间', `last_offline_time` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '设备最后离线时间', `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'createTime', `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'updateTime', `is_deleted` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除标记', PRIMARY KEY (`id`), UNIQUE KEY(`imei`) )ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'device';
CREATE TABLE Course( cid VARCHAR2(20), GPA FLOAT, semester VARCHAR2(20), Availability VARCHAR2(20), PRIMARY KEY(cid) );
drop table if exists authors; create table authors( id bigint not null auto_increment, firstname varchar(32) not null, lastname varchar(32) not null, primary key(id)); drop table if exists genres; create table genres(id bigint not null auto_increment, title varchar(32) not null, primary key(id)); drop table if exists books; create table books( id bigint not null auto_increment, title varchar(32) not null, author_id bigint not null, genre_id bigint not null, primary key(id), constraint fk_books_authors foreign key(author_id) references authors(id), constraint fk_books_genres foreign key(genre_id) references genres(id)); drop table if exists comments; create table comments(id bigint not null auto_increment, content varchar(100) not null, book_id bigint, primary key(id), constraint fk_comments_books foreign key(book_id) references books(id)); create unique index unicNameAuthor on authors(firstname, lastname); create unique index unicTitleBook on books(title); create unique index unicTitleGenre on genres(title);
DROP SCHEMA IF EXISTS hotel; -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema hotel -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema hotel -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `hotel` DEFAULT CHARACTER SET utf8 ; USE `hotel` ; -- ----------------------------------------------------- -- Table `hotel`.`room_type` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `hotel`.`room_type` ( `room_type_id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(127) NOT NULL, `capacity` INT NOT NULL, `price` INT NOT NULL, `description` VARCHAR(255) NULL, PRIMARY KEY (`room_type_id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `hotel`.`room` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `hotel`.`room` ( `room_id` INT NOT NULL AUTO_INCREMENT, `room_number` VARCHAR(8) NOT NULL, `room_type_id` INT NOT NULL, PRIMARY KEY (`room_id`), UNIQUE INDEX `room_number_UNIQUE` (`room_number` ASC), INDEX `fk_room_room_type1_idx` (`room_type_id` ASC), CONSTRAINT `fk_room_room_type1` FOREIGN KEY (`room_type_id`) REFERENCES `hotel`.`room_type` (`room_type_id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `hotel`.`users` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `hotel`.`users` ( `users_id` INT NOT NULL AUTO_INCREMENT, `username` VARCHAR(16) NOT NULL, `password` VARCHAR(255) NOT NULL, `email` VARCHAR(255) NOT NULL, `phone_number` VARCHAR(255) NOT NULL, `first_name` VARCHAR(64) NOT NULL, `last_name` VARCHAR(64) NOT NULL, `patronymic` VARCHAR(64) NULL, `role` ENUM('administrator', 'client') NOT NULL, PRIMARY KEY (`users_id`), UNIQUE INDEX `username_UNIQUE` (`username` ASC), UNIQUE INDEX `email_UNIQUE` (`email` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `hotel`.`reservation` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `hotel`.`reservation` ( `reservation_id` INT NOT NULL AUTO_INCREMENT, `reservation_date` DATETIME NOT NULL, `start_date` DATE NOT NULL, `end_date` DATE NOT NULL, `client_comment` VARCHAR(255) NULL, `administrator_comment` VARCHAR(255) NULL, `status` ENUM('new', 'approved', 'denied', 'in_progress', 'payed') NOT NULL, `users_id` INT NOT NULL, `room_type_id` INT NOT NULL, `room_id` INT NULL, PRIMARY KEY (`reservation_id`), INDEX `fk_reservation_users1_idx` (`users_id` ASC), INDEX `fk_reservation_room_type1_idx` (`room_type_id` ASC), INDEX `fk_reservation_room1_idx` (`room_id` ASC), CONSTRAINT `fk_reservation_users1` FOREIGN KEY (`users_id`) REFERENCES `hotel`.`users` (`users_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_reservation_room_type1` FOREIGN KEY (`room_type_id`) REFERENCES `hotel`.`room_type` (`room_type_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_reservation_room1` FOREIGN KEY (`room_id`) REFERENCES `hotel`.`room` (`room_id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `hotel`.`payment` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `hotel`.`payment` ( `payment_id` INT NOT NULL AUTO_INCREMENT, `total` INT NOT NULL, `date` DATETIME NOT NULL, `payment_method` ENUM('cash', 'card') NOT NULL, `reservation_id` INT NOT NULL, PRIMARY KEY (`payment_id`), INDEX `fk_payment_reservation_idx` (`reservation_id` ASC), CONSTRAINT `fk_payment_reservation` FOREIGN KEY (`reservation_id`) REFERENCES `hotel`.`reservation` (`reservation_id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; INSERT INTO `hotel`.room_type (name, capacity, price, description) VALUES ("Стандарт з 2 ліжками", 2, 40000, "1 кімната, 2 одномісних ліжка."); INSERT INTO `hotel`.room_type (name, capacity, price, description) VALUES ("Стандарт з 3 ліжками", 3, 60000, "1 кімната, 3 одномісних ліжка."); INSERT INTO `hotel`.room_type (name, capacity, price, description) VALUES ("Стандарт з 4 ліжками", 4, 80000, "2 кімнати, 4 одномісних ліжка."); INSERT INTO `hotel`.room_type (name, capacity, price, description) VALUES ("Стандарт з великим ліжком", 2, 45000, "1 кімната, 1 двомісне ліжко."); INSERT INTO `hotel`.room_type (name, capacity, price, description) VALUES ("Стандарт з великим ліжком та диваном", 3, 65000, "2 кімнати. 1 двомісне ліжко, 1 диван."); INSERT INTO `hotel`.room_type (name, capacity, price, description) VALUES ("Напівлюкс з великим ліжком", 2, 70000, "1 кімната, 1 двомісне ліжко."); INSERT INTO `hotel`.room_type (name, capacity, price, description) VALUES ("Напівлюкс з великим ліжком та диваном", 3, 85000, "2 кімнати, 1 двомісне ліжко, 1 диван."); INSERT INTO `hotel`.room_type (name, capacity, price, description) VALUES ("Напівлюкс з двома великими ліжками", 4, 100000, "2 кімнати, 2 двомісних ліжка."); INSERT INTO `hotel`.room_type (name, capacity, price, description) VALUES ("Люкс з великим ліжком", 2, 100000, "2 кімнати, 1 двомісне ліжко"); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("1", 1); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("2", 1); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("3", 2); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("4", 2); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("5", 3); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("6", 3); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("7", 4); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("8", 4); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("9", 5); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("10", 6); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("11", 6); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("12", 7); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("13", 8); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("14", 9); INSERT INTO `hotel`.room (room_number, room_type_id) VALUES ("15", 9); INSERT INTO `hotel`.users (username, password, email, phone_number, first_name, last_name, patronymic, role) VALUES ("admin", "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918", "admin@hotel.ua", "380987654321", "Мирослава", "Кот", "Дмитрівна", "administrator");
--How many customers has Foodie-Fi ever had? --What is the monthly distribution of trial plan start_date values for our dataset - use the start of the month as the group by value --What plan start_date values occur after the year 2020 for our dataset? Show the breakdown by count of events for each plan_name --What is the customer count and percentage of customers who have churned rounded to 1 decimal place? --How many customers have churned straight after their initial free trial - what percentage is this rounded to the nearest whole number? --What is the number and percentage of customer plans after their initial free trial? --What is the customer count and percentage breakdown of all 5 plan_name values at 2020-12-31? --How many customers have upgraded to an annual plan in 2020? --How many days on average does it take for a customer to an annual plan from the day they join Foodie-Fi? --Can you further breakdown this average value into 30 day periods (i.e. 0-30 days, 31-60 days etc) --How many customers downgraded from a pro monthly to a basic monthly plan in 2020? --1 How many customers has Foodie-Fi ever had? SELECT COUNT(DISTINCT customer_id) FROM foodie_fi.subscriptions --2 What is the monthly distribution of trial plan start_date values for our dataset - use the start of the month as the group by value SELECT COUNT(DISTINCT customer_id) as number_of_cus,DATE_PART('month',start_date) As by_month FROM foodie_fi.subscriptions JOIN foodie_fi.plans USING (plan_id) WHERE plan_name='trial' GROUP BY DATE_PART('month',start_date) --3 What plan start_date values occur after the year 2020 for our dataset? Show the breakdown by count of events for each plan_name SELECT plan_name,COUNT(DISTINCT customer_id) FROM foodie_fi.subscriptions JOIN foodie_fi.plans USING (plan_id) WHERE DATE_PART('year',start_date) >2020 GROUP BY plan_name --4 What is the customer count and percentage of customers who have churned rounded to 1 decimal place? SELECT COUNT(DISTINCT customer_id), ROUND(COUNT(DISTINCT customer_id)::numeric*100/1000,1) FROM foodie_fi.subscriptions JOIN foodie_fi.plans USING (plan_id) WHERE plan_name='churn' --5 How many customers have churned straight after their initial free trial - what percentage is this rounded to the nearest whole number? WITH next_plan_table AS (SELECT customer_id, start_date,plan_name, LEAD (plan_name,1) OVER(PARTITION BY customer_id ORDER BY start_date) AS next_plan FROM foodie_fi.subscriptions JOIN foodie_fi.plans USING (plan_id)) SELECT COUNT(distinct customer_id) as trial_churn, ROUND((COUNT(distinct customer_id)::numeric/1000)*100,2) AS percent FROM next_plan_table WHERE plan_name = 'trial' AND next_plan='churn' --6 What is the number and percentage of customer plans after their initial free trial? WITH next_plan_table AS (SELECT customer_id, start_date,plan_name, LEAD (plan_name,1) OVER(PARTITION BY customer_id ORDER BY start_date) AS next_plan FROM foodie_fi.subscriptions JOIN foodie_fi.plans USING (plan_id)) SELECT next_plan AS next_plan_after_trial,COUNT(distinct customer_id) AS customer, ROUND((COUNT(distinct customer_id)::numeric/1000)*100,2) FROM next_plan_table WHERE plan_name='trial' GROUP BY next_plan --7 What is the customer count and percentage breakdown of all 5 plan_name values at 2020-12-31? WITH t1 AS (SELECT customer_id,start_date,plan_id, LEAD(plan_id,1) OVER (PARTITION BY customer_id ORDER BY start_date) AS stt FROM foodie_fi.subscriptions WHERE EXTRACT(YEAR FROM start_date)=2020) --table tính đến năm 2020 và dùng lead để biết plan tiếp theo có null ko, nếu null là plan cũ đang là plan hiện tại , t2 AS(SELECT COUNT(customer_id) AS sum_of_each_plan,plan_id FROM t1 WHERE stt IS NULL GROUP BY plan_id) --cột next_plan null là hiện tại vẫn ở cột plan_id đó SELECT ROUND((sum_of_each_plan/1000::numeric*100),2),plan_name FROM t2 JOIN foodie_fi.plans USING (plan_id) --8 How many customers have upgraded to an annual plan in 2020? WITH t1 AS (SELECT customer_id,start_date,plan_name, LEAD(plan_name,1) OVER (PARTITION BY customer_id ORDER BY start_date) AS next_plan FROM foodie_fi.subscriptions JOIN foodie_fi.plans USING(plan_id) WHERE EXTRACT(YEAR FROM start_date)=2020) SELECT COUNT(customer_id) FROM t1 WHERE plan_name='pro annual' --9 How many days on average does it take for a customer to an annual plan from the day they join Foodie-Fi? WITH t1 AS(SELECT customer_id, plan_name,start_date, LEAD(start_date,1) OVER (PARTITION BY customer_id ORDER BY start_date) AS annual_next_date FROM foodie_fi.subscriptions JOIN foodie_fi.plans USING (plan_id) WHERE plan_name='trial' OR plan_name='pro annual') SELECT AVG(annual_next_date-start_date) FROM t1 WHERE annual_next_date is not null --10 Can you further breakdown this average value into 30 day periods (i.e. 0-30 days, 31-60 days etc) WITH t1 AS(SELECT customer_id, plan_name,start_date, LEAD(start_date,1) OVER (PARTITION BY customer_id ORDER BY start_date) AS annual_next_date FROM foodie_fi.subscriptions JOIN foodie_fi.plans USING (plan_id) WHERE plan_name='trial' OR plan_name='pro annual') SELECT ROUND(AVG (annual_next_date-start_date),2) AS avg_trial_To_annual , CASE WHEN (annual_next_date-start_date) <=30 THEN '0-30 days' WHEN (annual_next_date-start_date) <=60 THEN '30-60 days' WHEN (annual_next_date-start_date) <=90 THEN '60-90 days' WHEN (annual_next_date-start_date) <=120 THEN '90-120 days' WHEN (annual_next_date-start_date) <=150 THEN '120-150 days' WHEN (annual_next_date-start_date) <=180 THEN '150-180 days' WHEN (annual_next_date-start_date) <=210 THEN '180-210 days' WHEN (annual_next_date-start_date) <=240 THEN '210-240 days' WHEN (annual_next_date-start_date) <=270 THEN '240-270 days' WHEN (annual_next_date-start_date) <=300 THEN '270-300 days' WHEN (annual_next_date-start_date) <=330 THEN '300-330 days' WHEN (annual_next_date-start_date) <=366 THEN '330-366 days' END as day_period FROM t1 WHERE annual_next_date is not null GROUP BY day_period ORDER BY day_period --11 How many customers downgraded from a pro monthly to a basic monthly plan in 2020? WITH t1 AS (SELECT customer_id,start_date, plan_name, LEAD(plan_name,1) OVER (PARTITION BY customer_id ORDER BY start_date) AS next_basic_monthly FROM foodie_fi.subscriptions JOIN foodie_fi.plans USING (plan_id) WHERE DATE_PART('year',start_date)=2020) SELECT COUNT(customer_id) AS customer_from_pro_to_basic_monthly FROm t1 WHERE plan_name='pro monthly' AND next_basic_monthly='basic monthly'
use ge; # dictionaries insert into item_type (item_type_name) values ('engine'), ('weapon'), ('bonus'), ('sale'), ('money'); insert into bonus_type (bonus_type_name) values ('armor'), ('hp_regen'), ('energy_regen'), ('speed_rotation'), ('speed_move'), ('acceleration_rotation'), ('acceleration_move'), ('weapon_speed'); insert into weapon_type (weapon_type_name) values ('rocket'), ('laser'); insert into location_object_behavior_type (object_behavior_type_name) values ('ignored'), ('static'), ('drawable'), ('dynamic'); insert into location_object_type (object_type_name) values ('star'), ('fog'), ('station'), ('asteroid'), ('bullet'), ('player'); # location insert into location (location_name, location_width, location_height) values (get_default_location_name(), 15000, 15000); # item insert into item (item_name, item_description, item_price, item_type_id) values # engine (get_default_engine_name(), 'engine escarpment 0', 50, get_item_type_id_by_name('engine')), -- escarpment (крутость) ('Engine "Torelin"', 'engine escarpment 1', 100, get_item_type_id_by_name('engine')), -- ('Engine "Radamaes"', 'engine escarpment 2', 150, get_item_type_id_by_name('engine')), -- engine escarpment 2 ('Engine "Hayale"', 'engine escarpment 3', 200, get_item_type_id_by_name('engine')), -- engine escarpment 3 # bullet laser (get_default_weapon_name(), 'weapon escarpment 0', 500, get_item_type_id_by_name('weapon')), ('Laser "Gyash"', 'weapon escarpment 1', 1000, get_item_type_id_by_name('weapon')), # bullet rocket ('Rocket "Idario"', 'weapon escarpment 0', 2000, get_item_type_id_by_name('weapon')), ('Rocket "Pemelaya', 'weapon escarpment 1', 5000, get_item_type_id_by_name('weapon')), # bonus armor ('Armor Module "Tortoise"', 'armor bonus', 600, get_item_type_id_by_name('bonus')), ('Armor Module "Armadillo"', 'armor bonus', 800, get_item_type_id_by_name('bonus')), # bonus hp regen ('HP Regen Module "Lisard"', 'hp_regen bonus', 800, get_item_type_id_by_name('bonus')), ('HP Regen Module "Tarrudo"', 'hp_regen bonus', 1000, get_item_type_id_by_name('bonus')), # bonus energy regen ('Energy Regen Module "Lanis"', 'energy bonus', 500, get_item_type_id_by_name('bonus')), ('Energy Regen Module "Tadpole"', 'energy bonus', 500, get_item_type_id_by_name('bonus')), # sale ('Scarp Metal', 'scarp metal for sale', 100, get_item_type_id_by_name('sale')), ('Reactor Core', 'scarp metal for sale', 100, get_item_type_id_by_name('sale')), ('Trash', 'trash for sale', 5, get_item_type_id_by_name('sale')), #money ('Gold', 'money doesn\'t bring happiness, but it helps', 1, get_item_type_id_by_name('money')); insert into bonus (bonus_value, item_id, bonus_type_id) values # armor (1, get_item_id_by_name('Armor Module "Tortoise"'), get_bonus_type_id_by_name('armor')), (2, get_item_id_by_name('Armor Module "Armadillo"'), get_bonus_type_id_by_name('armor')), # hp regen (5, get_item_id_by_name('HP Regen Module "Lisard"'), get_bonus_type_id_by_name('hp_regen')), (6, get_item_id_by_name('HP Regen Module "Tarrudo"'), get_bonus_type_id_by_name('hp_regen')), # energy regen (3, get_item_id_by_name('Energy Regen Module "Lanis"'), get_bonus_type_id_by_name('energy_regen')), (3, get_item_id_by_name('Energy Regen Module "Tadpole"'), get_bonus_type_id_by_name('energy_regen')); insert into weapon (damage, shot_delay, bullet_speed, max_distance, energy_cost, weapon_type_id, item_id) values # laser (43, 200, 30, 1000, 16, get_weapon_type_id_by_name('laser'), get_item_id_by_name(get_default_weapon_name())), (40, 300, 40, 1500, 15, get_weapon_type_id_by_name('laser'), get_item_id_by_name('Laser "Gyash"')), # rocket (25, 10, 100, 200, 10, get_weapon_type_id_by_name('rocket'), get_item_id_by_name('Rocket "Idario"')), (50, 15, 85, 300, 15, get_weapon_type_id_by_name('rocket'), get_item_id_by_name('Rocket "Pemelaya')); insert into engine (move_acceleration_bonus, move_max_speed_bonus, rotation_acceleration_bonus, rotation_max_speed_bonus, item_id) values (1, 5, 1, 2, get_item_id_by_name(get_default_engine_name())), (2, 6, 1, 2, get_item_id_by_name('Engine "Torelin"')), (3, 7, 2, 3, get_item_id_by_name('Engine "Radamaes"')), (4, 8, 3, 4, get_item_id_by_name('Engine "Hayale"')); # ships insert into ship_type (ship_type_name, ship_type_armor, ship_type_armor_durability, ship_type_energy_max, ship_type_hp_max, ship_type_energy_regen, ship_type_hp_regen, ship_type_move_max_speed, ship_type_move_acceleration, ship_type_rotation_max_speed, ship_type_rotation_acceleration, weapon_slots_count, bonus_slots_count) values (get_default_ship_type_name(), 100, 100, 100, 500, 5, 10, 10, 0.2, 1, 0.025, 3, 3), ('Jass', 120, 120, 120, 600, 6, 12, 40, 4, 5, 1, 4, 4); # test data insert into player (username, password, nickname, email, banned, activated) values ('test1', md5('test1'), 'test1', 'test1', 0, 1), ('test2', md5('test2'), 'test2', 'test2', 0, 1), ('test3', md5('test3'), 'test3', 'test3', 0, 1), ('test4', md5('test4'), 'test4', 'test4', 0, 1); call activate_player(get_player_id_by_username('test1')); call activate_player(get_player_id_by_username('test2')); call activate_player(get_player_id_by_username('test3')); call activate_player(get_player_id_by_username('test4'));
DROP TABLE dishes_ordered; DROP TABLE private; DROP TABLE orders; DROP TABLE subscriptionplan; DROP TABLE company; DROP TABLE CUSTOMER; DROP TABLE dish_menu; DROP TABLE menu; DROP TABLE dish; DROP TABLE salesman; DROP TABLE chef; DROP TABLE driver; DROP TABLE worker; DROP TABLE administration; DROP TABLE employee; DROP TABLE Users; DROP TABLE roles; DROP TABLE postalArea; CREATE TABLE PostalArea( postalCode INTEGER, postalArea VARCHAR(30) NOT NULL, CONSTRAINT postalArea_pk PRIMARY KEY(postalCode) ); CREATE TABLE ROLES( roleName VARCHAR(20), CONSTRAINT roles_pk PRIMARY KEY(roleName) ); CREATE TABLE users( username VARCHAR(20) NOT NULL, password VARCHAR(20) NOT NULL, namee VARCHAR(40), address VARCHAR(40) NOT NULL, postalCode INTEGER, roleName VARCHAR(20), CONSTRAINT users_pk PRIMARY KEY(username), CONSTRAINT users_fk1 FOREIGN KEY(postalCode) REFERENCES postalArea(postalCode), CONSTRAINT users_fk2 FOREIGN KEY(roleName) REFERENCES roles(roleName) ); CREATE TABLE EMPLOYEE( username VARCHAR(20) NOT NULL, employee_nr INTEGER NOT NULL, CONSTRAINT employee_fk FOREIGN KEY(username) REFERENCES users(username), CONSTRAINT employee_pk PRIMARY KEY(username) ); CREATE TABLE worker( username VARCHAR(20) NOT NULL, CONSTRAINT worker_fk FOREIGN KEY(username) REFERENCES users(username), CONSTRAINT worker_pk PRIMARY KEY(username) ); CREATE TABLE Driver( username VARCHAR(20) NOT NULL, CONSTRAINT driver_fk FOREIGN KEY(username) REFERENCES users(username), CONSTRAINT driver_pk PRIMARY KEY(username) ); CREATE TABLE Salesman( username VARCHAR(20) NOT NULL, CONSTRAINT salesman_fk FOREIGN KEY(username) REFERENCES users(username), CONSTRAINT salesman_pk PRIMARY KEY(username) ); CREATE TABLE chef( username VARCHAR(20) NOT NULL, CONSTRAINT chef_fk FOREIGN KEY(username) REFERENCES users(username), CONSTRAINT chef_pk PRIMARY KEY(username) ); CREATE TABLE administration( username VARCHAR(20) NOT NULL, CONSTRAINT administration_fk FOREIGN KEY(username) REFERENCES users(username), CONSTRAINT administration_pk PRIMARY KEY(username) ); CREATE TABLE CUSTOMER( username VARCHAR(20) NOT NULL, CONSTRAINT customer_fk FOREIGN KEY(username) REFERENCES users(username), CONSTRAINT customer_pk PRIMARY KEY(username) ); CREATE TABLE private( username VARCHAR(20) NOT NULL, CONSTRAINT private_fk FOREIGN KEY(username) REFERENCES users(username), CONSTRAINT private_pk PRIMARY KEY(username) ); CREATE TABLE company( username VARCHAR(20) NOT NULL, CONSTRAINT company_fk FOREIGN KEY(username) REFERENCES users(username), CONSTRAINT company_pk PRIMARY KEY(username) ); CREATE TABLE Subscriptionplan( subscriptionId INTEGER not null, startDate date, endDate date, companyUserName VarCHAR(20), CONSTRAINT subscriptionplan_pk PRIMARY KEY(subscriptionId), CONSTRAINT subscriptionplan_fk1 FOREIGN KEY(companyUserName) REFERENCES company(UserName) ); CREATE TABLE orders( orderId INTEGER NOT NULL, timeOfDelivery INT NOT NULL, deliveryAddress VARCHAR (50), status VARCHAR(15), dates date, userNameSalesman VARCHAR(20), userNameCustomer VARCHAR(20), subscriptionId INTEGER, postalCode INTEGER, CONSTRAINT orders_pk PRIMARY KEY(orderId), CONSTRAINT orders_fk1 FOREIGN KEY(userNameSalesman) REFERENCES Salesman(username), CONSTRAINT orders_fk2 FOREIGN KEY(userNameCustomer) REFERENCES Customer(username), CONSTRAINT orders_fk3 FOREIGN KEY(subscriptionId) REFERENCES Subscriptionplan(subscriptionid), CONSTRAINT orders_fk4 FOREIGN KEY(postalcode) REFERENCES postalArea(postalCode) ); CREATE TABLE dish( dishId INTEGER NOT NULL, dishName VARCHAR(50) NOT NULL, CONSTRAINT dish_pk PRIMARY KEY(dishId) ); CREATE TABLE menu( menuId INTEGER NOT NULL, CONSTRAINT menu_pk PRIMARY KEY(menuID) ); CREATE TABLE dish_menu ( dishId INTEGER NOT NULL, menuId INTEGER NOT NULL, CONSTRAINT dish_menu_fk1 FOREIGN KEY(dishId) REFERENCES dish(dishId), CONSTRAINT dish_menu_fk2 FOREIGN KEY(menuId) REFERENCES menu(menuId), CONSTRAINT dish_menu_pk PRIMARY KEY(dishId,menuId) ); CREATE TABLE dishes_ordered( dishId INTEGER NOT NULL, menuId INTEGER NOT NULL, orderId INTEGER NOT NULL, dishCount INTEGER NOT NULL, CONSTRAINT dishes_ordered_fk1 FOREIGN KEY(dishId,menuId) REFERENCES dish_menu(dishId,menuId), CONSTRAINT dishes_ordered_fk2 FOREIGN KEY(orderId) REFERENCES orders(orderID), CONSTRAINT dishes_ordered_pk PRIMARY KEY(orderId,dishId,menuId) );
SELECT val FROM ime WHERE attr="valid_input_chars"
-- CREATE DATABASE trubya_rails_development; -- CREATE USER jimmy WITH PASSWORD 'password'; -- GRANT ALL PRIVILEGES ON DATABASE trubya_rails_development TO jimmy; -- not used
/* Create and insert CTS prior to executing following commands */ delete from cms_cts_tasksbase where cms_correspondence in (select ID from cts_to_delete); delete from cms_cts_correspondence_actsofparliamentBase where cms_cts_correspondenceid in (select id from cts_to_delete); delete from cms_cts_correspondencebase where cms_cts_correspondenceid in (select ID from cts_to_delete); -- Create the following tables then run an insert from the Orphan script -- 1 - Find Orphan Accounts and insert in account_to_delete then execute delete delete from AccountBase where accountid in (select id from account_to_delete); -- 2 - Find Orphan Contacts and insert in contact_to_delete then execute delete delete from contactbase where contactid in (select id from contact_to_delete) and contactid not in ( select distinct cms_contact from systemuserbase where cms_contact is not null ); -- 3 - Find Orphan Accounts again and insert in account_to_delete then execute delete to delete account that were associated to orphan contacts (primary contacts) delete from AccountBase where accountid in (select id from account_to_delete); -- 4 - Find Orphan Contacts again and insert in contact_to_delete then execute delete to remove additional contacts that were associated to account with orphan contacts (primary contact) delete from contactbase where contactid in (select id from contact_to_delete) and contactid not in ( select distinct cms_contact from systemuserbase where cms_contact is not null );
CREATE TABLE [aud].[auditorias] ( [id_auditoria] INT IDENTITY (1, 1) NOT NULL, [codigo] VARCHAR (50) NOT NULL, [notificada] BIT NOT NULL, [fecha_inicio] DATETIME2 (0) NOT NULL, [fecha_fin] DATETIME2 (0) NOT NULL, [fecha_actualizacion] DATETIME2 (0) NOT NULL, CONSTRAINT [PK_auditorias] PRIMARY KEY CLUSTERED ([id_auditoria] ASC) );
USE `yiyun`; /*Data for the table `lm_product` */ insert into `lm_product`(`id`,`prd_type`,`title`,`content`,`agreemt`,`people`,`state`,`sort`,`create_time`,`update_time`) values (1,'A','银行抵押贷款','提供银行抵押贷款居间服务,为客户匹配最优银行,解决客户资金需求。','居间服务费:2%/次','名下有可抵押房产的客户。','1',1,'2018-06-23 03:59:33','2018-07-05 19:58:46'),(2,'B','银行信用贷款','提供银行抵押贷款居间服务,为客户匹配最优银行,解决客户资金需求。','居间服务费:2%/次','名下有可抵押房产的客户。','1',2,'2018-06-23 05:14:16','2018-07-05 19:58:55'),(3,'C','银行按揭贷款','提供银行抵押贷款居间服务,为客户匹配最优银行,解决客户资金需求。','居间服务费:2%/次','名下有可抵押房产的客户。','1',3,'2018-06-23 04:50:07','2018-07-05 19:59:04'); commit;
CREATE TABLE [Maestro].[Moneda] ( [ID] INT IDENTITY (1, 1) NOT NULL, [Nombre] VARCHAR (50) NULL, [CodigoSunat] CHAR (3) NULL, [Simbolo] CHAR (4) NULL, PRIMARY KEY CLUSTERED ([ID] ASC) );
-- phpMyAdmin SQL Dump -- version 4.6.5.2 -- https://www.phpmyadmin.net/ -- -- 主機: 127.0.0.1 -- 產生時間: 2017-05-04 17:21:25 -- 伺服器版本: 10.1.21-MariaDB -- PHP 版本: 5.6.30 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- 資料庫: `marathon` -- -- -------------------------------------------------------- -- -- 資料表結構 `marathon21012018` -- CREATE Database IF NOT EXISTS `marathon` DEFAULT CHARACTER SET utf8; CREATE TABLE IF NOT EXISTS `marathon`. `marathon21012018` ( `FirstName` varchar(50) NOT NULL, `LastName` varchar(50) NOT NULL, `Gender` varchar(50) NOT NULL, `DOB` varchar(50) NOT NULL, `Email` varchar(50) NOT NULL, `PhoneNumber` varchar(40) NOT NULL, `Event` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- 資料表結構 `member` -- CREATE TABLE IF NOT EXISTS `marathon`. `member` ( `Email` varchar(50) NOT NULL, `Password` varchar(50) NOT NULL, `FirstName` varchar(50) NOT NULL, `LastName` varchar(50) NOT NULL, `Age` int(2) NOT NULL, `PhoneNumber` varchar(40) NOT NULL, `DOB` varchar(50) NOT NULL, `Gender` varchar(50) NOT NULL, `Type` varchar(6) NOT NULL DEFAULT 'member' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- 資料表的匯出資料 `member` -- INSERT INTO `marathon`.`member` (`Email`, `Password`, `FirstName`, `LastName`, `Age`, `PhoneNumber`, `DOB`, `Gender`, `Type`) VALUES ('123@123', 'qweqwe', 'a', 'bc', 1, '555555', '2017-04-06', 'male', 'admin'), ('aaa@aaa.com', '123456789', 'bbb', 'ccc', 13, '55555', '2017-05-01', 'male', 'member'), ('abc@abc', 'qwe', 'qweabc', 'F', 1, '5038964010', '2017-04-06', 'F', 'member'), ('admin@vtc.edu.hk', '12345678', 'admin', 'admin', 18, '55555555', '2001-05-02', 'male', 'member'), ('bcc@bcc', '123', 'bcc', 'bcc', 13, '123456789', '2017-05-11', 'male', 'member'), ('qwe@wqeqwe', 'qwe', 'qwe', 'qweqwe', 13, '5038964010', '2017-05-07', 'male', 'member'); -- -------------------------------------------------------- -- -- 資料表結構 `news` -- CREATE TABLE IF NOT EXISTS `marathon`. `news` ( `id` int(3) NOT NULL, `date` varchar(20) NOT NULL, `topic` varchar(1000) NOT NULL, `content` varchar(5000) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- 資料表的匯出資料 `news` -- INSERT INTO `marathon`.`news` (`id`, `date`, `topic`, `content`) VALUES (1, '13 April 2017', 'Hong Kong Amateur Athletic Association - Tender for Marathon Secretariat Service (Entries & Runners\'Communication)', 'Hong Kong Amateur Athletic Association (HKAAA) is the governing body of athletics in Hong Kong with the mission of promoting and developing road races, track and field, race walking and cross-country events in Hong Kong. With the continuous development of the Standard Chartered Hong Kong Marathon, the HKAAA wishes to invite application to provide secretariat services (Entries & Runners\'Communication) to this major event on a maximum of 3 years\'contract term.'), (2, '13 April 2017', 'Hong Kong Amateur Athletic Association - Tender for Marathon Secretariat Service (Organization & Operations)', 'Hong Kong Amateur Athletic Association (HKAAA) is the governing body of athletics in Hong Kong with the mission of promoting and developing road races, track and field, race walking and cross-country events in Hong Kong. With the continuous development of the Standard Chartered Hong Kong Marathon, the HKAAA wishes to invite application to provide secretariat services (Organization & Operations) to this major event on a maximum of 3 years\'contract term.'), (3, '13 April 2017', 'Hong Kong Amateur Athletic Association - Tender for Marathon Website Project', 'Hong Kong Amateur Athletic Association (HKAAA) is the governing body of athletics in Hong Kong with the mission of promoting and developing road races, track and field, race walking and cross-country events in Hong Kong. With the continuous development of the Standard Chartered Hong Kong Marathon, the HKAAA wishes to invite a tender for the provisions of a new Website Project for the Standard Chartered Hong Kong Marathon.'), (5, '03 May 2017', '123', '123'); -- -- 已匯出資料表的索引 -- -- -- 資料表索引 `marathon21012018` -- ALTER TABLE `marathon`.`marathon21012018` ADD PRIMARY KEY (`Email`); -- -- 資料表索引 `member` -- ALTER TABLE `marathon`.`member` ADD PRIMARY KEY (`Email`); -- -- 資料表索引 `news` -- ALTER TABLE `marathon`.`news` ADD PRIMARY KEY (`id`); -- -- 在匯出的資料表使用 AUTO_INCREMENT -- -- -- 使用資料表 AUTO_INCREMENT `news` -- ALTER TABLE `marathon`. `news` MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
DROP TABLE IF EXISTS review; CREATE TABLE review ( game_id SERIAL PRIMARY KEY, price VARCHAR(255), title VARCHAR(50), age_require TEXT, release_date DATE, description VARCHAR(255), developer VARCHAR(50) ); INSERT INTO review ( game_id, price, title, age_require, release_date, description, developer) VALUES ('Review 1' , 'Body text 1'); INSERT INTO review ( game_id, price, title, age_require, release_date, description, developer) VALUES ('Review 2' , 'Body text 2'); INSERT INTO review ( game_id, price, title, age_require, release_date, description, developer) VALUES ('Review 3' , 'Body text 3'); INSERT INTO review ( game_id, price, title, age_require, release_date, description, developer) VALUES ('Review 4' , 'Body text 4'); INSERT INTO review ( game_id, price, title, age_require, release_date, description, developer) VALUES ('Review 5' , 'Body text 5'); INSERT INTO review ( game_id, price, title, age_require, release_date, description, developer) VALUES ('Review 6' , 'Body text 6'); INSERT INTO review ( game_id, price, title, age_require, release_date, description, developer) VALUES ('Review 7' , 'Body text 7');
DROP TABLE IF EXISTS `{database_prefix}users`; CREATE TABLE `users`( `id` INT(11) NOT NULL AUTO_INCREMENT, `username` VARCHAR(255) NOT NULL, `password` VARCHAR(40) NOT NULL, `email` VARCHAR(255) NOT NULL, `code` VARCHAR(32) DEFAULT '' NOT NULL, `active` TINYINT(1) DEFAULT '0' NOT NULL, `activation_time` INT(11) DEFAULT '0' NOT NULL, `last_login` INT(11) DEFAULT '0' NOT NULL, `last_session` VARCHAR(40) DEFAULT '' NOT NULL, `blocked` TINYINT(1) DEFAULT '0' NOT NULL, `tries` TINYINT(2) DEFAULT '0' NOT NULL, `last_try` INT(11) DEFAULT '0' NOT NULL, `last_action` INT(11) DEFAULT '0' NOT NULL, `group_id` INT(11) DEFAULT '0' NOT NULL, `mask_id` INT(11) DEFAULT '0' NOT NULL, PRIMARY KEY(`id`), INDEX `users_idx` (`username`), INDEX `users_idx2` (`code`), INDEX `users_idx3` (`last_login`), INDEX `users_idx4` (`last_session`), INDEX `users_idx5` (`last_try`), INDEX `users_idx6` (`activation_time`), INDEX `users_idx7` (`last_action`) ); DROP TABLE IF EXISTS `{database_prefix}sessions`; CREATE TABLE `{database_prefix}sessions`( `user_id` INT(11) NOT NULL, `value` VARCHAR(40) DEFAULT '' NOT NULL, `time` INT(11) DEFAULT '0' NOT NULL, PRIMARY KEY(`user_id`), INDEX `sessions_idx` (`value`,`time`) ); DROP TABLE IF EXISTS `{database_prefix}config`; CREATE TABLE `{database_prefix}config`( `id` TINYINT(4) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `value` VARCHAR(255) NOT NULL, PRIMARY KEY(`id`) ); DROP TABLE IF EXISTS `{database_prefix}registration_fields`; CREATE TABLE `{database_prefix}registration_fields`( `id` SMALLINT(6) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) DEFAULT '' NOT NULL, `maxvalue` VARCHAR(255) NOT NULL, `minvalue` VARCHAR(255) NOT NULL, `confirm` TINYINT(1) DEFAULT 0 NOT NULL, `regex` VARCHAR(255) DEFAULT '' NOT NULL );
-- phpMyAdmin SQL Dump -- version 4.6.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: 2017-05-10 02:52:56 -- 服务器版本: 5.7.14 -- PHP Version: 5.6.25 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: `xihaxueche` -- -- -------------------------------------------------------- -- -- 表的结构 `cs_bank_config` -- DROP TABLE IF EXISTS `cs_bank_config` ; CREATE TABLE `cs_bank_config` ( `id` int(11) NOT NULL, `bank_no` varchar(20) NOT NULL, `bank_name` varchar(32) NOT NULL, `bank_code` varchar(20) NOT NULL, `card_type` varchar(10) NOT NULL COMMENT '卡类型缩写 CC 信用卡 DC储蓄卡(借记卡)', `addtime` bigint(14) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='银行配置表'; -- -- 转存表中的数据 `cs_bank_config` -- INSERT INTO `cs_bank_config` (`id`, `bank_no`, `bank_name`, `bank_code`, `card_type`, `addtime`) VALUES (1, 'ICBC', '工商银行(借记卡)', 'ICBC_DEBIT', 'DC', 11231231), (2, 'ICBC', '工商银行(信用卡)', 'ICBC_CREDIT', 'CC', 11231232), (3, 'ABC', '农业银行(借记卡)', 'ABC_DEBIT', 'DC', 11231233), (4, 'ABC', '农业银行(信用卡)', 'ABC_CREDIT', 'CC', 11231234), (5, 'PSBC', '邮政储蓄银行(借记卡)', 'PSBC_DEBIT', 'DC', 11231235), (6, 'PSBC', '邮政储蓄银行(信用卡)', 'PSBC_CREDIT', 'CC', 11231236), (7, 'CCB', '建设银行(借记卡)', 'CCB_DEBIT', 'DC', 11231237), (8, 'CCB', '建设银行(信用卡)', 'CCB_CREDIT', 'CC', 11231238), (9, 'CMB', '招商银行(借记卡)', 'CMB_DEBIT', 'DC', 11231239), (10, 'CMB', '招商银行(信用卡)', 'CMB_CREDIT', 'CC', 11231240), (11, 'BOC', '中国银行(借记卡)', 'BOC_DEBIT', 'DC', 11231241), (12, 'BOC', '中国银行(信用卡)', 'BOC_CREDIT', 'CC', 11231242), (13, 'COMM', '交通银行(借记卡)', 'COMM_DEBIT', 'DC', 11231243), (14, 'COMM', '交通银行(信用卡)', 'COMM_CREDIT', 'CC', 11231244), (15, 'SPDB', '浦发银行(借记卡)', 'SPDB_DEBIT', 'DC', 11231245), (16, 'SPDB', '浦发银行(信用卡)', 'SPDB_CREDIT', 'CC', 11231246), (17, 'GDB', '广发银行(借记卡)', 'GDB_DEBIT', 'DC', 11231247), (18, 'GDB', '广发银行(信用卡)', 'GDB_CREDIT', 'CC', 11231248), (19, 'CMBC', '民生银行(借记卡)', 'CMBC_DEBIT', 'DC', 11231249), (20, 'CMBC', '民生银行(信用卡)', 'CMBC_CREDIT', 'CC', 11231250), (21, 'PAB', '平安银行(借记卡)', 'PAB_DEBIT', 'DC', 11231251), (22, 'PAB', '平安银行(信用卡)', 'PAB_CREDIT', 'CC', 11231252), (23, 'CEB', '光大银行(借记卡)', 'CEB_DEBIT', 'DC', 11231253), (24, 'CEB', '光大银行(信用卡)', 'CEB_CREDIT', 'CC', 11231254), (25, 'CIB', '兴业银行(借记卡)', 'CIB_DEBIT', 'DC', 11231255), (26, 'CIB', '兴业银行(信用卡)', 'CIB_CREDIT', 'CC', 11231256), (27, 'CITIC', '中信银行(借记卡)', 'CITIC_DEBIT', 'DC', 11231257), (28, 'CITIC', '中信银行(信用卡)', 'CITIC_CREDIT', 'CC', 11231258), (29, 'BOSH', '上海银行(借记卡)', 'BOSH_DEBIT', 'DC', 11231259), (30, 'BOSH', '上海银行(信用卡)', 'BOSH_CREDIT', 'CC', 11231260), (31, 'CRB', '华润银行(借记卡)', 'CRB_DEBIT', 'DC', 11231261), (32, 'HZB', '杭州银行(借记卡)', 'HZB_DEBIT', 'DC', 11231262), (33, 'HZB', '杭州银行(信用卡)', 'HZB_CREDIT', 'CC', 11231263), (34, 'BSB', '包商银行(借记卡)', 'BSB_DEBIT', 'DC', 11231264), (35, 'BSB', '包商银行(信用卡)', 'BSB_CREDIT', 'CC', 11231265), (36, 'CQB', '重庆银行(借记卡)', 'CQB_DEBIT', 'DC', 11231266), (37, 'SDEB', '顺德农商行(借记卡)', 'SDEB_DEBIT', 'DC', 11231267), (38, 'SZRCB', '深圳农商银行(借记卡)', 'SZRCB_DEBIT', 'DC', 11231268), (39, 'SZRCB', '深圳农商银行(信用卡)', 'SZRCB_CREDIT', 'CC', 11231269), (40, 'HRBB', '哈尔滨银行(借记卡)', 'HRBB_DEBIT', 'DC', 11231270), (41, 'BOCD', '成都银行(借记卡)', 'BOCD_DEBIT', 'DC', 11231271), (42, 'GDNYB', '南粤银行(借记卡)', 'GDNYB_DEBIT', 'DC', 11231272), (43, 'GDNYB', '南粤银行(信用卡)', 'GDNYB_CREDIT', 'CC', 11231273), (44, 'GZCB', '广州银行(借记卡)', 'GZCB_DEBIT', 'DC', 11231274), (45, 'GZCB', '广州银行(信用卡)', 'GZCB_CREDIT', 'CC', 11231275), (46, 'JSB', '江苏银行(借记卡)', 'JSB_DEBIT', 'DC', 11231276), (47, 'JSB', '江苏银行(信用卡)', 'JSB_CREDIT', 'CC', 11231277), (48, 'NBCB', '宁波银行(借记卡)', 'NBCB_DEBIT', 'DC', 11231278), (49, 'NBCB', '宁波银行(信用卡)', 'NBCB_CREDIT', 'CC', 11231279), (50, 'NJCB', '南京银行(借记卡)', 'NJCB_DEBIT', 'DC', 11231280), (51, 'QHNX', '青海农信(借记卡)', 'QHNX_DEBIT', 'DC', 11231281), (52, 'ORDOSB', '鄂尔多斯银行(信用卡)', 'ORDOSB_CREDIT', 'CC', 11231282), (53, 'ORDOSB', '鄂尔多斯银行(借记卡)', 'ORDOSB_DEBIT', 'DC', 11231283), (54, 'BJRCB', '北京农商(信用卡)', 'BJRCB_CREDIT', 'CC', 11231284), (55, 'BHB', '河北银行(借记卡)', 'BHB_DEBIT', 'DC', 11231285), (56, 'BGZB', '贵州银行(借记卡)', 'BGZB_DEBIT', 'DC', 11231286), (57, 'BEEB', '鄞州银行(借记卡)', 'BEEB_DEBIT', 'DC', 11231287), (58, 'PZHCCB', '攀枝花银行(借记卡)', 'PZHCCB_DEBIT', 'DC', 11231288), (59, 'QDCCB', '青岛银行(信用卡)', 'QDCCB_CREDIT', 'CC', 11231289), (60, 'QDCCB', '青岛银行(借记卡)', 'QDCCB_DEBIT', 'DC', 11231290), (61, 'SHINHAN', '新韩银行(借记卡)', 'SHINHAN_DEBIT', 'DC', 11231291), (62, 'QLB', '齐鲁银行(借记卡)', 'QLB_DEBIT', 'DC', 11231292), (63, 'QSB', '齐商银行(借记卡)', 'QSB_DEBIT', 'DC', 11231293), (64, 'ZZB', '郑州银行(借记卡)', 'ZZB_DEBIT', 'DC', 11231294), (65, 'CCAB', '长安银行(借记卡)', 'CCAB_DEBIT', 'DC', 11231295), (66, 'RZB', '日照银行(借记卡)', 'RZB_DEBIT', 'DC', 11231296), (67, 'SCNX', '四川农信(借记卡)', 'SCNX_DEBIT', 'DC', 11231297), (68, 'BEEB', '鄞州银行(信用卡)', 'BEEB_CREDIT', 'CC', 11231298), (69, 'SDRCU', '山东农信(借记卡)', 'SDRCU_DEBIT', 'DC', 11231299), (70, 'BCZ', '沧州银行(借记卡)', 'BCZ_DEBIT', 'DC', 11231300), (71, 'SJB', '盛京银行(借记卡)', 'SJB_DEBIT', 'DC', 11231301), (72, 'LNNX', '辽宁农信(借记卡)', 'LNNX_DEBIT', 'DC', 11231302), (73, 'JUFENGB', '临朐聚丰村镇银行(借记卡)', 'JUFENGB_DEBIT', 'DC', 11231303), (74, 'ZZB', '郑州银行(信用卡)', 'ZZB_CREDIT', 'CC', 11231304), (75, 'JXNXB', '江西农信(借记卡)', 'JXNXB_DEBIT', 'DC', 11231305), (76, 'JZB', '晋中银行(借记卡)', 'JZB_DEBIT', 'DC', 11231306), (77, 'JZCB', '锦州银行(信用卡)', 'JZCB_CREDIT', 'CC', 11231307), (78, 'JZCB', '锦州银行(借记卡)', 'JZCB_DEBIT', 'DC', 11231308), (79, 'KLB', '昆仑银行(借记卡)', 'KLB_DEBIT', 'DC', 11231309), (80, 'KRCB', '昆山农商(借记卡)', 'KRCB_DEBIT', 'DC', 11231310), (81, 'KUERLECB', '库尔勒市商业银行(借记卡)', 'KUERLECB_DEBIT', 'DC', 11231311), (82, 'LJB', '龙江银行(借记卡)', 'LJB_DEBIT', 'DC', 11231312), (83, 'NYCCB', '南阳村镇银行(借记卡)', 'NYCCB_DEBIT', 'DC', 11231313), (84, 'LSCCB', '乐山市商业银行(借记卡)', 'LSCCB_DEBIT', 'DC', 11231314), (85, 'LUZB', '柳州银行(借记卡)', 'LUZB_DEBIT', 'DC', 11231315), (86, 'LWB', '莱商银行(借记卡)', 'LWB_DEBIT', 'DC', 11231316), (87, 'LYYHB', '辽阳银行(借记卡)', 'LYYHB_DEBIT', 'DC', 11231317), (88, 'LZB', '兰州银行(借记卡)', 'LZB_DEBIT', 'DC', 11231318), (89, 'MINTAIB', '民泰银行(信用卡)', 'MINTAIB_CREDIT', 'CC', 11231319), (90, 'MINTAIB', '民泰银行(借记卡)', 'MINTAIB_DEBIT', 'DC', 11231320), (91, 'NCB', '宁波通商银行(借记卡)', 'NCB_DEBIT', 'DC', 11231321), (92, 'NMGNX', '内蒙古农信(借记卡)', 'NMGNX_DEBIT', 'DC', 11231322), (93, 'XAB', '西安银行(借记卡)', 'XAB_DEBIT', 'DC', 11231323), (94, 'WFB', '潍坊银行(信用卡)', 'WFB_CREDIT', 'CC', 11231324), (95, 'WFB', '潍坊银行(借记卡)', 'WFB_DEBIT', 'DC', 11231325), (96, 'WHB', '威海商业银行(信用卡)', 'WHB_CREDIT', 'CC', 11231326), (97, 'WHB', '威海市商业银行(借记卡)', 'WHB_DEBIT', 'DC', 11231327), (98, 'WHRC', '武汉农商(信用卡)', 'WHRC_CREDIT', 'CC', 11231328), (99, 'WHRC', '武汉农商行(借记卡)', 'WHRC_DEBIT', 'DC', 11231329), (100, 'WJRCB', '吴江农商行(借记卡)', 'WJRCB_DEBIT', 'DC', 11231330), (101, 'WLMQB', '乌鲁木齐银行(借记卡)', 'WLMQB_DEBIT', 'DC', 11231331), (102, 'WRCB', '无锡农商(借记卡)', 'WRCB_DEBIT', 'DC', 11231332), (103, 'WZB', '温州银行(借记卡)', 'WZB_DEBIT', 'DC', 11231333), (104, 'XAB', '西安银行(信用卡)', 'XAB_CREDIT', 'CC', 11231334), (105, 'WEB', '微众银行(借记卡)', 'WEB_DEBIT', 'DC', 11231335), (106, 'XIB', '厦门国际银行(借记卡)', 'XIB_DEBIT', 'DC', 11231336), (107, 'XJRCCB', '新疆农信银行(借记卡)', 'XJRCCB_DEBIT', 'DC', 11231337), (108, 'XMCCB', '厦门银行(借记卡)', 'XMCCB_DEBIT', 'DC', 11231338), (109, 'YNRCCB', '云南农信(借记卡)', 'YNRCCB_DEBIT', 'DC', 11231339), (110, 'YRRCB', '黄河农商银行(信用卡)', 'YRRCB_CREDIT', 'CC', 11231340), (111, 'YRRCB', '黄河农商银行(借记卡)', 'YRRCB_DEBIT', 'DC', 11231341), (112, 'YTB', '烟台银行(借记卡)', 'YTB_DEBIT', 'DC', 11231342), (113, 'ZJB', '紫金农商银行(借记卡)', 'ZJB_DEBIT', 'DC', 11231343), (114, 'ZJLXRB', '兰溪越商银行(借记卡)', 'ZJLXRB_DEBIT', 'DC', 11231344), (115, 'ZJRCUB', '浙江农信(信用卡)', 'ZJRCUB_CREDIT', 'CC', 11231345), (116, 'AHRCUB', '安徽省农村信用社联合社(借记卡)', 'AHRCUB_DEBIT', 'DC', 11231346), (117, 'BCZ', '沧州银行(信用卡)', 'BCZ_CREDIT', 'CC', 11231347), (118, 'SRB', '上饶银行(借记卡)', 'SRB_DEBIT', 'DC', 11231348), (119, 'ZYB', '中原银行(借记卡)', 'ZYB_DEBIT', 'DC', 11231349), (120, 'ZRCB', '张家港农商行(借记卡)', 'ZRCB_DEBIT', 'DC', 11231350), (121, 'SRCB', '上海农商银行(信用卡)', 'SRCB_CREDIT', 'CC', 11231351), (122, 'SRCB', '上海农商银行(借记卡)', 'SRCB_DEBIT', 'DC', 11231352), (123, 'ZJTLCB', '浙江泰隆银行(借记卡)', 'ZJTLCB_DEBIT', 'DC', 11231353), (124, 'SUZB', '苏州银行(借记卡)', 'SUZB_DEBIT', 'DC', 11231354), (125, 'SXNX', '山西农信(借记卡)', 'SXNX_DEBIT', 'DC', 11231355), (126, 'SXXH', '陕西信合(借记卡)', 'SXXH_DEBIT', 'DC', 11231356), (127, 'ZJRCUB', '浙江农信(借记卡)', 'ZJRCUB_DEBIT', 'DC', 11231357), (128, 'AE', 'AE(信用卡)', 'AE_CREDIT', 'CC', 11231358), (129, 'TACCB', '泰安银行(信用卡)', 'TACCB_CREDIT', 'CC', 11231359), (130, 'TACCB', '泰安银行(借记卡)', 'TACCB_DEBIT', 'DC', 11231360), (131, 'TCRCB', '太仓农商行(借记卡)', 'TCRCB_DEBIT', 'DC', 11231361), (132, 'TJBHB', '天津滨海农商行(信用卡)', 'TJBHB_CREDIT', 'CC', 11231362), (133, 'TJBHB', '天津滨海农商行(借记卡)', 'TJBHB_DEBIT', 'DC', 11231363), (134, 'TJB', '天津银行(借记卡)', 'TJB_DEBIT', 'DC', 11231364), (135, 'TRCB', '天津农商(借记卡)', 'TRCB_DEBIT', 'DC', 11231365), (136, 'TZB', '台州银行(借记卡)', 'TZB_DEBIT', 'DC', 11231366), (137, 'URB', '联合村镇银行(借记卡)', 'URB_DEBIT', 'DC', 11231367), (138, 'DYB', '东营银行(信用卡)', 'DYB_CREDIT', 'CC', 11231368), (139, 'CSRCB', '常熟农商银行(借记卡)', 'CSRCB_DEBIT', 'DC', 11231369), (140, 'CZB', '浙商银行(信用卡)', 'CZB_CREDIT', 'CC', 11231370), (141, 'CZB', '浙商银行(借记卡)', 'CZB_DEBIT', 'DC', 11231371), (142, 'CZCB', '稠州银行(信用卡)', 'CZCB_CREDIT', 'CC', 11231372), (143, 'CZCB', '稠州银行(借记卡)', 'CZCB_DEBIT', 'DC', 11231373), (144, 'DANDONGB', '丹东银行(信用卡)', 'DANDONGB_CREDIT', 'CC', 11231374), (145, 'DANDONGB', '丹东银行(借记卡)', 'DANDONGB_DEBIT', 'DC', 11231375), (146, 'DLB', '大连银行(信用卡)', 'DLB_CREDIT', 'CC', 11231376), (147, 'DLB', '大连银行(借记卡)', 'DLB_DEBIT', 'DC', 11231377), (148, 'DRCB', '东莞农商银行(信用卡)', 'DRCB_CREDIT', 'CC', 11231378), (149, 'DRCB', '东莞农商银行(借记卡)', 'DRCB_DEBIT', 'DC', 11231379), (150, 'CSRCB', '常熟农商银行(信用卡)', 'CSRCB_CREDIT', 'CC', 11231380), (151, 'DYB', '东营银行(借记卡)', 'DYB_DEBIT', 'DC', 11231381), (152, 'DYCCB', '德阳银行(借记卡)', 'DYCCB_DEBIT', 'DC', 11231382), (153, 'FBB', '富邦华一银行(借记卡)', 'FBB_DEBIT', 'DC', 11231383), (154, 'FDB', '富滇银行(借记卡)', 'FDB_DEBIT', 'DC', 11231384), (155, 'FJHXB', '福建海峡银行(信用卡)', 'FJHXB_CREDIT', 'CC', 11231385), (156, 'FJHXB', '福建海峡银行(借记卡)', 'FJHXB_DEBIT', 'DC', 11231386), (157, 'FJNX', '福建农信银行(借记卡)', 'FJNX_DEBIT', 'DC', 11231387), (158, 'FUXINB', '阜新银行(借记卡)', 'FUXINB_DEBIT', 'DC', 11231388), (159, 'BOCDB', '承德银行(借记卡)', 'BOCDB_DEBIT', 'DC', 11231389), (160, 'JSNX', '江苏农商行(借记卡)', 'JSNX_DEBIT', 'DC', 11231390), (161, 'BOLFB', '廊坊银行(借记卡)', 'BOLFB_DEBIT', 'DC', 11231391), (162, 'CCAB', '长安银行(信用卡)', 'CCAB_CREDIT', 'CC', 11231392), (163, 'CBHB', '渤海银行(借记卡)', 'CBHB_DEBIT', 'DC', 11231393), (164, 'CDRCB', '成都农商银行(借记卡)', 'CDRCB_DEBIT', 'DC', 11231394), (165, 'BYK', '营口银行(借记卡)', 'BYK_DEBIT', 'DC', 11231395), (166, 'BOZ', '张家口市商业银行(借记卡)', 'BOZ_DEBIT', 'DC', 11231396), (167, 'CFT', 'CFT', 'CFT', 'CFT', 11231397), (168, 'BOTSB', '唐山银行(借记卡)', 'BOTSB_DEBIT', 'DC', 11231398), (169, 'BOSZS', '石嘴山银行(借记卡)', 'BOSZS_DEBIT', 'DC', 11231399), (170, 'BOSXB', '绍兴银行(借记卡)', 'BOSXB_DEBIT', 'DC', 11231400), (171, 'BONX', '宁夏银行(借记卡)', 'BONX_DEBIT', 'DC', 11231401), (172, 'BONX', '宁夏银行(信用卡)', 'BONX_CREDIT', 'CC', 11231402), (173, 'GDHX', '广东华兴银行(借记卡)', 'GDHX_DEBIT', 'DC', 11231403), (174, 'BOLB', '洛阳银行(借记卡)', 'BOLB_DEBIT', 'DC', 11231404), (175, 'BOJX', '嘉兴银行(借记卡)', 'BOJX_DEBIT', 'DC', 11231405), (176, 'BOIMCB', '内蒙古银行(借记卡)', 'BOIMCB_DEBIT', 'DC', 11231406), (177, 'BOHN', '海南银行(借记卡)', 'BOHN_DEBIT', 'DC', 11231407), (178, 'BOD', '东莞银行(借记卡)', 'BOD_DEBIT', 'DC', 11231408), (179, 'CQRCB', '重庆农商银行(信用卡)', 'CQRCB_CREDIT', 'CC', 11231409), (180, 'CQRCB', '重庆农商银行(借记卡)', 'CQRCB_DEBIT', 'DC', 11231410), (181, 'CQTGB', '重庆三峡银行(借记卡)', 'CQTGB_DEBIT', 'DC', 11231411), (182, 'BOD', '东莞银行(信用卡)', 'BOD_CREDIT', 'CC', 11231412), (183, 'CSCB', '长沙银行(借记卡)', 'CSCB_DEBIT', 'DC', 11231413), (184, 'BOB', '北京银行(信用卡)', 'BOB_CREDIT', 'CC', 11231414), (185, 'GDRCU', '广东农信银行(借记卡)', 'GDRCU_DEBIT', 'DC', 11231415), (186, 'BOB', '北京银行(借记卡)', 'BOB_DEBIT', 'DC', 11231416), (187, 'HRXJB', '华融湘江银行(借记卡)', 'HRXJB_DEBIT', 'DC', 11231417), (188, 'HSBC', '恒生银行(借记卡)', 'HSBC_DEBIT', 'DC', 11231418), (189, 'HSB', '徽商银行(信用卡)', 'HSB_CREDIT', 'CC', 11231419), (190, 'HSB', '徽商银行(借记卡)', 'HSB_DEBIT', 'DC', 11231420), (191, 'HUNNX', '湖南农信(借记卡)', 'HUNNX_DEBIT', 'DC', 11231421), (192, 'HUSRB', '湖商村镇银行(借记卡)', 'HUSRB_DEBIT', 'DC', 11231422), (193, 'HXB', '华夏银行(信用卡)', 'HXB_CREDIT', 'CC', 11231423), (194, 'HXB', '华夏银行(借记卡)', 'HXB_DEBIT', 'DC', 11231424), (195, 'HNNX', '河南农信(借记卡)', 'HNNX_DEBIT', 'DC', 11231425), (196, 'BNC', '江西银行(借记卡)', 'BNC_DEBIT', 'DC', 11231426), (197, 'BNC', '江西银行(信用卡)', 'BNC_CREDIT', 'CC', 11231427), (198, 'BJRCB', '北京农商行(借记卡)', 'BJRCB_DEBIT', 'DC', 11231428), (199, 'JCB', '晋城银行(借记卡)', 'JCB_DEBIT', 'DC', 11231429), (200, 'JJCCB', '九江银行(借记卡)', 'JJCCB_DEBIT', 'DC', 11231430), (201, 'JLB', '吉林银行(借记卡)', 'JLB_DEBIT', 'DC', 11231431), (202, 'JLNX', '吉林农信(借记卡)', 'JLNX_DEBIT', 'DC', 11231432), (203, 'JNRCB', '江南农商(借记卡)', 'JNRCB_DEBIT', 'DC', 11231433), (204, 'JRCB', '江阴农商行(借记卡)', 'JRCB_DEBIT', 'DC', 11231434), (205, 'JSHB', '晋商银行(借记卡)', 'JSHB_DEBIT', 'DC', 11231435), (206, 'HAINNX', '海南农信(借记卡)', 'HAINNX_DEBIT', 'DC', 11231436), (207, 'GLB', '桂林银行(借记卡)', 'GLB_DEBIT', 'DC', 11231437), (208, 'GRCB', '广州农商银行(信用卡)', 'GRCB_CREDIT', 'CC', 11231438), (209, 'GRCB', '广州农商银行(借记卡)', 'GRCB_DEBIT', 'DC', 11231439), (210, 'GSB', '甘肃银行(借记卡)', 'GSB_DEBIT', 'DC', 11231440), (211, 'GSNX', '甘肃农信(借记卡)', 'GSNX_DEBIT', 'DC', 11231441), (212, 'GXNX', '广西农信(借记卡)', 'GXNX_DEBIT', 'DC', 11231442), (213, 'GYCB', '贵阳银行(信用卡)', 'GYCB_CREDIT', 'CC', 11231443), (214, 'GYCB', '贵阳银行(借记卡)', 'GYCB_DEBIT', 'DC', 11231444), (215, 'GZNX', '贵州农信(借记卡)', 'GZNX_DEBIT', 'DC', 11231445), (216, 'HAINNX', '海南农信(信用卡)', 'HAINNX_CREDIT', 'CC', 11231446), (217, 'HKB', '汉口银行(借记卡)', 'HKB_DEBIT', 'DC', 11231447), (218, 'HANAB', '韩亚银行(借记卡)', 'HANAB_DEBIT', 'DC', 11231448), (219, 'HBCB', '湖北银行(信用卡)', 'HBCB_CREDIT', 'CC', 11231449), (220, 'HBCB', '湖北银行(借记卡)', 'HBCB_DEBIT', 'DC', 11231450), (221, 'HBNX', '湖北农信(信用卡)', 'HBNX_CREDIT', 'CC', 11231451), (222, 'HBNX', '湖北农信(借记卡)', 'HBNX_DEBIT', 'DC', 11231452), (223, 'HDCB', '邯郸银行(借记卡)', 'HDCB_DEBIT', 'DC', 11231453), (224, 'HEBNX', '河北农信(借记卡)', 'HEBNX_DEBIT', 'DC', 11231454), (225, 'HFB', '恒丰银行(借记卡)', 'HFB_DEBIT', 'DC', 11231455), (226, 'HKBEA', '东亚银行(借记卡)', 'HKBEA_DEBIT', 'DC', 11231456), (227, 'JCB', 'JCB(信用卡)', 'JCB_CREDIT', 'CC', 11231457), (228, 'MASTERCARD', 'MASTERCARD(信用卡)', 'MASTERCARD_CREDIT', 'CC', 11231458), (229, 'VISA', 'VISA(信用卡)', 'VISA_CREDIT', 'CC', 11231459); -- -- Indexes for dumped tables -- -- -- Indexes for table `cs_bank_config` -- ALTER TABLE `cs_bank_config` ADD PRIMARY KEY (`id`); -- -- 在导出的表使用AUTO_INCREMENT -- -- -- 使用表AUTO_INCREMENT `cs_bank_config` -- ALTER TABLE `cs_bank_config` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=230; /*!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 */;
-- 1. Instanz-Name max. 42 Zeichen alphanumerisch ALTER TABLE f_instances CHANGE COLUMN instanceName instanceName VARCHAR(42); -- 2. StorageNames max. 30 Zeichen alphanumerisch ALTER TABLE f_files CHANGE COLUMN storageName storageName VARCHAR(30); -- 3. Löschen des Eintrags "Casestudy1" DELETE FROM f_entries WHERE headline = 'Casestudy1'; -- 4. Löschaktionen aus dem log selektieren SELECT * FROM f_log WHERE scope = 'file deletion'; -- 5. numOfPics aus f_files entfernen ALTER TABLE f_files DROP COLUMN numOfPics; -- 6. Sinnvoll Verknüpfung von f_files mit f_users (Anm. Mir erschienen nur jene User sinnvoll, die upgedoadet haben.) SELECT * FROM f_users INNER JOIN f_files ON f_users.id = f_files.uploadedBy; -- 7. User, die Berechtigung für World #2 haben SELECT username, CONCAT (prename, ' ', surname) AS Name, instanceName FROM f_users, f_instances WHERE f_instances.instanceName = 'World #2'; -- 8. Welche Datei liegt auf welcher Instanz? Anm. Pfuh, da durchschau ich die Tabellen nicht. :-( SELECT storageName, instanceName FROM f_files, f_instances; -- 9. Wie viele unterschiedliche Messages gibt es im Log? "379 rows" werden auch ohne "Count" angezeigt. SELECT DISTINCT message FROM f_log; -- 10. Maximal 3 Einlog-Versuche UPDATE f_options SET value = 3 WHERE id = max-login-attempts; -- Die Fehlermeldung versteh ich leider nicht. Man könnte es elegant umgehen, indem man die Zeilennummer als "Where" -- nimmt, aber dann ist was Neues einfügen eher blöd.
DROP DATABASE IF EXISTS learning_through_test; CREATE DATABASE learning_through_test;
insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 30, 20); insert into mensaje values (NULL,'2020-06-08', 28, 20); insert into mensaje values (NULL,'2020-06-08', 30, 20); insert into mensaje values (NULL,'2020-06-08', 28, 20); insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 30, 20); insert into mensaje values (NULL,'2020-06-08', 28, 20); insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 30, 20); insert into mensaje values (NULL,'2020-06-08', 30, 20); insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 30, 20); insert into mensaje values (NULL,'2020-06-08', 30, 20); insert into mensaje values (NULL,'2020-06-08', 28, 20); insert into mensaje values (NULL,'2020-06-08', 28, 20); insert into mensaje values (NULL,'2020-06-08', 30, 20); insert into mensaje values (NULL,'2020-06-08', 29, 20); insert into mensaje values (NULL,'2020-06-08', 28, 20); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 9, 10); insert into mensaje values (NULL,'2020-06-08', 10, 10); insert into mensaje values (NULL,'2020-06-08', 10, 10); insert into mensaje values (NULL,'2020-06-08', 9, 10); insert into mensaje values (NULL,'2020-06-08', 10, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 10, 10); insert into mensaje values (NULL,'2020-06-08', 10, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 9, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 9, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 9, 10); insert into mensaje values (NULL,'2020-06-08', 10, 10); insert into mensaje values (NULL,'2020-06-08', 10, 10); insert into mensaje values (NULL,'2020-06-08', 9, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 11, 10); insert into mensaje values (NULL,'2020-06-08', 9, 30); insert into mensaje values (NULL,'2020-06-08', 11, 30); insert into mensaje values (NULL,'2020-06-08', 11, 30); insert into mensaje values (NULL,'2020-06-08', 11, 30); insert into mensaje values (NULL,'2020-06-08', 9, 30); insert into mensaje values (NULL,'2020-06-08', 15, 30); insert into mensaje values (NULL,'2020-06-08', 15, 30); insert into mensaje values (NULL,'2020-06-08', 12, 30); insert into mensaje values (NULL,'2020-06-08', 9, 30); insert into mensaje values (NULL,'2020-06-08', 17, 30); insert into mensaje values (NULL,'2020-06-08', 15, 30); insert into mensaje values (NULL,'2020-06-08', 15, 30); insert into mensaje values (NULL,'2020-06-08', 10, 30); insert into mensaje values (NULL,'2020-06-08', 17, 30); insert into mensaje values (NULL,'2020-06-08', 16, 30); insert into mensaje values (NULL,'2020-06-08', 14, 30); insert into mensaje values (NULL,'2020-06-08', 12, 30); insert into mensaje values (NULL,'2020-06-08', 9, 30); insert into mensaje values (NULL,'2020-06-08', 14, 30); insert into mensaje values (NULL,'2020-06-08', 16, 30); insert into mensaje values (NULL,'2020-06-08', 14, 30); insert into mensaje values (NULL,'2020-06-08', 11, 30); insert into mensaje values (NULL,'2020-06-08', 14, 30); insert into mensaje values (NULL,'2020-06-08', 16, 30); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 0, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40); insert into mensaje values (NULL,'2020-06-08', 1, 40);
create database db_escola; create table tb_estudantes( id_estudante INT AUTO_INCREMENT, nome VARCHAR (100), turma VARCHAR (100), idade VARCHAR (100), nota FLOAT NULL, email VARCHAR (100), primary key(id_estudante) ); USE db_escola; insert into tb_estudantes (nome,turma,idade,nota,email) values ("Pedro Tavares","4° A", "10","8.0","pedrinho_1996@gmail.com"), ("Rebeca Pereira","6° A", "13","6.0","rebecaboneca@gmail.com"), ("Jaqueline Andrade","9° A", "16","4.0","jaquelineperfeitinha@gmail.com"), ("Rodrigo Gustavo","2° B", "5","3.0","rodrigo_cmp@gmail.com"), ("Yasmim frança","6° A", "13","8.0","yasmimfranca@gmail.com"), ("Alison Ferreira","4° A", "12","7.0","alisonferreira@gmail.com"), ("Tânia Maria","8° A", "15","5.0","taniamaria@gmail.com"), ("Paulo Aurelio","7° B", "10","3.0","paulodogera@gmail.com"); select * from tb_estudantes where nota>7; select * from tb_estudantes where nota<7; use db_escola; update tb_estudantes set nota=3.0 where id_estudante=4;
alter table tokens add created_at timestamptz DEFAULT (now())
DELIMITER $$ DROP TRIGGER IF EXISTS setUserAccumNewSub $$ CREATE TRIGGER setUserAccumNewSub AFTER INSERT ON cm_substances FOR EACH ROW BEGIN DECLARE done INT DEFAULT FALSE; DECLARE srvUserId VARCHAR(10); DECLARE column_cursor CURSOR FOR SELECT client_id FROM cm_clients ; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN column_cursor; read_loop: LOOP FETCH column_cursor INTO srvUserId; IF done THEN LEAVE read_loop; END IF; INSERT INTO cm_client_substance_accum VALUES (srvUserId, new.substance , new.reset_value, NEW.Created_By, curdate()); END LOOP; CLOSE column_cursor; END$$ DELIMITER ;
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: localhost Database: destiny -- ------------------------------------------------------ -- Server version 5.7.18-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 `accounts` -- DROP TABLE IF EXISTS `accounts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accounts` ( `account_id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(20) NOT NULL, `password` char(130) NOT NULL DEFAULT '', `salt` blob, PRIMARY KEY (`account_id`), KEY `username` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `characters` -- DROP TABLE IF EXISTS `characters`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `characters` ( `character_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(12) NOT NULL, `account_id` int(11) NOT NULL, `world_id` tinyint(3) unsigned NOT NULL, `gender` tinyint(1) unsigned NOT NULL DEFAULT '0', `skin` tinyint(4) unsigned NOT NULL DEFAULT '0', `face` int(11) NOT NULL, `hair` int(11) NOT NULL, `level` tinyint(3) unsigned NOT NULL DEFAULT '1', `job` smallint(6) NOT NULL DEFAULT '0', `strength` smallint(6) NOT NULL DEFAULT '12', `dexterity` smallint(6) NOT NULL DEFAULT '5', `intelligence` smallint(6) NOT NULL DEFAULT '4', `luck` smallint(6) NOT NULL DEFAULT '4', `health` smallint(6) NOT NULL DEFAULT '50', `max_health` smallint(6) NOT NULL DEFAULT '50', `mana` smallint(6) NOT NULL DEFAULT '5', `max_mana` smallint(6) NOT NULL DEFAULT '5', `ability_points` smallint(6) NOT NULL DEFAULT '0', `skill_points` smallint(6) NOT NULL DEFAULT '0', `experience` int(11) NOT NULL DEFAULT '0', `fame` smallint(6) NOT NULL DEFAULT '0', `map` int(11) NOT NULL DEFAULT '0', `map_spawn` tinyint(3) unsigned NOT NULL DEFAULT '0', `mesos` int(11) NOT NULL DEFAULT '0', `equipment_slots` tinyint(3) unsigned NOT NULL DEFAULT '24', `usable_slots` tinyint(3) unsigned NOT NULL DEFAULT '24', `setup_slots` tinyint(3) unsigned NOT NULL DEFAULT '24', `etcetera_slots` tinyint(3) unsigned NOT NULL DEFAULT '24', `cash_slots` tinyint(3) unsigned NOT NULL DEFAULT '48', `buddylist_size` int(3) NOT NULL DEFAULT '20', `overall_cpos` int(11) DEFAULT NULL, `overall_opos` int(11) DEFAULT NULL, `world_cpos` int(11) DEFAULT NULL, `world_opos` int(11) DEFAULT NULL, `job_cpos` int(11) DEFAULT NULL, `job_opos` int(11) DEFAULT NULL, `fame_cpos` int(11) DEFAULT NULL, `fame_opos` int(11) DEFAULT NULL, `book_cover` int(11) DEFAULT NULL, PRIMARY KEY (`character_id`), KEY `account_id` (`account_id`), KEY `world_id` (`world_id`), KEY `name` (`name`), CONSTRAINT `characters_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `items` -- DROP TABLE IF EXISTS `items`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `items` ( `character_id` int(11) NOT NULL DEFAULT '0', `inventory` tinyint(3) unsigned NOT NULL DEFAULT '0', `slot` smallint(6) NOT NULL DEFAULT '0', `item_identifier` int(11) NOT NULL DEFAULT '0', `quantity` smallint(6) NOT NULL DEFAULT '1', `slots` tinyint(4) unsigned DEFAULT NULL, `scrolls` tinyint(4) unsigned DEFAULT NULL, `strength` smallint(6) DEFAULT NULL, `dexterity` smallint(6) DEFAULT NULL, `intelligence` smallint(6) DEFAULT NULL, `luck` smallint(6) DEFAULT NULL, `health` smallint(6) DEFAULT NULL, `mana` smallint(6) DEFAULT NULL, `weapon_attack` smallint(6) DEFAULT NULL, `magic_attack` smallint(6) DEFAULT NULL, `weapon_defense` smallint(6) DEFAULT NULL, `magic_defense` smallint(6) DEFAULT NULL, `accuracy` smallint(6) DEFAULT NULL, `avoidability` smallint(6) DEFAULT NULL, `hands` smallint(6) DEFAULT NULL, `speed` smallint(6) DEFAULT NULL, `jump` smallint(6) DEFAULT NULL, `flags` tinyint(3) DEFAULT NULL, `hammers` tinyint(3) DEFAULT NULL, `pet_id` bigint(23) unsigned DEFAULT NULL, `name` varchar(12) DEFAULT NULL, `expiration` datetime DEFAULT NULL, PRIMARY KEY (`character_id`,`inventory`,`slot`), KEY `pet_id` (`pet_id`), CONSTRAINT `items_ibfk_1` FOREIGN KEY (`character_id`) REFERENCES `characters` (`character_id`) ON DELETE CASCADE, CONSTRAINT `items_ibfk_2` FOREIGN KEY (`pet_id`) REFERENCES `pets` (`pet_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `pets` -- DROP TABLE IF EXISTS `pets`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `pets` ( `pet_id` bigint(23) unsigned NOT NULL AUTO_INCREMENT, `index` tinyint(3) DEFAULT NULL, `name` varchar(12) NOT NULL, `level` tinyint(3) NOT NULL DEFAULT '1', `closeness` smallint(6) NOT NULL DEFAULT '0', `fullness` tinyint(3) NOT NULL DEFAULT '1', PRIMARY KEY (`pet_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2017-05-30 12:39:27
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Máy chủ: 127.0.0.1 -- Thời gian đã tạo: Th10 10, 2020 lúc 11:31 AM -- Phiên bản máy phục vụ: 10.4.11-MariaDB -- Phiên bản PHP: 7.2.30 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Cơ sở dữ liệu: `csdl_gvtdg_1` -- -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `category_evaluation` -- CREATE TABLE `category_evaluation` ( `id` int(11) NOT NULL, `ca_title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `ca_desc` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `create_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `category_evaluation` -- INSERT INTO `category_evaluation` (`id`, `ca_title`, `ca_desc`, `create_at`, `updated_at`) VALUES (6, 'Các nhiệm vụ', 'Các nhiệm vụ', '2020-11-10 07:05:51', '2020-11-10 07:05:51'), (7, 'Thông tin về học phần và chương trình đào tạo', 'Thông tin về học phần và chương trình đào tạo', '2020-11-10 07:05:51', '2020-11-10 07:05:51'), (8, 'Kiểm tra, đánh giá', 'Kiểm tra, đánh giá', '2020-11-10 07:05:51', '2020-11-10 07:05:51'), (9, 'Một số hoạt động quản trị', 'Một số hoạt động quản trị', '2020-11-10 07:05:51', '2020-11-10 07:05:51'), (10, 'Công tác hỗ trợ và cơ sở vật chất phục vụ giảng dạy học phần', 'Công tác hỗ trợ và cơ sở vật chất phục vụ giảng dạy học phần', '2020-11-10 07:05:51', '2020-11-10 07:05:51'); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `evaluation` -- CREATE TABLE `evaluation` ( `eva_id` int(11) NOT NULL, `eva_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `eva_ad_create_point` int(11) NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp(), `ca_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `evaluation` -- INSERT INTO `evaluation` (`eva_id`, `eva_name`, `eva_ad_create_point`, `created_at`, `updated_at`, `ca_id`) VALUES (32, 'Thiết kế các hoạt động giảng dạy và học tập phù hợp để đạt được chuẩn đầu ra tương ứng của học phần', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (33, 'Tạo cơ hội cho sinh viên tích cực tham gia vào các hoạt động học tập\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (34, 'Đổi mới phương pháp giảng dạy trong học phần được phân công\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (35, 'Hướng dẫn sinh viên phương pháp học tập trong quá trình dạy học nhằm thúc đẩy khả năng học tập suốt đời', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (36, 'Thực hiện đủ thời lượng, nội dung của học phần theo kế hoạch, đề cương học phần đã công bố', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (37, 'Phản hồi kết quả kiểm tra đánh giá giúp sinh viên cải thiện kết quả học tập', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (38, 'Hỗ trợ sinh viên trong học tập và nghiên cứu', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (39, 'Ứng dụng công nghệ trong dạy học', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (40, 'Thực hiện chuẩn mực của nhà giáo (lên lớp đúng giờ, giao tiếp và ứng xử đúng mực với sinh viên…)', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (41, 'Chất lượng thực hiện công tác cố vấn học tập (nếu có tham gia)', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (42, 'Chất lượng thực hiện công tác quản lý từ cấp bộ môn trở lên (nếu có tham gia)', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (43, 'Hoàn thành định mức nghiên cứu khoa học trong năm', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (44, 'Tự bồi dưỡng và nâng cao trình độ', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (45, 'Cung cấp đầy đủ thông tin về học phần cho sinh viên theo quy định', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 6), (46, 'Giảng viên chủ động cập nhật kiến thức mới phục vụ nội dung học phần được phân công giảng dạy', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 7), (47, 'Giảng viên được tham gia xây dựng và đóng góp ý kiến điều chỉnh học phần', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 7), (48, 'Giảng viên được tham gia xây dựng và đóng góp ý kiến điều chỉnh chương trình đào tạo', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 7), (49, 'Phương pháp kiểm tra đánh giá sử dụng trong học phần phù hợp với chuẩn đầu ra tương ứng của học phần', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 8), (50, 'Việc kiểm tra, đánh giá kết quả học tập của sinh viên được rà soát và đánh giá thường xuyên để đảm bảo sự tương thích và phù hợp với chuẩn đầu ra.\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 8), (51, 'Việc tổ chức ra đề thi, chấm thi được thực hiện theo đúng quy định', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 8), (52, 'Văn bản về triết lý giáo dục của Nhà trường được phổ biến tới giảng viên\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 9), (53, 'Nhu cầu được đào tạo và tham gia các khóa học bồi dưỡng nâng cao trình độ và kỹ năng của giảng viên được Nhà trường đáp ứng\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 9), (54, 'Kết quả làm việc của giảng viên được đánh giá công bằng\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 9), (55, 'Giảng viên hài lòng đối với các chính sách đãi ngộ chung của Nhà trường\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 9), (56, 'Có đủ phòng học với trang thiết bị phù hợp để hỗ trợ hoạt động đào tạo và nghiên cứu trong phạm vi học phần\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 10), (57, 'Có đủ phòng làm việc với trang thiết bị phù hợp để hỗ trợ hoạt động đào tạo và nghiên cứu trong phạm vi học phần\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 10), (58, 'Có đủ phòng thí nghiệm hoặc phòng thực hành và trang thiết bị phù hợp để hỗ trợ các hoạt động đào tạo và nghiên cứu trong phạm vi học phần\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 10), (59, 'Các yêu cầu sửa chữa cơ sở vật chất hoặc trang thiết bị phục vụ học tập, nghiên cứu được đáp ứng\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 10), (60, 'Thư viện và các nguồn học liệu phù hợp và được cập nhật để hỗ trợ các hoạt động đào tạo và nghiên cứu trong phạm vi học phần\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 10), (61, 'Cơ sở hạ tầng công nghệ hỗ trợ việc ứng dụng công nghệ thông tin vào dạy và học đáp ứng được yêu cầu\r\n', 5, '2020-11-10 07:12:34', '2020-11-10 07:12:34', 10); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `password_resets` -- CREATE TABLE `password_resets` ( `id` int(20) NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `password_resets` -- INSERT INTO `password_resets` (`id`, `email`, `token`, `created_at`, `updated_at`) VALUES (5, 'dangvantu1999@gmail.com', '$2y$10$iW94V2Z7Xb8RrgPTHKQuTO6XfwIhoxfPhq6lbNxO8K4hHeWC9N0za', '2020-11-06 20:46:25', '2020-11-07 03:46:25'), (12, 'dangvantuadv@gmail.com', '$2y$10$KlSqddNOsGYMhhFsCklhLuB1cAJZLMw5yPMSvPUNhO8QJlBokugRW', '2020-11-07 00:16:02', '2020-11-07 07:16:02'); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `school` -- CREATE TABLE `school` ( `sch_id` int(11) NOT NULL, `sch_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `sch_address` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `school` -- INSERT INTO `school` (`sch_id`, `sch_name`, `sch_address`, `created_at`, `updated_at`) VALUES (1, 'Đại học khoa học tự nhiên', 'Nguyễn Trãi - Thanh Xuân - Hà Nội', '2020-10-28 07:50:03', '2020-10-28 07:50:03'), (2, 'Đại học Khoa học Xã hội & Nhân văn', 'Số 336 đường Nguyễn Trãi, quận Thanh Xuân, Hà Nội', '2020-10-29 11:48:34', '2020-10-29 11:48:34'), (3, 'Đại học Giáo dục', 'Nhà G7, số 144 đường Xuân Thuỷ, quận Cầu Giấy, Hà Nội', '2020-10-29 11:48:34', '2020-10-29 11:48:34'); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `science` -- CREATE TABLE `science` ( `sci_id` int(11) NOT NULL, `sci_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `sci_id_school` int(11) NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `science` -- INSERT INTO `science` (`sci_id`, `sci_name`, `sci_id_school`, `created_at`, `updated_at`) VALUES (1, 'Toán-Cơ-Tin học', 1, '2020-10-28 07:50:27', '2020-10-28 07:50:27'), (2, 'Sinh học', 1, '2020-10-29 11:46:55', '2020-10-29 11:46:55'), (3, 'Ngôn ngữ học', 2, '2020-10-29 11:50:54', '2020-10-29 11:50:54'), (4, 'Quốc tế học', 2, '2020-10-29 11:50:54', '2020-10-29 11:50:54'); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `semester` -- CREATE TABLE `semester` ( `se_id` int(11) NOT NULL, `se_year` int(11) NOT NULL, `se_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `semester` -- INSERT INTO `semester` (`se_id`, `se_year`, `se_name`, `created_at`, `updated_at`) VALUES (1, 2019, 'Học kì 1', '2020-10-29 11:52:46', '2020-10-29 11:52:46'), (2, 2019, 'Học kì 2', '2020-10-29 11:52:46', '2020-10-29 11:52:46'), (3, 2019, 'Học kì hè', '2020-10-29 11:52:46', '2020-10-29 11:52:46'), (4, 2020, 'Học kì 1', '2020-10-29 11:52:46', '2020-10-29 11:52:46'); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `statistic` -- CREATE TABLE `statistic` ( `st_id` int(11) NOT NULL, `st_us_id` int(11) NOT NULL, `st_sum_point` int(11) NOT NULL, `st_standard_deviation` double NOT NULL, `updated_at` timestamp NOT NULL DEFAULT current_timestamp(), `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `se_id` int(11) NOT NULL, `average_score` double NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `statistic` -- INSERT INTO `statistic` (`st_id`, `st_us_id`, `st_sum_point`, `st_standard_deviation`, `updated_at`, `created_at`, `se_id`, `average_score`) VALUES (2, 2, 140, 0, '2020-10-29 12:07:24', '2020-10-29 12:07:24', 4, 0); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `users` -- CREATE TABLE `users` ( `us_id` int(11) NOT NULL, `us_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `us_is_admin` int(1) DEFAULT NULL, `us_is_active` int(1) DEFAULT NULL, `us_sci_id` int(11) NOT NULL, `us_id_school` int(11) NOT NULL, `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp(), `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `email_verified_at` timestamp NOT NULL DEFAULT current_timestamp(), `remember_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `us_avatar` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `status` int(1) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `users` -- INSERT INTO `users` (`us_id`, `us_name`, `us_is_admin`, `us_is_active`, `us_sci_id`, `us_id_school`, `password`, `created_at`, `updated_at`, `email`, `email_verified_at`, `remember_token`, `us_avatar`, `status`) VALUES (2, 'Đặng Văn Tú', 1, NULL, 1, 1, '$2y$10$3szJbPrk2z/hO5FsU239me8jQUdN4QmCEhyWFezCPpiYzySAQmsWa', '2020-10-28 00:51:12', '2020-11-10 03:01:15', 'dangvantu1999@gmail.com', '2020-10-28 07:51:12', 'qia7splINzqVDIKNRs4nmfzu4cqdrTzM33MPi6oScOiyYliMDFfjiqR4wdSY', '/uploads/profile/20201106145613.jpg', 0), (6, 'add1', 1, NULL, 1, 1, '$2y$10$KHXWiOBhUeYYpra2ATvMiur1jbiwpxexIZgzaN6ULEMqTT5APhT06', '2020-10-31 01:55:30', '2020-10-31 01:55:30', 'add1@gmail.com', '2020-10-31 08:55:30', NULL, '/uploads/profile/default.png', 0), (7, 'test', 1, NULL, 2, 1, '$2y$10$qMdXygEwlJm5hhAoNW527OTJupz5Ikibd.mmJOyrOI0bDj5bm1e4a', '2020-11-05 20:55:11', '2020-11-05 20:55:27', 'test@gmail.com', '2020-11-06 03:55:11', NULL, '/uploads/profile/default.png', 0), (8, 'dangvantu', 2, NULL, 1, 1, '$2y$10$flukID6HyGxGJa7P9cdCNOPZg0Mwv9WbKPEseqihQ6RDyBy1V422S', '2020-11-06 02:09:52', '2020-11-06 03:04:09', 'vantund2017@gmail.com', '2020-11-06 09:09:52', NULL, '/uploads/profile/default.png', 0), (9, 'dangvantu', 1, NULL, 1, 1, '$2y$10$2Xks8GqnhI2JkPJXMt620O7iJaiAlkNNJM2TEMiPxlQZORTg3Zg0u', '2020-11-06 18:18:04', '2020-11-06 18:18:04', 'adv@gmail.com', '2020-11-07 01:18:04', NULL, '/uploads/profile/default.png', 0), (11, 'gv1', 2, NULL, 1, 1, '$2y$10$56IsSpEo7380huPX/15kY.Hj.D9.pwwx3Ueo/deyLjCPVemeU1RdW', '2020-11-10 03:13:53', '2020-11-10 03:30:09', 'gv@gmail.com', '2020-11-10 10:13:53', 'ATuVTHs74uzlqJrABAS6bKtFIDmI4HJIO6Jl54oZw8v6lzlcpY3j9K1IHEvx', '/uploads/profile/default.png', 1); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `user_eval_sem` -- CREATE TABLE `user_eval_sem` ( `id` int(11) NOT NULL, `us_id` int(11) NOT NULL, `se_id` int(11) NOT NULL, `eval_id` int(11) NOT NULL, `user_rate_point` int(11) NOT NULL, `updated_at` timestamp NOT NULL DEFAULT current_timestamp(), `created_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `user_eval_sem` -- INSERT INTO `user_eval_sem` (`id`, `us_id`, `se_id`, `eval_id`, `user_rate_point`, `updated_at`, `created_at`) VALUES (3, 2, 4, 32, 1, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (4, 2, 4, 33, 2, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (5, 2, 4, 34, 3, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (6, 2, 4, 35, 4, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (7, 2, 4, 36, 5, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (8, 2, 4, 37, 3, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (9, 2, 4, 38, 2, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (10, 2, 4, 39, 3, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (11, 2, 4, 40, 2, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (12, 2, 4, 41, 5, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (13, 2, 4, 42, 5, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (14, 2, 4, 43, 4, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (15, 2, 4, 44, 3, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (16, 2, 4, 45, 4, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (17, 2, 4, 46, 5, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (18, 2, 4, 47, 5, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (19, 2, 4, 48, 5, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (20, 2, 4, 49, 1, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (21, 2, 4, 50, 2, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (22, 2, 4, 51, 3, '2020-11-10 02:10:10', '2020-11-10 02:10:10'), (23, 2, 4, 52, 3, '2020-11-10 02:10:11', '2020-11-10 02:10:11'), (24, 2, 4, 53, 1, '2020-11-10 02:10:11', '2020-11-10 02:10:11'), (25, 2, 4, 54, 2, '2020-11-10 02:10:11', '2020-11-10 02:10:11'), (26, 2, 4, 55, 5, '2020-11-10 02:10:11', '2020-11-10 02:10:11'), (27, 2, 4, 56, 1, '2020-11-10 02:10:11', '2020-11-10 02:10:11'), (28, 2, 4, 57, 3, '2020-11-10 02:10:11', '2020-11-10 02:10:11'), (29, 2, 4, 58, 2, '2020-11-10 02:10:11', '2020-11-10 02:10:11'), (30, 2, 4, 60, 1, '2020-11-10 02:10:11', '2020-11-10 02:10:11'), (31, 2, 4, 32, 1, '2020-11-10 02:11:52', '2020-11-10 02:11:52'), (32, 2, 4, 33, 2, '2020-11-10 02:11:52', '2020-11-10 02:11:52'), (33, 2, 4, 32, 1, '2020-11-10 02:58:54', '2020-11-10 02:58:54'), (34, 2, 4, 33, 4, '2020-11-10 02:58:54', '2020-11-10 02:58:54'), (35, 2, 4, 34, 2, '2020-11-10 02:58:54', '2020-11-10 02:58:54'), (36, 2, 4, 35, 5, '2020-11-10 02:58:54', '2020-11-10 02:58:54'), (37, 11, 4, 32, 1, '2020-11-10 03:23:13', '2020-11-10 03:23:13'), (38, 11, 4, 33, 2, '2020-11-10 03:23:13', '2020-11-10 03:23:13'), (39, 11, 4, 34, 3, '2020-11-10 03:23:13', '2020-11-10 03:23:13'), (40, 11, 4, 35, 5, '2020-11-10 03:23:13', '2020-11-10 03:23:13'), (41, 11, 4, 36, 2, '2020-11-10 03:23:13', '2020-11-10 03:23:13'), (42, 11, 4, 37, 3, '2020-11-10 03:23:13', '2020-11-10 03:23:13'), (43, 11, 4, 38, 4, '2020-11-10 03:23:13', '2020-11-10 03:23:13'), (44, 11, 4, 39, 2, '2020-11-10 03:23:13', '2020-11-10 03:23:13'), (45, 11, 4, 40, 5, '2020-11-10 03:23:13', '2020-11-10 03:23:13'), (46, 11, 4, 41, 2, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (47, 11, 4, 42, 3, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (48, 11, 4, 43, 3, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (49, 11, 4, 44, 2, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (50, 11, 4, 45, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (51, 11, 4, 46, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (52, 11, 4, 47, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (53, 11, 4, 48, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (54, 11, 4, 49, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (55, 11, 4, 50, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (56, 11, 4, 51, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (57, 11, 4, 52, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (58, 11, 4, 53, 3, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (59, 11, 4, 54, 2, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (60, 11, 4, 55, 3, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (61, 11, 4, 56, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (62, 11, 4, 57, 3, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (63, 11, 4, 58, 2, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (64, 11, 4, 59, 5, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (65, 11, 4, 60, 2, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (66, 11, 4, 61, 3, '2020-11-10 03:23:14', '2020-11-10 03:23:14'), (67, 11, 4, 32, 1, '2020-11-10 03:28:33', '2020-11-10 03:28:33'), (68, 11, 4, 33, 2, '2020-11-10 03:28:33', '2020-11-10 03:28:33'), (69, 11, 4, 34, 3, '2020-11-10 03:28:33', '2020-11-10 03:28:33'), (70, 11, 4, 35, 2, '2020-11-10 03:28:33', '2020-11-10 03:28:33'), (71, 11, 4, 36, 5, '2020-11-10 03:28:33', '2020-11-10 03:28:33'), (72, 11, 4, 37, 3, '2020-11-10 03:28:33', '2020-11-10 03:28:33'), (73, 11, 4, 32, 1, '2020-11-10 03:30:08', '2020-11-10 03:30:08'), (74, 11, 4, 33, 2, '2020-11-10 03:30:08', '2020-11-10 03:30:08'), (75, 11, 4, 34, 1, '2020-11-10 03:30:08', '2020-11-10 03:30:08'), (76, 11, 4, 35, 3, '2020-11-10 03:30:09', '2020-11-10 03:30:09'), (77, 11, 4, 49, 1, '2020-11-10 03:30:09', '2020-11-10 03:30:09'), (78, 11, 4, 50, 2, '2020-11-10 03:30:09', '2020-11-10 03:30:09'), (79, 11, 4, 51, 2, '2020-11-10 03:30:09', '2020-11-10 03:30:09'); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `user_self_think` -- CREATE TABLE `user_self_think` ( `id` int(11) NOT NULL, `us_id` int(11) NOT NULL, `se_id` int(11) NOT NULL, `us_self_think` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Đang đổ dữ liệu cho bảng `user_self_think` -- INSERT INTO `user_self_think` (`id`, `us_id`, `se_id`, `us_self_think`, `created_at`, `updated_at`) VALUES (1, 11, 4, 'sssssssssssssssssssssssssssssss', '2020-11-10 03:23:12', '2020-11-10 03:23:12'), (2, 11, 4, '3333333333333333333333333', '2020-11-10 03:28:33', '2020-11-10 03:28:33'), (3, 11, 4, '3333333333333333333333333', '2020-11-10 03:30:08', '2020-11-10 03:30:08'); -- -- Chỉ mục cho các bảng đã đổ -- -- -- Chỉ mục cho bảng `category_evaluation` -- ALTER TABLE `category_evaluation` ADD PRIMARY KEY (`id`); -- -- Chỉ mục cho bảng `evaluation` -- ALTER TABLE `evaluation` ADD PRIMARY KEY (`eva_id`), ADD KEY `eva_id` (`eva_id`,`eva_name`,`eva_ad_create_point`,`created_at`,`updated_at`), ADD KEY `ca_id` (`ca_id`); -- -- Chỉ mục cho bảng `password_resets` -- ALTER TABLE `password_resets` ADD PRIMARY KEY (`id`); -- -- Chỉ mục cho bảng `school` -- ALTER TABLE `school` ADD PRIMARY KEY (`sch_id`), ADD KEY `sch_id` (`sch_id`,`sch_name`,`sch_address`,`created_at`,`updated_at`); -- -- Chỉ mục cho bảng `science` -- ALTER TABLE `science` ADD PRIMARY KEY (`sci_id`), ADD KEY `sci_id` (`sci_id`,`sci_name`,`sci_id_school`,`created_at`,`updated_at`), ADD KEY `sci_id_school` (`sci_id_school`); -- -- Chỉ mục cho bảng `semester` -- ALTER TABLE `semester` ADD PRIMARY KEY (`se_id`), ADD KEY `se_id` (`se_id`,`se_year`,`se_name`,`created_at`,`updated_at`); -- -- Chỉ mục cho bảng `statistic` -- ALTER TABLE `statistic` ADD PRIMARY KEY (`st_id`), ADD KEY `st_id` (`st_id`,`st_us_id`,`st_sum_point`,`st_standard_deviation`,`updated_at`,`created_at`), ADD KEY `st_us_id` (`st_us_id`), ADD KEY `st_id_2` (`st_id`,`st_us_id`,`st_sum_point`,`st_standard_deviation`,`updated_at`,`created_at`,`se_id`), ADD KEY `se_id` (`se_id`); -- -- Chỉ mục cho bảng `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`us_id`), ADD KEY `us_id` (`us_id`,`us_name`,`us_is_admin`,`us_is_active`,`us_sci_id`,`us_id_school`,`password`,`created_at`,`updated_at`), ADD KEY `us_id_school` (`us_id_school`), ADD KEY `us_sci_id` (`us_sci_id`); -- -- Chỉ mục cho bảng `user_eval_sem` -- ALTER TABLE `user_eval_sem` ADD PRIMARY KEY (`id`), ADD KEY `id` (`id`,`us_id`,`se_id`,`eval_id`), ADD KEY `se_id` (`se_id`), ADD KEY `eval_id` (`eval_id`), ADD KEY `us_id` (`us_id`); -- -- Chỉ mục cho bảng `user_self_think` -- ALTER TABLE `user_self_think` ADD PRIMARY KEY (`id`), ADD KEY `id` (`id`,`us_id`,`se_id`,`us_self_think`), ADD KEY `us_id` (`us_id`), ADD KEY `se_id` (`se_id`); -- -- AUTO_INCREMENT cho các bảng đã đổ -- -- -- AUTO_INCREMENT cho bảng `category_evaluation` -- ALTER TABLE `category_evaluation` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT cho bảng `evaluation` -- ALTER TABLE `evaluation` MODIFY `eva_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=62; -- -- AUTO_INCREMENT cho bảng `password_resets` -- ALTER TABLE `password_resets` MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT cho bảng `school` -- ALTER TABLE `school` MODIFY `sch_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT cho bảng `science` -- ALTER TABLE `science` MODIFY `sci_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT cho bảng `semester` -- ALTER TABLE `semester` MODIFY `se_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT cho bảng `statistic` -- ALTER TABLE `statistic` MODIFY `st_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT cho bảng `users` -- ALTER TABLE `users` MODIFY `us_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT cho bảng `user_eval_sem` -- ALTER TABLE `user_eval_sem` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=80; -- -- AUTO_INCREMENT cho bảng `user_self_think` -- ALTER TABLE `user_self_think` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- Các ràng buộc cho các bảng đã đổ -- -- -- Các ràng buộc cho bảng `evaluation` -- ALTER TABLE `evaluation` ADD CONSTRAINT `evaluation_ibfk_1` FOREIGN KEY (`ca_id`) REFERENCES `category_evaluation` (`id`); -- -- Các ràng buộc cho bảng `science` -- ALTER TABLE `science` ADD CONSTRAINT `science_ibfk_1` FOREIGN KEY (`sci_id_school`) REFERENCES `school` (`sch_id`); -- -- Các ràng buộc cho bảng `statistic` -- ALTER TABLE `statistic` ADD CONSTRAINT `statistic_ibfk_1` FOREIGN KEY (`st_us_id`) REFERENCES `users` (`us_id`), ADD CONSTRAINT `statistic_ibfk_2` FOREIGN KEY (`se_id`) REFERENCES `semester` (`se_id`); -- -- Các ràng buộc cho bảng `users` -- ALTER TABLE `users` ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`us_id_school`) REFERENCES `school` (`sch_id`), ADD CONSTRAINT `users_ibfk_2` FOREIGN KEY (`us_sci_id`) REFERENCES `science` (`sci_id`); -- -- Các ràng buộc cho bảng `user_eval_sem` -- ALTER TABLE `user_eval_sem` ADD CONSTRAINT `user_eval_sem_ibfk_1` FOREIGN KEY (`se_id`) REFERENCES `semester` (`se_id`), ADD CONSTRAINT `user_eval_sem_ibfk_2` FOREIGN KEY (`eval_id`) REFERENCES `evaluation` (`eva_id`), ADD CONSTRAINT `user_eval_sem_ibfk_3` FOREIGN KEY (`us_id`) REFERENCES `users` (`us_id`); -- -- Các ràng buộc cho bảng `user_self_think` -- ALTER TABLE `user_self_think` ADD CONSTRAINT `user_self_think_ibfk_1` FOREIGN KEY (`us_id`) REFERENCES `users` (`us_id`), ADD CONSTRAINT `user_self_think_ibfk_2` FOREIGN KEY (`se_id`) REFERENCES `semester` (`se_id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
CREATE TABLE monthlies( id BIGINT NOT NULL PRIMARY KEY, dentist BIGINT NOT NULL REFERENCES dentists (id), description VARCHAR(255) NOT NULL, date DATE NOT NULL, invoices BIGINT[] NOT NULL, skonto BIGINT NOT NULL, total DECIMAL NOT NULL );
-- create database db_farmacia_do_bem -- use db_farmacia_do_bem; /*create table categoria( id int primary key auto_increment, tipoGenerico boolean, tipoRemédio varchar (50) ); create table produto ( nome varchar (50), estoque int (3), preco int (3), comorbidade varchar (50), Via varchar (50), id_categoria int not null, foreign key (id_categoria) references categoria (id) ); insert into categoria (tipoGenerico, tipoRemédio) values (true, "Ativo"), (true, "Fora de Mercado"), (false, "Fora de Mercado"), (true, "Ativo"), (true, "Ativo")*/ /*insert into produto (nome, estoque, preco, comorbidade, Via, id_categoria) values ("Tylenol", "5", "100", "Dor de cabeça", "Oral", 3), ("Paracetamol", "10", "10", "Dor nas costas", "Cápsula", 3), ("Tylenol", "13", "50", "Dor de cabeça", "Oral", 1), ("Tylenol", "5", "100", "Dor de cabeça", "Oral", 4), ("Tylenol", "130", "1000", "Dor de cabeça", "Gel", 3), ("Tylenol", "5", "100", "Dor de cabeça", "Oral", 2), ("Buscopan", "5", "100", "Dor abdominal", "Oral", 1), ("Clonazepam", "20", "1", "Remédio para dormir", "Cápsula", 2);*/ -- select * from produto where preco >50; -- select * from produto where preco>3 and preco<60; -- select * from produto where nome like "%B%"; -- select * from categoria inner join produto on categoria.id = produto.id_categoria; -- select * from categoria inner join produto on categoria.id = produto.id_categoria where comorbidade = "Dor de Cabeça";
INSERT INTO `kb-daas-dev.mart_200723.keyword_list2` ( TYPE, ID, CHANNEL, S_NAME, SB_NAME, WRITESTAMP, KEYWORD ) SELECT 1 AS type , A.ID AS id , A.CHANNEL AS channel , A.S_NAME AS s_name , A.SB_NAME AS sb_name , A.WRITESTAMP as day , K.keyword AS keyword FROM `kb-daas-dev.master_200723.keyword_bank_result` A CROSS JOIN UNNEST(KPE) AS K WHERE A.CRAWLSTAMP > TIMESTAMP('2020-06-01 00:00:00', 'Asia/Seoul') AND DATE(A.WRITESTAMP) BETWEEN '2020-05-31' AND '2020-06-30' ; INSERT INTO `kb-daas-dev.mart_200723.keyword_list2` ( TYPE, ID, CHANNEL, S_NAME, SB_NAME, WRITESTAMP, KEYWORD ) SELECT 2 AS type , A.ID AS id , A.CHANNEL AS channel , A.S_NAME AS s_name , A.SB_NAME AS sb_name , A.WRITESTAMP as day , K.keyword AS keyword FROM `kb-daas-dev.master_200723.keyword_corona_result` A CROSS JOIN UNNEST(KPE) AS K WHERE A.CRAWLSTAMP > TIMESTAMP('2020-06-01 00:00:00', 'Asia/Seoul') AND DATE(A.WRITESTAMP) BETWEEN '2020-05-31' AND '2020-06-30' ;
-- MySQL Script generated by MySQL Workbench -- 01/19/17 12:26:05 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema library -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema library -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `library` DEFAULT CHARACTER SET utf8 ; USE `library` ; -- ----------------------------------------------------- -- Table `library`.`Film` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `library`.`Film` ( `id_Film` INT NOT NULL AUTO_INCREMENT, `Title` LONGTEXT NOT NULL, `Ganre` ENUM('ACTION', 'ADVENTURE', 'COMEDY', 'CRIME', 'DRAMA', 'HORROR', 'WESTERNS', 'WAR') NOT NULL, `Release_Date` DATE NULL, `Country` VARCHAR(45) NULL, PRIMARY KEY (`id_Film`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `library`.`Stars` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `library`.`Stars` ( `id_Stars` INT NOT NULL AUTO_INCREMENT, `FirstName` VARCHAR(45) NOT NULL, `MidleName` VARCHAR(45) NULL, `LastName` VARCHAR(45) NOT NULL, `Date_of_Birth` DATE NULL, PRIMARY KEY (`id_Stars`), UNIQUE INDEX `LastName_UNIQUE` (`LastName` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `library`.`Films_Stars` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `library`.`Films_Stars` ( `id_Film` INT NOT NULL, `id_Stars` INT NOT NULL, INDEX `id_Stars` (`id_Stars` ASC), INDEX `id_Film` (`id_Film` ASC), CONSTRAINT `id_Stars` FOREIGN KEY (`id_Stars`) REFERENCES `library`.`Stars` (`id_Stars`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `id_Film` FOREIGN KEY (`id_Film`) REFERENCES `library`.`Film` (`id_Film`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `library`.`User` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `library`.`User` ( `id_User` INT NOT NULL AUTO_INCREMENT, `First_Name` TEXT NULL, `Midle_Name` TEXT NULL, `Last_Name` varchar(80) NOT NULL, `Passwords` VARCHAR(45) NOT NULL, `Email` VARCHAR(80) NOT NULL, 'Role' VARCHAR(5) NOT NULL, PRIMARY KEY (`id_User`), UNIQUE INDEX `Last_Name_UNIQUE` (`Last_Name` ASC), UNIQUE INDEX `Email_UNIQUE` (`Email` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `library`.`Review` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `library`.`Review` ( `id_Review` INT NOT NULL AUTO_INCREMENT, `id_User` INT NOT NULL, `id_Film` INT NOT NULL, `Text` TEXT NOT NULL, `Mark` DOUBLE NOT NULL, PRIMARY KEY (`id_Review`), INDEX `id_Film` (`id_Film` ASC), INDEX `id_User` (`id_User` ASC), FOREIGN KEY (`id_Film`) REFERENCES `library`.`Film` (`id_Film`) , FOREIGN KEY (`id_User`) REFERENCES `library`.`User` (`id_User`) ) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; USE library; INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('Terminator 2: Judgment Day', 'ACTION', '1991-7-1', 'USA'); INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('Pirates of the Caribbean: The Curse of The Black Pear', 'ADVENTURE', '2003-6-28', 'USA'); INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('The Mask', 'COMEDY', '1994-7-29', 'USA'); INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('The Lord of the Rings: The Two Towers', 'ADVENTURE', '2002-12-18', 'UK'); INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('Pulp Fiction', 'COMEDY', '1994-9-10', 'USA'); INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('Saw', 'HORROR', '2004-10-1', 'USA'); INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('Massaker', 'HORROR', '2010-01-01', 'BY'); INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('The Godfather', 'CRIME', '1972-3-14', 'USA'); INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('Titanic', 'DRAMA', '1997-10-18', 'USA'); INSERT INTO `library`.`film` (`Title`, `Ganre`, `Release_Date`, `Country`) VALUES ('Fight Club', 'DRAMA', '1999-9-10', 'USA'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('Arnold', 'Alois', 'Schwarzenegger', '1947-7-30'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('John', 'Christopher', 'Depp', '1963-6-9'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('James', 'Eugene', 'Carrey', '1962-1-17'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('Orlando', 'Jonathan', 'Bloom', '1977-1-13'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('John', 'Joseph', 'Travolta', '1954-2-18'); INSERT INTO `library`.`stars` (`FirstName`, `LastName`, `Date_of_Birth`) VALUES ('Leigh', 'Whannell', '1977-1-17'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('Dmitry', 'Arturovich', 'Miller', '1972-4-2'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('Alfredo', 'James', 'Pacino', '1940-4-25'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('Leonardo', 'Wilhelm', 'DiCaprio', '1974-11-11'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('Edward', 'Harrison', 'Norton', '1969-8-18'); INSERT INTO `library`.`stars` (`FirstName`, `MidleName`, `LastName`, `Date_of_Birth`) VALUES ('Brad', 'William', 'Pitt', '1963-12-18'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('1', '1'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('2', '2'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('3', '3'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('4', '4'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('5', '5'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('6', '6'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('7', '7'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('8', '8'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('9', '9'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('10', '10'); INSERT INTO `library`.`films_stars` (`id_Film`, `id_Stars`) VALUES ('10', '11'); INSERT INTO `library`.`library`.`User` (`First_Name`, `Midle_Name`, `Last_name`,`Passwords`,`Email`,`Role`) VALUES ('Admin', 'Admin', 'Admin','12345','Admin'); INSERT INTO `library`.`library`.`User` (`First_Name`, `Midle_Name`, `Last_name`,`Passwords`,`Email`,`Role`) VALUES ('User', 'User', 'User','12345','User');
select title ,count(actor_id) from sakila.film inner join sakila.film_actor on film.film_id = film_actor.film_id group by title
-- create database vacation_project_moran; -- use vacation_project_moran; -- create table users( -- user_id int auto_increment, -- first_name varchar(255), -- last_name varchar(255), -- username varchar(255), -- password varchar(255), -- isAdmin bool default 0, -- primary key (user_id) -- ); -- insert into users(first_name, last_name, username,password,isAdmin) -- values ("Adi","Min","adi_min",'$2b$10$RBlgzCsqrFuFkot24jPhkO/fLMHyQMx3V8Wz8CWxl5eaGAZ9TqTPa',TRUE); -- insert into users(first_name, last_name, username,password,isAdmin) -- values ("Guy","Someyoung","s_y_g",'$2b$10$RBlgzCsqrFuFkot24jPhkO/fLMHyQMx3V8Wz8CWxl5eaGAZ9TqTPa',false),("Eishe","Carlo","carlomeod",'$2b$10$RBlgzCsqrFuFkot24jPhkO/fLMHyQMx3V8Wz8CWxl5eaGAZ9TqTPa',false); -- create table vacations( -- Vac_id int auto_increment, -- vac_destination varchar(255), -- vac_description text, -- vac_pic text, -- from_date date, -- to_date date, -- price int, -- vac_followers int, -- primary key (Vac_id) -- ); -- insert into vacations(vac_destination, vac_description, vac_pic, from_date, to_date, price) -- values ("Thailand","5 star hotel on the magical island of Ko Pha Ngan","https://upload.wikimedia.org/wikipedia/commons/f/fd/Koh_Phangan01.jpg","2021-08-01","2021-08-12",1777); -- insert into vacations(vac_destination, vac_description, vac_pic, from_date, to_date, price) -- values ("Budapest","The capital and the most populous city of Hungary","https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Hungarian_Parliament_By_River_Danube.jpg/1280px-Hungarian_Parliament_By_River_Danube.jpg","2021-07-14","2021-07-17",656), -- ("New York City","Days and nights in a city that does not go to sleep","https://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/Lower_Manhattan_skyline_-_June_2017.jpg/1920px-Lower_Manhattan_skyline_-_June_2017.jpg","2021-09-05","2021-09-16",2555); -- create table bridge ( -- bridge_id int auto_increment, -- br_user_id int, -- br_Vac_id int, -- primary key(bridge_id), -- foreign key(br_user_id) references users(user_id), -- foreign key(br_Vac_id) references vacations(Vac_id) -- ); -- insert into bridge(br_user_id, br_Vac_id) -- values (2,1),(2,2),(3,2);
-- -- RUN THE DOCUMENT IMPORT APPLICATION TO -- Imports the base/core concepts
/* Goal: Control Azure Storage Account from Snowflake Integration and Stage Benefit: Setup Integration once and no longer need to pass credentials Use Snowflake RBAC to control access to Azure Storage Container Use Snowflake's Massively Parallel COPY INTO Statement and instant compute power for bulk loading Remove Azure Storage Container files after loaded into Snowflake Snowflake Documentation https://docs.snowflake.com/en/user-guide/data-load-azure-config.html#option-1-configuring-a-snowflake-storage-integration Elitmind presentation https://youtu.be/jTIStJfCbdY?t=241 Agenda: Prerequisites: In Azure, create a storage container and populate some data in it List Azure Storage Container from Snowflake In Snowflake: create STORAGE INTEGRATION, FILE FORMAT, STAGE In Azure: Azure Active Directory, Storage Access Control (IAM) */ ----------------------------------------------------- --Test Driven Developement: list an Azure Storage Container from Snowflake --This will work once this tutorial is complete list @azure_stage_2; ----------------------------------------------------- --create database and warehouse use role sysadmin; create database if not exists playdb; create warehouse if not exists playwh with warehouse_size = 'xsmall' auto_suspend = 60 initially_suspended = true; use schema playdb.public; ----------------------------------------------------- --cloud storage INTEGRATION - helps you authorize Snowflake without hardcoding credentials --To get AZURE_TENANT_ID: Azure Active Directory | Tenant ID //escalate to accountadmin since needed to create a integration use role accountadmin; create storage integration azure_snowflake_integration_171_2 type = external_stage storage_provider = azure enabled = true azure_tenant_id = 'c3dde62b-7e49-464f-ad42-84476aa3479d' storage_allowed_locations = ('*'); grant usage on integration azure_snowflake_integration_171_2 to sysadmin; //go to AZURE_CONSENT_URL | [No need to click Consent] | Click Accept describe storage integration azure_snowflake_integration_171_2; //Authorize Snowflake in Access Control (IAM) //Azure | Storage Account | Access Control (IAM) //Add a role assignment | Storage Blob Data Contributor //Select | Type in "Snowflake" and select the Snowflake app you just created | Click Save ----------------------------------------------------- --Setup Snowflake Stage //De-escalate role use role sysadmin; /*file format makes it easy to reload files of a certain type https://docs.snowflake.com/en/sql-reference/sql/create-file-format.html#examples */ create or replace file format my_csv_format_2 type = csv field_delimiter = '|' skip_header = 1 null_if = ('NULL', 'null') empty_field_as_null = true compression = gzip; //url = 'azure://<storage_account>.blob.core.windows.net/<container>' //replace snowflake171a with your storage account //replace datalake with your container create stage azure_stage_2 storage_integration = azure_snowflake_integration_171_2 url = 'azure://snowflake171a.blob.core.windows.net/datalake' file_format = my_csv_format_2; //Please note it can take an hour or two for Azure to create the objects necessary for the integration list @azure_stage_2; ---------------------------------------------------------------------------------------------------------- --CLEANUP IF YOU WANT TO RERUN use role accountadmin; drop integration if exists azure_snowflake_integration_171_2; drop file format if exists my_csv_format_2; drop stage if exists azure_stage_2;
SELECT VAR(c) FROM (VALUES (2), (3), (2)) AS t(c) SELECT VAR(c) FROM (VALUES (2), (30), (100)) AS t(c)
SET HEADING OFF SET FEEDBACK OFF SET TRIMSPOOL ON SET PAGESIZE 0 SET LINESIZE 300 SPOOL 'psexports\sites.txt'; -- Write course column headers. -- SELECT DISTINCT '01 Site ID' || :TAB || '02 Site Name' || :TAB || '03 State Site ID' || :TAB || '04 Start Grade Level ID' || :TAB || '05 End Grade Level ID' || :TAB || '06 School Type ID' || :TAB || '07 Address 1' || :TAB || '08 Address 2' || :TAB || '09 City' || :TAB || '10 State' || :TAB || '11 Zip Code' || :TAB || '12 Local Site Code' || :TAB || '13 Annual Hours of Instruction' || :TAB || '14 Annual Number of Weeks of Instruction' || :TAB || '15 Parent Site ID' --BEGIN additional column headers --END additional column headers FROM DUAL / -- Write course data. -- SELECT DISTINCT s.SCHOOL_NUMBER || :TAB || s.NAME || :TAB || s.COUNTYNBR||s.DISTRICT_NUMBER||s.SCHOOL_NUMBER || :TAB || CASE s.LOW_GRADE WHEN -2 THEN 15 WHEN -1 THEN 15 WHEN 0 THEN 1 WHEN 1 THEN 2 WHEN 2 THEN 3 WHEN 3 THEN 4 WHEN 4 THEN 5 WHEN 5 THEN 6 WHEN 6 THEN 7 WHEN 7 THEN 8 WHEN 8 THEN 9 WHEN 9 THEN 10 WHEN 10 THEN 11 WHEN 11 THEN 12 WHEN 12 THEN 13 WHEN 99 THEN 14 END || :TAB || CASE s.HIGH_GRADE WHEN -2 THEN 15 WHEN -1 THEN 15 WHEN 0 THEN 1 WHEN 1 THEN 2 WHEN 2 THEN 3 WHEN 3 THEN 4 WHEN 4 THEN 5 WHEN 5 THEN 6 WHEN 6 THEN 7 WHEN 7 THEN 8 WHEN 8 THEN 9 WHEN 9 THEN 10 WHEN 10 THEN 11 WHEN 11 THEN 12 WHEN 12 THEN 13 WHEN 99 THEN 14 END || :TAB || CASE WHEN s.NAME LIKE '%Middle%' THEN 1 WHEN s.NAME LIKE '%High%' THEN 2 WHEN s.NAME LIKE '%Elementary%' THEN 9 WHEN s.NAME LIKE '%Pre%' THEN 4 ELSE 7 END || :TAB || s.SCHOOLADDRESS || :TAB || '' || :TAB || s.SCHOOLCITY || :TAB || s.SCHOOLSTATE || :TAB || s.SCHOOLZIP || :TAB || '' || :TAB || '' || :TAB || '' || :TAB || '' --BEGIN additional data columns --Acceptable fields: --Schools table(s). Custom schools fields: ps_customfields.getSchoolsCF(c.id, 'FIELDNAME') --END additional data columns FROM (SELECT * FROM ps.schools order by school_number) s / SPOOL OFF