text
stringlengths
6
9.38M
CREATE TABLE IF NOT EXISTS users ( id SERIAL PRIMARY KEY, first_name TEXT NOT NULL, last_name TEXT NOT NULL, username TEXT NOT NULL UNIQUE, password TEXT NOT NULL, age INTEGER NOT NULL, country TEXT NOT NULL, nickname TEXT, gender TEXT NOT NULL, block_list BOOLEAN NOT NULL DEFAULT false, last_modified TIMESTAMPTZ NOT NULL DEFAULT now() ); CREATE TABLE IF NOT EXISTS movies ( id SERIAL PRIMARY KEY, title TEXT NOT NULL, posterUrl TEXT DEFAULT 'https://imgc.allpostersimages.com/img/print/u-g-PILE2Y0.jpg', trailerUrl TEXT, summary TEXT DEFAULT 'Not yet available', year INTEGER NOT NULL, country TEXT NOT NULL, genres TEXT [], last_modified TIMESTAMPTZ NOT NULL DEFAULT now() ); CREATE TABLE IF NOT EXISTS artists ( id SERIAL PRIMARY KEY, full_name TEXT NOT NULL, title TEXT NOT NULL, avatar TEXT, birth_year INTEGER, country TEXT ); CREATE TABLE IF NOT EXISTS movie_cast( id SERIAL PRIMARY KEY, movieid INTEGER REFERENCES movies(id) ON DELETE CASCADE NOT NULL, director INTEGER REFERENCES artists(id) ON DELETE CASCADE, actor_one INTEGER REFERENCES artists(id) ON DELETE CASCADE, actor_two INTEGER REFERENCES artists(id) ON DELETE CASCADE ); CREATE TABLE IF NOT EXISTS reviews( id SERIAL PRIMARY KEY, movieid INTEGER REFERENCES movies(id) ON DELETE CASCADE NOT NULL, userid INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL, comment TEXT NOT NULL, rating INTEGER NOT NULL, upvote INTEGER DEFAULT 0, downvote INTEGER DEFAULT 0, date_submitted TIMESTAMPTZ NOT NULL DEFAULT now() );
create table if not exists users ( username text not null unique, password_hash text not null, is_admin int not null default 0 );
SET MODE DB2; -- First throw away all stuff DROP TABLE VWIM0001DESIGN_AUTHORITY IF EXISTS; DROP TABLE VWIM0002DOMAIN IF EXISTS; DROP TABLE VWIM0003APP IF EXISTS; DROP TABLE VWIM0004KOMP IF EXISTS; DROP TABLE VWIM0005SOFTWAREART IF EXISTS; DROP TABLE VWIM0007RISIKOEINWERTUNG IF EXISTS; DROP TABLE VWIM0008DATENSCHUTZEINWERTUNG IF EXISTS; DROP TABLE VWIM0011TECHNOLOGY_STATE IF EXISTS; DROP TABLE VWIM0011ZUSTAND IF EXISTS; DROP TABLE VWIM0012TECHNOLOGY_RATING IF EXISTS; DROP TABLE VWIM0012BEWERTUNG IF EXISTS; DROP TABLE VWIM0013SERVICE_CLUSTER IF EXISTS; DROP TABLE VWIM0014SERVICE_CATEGORY IF EXISTS; DROP TABLE VWIM0015SERVICE_CAPABILITY IF EXISTS; DROP TABLE VWIM0016TECHNOLOGY_FUNCTIONALITY IF EXISTS; DROP TABLE VWIM0017TECHNOLOGY_PRODUCT IF EXISTS; DROP TABLE VWIM0021APPLICATION_TECHNOLOGY_PRODUCT IF EXISTS; DROP TABLE VWIM0022KOMP_KOMP IF EXISTS; DROP TABLE VWIM0025KOMP_TECHNOLOGY_PRODUCT IF EXISTS; -- Tables for rating DROP TABLE VWIM0100BEW_TECHNOLOGY_PRODUCT IF EXISTS; DROP TABLE VWIM0101BEW_DA IF EXISTS; DROP TABLE VWIM0102BEW_APP IF EXISTS; DROP TABLE VWIM0103BEW_DOMAIN IF EXISTS; DROP TABLE VWIM0105BEW_KOMP_TECH IF EXISTS; DROP TABLE VWIM0106BEW_KOMP_FINAL IF EXISTS;
SELECT BuriState.dataid , BuriState.branchid , BuriState.pathid , BuriState.processdate , BuriState.versionno , BuriState.insertdate , BuriState.useridnum , BuriState.useridval , BuriState.stateid , BuriState.abortdate FROM BuriState WHERE processDate > CURRENT_TIMESTAMP
-- Create climbing statistics table DROP TABLE climbing_statistics CREATE TABLE climbing_statistics ( id SERIAL PRIMARY KEY, date VARCHAR, route VARCHAR, attempted INT, succeeded INT, success_percentage INT ); -- Create weather statistics table CREATE TABLE weather ( date VARCHAR PRIMARY KEY, temp_avg INT, relative_humidity_avg INT, wind_speed_daily_avg INT ); --Create route info table DROP TABLE routes CREATE TABLE routes( id SERIAL PRIMARY KEY, route_name VARCHAR, difficulty_rating TEXT, elevation_gain VARCHAR, max_grade VARCHAR, season_approach VARCHAR ); --Preview tables SELECT * FROM climbing_statistics SELECT * FROM weather SELECT * FROM routes -- Join tables to view weather data with climbing statistics CREATE VIEW climbing_stats_w_weather AS SELECT climbing_statistics.id, climbing_statistics.date, climbing_statistics.route, climbing_statistics.attempted, climbing_statistics.succeeded, climbing_statistics.success_percentage, weather.temp_avg, weather.relative_humidity_avg, weather.wind_speed_daily_avg FROM climbing_statistics LEFT JOIN weather ON climbing_statistics.date = weather.date; --Query for all results in November and December SELECT * FROM climbing_stats_w_weather WHERE date LIKE '11%' OR date LIKE '12%'; --Join climbing stats w/ route info and sort by success rate vs. difficulty rating CREATE VIEW success_difficulty_rating AS SELECT climbing_statistics.route, climbing_statistics.success_percentage, routes.difficulty_rating FROM climbing_statistics LEFT JOIN routes ON climbing_statistics.route = routes.route_name; SELECT * FROM success_difficulty_rating SELECT route, AVG(success_percentage) AS "avg_success_rating" FROM success_difficulty_rating WHERE route LIKE 'Disappointment Cleaver' OR route like 'Little Tahoma' OR route like 'Kautz Glacier Direct' OR route LIKE 'Fuhrer Finger' GROUP BY route ORDER BY "avg_success_rating" DESC;
-- 请在这里编写一条SQL语句,创建一个名为USER的表,其中的列如下 CREATE TABLE `USER` ( `ID` BIGINT(10) NOT NULL AUTO_INCREMENT COMMENT 'ID', `NAME` VARCHAR(100) NOT NULL COMMENT '用户名', `TEL` VARCHAR(20) NOT NULL COMMENT '电话', `ADDRESS` VARCHAR(100) DEFAULT NULL COMMENT '地址', `CREATED_AT` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', `UPDATED_AT` TIMESTAMP(0) NOT NULL COMMENT '修改时间', `STATUS` TINYINT(10) NOT NULL COMMENT '状态,1正常,-1删除', PRIMARY KEY (`ID`) USING BTREE, UNIQUE INDEX `TEL`(`TEL`) USING BTREE ) -- ID BIGINT ID 主键 自增 -- NAME VARCHAR(100) 用户名 不可为空 -- TEL VARCHAR(20) 电话 不可为空,不可重复 -- ADDRESS VARCHAR(100) 地址 可为空 -- CREATED_AT TIMESTAMP 创建时间 不可为空 -- UPDATED_AT TIMESTAMP 修改时间 不可为空 -- STATUS TINYINT 状态,1正常,-1删除 不可为空
-- a new simplified version of user to roles relation table INSERT INTO user_role SELECT user_id, role_id FROM user_role_context_object GROUP BY user_id, role_id;
CREATE OR REPLACE VIEW my_users AS SELECT * FROM users;
insert into utilisateur(login,password,type) values('affolabp','affolabp',2); insert into utilisateur(login,password,type) values('agnerayq','agnerayq',2); insert into utilisateur(login,password,type) values('aitelhaa','aitelhaa',2); insert into utilisateur(login,password,type) values('alaerm','alaerm',2); insert into utilisateur(login,password,type) values('alderh','alderh',2); insert into utilisateur(login,password,type) values('alvesdor','alvesdor',2); insert into utilisateur(login,password,type) values('alyasino','alyasino',2); insert into utilisateur(login,password,type) values('amhalk','amhalk',2); insert into utilisateur(login,password,type) values('aronowij','aronowij',2); insert into utilisateur(login,password,type) values('attah','attah',2); insert into utilisateur(login,password,type) values('avanessm','avanessm',2); insert into utilisateur(login,password,type) values('awledjbn','awledjbn',2); insert into utilisateur(login,password,type) values('bachriom','bachriom',2); insert into utilisateur(login,password,type) values('baha','baha',2); insert into utilisateur(login,password,type) values('baillett','baillett',2); insert into utilisateur(login,password,type) values('baltrusd','baltrusd',2); insert into utilisateur(login,password,type) values('bardelg','bardelg',2); insert into utilisateur(login,password,type) values('barrya','barrya',2); insert into utilisateur(login,password,type) values('bataillj','bataillj',2); insert into utilisateur(login,password,type) values('baudensc','baudensc',2); insert into utilisateur(login,password,type) values('baudoint','baudoint',2); insert into utilisateur(login,password,type) values('baudryo','baudryo',2); insert into utilisateur(login,password,type) values('beaudouq','beaudouq',2); insert into utilisateur(login,password,type) values('beaunee','beaunee',2); insert into utilisateur(login,password,type) values('beaussan','beaussan',2); insert into utilisateur(login,password,type) values('behaguec','behaguec',2); insert into utilisateur(login,password,type) values('belkadir','belkadir',2); insert into utilisateur(login,password,type) values('bellensa','bellensa',2); insert into utilisateur(login,password,type) values('belsa','belsa',2); insert into utilisateur(login,password,type) values('benaddim','benaddim',2); insert into utilisateur(login,password,type) values('benoistv','benoistv',2); insert into utilisateur(login,password,type) values('bernardd','bernardd',2); insert into utilisateur(login,password,type) values('bernardt','bernardt',2); insert into utilisateur(login,password,type) values('betteg','betteg',2); insert into utilisateur(login,password,type) values('beunsv','beunsv',2); insert into utilisateur(login,password,type) values('biesbroa','biesbroa',2); insert into utilisateur(login,password,type) values('blaszkol','blaszkol',2); insert into utilisateur(login,password,type) values('bocquetf','bocquetf',2); insert into utilisateur(login,password,type) values('boddezk','boddezk',2); insert into utilisateur(login,password,type) values('boinc','boinc',2); insert into utilisateur(login,password,type) values('boireauf','boireauf',2); insert into utilisateur(login,password,type) values('bonifacm','bonifacm',2); insert into utilisateur(login,password,type) values('boquetf','boquetf',2); insert into utilisateur(login,password,type) values('bordesb','bordesb',2); insert into utilisateur(login,password,type) values('boreec','boreec',2); insert into utilisateur(login,password,type) values('bouaksaa','bouaksaa',2); insert into utilisateur(login,password,type) values('bouderkr','bouderkr',2); insert into utilisateur(login,password,type) values('bourdiec','bourdiec',2); insert into utilisateur(login,password,type) values('bourgeop','bourgeop',2); insert into utilisateur(login,password,type) values('bracheta','bracheta',2); insert into utilisateur(login,password,type) values('braultq','braultq',2); insert into utilisateur(login,password,type) values('breanta','breanta',2); insert into utilisateur(login,password,type) values('brehonu','brehonu',2); insert into utilisateur(login,password,type) values('brejona','brejona',2); insert into utilisateur(login,password,type) values('bridelo','bridelo',2); insert into utilisateur(login,password,type) values('brisseta','brisseta',2); insert into utilisateur(login,password,type) values('brulardn','brulardn',2); insert into utilisateur(login,password,type) values('buchardt','buchardt',2); insert into utilisateur(login,password,type) values('bulteela','bulteela',2); insert into utilisateur(login,password,type) values('bureaud','bureaud',2); insert into utilisateur(login,password,type) values('cailliea','cailliea',2); insert into utilisateur(login,password,type) values('cannym','cannym',2); insert into utilisateur(login,password,type) values('cantac','cantac',2); insert into utilisateur(login,password,type) values('capelleo','capelleo',2); insert into utilisateur(login,password,type) values('capont','capont',2); insert into utilisateur(login,password,type) values('carlierd','carlierd',2); insert into utilisateur(login,password,type) values('carlierm','carlierm',2); insert into utilisateur(login,password,type) values('caroenk','caroenk',2); insert into utilisateur(login,password,type) values('caronic','caronic',2); insert into utilisateur(login,password,type) values('carpentr','carpentr',2); insert into utilisateur(login,password,type) values('cassinm','cassinm',2); insert into utilisateur(login,password,type) values('catricea','catricea',2); insert into utilisateur(login,password,type) values('catteaum','catteaum',2); insert into utilisateur(login,password,type) values('catteze','catteze',2); insert into utilisateur(login,password,type) values('chabenir','chabenir',2); insert into utilisateur(login,password,type) values('cherrihn','cherrihn',2); insert into utilisateur(login,password,type) values('cherya','cherya',2); insert into utilisateur(login,password,type) values('chigarr','chigarr',2); insert into utilisateur(login,password,type) values('choukhis','choukhis',2); insert into utilisateur(login,password,type) values('clayn','clayn',2); insert into utilisateur(login,password,type) values('coeureta','coeureta',2); insert into utilisateur(login,password,type) values('collotl','collotl',2); insert into utilisateur(login,password,type) values('coppinv','coppinv',2); insert into utilisateur(login,password,type) values('corbriot','corbriot',2); insert into utilisateur(login,password,type) values('cornett','cornett',2); insert into utilisateur(login,password,type) values('cottona','cottona',2); insert into utilisateur(login,password,type) values('couranda','couranda',2); insert into utilisateur(login,password,type) values('couturej','couturej',2); insert into utilisateur(login,password,type) values('crepieus','crepieus',2); insert into utilisateur(login,password,type) values('cuviliel','cuviliel',2); insert into utilisateur(login,password,type) values('cuvillia','cuvillia',2); insert into utilisateur(login,password,type) values('dahmanes','dahmanes',2); insert into utilisateur(login,password,type) values('dalexisg','dalexisg',2); insert into utilisateur(login,password,type) values('dambrinv','dambrinv',2); insert into utilisateur(login,password,type) values('dauchyr','dauchyr',2); insert into utilisateur(login,password,type) values('debaerdm','debaerdm',2); insert into utilisateur(login,password,type) values('deblocka','deblocka',2); insert into utilisateur(login,password,type) values('decantem','decantem',2); insert into utilisateur(login,password,type) values('defretis','defretis',2); insert into utilisateur(login,password,type) values('degardis','degardis',2); insert into utilisateur(login,password,type) values('deguinea','deguinea',2); insert into utilisateur(login,password,type) values('dehonghm','dehonghm',2); insert into utilisateur(login,password,type) values('dejonghr','dejonghr',2); insert into utilisateur(login,password,type) values('delattrc','delattrc',2); insert into utilisateur(login,password,type) values('delattrt','delattrt',2); insert into utilisateur(login,password,type) values('delbartj','delbartj',2); insert into utilisateur(login,password,type) values('delecaum','delecaum',2); insert into utilisateur(login,password,type) values('delhayel','delhayel',2); insert into utilisateur(login,password,type) values('delobelt','delobelt',2); insert into utilisateur(login,password,type) values('delporta','delporta',2); insert into utilisateur(login,password,type) values('deltourl','deltourl',2); insert into utilisateur(login,password,type) values('delvarrn','delvarrn',2); insert into utilisateur(login,password,type) values('demea','demea',2); insert into utilisateur(login,password,type) values('demoraen','demoraen',2); insert into utilisateur(login,password,type) values('denoeuda','denoeuda',2); insert into utilisateur(login,password,type) values('deplanqt','deplanqt',2); insert into utilisateur(login,password,type) values('deregnab','deregnab',2); insert into utilisateur(login,password,type) values('derhoren','derhoren',2); insert into utilisateur(login,password,type) values('dernil','dernil',2); insert into utilisateur(login,password,type) values('descampm','descampm',2); insert into utilisateur(login,password,type) values('deschamg','deschamg',2); insert into utilisateur(login,password,type) values('deschamp','deschamp',2); insert into utilisateur(login,password,type) values('desryj','desryj',2); insert into utilisateur(login,password,type) values('devassia','devassia',2); insert into utilisateur(login,password,type) values('devost','devost',2); insert into utilisateur(login,password,type) values('devredj','devredj',2); insert into utilisateur(login,password,type) values('dhoopb','dhoopb',2); insert into utilisateur(login,password,type) values('diabatm','diabatm',2); insert into utilisateur(login,password,type) values('diazr','diazr',2); insert into utilisateur(login,password,type) values('dieue','dieue',2); insert into utilisateur(login,password,type) values('djamak','djamak',2); insert into utilisateur(login,password,type) values('djebouri','djebouri',2); insert into utilisateur(login,password,type) values('doitn','doitn',2); insert into utilisateur(login,password,type) values('doualia','doualia',2); insert into utilisateur(login,password,type) values('dramem','dramem',2); insert into utilisateur(login,password,type) values('dransarj','dransarj',2); insert into utilisateur(login,password,type) values('drodzinl','drodzinl',2); insert into utilisateur(login,password,type) values('dubromev','dubromev',2); insert into utilisateur(login,password,type) values('dubrullg','dubrullg',2); insert into utilisateur(login,password,type) values('ducaurob','ducaurob',2); insert into utilisateur(login,password,type) values('dujardir','dujardir',2); insert into utilisateur(login,password,type) values('dumontp','dumontp',2); insert into utilisateur(login,password,type) values('dupirec','dupirec',2); insert into utilisateur(login,password,type) values('duprieza','duprieza',2); insert into utilisateur(login,password,type) values('duquesnr','duquesnr',2); insert into utilisateur(login,password,type) values('duranda','duranda',2); insert into utilisateur(login,password,type) values('durandg','durandg',2); insert into utilisateur(login,password,type) values('dusartb','dusartb',2); insert into utilisateur(login,password,type) values('dusartc','dusartc',2); insert into utilisateur(login,password,type) values('dutrieul','dutrieul',2); insert into utilisateur(login,password,type) values('duviviea','duviviea',2); insert into utilisateur(login,password,type) values('ebomaakm','ebomaakm',2); insert into utilisateur(login,password,type) values('eddhrifm','eddhrifm',2); insert into utilisateur(login,password,type) values('elmassam','elmassam',2); insert into utilisateur(login,password,type) values('elmesbam','elmesbam',2); insert into utilisateur(login,password,type) values('fablety','fablety',2); insert into utilisateur(login,password,type) values('fayep','fayep',2); insert into utilisateur(login,password,type) values('fayk','fayk',2); insert into utilisateur(login,password,type) values('ferrot','ferrot',2); insert into utilisateur(login,password,type) values('fevrec','fevrec',2); insert into utilisateur(login,password,type) values('fevrer','fevrer',2); insert into utilisateur(login,password,type) values('fievetj','fievetj',2); insert into utilisateur(login,password,type) values('fitoussr','fitoussr',2); insert into utilisateur(login,password,type) values('flamentp','flamentp',2); insert into utilisateur(login,password,type) values('fombasst','fombasst',2); insert into utilisateur(login,password,type) values('fostierj','fostierj',2); insert into utilisateur(login,password,type) values('francoin','francoin',2); insert into utilisateur(login,password,type) values('francois','francois',2); insert into utilisateur(login,password,type) values('gaillarm','gaillarm',2); insert into utilisateur(login,password,type) values('galloujn','galloujn',2); insert into utilisateur(login,password,type) values('garbey','garbey',2); insert into utilisateur(login,password,type) values('gardem','gardem',2); insert into utilisateur(login,password,type) values('gerardc','gerardc',2); insert into utilisateur(login,password,type) values('germer','germer',2); insert into utilisateur(login,password,type) values('ghysc','ghysc',2); insert into utilisateur(login,password,type) values('gilletd','gilletd',2); insert into utilisateur(login,password,type) values('gilletl','gilletl',2); insert into utilisateur(login,password,type) values('gilmantl','gilmantl',2); insert into utilisateur(login,password,type) values('grandjes','grandjes',2); insert into utilisateur(login,password,type) values('gremberm','gremberm',2); insert into utilisateur(login,password,type) values('griettem','griettem',2); insert into utilisateur(login,password,type) values('groblewt','groblewt',2); insert into utilisateur(login,password,type) values('gronierp','gronierp',2); insert into utilisateur(login,password,type) values('guermonm','guermonm',2); insert into utilisateur(login,password,type) values('guervild','guervild',2); insert into utilisateur(login,password,type) values('guffroyg','guffroyg',2); insert into utilisateur(login,password,type) values('guiotc','guiotc',2); insert into utilisateur(login,password,type) values('gungors','gungors',2); insert into utilisateur(login,password,type) values('hachemis','hachemis',2); insert into utilisateur(login,password,type) values('haddadr','haddadr',2); insert into utilisateur(login,password,type) values('haliprer','haliprer',2); insert into utilisateur(login,password,type) values('halleuxa','halleuxa',2); insert into utilisateur(login,password,type) values('hamdachn','hamdachn',2); insert into utilisateur(login,password,type) values('hashcode','hashcode',2); insert into utilisateur(login,password,type) values('hategeki','hategeki',2); insert into utilisateur(login,password,type) values('hennuyem','hennuyem',2); insert into utilisateur(login,password,type) values('heysenj','heysenj',2); insert into utilisateur(login,password,type) values('hirsonf','hirsonf',2); insert into utilisateur(login,password,type) values('hochartg','hochartg',2); insert into utilisateur(login,password,type) values('holquinb','holquinb',2); insert into utilisateur(login,password,type) values('honored','honored',2); insert into utilisateur(login,password,type) values('hourdeaa','hourdeaa',2); insert into utilisateur(login,password,type) values('hourdinf','hourdinf',2); insert into utilisateur(login,password,type) values('housett','housett',2); insert into utilisateur(login,password,type) values('idgouahy','idgouahy',2); insert into utilisateur(login,password,type) values('jacquemn','jacquemn',2); insert into utilisateur(login,password,type) values('jacquetc','jacquetc',2); insert into utilisateur(login,password,type) values('janzegea','janzegea',2); insert into utilisateur(login,password,type) values('jedrzejw','jedrzejw',2); insert into utilisateur(login,password,type) values('jonasm','jonasm',2); insert into utilisateur(login,password,type) values('kadjaiea','kadjaiea',2); insert into utilisateur(login,password,type) values('kancurzv','kancurzv',2); insert into utilisateur(login,password,type) values('karbouba','karbouba',2); insert into utilisateur(login,password,type) values('karfai','karfai',2); insert into utilisateur(login,password,type) values('kirschec','kirschec',2); insert into utilisateur(login,password,type) values('kleinpog','kleinpog',2); insert into utilisateur(login,password,type) values('kucharsb','kucharsb',2); insert into utilisateur(login,password,type) values('labrousy','labrousy',2); insert into utilisateur(login,password,type) values('laffileh','laffileh',2); insert into utilisateur(login,password,type) values('lakelt','lakelt',2); insert into utilisateur(login,password,type) values('lalleaul','lalleaul',2); insert into utilisateur(login,password,type) values('lambda','lambda',2); insert into utilisateur(login,password,type) values('lambertc','lambertc',2); insert into utilisateur(login,password,type) values('lamboisa','lamboisa',2); insert into utilisateur(login,password,type) values('lantoina','lantoina',2); insert into utilisateur(login,password,type) values('lassallr','lassallr',2); insert into utilisateur(login,password,type) values('lauder','lauder',2); insert into utilisateur(login,password,type) values('laudev','laudev',2); insert into utilisateur(login,password,type) values('lebouazt','lebouazt',2); insert into utilisateur(login,password,type) values('lecointf','lecointf',2); insert into utilisateur(login,password,type) values('lecomtea','lecomtea',2); insert into utilisateur(login,password,type) values('leduca','leduca',2); insert into utilisateur(login,password,type) values('lefebvrr','lefebvrr',2); insert into utilisateur(login,password,type) values('lefevrew','lefevrew',2); insert into utilisateur(login,password,type) values('legayn','legayn',2); insert into utilisateur(login,password,type) values('leichtt','leichtt',2); insert into utilisateur(login,password,type) values('leleuj','leleuj',2); insert into utilisateur(login,password,type) values('lelongb','lelongb',2); insert into utilisateur(login,password,type) values('lemainte','lemainte',2); insert into utilisateur(login,password,type) values('lemaitrl','lemaitrl',2); insert into utilisateur(login,password,type) values('lenainm','lenainm',2); insert into utilisateur(login,password,type) values('lentinil','lentinil',2); insert into utilisateur(login,password,type) values('lepretrg','lepretrg',2); insert into utilisateur(login,password,type) values('lesaged','lesaged',2); insert into utilisateur(login,password,type) values('lesager','lesager',2); insert into utilisateur(login,password,type) values('leue','leue',2); insert into utilisateur(login,password,type) values('levoyec','levoyec',2); insert into utilisateur(login,password,type) values('liegea','liegea',2); insert into utilisateur(login,password,type) values('lisig','lisig',2); insert into utilisateur(login,password,type) values('lopezb','lopezb',2); insert into utilisateur(login,password,type) values('lorietta','lorietta',2); insert into utilisateur(login,password,type) values('loufinih','loufinih',2); insert into utilisateur(login,password,type) values('louveto','louveto',2); insert into utilisateur(login,password,type) values('luszezn','luszezn',2); insert into utilisateur(login,password,type) values('maammart','maammart',2); insert into utilisateur(login,password,type) values('macheta','macheta',2); insert into utilisateur(login,password,type) values('maertenm','maertenm',2); insert into utilisateur(login,password,type) values('magnierb','magnierb',2); insert into utilisateur(login,password,type) values('mahiettc','mahiettc',2); insert into utilisateur(login,password,type) values('mahioutm','mahioutm',2); insert into utilisateur(login,password,type) values('mainguet','mainguet',2); insert into utilisateur(login,password,type) values('marcailf','marcailf',2); insert into utilisateur(login,password,type) values('marchalt','marchalt',2); insert into utilisateur(login,password,type) values('marchane','marchane',2); insert into utilisateur(login,password,type) values('mardonf','mardonf',2); insert into utilisateur(login,password,type) values('marechaa','marechaa',2); insert into utilisateur(login,password,type) values('marliere','marliere',2); insert into utilisateur(login,password,type) values('marliott','marliott',2); insert into utilisateur(login,password,type) values('martella','martella',2); insert into utilisateur(login,password,type) values('massiaua','massiaua',2); insert into utilisateur(login,password,type) values('mastalet','mastalet',2); insert into utilisateur(login,password,type) values('mathona','mathona',2); insert into utilisateur(login,password,type) values('maugern','maugern',2); insert into utilisateur(login,password,type) values('mayeuxw','mayeuxw',2); insert into utilisateur(login,password,type) values('mbayob','mbayob',2); insert into utilisateur(login,password,type) values('meftouhr','meftouhr',2); insert into utilisateur(login,password,type) values('megancka','megancka',2); insert into utilisateur(login,password,type) values('melnykt','melnykt',2); insert into utilisateur(login,password,type) values('merianb','merianb',2); insert into utilisateur(login,password,type) values('messiaek','messiaek',2); insert into utilisateur(login,password,type) values('messuvel','messuvel',2); insert into utilisateur(login,password,type) values('meulemar','meulemar',2); insert into utilisateur(login,password,type) values('meurilla','meurilla',2); insert into utilisateur(login,password,type) values('mezierev','mezierev',2); insert into utilisateur(login,password,type) values('migrainv','migrainv',2); insert into utilisateur(login,password,type) values('mihaia','mihaia',2); insert into utilisateur(login,password,type) values('millott','millott',2); insert into utilisateur(login,password,type) values('mireb','mireb',2); insert into utilisateur(login,password,type) values('moirouxm','moirouxm',2); insert into utilisateur(login,password,type) values('moreaut','moreaut',2); insert into utilisateur(login,password,type) values('morelf','morelf',2); insert into utilisateur(login,password,type) values('moroiue','moroiue',2); insert into utilisateur(login,password,type) values('moukokoj','moukokoj',2); insert into utilisateur(login,password,type) values('moulards','moulards',2); insert into utilisateur(login,password,type) values('moulayki','moulayki',2); insert into utilisateur(login,password,type) values('moutiio','moutiio',2); insert into utilisateur(login,password,type) values('mudryq','mudryq',2); insert into utilisateur(login,password,type) values('murate','murate',2); insert into utilisateur(login,password,type) values('murschet','murschet',2); insert into utilisateur(login,password,type) values('nehalm','nehalm',2); insert into utilisateur(login,password,type) values('ngoutans','ngoutans',2); insert into utilisateur(login,password,type) values('nguengaj','nguengaj',2); insert into utilisateur(login,password,type) values('obledj','obledj',2); insert into utilisateur(login,password,type) values('oblinn','oblinn',2); insert into utilisateur(login,password,type) values('oliveras','oliveras',2); insert into utilisateur(login,password,type) values('oswaltr','oswaltr',2); insert into utilisateur(login,password,type) values('oulmin','oulmin',2); insert into utilisateur(login,password,type) values('ourizatm','ourizatm',2); insert into utilisateur(login,password,type) values('ouvryl','ouvryl',2); insert into utilisateur(login,password,type) values('pamartn','pamartn',2); insert into utilisateur(login,password,type) values('paulk','paulk',2); insert into utilisateur(login,password,type) values('pelleria','pelleria',2); insert into utilisateur(login,password,type) values('peronq','peronq',2); insert into utilisateur(login,password,type) values('perriert','perriert',2); insert into utilisateur(login,password,type) values('peyresab','peyresab',2); insert into utilisateur(login,password,type) values('philippa','philippa',2); insert into utilisateur(login,password,type) values('philippj','philippj',2); insert into utilisateur(login,password,type) values('picaultm','picaultm',2); insert into utilisateur(login,password,type) values('pirletg','pirletg',2); insert into utilisateur(login,password,type) values('plaisanb','plaisanb',2); insert into utilisateur(login,password,type) values('plaisang','plaisang',2); insert into utilisateur(login,password,type) values('plouchat','plouchat',2); insert into utilisateur(login,password,type) values('plouvinm','plouvinm',2); insert into utilisateur(login,password,type) values('pohlem','pohlem',2); insert into utilisateur(login,password,type) values('poissinf','poissinf',2); insert into utilisateur(login,password,type) values('porionq','porionq',2); insert into utilisateur(login,password,type) values('pottiezm','pottiezm',2); insert into utilisateur(login,password,type) values('poulaink','poulaink',2); insert into utilisateur(login,password,type) values('poulinl','poulinl',2); insert into utilisateur(login,password,type) values('prochnof','prochnof',2); insert into utilisateur(login,password,type) values('provof','provof',2); insert into utilisateur(login,password,type) values('raesr','raesr',2); insert into utilisateur(login,password,type) values('rasamimj','rasamimj',2); insert into utilisateur(login,password,type) values('regnierk','regnierk',2); insert into utilisateur(login,password,type) values('reinlinr','reinlinr',2); insert into utilisateur(login,password,type) values('remirk','remirk',2); insert into utilisateur(login,password,type) values('richarda','richarda',2); insert into utilisateur(login,password,type) values('robartv','robartv',2); insert into utilisateur(login,password,type) values('rocav','rocav',2); insert into utilisateur(login,password,type) values('rocchiat','rocchiat',2); insert into utilisateur(login,password,type) values('rodrigum','rodrigum',2); insert into utilisateur(login,password,type) values('rogera','rogera',2); insert into utilisateur(login,password,type) values('rogeza','rogeza',2); insert into utilisateur(login,password,type) values('rolanda','rolanda',2); insert into utilisateur(login,password,type) values('roosen','roosen',2); insert into utilisateur(login,password,type) values('rucartt','rucartt',2); insert into utilisateur(login,password,type) values('saidis','saidis',2); insert into utilisateur(login,password,type) values('serizelg','serizelg',2); insert into utilisateur(login,password,type) values('seysn','seysn',2); insert into utilisateur(login,password,type) values('seysr','seysr',2); insert into utilisateur(login,password,type) values('skawandd','skawandd',2); insert into utilisateur(login,password,type) values('slowinsd','slowinsd',2); insert into utilisateur(login,password,type) values('soualhim','soualhim',2); insert into utilisateur(login,password,type) values('soulanh','soulanh',2); insert into utilisateur(login,password,type) values('speleerv','speleerv',2); insert into utilisateur(login,password,type) values('spichtj','spichtj',2); insert into utilisateur(login,password,type) values('spinnewq','spinnewq',2); insert into utilisateur(login,password,type) values('steenkij','steenkij',2); insert into utilisateur(login,password,type) values('surmontn','surmontn',2); insert into utilisateur(login,password,type) values('svevia','svevia',2); insert into utilisateur(login,password,type) values('syczj','syczj',2); insert into utilisateur(login,password,type) values('tartara','tartara',2); insert into utilisateur(login,password,type) values('tartarev','tartarev',2); insert into utilisateur(login,password,type) values('tchalabs','tchalabs',2); insert into utilisateur(login,password,type) values('thetteny','thetteny',2); insert into utilisateur(login,password,type) values('tihiania','tihiania',2); insert into utilisateur(login,password,type) values('tremouig','tremouig',2); insert into utilisateur(login,password,type) values('tricartc','tricartc',2); insert into utilisateur(login,password,type) values('tutinj','tutinj',2); insert into utilisateur(login,password,type) values('vaboisl','vaboisl',2); insert into utilisateur(login,password,type) values('vaillanj','vaillanj',2); insert into utilisateur(login,password,type) values('valentif','valentif',2); insert into utilisateur(login,password,type) values('vandepus','vandepus',2); insert into utilisateur(login,password,type) values('vanderar','vanderar',2); insert into utilisateur(login,password,type) values('vanheckj','vanheckj',2); insert into utilisateur(login,password,type) values('vankalct','vankalct',2); insert into utilisateur(login,password,type) values('vanrenta','vanrenta',2); insert into utilisateur(login,password,type) values('vantourf','vantourf',2); insert into utilisateur(login,password,type) values('vanwynee','vanwynee',2); insert into utilisateur(login,password,type) values('vasseurs','vasseurs',2); insert into utilisateur(login,password,type) values('vastraa','vastraa',2); insert into utilisateur(login,password,type) values('vergauwb','vergauwb',2); insert into utilisateur(login,password,type) values('verquinc','verquinc',2); insert into utilisateur(login,password,type) values('vingadal','vingadal',2); insert into utilisateur(login,password,type) values('vitsem','vitsem',2); insert into utilisateur(login,password,type) values('voltz','voltz',2); insert into utilisateur(login,password,type) values('vuylstel','vuylstel',2); insert into utilisateur(login,password,type) values('wahbiy','wahbiy',2); insert into utilisateur(login,password,type) values('watreloj','watreloj',2); insert into utilisateur(login,password,type) values('willaerc','willaerc',2); insert into utilisateur(login,password,type) values('wlochb','wlochb',2); insert into utilisateur(login,password,type) values('woitteqy','woitteqy',2); insert into utilisateur(login,password,type) values('zemmiriz','zemmiriz',2); insert into utilisateur(login,password,type) values('zhangl','zhangl',2); insert into utilisateur(login,password,type) values('zoksd','zoksd',2);
DROP TABLE IF EXISTS report_manager_schema.report_parameters; CREATE TABLE report_manager_schema.report_parameters ( report_id uuid, parameter_id uuid, datetime_parameter_added timestamp without time zone NOT NULL, changing_user_login text NOT NULL, CONSTRAINT report_parameters_pkey PRIMARY KEY (report_id, parameter_id), CONSTRAINT report_parameters_parameter_id_fkey FOREIGN KEY (parameter_id) REFERENCES report_manager_schema.parameter_list (parameter_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE, CONSTRAINT report_parameters_report_id_fkey FOREIGN KEY (report_id) REFERENCES report_manager_schema.reports (report_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE );
# # Table structure for table 'sys_language' # CREATE TABLE sys_language ( hreflang varchar(5) DEFAULT '' NOT NULL, );
CREATE PROCEDURE SelectFeaturedProducts AS BEGIN SELECT * FROM Products WHERE Product.CategoryId IN (1,2,3) END;
use tianque; -- 组织表 DROP TABLE IF EXISTS `tq_team`; CREATE TABLE `tq_team` ( `TEAMID` int(11) NOT NULL AUTO_INCREMENT COMMENT '组织id', `TEAMNAME` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '组织名\r\n', `TEAMINDEX` int(255) NULL DEFAULT NULL COMMENT '排序', `DESCRIBE` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述', `CREATEDATE` datetime(0) NOT NULL COMMENT '创建时间', `CREATOR` int(255) NOT NULL COMMENT '创建人id', `CREATORNAME` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人名字', `UPDATETIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间', `VALID` int(11) NOT NULL COMMENT '是否有效', `SUPERID` int(11) NULL DEFAULT NULL COMMENT '上级部门', PRIMARY KEY (`TEAMID`) USING BTREE, INDEX `IDINDEX`(`TEAMID`, `TEAMINDEX`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; -- 用户join组织表 -- tq_user_team DROP TABLE IF EXISTS `tq_user_team`; CREATE TABLE `tq_user_team` ( `USERID` int(11) NOT NULL, `TEAMID` int(255) NOT NULL, INDEX `USER_TEAM`(`USERID`, `TEAMID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; -- 用户表 select * from tq_user; DROP TABLE IF EXISTS `tq_user`; CREATE TABLE `tq_user` ( `USERID` int(11) NOT NULL AUTO_INCREMENT, `PASSWORD` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', `BIRTHDAY` datetime(0) NULL DEFAULT NULL COMMENT '生日', `AGE` int(11) NULL DEFAULT NULL COMMENT '年龄', `SEX` int(11) NULL DEFAULT NULL COMMENT '性别', `EMAIL` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱', `DISABLED` int(11) NULL DEFAULT NULL COMMENT '是否禁用', `MOBILE` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号码', `DESCRIPTION` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '个人简介', `AVATAR` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `IDNUMBER` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '身份证号码', `ADDRESS` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址', `CREATE_TIME` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `UPDATE_TIME` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', `VALID` int(11) NOT NULL, PRIMARY KEY (`USERID`) USING BTREE, UNIQUE INDEX `USERNIKE_UNIQUE`(`USERID`) USING BTREE, UNIQUE INDEX `USER_TEAM`(`VALID`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; -- 初始化一个账号-- insert into tq_user(password, birthday, age,sex, email, disabled,mobile, description, idnumber, address) values("$2a$10$4E.3EGBmnGtu9cXLn0RWzuaf3uePbSzqVCNLK6vOJ6/JxxRfeEB9a", now(), 23,1,"sdaklf@163.com", 0, "13787720372", "躁动起来", "430333199604189984","上海市浦东新区"); -- delete from tq_user where userid in (2,3); -- 角色表 select * from tq_role; CREATE TABLE `tq_role` ( `ROLEID` varchar(32) NOT NULL, `ROLENAME` varchar(45) NOT NULL COMMENT '角色名称', `ROLEDESC` varchar(200) DEFAULT NULL COMMENT '角色描述', `ROLECODE` varchar(200) NOT NULL COMMENT 'CODE', PRIMARY KEY (`ROLEID`), UNIQUE KEY `ROLEID_UNIQUE` (`ROLEID`), UNIQUE KEY `ROLENAME_UNIQUE` (`ROLENAME`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色表'; -- 初始化部分角色 insert into tq_role values("b81f82517bfc4a19a34cf371ab25215c", "超级管理员", "拥有最高权限", "ADMIN"); insert into tq_role values("5b80a08627e14caaa05509c529ca729b", "一般管理员", "拥有一定权限", "ADMIN_A"); insert into tq_role values("0e4f6efd59c8475e846a8d1002e657da", "普通用户", "只可操作自己的东西", "USER"); -- 账户表 , 一个用户对应多个账户 select * from tq_accounts; CREATE TABLE `tq_accounts` ( `aid` int(11) NOT NULL AUTO_INCREMENT, `userid` varchar(45) NOT NULL COMMENT '关联用户表id', `username` varchar(45) NOT NULL COMMENT '账户名称', `create_time` varchar(45) DEFAULT 'now()' COMMENT '创建时间', PRIMARY KEY (`aid`), UNIQUE KEY `aid_UNIQUE` (`aid`), UNIQUE KEY `username_UNIQUE` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='账户表,一个用户多个账户'; -- 初始化用户账户信息 insert into tq_accounts(userid, username) values((select userid from tq_user limit 0,1), "zhuhui"); -- 角色用户关系表 select * from tq_user_role; CREATE TABLE `tq_user_role` ( `urid` int(11) NOT NULL AUTO_INCREMENT COMMENT '关系id', `userid` int(11) NOT NULL COMMENT '用户id', `roleid` varchar(32) NOT NULL COMMENT '角色id', PRIMARY KEY (`urid`), UNIQUE KEY `urid_UNIQUE` (`urid`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='用户角色关系表'; insert into tq_user_role(userid, roleid) values((select userid from tq_user limit 0,1), "b81f82517bfc4a19a34cf371ab25215c"); -- 根据用户id查询所属角色 卫士通张小平:13331899059 -- select * from tq_user_role ur left join tq_role ro on ur.roleid = ro.roleid where ur.userid = 4; -- 登录日志表 CREATE TABLE `tq_loginlog` ( `id` varchar(32) NOT NULL, `ip` varchar(45) DEFAULT NULL, `userName` varchar(45) NOT NULL, `loginDate` datetime NOT NULL, `loginLogType` varchar(45) NOT NULL, `result` int(11) NOT NULL, `message` varchar(300) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), KEY `userName` (`userName`,`result`,`loginLogType`,`loginDate`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; select * from tq_loginlog; -- 操作日志表 select * from tq_operationlog; -- 菜单 --> 操作 -- 菜单表table DROP TABLE IF EXISTS `tq_menu`; CREATE TABLE `tq_menu` ( `MENUID` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜单id', `MENUNAME` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单名称', `PARENTID` int(11) NULL DEFAULT NULL COMMENT '上级菜单id', `URL` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单地址', `ICON` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标', `MENUINDEX` int(255) NULL DEFAULT NULL COMMENT '排序', PRIMARY KEY (`MENUID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; select * from tq_menu; -- 初始化菜单数据 insert into tq_menu(menuname,PARENTID,URL,ICON,MENUINDEX) VALUES('统计分析', 0, '', '', 1); insert into tq_menu(menuname,PARENTID,URL,ICON,MENUINDEX) VALUES('用户', 0, '', '', 2); insert into tq_menu(menuname,PARENTID,URL,ICON,MENUINDEX) VALUES('菜单', 0, '', '', 3); insert into tq_menu(menuname,PARENTID,URL,ICON,MENUINDEX) VALUES('test', 9, '', '', 3); UPDATE -- ----角色与菜单和操作的对应关系--- -- 角色join菜单表table -- 单个用户和菜单和操作的对应关系--- -- 用户join菜单表table -- 菜单join操作表table show variables like 'character_set_database'; select version(); SELECT * from tq_menu;
-- phpMyAdmin SQL Dump -- version 4.8.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jul 17, 2020 at 09:48 PM -- Server version: 10.1.37-MariaDB -- PHP Version: 7.2.12 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `tourism` -- -- -------------------------------------------------------- -- -- Table structure for table `tbl_accoma` -- CREATE TABLE `tbl_accoma` ( `acco_id` varchar(50) NOT NULL, `acco_typ` varchar(100) NOT NULL, `name` varchar(150) NOT NULL, `palce` varchar(50) NOT NULL, `address` varchar(500) NOT NULL, `descr` varchar(1000) NOT NULL, `status` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `tbl_compli` -- CREATE TABLE `tbl_compli` ( `mail` varchar(100) NOT NULL, `comp` varchar(500) NOT NULL, `sug` varchar(500) NOT NULL, `date` varchar(50) NOT NULL, `time` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_compli` -- INSERT INTO `tbl_compli` (`mail`, `comp`, `sug`, `date`, `time`) VALUES ('sasi@gmail.com', 'very bad', 'need much more improvement', '18/6/2020', '21:9:47'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_district` -- CREATE TABLE `tbl_district` ( `dis_id` varchar(50) NOT NULL, `dis_name` varchar(100) NOT NULL, `dis_descri` varchar(1000) NOT NULL, `pic` varchar(250) NOT NULL, `status` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_district` -- INSERT INTO `tbl_district` (`dis_id`, `dis_name`, `dis_descri`, `pic`, `status`) VALUES ('DIS1', 'Munnar', 'Top Station is tourist destination in the Kannan Devan hills of Munnar. It is a part between the border of Idukki-Theni Districts in the state of Kerala and Tamil Nadu .Top Station is notable as the historic transshippment location for Kannan Devan tea delivered up here from Munnar and Madupatty by railway and then down by ropeway to Kottagudi. This area is popular for the rare Neelakurinji flowers. The Kurinjimala Sanctuary is nearby. Top Station is the western entrance to the planned Palani Hills National Park.', '58877-munnar-women-plucking-tea-leaves.jpg', 'nostatus'), ('DIS2', 'Thekkady', 'Thekkady is a pleasant heaven on earth for those who love nature in its wild manifestations. Thekkady is placed at an altitude of 700m above the sea level. Located in the Idukki district of Kerala, Thekkady is a perfect retreat for anyone who loves adventure, fun, wildlife and nature.', '56224-4233465548.jpg', 'nostatus'), ('DIS3', 'Silent Valley', 'Silent Valley National Park, is a national park in Kerala, India. It is located in the Nilgiri hills, has a core area of 89.52 km², which is surrounded by a buffer zone of 148 km². This national park has some rare species of flora and fauna. This area was explored in 1847 by the botanist Robert Wight', '61940-silent_valley_national_park_palakkad20131031115538_157_1.jpg', 'nostatus'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_feedback` -- CREATE TABLE `tbl_feedback` ( `mail` varchar(50) NOT NULL, `feedback` varchar(500) NOT NULL, `date` varchar(50) NOT NULL, `time` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_feedback` -- INSERT INTO `tbl_feedback` (`mail`, `feedback`, `date`, `time`) VALUES ('sasi@gmail.com', 'not bad', '18/6/2020', '21:9:2'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_login` -- CREATE TABLE `tbl_login` ( `u_id` varchar(50) NOT NULL, `uname` varchar(50) NOT NULL, `pass` varchar(50) NOT NULL, `u_type_id` varchar(50) NOT NULL, `status` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_login` -- INSERT INTO `tbl_login` (`u_id`, `uname`, `pass`, `u_type_id`, `status`) VALUES ('A1', 'YWRtaW4=', 'YWRtaW4=', 'A1', 'unfreeze'), ('U1', 'aml0bw==', 'MQ==', 'A2', 'unfreeze'), ('ST1', 'QXJ1bg==', 'QXJ1bg==', 'A3', 'unfreeze'), ('U2', 'UmVqaXRo', 'UmVqaXRo', 'A2', 'unfreeze'), ('ST2', 'dGVzdDE=', 'dGVzdDE=', 'A3', 'unfreeze'), ('U3', 'dXNlcjE=', 'dXNlcjE=', 'A2', 'unfreeze'), ('ST3', 'c2FsaW5p', 'c2FsaW5p', 'A3', 'unfreeze'), ('U4', 'c3VyZWtoYQ==', 'c3VyZWtoYQ==', 'A2', 'unfreeze'), ('U5', 'c2Fz', 'MTIzNDU=', 'A2', 'unfreeze'), ('ST4', 'c3M=', 'YXM=', 'A3', 'unfreeze'), ('U6', 'c2hhbW5hZA==', 'MQ==', 'A2', 'unfreeze'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_offers` -- CREATE TABLE `tbl_offers` ( `offer_id` varchar(50) NOT NULL, `offer_nam` varchar(100) NOT NULL, `offer_dis` varchar(1000) NOT NULL, `status` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `tbl_package` -- CREATE TABLE `tbl_package` ( `pac_id` varchar(50) NOT NULL, `pac_nam` varchar(100) NOT NULL, `places` varchar(150) NOT NULL, `no_days` varchar(100) NOT NULL, `person` varchar(100) NOT NULL, `status` varchar(250) NOT NULL, `path` varchar(500) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_package` -- INSERT INTO `tbl_package` (`pac_id`, `pac_nam`, `places`, `no_days`, `person`, `status`, `path`) VALUES ('PA1', 'Munnar', 'Tea Factory,Treking,Top Stations', '2', '1400', 'deleted', '58071-munnar.jpeg'), ('PA2', 'Munnar', 'Munnar', '4', '2500', 'deleted', '16176-munnar.jpeg'), ('PA3', 'Package1', 'Munnar', '4', '1500', 'nostatus', '70691-munnar-women-plucking-tea-leaves.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_pack_book` -- CREATE TABLE `tbl_pack_book` ( `pack_id` varchar(50) NOT NULL, `usr_id` varchar(50) NOT NULL, `date` varchar(50) NOT NULL, `no_pass` varchar(50) NOT NULL, `book_id` varchar(50) NOT NULL, `status` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_pack_book` -- INSERT INTO `tbl_pack_book` (`pack_id`, `usr_id`, `date`, `no_pass`, `book_id`, `status`) VALUES ('PA1', 'U2', '11/3/2020', '4', 'BOOKED1', 'nostatus'), ('PA1', 'U3', '10/3/2020', '4', 'BOOKED2', 'nostatus'), ('PA3', 'U6', '2020-06-10', '5', 'BOOKED3', 'nostatus'), ('PA3', 'U6', '2020-06-30', '2', 'BOOKED4', 'nostatus'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_registration` -- CREATE TABLE `tbl_registration` ( `u_id` varchar(50) NOT NULL, `name` varchar(100) NOT NULL, `address` varchar(250) NOT NULL, `gender` varchar(50) NOT NULL, `dob` varchar(50) NOT NULL, `mail` varchar(50) NOT NULL, `ph` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_registration` -- INSERT INTO `tbl_registration` (`u_id`, `name`, `address`, `gender`, `dob`, `mail`, `ph`) VALUES ('U1', 'Jito J Thomas Vaidyan', 'Elanjickal\r\nNagiyarkulangara', 'male', '27/4/1995', 'jitovaidyan1995@gmail.com', '09544571966'), ('U2', 'Rejith', 'Ravi Nivas', 'male', '02/1/1997', 'rejith@gmail.com', '9876445566'), ('U3', 'user1', 'user1', 'male', '25/12/1997', 'user1@gmail.com', '887766687'), ('U4', 'surekha', 'rdgfdghdr', 'female', '04/1/2006', 'surekha@gmail.com', '9875432341'), ('U5', 'sasi', 'sasi laym', 'male', '02/6/2020', 'sasi@gmail.com', '987848669'), ('U6', 'Shamnad', 'sjkshhgyug', 'male', '1999-10-04', 'sshamnad03@gmail.com', '9567932761'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_staff` -- CREATE TABLE `tbl_staff` ( `staff_id` varchar(50) NOT NULL, `name` varchar(100) NOT NULL, `address` varchar(250) NOT NULL, `gender` varchar(50) NOT NULL, `mail` varchar(100) NOT NULL, `dob` varchar(50) NOT NULL, `phone` varchar(50) NOT NULL, `status` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_staff` -- INSERT INTO `tbl_staff` (`staff_id`, `name`, `address`, `gender`, `mail`, `dob`, `phone`, `status`) VALUES ('ST1', 'gkugkgk', 'Nilayam1', 'male', 'arun@gmail.com', '18/06/2020', '9876578935', 'nostatus'), ('ST2', 'Test1', 'test1address', 'male', 'test1@gmail.com', '08/3/1999', '9876545678', 'nostatus'), ('ST3', 'salini', 'ytftr', 'female', 'salini@gmail.com', '03/3/2020', '9867452311', 'nostatus'), ('ST4', 'Ashok', 'Patiala House\r\nPunjab', 'male', 'ashokmityra@gmail.com', '2020-06-05', '9567932755', 'nostatus'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_staffid` -- CREATE TABLE `tbl_staffid` ( `staff_id` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_staffid` -- INSERT INTO `tbl_staffid` (`staff_id`) VALUES ('ST1'), ('ST2'), ('ST3'), ('ST4'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_userid_genl` -- CREATE TABLE `tbl_userid_genl` ( `u_id` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_userid_genl` -- INSERT INTO `tbl_userid_genl` (`u_id`) VALUES ('U1'), ('U2'), ('U3'), ('U4'), ('U5'), ('U6'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_usertype` -- CREATE TABLE `tbl_usertype` ( `utype_id` varchar(50) NOT NULL, `utype` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_usertype` -- INSERT INTO `tbl_usertype` (`utype_id`, `utype`) VALUES ('A1', 'Admin'), ('A2', 'Customer'), ('A3', 'Staff'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_vehicle` -- CREATE TABLE `tbl_vehicle` ( `veh_id` varchar(50) NOT NULL, `veh_ty` varchar(50) NOT NULL, `veh_no` varchar(100) NOT NULL, `veh_name` varchar(150) NOT NULL, `se_cap` varchar(50) NOT NULL, `rate` varchar(50) NOT NULL, `addi_rate` varchar(150) NOT NULL, `status` varchar(500) NOT NULL, `path` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `tbl_veh_book` -- CREATE TABLE `tbl_veh_book` ( `veh_book_id` varchar(50) NOT NULL, `veh_id` varchar(50) NOT NULL, `user_id` varchar(50) NOT NULL, `date` varchar(50) NOT NULL, `pickpoint` varchar(100) NOT NULL, `no_pass` varchar(50) NOT NULL, `status` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 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 ShohinSaeki (shohin_id CHAR(4) NOT NULL, shohin_mei VARCHAR(100) NOT NULL, hanbai_tanka INTEGER, shiire_tanka INTEGER, saeki INTEGER, PRIMARY KEY(shohin_id)); INSERT INTO ShohinSaeki SELECT shohin_id, shohin_mei, hanbai_tanka, shiire_tanka, hanbai_tanka - shiire_tanka AS saeki FROM Shohin;
-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Server version: 10.4.12-MariaDB - mariadb.org binary distribution -- Server OS: Win64 -- HeidiSQL Version: 10.2.0.5599 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- Dumping database structure for social_network CREATE DATABASE IF NOT EXISTS `social_network` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `social_network`; -- Dumping structure for table social_network.authorities CREATE TABLE IF NOT EXISTS `authorities` ( `username` varchar(50) NOT NULL, `authority` varchar(50) NOT NULL, UNIQUE KEY `USERNAME_AUTHORITY` (`username`,`authority`), CONSTRAINT `authorities_users_username_fk` FOREIGN KEY (`username`) REFERENCES `users` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Data exporting was unselected. -- Dumping structure for table social_network.comments CREATE TABLE IF NOT EXISTS `comments` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `description` varchar(200) NOT NULL, `user_id` bigint(20) NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `post_id` bigint(20) NOT NULL, PRIMARY KEY (`id`), KEY `comments_posts_id_fk` (`post_id`), KEY `comments_users_id_fk` (`user_id`), CONSTRAINT `comments_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`), CONSTRAINT `comments_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=latin1; -- Data exporting was unselected. -- Dumping structure for table social_network.likes CREATE TABLE IF NOT EXISTS `likes` ( `like_id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) NOT NULL, `post_id` bigint(20) NOT NULL, PRIMARY KEY (`like_id`), UNIQUE KEY `UQ_UserID_PostID` (`user_id`,`post_id`), KEY `likes_posts_id_fk` (`post_id`), CONSTRAINT `likes_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`), CONSTRAINT `likes_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; -- Data exporting was unselected. -- Dumping structure for table social_network.pictures CREATE TABLE IF NOT EXISTS `pictures` ( `id` int(11) NOT NULL AUTO_INCREMENT, `data` longblob DEFAULT NULL, `is_public` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; -- Data exporting was unselected. -- Dumping structure for table social_network.posts CREATE TABLE IF NOT EXISTS `posts` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `text` varchar(300) DEFAULT NULL, `created_by` bigint(20) DEFAULT NULL, `is_public` tinyint(1) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `enabled` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `posts_users_id_fk` (`created_by`), CONSTRAINT `posts_users_id_fk` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=latin1; -- Data exporting was unselected. -- Dumping structure for table social_network.requests CREATE TABLE IF NOT EXISTS `requests` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `sender_id` bigint(20) NOT NULL, `receiver_id` bigint(20) NOT NULL, `is_accepted` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `requests_users_id_fk` (`sender_id`), KEY `requests_users_id_fk_2` (`receiver_id`), CONSTRAINT `requests_users_id_fk` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`), CONSTRAINT `requests_users_id_fk_2` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1; -- Data exporting was unselected. -- Dumping structure for table social_network.users CREATE TABLE IF NOT EXISTS `users` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `email` varchar(50) DEFAULT NULL, `password` varchar(68) NOT NULL, `picture` longblob DEFAULT NULL, `enabled` tinyint(4) NOT NULL DEFAULT 1, `age` int(11) NOT NULL DEFAULT 0, `job_title` varchar(255) DEFAULT NULL, `first_name` varchar(50) DEFAULT NULL, `last_name` varchar(50) DEFAULT NULL, `cover_photo` longblob DEFAULT NULL, `picture_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_authorities_username_fk` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1; -- Data exporting was unselected. -- Dumping structure for table social_network.users_friends CREATE TABLE IF NOT EXISTS `users_friends` ( `user_id` bigint(20) NOT NULL, `friend_id` bigint(20) NOT NULL, UNIQUE KEY `USERS_FRIENDS_UK` (`user_id`,`friend_id`), KEY `users_friends_users_id_fk_2` (`friend_id`), CONSTRAINT `users_friends_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`), CONSTRAINT `users_friends_users_id_fk_2` FOREIGN KEY (`friend_id`) REFERENCES `users` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Data exporting was unselected. /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/* Warnings: - The migration will add a unique constraint covering the columns `[slug]` on the table `users`. If there are existing duplicate values, the migration will fail. */ -- AlterTable ALTER TABLE "users" ADD COLUMN "slug" TEXT; -- CreateIndex CREATE UNIQUE INDEX "users.slug_unique" ON "users"("slug");
INSERT INTO subject (id, name, short_name) VALUES (1, 'Проектирование информационных систем', 'ПрИС') ON CONFLICT DO NOTHING; INSERT INTO subject (id, name, short_name) VALUES (2, 'Системы искусственного интеллекта', 'СИИ') ON CONFLICT DO NOTHING; INSERT INTO subject (id, name, short_name) VALUES (3, 'Программная инженерия', 'ПИ') ON CONFLICT DO NOTHING; INSERT INTO subject (id, name, short_name) VALUES (4, 'Национальная система информационной безопасности', 'НСИБ') ON CONFLICT DO NOTHING; INSERT INTO subject (id, name, short_name) VALUES (5, 'Системный анализ', 'СисАнал') ON CONFLICT DO NOTHING; INSERT INTO subject (id, name, short_name) VALUES (6, 'Распределенные базы данных', 'РБД') ON CONFLICT DO NOTHING; INSERT INTO subject (id, name, short_name) VALUES (7, 'Системное программное обеспечение', 'СПО') ON CONFLICT DO NOTHING; INSERT INTO exam_type(id, type) values (1, 'Экзамен') ON CONFLICT DO NOTHING; INSERT INTO exam_type(id, type) values (2, 'Зачет') ON CONFLICT DO NOTHING; INSERT INTO exam_type(id, type) values (3, 'Зачет с оценкой') ON CONFLICT DO NOTHING; INSERT INTO exam_type(id, type) values (4, 'Курсовая') ON CONFLICT DO NOTHING;; INSERT INTO study_plan (id, subject_id, exam_type_id) VALUES (1, 1, 1) ON CONFLICT DO NOTHING; INSERT INTO study_plan (id, subject_id, exam_type_id) VALUES (2, 1, 4) ON CONFLICT DO NOTHING; INSERT INTO study_plan (id, subject_id, exam_type_id) VALUES (3, 2, 1) ON CONFLICT DO NOTHING; INSERT INTO study_plan (id, subject_id, exam_type_id) VALUES (4, 3, 1) ON CONFLICT DO NOTHING; INSERT INTO study_plan (id, subject_id, exam_type_id) VALUES (5, 4, 2) ON CONFLICT DO NOTHING; INSERT INTO study_plan (id, subject_id, exam_type_id) VALUES (6, 5, 1) ON CONFLICT DO NOTHING; INSERT INTO study_plan (id, subject_id, exam_type_id) VALUES (7, 6, 2) ON CONFLICT DO NOTHING; INSERT INTO study_plan (id, subject_id, exam_type_id) VALUES (8, 7, 1) ON CONFLICT DO NOTHING; INSERT INTO mark (id, name, value) VALUES (1, 'Отлично', 5) ON CONFLICT DO NOTHING; INSERT INTO mark (id, name, value) VALUES (2, 'Хорошо', 4) ON CONFLICT DO NOTHING; INSERT INTO mark (id, name, value) VALUES (3, 'Удовлетворительно', 3) ON CONFLICT DO NOTHING; INSERT INTO mark (id, name, value) VALUES (4, 'Неудовлетворительно', 2) ON CONFLICT DO NOTHING; INSERT INTO mark (id, name, value) VALUES (5, 'Зачет', 'з') ON CONFLICT DO NOTHING; INSERT INTO mark (id, name, value) VALUES (6, 'Незачет', 'н') ON CONFLICT DO NOTHING; INSERT INTO mark (id, name, value) VALUES (7, 'Неявка', '') ON CONFLICT DO NOTHING; INSERT INTO study_group (id, name) VALUES (1, 'ИКБО-11-17') ON CONFLICT DO NOTHING; INSERT INTO study_group (id, name) VALUES (2, 'ИКБО-12-17') ON CONFLICT DO NOTHING;
DROP DATABASE IF EXISTS testdb; CREATE DATABASE testdb; USE testdb; DROP TABLE IF EXISTS CREDIT; CREATE TABLE CREDIT ( ID INT NOT NULL AUTO_INCREMENT, STATUS VARCHAR(200), AMOUNT DOUBLE, APPLICATION_SIGNED_HOUR INT, APPLICATION_SIGNED_WEEKDAY INT, CITY VARCHAR(200), COUNTRY VARCHAR(200), CREDIT_SCORE_ES_EQUIFAX_RISK VARCHAR(200), DATE_OF_BIRTH VARCHAR(200), DEBT_TO_INCOME DOUBLE, EDUCATION INT, EMPLOYMENT_DURATION_CURRENT_EMPLOYER VARCHAR(200), EMPLOYMENT_POSITION VARCHAR (200), EMPLOYMENT_STATUS INT, EXISTING_LIABILITIES INT, GENDER INT, HOME_OWNERSHIP_TYPE INT, INCOME_FROM_PRINCIPAL_EMPLOYER INT, INCOME_TOTAL INT, INTEREST_RATE DOUBLE, LOAN_DATE VARCHAR(200), LOAN_DURATION INT, MARITAL_STATUS INT, NEW_CREDIT_CUSTOMER BIT, NO_OF_PREVIOUS_LOANS_BEFORE_LOAN INT, OCCUPATION_AREA INT, USE_OF_LOAN INT, VERIFICATION_TYPE INT, WORK_EXPERIENCE VARCHAR(200), PREVIOUS_SCORE DOUBLE, DEFAULTED BIT, DEFAULT_DATE VARCHAR(200), PRIMARY KEY (ID) )
CREATE TABLE public.da_district ( district_cd character varying(8) NOT NULL, district_name character varying(64), district_desc character varying(64), state_cd character varying(8), country_cd character varying(8), grp_cd character varying(15) NOT NULL, record_status character(1), dw_last_updated_dt timestamp without time zone, dw_facility_cd character varying(16), dw_job_run_no numeric, dw_row_id character varying(128) );
SELECT Username, LastName, CASE WHEN PhoneNumber IS NULL THEN 0 ELSE 1 END AS [Has Phone] FROM Users ORDER BY LastName, Id
-- This is the MySql Sakai 1.5 -> 2.0 conversion script -- new tables will be established by running auto-ddl. If this is not desired, you must manually -- create the tables for any new Sakai feature -- tables were renamed alter table CHEF_EVENT rename to SAKAI_EVENT; alter table CHEF_DIGEST rename to SAKAI_DIGEST; alter table CHEF_NOTIFICATION rename to SAKAI_NOTIFICATION; alter table CHEF_PREFERENCES rename to SAKAI_PREFERENCES; alter table CHEF_PRESENCE rename to SAKAI_PRESENCE; alter table CHEF_SESSION rename to SAKAI_SESSION; DROP TABLE if exists CHEF_ID_SEQ; -- fields were expanded alter table ANNOUNCEMENT_MESSAGE modify MESSAGE_ID VARCHAR(36); ALTER TABLE CALENDAR_EVENT modify EVENT_ID VARCHAR(36) NOT NULL DEFAULT ''; alter table CHAT_MESSAGE modify MESSAGE_ID VARCHAR(36); alter table DISCUSSION_MESSAGE modify MESSAGE_ID VARCHAR(36); alter table DISCUSSION_MESSAGE modify REPLY VARCHAR(36); alter table MAILARCHIVE_MESSAGE modify MESSAGE_ID VARCHAR(36); alter table SAKAI_EVENT modify SESSION_ID VARCHAR(36); alter table SAKAI_PRESENCE modify SESSION_ID VARCHAR(36); alter table SAKAI_SESSION modify SESSION_ID VARCHAR(36); alter table SAKAI_LOCKS modify USAGE_SESSION_ID VARCHAR(36); -- tool ids were changed update SAKAI_SITE_TOOL set REGISTRATION=concat('sakai', substr(REGISTRATION,5)) where UPPER(substr(REGISTRATION,1,4)) = 'CHEF'; update SAKAI_SITE_TOOL set REGISTRATION='sakai.preferences' where REGISTRATION='sakai.noti.prefs'; update SAKAI_SITE_TOOL set REGISTRATION='sakai.online' where REGISTRATION='sakai.presence'; update SAKAI_SITE_TOOL set REGISTRATION='sakai.siteinfo' where REGISTRATION='sakai.siteinfogeneric'; update SAKAI_SITE_TOOL set REGISTRATION='sakai.sitesetup' where REGISTRATION='sakai.sitesetupgeneric'; update SAKAI_SITE_TOOL set REGISTRATION='sakai.discussion' where REGISTRATION='sakai.threadeddiscussion'; -- change the old site types update SAKAI_SITE set TYPE='project' where TYPE='CTNG-project'; update SAKAI_SITE set TYPE='course' where TYPE='CTNG-course'; -- optional: drop old skins, everyone re-starts as default /* update SAKAI_SITE set SKIN=null; */ -- optional: drop all user myWorkspaces, so they get new ones (with new stuff) /* delete from sakai_site_user where site_id like '~%' and site_id != '~admin'; delete from sakai_site_tool_property where site_id like '~%' and site_id != '~admin'; delete from sakai_site_tool where site_id like '~%' and site_id != '~admin'; delete from sakai_site_page where site_id like '~%' and site_id != '~admin'; delete from sakai_site where site_id like '~%' and site_id != '~admin'; */ -- replace the gateway site /* delete from sakai_site_user where site_id = '!gateway'; delete from sakai_site_tool_property where site_id = '!gateway'; delete from sakai_site_tool where site_id = '!gateway'; delete from sakai_site_page where site_id = '!gateway'; delete from sakai_site where site_id like '!gateway'; INSERT INTO SAKAI_SITE VALUES('!gateway', 'Gateway', null, null, 'The Gateway Site', null, null, null, 1, 0, 0, '', null, null, null, null, 1, 0 ); UPDATE SAKAI_SITE SET MODIFIEDBY='admin' WHERE SITE_ID = '!gateway'; UPDATE SAKAI_SITE SET MODIFIEDON='2003-11-26 03:45:22' WHERE SITE_ID = '!gateway'; INSERT INTO SAKAI_SITE_PAGE VALUES('!gateway-100', '!gateway', 'Welcome', '0', 1 ); INSERT INTO SAKAI_SITE_TOOL VALUES('!gateway-110', '!gateway-100', '!gateway', 'sakai.motd', 1, 'Message of the day', NULL ); INSERT INTO SAKAI_SITE_TOOL VALUES('!gateway-120', '!gateway-100', '!gateway', 'sakai.iframe', 2, 'Welcome!', NULL ); INSERT INTO SAKAI_SITE_TOOL_PROPERTY VALUES('!gateway', '!gateway-120', 'special', 'site' ); INSERT INTO SAKAI_SITE_PAGE VALUES('!gateway-200', '!gateway', 'About', '0', 2 ); INSERT INTO SAKAI_SITE_TOOL VALUES('!gateway-210', '!gateway-200', '!gateway', 'sakai.iframe', 1, 'About', NULL ); INSERT INTO SAKAI_SITE_TOOL_PROPERTY VALUES('!gateway', '!gateway-210', 'height', '500px' ); INSERT INTO SAKAI_SITE_TOOL_PROPERTY VALUES('!gateway', '!gateway-210', 'source', '/library/content/gateway/about.html' ); INSERT INTO SAKAI_SITE_PAGE VALUES('!gateway-300', '!gateway', 'Features', '0', 3 ); INSERT INTO SAKAI_SITE_TOOL VALUES('!gateway-310', '!gateway-300', '!gateway', 'sakai.iframe', 1, 'Features', NULL ); INSERT INTO SAKAI_SITE_TOOL_PROPERTY VALUES('!gateway', '!gateway-310', 'height', '500px' ); INSERT INTO SAKAI_SITE_TOOL_PROPERTY VALUES('!gateway', '!gateway-310', 'source', '/library/content/gateway/features.html' ); INSERT INTO SAKAI_SITE_PAGE VALUES('!gateway-400', '!gateway', 'Sites', '0', 4 ); INSERT INTO SAKAI_SITE_TOOL VALUES('!gateway-410', '!gateway-400', '!gateway', 'sakai.sitebrowser', 1, 'Sites', NULL ); INSERT INTO SAKAI_SITE_PAGE VALUES('!gateway-500', '!gateway', 'Training', '0', 5 ); INSERT INTO SAKAI_SITE_TOOL VALUES('!gateway-510', '!gateway-500', '!gateway', 'sakai.iframe', 1, 'Training', NULL ); INSERT INTO SAKAI_SITE_TOOL_PROPERTY VALUES('!gateway', '!gateway-510', 'height', '500px' ); INSERT INTO SAKAI_SITE_TOOL_PROPERTY VALUES('!gateway', '!gateway-510', 'source', '/library/content/gateway/training.html' ); INSERT INTO SAKAI_SITE_PAGE VALUES('!gateway-600', '!gateway', 'New Account', '0', 6 ); INSERT INTO SAKAI_SITE_TOOL VALUES('!gateway-610', '!gateway-600', '!gateway', 'sakai.createuser', 1, 'New Account', NULL ); */ -- skin has changed, so most should have defaults and icons set -- here's an example of finding old skins and changing them /* update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/arc.gif' where skin='arc.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/art.gif' where skin='art.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/bus.gif' where skin='bus.css'; update SAKAI_SITE set SKIN=null where skin='chef.css'; update SAKAI_SITE set SKIN=null where skin='ctng.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/den.gif' where skin='den.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/edu.gif' where skin='edu.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/eng.gif' where skin='eng.css'; update SAKAI_SITE set SKIN=null where skin='examp-u.css'; update SAKAI_SITE set SKIN=null where skin='glrc.css'; update SAKAI_SITE set SKIN=null where skin='hkitty.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/inf.gif' where skin='inf.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/kin.gif' where skin='kin.css'; update SAKAI_SITE set SKIN=null where skin='komisar.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/law.gif' where skin='law'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/law.gif' where skin='law.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/lsa.gif' where skin='lsa'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/lsa.gif' where skin='lsa.css'; update SAKAI_SITE set SKIN=null where skin='lynx.css'; update SAKAI_SITE set SKIN='med', ICON_URL='/ctlib/icon/med.jpg' where skin='med.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/mus.gif' where skin='mus.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/nre.gif' where skin='nre.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/nur.gif' where skin='nur.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/off.gif' where skin='off.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/pha.gif' where skin='pha.css'; update SAKAI_SITE set SKIN=null where skin='pro.css'; update SAKAI_SITE set SKIN=null where skin='prp.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/rac.gif' where skin='rac.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/sph.gif' where skin='sph.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/spp.gif' where skin='spp.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/ssw.gif' where skin='ssw.css'; update SAKAI_SITE set SKIN=null where skin='um'; update SAKAI_SITE set SKIN=null where skin='um.css'; update SAKAI_SITE set SKIN=null where skin='sakai_core.css'; update SAKAI_SITE set SKIN=null, ICON_URL='/ctlib/icon/umd.gif' where skin='umd.css'; */ -- GradTools specific conversions /* update sakai_site_tool_property set value='http://gradtools.umich.edu/about.html' where dbms_lob.substr( value, 4000, 1 ) ='/content/public/GradToolsInfo.html'; update sakai_site_tool_property set value='http://gradtools.umich.edu/help' where dbms_lob.substr( value, 4000, 1 ) ='https://coursetools.ummu.umich.edu/disstools/help.nsf'; */ -- get rid of the old "contact support" help, if using the new portal supplied help /* delete from sakai_site_tool_property where tool_id in (select tool_id from sakai_site_tool where page_id in (select page_id from sakai_site_page where title='Help') ); delete from sakai_site_tool where page_id in (select page_id from sakai_site_page where title='Help'); delete from sakai_site_page_property where page_id in (select page_id from sakai_site_page where title='Help'); delete from sakai_site_page where title='Help'; */ -- add some additional keys ALTER TABLE `ANNOUNCEMENT_MESSAGE` ADD KEY `ANNOUNCEMENT_MESSAGE_CDD` (`CHANNEL_ID`,`MESSAGE_DATE`,`DRAFT`); ALTER TABLE CALENDAR_EVENT modify EVENT_ID VARCHAR(36) NOT NULL DEFAULT ''; ALTER TABLE `CHAT_MESSAGE` ADD KEY `CHAT_MSG_CDD` (`CHANNEL_ID`,`MESSAGE_DATE`,`DRAFT`); ALTER TABLE `DISCUSSION_MESSAGE` ADD KEY `DISC_MSG_CDD` (`CHANNEL_ID`,`MESSAGE_DATE`,`DRAFT`); ALTER TABLE `MAILARCHIVE_MESSAGE` ADD KEY `MAILARC_MSG_CDD` (`CHANNEL_ID`,`MESSAGE_DATE`,`DRAFT`); -- add gradebook permissions INSERT INTO SAKAI_REALM_FUNCTION VALUES (DEFAULT,'gradebook.access'); INSERT INTO SAKAI_REALM_FUNCTION VALUES (DEFAULT,'gradebook.maintain'); -- add admin role INSERT INTO `SAKAI_REALM_ROLE` VALUES (DEFAULT,'admin'); -- add the mercury and !admin sites and associated realms INSERT INTO SAKAI_REALM VALUES (DEFAULT,'/site/mercury','',NULL,'admin','admin',CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); INSERT INTO SAKAI_REALM VALUES (DEFAULT,'/site/!admin','',(select ROLE_KEY FROM SAKAI_REALM_ROLE WHERE ROLE_NAME='admin'),'admin','admin',CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); INSERT INTO `SAKAI_SITE` VALUES ('!admin','Administration Workspace',NULL,NULL,'Administration Workspace',NULL,NULL,NULL,1,'0','0','',NULL,NULL,NULL,NULL,'0','0'); INSERT INTO `SAKAI_SITE` VALUES ('mercury','mercury site',NULL,NULL,NULL,'','',NULL,1,'1','1','access','admin','admin',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP(),'0','0'); INSERT INTO `SAKAI_SITE_PAGE` VALUES ('!admin-100','!admin','Home','0',1),('!admin-200','!admin','Users','0',2),('!admin-250','!admin','Aliases','0',3),('!admin-300','!admin','Sites','0',4),('!admin-350','!admin','Realms','0',5),('!admin-360','!admin','Worksite Setup','0',6),('!admin-400','!admin','MOTD','0',7),('!admin-500','!admin','Resources','0',8),('!admin-600','!admin','On-Line','0',9),('!admin-700','!admin','Memory','0',10),('!admin-900','!admin','Site Archive','0',11); INSERT INTO `SAKAI_SITE_PAGE` VALUES ('mercury-100','mercury','Home','1',1),('mercury-200','mercury','Schedule','0',2),('mercury-300','mercury','Announcements','0',3),('mercury-400','mercury','Resources','0',4),('mercury-500','mercury','Discussion','0',5),('mercury-600','mercury','Assignments','0',6),('mercury-700','mercury','Drop Box','0',7),('mercury-800','mercury','Chat','0',8),('mercury-900','mercury','Email Archive','0',9); INSERT INTO `SAKAI_SITE_TOOL` VALUES ('!admin-110','!admin-100','!admin','sakai.motd',1,'Message of the Day',NULL),('!admin-120','!admin-100','!admin','sakai.iframe',2,'My Workspace Information',NULL),('!admin-210','!admin-200','!admin','sakai.users',1,'Users',NULL),('!admin-260','!admin-250','!admin','sakai.aliases',1,'Aliases',NULL),('!admin-310','!admin-300','!admin','sakai.sites',1,'Sites',NULL),('!admin-355','!admin-350','!admin','sakai.realms',1,'Realms',NULL),('!admin-365','!admin-360','!admin','sakai.sitesetup',1,'Worksite Setup',NULL),('!admin-410','!admin-400','!admin','sakai.announcements',1,'MOTD',NULL),('!admin-510','!admin-500','!admin','sakai.resources',1,'Resources',NULL),('!admin-610','!admin-600','!admin','sakai.online',1,'On-Line',NULL),('!admin-710','!admin-700','!admin','sakai.memory',1,'Memory',NULL),('!admin-910','!admin-900','!admin','sakai.archive',1,'Site Archive / Import',NULL); INSERT INTO `SAKAI_SITE_TOOL` VALUES ('mercury-110','mercury-100','mercury','sakai.iframe',1,'My Workspace Information',NULL),('mercury-120','mercury-100','mercury','sakai.synoptic.announcement',2,'Recent Announcements',NULL),('mercury-130','mercury-100','mercury','sakai.synoptic.discussion',3,'Recent Discussion Items',NULL),('mercury-140','mercury-100','mercury','sakai.synoptic.chat',4,'Recent Chat Messages',NULL),('mercury-210','mercury-200','mercury','sakai.schedule',1,'Schedule',NULL),('mercury-310','mercury-300','mercury','sakai.announcements',1,'Announcements',NULL),('mercury-410','mercury-400','mercury','sakai.resources',1,'Resources',NULL),('mercury-510','mercury-500','mercury','sakai.discussion',1,'Discussion',NULL),('mercury-610','mercury-600','mercury','sakai.assignment',1,'Assignments',NULL),('mercury-710','mercury-700','mercury','sakai.dropbox',1,'Drop Box',NULL),('mercury-810','mercury-800','mercury','sakai.chat',1,'Chat',NULL),('mercury-910','mercury-900','mercury','sakai.mailbox',1,'Email Archive',NULL); INSERT INTO `SAKAI_SITE_TOOL_PROPERTY` VALUES ('!admin','!admin-120','special','workspace'),('!admin','!admin-410','channel','/announcement/channel/!site/motd'),('!admin','!admin-510','home','/'); INSERT INTO `SAKAI_SITE_TOOL_PROPERTY` VALUES ('mercury','mercury-110','height','100px'),('mercury','mercury-110','special','workspace'),('mercury','mercury-110','source',''),('mercury','mercury-510','category','false'),('mercury','mercury-710','resources_mode','dropbox'),('mercury','mercury-810','display-date','true'),('mercury','mercury-810','filter-param','3'),('mercury','mercury-810','display-time','true'),('mercury','mercury-810','sound-alert','true'),('mercury','mercury-810','filter-type','SelectMessagesByTime'),('mercury','mercury-810','display-user','true'); INSERT INTO SAKAI_REALM_RL_GR VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/!admin'), 'admin',(select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'admin'), '1', '0'); INSERT INTO SAKAI_REALM_RL_GR VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), 'admin',(select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), '1', '0'); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'annc.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'asn.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'asn.submit')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'chat.new')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'chat.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.new')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.revise.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dropbox.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'calendar.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'content.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'mail.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'site.visit')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.status.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.status.del')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.dis.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.status.upd')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.path.upd')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.status.add')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.step.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'access'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'gradebook.access')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'annc.new')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'annc.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'annc.revise.any')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'annc.revise.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'annc.delete.any')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'annc.delete.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'annc.read.drafts')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'asn.delete')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'asn.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'asn.revise')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'asn.new')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'calendar.revise')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'calendar.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'calendar.delete')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'calendar.new')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'chat.new')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'chat.revise.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'chat.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'chat.delete.any')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'chat.delete.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'chat.revise.any')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'content.revise')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'content.new')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'content.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'content.delete')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.delete.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.new')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.revise.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.new.topic')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.delete.any')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.read.drafts')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'disc.revise.any')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'mail.new')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'mail.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'mail.revise.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'mail.revise.any')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'mail.delete.own')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'mail.delete.any')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'realm.del')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'realm.upd')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'site.del')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'site.visit')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'site.upd')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'site.visit.unp')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.status.del')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.dis.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.dis.upd')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.path.del')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.path.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.status.upd')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.path.add')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.dis.add')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.step.upd')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.step.del')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.status.add')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.status.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.dis.del')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.step.add')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'dis.step.read')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/mercury'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'maintain'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'gradebook.maintain')); INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '/site/!admin'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = 'admin'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'site.upd'));
UPDATE users SET verified = true WHERE verified_link = $1; SELECT * FROM users;
DROP table IF EXISTS btj_joblevel; CREATE TABLE btj_joblevel ( num int(11) NOT NULL default '0', code varchar(10) , cvalue varchar(50), content text, PRIMARY KEY (num) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (1, '1', '본부선교사', '본부선교사'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (2, '2', '지부장', '지부장'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (3, '3', '총무', '총무'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (4, '4', '선교사', '선교사'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (5, '5', '행정부', '행정부'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (6, '6', '기획부', '기획부'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (7, '7', '전임간사', '전임간사'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (8, '8', '협력간사', '협력간사'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (10, '10', '발렌티어', '발렌티어'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (12, '12', '사역총무', '사역총무'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (13, '13', '사역이사', '사역이사'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (14, '11', '대표간사', '대표간사'); INSERT INTO btj_joblevel (num, code, cvalue, content) VALUES (15, '14', '여성월미팀장', '여성월미 팀장권한');
SELECT u.[Username], c.Name FROM Reports AS r LEFT JOIN Users AS u ON r.UserId = u.Id LEFT JOIN Categories AS c ON r.CategoryId = c.Id WHERE DAY(r.OpenDate) = DAY(u.Birthdate) AND MONTH(r.OpenDate) = MONTH(u.Birthdate) ORDER BY u.Username, c.Name
-- hjælpetekster. INSERT INTO Hjaelpetekst(tekst) VALUES('Beklædning af skur 1 på 2'); INSERT INTO Hjaelpetekst(tekst) VALUES('beklædning af gavle 1 på 2'); INSERT INTO Hjaelpetekst(tekst) VALUES('byg-selv spær (skal samles) ? stk.'); INSERT INTO Hjaelpetekst(tekst) VALUES('løsholter til skur gavle'); INSERT INTO Hjaelpetekst(tekst) VALUES('løsholter til skur sider'); INSERT INTO Hjaelpetekst(tekst) VALUES('monteres på toppen af spæret (til toplægte)'); INSERT INTO Hjaelpetekst(tekst) VALUES('monteres på taglægter 6 rækker af 24 sten på hver side af taget'); INSERT INTO Hjaelpetekst(tekst) VALUES('monteres på toplægte med medfølgende beslag se tagstens vejledning'); INSERT INTO Hjaelpetekst(tekst) VALUES('oversternbrædder til siderne'); INSERT INTO Hjaelpetekst(tekst) VALUES('oversternbrædder til forenden'); INSERT INTO Hjaelpetekst(tekst) VALUES('Remme i sider, sadles ned i stolper'); INSERT INTO Hjaelpetekst(tekst) VALUES('Remme i sider, sadles ned i stolper Skur del'); INSERT INTO Hjaelpetekst(tekst) VALUES('Remme i sider, sadles ned i stolper Carport del'); INSERT INTO Hjaelpetekst(tekst) VALUES('Remme i sider, sadles ned i stolper (skur del, deles)'); INSERT INTO Hjaelpetekst(tekst) VALUES('Skruer til tagplader'); INSERT INTO Hjaelpetekst(tekst) VALUES('Spær, monteres på rem'); INSERT INTO Hjaelpetekst(tekst) VALUES('Stolper nedgraves 90 cm. i jord'); INSERT INTO Hjaelpetekst(tekst) VALUES('Stolper nedgraves 90 cm. i jord + skråstiver'); INSERT INTO Hjaelpetekst(tekst) VALUES('Sternbrædder til siderne Carport del'); INSERT INTO Hjaelpetekst(tekst) VALUES('Sternbrædder til siderne Skur del ( deles )'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til skurdør'); INSERT INTO Hjaelpetekst(tekst) VALUES('til taglægter'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til vindkryds på spær'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til lås på dør i skur'); INSERT INTO Hjaelpetekst(tekst) VALUES('til z på bagside af dør'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til montering af rygsten'); INSERT INTO Hjaelpetekst(tekst) VALUES('tagplader monteres på spær'); INSERT INTO Hjaelpetekst(tekst) VALUES('til montering af løsholter'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til montering af spær på rem'); INSERT INTO Hjaelpetekst(tekst) VALUES('til beklædning af skur 1 på 2'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til montering af rem på stolper'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til montering af stern&vandbrædt'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til montering af løsholter i skur'); INSERT INTO Hjaelpetekst(tekst) VALUES('til montering oven på tagfodslægte'); INSERT INTO Hjaelpetekst(tekst) VALUES('til montering af yderste beklædning'); INSERT INTO Hjaelpetekst(tekst) VALUES('til montering af inderste beklædning'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til montering af universalbeslag + hulbånd'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til montering af universalbeslag + toplægte'); INSERT INTO Hjaelpetekst(tekst) VALUES('til montering af yderste bræt ved beklædning'); INSERT INTO Hjaelpetekst(tekst) VALUES('til montering af inderste bræt ved beklædning'); INSERT INTO Hjaelpetekst(tekst) VALUES('Til montering af Stern, vindskeder, vindkryds & vandbræt'); INSERT INTO Hjaelpetekst(tekst) VALUES('toplægte til montering af rygsten lægges i toplægte holder'); INSERT INTO Hjaelpetekst(tekst) VALUES('til montering af tagsten, alle ydersten + hver anden fastgøres'); INSERT INTO Hjaelpetekst(tekst) VALUES('til montering på spær, 7 rækker lægter på hver skiftevis 1 hel & 1 halv lægte'); INSERT INTO Hjaelpetekst(tekst) VALUES('understernbrædder til siderne'); INSERT INTO Hjaelpetekst(tekst) VALUES('understernbrædder til for- & bagende'); INSERT INTO Hjaelpetekst(tekst) VALUES('Vandbræt på vindskeder'); INSERT INTO Hjaelpetekst(tekst) VALUES('Vindskeder på rejsning'); INSERT INTO Hjaelpetekst(tekst) VALUES('vandbrædt på stern i sider'); INSERT INTO Hjaelpetekst(tekst) VALUES('vandbrædt på stern i forende'); -- trykimprægnerede brædder. INSERT INTO Materialetype(type) VALUES('Trykimp. brædt'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '25x200 mm.', 360, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '25x200 mm.', 540, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '25x150 mm.', 480, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '25x150 mm.', 540, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '25x150 mm.', 600, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '25x125 mm.', 360, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '25x125 mm.', 540, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '25x50 mm.', 540, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '19x100 mm.', 210, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '19x100 mm.', 240, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '19x100 mm.', 360, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '19x100 mm.', 480, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (1, '19x100 mm.', 540, 'stk'); -- 13 -- ubehandlede lægter INSERT INTO Materialetype(type) VALUES('lægte ubh.'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (2, '38x73 mm.', 420, 'stk'); -- ubehandlede reglar INSERT INTO Materialetype(type) VALUES('reglar ub.'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (3, '45x95 mm.', 360, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (3, '45x95 mm.', 270, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (3, '45x95 mm.', 240, 'stk'); -- spærtræ, ubehandlet. INSERT INTO Materialetype(type) VALUES('spærtræ ubh.'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (4, '45x195 mm.', 600, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (4, '45x195 mm.', 480, 'stk'); -- trykimprægnerede stolper. INSERT INTO Materialetype(type) VALUES('trykimp. stolpe'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (5, '97x97 mm.', 300, 'stk'); -- 20 -- taglægte T1 INSERT INTO Materialetype(type) VALUES('taglægte T1'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (6, '38x73 mm.', 540, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (6, '38x73 mm.', 420, 'stk'); -- tagfladebelægning. INSERT INTO Materialetype(type) VALUES('tagfladebelægning'); -- 7 INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (7, 'Plastmo ecolite blåtonet', 600, 'stk'); INSERT INTO Materiale(materialetypeId, navn, laengde, enhed) VALUES (7, 'Plastmo ecolite blåtonet', 360, 'stk'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (7, 'B & C Dobbelt-s sort', 'stk'); -- 25 -- tagrygbelægning. INSERT INTO Materialetype(type) VALUES('tagrygbelægning'); -- tidl. rygsten INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (8, 'B & C sort', 'stk'); -- toplægteholder INSERT INTO Materialetype(type) VALUES('toplægteholder'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (9, 'B & C', 'stk'); -- rygstensbeslag INSERT INTO Materialetype(type) VALUES('rygstensbeslag'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (10, 'B & C', 'stk'); -- tagstensbindere og kroge sampak INSERT INTO Materialetype(type) VALUES('tagstensbindere & nakkekroge'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (11, 'B & C', 'pk'); -- universalbeslag højre INSERT INTO Materialetype(type) VALUES('universalbeslag højre'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (12, '190 mm.', 'stk'); -- universalbeslag venstre INSERT INTO Materialetype(type) VALUES('universalbeslag venstre'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (13, '190 mm.', 'stk'); -- stalddørsgreb INSERT INTO Materialetype(type) VALUES('stalddørsgreb'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (14, '50x75', 'stk'); -- T-hængsel INSERT INTO Materialetype(type) VALUES('T-hængsel'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (15, '390 mm.', 'stk'); -- Vinkelbeslag INSERT INTO Materialetype(type) VALUES('vinkelbeslag'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (16, '35 mm.', 'stk'); -- skruer INSERT INTO Materialetype(type) VALUES('skruer'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (17, '300 stk 4,5x50 mm.', 'pakke'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (17, '350 stk 4,5x50 mm.', 'pakke'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (17, '200 stk 4,5x60 mm.', 'pakke'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (17, '200 stk 4,5x70 mm.', 'pakke'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (17, '400 stk 4,5x70 mm.', 'pakke'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (17, '100 stk 5,0x100 mm.', 'pakke'); -- beslagskruer INSERT INTO Materialetype(type) VALUES('beslagskruer'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (18, '250 stk 4,0x50 mm.', 'pakke'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (18, '250 stk 5,0x40 mm.', 'pakke'); -- bræddebolt INSERT INTO Materialetype(type) VALUES('bræddebolt'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (19, '10 x 120 mm.', 'stk'); -- firkantskiver INSERT INTO Materialetype(type) VALUES('firkantskiver'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (20, '40x40x11 mm.', 'stk'); -- bundskruer INSERT INTO Materialetype(type) VALUES('bundskruer'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (21, '200 stk Plastmo', 'pakke'); -- hulbånd INSERT INTO Materialetype(type) VALUES('hulbånd'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (22, '1x20 mm., 10 mtr', 'rulle'); -- byg-selv spær INSERT INTO Materialetype(type) VALUES('byg-selv spær'); INSERT INTO Materiale(materialetypeId, navn, enhed) VALUES (23, 'færdigskåret spær', 'sæt'); -- roof types INSERT INTO Rooftype(type) VALUES('Rødt tegltag'); INSERT INTO Rooftype(type) VALUES('Sort tegltag'); INSERT INTO Rooftype(type) VALUES('Plast tag'); INSERT INTO Rooftype(type) VALUES('Pap tag'); -- roof type materials INSERT INTO RooftypeMaterial(rooftypeId, materialtypeId, slope, materialId) VALUES (2, 7, true, 25); -- tagsten sort INSERT INTO RooftypeMaterial(rooftypeId, materialtypeId, slope, materialId) VALUES (2, 8, true, 26); -- rygsten sort INSERT INTO RooftypeMaterial(rooftypeId, materialtypeId, slope, materialId) VALUES (3, 7, false, 24); -- plast tag 360 cm INSERT INTO RooftypeMaterial(rooftypeId, materialtypeId, slope, materialId) VALUES (3, 7, false, 23); -- plast tag 600 cm
 CREATE PROC [ERP].[Usp_Sel_Reporte_AsientoDetalle_Concar] @IDS VARCHAR(MAX) AS BEGIN SELECT '06' SubDiario, RIGHT('00' + LTRIM(RTRIM(MONTH(AD.Fecha))), 2) + RIGHT('0000' + LTRIM(RTRIM(A.Orden)), 4) NumeroComprobante, FORMAT(AD.Fecha,'dd/MM/yyyy') FechaComprobante, 'MN' CodigoMoneda, AD.Nombre GlosaPrincipal, CAST(A.TipoCambio AS DECIMAL(14,2)) TipoCambio, 'V' TipoConversion, CASE WHEN A.IdMoneda = 1 THEN 'N' ELSE 'S' END FlagConversionMoneda, FORMAT(AD.Fecha,'dd/MM/yyyy') FechaTipoCambio, PC.CuentaContable CuentaContable, CASE WHEN SUBSTRING(PC.CuentaContable,0,3) = '40' THEN '110' ELSE ETD.NumeroDocumento END CodigoAnexo, '300' CentroCosto, DH.Abreviatura DebeHaber, CAST(AD.ImporteSoles AS DECIMAL(14,2)) ImporteOriginal, CAST(AD.ImporteDolares AS DECIMAL(14,2)) ImporteDolares, CAST(AD.ImporteSoles AS DECIMAL(14,2)) ImporteSoles, -- TC.CodigoSunat TipoDocumento, CASE WHEN C.IdTipoComprobante = 4 OR C.IdTipoComprobante = 189 THEN --BOLETA 'BV' WHEN C.IdTipoComprobante = 2 OR C.IdTipoComprobante = 190 THEN --FACTURA 'FT' WHEN C.IdTipoComprobante = 8 THEN 'NA' WHEN C.IdTipoComprobante = 9 THEN 'ND' END TipoDocumento, RIGHT('00000000000000000000' + LTRIM(RTRIM(C.Documento)), 20) NumeroDocumento, --'' NumeroDocumento, FORMAT(AD.Fecha,'dd/MM/yyyy') FechaDocumento, FORMAT(AD.Fecha,'dd/MM/yyyy') FechaVencimiento, --'' FechaDocumento, --'' FechaVencimiento, '' CodigoArea, AD.Nombre GlosaDetalle, '' CodigoAnexoAuxiliar, '' MedioPago, '' TipoDocumentoReferencia, '' NumeroDocumentoReferencia, '' FechaDocumentoReferencia, '' NumeroMaquinaRegistradoraDocRef, CAST(0 AS DECIMAL(14,2)) BaseImponibleDocumentoReferencia, CAST(0 AS DECIMAL(14,2)) IGVDocumentoProvision, '' TipoReferenciaMQ, '' NumeroSerieCajaRegistradora, --FORMAT(AD.Fecha,'dd/MM/yyyy') FechaOperacion, '' FechaOperacion, '' TipoTasa, CAST(0 AS DECIMAL(14,2)) TasaDetraccionPercepcion, CAST(0 AS DECIMAL(14,2)) ImporteBaseDetraccionPercepcionDolares, CAST(0 AS DECIMAL(14,2)) ImporteBaseDetraccionPercepcionSoles, 'V' TipoCambioF, CAST(0 AS DECIMAL(14,2)) ImporteIGVSNCreditoFiscal FROM ERP.AsientoDetalle AD INNER JOIN ERP.Asiento A ON A.ID = AD.IdAsiento INNER JOIN ERP.Comprobante C ON C.IdAsiento = AD.IdAsiento LEFT JOIN ERP.Cliente CLI ON CLI.ID = C.IdCliente LEFT JOIN ERP.EntidadTipoDocumento ETD ON ETD.IdEntidad = CLI.IdEntidad --INNER JOIN PLE.T10TipoComprobante TC ON TC.ID = C.IdTipoComprobante INNER JOIN Maestro.DebeHaber DH ON DH.ID = AD.IdDebeHaber LEFT JOIN ERP.PlanCuenta PC ON PC.ID = AD.IdPlanCuenta WHERE AD.IdAsiento IN (SELECT DATA FROM [ERP].[Fn_SplitContenido](@IDS,',')) END
-- Problem 14 CREATE DATABASE CarRental USE CarRental CREATE TABLE Categories ( Id int IDENTITY PRIMARY KEY, CategoryName nvarchar(50) NOT NULL, DailyRate decimal(7,2) NOT NULL, WeeklyRate decimal(7,2) NOT NULL, MonthlyRate decimal(7,2) NOT NULL, WeekendRate decimal(7,2) NOT NULL ) CREATE TABLE Cars ( Id int IDENTITY PRIMARY KEY, PlateNumber varchar(10) NOT NULL, Manufacturer varchar(20) NOT NULL, Model varchar(20) NOT NULL, CarYear int NOT NULL, CategoryId int, Doors int, Picture varbinary(max), Condition nvarchar(max), Available bit NOT NULL ) CREATE TABLE Employees ( Id int IDENTITY PRIMARY KEY, FirstName nvarchar(20) NOT NULL, LastName nvarchar(20) NOT NULL, Title nvarchar(50), Notes nvarchar(max) ) CREATE TABLE Customers ( Id int IDENTITY PRIMARY KEY, DriverLicenceNumber int NOT NULL, FullName nvarchar(50) NOT NULL, Address nvarchar(50), City nvarchar(20), ZIPCode nvarchar(20), Notes nvarchar(max) ) CREATE TABLE RentalOrders ( Id int IDENTITY PRIMARY KEY, EmployeeId int FOREIGN KEY REFERENCES Employees(Id), CustomerId int FOREIGN KEY REFERENCES Customers(Id), CarId int FOREIGN KEY REFERENCES Cars(Id), TankLevel decimal (7,2) NOT NULL, KilometrageStart decimal (15,2) NOT NULL, KilometrageEnd decimal (15,2) NOT NULL, TotalKilometrage AS KilometrageEnd - KilometrageStart, StartDate date, EndDate date, TotalDays AS datediff(day, StartDate, EndDate), RateApplied decimal (7,2), TaxRate decimal (7,2), OrderStatus nvarchar(20), Notes nvarchar(max) ) INSERT INTO Categories (CategoryName, DailyRate, WeeklyRate, MonthlyRate, WeekendRate) VALUES ('Family Cars', 25.50, 140.20, 500.90, 50.60), ('Luxury Cars', 64.50, 430.50, 1520.40, 140.15), ('Sports Cars', 50.50, 350.20, 1050.60, 100.15) INSERT INTO Cars(PlateNumber, Manufacturer, Model, CarYear, CategoryId, Doors, Picture, Condition, Available) VALUES ('CB5673PA', 'Opel', 'Astra', 2006, 1, 4, 123, 'Very safety!', 0), ('CB7091CT', 'Maserati', 'Quattroporte', 2016, 2, 4, 456, 'Very expensive and luxury car!', 0), ('CB0079RH', 'Bugatti', 'Chiron', 2017, 3, 2, 789, 'Very fast!', 1) INSERT INTO Employees (FirstName, LastName, Title, Notes) VALUES ('Georgi', 'Petrov', 'Manager', 'Very strict!'), ('Ivan', 'Angelov', 'Salesman', 'Very polite!'), ('Maria', 'Ivanova', 'Salesman', 'Very kind!') INSERT INTO Customers(DriverLicenceNumber, FullName, Address, City, ZIPCode) VALUES ('37507178', 'Kristian Ivanov','Boyana, str.Boyanska', 'Sofia', '1518'), ('90158506', 'Ivan Penev','Beli brezi, str.Vorino', 'Sofia', '1680'), ('68017435', 'Iva Stoyanova','Mladost, str.Alexander Malinov', 'Sofia', '7856') INSERT INTO RentalOrders(EmployeeId, CustomerId, CarId, TankLevel, KilometrageStart, KilometrageEnd, StartDate, EndDate) VALUES (1, 1, 1, 34.8, 115067.49, 11879.80, '2017-07-20', '2017-07-27'), (2, 2, 2, 40.9, 11001.60, 11300.50, '2017-09-03', '2017-09-23'), (3, 3, 3, 45.6, 5070.87, 5600.78, '2017-03-08', '2016-03-15')
/* Formatted on 21/07/2014 18:33:43 (QP5 v5.227.12220.39754) */ CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRE0_APP_GEST_ADVISOR ( COD_ABI_CARTOLARIZZATO, COD_NDG, COD_SNDG, COD_MACROSTATO, ID_ADVISOR_CONSULENZA, ID_ADVISOR_GR_GESTIONE, ID_ADVISOR_GR_ISP, COD_ADVISOR, COD_STATO_RISCHIO, DTA_INS, DTA_UPD, FLG_DELETE, DTA_DELETE ) AS SELECT cod_abi_cartolarizzato, cod_ndg, cod_sndg, cod_macrostato, id_advisor_consulenza, id_advisor_gr_gestione, id_advisor_gr_isp, cod_advisor, cod_stato_rischio, dta_ins, dta_upd, flg_delete, dta_delete FROM T_MCRE0_APP_GEST_ADVISOR;
CREATE USER 'bafapp' IDENTIFIED BY 'bafapp'; GRANT SELECT ON bafapp.* TO 'bafapp'; GRANT INSERT ON bafapp.* TO 'bafapp'; GRANT UPDATE ON bafapp.* TO 'bafapp'; GRANT DELETE ON bafapp.* TO 'bafapp'; GRANT EXECUTE ON bafapp.* TO 'bafapp'; FLUSH PRIVILEGES;
select distinct subject_id, hadm_id, icustay_id from (select cv.subject_id, cv.hadm_id, cv.icustay_id from `MIMIC3_V1_4.INPUTEVENTS_CV` cv where cv.itemid in (select itemid from `NMB.NMBs` )-- item id for Cisatracurium from carevue and from metavision group by cv.subject_id, cv.hadm_id, cv.icustay_id) union distinct (select mv.subject_id, mv.hadm_id, mv.icustay_id from `MIMIC3_V1_4.INPUTEVENTS_MV` mv where mv.itemid in (select itemid from `NMB.NMBs` )-- item id for Cisatracurium from carevue and from metavision group by mv.subject_id, mv.hadm_id, mv.icustay_id) order by subject_id, hadm_id, icustay_id -- this adds up to 1398 icustays
DROP DATABASE IF EXISTS moviesDatabase; CREATE DATABASE moviesDatabase; USE moviesDatabase; CREATE TABLE movieTable ( id int(3) NOT NULL AUTO_INCREMENT, title varchar(20), watched BOOLEAN, PRIMARY KEY (id) ); -- 1 = true INSERT INTO movieTable (title, watched) VALUES ('One Piece', true); INSERT INTO movieTable (title, watched) VALUES ('Zoro', true); INSERT INTO movieTable (title, watched) VALUES ('Luffy', true); INSERT INTO movieTable (title, watched) VALUES ('Sanjin', true); -- select * from movieTable WHERE watched = true;
-- -- PostgreSQL database dump -- -- Dumped from database version 9.5.9 -- Dumped by pg_dump version 9.5.9 SET statement_timeout = 0; SET lock_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; SET row_security = off; -- -- TOC entry 1 (class 3079 OID 12395) -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; -- -- TOC entry 2193 (class 0 OID 0) -- Dependencies: 1 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; SET search_path = public, pg_catalog; SET default_tablespace = ''; SET default_with_oids = false; -- -- TOC entry 182 (class 1259 OID 33292) -- Name: tb_sensor; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE tb_sensor ( id bigint NOT NULL, create_time timestamp without time zone, description character varying(255), latitude double precision NOT NULL, longitude double precision NOT NULL, name character varying(255), sensor_source_id bigint NOT NULL ); ALTER TABLE tb_sensor OWNER TO postgres; -- -- TOC entry 183 (class 1259 OID 33301) -- Name: tb_sensor_has_sensor_measure_type; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE tb_sensor_has_sensor_measure_type ( sensor_id bigint NOT NULL, sensor_measure_type_id bigint NOT NULL ); ALTER TABLE tb_sensor_has_sensor_measure_type OWNER TO postgres; -- -- TOC entry 181 (class 1259 OID 33290) -- Name: tb_sensor_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE tb_sensor_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE tb_sensor_id_seq OWNER TO postgres; -- -- TOC entry 2194 (class 0 OID 0) -- Dependencies: 181 -- Name: tb_sensor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE tb_sensor_id_seq OWNED BY tb_sensor.id; -- -- TOC entry 185 (class 1259 OID 33308) -- Name: tb_sensor_measure; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE tb_sensor_measure ( id bigint NOT NULL, create_time timestamp without time zone, value character varying(255), sensor_id bigint NOT NULL, sensor_measure_type_id bigint NOT NULL ); ALTER TABLE tb_sensor_measure OWNER TO postgres; -- -- TOC entry 184 (class 1259 OID 33306) -- Name: tb_sensor_measure_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE tb_sensor_measure_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE tb_sensor_measure_id_seq OWNER TO postgres; -- -- TOC entry 2195 (class 0 OID 0) -- Dependencies: 184 -- Name: tb_sensor_measure_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE tb_sensor_measure_id_seq OWNED BY tb_sensor_measure.id; -- -- TOC entry 187 (class 1259 OID 33316) -- Name: tb_sensor_measure_type; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE tb_sensor_measure_type ( id bigint NOT NULL, create_time timestamp without time zone, name character varying(255), unit character varying(255) ); ALTER TABLE tb_sensor_measure_type OWNER TO postgres; -- -- TOC entry 186 (class 1259 OID 33314) -- Name: tb_sensor_measure_type_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE tb_sensor_measure_type_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE tb_sensor_measure_type_id_seq OWNER TO postgres; -- -- TOC entry 2196 (class 0 OID 0) -- Dependencies: 186 -- Name: tb_sensor_measure_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE tb_sensor_measure_type_id_seq OWNED BY tb_sensor_measure_type.id; -- -- TOC entry 189 (class 1259 OID 33327) -- Name: tb_sensor_source; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE tb_sensor_source ( id bigint NOT NULL, create_time timestamp without time zone, description character varying(255), name character varying(255) ); ALTER TABLE tb_sensor_source OWNER TO postgres; -- -- TOC entry 188 (class 1259 OID 33325) -- Name: tb_sensor_source_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE tb_sensor_source_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE tb_sensor_source_id_seq OWNER TO postgres; -- -- TOC entry 2197 (class 0 OID 0) -- Dependencies: 188 -- Name: tb_sensor_source_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE tb_sensor_source_id_seq OWNED BY tb_sensor_source.id; -- -- TOC entry 2044 (class 2604 OID 33295) -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor ALTER COLUMN id SET DEFAULT nextval('tb_sensor_id_seq'::regclass); -- -- TOC entry 2045 (class 2604 OID 33311) -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_measure ALTER COLUMN id SET DEFAULT nextval('tb_sensor_measure_id_seq'::regclass); -- -- TOC entry 2046 (class 2604 OID 33319) -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_measure_type ALTER COLUMN id SET DEFAULT nextval('tb_sensor_measure_type_id_seq'::regclass); -- -- TOC entry 2047 (class 2604 OID 33330) -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_source ALTER COLUMN id SET DEFAULT nextval('tb_sensor_source_id_seq'::regclass); -- -- TOC entry 2178 (class 0 OID 33292) -- Dependencies: 182 -- Data for Name: tb_sensor; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY tb_sensor (id, create_time, description, latitude, longitude, name, sensor_source_id) FROM stdin; \. -- -- TOC entry 2179 (class 0 OID 33301) -- Dependencies: 183 -- Data for Name: tb_sensor_has_sensor_measure_type; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY tb_sensor_has_sensor_measure_type (sensor_id, sensor_measure_type_id) FROM stdin; \. -- -- TOC entry 2198 (class 0 OID 0) -- Dependencies: 181 -- Name: tb_sensor_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('tb_sensor_id_seq', 1, false); -- -- TOC entry 2181 (class 0 OID 33308) -- Dependencies: 185 -- Data for Name: tb_sensor_measure; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY tb_sensor_measure (id, create_time, value, sensor_id, sensor_measure_type_id) FROM stdin; \. -- -- TOC entry 2199 (class 0 OID 0) -- Dependencies: 184 -- Name: tb_sensor_measure_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('tb_sensor_measure_id_seq', 1, false); -- -- TOC entry 2183 (class 0 OID 33316) -- Dependencies: 187 -- Data for Name: tb_sensor_measure_type; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY tb_sensor_measure_type (id, create_time, name, unit) FROM stdin; \. -- -- TOC entry 2200 (class 0 OID 0) -- Dependencies: 186 -- Name: tb_sensor_measure_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('tb_sensor_measure_type_id_seq', 1, false); -- -- TOC entry 2185 (class 0 OID 33327) -- Dependencies: 189 -- Data for Name: tb_sensor_source; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY tb_sensor_source (id, create_time, description, name) FROM stdin; \. -- -- TOC entry 2201 (class 0 OID 0) -- Dependencies: 188 -- Name: tb_sensor_source_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('tb_sensor_source_id_seq', 1, false); -- -- TOC entry 2051 (class 2606 OID 33305) -- Name: tb_sensor_has_sensor_measure_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_has_sensor_measure_type ADD CONSTRAINT tb_sensor_has_sensor_measure_type_pkey PRIMARY KEY (sensor_id, sensor_measure_type_id); -- -- TOC entry 2053 (class 2606 OID 33313) -- Name: tb_sensor_measure_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_measure ADD CONSTRAINT tb_sensor_measure_pkey PRIMARY KEY (id); -- -- TOC entry 2055 (class 2606 OID 33324) -- Name: tb_sensor_measure_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_measure_type ADD CONSTRAINT tb_sensor_measure_type_pkey PRIMARY KEY (id); -- -- TOC entry 2049 (class 2606 OID 33300) -- Name: tb_sensor_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor ADD CONSTRAINT tb_sensor_pkey PRIMARY KEY (id); -- -- TOC entry 2057 (class 2606 OID 33335) -- Name: tb_sensor_source_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_source ADD CONSTRAINT tb_sensor_source_pkey PRIMARY KEY (id); -- -- TOC entry 2060 (class 2606 OID 33346) -- Name: fk7kh7vycrh6wo1xopweg4tbu0f; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_has_sensor_measure_type ADD CONSTRAINT fk7kh7vycrh6wo1xopweg4tbu0f FOREIGN KEY (sensor_id) REFERENCES tb_sensor(id); -- -- TOC entry 2058 (class 2606 OID 33336) -- Name: fk8iacr1nconflem1qa5fy75dlu; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor ADD CONSTRAINT fk8iacr1nconflem1qa5fy75dlu FOREIGN KEY (sensor_source_id) REFERENCES tb_sensor_source(id); -- -- TOC entry 2059 (class 2606 OID 33341) -- Name: fko4b836kfoir93b40t56rs62q6; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_has_sensor_measure_type ADD CONSTRAINT fko4b836kfoir93b40t56rs62q6 FOREIGN KEY (sensor_measure_type_id) REFERENCES tb_sensor_measure_type(id); -- -- TOC entry 2062 (class 2606 OID 33356) -- Name: fktabdn3sejqud2dm2oym8olqiu; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_measure ADD CONSTRAINT fktabdn3sejqud2dm2oym8olqiu FOREIGN KEY (sensor_measure_type_id) REFERENCES tb_sensor_measure_type(id); -- -- TOC entry 2061 (class 2606 OID 33351) -- Name: fktbhtqf9ftmiueppjy6evacfm2; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY tb_sensor_measure ADD CONSTRAINT fktbhtqf9ftmiueppjy6evacfm2 FOREIGN KEY (sensor_id) REFERENCES tb_sensor(id); -- -- TOC entry 2192 (class 0 OID 0) -- Dependencies: 6 -- Name: public; Type: ACL; Schema: -; Owner: postgres -- REVOKE ALL ON SCHEMA public FROM PUBLIC; REVOKE ALL ON SCHEMA public FROM postgres; GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO PUBLIC; -- Completed on 2017-10-30 20:59:28 BRST -- -- PostgreSQL database dump complete --
select a.* from ( select t.date, case when t1.studies_created is not null then t1.studies_created else 0 end studies_created, case when t2.public is not null then t2.public else 0 end public_studies, case when t4.review is not null then t4.review else 0 end review_studies, case when t5.curation is not null then t5.curation else 0 end curation_studies, case when t6.user_1 is not null then t6.user_1 else 0 end users from (select date_1 as date from ( select date(submissiondate) date_1 from studies group by date(submissiondate) union select date(releasedate) date_1 from studies group by date(releasedate) union select date(updatedate) date_1 from studies group by date(updatedate) union select date(joindate) date_1 from users group by date(joindate) ) t1 group by date_1 order by date_1) t left join ( select date(submissiondate) date_1, count(*) studies_created from studies group by date(submissiondate)) t1 on t.date = t1.date_1 -- studies_created left join ( select date(releasedate) date_1, count(*) public from studies where status = 3 group by date(releasedate)) t2 on t.date = t2.date_1 -- public left join ( select date(updatedate) date_1, count(*) review from studies where status = 2 group by date(updatedate)) t4 on t.date = t4.date_1 -- review left join ( select date(updatedate) date_1, count(*) curation from studies where status = 1 group by date(updatedate)) t5 on t.date = t5.date_1 -- curation left join( select date(joindate) date_1, count(*) user_1 from users group by date(joindate)) t6 on t.date = t6.date_1 ) a -- user_1 where studies_created + public_studies + review_studies + curation_studies+ users > 0 order by date asc;
INSERT INTO `ViaPublica` VALUES (1),(2),(3),(4),(5); INSERT INTO `ViaPublica` VALUES (6),(7),(8),(9),(10); INSERT INTO `ViaPublica` VALUES (11),(12),(13),(14),(15); INSERT INTO `ViaPublica` VALUES (16),(17),(18),(19),(20); INSERT INTO `ViaPublica` VALUES (21),(22),(23),(24),(25); INSERT INTO `ViaPublica` VALUES (26),(27),(28),(29),(30); INSERT INTO `ViaPublica` VALUES (31),(32),(33),(34),(35); INSERT INTO `ViaPublica` VALUES (36),(37),(38),(39),(40); INSERT INTO `ViaPublica` VALUES (41),(42),(43),(44),(45); INSERT INTO `ViaPublica` VALUES (46),(47),(48),(49),(50); INSERT INTO `ViaPublica` VALUES (51),(52),(53),(54),(55); INSERT INTO `ViaPublica` VALUES (56),(57),(58),(59),(60); INSERT INTO `ViaPublica` VALUES (61),(62),(63),(64),(65); INSERT INTO `ViaPublica` VALUES (66),(67),(68),(69),(70); INSERT INTO `ViaPublica` VALUES (71),(72),(73),(74),(75); INSERT INTO `ViaPublica` VALUES (76),(77),(78),(79),(80); INSERT INTO `ViaPublica` VALUES (81),(82),(83),(84),(85); INSERT INTO `ViaPublica` VALUES (86),(87),(88),(89),(90); INSERT INTO `ViaPublica` VALUES (91),(92),(93),(94),(95); INSERT INTO `ViaPublica` VALUES (96),(97),(98),(99),(100);
DROP DATABASE IF EXISTS `films_db`; CREATE DATABASE `films_db`; USE `films_db`; CREATE TABLE `movies` ( `id` INTEGER(11) AUTO_INCREMENT, `title` VARCHAR(255) NOT NULL, `rating` INTEGER(11) NOT NULL, PRIMARY KEY(`id`) );
/*Create a new SQL script named 3.5.3_limit_exercises.sql. MySQL provides a way to return only unique results from our queries with the keyword DISTINCT. For example, to find all the unique titles within the company, we could run the following query: SELECT DISTINCT title FROM titles; List the first 10 distinct last name sorted in descending order. select distinct last_name from employees order by last_name desc limit 10; Find your query for employees born on Christmas and hired in the 90s from order_by_exercises.sql. Update it to find just the first 5 employees. select first_name, last_name from employees where (hire_date between '1990-01-01' and '1999-12-31') and birth_date like '%12-25'order by birth_date, hire_date desc limit 5; Try to think of your results as batches, sets, or pages. The first five results are your first page. The five after that would be your second page, etc. Update the query to find the tenth page of results. select first_name, last_name from employees where (hire_date between '1990-01-01' and '1999-12-31') and birth_date like '%12-25'order by birth_date, hire_date desc limit 5 offset 45; LIMIT and OFFSET can be used to create multiple pages of data. What is the relationship between OFFSET (number of results to skip), LIMIT (number of results per page), and the page number? If limit determines the number of results per page and offset determines the number of results to skip, the page number is offset/limit plus one. */
--// materialinitem.sql --// create table 'materialinitem' drop table MaterialInItem; create table MaterialInItem( No int NOT NULL, MNo1 int, MNo2 int, MNo3 int, MNo4 int, MNo5 int, MNo6 int, MNo7 int, MNo8 int, MNo9 int, MNo10 int, primary key(No));
create table Province( ProvID int primary key, ProvName varchar(50), Sort int, Memo varchar(50) ) create table City( CityID int primary key, CityName varchar(200) not null, ProvID int not null, Sort int ) create table Region( RegionID int primary key, RegionName varchar(200) not null, CityID int not null, Sort int ) insert into Province select PRV_ID,PRV_LOCALNAME,PRV_ORDER_NUM,PRV_MEMO from NET_ABS_CN.dbo.RPROVINCE insert into City select CTY_ID,CTY_LOCALNAME,CTY_PRV_ID,CTY_ORDER_NUM from NET_ABS_CN.dbo.RCITY insert into Region select REG_ID,REG_LOCALNAME,REG_CTY_ID,REG_ORDER_NUM from NET_ABS_CN.dbo.RREGION
/*Créez la procédure stockée Lst_Suppliers correspondant à la requête afficher le nom des fournisseurs pour lesquels une commande a été passée.*/ DELIMITER $$ CREATE DEFINER=`mhirihoueida`@`localhost` PROCEDURE `Lst_Suppliers`() NO SQL SELECT sup_name FROM suppliers,products WHERE products.pro_sup_id= suppliers.sup_id$$ DELIMITER ; /*Exécutez la commande SQL suivante pour obtenir des informations sur cette procédure stockée : SHOW CREATE PROCEDURE Lst_suppliers; */ Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation Lst_Suppliers ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_... CREATE DEFINER=`mhirihoueida`@`localhost` PROCEDUR... utf8mb4 utf8mb4_unicode_ci utf8mb4_0900_ai_ci
update harmony.tuser us set user_type_id = 2 where exists ( select id from harmony.tssc ssc where ssc.legal_entity = us.legal_entity and ssc.mrc = us.mrc ); update harmony.tuser us set SHARED_SERVICE_CENTER_ID = ( select id from harmony.tssc ssc where ssc.legal_entity = us.legal_entity and ssc.mrc = us.mrc ) where us.user_type_id = 2; commit;
CREATE TABLE CAR(ID BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,NAME VARCHAR(255),TYPE_ID BIGINT,COLOR VARCHAR(255),PRICE DECIMAL(18, 2),AMOUNT INT); CREATE TABLE CAR_TYPE (ID BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,NAME VARCHAR(255) NOT NULL); ALTER TABLE CAR ADD CONSTRAINT CAR_FK FOREIGN KEY (TYPE_ID) REFERENCES CAR_TYPE(ID); INSERT INTO CAR_TYPE (ID, NAME) VALUES(1, 'SEDAN'); INSERT INTO CAR_TYPE (ID, NAME) VALUES(2, 'COUPE'); INSERT INTO CAR_TYPE (ID, NAME) VALUES(3, 'HATCHBACK'); INSERT INTO CAR_TYPE (ID, NAME) VALUES(4, 'OTHER'); INSERT INTO CAR_TYPE (ID, NAME) VALUES(5, 'TRUCK'); INSERT INTO CAR_TYPE (ID, NAME) VALUES(6, 'TANK'); INSERT INTO CAR_TYPE (ID, NAME) VALUES(7, 'SPORTS CAR'); INSERT INTO CAR (ID, NAME, COLOR, PRICE, AMOUNT, TYPE_ID) VALUES(1, 'Lightning McQueen', 'RED', 1.00, 1, 7); INSERT INTO CAR (ID, NAME, COLOR, PRICE, AMOUNT, TYPE_ID) VALUES(2, 'Optimus Prime', 'RED+BLUE', 2.00, 0, 5); INSERT INTO CAR (ID, NAME, COLOR, PRICE, AMOUNT, TYPE_ID) VALUES(4, 'The Flintstones Flintmobile', '?', 4.0, 3, 4); INSERT INTO CAR (ID, NAME, COLOR, PRICE, AMOUNT, TYPE_ID) VALUES(3, 'The Batmobile', 'BLACK', 3.00, 2, 6);
exec sp_rename 'Table', 'UserData'
------------------------------------------------------------------------------ -- TEMPORARY WORKING directory objects -- -- NOTE: -- %..% variables are substituted with the correct values during installation. -- Refer to the install script for details on these installation variables. -- Directory objects belong to SYS, regardless of which user creates them. -- ------------------------------------------------------------------------------ set serveroutput on size 1000000 set verify off set feedback off set scan off whenever SQLERROR exit failure whenever OSERROR exit failure prompt VCRTMP Directory object for %TARGET_HOME%/tmp path host [[ ! -d %TARGET_HOME%/tmp ]] && mkdir -p %TARGET_HOME%/tmp host [[ ! -d %TARGET_HOME%/tmp ]] && echo "* Could not create directory %TARGET_HOME%/tmp." host [[ -d %TARGET_HOME%/tmp ]] && chmod 775 %TARGET_HOME%/tmp create or replace directory TMP as '%TARGET_HOME%/tmp'; grant read on directory TMP to utl; grant write on directory TMP to utl; grant read on directory TMP to public; grant write on directory TMP to public; ------------------------------------------------------------------------------ -- end of file ------------------------------------------------------------------------------
-- phpMyAdmin SQL Dump -- version 4.0.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Dec 04, 2015 at 02:11 PM -- Server version: 5.6.12-log -- PHP Version: 5.4.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: `classicfc` -- CREATE DATABASE IF NOT EXISTS `classicfc` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `classicfc`; -- -------------------------------------------------------- -- -- Table structure for table `players` -- CREATE TABLE IF NOT EXISTS `players` ( `Jersey_No` int(10) NOT NULL, `First_Name` varchar(20) NOT NULL, `Other_Name` varchar(20) NOT NULL, `Position` varchar(20) NOT NULL, `Nationality` varchar(20) NOT NULL, `Age` int(20) NOT NULL, `Contract` date DEFAULT NULL, PRIMARY KEY (`Jersey_No`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `players` -- INSERT INTO `players` (`Jersey_No`, `First_Name`, `Other_Name`, `Position`, `Nationality`, `Age`, `Contract`) VALUES (1, 'David', 'Degea', 'Goal Keeper', 'Spanish', 26, '2019-01-06'), (2, 'Marcelo', 'Diaz', 'Left Back', 'Brazilian', 26, '2018-08-11'), (3, 'Ryan', 'Betrand', 'Left Back', 'England', 22, '2017-12-01'), (4, 'Sergio', 'Ramos', 'Center Back', 'Spanish', 29, '2018-01-07'), (5, 'John', 'Terry', 'Center Back', 'England', 32, '2016-07-01'), (6, 'Paul', 'Pogba', 'Holding Midfielder', 'French', 21, '2020-12-01'), (7, 'Luis', 'Suarez', 'Striker', 'Uruguay', 27, '2019-06-01'), (8, 'Andres', 'Iniesta', 'Midfielder', 'Spanish', 32, '2020-11-14'), (9, 'Karim', 'benzema', 'Striker', 'French', 28, '2020-01-11'), (10, 'Eden', 'Hazard', 'Winger', 'Belgian', 25, '2020-01-08'), (11, 'Arjen', 'Robben', 'Winger', 'Holland', 32, '2017-01-06'), (12, 'Victor', 'Wanyama', 'Midfielder', 'Kenya', 25, '2016-07-01'), (13, 'jimmy', 'vady', 'Striker', 'England', 24, '2018-12-01'), (14, 'Xabi', 'Alonso', 'Midfielder', 'Spanish', 30, '2016-06-01'), (15, 'Eng Michael', 'Olunga', 'Striker', 'Kenyan', 24, '2017-06-01'), (16, 'John', 'Stones', 'Defender', 'England', 24, '2020-12-01'), (17, 'Arjen', 'Robben', 'Winger', 'Dutch', 30, '2016-07-01'), (18, 'Victor', 'Moses', 'Winger', 'Nigerian', 28, '2017-12-16'), (19, 'Diego', 'Costa', 'Striker', 'Spanish', 27, '2017-12-01'), (20, 'Romelu', 'Lukaku', 'Striker', 'Belgian', 24, '2019-06-01'), (21, 'Romelu', 'Lukaku', 'Striker', 'Belgian', 24, '2019-06-01'), (30, 'juan', 'mata', 'midfielder', 'spanish', 28, '2018-12-01'); /*!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 */;
IF NOT EXISTS(SELECT * FROM sys.tables where [name] = 'RecommendedPrices') BEGIN CREATE TABLE [prod].[RecommendedPrices]( [Balance] [money] NOT NULL, [MinPrice] [money] NOT NULL, [MaxPrice] [money] NOT NULL ) ON [PRIMARY] ALTER TABLE [prod].[RecommendedPrices] ADD CONSTRAINT [DF_RecommendedPrices_Balance] DEFAULT ((0)) FOR [Balance] ALTER TABLE [prod].[RecommendedPrices] ADD CONSTRAINT [DF_RecommendedPrices_MinPrice] DEFAULT ((0)) FOR [MinPrice] ALTER TABLE [prod].[RecommendedPrices] ADD CONSTRAINT [DF_RecommendedPrices_MaxPrice] DEFAULT ((0)) FOR [MaxPrice] END
 -- Temp Organisation DO $$ Declare DoTemplateID uuid; Declare DoVersionNumber integer; Declare OrganisationTypeID integer; Begin -- declare variables OrganisationTypeID := (select "OrganisationTypeID" from "OrganisationType" where "Name" = 'Supplier' limit 1); INSERT INTO public."DefaultOrganisationTemplate" ( "DefaultOrganisationTemplateVersionNumber", "Name", "Description", "IsActive", "IsDeleted", "OrganisationTypeID" ) VALUES ( 1, 'Supplier', 'Template for a Supplier Organisation', true, false, OrganisationTypeID ); DoTemplateID:= (select dot."DefaultOrganisationTemplateID" from "DefaultOrganisationTemplate" dot where dot."Name" = 'Supplier' limit 1); DoVersionNumber = 1; -- add 2 ledger accounts INSERT INTO public."DefaultOrganisationLedgerTemplate" ( "DefaultOrganisationTemplateID", "DefaultOrganisationTemplateVersionNumber", "LedgerAccountTypeID", "LedgerAccountName", "HandlesCredit", "HandlesDebit", "IsActive", "IsDeleted" ) VALUES ( DoTemplateID, DoVersionNumber, (select "ClassificationTypeID" from "ClassificationType" where "Name" = 'Sales' and "ClassificationTypeCategoryID" = 8500 limit 1), 'Sales', true, false, true, false ); INSERT INTO public."DefaultOrganisationLedgerTemplate" ( "DefaultOrganisationTemplateID", "DefaultOrganisationTemplateVersionNumber", "LedgerAccountTypeID", "LedgerAccountName", "HandlesCredit", "HandlesDebit", "IsActive", "IsDeleted" ) VALUES ( DoTemplateID, DoVersionNumber, (select "ClassificationTypeID" from "ClassificationType" where "Name" = 'Purchasing' and "ClassificationTypeCategoryID" = 8500 limit 1), 'Purchasing', false, true, true, false ); -- promote supplier DO perform "fn_PromoteDefaultOrganisationTemplate"(DoTemplateID, DoVersionNumber); END $$;
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 07 Jul 2019 pada 16.50 -- Versi server: 10.1.38-MariaDB -- Versi PHP: 7.3.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: `db_test` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `event` -- CREATE TABLE `event` ( `event_id` int(11) NOT NULL, `event_title` varchar(255) NOT NULL, `event_date` date NOT NULL, `event_speaker` varchar(255) NOT NULL, `event_location` varchar(255) NOT NULL, `event_description` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `event` -- INSERT INTO `event` (`event_id`, `event_title`, `event_date`, `event_speaker`, `event_location`, `event_description`) VALUES (1, 'Code Code Code', '2019-07-03', 'Unknown', 'Bandung', 'Belajar Ngoding'), (2, 'Event 2', '2019-07-05', 'Unknown 2', 'Bandung 2', 'Belajar Ngoding 2'); -- -------------------------------------------------------- -- -- Struktur dari tabel `news` -- CREATE TABLE `news` ( `news_id` int(11) NOT NULL, `news_title` varchar(255) NOT NULL, `news_sumber` varchar(255) NOT NULL, `news_date` date NOT NULL, `news_description` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `news` -- INSERT INTO `news` (`news_id`, `news_title`, `news_sumber`, `news_date`, `news_description`) VALUES (1, 'Berita 1', 'ErCeTeI', '2019-07-01', 'Berita pertama yang dikeluarkan'), (2, 'berita 2', 'EsCeTeVe', '2019-07-04', 'berita kedua yang dikeluarkan'), (3, 'berita 3', 'Tivi Wan', '2019-07-24', 'berita terbaru yang merupakan berita ketiga yang dikeluarkan'); -- -------------------------------------------------------- -- -- Struktur dari tabel `user` -- CREATE TABLE `user` ( `user_id` int(255) NOT NULL, `user_name` varchar(16) NOT NULL, `user_pass` varchar(255) NOT NULL, `user_status` varchar(12) NOT NULL, `user_role` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `user` -- INSERT INTO `user` (`user_id`, `user_name`, `user_pass`, `user_status`, `user_role`) VALUES (1, 'admin', '200ceb26807d6bf99fd6f4f0d1ca54d4', 'Active', 'Admin'), (2, 'news', '58d0020d599ca59d6bf258baf60600ab', 'Active', 'UserNews'), (3, 'event', 'aa42d74405036c9f7a8f696818a66214', 'Active', 'UserEvent'), (5, 'asdf', 'a8f5f167f44f4964e6c998dee827110c', 'Active', 'UserNews'); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `event` -- ALTER TABLE `event` ADD PRIMARY KEY (`event_id`); -- -- Indeks untuk tabel `news` -- ALTER TABLE `news` ADD PRIMARY KEY (`news_id`); -- -- Indeks untuk tabel `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`user_id`); -- -- AUTO_INCREMENT untuk tabel yang dibuang -- -- -- AUTO_INCREMENT untuk tabel `event` -- ALTER TABLE `event` MODIFY `event_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT untuk tabel `news` -- ALTER TABLE `news` MODIFY `news_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT untuk tabel `user` -- ALTER TABLE `user` MODIFY `user_id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump -- version 4.8.4 -- https://www.phpmyadmin.net/ -- -- Máy chủ: 127.0.0.1 -- Thời gian đã tạo: Th4 07, 2019 lúc 07:32 PM -- Phiên bản máy phục vụ: 10.1.37-MariaDB -- Phiên bản PHP: 5.6.40 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Cơ sở dữ liệu: `diemdanhsinhvien` -- -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `cahoc` -- CREATE TABLE `cahoc` ( `ma_ca_hoc` bigint(20) NOT NULL, `buoi_hoc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `gio_bat_dau` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `gio_ket_thuc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ma_mon_hoc` bigint(20) DEFAULT NULL, `ma_phong_hoc` bigint(20) DEFAULT NULL, `thu` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -- Đang đổ dữ liệu cho bảng `cahoc` -- INSERT INTO `cahoc` (`ma_ca_hoc`, `buoi_hoc`, `gio_bat_dau`, `gio_ket_thuc`, `ma_mon_hoc`, `ma_phong_hoc`, `thu`) VALUES (1, 'Sáng', '7h00', '9h30', 4203000959, 1, '2'); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `chitietdiemdanh` -- CREATE TABLE `chitietdiemdanh` ( `ma_diem_danh` bigint(20) NOT NULL, `buoi_hoc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `gio_bat_dau` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `gio_ket_thuc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ly_do_nghi` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ten_giao_vien` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ten_mon_hoc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `thu` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `diemdanh` -- CREATE TABLE `diemdanh` ( `ma_diem_danh` bigint(20) NOT NULL, `ma_sinh_vien` bigint(20) DEFAULT NULL, `ngay_diem_danh` datetime DEFAULT NULL, `so_tiet_di_hoc` int(11) DEFAULT NULL, `so_tiet_vang` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `giaovien` -- CREATE TABLE `giaovien` ( `ma_giao_vien` bigint(20) NOT NULL, `chuc_vu` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `gioi_tinh` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `hinh_giao_vien` tinyblob, `mat_khau` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ngay_sinh` date DEFAULT NULL, `ten_giao_vien` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ten_khoa` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `trinh_do` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `hibernate_sequence` -- CREATE TABLE `hibernate_sequence` ( `next_val` bigint(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -- Đang đổ dữ liệu cho bảng `hibernate_sequence` -- INSERT INTO `hibernate_sequence` (`next_val`) VALUES (1), (1), (1), (1), (1), (1); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `lich_day` -- CREATE TABLE `lich_day` ( `ma_mon_hoc` bigint(20) NOT NULL, `buoi_hoc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `chi_so` int(11) NOT NULL, `gio_bat_dau` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `gio_ket_thuc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `hoc_ky` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ma_nguoi_dung` bigint(20) NOT NULL, `nam_hoc` int(11) NOT NULL, `ngay_bat_dau` date DEFAULT NULL, `ngay_ket_thuc` date DEFAULT NULL, `so_cho_ngoi` int(11) NOT NULL, `so_tiet_ly_thuyet` int(11) NOT NULL, `so_tiet_thuc_hanh` int(11) NOT NULL, `ten_mon_hoc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ten_phong_hoc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `thu` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `tong_so_tiet` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `monhoc` -- CREATE TABLE `monhoc` ( `ma_mon_hoc` bigint(20) NOT NULL, `chi_so` int(11) DEFAULT NULL, `hoc_ky` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ma_giao_vien` bigint(20) DEFAULT NULL, `nam_hoc` int(11) DEFAULT NULL, `ngay_bat_dau` date DEFAULT NULL, `ngay_ket_thuc` date DEFAULT NULL, `so_tiet_ly_thuyet` int(11) DEFAULT NULL, `so_tiet_thuc_hanh` int(11) DEFAULT NULL, `ten_mon_hoc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `tong_so_tiet` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -- Đang đổ dữ liệu cho bảng `monhoc` -- INSERT INTO `monhoc` (`ma_mon_hoc`, `chi_so`, `hoc_ky`, `ma_giao_vien`, `nam_hoc`, `ngay_bat_dau`, `ngay_ket_thuc`, `so_tiet_ly_thuyet`, `so_tiet_thuc_hanh`, `ten_mon_hoc`, `tong_so_tiet`) VALUES (4203000959, 3, '1', 10039791, 2018, '2019-08-01', '2019-11-04', 30, 30, 'Triển khai an ninh hệ thống', 60); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `nguoidung` -- CREATE TABLE `nguoidung` ( `ma` bigint(20) NOT NULL, `chuc_vu` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `gioi_tinh` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `mat_khau` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ngay_sinh` date DEFAULT NULL, `ten` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ten_khoa` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ten_lop` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `trinh_do` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `hinh` tinyblob, `status` bit(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `phonghoc` -- CREATE TABLE `phonghoc` ( `ma_phong_hoc` bigint(20) NOT NULL, `so_cho_ngoi` int(11) DEFAULT NULL, `ten_phong_hoc` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -- Đang đổ dữ liệu cho bảng `phonghoc` -- INSERT INTO `phonghoc` (`ma_phong_hoc`, `so_cho_ngoi`, `ten_phong_hoc`) VALUES (1, 70, 'A1-01'); -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `sinhvien` -- CREATE TABLE `sinhvien` ( `ma_sinh_vien` bigint(20) NOT NULL, `gioi_tinh` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `hinh_sinh_vien` tinyblob, `mat_khau` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ngay_sinh` date DEFAULT NULL, `ten_lop` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL, `ten_sinh_vien` varchar(255) COLLATE utf8_german2_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; -- -- Đang đổ dữ liệu cho bảng `sinhvien` -- INSERT INTO `sinhvien` (`ma_sinh_vien`, `gioi_tinh`, `hinh_sinh_vien`, `mat_khau`, `ngay_sinh`, `ten_lop`, `ten_sinh_vien`) VALUES (15094631, 'Nam', NULL, '12345', '1997-01-05', 'DHCNTT11A', 'Nguyễn Minh Thiên'); -- -- Chỉ mục cho các bảng đã đổ -- -- -- Chỉ mục cho bảng `cahoc` -- ALTER TABLE `cahoc` ADD PRIMARY KEY (`ma_ca_hoc`); -- -- Chỉ mục cho bảng `chitietdiemdanh` -- ALTER TABLE `chitietdiemdanh` ADD PRIMARY KEY (`ma_diem_danh`); -- -- Chỉ mục cho bảng `diemdanh` -- ALTER TABLE `diemdanh` ADD PRIMARY KEY (`ma_diem_danh`); -- -- Chỉ mục cho bảng `giaovien` -- ALTER TABLE `giaovien` ADD PRIMARY KEY (`ma_giao_vien`); -- -- Chỉ mục cho bảng `lich_day` -- ALTER TABLE `lich_day` ADD PRIMARY KEY (`ma_mon_hoc`); -- -- Chỉ mục cho bảng `monhoc` -- ALTER TABLE `monhoc` ADD PRIMARY KEY (`ma_mon_hoc`); -- -- Chỉ mục cho bảng `nguoidung` -- ALTER TABLE `nguoidung` ADD PRIMARY KEY (`ma`); -- -- Chỉ mục cho bảng `phonghoc` -- ALTER TABLE `phonghoc` ADD PRIMARY KEY (`ma_phong_hoc`); -- -- Chỉ mục cho bảng `sinhvien` -- ALTER TABLE `sinhvien` ADD PRIMARY KEY (`ma_sinh_vien`); 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 */;
insert into matiere(matiere_id, nom_matiere) values(1,'Probabilité appliquées'); insert into matiere values(2,'circuits Numériques'); insert into matiere values(3,'Math de L"ingénieur'); insert into matiere values(4,'Algorithmique et Strucuture de Données etProgrammation C'); insert into matiere values(5,'Economie et Gestion d"Entreprise'); insert into matiere values(6,'Electronique Analogique'); insert into matiere values(7,'Francais'); insert into matiere values(8,'Anglais 1'); insert into matiere values(9,'Algo de l"analyse Numerique'); insert into matiere values(10,'Logique Formelle'); insert into matiere values(11,'Probabilité appliquée'); insert into matiere values(12,'Communication'); insert into matiere values(13,'Analyse et Conception OO'); insert into matiere values(14,'Reseaux Locaux'); insert into matiere values(15,'Methodologie et Conception de Processeur'); insert into matiere values(16,'Genie Logiciel I'); insert into matiere values(17,'Conception de bases de données'); insert into matiere values(18,'Systeme de"Exploitation et programmation Concurrente'); insert into matiere values(19,'Conception et analyse d"algorithmes'); insert into matiere values(20,'PPES et Methodes Statistiques'); insert into matiere values(21,'Anglais 2'); insert into matiere values(22,'Conception et Validation des STR'); insert into matiere values(23,'Securité Informatique'); insert into matiere values(24,'Systeme a base de Microcontroleurs'); insert into matiere values(25,'Developement Linux Prog Embarquées'); insert into matiere values(26,'Architecture .Av et Prog N'); insert into matiere values(27,'Codesign'); insert into matiere values(28,'Robotique et Soft computing'); insert into matiere values(29,'Integration des systemes'); insert into matiere values(30,'Intelligence Artificielle'); insert into matiere values(31,'Electronique pour l"Embarqué'); insert into matiere values(32,'Réseaux De Capteurs'); insert into matiere values(33,'Reseaux de Données Avancés'); insert into matiere values(34,'Algorithmique Répartie'); insert into matiere values(35,'Bases de Données Reparties'); insert into matiere values(36,'Architecture .Av et rpog N'); insert into matiere values(37,'Constru d app repartis'); insert into matiere values(38,'Reseaux sans fil et Cellulaire'); insert into matiere values(39,'Simu à Evenements Discrets'); insert into matiere values(40,'Sys.Int D"aide à la Decision'); insert into matiere values(41,'RE-ING Logicielle '); insert into matiere values(42,'Frameworks Devpt Web',); insert into matiere values(43,'Datamining'); insert into matiere values(44,'Ingenierie O Services'); insert into matiere values(45,'Management qualifié Metrique Log'); insert into matiere values(46,'Big data'); insert into matiere values(47,'Ingenierie Dirigée'); insert into matiere values(48,'Opt Combi: Methodes Approchées'); insert into matiere values(49,'Logique non classique'); insert into matiere values(50,'Systemes Mutli-Agents'); insert into matiere values(51,'Info-Repartie'); insert into matiere values(52,'Raisonnement'); insert into matiere values(53,'Soft Computing/Aide Decision'); insert into matiere values(54,'Apprentissage'); insert into matiere values(55,'Marches Financiers'); insert into matiere values(56,'Finance Int et Gestion de Porte'); insert into matiere values(57,'Decision Financiere'); insert into matiere values(58,'Sys et App Reparties'); insert into matiere values(59,'Model du risque et gestion dyn'); insert into matiere values(60,'Analyse de Données'); insert into matiere values(61,'Gestion bancaire'); insert into matiere values(62,'Rep.3D CourbeFormes.surfaces'); insert into matiere values(63,'Rep.Discretes des Objets 3D'); insert into matiere values(64,'Reconnaissance de Forme Stat'); insert into matiere values(65,'Traitement et analyse Des images'); insert into matiere values(66,'Atelier T.A.I'); insert into matiere values(67,'Analyse Geo des Formes'); insert into matiere values(68,'Methodes Num Pour Images'); insert into matiere values(69,'Contours Actifs');
select id, kyu, languages, description, starter_code, name, examples, tags, creator from katas WHERE kyu >= $1 AND kyu <= $2;
-- restringindo e ordenando dados -- -- objetivo recuperar e limitar linha recuperadas por uma consulta -- utilizando filtro simples. SELECT * FROM aluno WHERE id >= 10 AND id <= 50; -- utilizando uma função que representa o mesmo resultado. SELECT * FROM aluno WHERE id BETWEEN 10 AND 50; -- caso no projeto anterior, a opção tenha sido acrescentar uma nova coluna -- o comando será: ALTER TABLE item ADD id INTEGER NOT NULL; -- realizando outras consultas com filtro: SELECT * FROM curso WHERE valor <= 50; -- consulta ordenando por nome de curso, valor e carga horária SELECT * FROM curso WHERE valor <= 50 ORDER BY nome; SELECT * FROM curso WHERE valor <= 50 ORDER BY valor; SELECT * FROM curso WHERE valor <= 50 ORDER BY carga_horaria; SELECT * FROM curso WHERE valor <= 50 ORDER BY nome, valor, carga_horaria; SELECT * FROM curso WHERE valor <= 50 AND carga_horaria = 120 ORDER BY nome; -- filtrando com datas SELECT TRUNC(data_inicio) FROM contrato WHERE TRUNC(data_inicio) >= '01-01-2019'; -- a função TRUNC abrevia a exibição de datas ignorando as horas. -- pesquisa entre datas SELECT * FROM contrato WHERE data_inicio BETWEEN '01-05-2018' AND '31-05-2018'; DESC contrato; -- utilizando o operador IN para verificar se existem itens para um grupo de -- alunos SELECT * FROM contrato WHERE aluno_id IN (100, 203, 404) ORDER BY aluno_id; SELECT * FROM contrato WHERE aluno_id = 100 OR aluno_id = 203 OR aluno_id = 404 ORDER BY aluno_id; -- consultando se existe algum curso que não foi vendido SELECT * FROM item; SELECT id FROM curso WHERE id NOT IN (SELECT curso_id FROM item); -- consultando cursos onde tem engenharia no nome SELECT * FROM curso WHERE nome LIKE UPPER('%engenharia%') ORDER BY nome; -- ordem de precedência de operadores -- () -- AND -- OR -- -- utilizando parenteses para explicitar a ordem de precendência SELECT * FROM curso WHERE (valor >= 50 OR valor <= 70) AND carga_horaria = 120 ORDER BY curso.valor; -- a consulta acima é equivalente a SELECT * FROM (SELECT * FROM curso WHERE (valor >= 50 OR valor <= 70)) A WHERE carga_horaria = 120; -- sem utilizar parênteses SELECT * FROM curso WHERE valor >= 50 OR valor <= 100 AND carga_horaria = 120; -- a consulta acima é equivalente a SELECT * FROM curso WHERE valor >= 50 UNION SELECT * FROM curso WHERE carga_horaria = 120 AND valor <= 100;
drop database hospital; create database hospital; use hospital; create table doctors ( `doctor_id` int not null, `doctor_type` varchar(10) not null, `doctor_name` varchar(20) not null, `salary` int not null, CONSTRAINT `PK_doctor_id` PRIMARY KEY (`doctor_id`) ); create table patients( `patient_id` int not null, `patient_name` varchar(20), CONSTRAINT `PK_patient_id` PRIMARY KEY (`patient_id`) ); create table appointment ( `appointment_id` int not null auto_increment, `patient_id` int not null, `doctor_id` int not null, `appointment_time` datetime, CONSTRAINT `PK_appointment_id` PRIMARY KEY (`appointment_id`) ); create table queue ( `appointment_id` int not null, `actual_time` datetime, CONSTRAINT `PK_actual_time` PRIMARY KEY (`appointment_id`, `actual_time`) ); create table queue_summary ( `date` datetime, `doctor_id` int, `num_of_patients` int, CONSTRAINT `PK_date_doctor_id` PRIMARY KEY (`date`, `doctor_id`) ); # ---------------------------------------------------------------------- # # TRIGGER: After insert new appointment update queue # # ---------------------------------------------------------------------- # DELIMITER $$ CREATE TRIGGER queue_after_new_appointment AFTER INSERT ON appointment FOR EACH ROW BEGIN insert into queue values (new.appointment_id, new.appointment_time); END$$ DELIMITER ; # ---------------------------------------------------------------------- # # TRIGGER: After delete appointment from queue update queue summary # # ---------------------------------------------------------------------- # DELIMITER $$ CREATE TRIGGER queue_summary_after_delete_from_queue AFTER DELETE ON queue FOR EACH ROW BEGIN declare removed_doctor int; declare removed_date datetime; declare count_of_patients int; select doctor_id into removed_doctor from appointment as a left join queue as q on a.appointment_id = q.appointment_id where actual_time is null limit 1; select date(appointment_time) into removed_date from appointment as a left join queue as q on a.appointment_id = q.appointment_id where actual_time is null limit 1; select num_of_patients into count_of_patients from queue_summary where (doctor_id = removed_doctor and date(`date`) = removed_date) limit 1; if ( count_of_patients = 1) then delete from queue_summary where doctor_id = removed_doctor and date(`date`) = removed_date; elseif ( count_of_patients > 1) then update queue_summary set num_of_patients = num_of_patients - 1 where doctor_id = removed_doctor and date(`date`) = removed_date; end if; set removed_doctor = null; set removed_date = null; set count_of_patients = null; END$$ DELIMITER ; # ---------------------------------------------------------------------- # # TRIGGER: After insert appointment to queue update queue summary # # ---------------------------------------------------------------------- # DELIMITER $$ CREATE TRIGGER queue_summary_after_insert_to_queue AFTER INSERT ON queue FOR EACH ROW BEGIN declare d_id int; declare new_date date; select a.doctor_id into d_id from appointment as a inner join doctors as d on a.doctor_id = d.doctor_id order by a.appointment_id desc limit 1; select date(new.actual_time) into new_date from queue limit 1; if (d_id in (select doctor_id from queue_summary as q where q.date = new_date)) then update queue_summary set num_of_patients = num_of_patients + 1 where (doctor_id = d_id and `date` = new_date); else insert into queue_summary values (date(new_date), d_id, 1); end if; set d_id = null; set new_date = null; END$$ DELIMITER ; # ---------------------------------------------------------------------- # # PROCEDURE: Update to actual time, uses from java # # ---------------------------------------------------------------------- # DELIMITER $$ CREATE PROCEDURE `update_appointment_time`(in d_id int, in p_id int) BEGIN update queue set actual_time = NOW() where appointment_id = ( select appointment_id from appointment as a where ( (a.doctor_id = d_id) and (a.patient_id = p_id) ) ); END $$ DELIMITER ; # ---------------------------------------------------------------------- # # VIEW: View table # # ---------------------------------------------------------------------- # create view largest_waiting as select patient_name from appointment as a inner join queue as q on a.appointment_id = q.appointment_id inner join patients as p on a.patient_id = p.patient_id order by actual_time - appointment_time limit 10; # ---------------------------------------------------------------------- # # INSERT DATA TO HOSPITAL # # ---------------------------------------------------------------------- # insert into Doctors values (999, "EKG", "moshe", 10000); insert into Doctors values (888, "MRT", "menachem", 5000); insert into Doctors values (777, "GYN", "osnat", 5000); insert into Patients values (100, "alex"); insert into Patients values (111, "kobi"); insert into Patients values (199, "adar"); insert into Patients values (122, "yosi"); insert into Patients values (200, "herzel"); insert into Patients values (166, "hanna"); insert into Patients values (211, "dani"); insert into Patients values (188, "shira"); insert into Patients values (222, "or"); insert into Patients values (133, "alon"); insert into Patients values (177, "eden"); insert into Patients values (144, "shai"); insert into Patients values (233, "rahel"); insert into Appointment (patient_id, doctor_id, appointment_time) values (100, 999, '2019-03-19 13:00:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (111, 999, '2019-03-19 13:20:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (122, 888, '2019-03-15 10:00:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (133, 888, '2019-03-16 15:00:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (144, 999, '2019-03-19 14:30:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (155, 888, '2019-03-16 16:15:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (166, 999, '2019-03-19 15:45:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (177, 888, '2019-03-19 15:20:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (188, 999, '2019-03-19 12:00:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (199, 888, '2019-03-17 13:30:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (200, 777, '2019-03-18 13:10:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (211, 777, '2019-03-16 14:00:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (222, 777, '2019-03-16 10:30:00'); insert into Appointment (patient_id, doctor_id, appointment_time) values (233, 777, '2019-03-18 12:30:00');
-- +migrate up ALTER TABLE "public"."bingo_plays" DROP COLUMN "player_id"; -- +migrate down ALTER TABLE "public"."bingo_plays" ADD COLUMN "player_id" integer, ADD FOREIGN KEY("player_id") REFERENCES "public"."bingo_players"("id");
/* Navicat MySQL Data Transfer Source Server : 192.168.189.128 Source Server Type : MySQL Source Server Version : 100402 Source Host : 192.168.189.128:3306 Source Schema : dailyfresh Target Server Type : MySQL Target Server Version : 100402 File Encoding : 65001 Date: 19/11/2019 18:07:01 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for auth_group -- ---------------------------- DROP TABLE IF EXISTS `auth_group`; CREATE TABLE `auth_group` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `name`(`name`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for auth_group_permissions -- ---------------------------- DROP TABLE IF EXISTS `auth_group_permissions`; CREATE TABLE `auth_group_permissions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `group_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `auth_group_permissions_group_id_permission_id_0cd325b0_uniq`(`group_id`, `permission_id`) USING BTREE, INDEX `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm`(`permission_id`) USING BTREE, CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for auth_permission -- ---------------------------- DROP TABLE IF EXISTS `auth_permission`; CREATE TABLE `auth_permission` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `content_type_id` int(11) NOT NULL, `codename` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `auth_permission_content_type_id_codename_01ab375a_uniq`(`content_type_id`, `codename`) USING BTREE, CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 65 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_address -- ---------------------------- DROP TABLE IF EXISTS `df_address`; CREATE TABLE `df_address` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `receiver` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `addr` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `zip_code` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `is_default` tinyint(1) NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `df_address_user_id_5e6a5c8a_fk_df_user_id`(`user_id`) USING BTREE, CONSTRAINT `df_address_user_id_5e6a5c8a_fk_df_user_id` FOREIGN KEY (`user_id`) REFERENCES `df_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_goods -- ---------------------------- DROP TABLE IF EXISTS `df_goods`; CREATE TABLE `df_goods` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `detail` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_goods_image -- ---------------------------- DROP TABLE IF EXISTS `df_goods_image`; CREATE TABLE `df_goods_image` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `image` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `sku_id` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `df_goods_image_sku_id_f8dc96ea_fk_df_goods_sku_id`(`sku_id`) USING BTREE, CONSTRAINT `df_goods_image_sku_id_f8dc96ea_fk_df_goods_sku_id` FOREIGN KEY (`sku_id`) REFERENCES `df_goods_sku` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_goods_sku -- ---------------------------- DROP TABLE IF EXISTS `df_goods_sku`; CREATE TABLE `df_goods_sku` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `desc` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `price` decimal(10, 2) NOT NULL, `image` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `stock` int(11) NOT NULL, `sales` int(11) NOT NULL, `status` smallint(6) NOT NULL, `detail` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `goods_id` int(11) NOT NULL, `type_id` int(11) NOT NULL, `unite` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `df_goods_sku_goods_id_31622280_fk_df_goods_id`(`goods_id`) USING BTREE, INDEX `df_goods_sku_type_id_576de3b4_fk_df_goods_type_id`(`type_id`) USING BTREE, CONSTRAINT `df_goods_sku_goods_id_31622280_fk_df_goods_id` FOREIGN KEY (`goods_id`) REFERENCES `df_goods` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `df_goods_sku_type_id_576de3b4_fk_df_goods_type_id` FOREIGN KEY (`type_id`) REFERENCES `df_goods_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_goods_type -- ---------------------------- DROP TABLE IF EXISTS `df_goods_type`; CREATE TABLE `df_goods_type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `logo` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `image` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_index_banner -- ---------------------------- DROP TABLE IF EXISTS `df_index_banner`; CREATE TABLE `df_index_banner` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `image` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `index` smallint(6) NOT NULL, `sku_id` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `df_index_banner_sku_id_57f2798e_fk_df_goods_sku_id`(`sku_id`) USING BTREE, CONSTRAINT `df_index_banner_sku_id_57f2798e_fk_df_goods_sku_id` FOREIGN KEY (`sku_id`) REFERENCES `df_goods_sku` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_index_promotion -- ---------------------------- DROP TABLE IF EXISTS `df_index_promotion`; CREATE TABLE `df_index_promotion` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `url` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `image` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `index` smallint(6) NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_index_type_goods -- ---------------------------- DROP TABLE IF EXISTS `df_index_type_goods`; CREATE TABLE `df_index_type_goods` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `display_type` smallint(6) NOT NULL, `index` smallint(6) NOT NULL, `sku_id` int(11) NOT NULL, `type_id` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `df_index_type_goods_sku_id_0a8a17db_fk_df_goods_sku_id`(`sku_id`) USING BTREE, INDEX `df_index_type_goods_type_id_35192ffd_fk_df_goods_type_id`(`type_id`) USING BTREE, CONSTRAINT `df_index_type_goods_sku_id_0a8a17db_fk_df_goods_sku_id` FOREIGN KEY (`sku_id`) REFERENCES `df_goods_sku` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `df_index_type_goods_type_id_35192ffd_fk_df_goods_type_id` FOREIGN KEY (`type_id`) REFERENCES `df_goods_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_order_goods -- ---------------------------- DROP TABLE IF EXISTS `df_order_goods`; CREATE TABLE `df_order_goods` ( `id` int(11) NOT NULL AUTO_INCREMENT, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `count` int(11) NOT NULL, `price` decimal(10, 2) NOT NULL, `comment` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `order_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `sku_id` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `df_order_goods_order_id_6958ee23_fk_df_order_info_order_id`(`order_id`) USING BTREE, INDEX `df_order_goods_sku_id_b7d6e04e_fk_df_goods_sku_id`(`sku_id`) USING BTREE, CONSTRAINT `df_order_goods_order_id_6958ee23_fk_df_order_info_order_id` FOREIGN KEY (`order_id`) REFERENCES `df_order_info` (`order_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `df_order_goods_sku_id_b7d6e04e_fk_df_goods_sku_id` FOREIGN KEY (`sku_id`) REFERENCES `df_goods_sku` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_order_info -- ---------------------------- DROP TABLE IF EXISTS `df_order_info`; CREATE TABLE `df_order_info` ( `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NOT NULL, `is_delete` tinyint(1) NOT NULL, `order_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `pay_method` smallint(6) NOT NULL, `total_count` int(11) NOT NULL, `total_price` decimal(10, 2) NOT NULL, `transit_price` decimal(10, 2) NOT NULL, `order_status` smallint(6) NOT NULL, `tran_no` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`order_id`) USING BTREE, INDEX `df_order_info_user_id_ac1e5bf5_fk_df_user_id`(`user_id`) USING BTREE, CONSTRAINT `df_order_info_user_id_ac1e5bf5_fk_df_user_id` FOREIGN KEY (`user_id`) REFERENCES `df_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_user -- ---------------------------- DROP TABLE IF EXISTS `df_user`; CREATE TABLE `df_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `password` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `last_login` datetime(6) NULL DEFAULT NULL, `user_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `first_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `last_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `avatar` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `email` varchar(254) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `is_active` tinyint(1) NOT NULL DEFAULT 1, `date_joined` datetime(6) NULL DEFAULT NULL, `create_time` datetime(6) NOT NULL, `update_time` datetime(6) NULL DEFAULT NULL, `is_delete` tinyint(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `user_name`(`user_name`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_user_groups -- ---------------------------- DROP TABLE IF EXISTS `df_user_groups`; CREATE TABLE `df_user_groups` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `group_id` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `df_user_groups_user_id_group_id_80e5ab91_uniq`(`user_id`, `group_id`) USING BTREE, INDEX `df_user_groups_group_id_36f24e94_fk_auth_group_id`(`group_id`) USING BTREE, CONSTRAINT `df_user_groups_group_id_36f24e94_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `df_user_groups_user_id_a816b098_fk_df_user_id` FOREIGN KEY (`user_id`) REFERENCES `df_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for df_user_user_permissions -- ---------------------------- DROP TABLE IF EXISTS `df_user_user_permissions`; CREATE TABLE `df_user_user_permissions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `permission_id` int(11) NOT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `df_user_user_permissions_user_id_permission_id_b22997de_uniq`(`user_id`, `permission_id`) USING BTREE, INDEX `df_user_user_permiss_permission_id_40a6cb2d_fk_auth_perm`(`permission_id`) USING BTREE, CONSTRAINT `df_user_user_permiss_permission_id_40a6cb2d_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `df_user_user_permissions_user_id_b5f6551b_fk_df_user_id` FOREIGN KEY (`user_id`) REFERENCES `df_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1;
-- phpMyAdmin SQL Dump -- version 4.7.3 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: Sep 11, 2017 at 11:32 AM -- Server version: 5.6.37 -- PHP Version: 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 */; -- -- Database: `funro_dev` -- -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `confirm` tinyint(4) NOT NULL, `token` varchar(255) NOT NULL DEFAULT '0', `facebook_id` varchar(255) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `username`, `password`, `email`, `confirm`, `token`, `facebook_id`) VALUES (1, 'admin', '8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918', 'an.pop95@gmail.com', 1, '59919502a02e3', '1995152730704818'), (2, 'admin2', '1c142b2d01aa34e9a36bde480645a57fd69e14155dacfab5a3f9257b77fdc8d8', 'tudor@contursoft.ro', 0, '599567db93355', '0'), (3, 'tudor', '3982de3c146151cafa11b0c9892281b6fe52b0c35d4281be0e43dc5b0c7f29dc', 'regtd@wadas.sxcas', 0, '599be6bb29f5d', '0'), (6, 'raresmircea', 'ca10e7913455602db212ff1dcacc5d9d61b74eceea00cdeb4f9c61ba19f59f75', 'raresm93@gmail.com', 0, '599dcba650b98', '0'), (16, 'admin3', '4fc2b5673a201ad9b1fc03dcb346e1baad44351daa0503d5534b4dfdcc4332e0', 'mail@mail.com', 0, '599ec990b9825', '0'), (18, 'Tudor Vulpe', '', 'tvulpe@yahoo.com', 0, '599ec9ddb4d55', '1540849839309897'), (19, 'Vlad Truta', '', 'vladtruta@icloud.com', 0, '599f06043cdde', '2062110967342597'), (20, 'Razvan Rus', '', 'razvy3331992@yahoo.com', 0, '599fd51ca1593', '10212330854200892'), (21, 'Gabriel Bogdan Pop', '', 'gaby_em23@yahoo.com', 1, '59a97dfca4288', '1607393235947361'), (22, 'Irina Gabriela', '', 'irina_g21@yahoo.com', 0, '59abd85fa7fbd', '1507583342612083'), (23, 'Adi Moldovan', '', 'ady.moldo.92@gmail.com', 0, '59ad90895a7a1', '1459522650779767'), (24, 'Bianca Peterlin', '', 'biancapeterlin@yahoo.com', 1, '59ae8585ddca3', '10210205815641522'), (25, 'Cristian Stefan Balint', '', 'balintstefancristian@gmail.com', 0, '59b00d3047e62', '10207761808002988'), (26, '\' + (SELECT UserName + \'_\' + Password FROM Users LIMIT 1) + \'', 'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3', 'm@m.com', 0, '59b2679db08ea', '0'), (27, 'ezze123', 'ae65d78e377dcef3bb0d8a5f3f3ab4d122369551bf34514acef52638d85996ad', 'r.mircea@cars.coffee', 0, '59b2e505c5255', '0'); -- -------------------------------------------------------- -- -- Table structure for table `user_details` -- CREATE TABLE `user_details` ( `id` int(11) NOT NULL, `firstname` varchar(255) NOT NULL, `lastname` varchar(255) NOT NULL, `picture` mediumblob NOT NULL, `points` int(11) UNSIGNED NOT NULL DEFAULT '0', `totalpoints` int(10) UNSIGNED NOT NULL DEFAULT '0', `user_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user_details` -- INSERT INTO `user_details` (`id`, `firstname`, `lastname`, `picture`, `points`, `totalpoints`, `user_id`) VALUES (1, 'Andrei', 'Tudor', '', 268, 15214, 1), (2, 'tudor', 'vulpe', '', 9979400, 410, 2), (5, '', '', '', 0, 0, 16), (6, 'Andrei', 'Pop', '', 474, 504, 17), (7, 'Tudor', 'V', '', 70149, 159, 18), (8, 'asd', 'asd', '', 63, 133, 19), (9, 'Razvan', 'Rus', '', 186, 186, 20), (10, 'Gabriel', 'Bogdan', '', 148, 148, 21), (11, 'Irina', 'Gabriela', '', 86, 86, 22), (12, 'Adi', 'Moldovan', '', 0, 0, 23), (13, 'Bianca', 'Peterlin', '', 49, 49, 24), (14, 'Cristian', 'Stefan', '', 4, 4, 25), (15, '', '', '', 0, 0, 26), (16, '', '', '', 0, 0, 27); -- -------------------------------------------------------- -- -- Table structure for table `vouchers` -- CREATE TABLE `vouchers` ( `id` int(11) NOT NULL, `code` varchar(1000) NOT NULL, `value` int(11) NOT NULL, `coins` int(11) NOT NULL, `sent` tinyint(4) NOT NULL DEFAULT '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `vouchers` -- INSERT INTO `vouchers` (`id`, `code`, `value`, `coins`, `sent`) VALUES (1, 'asdasdas12312ASD', 10, 10000, 1), (2, 'asd', 10, 10000, 1), (3, 'asd1', 10, 10000, 1), (4, 'asd2', 10, 10000, 1), (5, 'asd3', 10, 10000, 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user_details` -- ALTER TABLE `user_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `vouchers` -- ALTER TABLE `vouchers` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28; -- -- AUTO_INCREMENT for table `user_details` -- ALTER TABLE `user_details` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT for table `vouchers` -- ALTER TABLE `vouchers` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;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 */;
-- ----------------------------------------------------- -- procedure sp_AuthorizePlayer -- ----------------------------------------------------- delimiter && CREATE PROCEDURE sp_AuthorizePlayer(IN p_username varchar(45) , IN p_password varchar(45)) BEGIN SELECT playerId, userName, firstName, lastName, email, lastlogin from Player where userName = p_username and password = p_Password; END&&
select * from semantic.alerts where alert = '5000Y00000V0Y3o' select * from semantic.alerts a where a.datetime_opened >= '2016-12-05'::date - interval '60 days' and a.datetime_opened < '2016-12-05' and ST_DWithin('0101000020E6100000AD0782B68B1FB5BFDFB023C44BC34940',a.location, 50)
CREATE TABLE [Master].[Roles] ( [Role] NVARCHAR (50) NOT NULL );
-- complain if script is sourced in psql, rather than via CREATE EXTENSION \echo Use "CREATE EXTENSION pgsodium" to load this file. \quit CREATE FUNCTION randombytes_random() RETURNS integer AS '$libdir/pgsodium', 'pgsodium_randombytes_random' LANGUAGE C VOLATILE; CREATE FUNCTION randombytes_uniform(upper_bound integer) RETURNS integer AS '$libdir/pgsodium', 'pgsodium_randombytes_uniform' LANGUAGE C VOLATILE STRICT; CREATE FUNCTION randombytes_buf(size integer) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_randombytes_buf' LANGUAGE C VOLATILE STRICT; CREATE FUNCTION crypto_secretbox_keygen() RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_secretbox_keygen' LANGUAGE C VOLATILE; CREATE FUNCTION crypto_secretbox_noncegen() RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_secretbox_noncegen' LANGUAGE C VOLATILE; CREATE FUNCTION crypto_secretbox(message bytea, nonce bytea, key bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_secretbox' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION crypto_secretbox_open(ciphertext bytea, nonce bytea, key bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_secretbox_open' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION crypto_auth(message bytea, key bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_auth' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION crypto_auth_verify(mac bytea, message bytea, key bytea) RETURNS boolean AS '$libdir/pgsodium', 'pgsodium_crypto_auth_verify' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION crypto_auth_keygen() RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_auth_keygen' LANGUAGE C VOLATILE; CREATE FUNCTION crypto_generichash(message bytea, key bytea DEFAULT NULL) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_generichash' LANGUAGE C IMMUTABLE; CREATE FUNCTION crypto_shorthash(message bytea, key bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_shorthash' LANGUAGE C IMMUTABLE STRICT; CREATE TYPE crypto_box_keypair AS (public bytea, secret bytea); CREATE OR REPLACE FUNCTION crypto_box_new_keypair() RETURNS SETOF crypto_box_keypair AS '$libdir/pgsodium', 'pgsodium_crypto_box_keypair' LANGUAGE C VOLATILE; CREATE FUNCTION crypto_box_noncegen() RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_box_noncegen' LANGUAGE C VOLATILE; CREATE FUNCTION crypto_box(message bytea, nonce bytea, public bytea, secret bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_box' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION crypto_box_open(ciphertext bytea, nonce bytea, public bytea, secret bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_box_open' LANGUAGE C IMMUTABLE STRICT; CREATE TYPE crypto_sign_keypair AS (public bytea, secret bytea); CREATE OR REPLACE FUNCTION crypto_sign_new_keypair() RETURNS SETOF crypto_sign_keypair AS '$libdir/pgsodium', 'pgsodium_crypto_sign_keypair' LANGUAGE C VOLATILE; CREATE OR REPLACE FUNCTION crypto_sign(message bytea, key bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_sign' LANGUAGE C IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION crypto_sign_open(signed_message bytea, key bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_sign_open' LANGUAGE C IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION crypto_sign_detached(message bytea, key bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_sign_detached' LANGUAGE C IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION crypto_sign_verify_detached(sig bytea, message bytea, key bytea) RETURNS boolean AS '$libdir/pgsodium', 'pgsodium_crypto_sign_verify_detached' LANGUAGE C IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION crypto_pwhash_saltgen() RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_pwhash_saltgen' LANGUAGE C VOLATILE; CREATE OR REPLACE FUNCTION crypto_pwhash(password bytea, salt bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_pwhash' LANGUAGE C IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION crypto_pwhash_str(password bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_pwhash_str' LANGUAGE C VOLATILE STRICT; CREATE OR REPLACE FUNCTION crypto_pwhash_str_verify(hashed_password bytea, password bytea) RETURNS bool AS '$libdir/pgsodium', 'pgsodium_crypto_pwhash_str_verify' LANGUAGE C IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION crypto_box_seal(message bytea, public_key bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_box_seal' LANGUAGE C IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION crypto_box_seal_open(ciphertext bytea, public_key bytea, secret_key bytea) RETURNS bytea AS '$libdir/pgsodium', 'pgsodium_crypto_box_seal_open' LANGUAGE C IMMUTABLE STRICT;
CREATE DATABASE IF NOT EXISTS edison; USE edison; DROP TABLE IF EXISTS edison.pwm; CREATE TABLE IF NOT EXISTS edison.pwm ( `id` int(11) NOT NULL DEFAULT 0, `pwm1` double(5,2) DEFAULT NULL, `pwm2` double(5,2) DEFAULT NULL, `pwm3` double(5,2) DEFAULT NULL, `pwm4` double(5,2) DEFAULT NULL, `update_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE = InnoDB; INSERT INTO `pwm` VALUES (1, 0.1, 0.2, 0.3, 0.4, '0000-00-00 00:00:00');
CREATE DATABASE QuanLyDoanhNghiepDB USE QuanLyDoanhNghiepDB CREATE TABLE LOAISP ( MaLoaiSP NCHAR(4) NOT NULL PRIMARY KEY, TenLoaiSP NVARCHAR(50) NOT NULL ) CREATE TABLE SANPHAM ( MaSP NCHAR(5) NOT NULL PRIMARY KEY, TenSP NVARCHAR(50) NOT NULL, MaLoaiSP NCHAR(4) NOT NULL FOREIGN KEY REFERENCES LOAISP(MaLoaiSP), GiaBan MONEY NOT NULL, SoLuong INT NOT NULL ) CREATE TABLE NHANVIEN( MaNV NCHAR(5) NOT NULL PRIMARY KEY, HoTenNV NVARCHAR(50) NOT NULL, GioiTinh NVARCHAR(10) NOT NULL, QueQuan NVARCHAR(30) NOT NULL, Tuoi DATE ) CREATE TABLE BANHANG( MaNV NCHAR(5) NOT NULL FOREIGN KEY REFERENCES NHANVIEN(MaNV), MaSP NCHAR(5) NOT NULL FOREIGN KEY REFERENCES SANPHAM(MaSP), SoLuongDaBan INT NOT NULL, PRIMARY KEY (MaNV,MaSP) ) -- Cau 1 INSERT INTO LOAISP VALUES ('L001',N'Mỹ phẩm') INSERT INTO SANPHAM VALUES ('SP001',N'Kem dưỡng da','L001',210000,100) --cau 2 SELECT s.TenSP,s.SoLuong FROM SANPHAM s --cau 3 SELECT b.MaNV,n.HoTenNV,b.MaSP FROM NHANVIEN n,BANHANG b WHERE n.MaNV=b.MaNV --cau 4 SELECT n.MaNV,n.HoTenNV,b.MaSP FROM NHANVIEN n LEFT JOIN BANHANG b ON b.MaNV= n.MaNV --cau 5 SELECT s.MaSP,s.TenSP,l.MaLoaiSP, l.TenLoaiSP FROM SANPHAM s, LOAISP l WHERE s.MaLoaiSP=l.MaLoaiSP -- cau 6 SELECT * FROM NHANVIEN n WHERE n.MaNV IN (SELECT b.MaNV FROM BANHANG b WHERE b.SoLuongDaBan>=10) --cau 7 SELECT * FROM SANPHAM s WHERE s.SoLuong>=20 AND s.TenSP!=N'Kem dưỡng da' --cau 8 SELECT * FROM NHANVIEN n ORDER BY n.QueQuan,n.GioiTinh -- cau 9 SELECT b.MaNV,s.TenSP, l.TenLoaiSP FROM SANPHAM s,BANHANG b, LOAISP l WHERE s.MaSP=b.MaSP AND l.MaLoaiSP=s.MaLoaiSP -- cau 10 SELECT COUNT(*) AS N'Số lượng nhân viên bán SP001' FROM NHANVIEN n WHERE n.MaNV IN (SELECT b.MaNV FROM BANHANG b WHERE b.MaSP='SP001')
DELETE FROM content_imgs; INSERT INTO content_imgs("elemId", "aspectRatio", "optimalWidth", "optimalHeight") VALUES ('carousel-img-1', 1.777777778, 1600, 900), ('carousel-img-2', 1.777777778, 1600, 900), ('carousel-img-3', 1.777777778, 1600, 900), ('good-img', 2.25, 450, 200), ('contacts-img-1', 1.02, 344, 334); DELETE FROM content_text; INSERT INTO content_text("elemId", "value") VALUES ('h1-home-center', 'H1-HOME-CENTER'), ('p-home-center', 'P-HOME-CENTER, P-HOME-CENTER, P-HOME-CENTER, P-HOME-CENTER, P-HOME-CENTER'), ('h1-contacts-center', 'H1-CONTACTS-CENTER'), ('p-contacts-center', 'P-CONTACTS-CENTER'), ('h2-carousel-1', 'H2-CAROUSEL-1'), ('h2-carousel-2', 'H2-CAROUSEL-2'), ('h2-carousel-3', 'H2-CAROUSEL-3'); DELETE FROM images; DELETE FROM images_src; INSERT INTO admins(login, password, "createdAt", "updatedAt") VALUES ('admin', '16ytu91ito', now(), now());
SELECT end_station, AVG(duration) average_duration FROM trips GROUP BY 1 ORDER BY average_duration DESC
create database PLANSAUDE; user PLANSAUDE; create table Cliente (idCliente int primary key auto_increment, nome varchar (50), telefone int (12), cpf int (11) ); create table Dependente ( sexo varchar (1), idade varchar (2) ); create table Endereco ( rua varchar (60), numero int (4), complemento varchar (100) ); create table TipoPlano( basico varchar (50), familia varchar (50), premium varchar (50) );
create table if not exists movie ( id bigint auto_increment primary key, name varchar(255) not null, year int not null, description text, poster varchar(4096) );
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 cinesoft -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS cinesoft DEFAULT CHARACTER SET utf8 ; USE cinesoft; -- ----------------------------------------------------- -- Table cinesoft.Cliente -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS cinesoft.Cliente ( cpf INT NOT NULL, nome VARCHAR(45) UNIQUE NOT NULL, telefone VARCHAR(20) NOT NULL, email VARCHAR(45) NOT NULL, dataNascimento DATE NOT NULL, dataCadastro DATE NOT NULL, PRIMARY KEY (cpf)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table cinesoft.Compra -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS cinesoft.Compra ( idCompra INT NOT NULL, data DATE NOT NULL, precoBruto DECIMAL(5,2) NOT NULL, precoLiquido DECIMAL(5,2) NOT NULL, clienteCPF INT NOT NULL, PRIMARY KEY (idCompra, clienteCPF), INDEX fk_Compra_Cliente1_idx (clienteCPF ASC), CONSTRAINT fk_Compra_Cliente1 FOREIGN KEY (clienteCPF) REFERENCES cinesoft.Cliente (cpf) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table cinesoft.Produto -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS cinesoft.Produto ( idProduto INT NOT NULL, nome VARCHAR(45) NOT NULL, preco DECIMAL(5,2) NOT NULL, quantidade INT NOT NULL, PRIMARY KEY (idProduto)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table cinesoft.Contem -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS cinesoft.Contem ( idProduto INT NOT NULL, idCompra INT NOT NULL, quantidade INT NOT NULL, precoVenda DECIMAL(4,2) NOT NULL, PRIMARY KEY (idProduto, idCompra), INDEX fk_Produto_has_Compra_Compra1_idx (idCompra ASC), INDEX fk_Produto_has_Compra_Produto1_idx (idProduto ASC), CONSTRAINT fk_Produto_has_Compra_Produto1 FOREIGN KEY (idProduto) REFERENCES cinesoft.Produto (idProduto) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT fk_Produto_has_Compra_Compra1 FOREIGN KEY (idCompra) REFERENCES cinesoft.Compra (idCompra) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table cinesoft.Filme -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS cinesoft.Filme ( idFilme INT NOT NULL AUTO_INCREMENT, nome VARCHAR(45) NOT NULL, genero VARCHAR(15) NOT NULL, classificacaoIndicativa INT NOT NULL, dataEstreia DATE NOT NULL, dataFinal DATE NULL, PRIMARY KEY (idFilme)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table cinesoft.Sessao -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS cinesoft.Sessao ( idSessao INT NOT NULL, horario TIME NOT NULL, idioma TINYINT(1) NOT NULL, tipoImagem TINYINT(1) NOT NULL, idFilme INT NOT NULL, PRIMARY KEY (idSessao, idFilme), INDEX fk_Sessao_Filme1_idx (idFilme ASC), CONSTRAINT fk_Sessao_Filme1 FOREIGN KEY (idFilme) REFERENCES cinesoft.Filme (idFilme) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table cinesoft.Ingresso -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS cinesoft.Ingresso ( idIngresso INT NOT NULL, data DATE NOT NULL, precoBruto DECIMAL(5,2) NOT NULL, precoLiquido DECIMAL(5,2) NOT NULL, cpf INT NOT NULL, idSessao INT NOT NULL, poltrona VARCHAR(3) NOT NULL, PRIMARY KEY (idIngresso, cpf, idSessao), INDEX fk_Ingresso_Cliente1_idx (cpf ASC), INDEX fk_Ingresso_Sessao1_idx (idSessao ASC), CONSTRAINT fk_Ingresso_Cliente1 FOREIGN KEY (cpf) REFERENCES cinesoft.Cliente (cpf) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT fk_Ingresso_Sessao1 FOREIGN KEY (idSessao) REFERENCES cinesoft.Sessao (idSessao) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table cinesoft.Carteirinha -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS cinesoft.Carteirinha ( idCarteirinha INT NOT NULL, validade DATE NOT NULL, clienteCPF INT NOT NULL, idJovem TINYINT(1) NULL, estudante TINYINT(1) NULL, fidelidade TINYINT(1) NULL, categoria VARCHAR(1) NULL, PRIMARY KEY (idCarteirinha, clienteCPF), INDEX fk_Carteirinha_Cliente1_idx (clienteCPF ASC), CONSTRAINT fk_Carteirinha_Cliente1 FOREIGN KEY (clienteCPF) REFERENCES cinesoft.Cliente (cpf) 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; -- B ALTER TABLE Cliente ADD COLUMN endereco VARCHAR(100); ALTER TABLE Cliente DROP COLUMN endereco; RENAME TABLE Compra to Venda; RENAME TABLE Venda to Compra; DROP TABLE Contem; -- C INSERT INTO Cliente VALUES (1,"Otávio de Lima Soares", "(35) 3214-2665", "olima94@gmail.com", "2000-02-22", "2019-06-19"); INSERT INTO Cliente VALUES (2,"Kaio Vinicius de Morais", "(35) 9958-7788 ", "kaiocomk34@gmail.com", "1999-02-12", "2019-06-19"); INSERT INTO Cliente VALUES (3,"Otávio Augusto", "(35) 3222-2665", "otavio@gmail.com", "1998-02-22", "2019-06-19"); INSERT INTO Cliente VALUES (4,"Fabio Junio Rolin de Oliveira", "(35) 3221-2665", "fabiojunio@gmail.com", "1998-01-01", "2019-06-19"); INSERT INTO Cliente VALUES (5,"Sérgio Herique Menta Garcia", "(35) 3223-2665", "sergio@gmail.com", "1998-09-25", "2019-06-19"); INSERT INTO Filme (nome, genero, classificacaoIndicativa, dataEstreia, dataFinal) VALUES ("Endgame", "Ação", 16, "2019-06-19", "2019-07-19"); INSERT INTO Filme (nome, genero, classificacaoIndicativa, dataEstreia, dataFinal) VALUES ("Five Feet Apart", "Romance", 16, "2019-06-26", "2019-07-08"); INSERT INTO Filme (nome, genero, classificacaoIndicativa, dataEstreia, dataFinal) VALUES ("Jurassic World", "Ação", 0, "2019-07-19", "2019-07-26"); INSERT INTO Filme (nome, genero, classificacaoIndicativa, dataEstreia, dataFinal) VALUES ("Django Libre", "Ação", 16, "2019-08-19", "2019-08-26"); INSERT INTO Filme (nome, genero, classificacaoIndicativa, dataEstreia, dataFinal) VALUES ("Transformers", "Ação", 12, "2019-09-19", "2019-10-19"); INSERT INTO Filme (nome, genero, classificacaoIndicativa, dataEstreia, dataFinal) VALUES ("Avatar", "Ação", 12, "2019-10-19", "2019-11-19"); INSERT INTO Sessao VALUES (1, "13:40:00", 0, 1, 1); INSERT INTO Sessao VALUES (2, "17:00:00", 1, 0, 2); INSERT INTO Sessao VALUES (3, "20:40:00", 1, 1, 3); INSERT INTO Sessao VALUES (4, "22:00:00", 0, 0, 4); INSERT INTO Sessao VALUES (5, "21:30:00", 1, 1, 5); INSERT INTO Produto VALUES (1, "Pipoca", 11.50, 300); INSERT INTO Produto VALUES (2, "Refrigerante", 7.50, 1000); INSERT INTO Produto VALUES (3, "Chocolate", 3.00, 500); INSERT INTO Produto VALUES (4, "Suco", 9.00, 100); INSERT INTO Produto VALUES (5, "Chiclete", 00.50, 200); INSERT INTO Ingresso VALUES (1, "2019-06-19", 20.00, 10.00, 1, 1, "H2"); INSERT INTO Ingresso VALUES (2, "2019-05-20", 20.00, 20.00, 2, 5, "H23"); INSERT INTO Ingresso VALUES (3, "2019-05-01", 20.00, 10.00, 3, 4, "H4"); INSERT INTO Ingresso VALUES (4, "2019-05-20", 20.00, 20.00, 4, 3, "J2"); INSERT INTO Ingresso VALUES (5, "2019-06-19", 20.00, 10.00, 5, 2, "L17"); INSERT INTO Carteirinha (idCarteirinha, validade, clienteCPF, idJovem) VALUES (1, "2020-06-19", 1, 1); INSERT INTO Carteirinha (idCarteirinha, validade, clienteCPF, estudante) VALUES (2, "2020-06-19", 2, 1); INSERT INTO Carteirinha (idCarteirinha, validade, clienteCPF, idJovem) VALUES (3, "2020-06-19", 3, 1); INSERT INTO Carteirinha (idCarteirinha, validade, clienteCPF, estudante) VALUES (4, "2020-06-19", 4, 1); INSERT INTO Carteirinha (idCarteirinha, validade, clienteCPF, fidelidade, categoria) VALUES (5, "2020-06-19", 5, 1, "A"); INSERT INTO Compra VALUES (1, "2019-06-19", 11.50, 11.50, 1); INSERT INTO Compra VALUES (2, "2019-06-19", 9.00, 9.00, 2); INSERT INTO Compra VALUES (3, "2019-06-19", 12.00, 12.00, 3); INSERT INTO Compra VALUES (4, "2019-06-19", 2.50, 2.50, 4); INSERT INTO Compra VALUES (5, "2019-06-19", 23.00, 18.40, 5); INSERT INTO Contem VALUES (1, 1, 1, 11.50); INSERT INTO Contem VALUES (4, 2, 1, 9.00); INSERT INTO Contem VALUES (3, 3, 4, 3.00); INSERT INTO Contem VALUES (5, 4, 5, 00.50); INSERT INTO Contem VALUES (1, 5, 2, 11.50); -- D UPDATE Produto SET preco = preco*1.10 WHERE idProduto = 1; UPDATE Sessao SET idioma = 1 where idSessao = 1; UPDATE Filme SET dataFinal = "2019-08-26" where idFilme = 1; UPDATE Filme SET classificacaoIndicativa = 18 where idFilme = (select idFilme from Sessao where horario = "22:00:00"); UPDATE Cliente SET email = "otaviolima@hotmail.com" where cpf = 1; -- E DELETE FROM Carteirinha where clienteCPF = (select cpf from Cliente where nome = "Otávio de Lima Soares"); DELETE FROM Produto where idProduto = 4; DELETE FROM Contem where idCompra = 3; DELETE FROM Compra where idCompra = 4; DELETE FROM Ingresso where cpf = (select cpf FROM Cliente WHERE nome = "Kaio Vinicius de Morais"); -- F -- Retorna o titulo do filme e a sessao em que o mesmo será exibido, sem NULL SELECT Filme.nome, Sessao.horario FROM Filme JOIN Sessao ON Filme.idFilme = Sessao.idSessao; -- Retorna o titulo dos filmes e suas classificacoes ordenados por esta SELECT Filme.nome AS Titulo, Filme.classificacaoIndicativa AS Classificacao FROM Filme ORDER BY classificacaoIndicativa; -- Retorna o nome e o gênero do filme em ordem alfabética SELECT nome, genero FROM Filme ORDER BY nome; -- Retorna os produtos de quantidade vendida igual a 1 SELECT idProduto, count(*) FROM Contem WHERE quantidade = 1 GROUP BY idProduto; -- Retorna produtos vendidos em mais de uma compra SELECT Contem.idProduto, Produto.nome FROM Contem JOIN Produto ON Produto.idProduto = Contem.idProduto GROUP BY Contem.idProduto HAVING COUNT(Contem.idProduto) > 1; -- Retorna o titulo do filme e a sessao em que o mesmo será exibido, com NULL SELECT nome, Sessao.horario FROM Filme LEFT OUTER JOIN Sessao ON (Filme.idFilme = Sessao.idFilme); -- Retorna soma dos ingressos vendidos entre no mes 05 SELECT sum(precoLiquido) FROM Ingresso NATURAL JOIN Sessao WHERE data LIKE "2019-05%"; -- Retorna nome do cliente e a validade de sua carteirinha se for ID Jovem SELECT C.nome, D.validade FROM Cliente AS C JOIN Carteirinha AS D ON C.cpf = D.clienteCPF WHERE D.idJovem IS NOT NULL; -- Retorna nome do cliente e a validade de sua carteirinha se for fidelidade ou estudante SELECT C.nome, D.validade FROM Cliente AS C JOIN Carteirinha AS D ON C.cpf = D.clienteCPF WHERE D.fidelidade IS NOT NULL UNION SELECT C.nome, D.validade FROM Cliente AS C JOIN Carteirinha AS D ON C.cpf = D.clienteCPF WHERE D.estudante; -- Retorna compras com valor entre 8 e 12 "reais" SELECT idCompra AS Compra, data AS Data, precoLiquido AS Preco FROM Compra WHERE precoLiquido BETWEEN 8 AND 12; -- Retorna titulo e classificacao indicativa de 12 ou 16 SELECT nome, classificacaoIndicativa FROM Filme WHERE classificacaoIndicativa = 12 OR classificacaoIndicativa = 16; -- Retorna cliente, que tem ID Jovem, e sua poltrona SELECT Cli.nome, Ing.poltrona FROM Cliente AS Cli JOIN Ingresso AS Ing ON Cli.cpf = Ing.cpf WHERE Cli.cpf IN (SELECT Clih.cpf FROM Cliente AS Clih JOIN Carteirinha AS Id ON Id.clienteCPF = Clih.cpf WHERE Id.idJovem IS NOT NULL); -- G CREATE VIEW sessaoFilme as select nome, horario from Filme natural join Sessao; CREATE VIEW produtoCliente as select idProduto, clienteCPF from Compra natural join Contem; CREATE VIEW carteirinhaCliente as select nome, idCarteirinha from Cliente natural join Carteirinha; -- H CREATE USER 'otavio'@'localhost' IDENTIFIED BY '0192'; CREATE USER 'kaiocomK'@'localhost' IDENTIFIED BY '0193'; GRANT ALL ON cinesoft TO 'otavio'@'localhost'; REVOKE INSERT ON cinesoft FROM 'otavio'@'localhost'; GRANT ALL ON cinesoft.Cliente TO 'kaiocomK'@'localhost'; REVOKE UPDATE ON cinesoft.Cliente FROM 'kaiocomK'@'localhost'; -- I DELIMITER // CREATE PROCEDURE CompraDoCliente(IN pCpf INT) BEGIN SELECT nome,idCompra FROM Compra JOIN Cliente ON Compra.clienteCPF = Cliente.cpf WHERE pCpf = clienteCPF; END // DELIMITER ; CALL CompraDoCliente(1); DELIMITER // CREATE PROCEDURE ProdutosEstoque() BEGIN SELECT nome AS Produto, quantidade AS Quantidade, preco AS Preco FROM Produto WHERE quantidade > 0; END // DELIMITER ; CALL ProdutosEstoque(); DELIMITER // CREATE PROCEDURE ListarFilmesClassificacao(IN classIndic INT) BEGIN SELECT nome, classificacaoIndicativa FROM Filme WHERE classificacaoIndicativa = classIndic; END // DELIMITER ; call ListarFilmesClassificacao(16); -- J DELIMITER // CREATE TRIGGER antes_Filme_insercao BEFORE INSERT ON Filme FOR EACH ROW BEGIN IF(new.classificacaoIndicativa = 0) THEN SET new.classificacaoIndicativa = 0; ELSEIF(new.classificacaoIndicativa = 10) THEN SET new.classificacaoIndicativa = 10; ELSEIF(new.classificacaoIndicativa = 12) THEN SET new.classificacaoIndicativa = 12; ELSEIF(new.classificacaoIndicativa = 14) THEN SET new.classificacaoIndicativa = 14; ELSEIF(new.classificacaoIndicativa = 16) THEN SET new.classificacaoIndicativa = 16; ELSEIF(new.classificacaoIndicativa = 18) THEN SET new.classificacaoIndicativa = 18; ELSEIF(new.classificacaoIndicativa NOT IN (0,10,12,14,16,18)) THEN SIGNAL SQLSTATE '45000' SET message_text = 'Caracter invalido para classificacao indicativa, informe 0, 10, 12, 14, 16 ou 18.'; END IF; END // DELIMITER ; DELIMITER // CREATE TRIGGER antes_Filme_atualizacao BEFORE UPDATE ON Filme FOR EACH ROW BEGIN IF new.dataFinal < old.dataEstreia THEN SIGNAL SQLSTATE '45000' SET message_text = 'INVALIDO: data final antes da estreia'; END IF; END // DELIMITER ; DELIMITER // CREATE TRIGGER antes_Produto_exclusao BEFORE DELETE ON Produto FOR EACH ROW BEGIN IF old.quantidade > 0 THEN SIGNAL SQLSTATE '02000' SET message_text = 'INVALIDO: exclusao'; END IF; END // DELIMITER ;
 CREATE PROCEDURE [ERP].[Usp_Upd_Comparador_GenerarOC] @ID INT AS BEGIN --SET QUERY_GOVERNOR_COST_LIMIT 36000 --SET NOCOUNT ON; UPDATE ERP.Comparador SET FlagGeneroOC = 1 WHERE ID = @ID --SET NOCOUNT OFF; END
 CREATE PROC [ERP].[Usp_Ins_EntidadTipoDocumento] @IdEntidad INT OUT, @IdTipoPersona INT, @IdTipoDocumento INT, @IdCondicionSunat INT, @Nombre VARCHAR(250), @NumeroDocumento VARCHAR(20), @FlagBorrador BIT, @EstadoSunat BIT AS BEGIN INSERT INTO ERP.Entidad(Nombre,IdTipoPersona,EstadoSunat,IdCondicionSunat,FlagBorrador,Flag) VALUES(@Nombre,@IdTipoPersona,@EstadoSunat,@IdCondicionSunat,@FlagBorrador,1) SET @IdEntidad = (SELECT CAST(SCOPE_IDENTITY() AS INT)); INSERT INTO ERP.EntidadTipoDocumento(IdEntidad,IdTipoDocumento,NumeroDocumento) VALUES (@IdEntidad , @IdTipoDocumento, @NumeroDocumento); END
SELECT DISTINCT T.Email AS Email FROM ( SELECT P1.Email AS Email FROM Person AS P1 INNER JOIN Person AS P2 ON P1.Id <> P2.Id AND P1.Email = P2.Email ) AS T;
SELECT h2.name objectcsid, cc.objectnumber, h1.name mediacsid, mc.description, b.name, mc.creator creatorRefname, mc.creator creator, mc.blobcsid, mc.copyrightstatement, mc.identificationnumber, mc.rightsholder rightsholderRefname, mc.rightsholder rightsholder, mc.contributor FROM media_common mc JOIN misc ON (mc.id = misc.id AND misc.lifecyclestate <> 'deleted') LEFT OUTER JOIN hierarchy h1 ON (h1.id = mc.id) INNER JOIN relations_common r on (h1.name = r.objectcsid) LEFT OUTER JOIN hierarchy h2 on (r.subjectcsid = h2.name) LEFT OUTER JOIN collectionobjects_common cc on (h2.id = cc.id) JOIN hierarchy h3 ON (mc.blobcsid = h3.name) LEFT OUTER JOIN blobs_common b on (h3.id = b.id);
CREATE INDEX idx_da_city ON public.da_city USING btree (dw_last_updated_dt, dw_facility_cd); CREATE UNIQUE INDEX uk_da_city ON public.da_city USING btree (dw_row_id, dw_facility_cd); CREATE UNIQUE INDEX uk_da_city_2 ON public.da_city USING btree (city_cd, dw_facility_cd);
alter table BATTING_DETAIL drop constraint BATTING_DETAIL_FK1; alter table BATTING_DETAIL drop constraint BATTING_DETAIL_FK2; alter table BATTING_DETAIL drop constraint BATTING_DETAIL_FK3; alter table BATTING_DETAIL drop constraint BATTING_DETAIL_FK4; alter table BATTING_DETAIL drop constraint BATTING_DETAIL_FK5;
-- Se eliminan las tablas actuales de parada y ruta, de forma que se cargue el -- nuevo modelo de paradas ALTER TABLE "PIO".institucion DROP CONSTRAINT "FK_institucion_ruta"; ALTER TABLE "PIO".institucion DROP COLUMN idruta; DROP TABLE "PIO".ruta; DROP TABLE "PIO".parada; DROP SEQUENCE "PIO".parada_id; -- Se crea una nueva tabla parada con los valores necesarios CREATE SEQUENCE "PIO".parada_id INCREMENT 1 MINVALUE 1 MAXVALUE 922337203685477 START 1 CACHE 1; CREATE TABLE "PIO".parada ( id integer DEFAULT nextval('"PIO".parada_id'::regclass), nombre varchar, descripcion varchar ) WITH ( OIDS=false ); ALTER TABLE "PIO".parada OWNER TO postgres; ALTER TABLE "PIO".parada ADD CONSTRAINT "PK_parada_id" PRIMARY KEY (id); -- Se crea la tabla turno, utilizada para administrar los distintos turnos en -- los que pueden subir los estudiantes. CREATE SEQUENCE "PIO".turno_id INCREMENT 1 MINVALUE 1 MAXVALUE 922337203685477 START 1 CACHE 1; CREATE TABLE "PIO".turno ( id integer DEFAULT nextval('"PIO".turno_id'::regclass), capacidad integer, dia varchar, hora varchar, sede varchar ) WITH ( OIDS=false ); ALTER TABLE "PIO".turno OWNER TO postgres; ALTER TABLE "PIO".turno ADD CONSTRAINT "PK_turno_id" PRIMARY KEY (id); -- Se elimina la tabla actual de preinscrito para crear una nueva que sea acorde -- al nuevo modelo de paradas ALTER TABLE "PIO".participante DROP CONSTRAINT "FK_participante_preinscrito_cedula"; DROP TABLE "PIO".preinscrito; DROP SEQUENCE "PIO".preinscrito_id_seq; CREATE TABLE "PIO".preinscrito ( cedula varchar(8), turnoprueba integer, aulaprueba varchar(6), notatest integer, notapio integer, notaraven integer, sede varchar ) WITH ( OIDS=FALSE ); ALTER TABLE "PIO".preinscrito OWNER TO postgres; ALTER TABLE "PIO".preinscrito ADD CONSTRAINT "PK_preinscrito_cedula" PRIMARY KEY (cedula); ALTER TABLE "PIO".preinscrito ADD CONSTRAINT "FK_preinscrito_turno" FOREIGN KEY (turnoPrueba) REFERENCES "PIO".turno (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE SET NULL; ALTER TABLE "PIO".preinscrito ADD CONSTRAINT "FK_preinscrito_aula" FOREIGN KEY (aulaPrueba) REFERENCES "PIO".aula (ubicacion) MATCH SIMPLE ON UPDATE CASCADE ON DELETE SET NULL; ALTER TABLE "PIO".preinscrito ADD CONSTRAINT "FK_preinscrito_aspirante" FOREIGN KEY (cedula) REFERENCES "PIO".aspirante (cedula) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE "PIO".participante ADD CONSTRAINT "FK_participante_preinscrito" FOREIGN KEY (cedula) REFERENCES "PIO".preinscrito (cedula) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE; -- Se le agrega a cada institucion la referencia a su parada por defecto ALTER TABLE "PIO".institucion ADD COLUMN idparada integer; ALTER TABLE "PIO".institucion ADD CONSTRAINT "FK_institucion_parada" FOREIGN KEY (idparada) REFERENCES "PIO".parada (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE SET NULL; -- Se crea una tabla donde se definen las paradas alternas para una institución -- dependiendo del turno en el que se vaya a distribuir CREATE TABLE "PIO".parada_alterna ( idinstitucion integer, idparada integer, idturno integer ) WITH ( OIDS=false ); ALTER TABLE "PIO".parada_alterna OWNER TO postgres; ALTER TABLE "PIO".parada_alterna ADD CONSTRAINT "PK_paradaAlterna_idinstitucion_idturno" PRIMARY KEY (idinstitucion, idturno); ALTER TABLE "PIO".parada_alterna ADD CONSTRAINT "FK_paradaAlterna_institucion" FOREIGN KEY (idinstitucion) REFERENCES "PIO".institucion (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE "PIO".parada_alterna ADD CONSTRAINT "FK_paradaAlterna_parada" FOREIGN KEY (idparada) REFERENCES "PIO".parada (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE "PIO".parada_alterna ADD CONSTRAINT "FK_paradaAlterna_turno" FOREIGN KEY (idturno) REFERENCES "PIO".turno (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE; -- Se modifica la tabla de aula, para que ahora incluya la sede en la cual -- se encuentra ALTER TABLE "PIO".aula ADD COLUMN sede varchar;
/** * SQL for Delete FR_SHISETSU_WITHOUT_INS_SRV by SHISETSU_CD * @author TuyenVHA * @version $Id: ShisetsuDashboardService_deleteFrShisetsuWithoutInsSrv_Del_01.sql 21156 2014-08-15 04:15:43Z p__toen $ */ DELETE FROM FR_SHISETSU_WITHOUT_INS_SRV FSWIS WHERE FSWIS.SHISETSU_CD = /*shisetsuCd*/'111111111'
/* ################################################################################ Migration script to create new tables for ethnicity tracking Designed for execution with Flyway database migrations tool; this should be automatically run to completely generate the schema that is out-of-the-box compatibile with the GOCI model (see https://github.com/tburdett/goci/tree/2.x-dev/goci-core/goci-model for more). author: Emma Hastings date: Aug 04th 2016 version: 2.1.2.038 ################################################################################ ####################################### # CREATE NEW JOIN TABLES AND CONSTRAINTS ####################################### */ -------------------------------------------------------- -- DDL for Table ETHNICITY_EVENT -------------------------------------------------------- CREATE TABLE "ETHNICITY_EVENT" ( "ETHNICITY_ID" NUMBER(19, 0), "EVENT_ID" NUMBER(19, 0) ); -------------------------------------------------------- -- Constraints for Table ETHNICITY_EVENT -------------------------------------------------------- ALTER TABLE "ETHNICITY_EVENT" MODIFY ("ETHNICITY_ID" NOT NULL ENABLE); ALTER TABLE "ETHNICITY_EVENT" MODIFY ("EVENT_ID" NOT NULL ENABLE); -------------------------------------------------------- -- Ref Constraints for Table ETHNICITY_EVENT -------------------------------------------------------- ALTER TABLE "ETHNICITY_EVENT" ADD CONSTRAINT "ETH_ID_FK" FOREIGN KEY ("ETHNICITY_ID") REFERENCES "ETHNICITY" ("ID") ENABLE; ALTER TABLE "ETHNICITY_EVENT" ADD CONSTRAINT "ETH_EVENT_ID_FK" FOREIGN KEY ("EVENT_ID") REFERENCES "EVENT" ("ID") ENABLE; -------------------------------------------------------- -- DDL for Table DELETED_ETHNICITY -------------------------------------------------------- CREATE TABLE "DELETED_ETHNICITY" ( "ID" NUMBER(19, 0), "STUDY_ID" NUMBER(19, 0) ); -------------------------------------------------------- -- DDL for Index DELETED_ETHNICITY_ID_PK -------------------------------------------------------- CREATE UNIQUE INDEX "DELETED_ETH_ID_PK" ON "DELETED_ETHNICITY" ("ID"); -------------------------------------------------------- -- Constraints for DELETED_ETHNICITY -------------------------------------------------------- ALTER TABLE "DELETED_ETHNICITY" ADD PRIMARY KEY ("ID") ENABLE; ALTER TABLE "DELETED_ETHNICITY" MODIFY ("ID" NOT NULL ENABLE); -------------------------------------------------------- -- DDL for Table DELETED_ETHNICITY_EVENT -------------------------------------------------------- CREATE TABLE "DELETED_ETHNICITY_EVENT" ( "DELETED_ETHNICITY_ID" NUMBER(19, 0), "EVENT_ID" NUMBER(19, 0) ); -------------------------------------------------------- -- Constraints for Table DELETED_ETHNICITY_EVENT -------------------------------------------------------- ALTER TABLE "DELETED_ETHNICITY_EVENT" MODIFY ("DELETED_ETHNICITY_ID" NOT NULL ENABLE); ALTER TABLE "DELETED_ETHNICITY_EVENT" MODIFY ("EVENT_ID" NOT NULL ENABLE); -------------------------------------------------------- -- Ref Constraints for Table DELETED_ETHNICITY_EVENT -------------------------------------------------------- ALTER TABLE "DELETED_ETHNICITY_EVENT" ADD CONSTRAINT "DETH_ID_FK" FOREIGN KEY ("DELETED_ETHNICITY_ID") REFERENCES "DELETED_ETHNICITY" ("ID") ENABLE; ALTER TABLE "DELETED_ETHNICITY_EVENT" ADD CONSTRAINT "DETH_EVENT_ID_FK" FOREIGN KEY ("EVENT_ID") REFERENCES "EVENT" ("ID") ENABLE;
UPDATE traitor_users SET joined_mission = $2 WHERE traitor_users_id = $1;
CREATE TABLE [ERP].[ListaPrecio] ( [ID] INT IDENTITY (1, 1) NOT NULL, [IdEmpresa] INT NULL, [Nombre] VARCHAR (50) NULL, [IdMoneda] INT NULL, [PorcentajeDescuento] INT NULL, [FechaRegistro] DATETIME NULL, [FechaEliminado] DATETIME NULL, [FlagBorrador] BIT NULL, [Flag] BIT NULL, [FlagPrincipal] BIT NULL, [FechaModificado] DATETIME NULL, [UsuarioRegistro] VARCHAR (250) NULL, [UsuarioModifico] VARCHAR (250) NULL, [UsuarioElimino] VARCHAR (250) NULL, [UsuarioActivo] VARCHAR (250) NULL, [FechaActivacion] DATETIME NULL, CONSTRAINT [PK__ListaPre__3214EC27E6A9AE64] PRIMARY KEY CLUSTERED ([ID] ASC), CONSTRAINT [FK_ListaPrecio_Moneda] FOREIGN KEY ([IdMoneda]) REFERENCES [Maestro].[Moneda] ([ID]) );
-- Displays the number of records with id = 89 in -- the table first_table of the current database. SELECT COUNT(*) FROM `first_table` WHERE `id` = 89;
USE Orders -- Problem 16 SELECT ProductName, OrderDate, DATEADD(DAY, 3, OrderDate) AS [Pay Due], DATEADD(MONTH, 1, OrderDate) AS [Deliver Due] FROM Orders -- Problem 17 CREATE TABLE People ( Id int PRIMARY KEY IDENTITY, Name nvarchar(50) NOT NULL, Birthdate date NOT NULL ) INSERT INTO People (Name, Birthdate) VALUES ('Victor', '2000-12-07'), ('Steven','1992-09-10'), ('Stephen','1991-09-19'), ('John','2010-01-06') SELECT Name, DATEDIFF(YEAR, Birthdate, GETDATE()) AS [Age in Years], DATEDIFF(MONTH, Birthdate, GETDATE()) AS [Age in Months], DATEDIFF(DAY, Birthdate, GETDATE()) AS [Age in Days], DATEDIFF(MINUTE, Birthdate, GETDATE()) AS [Age in Minutes] FROM People
use m2h3; set hive.tez.java.opts=-Xmx1024m; ADD JAR m2h3-assembly-1.jar; CREATE TEMPORARY FUNCTION useragent AS 'module2.homework3.UserAgentUDF'; select d.cityname,c.ua,c.suma from city d, (select a.cityid, a.ua, a.suma from (select i.cityid as cityid, i.ua as ua, sum(i.counter) as suma from (select imp.cityid as cityid,useragent(imp.useragent).ua as ua, count(*) as counter from impression imp group by imp.cityid,imp.useragent) i group by cityid, ua order by suma desc) a join (select i.cityid as cityid, max(i.suma) as max from (select ii.cityid as cityid, ii.ua as ua, sum(ii.counter) as suma from (select imp.cityid as cityid,useragent(imp.useragent).ua as ua, count(*) as counter from impression imp group by imp.cityid,imp.useragent) ii group by cityid, ua order by suma desc)i group by cityid) b where a.suma=b.max and a.cityid=b.cityid) c where d.cityid=c.cityid group by cityname,ua,suma order by suma desc;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; -- **************************************** -- *** Crear basedatos: TiendaRopaRafa *** -- **************************************** CREATE DATABASE IF NOT EXISTS TiendaRopaRafa; USE TiendaRopaRafa; -- -------------------------------------------------------- -- ********************************* -- *** Crear tabla: FuentesPedido *** -- ********************************* CREATE TABLE `FuentesPedido` ( `codFuentePed` int(11) NOT NULL, `descFuentePed` varchar(45) NOT NULL, Primary Key (codFuentePed) )ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ********************************* -- *** Crear tabla: TiposPago ******* -- ********************************* CREATE TABLE `TiposPago` ( `codTipoPago` int(11) NOT NULL, `descTipoPago` varchar(45) NOT NULL, Primary Key (codTipoPago) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ************************************** -- *** Crear tabla: EstadosPedido ******* -- ************************************** CREATE TABLE `EstadosPedido` ( `codEstadoPed` int(11) NOT NULL, `descEstadoPed` varchar(45) NOT NULL, Primary Key (codEstadoPed) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ************************************** -- *** Crear tabla: Temporadas ********** -- ************************************** CREATE TABLE `Temporadas` ( `codTemp` int(11) NOT NULL, `descTemp` varchar(45) NOT NULL, Primary Key (codTemp) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ************************************** -- *** Crear tabla: Provincias ********* -- ************************************** CREATE TABLE `Provincias` ( `codProv` int(2) NOT NULL, `nombreProv` varchar(45) DEFAULT NULL, Primary Key (codProv) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ************************************** -- *** Crear tabla: Localidades ********* -- ************************************** CREATE TABLE `Localidades` ( `codLocal` int(11) NOT NULL, `descLocal` varchar(45) NOT NULL, Primary Key (codLocal) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- ************************************** -- *** Crear tabla: Categorias ********** -- ************************************** CREATE TABLE `Categorias` ( `codCat` int(11) NOT NULL, `desCat` varchar(45) NOT NULL, `codTempCat` int(11) NOT NULL, Primary Key (codCat), foreign key (codTempCat) references Temporadas(codTemp) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ************************************** -- *** Crear tabla: Clientes ********** -- ************************************** CREATE TABLE `Clientes` ( `codCli` int(11) NOT NULL, `dniCli` varchar(9) NOT NULL, `nombreCli` varchar(30) NOT NULL, `direcCli` varchar(30) NOT NULL, `codLocalCli` int(11) NOT NULL, `codProvCli` int(11) NOT NULL, `tfnoCli` varchar(9) NOT NULL, `emailCli` varchar(30) NOT NULL, Primary Key (codCli), foreign key (codLocalCli) references Localidades(codLocal), foreign key (codProvCli) references Provincias(codProv) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ************************************** -- *** Crear tabla: Articulos *********** -- ************************************** CREATE TABLE `Articulos` ( `codArt` int(11) NOT NULL, `descArt` varchar(30) NOT NULL, `codCatArt` int(11) NOT NULL, `precioArt` double NOT NULL, Primary Key (codArt), foreign key (codCatArt) references Categorias(codCat) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- ************************************** -- *** Crear tabla: Pedidos ************* -- ************************************** CREATE TABLE `Pedidos` ( `codPedido` int(11) NOT NULL, `codCliPedido` int(11) NOT NULL, `fechaPedido` date NOT NULL, `codEstadoPed` int(11) NOT NULL, `codFuentePed` int(11) NOT NULL, `codTipoPagoPed` int(11) NOT NULL, `PrecioTotal` double NOT NULL, Primary Key (codPedido), foreign key (codCliPedido) references Clientes(codCli), foreign key (codEstadoPed) references EstadosPedido(codEstadoPed), foreign key (codFuentePed) references FuentesPedido(codFuentePed), foreign key (codTipoPagoPed) references TiposPago(codTipoPago) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- ************************************** -- *** Crear tabla: LineasPedido ******** -- ************************************** CREATE TABLE `LineasPedido` ( `codLineaPed` int(11) NOT NULL, `codPedido` int(11) NOT NULL, `codArtLineaPed` int(11) NOT NULL, `cantArticulos` int(11) NOT NULL, Primary Key (codLineaPed), foreign key (codPedido) references Pedidos(codPedido), foreign key (codArtLineaPed) references Articulos(codArt) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
1. Write a SQL statement that will return the following result: id | author | categories ----+-----------------+-------------------------------- 1 | Charles Dickens | Fiction, Classics 2 | J. K. Rowling | Fiction, Fantasy 3 | Walter Isaacson | Nonfiction, Biography, Physics (3 rows) SELECT books.id, books.author, string_agg(categories.name, ', ') AS categories FROM books INNER JOIN books_categories ON books.id = books_categories.book_id INNER JOIN categories ON categories.id = books_categories.category_id GROUP BY books.id ORDER BY id; 2. Write SQL statements to insert the following new books into the database. What do you need to do to ensure this data fits in the database? Author Title Categories ------------------------------------------------------------------------------- Lynn Sherr Sally Ride: America''s First Woman in Space Biography, Nonfiction, Space Exploration Charlotte Brontë Jane Eyre Fiction, Classics Meeru Dhalwala and Vikram Vij Vij''s: Elegant and Inspired Indian Cuisine Cookbook, Nonfiction, South Asia ------------------------------------------------------------------------------- INSERT INTO categories (id, name) VALUES (7, 'Space Exploration'), (8, 'Cookbook'), (9, 'South Asia'); ALTER TABLE books ALTER COLUMN title TYPE VARCHAR(100), ALTER COLUMN author TYPE VARCHAR(100); INSERT INTO books (id, title, author) VALUES (4, 'Sally Ride: America''s First Woman in Space', 'Lynn Sherr'), (5, 'Jane Eyre', 'Charlotte Brontë'), (6, 'Vij''s: Elegant and Inspired Indian Cuisine', 'Meeru Dhalwala and Vikram Vij'); INSERT INTO books_categories (book_id, category_id) VALUES (4, 5), (4, 1), (4, 7), (5, 2), (5, 4), (6, 8), (6, 1), (6, 9); 3. Write a SQL statement to add a uniqueness constraint on the combination of columns book_id and category_id of the books_categories table. This constraint should be a table constraint; so, it should check for uniqueness on the combination of book_id and category_id across all rows of the books_categories table. ALTER TABLE books_categories ADD CONSTRAINT unique_book_id_category_id_pair UNIQUE (book_id, category_id); 4. Write a SQL statement that will return the following result: name | book_count | book_titles ------------------+------------+----------------------------------------------------------------------------- Biography | 2 | Einstein: His Life and Universe, Sally Ride: America's First Woman in Space Classics | 2 | A Tale of Two Cities, Jane Eyre Cookbook | 1 | Vij's: Elegant and Inspired Indian Cuisine Fantasy | 1 | Harry Potter Fiction | 3 | Jane Eyre, Harry Potter, A Tale of Two Cities Nonfiction | 3 | Sally Ride: America's First Woman in Space, Einstein: His Life and Universe, Vij's: Elegant and Inspired Indian Cuisine Physics | 1 | Einstein: His Life and Universe South Asia | 1 | Vij's: Elegant and Inspired Indian Cuisine Space Exploration | 1 | Sally Ride: America's First Woman in Space SELECT categories.name, count(books.id) AS book_count, string_agg(books.title, ', ') FROM books INNER JOIN books_categories ON books.id = books_categories.book_id INNER JOIN categories ON categories.id = books_categories.category_id GROUP BY categories.name ORDER BY categories.name;
--@Autor: Berdejo Arvizu Oscar || Olmos Cruz Edwin --@Fecha creación: 25/10/2018 --@Descripción: Creacion de Usuario --Usuario Admin: baoc_proy_admin --Usuario Invitado: baoc_proy_invitado Prompt secuendias de busqueda connect baoc_proy_admin --Muestra estudiantes, tesis y su director de tesis select t.nombre, et.clave, e.nombre, e.num_cuenta, p.nombre, p.RFC from tesis t join estudiante e on t.tesis_id = e.tesis_id join estatus et on et.estatus_id = t.estatus_id join PROFESOR_CARRERA pc on pc.profesor_id = t.director_id join profesor p on p.profesor_id = pc.profesor_id; --Muestra asignaturas necesarias select a.nombre as "Asignatura" , a.clave, a.num_semestre, ap.nombre as "Asignatura Previa", ap.clave, ap.num_semestre from asignatura a, asignatura ap where a.asignatura_previa = ap.asignatura_id; --Muestra la historia de los planes de estudio select p.clave, p.NOMBRE_P as "Viejo Plan", p.fecha_aprobacion, p.fecha_termino, ps.clave, ps.NOMBRE_P as "Nuevo Plan", ps.fecha_aprobacion from plan_estudios p, plan_estudios ps where p.plan_sustituto_id = ps.plan_estudios_id; --muestra estudiante con el estatus de su tesis select e.nombre, e.ap_paterno, e.ap_materno, e.num_cuenta, t.nombre, et.clave from estudiante e left join tesis t on t.tesis_id = e.tesis_id join ESTATUS et on et.ESTATUS_ID = t.estatus_id; --Estudiantes titulados select e.nombre, e.ap_paterno, e.ap_materno, e.num_cuenta, t.nombre, et.clave from estudiante e join tesis t on t.tesis_id = e.tesis_id join estatus et on et.ESTATUS_ID = t.estatus_id where et.clave = 'APROVADA'; --Mayores calificaciones de las materias select e.nombre, e.ap_paterno, e.ap_materno, a.nombre, c.CALIFICACION from estudiante e, inscripcion i, curso_inscripcion ci, asignatura a, CURSO c where e.estudiante_id = i.estudiante_id and i.inscripcion_id = ci.inscripcion_id and c.curso_id = ci.curso_id and a.asignatura_id = c.asignatura_id and c.CALIFICACION = ( select max(c2.CALIFICACION) from CURSO c2, curso_inscripcion ci2, inscripcion i2 where c2.curso_id = ci2.curso_id and i2.inscripcion_id = ci2.inscripcion_id and c2.asignatura_id = c.asignatura_id and i2.estudiante_id = i.estudiante_id );
drop table if exists rides_file_record ; create table rides_file_record( file_name varchar(200), loaded_timestamp timestamp with time zone not null default (now() at time zone 'utc'), -- if you dont specify the load time it will use the current time record_count int ) ;
--regulatory create sequence regulatory_seq start with 1 increment by 1; create table regulatory ( id integer generated by default as sequence regulatory_seq, client_id integer, regulator_id integer, regulation_type varchar(50) ); alter table regulatory add primary key(id); alter table regulatory add constraint fk_regulatory_client foreign key (client_id) references client(client_id) on delete cascade; alter table regulatory add constraint fk_regulatory_regulator foreign key (regulator_id) references regulator(id) on delete cascade; insert into regulatory values (null, 1, 1, 'financial'); insert into regulatory values (null, 1, 2, 'economical');
CREATE TABLE sav_abnormality ( idx integer PRIMARY KEY NOT NULL, pri_key text, stared integer)
alter table retirement add column metadata jsonb; create policy retirement_app_user_select on retirement for select to app_user using (true);
-- +goose Up -- SQL in section 'Up' is executed when this migration is applied create table meeting ( id serial8 PRIMARY KEY, name varchar(100), type varchar(20), created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, updated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ); -- +goose Down -- SQL section 'Down' is executed when this migration is rolled back drop table meeting cascade;
CREATE DATABASE instafake; \c instafake; CREATE TABLE Instagram (id SERIAL PRIMARY KEY, username VARCHAR(255), post VARCHAR(255), description VARCHAR(255),hashtags VARCHAR(255));
create database bd_portal; use bd_portal; -- tablas: usuarios, Login, Notas, Materias, -- drop database bd_portal; create table usuario( id int auto_increment primary key, usuario varchar(25), clave varchar(25) ); create table alumno( carnet int primary key not null, nombre varchar(50), carrera varchar(50), fech_nac date ); create table materia( cod_materia char(10) primary key not null, nombre varchar(50) ); create table notas( cod_materia char(10) not null, carnet_alumno int not null, nota double, foreign key(cod_materia) references materia(cod_materia), foreign key(carnet_alumno) references alumno(carnet) );
SET FOREIGN_KEY_CHECKS = 0; CREATE DATABASE IF NOT EXISTS `shorturl` CHARACTER SET utf8 COLLATE latin1_swedish_ci; USE shorturl; CREATE TABLE IF NOT EXISTS `hits` ( `hit_id` int(11) NOT NULL AUTO_INCREMENT, `link_id` int(11) NOT NULL, `refer` varchar(150) NOT NULL, `user_ip` varchar(16) NOT NULL, `access_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `browser` varchar(30) NOT NULL, `browser_version` varchar(10) NOT NULL, `os` varchar(30) NOT NULL, `country` varchar(15) NOT NULL, `region` varchar(15) NOT NULL, `city` varchar(30) NOT NULL, `zipcode` int(11) NOT NULL, `lat` float NOT NULL, `lon` float NOT NULL, PRIMARY KEY (`hit_id`), KEY `link_id` (`link_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=105 ; CREATE TABLE IF NOT EXISTS `links` ( `id` int(11) NOT NULL AUTO_INCREMENT, `short` varchar(15) NOT NULL, `long` varchar(300) NOT NULL, `creation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
-- phpMyAdmin SQL Dump -- version 4.8.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 15, 2018 at 08:31 PM -- Server version: 10.1.34-MariaDB -- PHP Version: 5.6.37 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: `cricket_club` -- -- -------------------------------------------------------- -- -- Table structure for table `club_data` -- CREATE TABLE `club_data` ( `club_id` int(20) NOT NULL, `club_name` varchar(500) NOT NULL, `date_of_est` date NOT NULL, `house_no` int(10) DEFAULT NULL, `location` varchar(250) DEFAULT NULL, `village_str` varchar(250) DEFAULT NULL, `thana` varchar(250) DEFAULT NULL, `district` varchar(250) NOT NULL, `post_code` int(10) DEFAULT NULL, `president_name` varchar(500) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `club_data` -- INSERT INTO `club_data` (`club_id`, `club_name`, `date_of_est`, `house_no`, `location`, `village_str`, `thana`, `district`, `post_code`, `president_name`) VALUES (11321, 'INDEPENDENT', '2015-01-01', 0, '', '', '', 'Dhaka', 0, 'Sumon'), (1250, 'ars', '2018-08-15', 0, '', '', '', 'bogra', 0, 'shohag'), (99554, 'ONE', '2018-08-08', 0, '', '', '', 'Dhaka', 0, 'M_One'); -- -------------------------------------------------------- -- -- Table structure for table `contract_data` -- CREATE TABLE `contract_data` ( `club_id` int(20) NOT NULL, `club_name3` varchar(250) NOT NULL, `f_name` varchar(250) NOT NULL, `m_name` varchar(250) DEFAULT NULL, `l_name` varchar(250) DEFAULT NULL, `player_id` int(20) NOT NULL, `f_name2` varchar(250) NOT NULL, `m_name2` varchar(250) DEFAULT NULL, `l_name2` varchar(250) DEFAULT NULL, `designation` varchar(250) NOT NULL, `start_day` date NOT NULL, `end_day` date NOT NULL, `c_amount` int(20) NOT NULL, `c_witness1` varchar(500) NOT NULL, `c_witness2` varchar(500) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `contract_data` -- INSERT INTO `contract_data` (`club_id`, `club_name3`, `f_name`, `m_name`, `l_name`, `player_id`, `f_name2`, `m_name2`, `l_name2`, `designation`, `start_day`, `end_day`, `c_amount`, `c_witness1`, `c_witness2`) VALUES (11321, 'national', 'sumon', '', '', 5522, 'Ahshanul', '', '', 'Register executive', '2018-08-01', '2020-08-20', 20000, 'Rouf', ''); -- -------------------------------------------------------- -- -- Table structure for table `match_data` -- CREATE TABLE `match_data` ( `event_id` int(20) NOT NULL, `vanue_id` varchar(200) NOT NULL, `match_date` date NOT NULL, `match_id` int(20) NOT NULL, `man_of_the_match` varchar(250) DEFAULT NULL, `umpire` varchar(250) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `match_data` -- INSERT INTO `match_data` (`event_id`, `vanue_id`, `match_date`, `match_id`, `man_of_the_match`, `umpire`) VALUES (11321, 'dk_02', '2013-01-01', 31, '', ''); -- -------------------------------------------------------- -- -- Table structure for table `payment_sch` -- CREATE TABLE `payment_sch` ( `serial_num1` int(20) DEFAULT NULL, `serial_num2` int(20) DEFAULT NULL, `serial_num3` int(20) DEFAULT NULL, `due_date1` date DEFAULT NULL, `due_date2` date DEFAULT NULL, `due_date3` date DEFAULT NULL, `payment_date1` date DEFAULT NULL, `payment_date2` date DEFAULT NULL, `payment_date3` date DEFAULT NULL, `amount1` int(40) DEFAULT NULL, `amount2` int(40) DEFAULT NULL, `amount3` int(40) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `payment_sch` -- INSERT INTO `payment_sch` (`serial_num1`, `serial_num2`, `serial_num3`, `due_date1`, `due_date2`, `due_date3`, `payment_date1`, `payment_date2`, `payment_date3`, `amount1`, `amount2`, `amount3`) VALUES (1, 2, 3, '2018-08-01', '2018-08-03', '2018-08-05', '2018-08-02', '2018-08-04', '2018-08-06', 10000, 5000, 5000); -- -------------------------------------------------------- -- -- Table structure for table `player_data1` -- CREATE TABLE `player_data1` ( `player_id` int(10) NOT NULL, `first_name` varchar(50) NOT NULL, `mid_name` varchar(50) DEFAULT NULL, `last_name` varchar(50) DEFAULT NULL, `father_name` varchar(40) NOT NULL, `mother_name` varchar(40) NOT NULL, `present_address` varchar(300) DEFAULT NULL, `parmanent_address` varchar(300) DEFAULT NULL, `date_of_birth` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `player_data1` -- INSERT INTO `player_data1` (`player_id`, `first_name`, `mid_name`, `last_name`, `father_name`, `mother_name`, `present_address`, `parmanent_address`, `date_of_birth`) VALUES (11321, 'sumon', '', 'shahed', 'father', 'mother', 'House no: 11Location: baddaVillage/Street: thana roadThana: vataraDistrict: dhakaPost Code: 1212', 'House no:111Location:baddaVillage/Street:thana roadThana:vataraDistrict:dhakaPost Code:1212', '1997-01-11'); -- -------------------------------------------------------- -- -- Table structure for table `player_edu` -- CREATE TABLE `player_edu` ( `player_id` int(20) NOT NULL, `deg_name` varchar(20) NOT NULL, `institute_dept` varchar(200) NOT NULL, `board_university` varchar(200) NOT NULL, `year` int(4) NOT NULL, `result` varchar(15) NOT NULL, `membership` varchar(200) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `player_edu` -- INSERT INTO `player_edu` (`player_id`, `deg_name`, `institute_dept`, `board_university`, `year`, `result`, `membership`) VALUES (11321, 'UG', 'ECE', 'NSU', 2020, 'studying', 'ICCB'); -- -------------------------------------------------------- -- -- Table structure for table `player_history` -- CREATE TABLE `player_history` ( `player_id` int(20) NOT NULL, `club_name` varchar(250) NOT NULL, `start_day` date DEFAULT NULL, `end_day` date DEFAULT NULL, `total_run` int(10) DEFAULT NULL, `total_wickets` int(10) DEFAULT NULL, `team_leader` varchar(5) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `player_history` -- INSERT INTO `player_history` (`player_id`, `club_name`, `start_day`, `end_day`, `total_run`, `total_wickets`, `team_leader`) VALUES (11321, 'independent', '2015-01-01', '2015-10-10', 100, 5, 'team_'); -- -------------------------------------------------------- -- -- Table structure for table `player_perform` -- CREATE TABLE `player_perform` ( `player_id` int(10) NOT NULL, `club_name2` varchar(150) NOT NULL, `oppo_club` varchar(150) NOT NULL, `event_id` int(20) NOT NULL, `match_id` int(20) NOT NULL, `run` int(10) DEFAULT NULL, `wicket` int(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `player_perform` -- INSERT INTO `player_perform` (`player_id`, `club_name2`, `oppo_club`, `event_id`, `match_id`, `run`, `wicket`) VALUES (11321, 'independent ', 'maxwar', 55, 3, 59, 3); -- -------------------------------------------------------- -- -- Table structure for table `pl_perform` -- CREATE TABLE `pl_perform` ( `match_id` int(20) NOT NULL, `vanue_id` varchar(20) NOT NULL, `match_date` date NOT NULL, `player_id_a1` int(20) DEFAULT NULL, `player_id_a2` int(20) DEFAULT NULL, `player_id_b1` int(20) DEFAULT NULL, `player_id_b2` int(20) DEFAULT NULL, `tot_wic_a1` int(20) DEFAULT NULL, `tot_wic_a2` int(20) DEFAULT NULL, `tot_wic_b1` int(20) DEFAULT NULL, `tot_wic_b2` int(20) DEFAULT NULL, `tot_run_a1` int(20) DEFAULT NULL, `tot_run_a2` int(20) DEFAULT NULL, `tot_run_b1` int(20) DEFAULT NULL, `tot_run_b2` int(20) DEFAULT NULL, `perform_pt_a1` int(2) DEFAULT NULL, `perform_pt_a2` int(2) DEFAULT NULL, `perform_pt_b1` int(2) DEFAULT NULL, `perform_pt_b2` int(2) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `pl_perform` -- INSERT INTO `pl_perform` (`match_id`, `vanue_id`, `match_date`, `player_id_a1`, `player_id_a2`, `player_id_b1`, `player_id_b2`, `tot_wic_a1`, `tot_wic_a2`, `tot_wic_b1`, `tot_wic_b2`, `tot_run_a1`, `tot_run_a2`, `tot_run_b1`, `tot_run_b2`, `perform_pt_a1`, `perform_pt_a2`, `perform_pt_b1`, `perform_pt_b2`) VALUES (11321, 'dh_mrpr1', '2016-01-01', 1, 9, 5, 9, 6, 8, 65, 8, 3, 5, 4, 65, 1, 3, 4, 5); -- -------------------------------------------------------- -- -- Table structure for table `team_data` -- CREATE TABLE `team_data` ( `club_id` int(20) NOT NULL, `team_id` int(20) NOT NULL, `formation_date` date NOT NULL, `event_id` int(20) NOT NULL, `leader_id` int(20) NOT NULL, `leader_name` varchar(250) DEFAULT NULL, `coach_id` int(20) DEFAULT NULL, `coach_name` varchar(250) DEFAULT NULL, `player_id` int(20) DEFAULT NULL, `player_name` varchar(250) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `team_data` -- INSERT INTO `team_data` (`club_id`, `team_id`, `formation_date`, `event_id`, `leader_id`, `leader_name`, `coach_id`, `coach_name`, `player_id`, `player_name`) VALUES (11321, 11321, '2014-01-01', 11321, 11321, '', 0, '', 0, ''); -- -- Indexes for dumped tables -- -- -- Indexes for table `match_data` -- ALTER TABLE `match_data` ADD PRIMARY KEY (`match_id`); -- -- Indexes for table `player_data1` -- ALTER TABLE `player_data1` ADD PRIMARY KEY (`player_id`); -- -- Indexes for table `player_edu` -- ALTER TABLE `player_edu` ADD PRIMARY KEY (`player_id`); -- -- Indexes for table `player_history` -- ALTER TABLE `player_history` ADD PRIMARY KEY (`player_id`); -- -- Indexes for table `player_perform` -- ALTER TABLE `player_perform` ADD PRIMARY KEY (`player_id`); -- -- Indexes for table `pl_perform` -- ALTER TABLE `pl_perform` ADD PRIMARY KEY (`match_id`); -- -- Indexes for table `team_data` -- ALTER TABLE `team_data` ADD PRIMARY KEY (`team_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 */;
/* Navicat MySQL Data Transfer Source Server : UnityMMO Source Server Version : 50640 Source Host : 192.168.5.132:3306 Source Database : UnityMMOGame Target Server Type : MYSQL Target Server Version : 50640 File Encoding : 65001 Date: 2019-08-24 16:33:42 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for AttrInfo -- ---------------------------- DROP TABLE IF EXISTS `AttrInfo`; CREATE TABLE `AttrInfo` ( `role_id` bigint(60) unsigned NOT NULL, `att` int(255) unsigned zerofill DEFAULT NULL, `hp` int(255) unsigned zerofill DEFAULT NULL, `def` int(255) unsigned zerofill DEFAULT NULL, `crit` int(255) unsigned zerofill DEFAULT NULL, `hit` int(255) unsigned zerofill DEFAULT NULL, `dodge` int(255) unsigned zerofill DEFAULT NULL, PRIMARY KEY (`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for Bag -- ---------------------------- DROP TABLE IF EXISTS `Bag`; CREATE TABLE `Bag` ( `uid` bigint(20) unsigned NOT NULL, `typeID` int(10) unsigned NOT NULL, `roleID` bigint(20) unsigned NOT NULL, `pos` tinyint(10) unsigned NOT NULL, `cell` smallint(10) unsigned NOT NULL, `num` int(10) unsigned NOT NULL, PRIMARY KEY (`uid`), KEY `role_id` (`roleID`,`pos`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for BagInfo -- ---------------------------- DROP TABLE IF EXISTS `BagInfo`; CREATE TABLE `BagInfo` ( `role_id` bigint(20) unsigned zerofill NOT NULL, `pos` varchar(255) DEFAULT NULL, `cell_num` mediumint(10) unsigned zerofill NOT NULL, KEY `role_id` (`role_id`,`pos`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for RoleBaseInfo -- ---------------------------- DROP TABLE IF EXISTS `RoleBaseInfo`; CREATE TABLE `RoleBaseInfo` ( `role_id` bigint(20) unsigned NOT NULL, `name` varchar(18) NOT NULL, `career` tinyint(4) NOT NULL, `level` smallint(5) unsigned DEFAULT '0', `scene_id` int(11) DEFAULT NULL, `pos_x` int(11) DEFAULT NULL, `pos_y` int(11) DEFAULT NULL, `pos_z` int(11) DEFAULT NULL, `coin` int(11) unsigned zerofill DEFAULT NULL, `diamond` int(11) unsigned zerofill DEFAULT NULL, `hp` int(11) unsigned zerofill NOT NULL, PRIMARY KEY (`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for RoleList -- ---------------------------- DROP TABLE IF EXISTS `RoleList`; CREATE TABLE `RoleList` ( `account_id` bigint(20) unsigned NOT NULL, `role_id` bigint(20) unsigned NOT NULL, `create_time` bigint(20) unsigned NOT NULL, KEY `account_id` (`account_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for RoleLooksInfo -- ---------------------------- DROP TABLE IF EXISTS `RoleLooksInfo`; CREATE TABLE `RoleLooksInfo` ( `role_id` bigint(64) NOT NULL, `body` int(10) DEFAULT NULL, `hair` int(10) DEFAULT NULL, `weapon` int(10) DEFAULT NULL, `wing` int(10) DEFAULT NULL, PRIMARY KEY (`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for TaskList -- ---------------------------- DROP TABLE IF EXISTS `TaskList`; CREATE TABLE `TaskList` ( `id` bigint(60) NOT NULL AUTO_INCREMENT, `roleID` bigint(60) NOT NULL, `taskID` int(11) NOT NULL, `status` tinyint(5) DEFAULT NULL, `subTaskIndex` tinyint(10) unsigned zerofill DEFAULT NULL, `subType` int(10) DEFAULT NULL, `curProgress` int(8) unsigned zerofill DEFAULT NULL, `maxProgress` int(8) unsigned DEFAULT NULL, `contentID` int(8) DEFAULT NULL, PRIMARY KEY (`id`), KEY `role_id` (`roleID`) ) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1;
CREATE DATABASE containers_db; USE containers_db; CREATE TABLE containers_info (container_id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), created_at BIGINT, status VARCHAR(255), cpu INT, memory_usage INT ); CREATE TABLE containers_addresses (id INT AUTO_INCREMENT PRIMARY KEY, container_id INT, address VARCHAR(255));
SELECT DNUM AS FOLIO, DREFERELLOS AS REFERENCIA, DPAR0 AS PROVEEDOR, TIDESCR AS TIPO_MOV, IF(CATDESCR='IBUSHAK/MERCADO LIBRE','MERCADO LIBRE', IF(CATDESCR='MERCADO LIBRE TOXIC','MERCADO LIBRE', IF(CATDESCR='MERCADO LIBRE FULL','MERCADO LIBRE', IF(CATDESCR='AMAZON COMER','AMAZON', IF(CATDESCR='AMAZON EN CEDIS','AMAZON', IF(CATDESCR='ALMACEN B2B LEKRASH','SHOPIFY', CATDESCR )))))) AS TIENDA, IEAN AS EAN, ICOD AS MODELO, IDESCR AS DESCRIPCION, FAM2.FAMDESCR AS DEPARTAMENTO, FAM3.FAMDESCR AS TIPO, FAM4.FAMDESCR AS SUBTIPO, FAM5.FAMDESCR AS PERSONAJE, FAM6.FAMDESCR AS TRIMESTRE, FAM7.FAMDESCR AS DISEÑADOR, FAM8.FAMDESCR AS LICENCIA, FAM9.FAMDESCR AS 'TIPO DE LICENCIA', AICANT AS UNIDADES, AICOSTO AS 'COSTO CON IVA', AICOSTO * AICANTF * 1.16 AS 'COSTO TOTAL', AIPRECIO AS PRECIO, AIPRECIO * 1.16 AS 'PRECIO CON IVA', ROUND((AICANTF*AIPRECIO)+(IF(IPORCIVA=0,(AICANTF*AIPRECIO)*((DPORCIVA/100)),0)),2)AS 'PRECIO TOTAL', MID(ICOD,1,11)AS 'MODELO COLOR', DFECHA AS FECHA, IF(IPORCIVA=0,'16%','EXENTO') as 'TIPO DE IVA', IF(DCANCELADA=0,'NO','CANCELADO') as CANCELADO, DFOLIO AS ORIGEN FROM FAXINV LEFT JOIN FDOC ON FDOC.DSEQ=FAXINV.DSEQ LEFT JOIN FINV ON FINV.ISEQ=FAXINV.ISEQ LEFT JOIN FCLI ON FCLI.CLISEQ=FDOC.CLISEQ LEFT JOIN FUNIDAD ON FUNIDAD.UCOD=FINV.IUM LEFT JOIN FALMCAT ON FALMCAT.CATALM = FAXINV.AIALMACEN LEFT JOIN FAG ON FAG.AGTNUM = FDOC.DPAR1 LEFT JOIN FTIPMV ON FTIPMV.TICLA = FDOC.DITIPMV LEFT JOIN FFAM AS FAM1 ON FAM1.FAMTNUM=FINV.IFAM1 LEFT JOIN FFAM AS FAM2 ON FAM2.FAMTNUM=FINV.IFAM2 LEFT JOIN FFAM AS FAM3 ON FAM3.FAMTNUM=FINV.IFAM3 LEFT JOIN FFAM AS FAM4 ON FAM4.FAMTNUM=FINV.IFAM4 LEFT JOIN FFAM AS FAM5 ON FAM5.FAMTNUM=FINV.IFAM5 LEFT JOIN FFAM AS FAM6 ON FAM6.FAMTNUM=FINV.IFAM6 LEFT JOIN FFAM AS FAM7 ON FAM7.FAMTNUM=FINV.IFAM7 LEFT JOIN FFAM AS FAM8 ON FAM8.FAMTNUM=FINV.IFAM8 LEFT JOIN FFAM AS FAM9 ON FAM9.FAMTNUM=FINV.IFAM9 LEFT JOIN FFAM AS FAMA ON FAMA.FAMTNUM=FINV.IFAMA WHERE (DITIPMV='I' OR DITIPMV='IF') AND (AIALMACEN <> 0 AND AIALMACEN <> 910 AND AIALMACEN <> 911 AND AIALMACEN <> 912 AND AIALMACEN <> 913 AND AIALMACEN <> 914 AND AIALMACEN <> 915 AND AIALMACEN <> 916 AND AIALMACEN <> 917 AND AIALMACEN <> 918 AND AIALMACEN <> 920 AND AIALMACEN <> 921 AND AIALMACEN <> 923 AND AIALMACEN <> 928) AND ITIPO = 1 AND AICANT <> 0
-- Inicializa usuario delete from usuario_perfil_empleado where id_usuario_perfil_empleado >=1; delete from empleado where id_empleado >=1; delete from usuario_perfil_empresa_rol where id_empresa_cat_rol >=1; delete from usuario_perfil_empresa where id_usuario_perfil_empresa >=1; delete from usuario_perfil_contador where id_usuario_perfil_contador >=1; delete from contador where id_contador >=1; delete from usuario_perfil where id_perfil >= 1; -- borrado de usuarios delete from billez_billez.datos_generales_usuario where id_datos_generales >=1; delete from usuario_token where idusuario_token>=1; delete from usuario where id_usuario >=1; -- Cuentas bancarias delete from cuenta_bancaria where id_cuenta_bancaria >=1; -- borrado de domicilios delete from domicilio_cliente where id_domicilio_cliente >=1; delete from domicilio_empleado where id_domicilio_empleado >= 1; delete from empresa_domicilio where id_empresa_domicilio >=1; delete from domicilio where id_domicilio >=1; -- Inicia borrado de facturas delete from impuesto where id_impuesto >=0; delete from retencion where id_retencion >=0; delete from descuento where id_descuento >=0; delete from complemento_factura where id_complemento_factura >= 0; delete from factura_sello where id_factura_sello >= 0; delete from factura_certificado where id_factura_certificado >=0; delete from emisor_factura where id_emisor_factura >=0; delete from receptor_factura where id_receptor_factura >=0; delete from bitacora_factura where id_bitacora_factura >=0; delete from factura_pago where id_factura_pago >=0; delete from concepto_comprobante where id_concepto_comp >= 1; delete from concepto_factura where id_concepto >=0; delete from factura where id_factura >=1; -- borrado de clientes delete from empresa_cliente where id_empresa_cliente >=1; delete from cliente_contacto where id_cliente_contacto >=1; delete from cliente where id_cliente >=1; -- borrado de empresa delete from folio where id_folio >=1; delete from serie where id_serie >= 1; delete from cat_lugar_expedicion where id_cat_lugar_expedicion >= 1; delete from empresa_domicilio where id_empresa_domicilio >=1; delete from empresa_enrolamiento where id_empresa_enrolamiento >=1; delete from empresa_logo where id_empresa_logo >=1; delete from empresa_regimen_fiscal where id_empresa_regimen >=1; -- borrado de clientes delete from contacto where id_contacto >= 1; delete from domicilio where id_domicilio >=1; delete from empresa_cobranza_detalle where id_empresa_cobranza_detalle >=1; delete from empresa_cobranza where id_empresa_cobranza >=1; delete from empresa where id_empresa >=1;
create table races ( id SERIAL PRIMARY KEY, name VARCHAR(50), location VARCHAR(50), date DATE, created_at DATE, updated_at DATE ); insert into races (id, name, location, date, created_at, updated_at) values (1, 'races1', 'China', '6/8/2021', '6/1/2021', '12/2/2020'); insert into races (id, name, location, date, created_at, updated_at) values (2, 'races2', 'Macedonia', '7/9/2021', '5/3/2021', '7/4/2021'); insert into races (id, name, location, date, created_at, updated_at) values (3, 'races3', 'Indonesia', '8/10/2021', '6/5/2021', '10/6/2021'); insert into races (id, name, location, date, created_at, updated_at) values (4, 'races4', 'Kazakhstan', '9/11/2021', '11/7/2021', '12/8/2021'); insert into races (id, name, location, date, created_at, updated_at) values (5, 'races5', 'China', '10/12/2021', '3/9/2021', '4/10/2021');
SELECT 'Bilonozhko' student FROM DUAL;
-- This file should undo anything in `up.sql` ALTER TABLE `user_club_relation` DROP `is_visible`;