text
stringlengths
6
9.38M
INSERT INTO users VALUES (1, CURRENT_TIMESTAMP, 'mdsacra@gmail.com', 'Matheus Sacramento', 'mdsacra', '123');
select StudentRefID = s.GStudentID, EPRefID = ic.IEPSeqNum, StudentID = s.StudentiD, s.Firstname, s.Lastname, Birthdate = isnull(convert(varchar, s.Birthdate, 101), ''), EPMeetingDate = isnull(convert(varchar, ic.MeetDate, 101), ''), -- EPInitDate = isnull(convert(varchar, ic.InitDate, 101), ''), LastEPDate = isnull(convert(varchar, ic.LastIEPDate, 101), ''), -- EPSpecReviewDate = isnull(convert(varchar, ic.ReEvalDate, 101), ''), DurationDate = isnull(convert(varchar, ic.Durationdate, 101), '') from SpecialEdStudentsAndIEPs x join IEPCompleteTbl ic on x.iepseqnum = ic.iepseqnum join student s on ic.gstudentid = s.gstudentid where x.SpedOrGifted = 'Gifted'
insert into DinningHall (name,Dinning_Manager) values('JJ','Mike Carlon'); insert into DinningHall (name,Dinning_Manager) values('Cartlon','Steve Goldman'); insert into DinningHall (name,Dinning_Manager) values('Mudd','Janet Chung'); insert into DinningHall (name,Dinning_Manager) values('Unris','Isabella Clark'); insert into DinningHall (name,Dinning_Manager) values('Farros Beeth','Matthew Thomas'); insert into DinningHall (name,Dinning_Manager) values('Hartlay','William Martinez'); insert into DinningHall (name,Dinning_Manager) values('Warlork','Madison Taylor');
CREATE VIEW jobcompanylocation AS SELECT job.id, job.revision, job.title, job."date", job.expiration, job.reference, job."url", job.publisherid, job.companyid, job.locationid, job."description", job.requirements, job.offers, job.descriptiontype, job.salary, job.jobtype, job.experience, job.categories, job.education, publisher."name" as publishername, publisher."url" as publisherurl, company."name" as companyname, company."url" as companyurl, companyaddress.country, companyaddress."state", companyaddress.city, companyaddress.postalcode, companyaddress.line FROM job JOIN companyaddress on companyaddress.id=job.locationid LEFT JOIN company as publisher on publisher.id=job.publisherid LEFT JOIN company on company.id=job.companyid
Add a Moons Table Someday in the future, technology will allow us to start observing the moons of extrasolar planets. At that point, we''re going to need a moons table in our extrasolar database. For this exercise, your task is to add that table to the database. The table should include the following data: id: a unique serial number that auto-increments and serves as a primary key for this table. designation: the designation of the moon. We will assume that moon designations will be numbers, with the first moon discovered for each planet being moon 1, the second moon being moon 2, etc. The designation is required. semi_major_axis: the average distance in kilometers from the planet when a moon is farthest from its corresponding planet. This field must be a number greater than 0, but is not required; it may take some time before we are able to measure moon-to-planet distances in extrasolar systems. mass: the mass of the moon measured in terms of Earth Moon masses. This field must be a numeric value greater than 0, but is not required. Make sure you also specify any foreign keys necessary to tie each moon to other rows in the database. CREATE TABLE moons( id SERIAL PRIMARY KEY, designation INTEGER UNIQUE NOT NULL CHECK (designation > 0), semi_major_axis NUMERIC CHECK (semi_major_axis > 0), mass NUMERIC CHECK (mass > 0), planet_id INTEGER NOT NULL REFERENCES planets (id) );
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * Author: silve * Created: May 31, 2020 * Edited by: Kira */ DROP TABLE Payment_Table CREATE TABLE Payment_Table ( PaymentID INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), OrderID INT NOT NULL, paymentMethod VARCHAR(20), cardNo VARCHAR(20), datePaid VARCHAR(20), PRIMARY KEY (PaymentID), FOREIGN KEY (OrderID) REFERENCES order_Table(OrderID)); INSERT INTO Payment_Table(OrderID, PaymentMethod, CardNo, datePaid) VALUES (1,'Mastercard','1234567154661288', '2019-12-15'), (2,'Visa','2222 531503151562', '2020-06-28'), (3,'Visa','1111 136415313156', '2020-06-28'), (4,'Mastercard','106648648746 5648', '2020-06-29'), (5,'Mastercard','106615691354 3146', '2020-06-29'), (6,'Mastercard','106613251356 1548', '2020-06-29'), (7,'Mastercard','5354231835468435', '2020-06-29'), (8,'Mastercard','5354135431851354', '2020-06-29'), (9,'Mastercard','5354168715641384', '2020-06-29'), (10,'Mastercard','5354 464818656468', '2020-06-30'), (11,'Mastercard','7901646516346486', '2020-06-30'), (12,'Mastercard','7901245454691864', '2020-06-30'), (13,'American Express','5062646448625848', '2020-06-30'), (14,'American Express','5062546834861548', '2020-06-30'), (15,'Visa','0590487948741418', '2020-06-30'), (16,'American Express','2485145615481583', '2020-07-01'), (17,'Visa','0590186848916862', '2020-07-01'), (18,'Mastercard','0777568468694644', '2020-07-01'), (19,'Mastercard','0777265959546953', '2020-07-01'), (20,'Mastercard','0777586418643984', '2020-07-01'), (5, 'MasterCard', '4920183759381729', '2020-01-19'), (4, 'Mastercard', '4920183759381729', '2020-01-17') (8, 'Mastercard', '4920183759381729', '2020-04-11'), (17, 'Mastercard', '4920183759381729', '2020-06-19'), (21, 'Mastercard', '4920183759381729', '2020-10-11');
DROP TABLE IF EXISTS user; CREATE TABLE user ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT UNIQUE NOT NULL, password TEXT NOT NULL ); /* Code from https://flask.palletsprojects.com/en/2.0.x/tutorial/database/ */
# Del valeur 5/6 : Del User-Val DELETE FROM `user_valeur_champ` WHERE `fk_client` = :client AND `fk_monde` = :monde AND `fk_champ` = :champ AND `fk_valeur_champ` = :pk ;
ALTER TABLE users ADD hire_date timestamp NULL DEFAULT NULL;
SELECT * FROM Student,Links WHERE Student.studentId > 2 AND Links.linkId = 1;
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: 04 Apr 2016 pada 15.17 -- Versi Server: 10.1.8-MariaDB -- PHP Version: 5.5.30 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `crud` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `mahasiswa` -- CREATE TABLE `mahasiswa` ( `id` int(11) NOT NULL, `nim` varchar(15) NOT NULL, `nama` varchar(50) NOT NULL, `jurusan` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `mahasiswa` -- INSERT INTO `mahasiswa` (`id`, `nim`, `nama`, `jurusan`) VALUES (12, 's', 'erik', 'ti'); -- -- Indexes for dumped tables -- -- -- Indexes for table `mahasiswa` -- ALTER TABLE `mahasiswa` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `mahasiswa` -- ALTER TABLE `mahasiswa` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; /*!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 */;
-- mokykla: kodas, adresas, pavadinimas, direktorius, mokiniu skaicius (default 0) INSERT INTO Mokykla VALUES(617283, 'Zariju g. 5', 'Liepu gimnazija', 'Aldona Aldoniene') ; --dalykas: nr (generated), pavadinimas, mokytoju sk (default 0) INSERT INTO Dalykas VALUES(DEFAULT, 'Lietuviu kalba') ; INSERT INTO Dalykas VALUES(DEFAULT, 'Matematika') ; INSERT INTO Dalykas VALUES(DEFAULT, 'Chemija') ; INSERT INTO Dalykas VALUES(DEFAULT, 'Biologija') ; INSERT INTO Dalykas VALUES(DEFAULT, 'Vokieciu kalba') ; INSERT INTO Dalykas VALUES(DEFAULT, 'Kuno kultura') ; --mokytojas: nr, mokykla, vardas, pavarde, dalykas INSERT INTO Mokytojas VALUES(999999, 'Liepu gimnazija', 'Aurelija', 'Aurelioniene', 'Biologija') ; INSERT INTO Mokytojas VALUES(999998, 'Liepu gimnazija', 'Jane', 'Janiniene', 'Chemija') ; INSERT INTO Mokytojas VALUES(999997, 'Liepu gimnazija', 'Irena', 'Ireniene', 'Lietuviu kalba') ; INSERT INTO Mokytojas VALUES(999996, 'Liepu gimnazija', 'Tomas', 'Tomauskas', 'Matematika') ; INSERT INTO Mokytojas VALUES(999995, 'Liepu gimnazija', 'Aurelija', 'Aureliene', 'Matematika') ; INSERT INTO Mokytojas VALUES(999994, 'Liepu gimnazija', 'Jonas', 'Jonienius', 'Vokieciu kalba') ; INSERT INTO Mokytojas VALUES(999993, 'Liepu gimnazija', 'Paulius', 'Paulienius', 'Informatika') ; INSERT INTO Mokytojas VALUES(999991, 'Liepu gimnazija', 'Janina', 'Janiene', 'Lietuviu kalba') ; INSERT INTO Mokytojas VALUES(999990, 'Liepu gimnazija', 'Luka', 'Lukiene', 'Kuno kultura') ; INSERT INTO Mokytojas VALUES(999000, 'Liepu gimnazija', 'Lukas', 'Lukauskas', 'Kuno kultura') ; --klase: pavadinimas, mokyklos pavadinimas INSERT INTO Klase VALUES('10A', 'Liepu gimnazija') ; INSERT INTO Klase VALUES('11A', 'Liepu gimnazija') ; INSERT INTO Klase VALUES('11F', 'Liepu gimnazija') ; INSERT INTO Klase VALUES('5A', 'Liepu gimnazija') ; INSERT INTO Klase VALUES('6A', 'Liepu gimnazija') ; INSERT INTO Klase VALUES('7A', 'Liepu gimnazija') ; INSERT INTO Klase VALUES('7B', 'Liepu gimnazija') ; --globejas: ak, vardas, pavarde INSERT INTO Globejas VALUES(44805197481, 'Aukse', 'Auksieniene') ; INSERT INTO Globejas VALUES(45609137121, 'Gabija', 'Gabijeniene') ; INSERT INTO Globejas VALUES(44812071200, 'Skaiste', 'Skaistiene') ; INSERT INTO Globejas VALUES(38111171100, 'Julius', 'Julenas') ; INSERT INTO Globejas VALUES(37911171162, 'Aurimas', 'Aurenas') ; INSERT INTO Globejas VALUES(37608309173, 'Sarunas', 'Sarunenas') ; INSERT INTO Globejas VALUES(65432123456, 'Sarunas', 'Sarunenas') ; --mokinys: nr, ak, vardas, pavarde, gimimo data, adresas, globejo ak, klases pavadinimas INSERT INTO Mokinys VALUES(111001, '00000000001', 'Simas', 'Simaitis', '2001-09-01', 'Guobu g. 9-5', 44805197481, '11F') ; INSERT INTO Mokinys VALUES(111002, '00000000002', 'Sima', 'Simaityte', '2001-09-01', 'Guobu g. 9-5', 44805197481, '11F') ; INSERT INTO Mokinys VALUES(111003, '00000000003', 'Lukas', 'Lukaitis', '2001-10-01', 'Baltoji g. 99-10', 45609137121, '11F') ; INSERT INTO Mokinys VALUES(111004, '00000000004', 'Ramunas', 'Julenas', '2001-11-01', 'Isiuteliu g. 68-71', 38111171100, '11F') ; INSERT INTO Mokinys VALUES(111005, '00000000005', 'Rima', 'Rimaityte', '2001-08-01', 'Guobu g. 9-5', 44805197481, '11F') ; INSERT INTO Mokinys VALUES(111006, '00000000006', 'Ela', 'Aurenaite', '2001-12-01', 'Kaimynu g. 88-31', 37911171162, '11F') ; INSERT INTO Mokinys VALUES(111007, '00000000007', 'Daiva', 'Aurenaite', '2001-12-08', 'Kaimynu g. 88-31', 37911171162, '11F') ; INSERT INTO Mokinys VALUES(111008, '00000000008', 'Dominykas', 'Aurenas', '2001-09-15', 'Kaimynu g. 88-31', 37911171162, '11F') ; INSERT INTO Mokinys VALUES(111009, '00000000009', 'Jokubas', 'Aurenas', '2001-02-14', 'Kaimynu g. 88-31', 37911171162, '11F') ; INSERT INTO Mokinys VALUES(111010, '00000000010', 'Matas', 'Mataitis', '2001-02-16', 'Guobu g. 9-5', 44805197481, '11F') ; INSERT INTO Mokinys VALUES(111011, '00000000011', 'Leja', 'Sarunenaite', '2001-08-20', 'Lauzu g. 15-32', 37608309173, '11F') ; INSERT INTO Mokinys VALUES(111012, '00000000012', 'Simona', 'Simonyte', '2001-09-30', 'Guobu g. 9-5', 44805197481, '11F') ; INSERT INTO Mokinys VALUES(111013, '00000000013', 'Kleja', 'Klejyte', '2001-05-13', 'Guobu g. 9-5', 44805197481, '11F') ; INSERT INTO Mokinys VALUES(111014, '00000000014', 'Juozas', 'Sarunenas', '2001-12-12', 'Lauzu g. 15-32', 37608309173, '11F') ; INSERT INTO Mokinys VALUES(111015, '00000000015', 'Herkus', 'Julenas', '2001-09-12', 'Isiuteliu g. 68-71', 38111171100, '11F') ; INSERT INTO Mokinys VALUES(111016, '00000000016', 'Joris', 'Jorauskas', '2001-09-18', 'Guobu g. 9-5', 44805197481, '11F') ; INSERT INTO Mokinys VALUES(111017, '00000000017', 'Gabrielius', 'Julenas', '2001-09-25', 'Isiuteliu g. 68-71', 38111171100, '11F') ; INSERT INTO Mokinys VALUES(111018, '00000000018', 'Gabriele', 'Gabriauskyte', '2001-12-31', 'Papilenu g. 79-1', 44812071200, '11F') ; INSERT INTO Mokinys VALUES(111019, '00000000019', 'Patricija', 'Patricaite', '2001-01-01', 'Papilenu g. 79-1', 44812071200, '11F') ; INSERT INTO Mokinys VALUES(111020, '00000000020', 'Austeja', 'Austyte', '2001-07-01', 'Baltoji g. 99-10', 45609137121, '11F') ; INSERT INTO Mokinys VALUES(111021, '00000000021', 'Saule', 'Sauliaite', '2001-11-18', 'Papilenu g. 79-1', 44812071200, '11F') ; INSERT INTO Mokinys VALUES(111022, '00000000022', 'Jorune', 'Jorunyte', '2009-11-11', 'Baltoji g. 99-10', 45609137121, '10A') ; INSERT INTO Mokinys VALUES(111023, '00000000023', 'Lukne', 'Sarunenaite', '2007-05-30', 'Lauzu g. 15-32', 37608309173, '11A') ; INSERT INTO Mokinys VALUES(555444, '00000000099', 'Saule', 'Sauliaite', '2001-11-18', 'Papilenu g. 79-1', 44812071200, '11F') ; INSERT INTO Mokinys VALUES(123456, '00000099999', 'Lukne', 'Sarunenaite', '2007-05-30', 'Lauzu g. 15-32', 65432123456, '11A') ; --pazymys: nr (generated), pazymys, mokinys, dalykas, data, laikas INSERT INTO Pazymys VALUES(DEFAULT, 9, 111001, 'Matematika') ; INSERT INTO Pazymys VALUES(DEFAULT, 6, 111001, 'Lietuviu kalba', '2019-09-21') ; INSERT INTO Pazymys VALUES(DEFAULT, 4, 111001, 'Vokieciu kalba', '2019-09-29') ; INSERT INTO Pazymys VALUES(DEFAULT, 10,111001, 'Biologija', '2019-10-03') ; INSERT INTO Pazymys VALUES(DEFAULT, 10,111001, 'Kuno kultura', '2019-10-02') ; INSERT INTO Pazymys VALUES(DEFAULT, 8, 111014, 'Biologija', '2019-10-03') ; INSERT INTO Pazymys VALUES(DEFAULT, 9, 111013, 'Chemija', '2019-10-04') ; INSERT INTO Pazymys VALUES(DEFAULT, 5, 111023, 'Lietuviu kalba', '2019-10-03') ; INSERT INTO Pazymys VALUES(DEFAULT, 9, 111013, 'Lietuviu kalba') ; INSERT INTO Pazymys VALUES(DEFAULT, 8, 111023, 'Matematika') ; INSERT INTO Pazymys VALUES(DEFAULT, 5, 111002, 'Matematika') ; INSERT INTO Pazymys VALUES(DEFAULT, 2, 111002, 'Chemija', '2019-10-04') ; INSERT INTO Pazymys VALUES(DEFAULT, 3, 111002, 'Biologija', '2019-10-03') ; INSERT INTO Pazymys VALUES(DEFAULT, 10,111003, 'Vokieciu kalba', '2019-10-02') ; INSERT INTO Pazymys VALUES(DEFAULT, 6, 111003, 'Kuno kultura', '2019-10-01') ; INSERT INTO Pazymys VALUES(DEFAULT, 7, 111010, 'Lietuviu kalba', '2019-11-10') ; INSERT INTO Pazymys VALUES(DEFAULT, 8, 111006, 'Kuno kultura', '2019-11-11') ; INSERT INTO Pazymys VALUES(DEFAULT, 8, 111005, 'Lietuviu kalba', '2019-11-12') ; INSERT INTO Pazymys VALUES(DEFAULT, 9, 111007, 'Chemija', '2019-10-13') ; INSERT INTO Pazymys VALUES(DEFAULT, 6, 111022, 'Matematika', '2019-10-15') ; INSERT INTO Pazymys VALUES(DEFAULT, 6, 111020, 'Vokieciu kalba', '2019-11-16') ; INSERT INTO Pazymys VALUES(DEFAULT, 4, 111022, 'Lietuviu kalba', '2019-11-17') ; --pastaba: nr, mokinys, data (default), laikas (default), priezastis INSERT INTO Pastaba VALUES(0, 111010, '2019-09-20', '13:30', 'Snekejo pamokos metu') ; INSERT INTO Pastaba VALUES(2, 111015, '2019-10-01', '10:10', 'Nepadare namu darbu') ; INSERT INTO Pastaba VALUES(1, 111023, '2019-09-12', '11:40', 'Nepasiruose projektui') ; INSERT INTO Pastaba VALUES(3, 111023, '2019-09-12', '11:40', 'Nepasiruose projektui') ; INSERT INTO Pastaba VALUES(4, 111023, '2019-09-12', '11:40', 'Nepasiruose projektui') ;
UPDATE CUSTOMER_RISK_RANK_APPLY_INFO SET ADJUSTED_RANKING = /*dto.adjustedRanking*/'', ADJUSTMENT_USER = /*dto.adjustmentUser*/'', ADJUSTED_DATE = /*dto.adjustedDate*/'', ADJUSTED_REASON = /*dto.adjustedReason*/'', MODIFY_USER = /*dto.adjustmentUser*/'', MODIFY_DATE = /*modifyDate*/'' WHERE APPLY_ID = /*dto.paramApplyId*/'' AND MODIFY_DATE <= /*dto.modifyDate*/''
use Splitwise; INSERT INTO `Splitwise`.`Users` (`Users_id`, `Name`, `Email`, `Password`, `Budget`, `Phone`) VALUES (1, 'Alice', 'alice@example.com', 'Password', -1, NULL), (2, 'Bob', 'bob@example.com', 'Password', -1, NULL), (3, 'Carol', 'carol@example.com', 'Password', -1, NULL), (4, 'David', 'david@example.com', 'Password', -1, NULL), (5, 'Eric', 'eric@example.com', 'Password', -1, NULL), (6, 'Frank', 'frank@example.com', 'Password', -1, NULL); select * from Users; /* INSERT INTO `Splitwise`.`Bills` (`Bills_id`, `Name`, `Date`, `Description`, `Paid_By`) VALUES (1, 'Stop-n-Shop Groceries', '2018-07-01 03:36:00', 'Groceries I brought at Stop n Shop', 1), (2, 'Target Groceries', '2018-07-10 03:36:00', 'Groceries I brought at Target', 3); select * from Bills; delete from bills where 1=1; INSERT INTO `Splitwise`.`Bill_Items` (`Item_id`, `Bills_id`, `Name`, `Cost`) VALUES (1, 1, 'Bread', 5.83), (2, 1, 'Milk', 4.89), (3, 1, 'Cheese', 5.49), (4, 1, 'Eggs', 5.29), (5, 1, 'Pita Bread', 5.83), (6, 1, 'Chicken Patty', 10.00), (7, 1, 'Chicken Thighs', 4.78), (8, 1, 'Ground Chicken', 3.99), (9, 1, 'Bell Peppers', 8.66), (10, 1, 'Mushrooms', 2.99), (11, 1, 'Tomato', 6.27), (12, 1, 'Lettuce', 1.69), (1, 2, 'Bread', 8.07), (2, 2, 'Peas', 4.77), (3, 2, 'Rat Traps', 9.98), (4, 2, 'Tomatoes', 3.36); select * from Bill_Items order by Bills_id; INSERT INTO `Splitwise`.`Bill_Requests` (`To_id`, `Bills_id`) VALUES (3, 2), (4, 2), (6, 2), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1), (6, 1); select * from Bill_Requests order by Bills_id; INSERT INTO `Splitwise`.`Share` (`Bills_id`, `Item_id`, `Users_id`, `Is_Paid`) VALUES (2, 1, 4, 0), (2, 1, 6, 0), (2, 2, 4, 0), (2, 3, 4, 0), (2, 3, 6, 0), (2, 4, 3, 0), (2, 4, 4, 0), (2, 4, 6, 0), (1, 1, 1, 0), (1, 1, 2, 0), (1, 2, 1, 0), (1, 2, 2, 0), (1, 3, 1, 0), (1, 3, 2, 0), (1, 4, 1, 0), (1, 5, 1, 0), (1, 6, 1, 0), (1, 6, 2, 0), (1, 7, 1, 0), (1, 8, 1, 0), (1, 9, 1, 0), (1, 9, 2, 0), (1, 10, 1, 0), (1, 11, 1, 0), (1, 12, 1, 0); select * from share order by Users_id; INSERT INTO `Splitwise`.`Ledger` (`Bills_id`, `Item_id`, `Amount`) VALUES (1, 1, 1.94), (1, 4, 2.64), (1, 5, 1.00), (1, 6, 3.33), (1, 7, 2.39), (1, 8, 2.00), (1, 9, 2.88), (1, 10, 1.94), (1, 11, 3.13), (1, 12, 8.84); select * from ledger order by Bills_id, Amount; */ select count(Bills_id) from ( select distinct(Bills_id) from bills join share using(bills_id) join bill_requests using(bills_id) where (Users_id = 2 and Paid_By = 1) OR (Paid_By = 1 and To_id = 2) ) as t1 join bill_requests using(Bills_id); select * from bills; select * from bill_requests;
CLEAR SCREEN; SET SERVEROUTPUT ON; SET FEEDBACK ON; DECLARE rb RMAN_RULEBLOCKS%ROWTYPE; BEGIN -- BEGINNING OF RULEBLOCK -- -- rb.blockid := 'rx_desc'; -- -- DELETE FROM rman_ruleblocks WHERE blockid = rb.blockid; -- -- rb.picoruleblock := ' -- -- /* Algorithm to assess Medication */ -- -- -- #define_ruleblock([[rb_id]], -- { -- description: "Algorithm to serialize active medications", -- -- is_active:0 -- -- } -- ); -- -- -- rxn_0 => eadv.[rxnc_%].dt.count().where(val=1); -- -- rx_name_obj => eadv.rx_desc.val.serialize2(); -- -- rx_n => eadv.rx_desc.val.count(0); -- -- [[rb_id]] : {rx_n>0 =>1},{=>0}; -- -- '; -- rb.picoruleblock := replace(rb.picoruleblock, '[[rb_id]]', rb.blockid); -- rb.picoruleblock := rman_pckg.sanitise_clob(rb.picoruleblock); -- INSERT INTO rman_ruleblocks(blockid, picoruleblock) VALUES (rb.blockid, rb.picoruleblock); -- -- COMMIT; -- END OF RULEBLOCK -- -- BEGINNING OF RULEBLOCK -- rb.blockid := 'rx_desc_ptr'; DELETE FROM rman_ruleblocks WHERE blockid = rb.blockid; rb.picoruleblock := ' /* Algorithm to assess Medication */ #define_ruleblock([[rb_id]], { description: "Algorithm to serialize active medications", is_active:2 } ); rx_name_obj => eadv.rx_desc_ptr.val.serialize2(); rx_n => eadv.rx_desc_ptr.val.count(); [[rb_id]] : {coalesce(rx_n,0)>0 =>1},{=>0}; '; rb.picoruleblock := replace(rb.picoruleblock, '[[rb_id]]', rb.blockid); rb.picoruleblock := rman_pckg.sanitise_clob(rb.picoruleblock); INSERT INTO rman_ruleblocks(blockid, picoruleblock) VALUES (rb.blockid, rb.picoruleblock); COMMIT; -- END OF RULEBLOCK -- END;
CREATE DEFINER=`root`@`localhost` PROCEDURE `MantenimientoProveedores`( IN _Accion VARCHAR(15), IN _ProId INT, IN _ProRTN VARCHAR(40), IN _ProNombre VARCHAR(40), IN _ProCorreo VARCHAR(60), IN _ProTelefono VARCHAR(20), IN _ProTelefono2 VARCHAR(20), IN _ProTelefono3 VARCHAR(20), IN _RubId INT, IN _ProContacto VARCHAR(40), IN _ProDireccion VARCHAR(100), IN _ProEstado VARCHAR(10), OUT _Estado VARCHAR(15) ) BEGIN SET _Estado = "Ok"; IF _Accion LIKE '%insertar%' THEN IF (SELECT COUNT(ProId) FROM proveedores WHERE ProRTN = _ProRTN) !=0 THEN SET _Estado = "errRTN"; END IF; IF (SELECT COUNT(ProId) FROM proveedores WHERE ProCorreo = _ProCorreo) !=0 THEN SET _Estado = "errCorreo"; END IF; IF _Estado = "Ok" THEN INSERT INTO proveedores VALUES ( _ProId, _ProRTN, _ProNombre, _ProCorreo, _ProTelefono, _ProTelefono2, _ProTelefono3, _RubId, _ProContacto, _ProDireccion, "Activo" ); END IF; END IF; IF _Accion LIKE '%editar%' THEN IF (SELECT COUNT(ProId) FROM proveedores WHERE ProId != _ProId AND ProRTN = _ProRTN) != 0 THEN SET _Estado = "errRTN"; END IF; IF _Estado = "Ok" THEN UPDATE proveedores SET ProRTN = _ProRTN, ProNombre = _ProNombre, ProCorreo = _ProCorreo, ProTelefono = _ProTelefono, ProTelefono2 = _ProTelefono2, ProTelefono3 = _ProTelefono3, RubId=_RubId, ProContacto = _ProContacto, ProDireccion = _ProDireccion, ProEstado= _ProEstado WHERE ProId = _ProId; END IF; END IF; END
/******************************************************************************* * File Name: cyfittergnu.inc * * PSoC Creator 4.1 Update 1 * * Description: * * This file is automatically generated by PSoC Creator. * ******************************************************************************** * Copyright (c) 2007-2017 Cypress Semiconductor. All rights reserved. * You may use this file only in accordance with the license, terms, conditions, * disclaimers, and limitations in the end user license agreement accompanying * the software package with which this file was provided. ********************************************************************************/ .ifndef INCLUDED_CYFITTERGNU_INC .set INCLUDED_CYFITTERGNU_INC, 1 .include "cydevicegnu_trm.inc" /* LCD_Char_LCDPort */ .set LCD_Char_LCDPort__0__DM__MASK, 0x07 .set LCD_Char_LCDPort__0__DM__SHIFT, 0 .set LCD_Char_LCDPort__0__DR, CYREG_PRT2_DR .set LCD_Char_LCDPort__0__HSIOM, CYREG_HSIOM_PORT_SEL2 .set LCD_Char_LCDPort__0__HSIOM_MASK, 0x0000000F .set LCD_Char_LCDPort__0__HSIOM_SHIFT, 0 .set LCD_Char_LCDPort__0__INTCFG, CYREG_PRT2_INTCFG .set LCD_Char_LCDPort__0__INTSTAT, CYREG_PRT2_INTSTAT .set LCD_Char_LCDPort__0__MASK, 0x01 .set LCD_Char_LCDPort__0__PA__CFG0, CYREG_UDB_PA2_CFG0 .set LCD_Char_LCDPort__0__PA__CFG1, CYREG_UDB_PA2_CFG1 .set LCD_Char_LCDPort__0__PA__CFG10, CYREG_UDB_PA2_CFG10 .set LCD_Char_LCDPort__0__PA__CFG11, CYREG_UDB_PA2_CFG11 .set LCD_Char_LCDPort__0__PA__CFG12, CYREG_UDB_PA2_CFG12 .set LCD_Char_LCDPort__0__PA__CFG13, CYREG_UDB_PA2_CFG13 .set LCD_Char_LCDPort__0__PA__CFG14, CYREG_UDB_PA2_CFG14 .set LCD_Char_LCDPort__0__PA__CFG2, CYREG_UDB_PA2_CFG2 .set LCD_Char_LCDPort__0__PA__CFG3, CYREG_UDB_PA2_CFG3 .set LCD_Char_LCDPort__0__PA__CFG4, CYREG_UDB_PA2_CFG4 .set LCD_Char_LCDPort__0__PA__CFG5, CYREG_UDB_PA2_CFG5 .set LCD_Char_LCDPort__0__PA__CFG6, CYREG_UDB_PA2_CFG6 .set LCD_Char_LCDPort__0__PA__CFG7, CYREG_UDB_PA2_CFG7 .set LCD_Char_LCDPort__0__PA__CFG8, CYREG_UDB_PA2_CFG8 .set LCD_Char_LCDPort__0__PA__CFG9, CYREG_UDB_PA2_CFG9 .set LCD_Char_LCDPort__0__PC, CYREG_PRT2_PC .set LCD_Char_LCDPort__0__PC2, CYREG_PRT2_PC2 .set LCD_Char_LCDPort__0__PORT, 2 .set LCD_Char_LCDPort__0__PS, CYREG_PRT2_PS .set LCD_Char_LCDPort__0__SHIFT, 0 .set LCD_Char_LCDPort__1__DM__MASK, 0x38 .set LCD_Char_LCDPort__1__DM__SHIFT, 3 .set LCD_Char_LCDPort__1__DR, CYREG_PRT2_DR .set LCD_Char_LCDPort__1__HSIOM, CYREG_HSIOM_PORT_SEL2 .set LCD_Char_LCDPort__1__HSIOM_MASK, 0x000000F0 .set LCD_Char_LCDPort__1__HSIOM_SHIFT, 4 .set LCD_Char_LCDPort__1__INTCFG, CYREG_PRT2_INTCFG .set LCD_Char_LCDPort__1__INTSTAT, CYREG_PRT2_INTSTAT .set LCD_Char_LCDPort__1__MASK, 0x02 .set LCD_Char_LCDPort__1__PA__CFG0, CYREG_UDB_PA2_CFG0 .set LCD_Char_LCDPort__1__PA__CFG1, CYREG_UDB_PA2_CFG1 .set LCD_Char_LCDPort__1__PA__CFG10, CYREG_UDB_PA2_CFG10 .set LCD_Char_LCDPort__1__PA__CFG11, CYREG_UDB_PA2_CFG11 .set LCD_Char_LCDPort__1__PA__CFG12, CYREG_UDB_PA2_CFG12 .set LCD_Char_LCDPort__1__PA__CFG13, CYREG_UDB_PA2_CFG13 .set LCD_Char_LCDPort__1__PA__CFG14, CYREG_UDB_PA2_CFG14 .set LCD_Char_LCDPort__1__PA__CFG2, CYREG_UDB_PA2_CFG2 .set LCD_Char_LCDPort__1__PA__CFG3, CYREG_UDB_PA2_CFG3 .set LCD_Char_LCDPort__1__PA__CFG4, CYREG_UDB_PA2_CFG4 .set LCD_Char_LCDPort__1__PA__CFG5, CYREG_UDB_PA2_CFG5 .set LCD_Char_LCDPort__1__PA__CFG6, CYREG_UDB_PA2_CFG6 .set LCD_Char_LCDPort__1__PA__CFG7, CYREG_UDB_PA2_CFG7 .set LCD_Char_LCDPort__1__PA__CFG8, CYREG_UDB_PA2_CFG8 .set LCD_Char_LCDPort__1__PA__CFG9, CYREG_UDB_PA2_CFG9 .set LCD_Char_LCDPort__1__PC, CYREG_PRT2_PC .set LCD_Char_LCDPort__1__PC2, CYREG_PRT2_PC2 .set LCD_Char_LCDPort__1__PORT, 2 .set LCD_Char_LCDPort__1__PS, CYREG_PRT2_PS .set LCD_Char_LCDPort__1__SHIFT, 1 .set LCD_Char_LCDPort__2__DM__MASK, 0x1C0 .set LCD_Char_LCDPort__2__DM__SHIFT, 6 .set LCD_Char_LCDPort__2__DR, CYREG_PRT2_DR .set LCD_Char_LCDPort__2__HSIOM, CYREG_HSIOM_PORT_SEL2 .set LCD_Char_LCDPort__2__HSIOM_MASK, 0x00000F00 .set LCD_Char_LCDPort__2__HSIOM_SHIFT, 8 .set LCD_Char_LCDPort__2__INTCFG, CYREG_PRT2_INTCFG .set LCD_Char_LCDPort__2__INTSTAT, CYREG_PRT2_INTSTAT .set LCD_Char_LCDPort__2__MASK, 0x04 .set LCD_Char_LCDPort__2__PA__CFG0, CYREG_UDB_PA2_CFG0 .set LCD_Char_LCDPort__2__PA__CFG1, CYREG_UDB_PA2_CFG1 .set LCD_Char_LCDPort__2__PA__CFG10, CYREG_UDB_PA2_CFG10 .set LCD_Char_LCDPort__2__PA__CFG11, CYREG_UDB_PA2_CFG11 .set LCD_Char_LCDPort__2__PA__CFG12, CYREG_UDB_PA2_CFG12 .set LCD_Char_LCDPort__2__PA__CFG13, CYREG_UDB_PA2_CFG13 .set LCD_Char_LCDPort__2__PA__CFG14, CYREG_UDB_PA2_CFG14 .set LCD_Char_LCDPort__2__PA__CFG2, CYREG_UDB_PA2_CFG2 .set LCD_Char_LCDPort__2__PA__CFG3, CYREG_UDB_PA2_CFG3 .set LCD_Char_LCDPort__2__PA__CFG4, CYREG_UDB_PA2_CFG4 .set LCD_Char_LCDPort__2__PA__CFG5, CYREG_UDB_PA2_CFG5 .set LCD_Char_LCDPort__2__PA__CFG6, CYREG_UDB_PA2_CFG6 .set LCD_Char_LCDPort__2__PA__CFG7, CYREG_UDB_PA2_CFG7 .set LCD_Char_LCDPort__2__PA__CFG8, CYREG_UDB_PA2_CFG8 .set LCD_Char_LCDPort__2__PA__CFG9, CYREG_UDB_PA2_CFG9 .set LCD_Char_LCDPort__2__PC, CYREG_PRT2_PC .set LCD_Char_LCDPort__2__PC2, CYREG_PRT2_PC2 .set LCD_Char_LCDPort__2__PORT, 2 .set LCD_Char_LCDPort__2__PS, CYREG_PRT2_PS .set LCD_Char_LCDPort__2__SHIFT, 2 .set LCD_Char_LCDPort__3__DM__MASK, 0xE00 .set LCD_Char_LCDPort__3__DM__SHIFT, 9 .set LCD_Char_LCDPort__3__DR, CYREG_PRT2_DR .set LCD_Char_LCDPort__3__HSIOM, CYREG_HSIOM_PORT_SEL2 .set LCD_Char_LCDPort__3__HSIOM_MASK, 0x0000F000 .set LCD_Char_LCDPort__3__HSIOM_SHIFT, 12 .set LCD_Char_LCDPort__3__INTCFG, CYREG_PRT2_INTCFG .set LCD_Char_LCDPort__3__INTSTAT, CYREG_PRT2_INTSTAT .set LCD_Char_LCDPort__3__MASK, 0x08 .set LCD_Char_LCDPort__3__PA__CFG0, CYREG_UDB_PA2_CFG0 .set LCD_Char_LCDPort__3__PA__CFG1, CYREG_UDB_PA2_CFG1 .set LCD_Char_LCDPort__3__PA__CFG10, CYREG_UDB_PA2_CFG10 .set LCD_Char_LCDPort__3__PA__CFG11, CYREG_UDB_PA2_CFG11 .set LCD_Char_LCDPort__3__PA__CFG12, CYREG_UDB_PA2_CFG12 .set LCD_Char_LCDPort__3__PA__CFG13, CYREG_UDB_PA2_CFG13 .set LCD_Char_LCDPort__3__PA__CFG14, CYREG_UDB_PA2_CFG14 .set LCD_Char_LCDPort__3__PA__CFG2, CYREG_UDB_PA2_CFG2 .set LCD_Char_LCDPort__3__PA__CFG3, CYREG_UDB_PA2_CFG3 .set LCD_Char_LCDPort__3__PA__CFG4, CYREG_UDB_PA2_CFG4 .set LCD_Char_LCDPort__3__PA__CFG5, CYREG_UDB_PA2_CFG5 .set LCD_Char_LCDPort__3__PA__CFG6, CYREG_UDB_PA2_CFG6 .set LCD_Char_LCDPort__3__PA__CFG7, CYREG_UDB_PA2_CFG7 .set LCD_Char_LCDPort__3__PA__CFG8, CYREG_UDB_PA2_CFG8 .set LCD_Char_LCDPort__3__PA__CFG9, CYREG_UDB_PA2_CFG9 .set LCD_Char_LCDPort__3__PC, CYREG_PRT2_PC .set LCD_Char_LCDPort__3__PC2, CYREG_PRT2_PC2 .set LCD_Char_LCDPort__3__PORT, 2 .set LCD_Char_LCDPort__3__PS, CYREG_PRT2_PS .set LCD_Char_LCDPort__3__SHIFT, 3 .set LCD_Char_LCDPort__4__DM__MASK, 0x7000 .set LCD_Char_LCDPort__4__DM__SHIFT, 12 .set LCD_Char_LCDPort__4__DR, CYREG_PRT2_DR .set LCD_Char_LCDPort__4__HSIOM, CYREG_HSIOM_PORT_SEL2 .set LCD_Char_LCDPort__4__HSIOM_MASK, 0x000F0000 .set LCD_Char_LCDPort__4__HSIOM_SHIFT, 16 .set LCD_Char_LCDPort__4__INTCFG, CYREG_PRT2_INTCFG .set LCD_Char_LCDPort__4__INTSTAT, CYREG_PRT2_INTSTAT .set LCD_Char_LCDPort__4__MASK, 0x10 .set LCD_Char_LCDPort__4__PA__CFG0, CYREG_UDB_PA2_CFG0 .set LCD_Char_LCDPort__4__PA__CFG1, CYREG_UDB_PA2_CFG1 .set LCD_Char_LCDPort__4__PA__CFG10, CYREG_UDB_PA2_CFG10 .set LCD_Char_LCDPort__4__PA__CFG11, CYREG_UDB_PA2_CFG11 .set LCD_Char_LCDPort__4__PA__CFG12, CYREG_UDB_PA2_CFG12 .set LCD_Char_LCDPort__4__PA__CFG13, CYREG_UDB_PA2_CFG13 .set LCD_Char_LCDPort__4__PA__CFG14, CYREG_UDB_PA2_CFG14 .set LCD_Char_LCDPort__4__PA__CFG2, CYREG_UDB_PA2_CFG2 .set LCD_Char_LCDPort__4__PA__CFG3, CYREG_UDB_PA2_CFG3 .set LCD_Char_LCDPort__4__PA__CFG4, CYREG_UDB_PA2_CFG4 .set LCD_Char_LCDPort__4__PA__CFG5, CYREG_UDB_PA2_CFG5 .set LCD_Char_LCDPort__4__PA__CFG6, CYREG_UDB_PA2_CFG6 .set LCD_Char_LCDPort__4__PA__CFG7, CYREG_UDB_PA2_CFG7 .set LCD_Char_LCDPort__4__PA__CFG8, CYREG_UDB_PA2_CFG8 .set LCD_Char_LCDPort__4__PA__CFG9, CYREG_UDB_PA2_CFG9 .set LCD_Char_LCDPort__4__PC, CYREG_PRT2_PC .set LCD_Char_LCDPort__4__PC2, CYREG_PRT2_PC2 .set LCD_Char_LCDPort__4__PORT, 2 .set LCD_Char_LCDPort__4__PS, CYREG_PRT2_PS .set LCD_Char_LCDPort__4__SHIFT, 4 .set LCD_Char_LCDPort__5__DM__MASK, 0x38000 .set LCD_Char_LCDPort__5__DM__SHIFT, 15 .set LCD_Char_LCDPort__5__DR, CYREG_PRT2_DR .set LCD_Char_LCDPort__5__HSIOM, CYREG_HSIOM_PORT_SEL2 .set LCD_Char_LCDPort__5__HSIOM_MASK, 0x00F00000 .set LCD_Char_LCDPort__5__HSIOM_SHIFT, 20 .set LCD_Char_LCDPort__5__INTCFG, CYREG_PRT2_INTCFG .set LCD_Char_LCDPort__5__INTSTAT, CYREG_PRT2_INTSTAT .set LCD_Char_LCDPort__5__MASK, 0x20 .set LCD_Char_LCDPort__5__PA__CFG0, CYREG_UDB_PA2_CFG0 .set LCD_Char_LCDPort__5__PA__CFG1, CYREG_UDB_PA2_CFG1 .set LCD_Char_LCDPort__5__PA__CFG10, CYREG_UDB_PA2_CFG10 .set LCD_Char_LCDPort__5__PA__CFG11, CYREG_UDB_PA2_CFG11 .set LCD_Char_LCDPort__5__PA__CFG12, CYREG_UDB_PA2_CFG12 .set LCD_Char_LCDPort__5__PA__CFG13, CYREG_UDB_PA2_CFG13 .set LCD_Char_LCDPort__5__PA__CFG14, CYREG_UDB_PA2_CFG14 .set LCD_Char_LCDPort__5__PA__CFG2, CYREG_UDB_PA2_CFG2 .set LCD_Char_LCDPort__5__PA__CFG3, CYREG_UDB_PA2_CFG3 .set LCD_Char_LCDPort__5__PA__CFG4, CYREG_UDB_PA2_CFG4 .set LCD_Char_LCDPort__5__PA__CFG5, CYREG_UDB_PA2_CFG5 .set LCD_Char_LCDPort__5__PA__CFG6, CYREG_UDB_PA2_CFG6 .set LCD_Char_LCDPort__5__PA__CFG7, CYREG_UDB_PA2_CFG7 .set LCD_Char_LCDPort__5__PA__CFG8, CYREG_UDB_PA2_CFG8 .set LCD_Char_LCDPort__5__PA__CFG9, CYREG_UDB_PA2_CFG9 .set LCD_Char_LCDPort__5__PC, CYREG_PRT2_PC .set LCD_Char_LCDPort__5__PC2, CYREG_PRT2_PC2 .set LCD_Char_LCDPort__5__PORT, 2 .set LCD_Char_LCDPort__5__PS, CYREG_PRT2_PS .set LCD_Char_LCDPort__5__SHIFT, 5 .set LCD_Char_LCDPort__6__DM__MASK, 0x1C0000 .set LCD_Char_LCDPort__6__DM__SHIFT, 18 .set LCD_Char_LCDPort__6__DR, CYREG_PRT2_DR .set LCD_Char_LCDPort__6__HSIOM, CYREG_HSIOM_PORT_SEL2 .set LCD_Char_LCDPort__6__HSIOM_MASK, 0x0F000000 .set LCD_Char_LCDPort__6__HSIOM_SHIFT, 24 .set LCD_Char_LCDPort__6__INTCFG, CYREG_PRT2_INTCFG .set LCD_Char_LCDPort__6__INTSTAT, CYREG_PRT2_INTSTAT .set LCD_Char_LCDPort__6__MASK, 0x40 .set LCD_Char_LCDPort__6__PA__CFG0, CYREG_UDB_PA2_CFG0 .set LCD_Char_LCDPort__6__PA__CFG1, CYREG_UDB_PA2_CFG1 .set LCD_Char_LCDPort__6__PA__CFG10, CYREG_UDB_PA2_CFG10 .set LCD_Char_LCDPort__6__PA__CFG11, CYREG_UDB_PA2_CFG11 .set LCD_Char_LCDPort__6__PA__CFG12, CYREG_UDB_PA2_CFG12 .set LCD_Char_LCDPort__6__PA__CFG13, CYREG_UDB_PA2_CFG13 .set LCD_Char_LCDPort__6__PA__CFG14, CYREG_UDB_PA2_CFG14 .set LCD_Char_LCDPort__6__PA__CFG2, CYREG_UDB_PA2_CFG2 .set LCD_Char_LCDPort__6__PA__CFG3, CYREG_UDB_PA2_CFG3 .set LCD_Char_LCDPort__6__PA__CFG4, CYREG_UDB_PA2_CFG4 .set LCD_Char_LCDPort__6__PA__CFG5, CYREG_UDB_PA2_CFG5 .set LCD_Char_LCDPort__6__PA__CFG6, CYREG_UDB_PA2_CFG6 .set LCD_Char_LCDPort__6__PA__CFG7, CYREG_UDB_PA2_CFG7 .set LCD_Char_LCDPort__6__PA__CFG8, CYREG_UDB_PA2_CFG8 .set LCD_Char_LCDPort__6__PA__CFG9, CYREG_UDB_PA2_CFG9 .set LCD_Char_LCDPort__6__PC, CYREG_PRT2_PC .set LCD_Char_LCDPort__6__PC2, CYREG_PRT2_PC2 .set LCD_Char_LCDPort__6__PORT, 2 .set LCD_Char_LCDPort__6__PS, CYREG_PRT2_PS .set LCD_Char_LCDPort__6__SHIFT, 6 .set LCD_Char_LCDPort__DR, CYREG_PRT2_DR .set LCD_Char_LCDPort__INTCFG, CYREG_PRT2_INTCFG .set LCD_Char_LCDPort__INTSTAT, CYREG_PRT2_INTSTAT .set LCD_Char_LCDPort__MASK, 0x7F .set LCD_Char_LCDPort__PA__CFG0, CYREG_UDB_PA2_CFG0 .set LCD_Char_LCDPort__PA__CFG1, CYREG_UDB_PA2_CFG1 .set LCD_Char_LCDPort__PA__CFG10, CYREG_UDB_PA2_CFG10 .set LCD_Char_LCDPort__PA__CFG11, CYREG_UDB_PA2_CFG11 .set LCD_Char_LCDPort__PA__CFG12, CYREG_UDB_PA2_CFG12 .set LCD_Char_LCDPort__PA__CFG13, CYREG_UDB_PA2_CFG13 .set LCD_Char_LCDPort__PA__CFG14, CYREG_UDB_PA2_CFG14 .set LCD_Char_LCDPort__PA__CFG2, CYREG_UDB_PA2_CFG2 .set LCD_Char_LCDPort__PA__CFG3, CYREG_UDB_PA2_CFG3 .set LCD_Char_LCDPort__PA__CFG4, CYREG_UDB_PA2_CFG4 .set LCD_Char_LCDPort__PA__CFG5, CYREG_UDB_PA2_CFG5 .set LCD_Char_LCDPort__PA__CFG6, CYREG_UDB_PA2_CFG6 .set LCD_Char_LCDPort__PA__CFG7, CYREG_UDB_PA2_CFG7 .set LCD_Char_LCDPort__PA__CFG8, CYREG_UDB_PA2_CFG8 .set LCD_Char_LCDPort__PA__CFG9, CYREG_UDB_PA2_CFG9 .set LCD_Char_LCDPort__PC, CYREG_PRT2_PC .set LCD_Char_LCDPort__PC2, CYREG_PRT2_PC2 .set LCD_Char_LCDPort__PORT, 2 .set LCD_Char_LCDPort__PS, CYREG_PRT2_PS .set LCD_Char_LCDPort__SHIFT, 0 /* Pin_Switch */ .set Pin_Switch__0__DM__MASK, 0xE00000 .set Pin_Switch__0__DM__SHIFT, 21 .set Pin_Switch__0__DR, CYREG_PRT0_DR .set Pin_Switch__0__HSIOM, CYREG_HSIOM_PORT_SEL0 .set Pin_Switch__0__HSIOM_MASK, 0xF0000000 .set Pin_Switch__0__HSIOM_SHIFT, 28 .set Pin_Switch__0__INTCFG, CYREG_PRT0_INTCFG .set Pin_Switch__0__INTSTAT, CYREG_PRT0_INTSTAT .set Pin_Switch__0__MASK, 0x80 .set Pin_Switch__0__PA__CFG0, CYREG_UDB_PA0_CFG0 .set Pin_Switch__0__PA__CFG1, CYREG_UDB_PA0_CFG1 .set Pin_Switch__0__PA__CFG10, CYREG_UDB_PA0_CFG10 .set Pin_Switch__0__PA__CFG11, CYREG_UDB_PA0_CFG11 .set Pin_Switch__0__PA__CFG12, CYREG_UDB_PA0_CFG12 .set Pin_Switch__0__PA__CFG13, CYREG_UDB_PA0_CFG13 .set Pin_Switch__0__PA__CFG14, CYREG_UDB_PA0_CFG14 .set Pin_Switch__0__PA__CFG2, CYREG_UDB_PA0_CFG2 .set Pin_Switch__0__PA__CFG3, CYREG_UDB_PA0_CFG3 .set Pin_Switch__0__PA__CFG4, CYREG_UDB_PA0_CFG4 .set Pin_Switch__0__PA__CFG5, CYREG_UDB_PA0_CFG5 .set Pin_Switch__0__PA__CFG6, CYREG_UDB_PA0_CFG6 .set Pin_Switch__0__PA__CFG7, CYREG_UDB_PA0_CFG7 .set Pin_Switch__0__PA__CFG8, CYREG_UDB_PA0_CFG8 .set Pin_Switch__0__PA__CFG9, CYREG_UDB_PA0_CFG9 .set Pin_Switch__0__PC, CYREG_PRT0_PC .set Pin_Switch__0__PC2, CYREG_PRT0_PC2 .set Pin_Switch__0__PORT, 0 .set Pin_Switch__0__PS, CYREG_PRT0_PS .set Pin_Switch__0__SHIFT, 7 .set Pin_Switch__DR, CYREG_PRT0_DR .set Pin_Switch__INTCFG, CYREG_PRT0_INTCFG .set Pin_Switch__INTSTAT, CYREG_PRT0_INTSTAT .set Pin_Switch__MASK, 0x80 .set Pin_Switch__PA__CFG0, CYREG_UDB_PA0_CFG0 .set Pin_Switch__PA__CFG1, CYREG_UDB_PA0_CFG1 .set Pin_Switch__PA__CFG10, CYREG_UDB_PA0_CFG10 .set Pin_Switch__PA__CFG11, CYREG_UDB_PA0_CFG11 .set Pin_Switch__PA__CFG12, CYREG_UDB_PA0_CFG12 .set Pin_Switch__PA__CFG13, CYREG_UDB_PA0_CFG13 .set Pin_Switch__PA__CFG14, CYREG_UDB_PA0_CFG14 .set Pin_Switch__PA__CFG2, CYREG_UDB_PA0_CFG2 .set Pin_Switch__PA__CFG3, CYREG_UDB_PA0_CFG3 .set Pin_Switch__PA__CFG4, CYREG_UDB_PA0_CFG4 .set Pin_Switch__PA__CFG5, CYREG_UDB_PA0_CFG5 .set Pin_Switch__PA__CFG6, CYREG_UDB_PA0_CFG6 .set Pin_Switch__PA__CFG7, CYREG_UDB_PA0_CFG7 .set Pin_Switch__PA__CFG8, CYREG_UDB_PA0_CFG8 .set Pin_Switch__PA__CFG9, CYREG_UDB_PA0_CFG9 .set Pin_Switch__PC, CYREG_PRT0_PC .set Pin_Switch__PC2, CYREG_PRT0_PC2 .set Pin_Switch__PORT, 0 .set Pin_Switch__PS, CYREG_PRT0_PS .set Pin_Switch__SHIFT, 7 /* Rx */ .set Rx__0__DM__MASK, 0x07 .set Rx__0__DM__SHIFT, 0 .set Rx__0__DR, CYREG_PRT0_DR .set Rx__0__HSIOM, CYREG_HSIOM_PORT_SEL0 .set Rx__0__HSIOM_MASK, 0x0000000F .set Rx__0__HSIOM_SHIFT, 0 .set Rx__0__INTCFG, CYREG_PRT0_INTCFG .set Rx__0__INTSTAT, CYREG_PRT0_INTSTAT .set Rx__0__MASK, 0x01 .set Rx__0__PA__CFG0, CYREG_UDB_PA0_CFG0 .set Rx__0__PA__CFG1, CYREG_UDB_PA0_CFG1 .set Rx__0__PA__CFG10, CYREG_UDB_PA0_CFG10 .set Rx__0__PA__CFG11, CYREG_UDB_PA0_CFG11 .set Rx__0__PA__CFG12, CYREG_UDB_PA0_CFG12 .set Rx__0__PA__CFG13, CYREG_UDB_PA0_CFG13 .set Rx__0__PA__CFG14, CYREG_UDB_PA0_CFG14 .set Rx__0__PA__CFG2, CYREG_UDB_PA0_CFG2 .set Rx__0__PA__CFG3, CYREG_UDB_PA0_CFG3 .set Rx__0__PA__CFG4, CYREG_UDB_PA0_CFG4 .set Rx__0__PA__CFG5, CYREG_UDB_PA0_CFG5 .set Rx__0__PA__CFG6, CYREG_UDB_PA0_CFG6 .set Rx__0__PA__CFG7, CYREG_UDB_PA0_CFG7 .set Rx__0__PA__CFG8, CYREG_UDB_PA0_CFG8 .set Rx__0__PA__CFG9, CYREG_UDB_PA0_CFG9 .set Rx__0__PC, CYREG_PRT0_PC .set Rx__0__PC2, CYREG_PRT0_PC2 .set Rx__0__PORT, 0 .set Rx__0__PS, CYREG_PRT0_PS .set Rx__0__SHIFT, 0 .set Rx__DR, CYREG_PRT0_DR .set Rx__INTCFG, CYREG_PRT0_INTCFG .set Rx__INTSTAT, CYREG_PRT0_INTSTAT .set Rx__MASK, 0x01 .set Rx__PA__CFG0, CYREG_UDB_PA0_CFG0 .set Rx__PA__CFG1, CYREG_UDB_PA0_CFG1 .set Rx__PA__CFG10, CYREG_UDB_PA0_CFG10 .set Rx__PA__CFG11, CYREG_UDB_PA0_CFG11 .set Rx__PA__CFG12, CYREG_UDB_PA0_CFG12 .set Rx__PA__CFG13, CYREG_UDB_PA0_CFG13 .set Rx__PA__CFG14, CYREG_UDB_PA0_CFG14 .set Rx__PA__CFG2, CYREG_UDB_PA0_CFG2 .set Rx__PA__CFG3, CYREG_UDB_PA0_CFG3 .set Rx__PA__CFG4, CYREG_UDB_PA0_CFG4 .set Rx__PA__CFG5, CYREG_UDB_PA0_CFG5 .set Rx__PA__CFG6, CYREG_UDB_PA0_CFG6 .set Rx__PA__CFG7, CYREG_UDB_PA0_CFG7 .set Rx__PA__CFG8, CYREG_UDB_PA0_CFG8 .set Rx__PA__CFG9, CYREG_UDB_PA0_CFG9 .set Rx__PC, CYREG_PRT0_PC .set Rx__PC2, CYREG_PRT0_PC2 .set Rx__PORT, 0 .set Rx__PS, CYREG_PRT0_PS .set Rx__SHIFT, 0 /* Tx */ .set Tx__0__DM__MASK, 0x38 .set Tx__0__DM__SHIFT, 3 .set Tx__0__DR, CYREG_PRT0_DR .set Tx__0__HSIOM, CYREG_HSIOM_PORT_SEL0 .set Tx__0__HSIOM_MASK, 0x000000F0 .set Tx__0__HSIOM_SHIFT, 4 .set Tx__0__INTCFG, CYREG_PRT0_INTCFG .set Tx__0__INTSTAT, CYREG_PRT0_INTSTAT .set Tx__0__MASK, 0x02 .set Tx__0__OUT_SEL, CYREG_UDB_PA0_CFG10 .set Tx__0__OUT_SEL_SHIFT, 2 .set Tx__0__OUT_SEL_VAL, 3 .set Tx__0__PA__CFG0, CYREG_UDB_PA0_CFG0 .set Tx__0__PA__CFG1, CYREG_UDB_PA0_CFG1 .set Tx__0__PA__CFG10, CYREG_UDB_PA0_CFG10 .set Tx__0__PA__CFG11, CYREG_UDB_PA0_CFG11 .set Tx__0__PA__CFG12, CYREG_UDB_PA0_CFG12 .set Tx__0__PA__CFG13, CYREG_UDB_PA0_CFG13 .set Tx__0__PA__CFG14, CYREG_UDB_PA0_CFG14 .set Tx__0__PA__CFG2, CYREG_UDB_PA0_CFG2 .set Tx__0__PA__CFG3, CYREG_UDB_PA0_CFG3 .set Tx__0__PA__CFG4, CYREG_UDB_PA0_CFG4 .set Tx__0__PA__CFG5, CYREG_UDB_PA0_CFG5 .set Tx__0__PA__CFG6, CYREG_UDB_PA0_CFG6 .set Tx__0__PA__CFG7, CYREG_UDB_PA0_CFG7 .set Tx__0__PA__CFG8, CYREG_UDB_PA0_CFG8 .set Tx__0__PA__CFG9, CYREG_UDB_PA0_CFG9 .set Tx__0__PC, CYREG_PRT0_PC .set Tx__0__PC2, CYREG_PRT0_PC2 .set Tx__0__PORT, 0 .set Tx__0__PS, CYREG_PRT0_PS .set Tx__0__SHIFT, 1 .set Tx__DR, CYREG_PRT0_DR .set Tx__INTCFG, CYREG_PRT0_INTCFG .set Tx__INTSTAT, CYREG_PRT0_INTSTAT .set Tx__MASK, 0x02 .set Tx__PA__CFG0, CYREG_UDB_PA0_CFG0 .set Tx__PA__CFG1, CYREG_UDB_PA0_CFG1 .set Tx__PA__CFG10, CYREG_UDB_PA0_CFG10 .set Tx__PA__CFG11, CYREG_UDB_PA0_CFG11 .set Tx__PA__CFG12, CYREG_UDB_PA0_CFG12 .set Tx__PA__CFG13, CYREG_UDB_PA0_CFG13 .set Tx__PA__CFG14, CYREG_UDB_PA0_CFG14 .set Tx__PA__CFG2, CYREG_UDB_PA0_CFG2 .set Tx__PA__CFG3, CYREG_UDB_PA0_CFG3 .set Tx__PA__CFG4, CYREG_UDB_PA0_CFG4 .set Tx__PA__CFG5, CYREG_UDB_PA0_CFG5 .set Tx__PA__CFG6, CYREG_UDB_PA0_CFG6 .set Tx__PA__CFG7, CYREG_UDB_PA0_CFG7 .set Tx__PA__CFG8, CYREG_UDB_PA0_CFG8 .set Tx__PA__CFG9, CYREG_UDB_PA0_CFG9 .set Tx__PC, CYREG_PRT0_PC .set Tx__PC2, CYREG_PRT0_PC2 .set Tx__PORT, 0 .set Tx__PS, CYREG_PRT0_PS .set Tx__SHIFT, 1 /* UART_BUART */ .set UART_BUART_sRX_RxBitCounter__16BIT_CONTROL_AUX_CTL_REG, CYREG_UDB_W16_ACTL_00 .set UART_BUART_sRX_RxBitCounter__16BIT_CONTROL_CONTROL_REG, CYREG_UDB_W16_CTL_00 .set UART_BUART_sRX_RxBitCounter__16BIT_CONTROL_COUNT_REG, CYREG_UDB_W16_CTL_00 .set UART_BUART_sRX_RxBitCounter__16BIT_COUNT_CONTROL_REG, CYREG_UDB_W16_CTL_00 .set UART_BUART_sRX_RxBitCounter__16BIT_COUNT_COUNT_REG, CYREG_UDB_W16_CTL_00 .set UART_BUART_sRX_RxBitCounter__16BIT_MASK_MASK_REG, CYREG_UDB_W16_MSK_00 .set UART_BUART_sRX_RxBitCounter__16BIT_MASK_PERIOD_REG, CYREG_UDB_W16_MSK_00 .set UART_BUART_sRX_RxBitCounter__16BIT_PERIOD_MASK_REG, CYREG_UDB_W16_MSK_00 .set UART_BUART_sRX_RxBitCounter__16BIT_PERIOD_PERIOD_REG, CYREG_UDB_W16_MSK_00 .set UART_BUART_sRX_RxBitCounter__32BIT_CONTROL_AUX_CTL_REG, CYREG_UDB_W32_ACTL_00 .set UART_BUART_sRX_RxBitCounter__32BIT_CONTROL_REG, CYREG_UDB_W32_CTL_00 .set UART_BUART_sRX_RxBitCounter__32BIT_COUNT_REG, CYREG_UDB_W32_CTL_00 .set UART_BUART_sRX_RxBitCounter__32BIT_PERIOD_REG, CYREG_UDB_W32_MSK_00 .set UART_BUART_sRX_RxBitCounter__CONTROL_AUX_CTL_REG, CYREG_UDB_W8_ACTL_00 .set UART_BUART_sRX_RxBitCounter__CONTROL_REG, CYREG_UDB_W8_CTL_00 .set UART_BUART_sRX_RxBitCounter__CONTROL_ST_REG, CYREG_UDB_CAT16_CTL_ST_00 .set UART_BUART_sRX_RxBitCounter__COUNT_REG, CYREG_UDB_W8_CTL_00 .set UART_BUART_sRX_RxBitCounter__COUNT_ST_REG, CYREG_UDB_CAT16_CTL_ST_00 .set UART_BUART_sRX_RxBitCounter__MASK_CTL_AUX_CTL_REG, CYREG_UDB_CAT16_ACTL_MSK_00 .set UART_BUART_sRX_RxBitCounter__PER_CTL_AUX_CTL_REG, CYREG_UDB_CAT16_ACTL_MSK_00 .set UART_BUART_sRX_RxBitCounter__PERIOD_REG, CYREG_UDB_W8_MSK_00 .set UART_BUART_sRX_RxBitCounter_ST__16BIT_STATUS_AUX_CTL_REG, CYREG_UDB_W16_ACTL_00 .set UART_BUART_sRX_RxBitCounter_ST__16BIT_STATUS_REG, CYREG_UDB_W16_ST_00 .set UART_BUART_sRX_RxBitCounter_ST__32BIT_MASK_REG, CYREG_UDB_W32_MSK_00 .set UART_BUART_sRX_RxBitCounter_ST__32BIT_STATUS_AUX_CTL_REG, CYREG_UDB_W32_ACTL_00 .set UART_BUART_sRX_RxBitCounter_ST__32BIT_STATUS_REG, CYREG_UDB_W32_ST_00 .set UART_BUART_sRX_RxBitCounter_ST__MASK_REG, CYREG_UDB_W8_MSK_00 .set UART_BUART_sRX_RxBitCounter_ST__MASK_ST_AUX_CTL_REG, CYREG_UDB_CAT16_ACTL_MSK_00 .set UART_BUART_sRX_RxBitCounter_ST__PER_ST_AUX_CTL_REG, CYREG_UDB_CAT16_ACTL_MSK_00 .set UART_BUART_sRX_RxBitCounter_ST__STATUS_AUX_CTL_REG, CYREG_UDB_W8_ACTL_00 .set UART_BUART_sRX_RxBitCounter_ST__STATUS_CNT_REG, CYREG_UDB_CAT16_CTL_ST_00 .set UART_BUART_sRX_RxBitCounter_ST__STATUS_CONTROL_REG, CYREG_UDB_CAT16_CTL_ST_00 .set UART_BUART_sRX_RxBitCounter_ST__STATUS_REG, CYREG_UDB_W8_ST_00 .set UART_BUART_sRX_RxShifter_u0__16BIT_A0_REG, CYREG_UDB_W16_A0_00 .set UART_BUART_sRX_RxShifter_u0__16BIT_A1_REG, CYREG_UDB_W16_A1_00 .set UART_BUART_sRX_RxShifter_u0__16BIT_D0_REG, CYREG_UDB_W16_D0_00 .set UART_BUART_sRX_RxShifter_u0__16BIT_D1_REG, CYREG_UDB_W16_D1_00 .set UART_BUART_sRX_RxShifter_u0__16BIT_DP_AUX_CTL_REG, CYREG_UDB_W16_ACTL_00 .set UART_BUART_sRX_RxShifter_u0__16BIT_F0_REG, CYREG_UDB_W16_F0_00 .set UART_BUART_sRX_RxShifter_u0__16BIT_F1_REG, CYREG_UDB_W16_F1_00 .set UART_BUART_sRX_RxShifter_u0__32BIT_A0_REG, CYREG_UDB_W32_A0_00 .set UART_BUART_sRX_RxShifter_u0__32BIT_A1_REG, CYREG_UDB_W32_A1_00 .set UART_BUART_sRX_RxShifter_u0__32BIT_D0_REG, CYREG_UDB_W32_D0_00 .set UART_BUART_sRX_RxShifter_u0__32BIT_D1_REG, CYREG_UDB_W32_D1_00 .set UART_BUART_sRX_RxShifter_u0__32BIT_DP_AUX_CTL_REG, CYREG_UDB_W32_ACTL_00 .set UART_BUART_sRX_RxShifter_u0__32BIT_F0_REG, CYREG_UDB_W32_F0_00 .set UART_BUART_sRX_RxShifter_u0__32BIT_F1_REG, CYREG_UDB_W32_F1_00 .set UART_BUART_sRX_RxShifter_u0__A0_A1_REG, CYREG_UDB_CAT16_A_00 .set UART_BUART_sRX_RxShifter_u0__A0_REG, CYREG_UDB_W8_A0_00 .set UART_BUART_sRX_RxShifter_u0__A1_REG, CYREG_UDB_W8_A1_00 .set UART_BUART_sRX_RxShifter_u0__D0_D1_REG, CYREG_UDB_CAT16_D_00 .set UART_BUART_sRX_RxShifter_u0__D0_REG, CYREG_UDB_W8_D0_00 .set UART_BUART_sRX_RxShifter_u0__D1_REG, CYREG_UDB_W8_D1_00 .set UART_BUART_sRX_RxShifter_u0__DP_AUX_CTL_REG, CYREG_UDB_W8_ACTL_00 .set UART_BUART_sRX_RxShifter_u0__F0_F1_REG, CYREG_UDB_CAT16_F_00 .set UART_BUART_sRX_RxShifter_u0__F0_REG, CYREG_UDB_W8_F0_00 .set UART_BUART_sRX_RxShifter_u0__F1_REG, CYREG_UDB_W8_F1_00 .set UART_BUART_sRX_RxShifter_u0__MSK_DP_AUX_CTL_REG, CYREG_UDB_CAT16_ACTL_MSK_00 .set UART_BUART_sRX_RxShifter_u0__PER_DP_AUX_CTL_REG, CYREG_UDB_CAT16_ACTL_MSK_00 .set UART_BUART_sRX_RxSts__16BIT_STATUS_AUX_CTL_REG, CYREG_UDB_W16_ACTL_01 .set UART_BUART_sRX_RxSts__16BIT_STATUS_REG, CYREG_UDB_W16_ST_01 .set UART_BUART_sRX_RxSts__3__MASK, 0x08 .set UART_BUART_sRX_RxSts__3__POS, 3 .set UART_BUART_sRX_RxSts__4__MASK, 0x10 .set UART_BUART_sRX_RxSts__4__POS, 4 .set UART_BUART_sRX_RxSts__5__MASK, 0x20 .set UART_BUART_sRX_RxSts__5__POS, 5 .set UART_BUART_sRX_RxSts__MASK, 0x38 .set UART_BUART_sRX_RxSts__MASK_REG, CYREG_UDB_W8_MSK_01 .set UART_BUART_sRX_RxSts__STATUS_AUX_CTL_REG, CYREG_UDB_W8_ACTL_01 .set UART_BUART_sRX_RxSts__STATUS_REG, CYREG_UDB_W8_ST_01 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__16BIT_A0_REG, CYREG_UDB_W16_A0_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__16BIT_A1_REG, CYREG_UDB_W16_A1_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__16BIT_D0_REG, CYREG_UDB_W16_D0_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__16BIT_D1_REG, CYREG_UDB_W16_D1_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__16BIT_DP_AUX_CTL_REG, CYREG_UDB_W16_ACTL_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__16BIT_F0_REG, CYREG_UDB_W16_F0_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__16BIT_F1_REG, CYREG_UDB_W16_F1_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__A0_A1_REG, CYREG_UDB_CAT16_A_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__A0_REG, CYREG_UDB_W8_A0_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__A1_REG, CYREG_UDB_W8_A1_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__D0_D1_REG, CYREG_UDB_CAT16_D_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__D0_REG, CYREG_UDB_W8_D0_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__D1_REG, CYREG_UDB_W8_D1_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__DP_AUX_CTL_REG, CYREG_UDB_W8_ACTL_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__F0_F1_REG, CYREG_UDB_CAT16_F_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__F0_REG, CYREG_UDB_W8_F0_02 .set UART_BUART_sTX_sCLOCK_TxBitClkGen__F1_REG, CYREG_UDB_W8_F1_02 .set UART_BUART_sTX_TxShifter_u0__A0_A1_REG, CYREG_UDB_CAT16_A_03 .set UART_BUART_sTX_TxShifter_u0__A0_REG, CYREG_UDB_W8_A0_03 .set UART_BUART_sTX_TxShifter_u0__A1_REG, CYREG_UDB_W8_A1_03 .set UART_BUART_sTX_TxShifter_u0__D0_D1_REG, CYREG_UDB_CAT16_D_03 .set UART_BUART_sTX_TxShifter_u0__D0_REG, CYREG_UDB_W8_D0_03 .set UART_BUART_sTX_TxShifter_u0__D1_REG, CYREG_UDB_W8_D1_03 .set UART_BUART_sTX_TxShifter_u0__DP_AUX_CTL_REG, CYREG_UDB_W8_ACTL_03 .set UART_BUART_sTX_TxShifter_u0__F0_F1_REG, CYREG_UDB_CAT16_F_03 .set UART_BUART_sTX_TxShifter_u0__F0_REG, CYREG_UDB_W8_F0_03 .set UART_BUART_sTX_TxShifter_u0__F1_REG, CYREG_UDB_W8_F1_03 .set UART_BUART_sTX_TxSts__0__MASK, 0x01 .set UART_BUART_sTX_TxSts__0__POS, 0 .set UART_BUART_sTX_TxSts__1__MASK, 0x02 .set UART_BUART_sTX_TxSts__1__POS, 1 .set UART_BUART_sTX_TxSts__2__MASK, 0x04 .set UART_BUART_sTX_TxSts__2__POS, 2 .set UART_BUART_sTX_TxSts__3__MASK, 0x08 .set UART_BUART_sTX_TxSts__3__POS, 3 .set UART_BUART_sTX_TxSts__MASK, 0x0F .set UART_BUART_sTX_TxSts__MASK_REG, CYREG_UDB_W8_MSK_03 .set UART_BUART_sTX_TxSts__STATUS_AUX_CTL_REG, CYREG_UDB_W8_ACTL_03 .set UART_BUART_sTX_TxSts__STATUS_REG, CYREG_UDB_W8_ST_03 /* UART_IntClock */ .set UART_IntClock__DIVIDER_MASK, 0x0000FFFF .set UART_IntClock__ENABLE, CYREG_CLK_DIVIDER_A00 .set UART_IntClock__ENABLE_MASK, 0x80000000 .set UART_IntClock__MASK, 0x80000000 .set UART_IntClock__REGISTER, CYREG_CLK_DIVIDER_A00 /* UART_RXInternalInterrupt */ .set UART_RXInternalInterrupt__INTC_CLR_EN_REG, CYREG_CM0_ICER .set UART_RXInternalInterrupt__INTC_CLR_PD_REG, CYREG_CM0_ICPR .set UART_RXInternalInterrupt__INTC_MASK, 0x01 .set UART_RXInternalInterrupt__INTC_NUMBER, 0 .set UART_RXInternalInterrupt__INTC_PRIOR_MASK, 0xC0 .set UART_RXInternalInterrupt__INTC_PRIOR_NUM, 3 .set UART_RXInternalInterrupt__INTC_PRIOR_REG, CYREG_CM0_IPR0 .set UART_RXInternalInterrupt__INTC_SET_EN_REG, CYREG_CM0_ISER .set UART_RXInternalInterrupt__INTC_SET_PD_REG, CYREG_CM0_ISPR /* UART_TXInternalInterrupt */ .set UART_TXInternalInterrupt__INTC_CLR_EN_REG, CYREG_CM0_ICER .set UART_TXInternalInterrupt__INTC_CLR_PD_REG, CYREG_CM0_ICPR .set UART_TXInternalInterrupt__INTC_MASK, 0x04 .set UART_TXInternalInterrupt__INTC_NUMBER, 2 .set UART_TXInternalInterrupt__INTC_PRIOR_MASK, 0xC00000 .set UART_TXInternalInterrupt__INTC_PRIOR_NUM, 3 .set UART_TXInternalInterrupt__INTC_PRIOR_REG, CYREG_CM0_IPR0 .set UART_TXInternalInterrupt__INTC_SET_EN_REG, CYREG_CM0_ISER .set UART_TXInternalInterrupt__INTC_SET_PD_REG, CYREG_CM0_ISPR /* Miscellaneous */ .set CYDEV_BCLK__HFCLK__HZ, 24000000 .set CYDEV_BCLK__HFCLK__KHZ, 24000 .set CYDEV_BCLK__HFCLK__MHZ, 24 .set CYDEV_BCLK__SYSCLK__HZ, 24000000 .set CYDEV_BCLK__SYSCLK__KHZ, 24000 .set CYDEV_BCLK__SYSCLK__MHZ, 24 .set CYDEV_CHIP_DIE_LEOPARD, 1 .set CYDEV_CHIP_DIE_PSOC4A, 16 .set CYDEV_CHIP_DIE_PSOC5LP, 2 .set CYDEV_CHIP_DIE_PSOC5TM, 3 .set CYDEV_CHIP_DIE_TMA4, 4 .set CYDEV_CHIP_DIE_UNKNOWN, 0 .set CYDEV_CHIP_FAMILY_FM0P, 5 .set CYDEV_CHIP_FAMILY_FM3, 6 .set CYDEV_CHIP_FAMILY_FM4, 7 .set CYDEV_CHIP_FAMILY_PSOC3, 1 .set CYDEV_CHIP_FAMILY_PSOC4, 2 .set CYDEV_CHIP_FAMILY_PSOC5, 3 .set CYDEV_CHIP_FAMILY_PSOC6, 4 .set CYDEV_CHIP_FAMILY_UNKNOWN, 0 .set CYDEV_CHIP_FAMILY_USED, CYDEV_CHIP_FAMILY_PSOC4 .set CYDEV_CHIP_JTAG_ID, 0x04C81193 .set CYDEV_CHIP_MEMBER_3A, 1 .set CYDEV_CHIP_MEMBER_4A, 16 .set CYDEV_CHIP_MEMBER_4D, 12 .set CYDEV_CHIP_MEMBER_4E, 6 .set CYDEV_CHIP_MEMBER_4F, 17 .set CYDEV_CHIP_MEMBER_4G, 4 .set CYDEV_CHIP_MEMBER_4H, 15 .set CYDEV_CHIP_MEMBER_4I, 21 .set CYDEV_CHIP_MEMBER_4J, 13 .set CYDEV_CHIP_MEMBER_4K, 14 .set CYDEV_CHIP_MEMBER_4L, 20 .set CYDEV_CHIP_MEMBER_4M, 19 .set CYDEV_CHIP_MEMBER_4N, 9 .set CYDEV_CHIP_MEMBER_4O, 7 .set CYDEV_CHIP_MEMBER_4P, 18 .set CYDEV_CHIP_MEMBER_4Q, 11 .set CYDEV_CHIP_MEMBER_4R, 8 .set CYDEV_CHIP_MEMBER_4S, 10 .set CYDEV_CHIP_MEMBER_4U, 5 .set CYDEV_CHIP_MEMBER_5A, 3 .set CYDEV_CHIP_MEMBER_5B, 2 .set CYDEV_CHIP_MEMBER_6A, 22 .set CYDEV_CHIP_MEMBER_FM3, 26 .set CYDEV_CHIP_MEMBER_FM4, 27 .set CYDEV_CHIP_MEMBER_PDL_FM0P_TYPE1, 23 .set CYDEV_CHIP_MEMBER_PDL_FM0P_TYPE2, 24 .set CYDEV_CHIP_MEMBER_PDL_FM0P_TYPE3, 25 .set CYDEV_CHIP_MEMBER_UNKNOWN, 0 .set CYDEV_CHIP_MEMBER_USED, CYDEV_CHIP_MEMBER_4A .set CYDEV_CHIP_DIE_EXPECT, CYDEV_CHIP_MEMBER_USED .set CYDEV_CHIP_DIE_ACTUAL, CYDEV_CHIP_DIE_EXPECT .set CYDEV_CHIP_REV_LEOPARD_ES1, 0 .set CYDEV_CHIP_REV_LEOPARD_ES2, 1 .set CYDEV_CHIP_REV_LEOPARD_ES3, 3 .set CYDEV_CHIP_REV_LEOPARD_PRODUCTION, 3 .set CYDEV_CHIP_REV_PSOC4A_ES0, 17 .set CYDEV_CHIP_REV_PSOC4A_PRODUCTION, 17 .set CYDEV_CHIP_REV_PSOC5LP_ES0, 0 .set CYDEV_CHIP_REV_PSOC5LP_PRODUCTION, 0 .set CYDEV_CHIP_REV_PSOC5TM_ES0, 0 .set CYDEV_CHIP_REV_PSOC5TM_ES1, 1 .set CYDEV_CHIP_REV_PSOC5TM_PRODUCTION, 1 .set CYDEV_CHIP_REV_TMA4_ES, 17 .set CYDEV_CHIP_REV_TMA4_ES2, 33 .set CYDEV_CHIP_REV_TMA4_PRODUCTION, 17 .set CYDEV_CHIP_REVISION_3A_ES1, 0 .set CYDEV_CHIP_REVISION_3A_ES2, 1 .set CYDEV_CHIP_REVISION_3A_ES3, 3 .set CYDEV_CHIP_REVISION_3A_PRODUCTION, 3 .set CYDEV_CHIP_REVISION_4A_ES0, 17 .set CYDEV_CHIP_REVISION_4A_PRODUCTION, 17 .set CYDEV_CHIP_REVISION_4D_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4E_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4F_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4F_PRODUCTION_256DMA, 0 .set CYDEV_CHIP_REVISION_4F_PRODUCTION_256K, 0 .set CYDEV_CHIP_REVISION_4G_ES, 17 .set CYDEV_CHIP_REVISION_4G_ES2, 33 .set CYDEV_CHIP_REVISION_4G_PRODUCTION, 17 .set CYDEV_CHIP_REVISION_4H_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4I_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4J_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4K_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4L_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4M_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4N_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4O_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4P_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4Q_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4R_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4S_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_4U_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_5A_ES0, 0 .set CYDEV_CHIP_REVISION_5A_ES1, 1 .set CYDEV_CHIP_REVISION_5A_PRODUCTION, 1 .set CYDEV_CHIP_REVISION_5B_ES0, 0 .set CYDEV_CHIP_REVISION_5B_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_6A_NO_UDB, 0 .set CYDEV_CHIP_REVISION_6A_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_FM3_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_FM4_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_PDL_FM0P_TYPE1_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_PDL_FM0P_TYPE2_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_PDL_FM0P_TYPE3_PRODUCTION, 0 .set CYDEV_CHIP_REVISION_USED, CYDEV_CHIP_REVISION_4A_PRODUCTION .set CYDEV_CHIP_REV_EXPECT, CYDEV_CHIP_REVISION_USED .set CYDEV_CONFIG_READ_ACCELERATOR, 1 .set CYDEV_CONFIG_UNUSED_IO_AllowButWarn, 0 .set CYDEV_CONFIG_UNUSED_IO, CYDEV_CONFIG_UNUSED_IO_AllowButWarn .set CYDEV_CONFIG_UNUSED_IO_AllowWithInfo, 1 .set CYDEV_CONFIG_UNUSED_IO_Disallowed, 2 .set CYDEV_CONFIGURATION_COMPRESSED, 1 .set CYDEV_CONFIGURATION_MODE_COMPRESSED, 0 .set CYDEV_CONFIGURATION_MODE, CYDEV_CONFIGURATION_MODE_COMPRESSED .set CYDEV_CONFIGURATION_MODE_DMA, 2 .set CYDEV_CONFIGURATION_MODE_UNCOMPRESSED, 1 .set CYDEV_DEBUG_PROTECT_KILL, 4 .set CYDEV_DEBUG_PROTECT_OPEN, 1 .set CYDEV_DEBUG_PROTECT, CYDEV_DEBUG_PROTECT_OPEN .set CYDEV_DEBUG_PROTECT_PROTECTED, 2 .set CYDEV_DEBUGGING_DPS_Disable, 3 .set CYDEV_DEBUGGING_DPS_SWD, 2 .set CYDEV_DEBUGGING_DPS, CYDEV_DEBUGGING_DPS_SWD .set CYDEV_DEBUGGING_ENABLE, 1 .set CYDEV_DFT_SELECT_CLK0, 1 .set CYDEV_DFT_SELECT_CLK1, 2 .set CYDEV_HEAP_SIZE, 0x80 .set CYDEV_IMO_TRIMMED_BY_USB, 0 .set CYDEV_IMO_TRIMMED_BY_WCO, 0 .set CYDEV_IS_EXPORTING_CODE, 0 .set CYDEV_IS_IMPORTING_CODE, 0 .set CYDEV_PROJ_TYPE, 0 .set CYDEV_PROJ_TYPE_BOOTLOADER, 1 .set CYDEV_PROJ_TYPE_LAUNCHER, 5 .set CYDEV_PROJ_TYPE_LOADABLE, 2 .set CYDEV_PROJ_TYPE_LOADABLEANDBOOTLOADER, 4 .set CYDEV_PROJ_TYPE_MULTIAPPBOOTLOADER, 3 .set CYDEV_PROJ_TYPE_STANDARD, 0 .set CYDEV_STACK_SIZE, 0x0400 .set CYDEV_USE_BUNDLED_CMSIS, 1 .set CYDEV_VARIABLE_VDDA, 0 .set CYDEV_VDDA, 5 .set CYDEV_VDDA_MV, 5000 .set CYDEV_VDDD, 5 .set CYDEV_VDDD_MV, 5000 .set CYDEV_WDT_GENERATE_ISR, 0 .set CYIPBLOCK_M0S8_CTBM_VERSION, 0 .set CYIPBLOCK_m0s8cpuss_VERSION, 0 .set CYIPBLOCK_m0s8csd_VERSION, 0 .set CYIPBLOCK_m0s8gpio2_VERSION, 0 .set CYIPBLOCK_m0s8hsiom4a_VERSION, 0 .set CYIPBLOCK_m0s8lcd_VERSION, 0 .set CYIPBLOCK_m0s8lpcomp_VERSION, 0 .set CYIPBLOCK_m0s8pclk_VERSION, 0 .set CYIPBLOCK_m0s8sar_VERSION, 0 .set CYIPBLOCK_m0s8scb_VERSION, 0 .set CYIPBLOCK_m0s8srssv2_VERSION, 1 .set CYIPBLOCK_m0s8tcpwm_VERSION, 0 .set CYIPBLOCK_m0s8udbif_VERSION, 0 .set CYIPBLOCK_S8_GPIO_VERSION, 2 .set CYDEV_BOOTLOADER_ENABLE, 0 .endif
create database jk_pro_db character set utf8;--建库语句 /* Navicat Premium Data Transfer Source Server : local Source Server Type : MySQL Source Server Version : 80018 Source Host : localhost:3306 Source Schema : jk_pro_db Target Server Type : MySQL Target Server Version : 80018 File Encoding : 65001 Date: 20/02/2020 16:00:21 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for book -- ---------------------------- DROP TABLE IF EXISTS `book`; CREATE TABLE `book` ( `id` bigint(11) NOT NULL AUTO_INCREMENT, `number` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `name` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `author` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `publishingHouse` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `price` decimal(10, 2) NULL DEFAULT NULL, `type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `inventory` int(6) NULL DEFAULT NULL, `lendCount` int(6) NULL DEFAULT NULL, `location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `description` varchar(4000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of book -- ---------------------------- INSERT INTO `book` VALUES (1, '001', 'Thinking In java', 'Bruce Eckel', 'Mechanical industry press', 1.00, '1', 30, 0, 'A-3', 'Classic object-oriented narrative for beginners and professionals'); INSERT INTO `book` VALUES (2, '002', 'Crazy English', 'Yang Li', 'Sun yat-sen university press', 89.00, '3', 10, 0, 'A-3', 'Crazy English is a set of unique English learning methods invented by li Yang. He advocates speaking English crazily'); INSERT INTO `book` VALUES (3, '003', 'Tom and Jerry', 'William Hanna', 'Jia jia cartoon', 16.00, '4', 20, 0, 'A-1', 'The plot of Tom and jerry revolves around a pair of common house cats, Tom and jerry the mouse. Tom has a strong desire to constantly try to catch jerry the mouse who is living in the same room, and constantly try to drive the lodger away'); SET FOREIGN_KEY_CHECKS = 1;
DROP TABLE IF EXISTS post; DROP TABLE IF EXISTS candidate; DROP TABLE IF EXISTS users; DROP TABLE IF EXISTS city; CREATE TABLE post ( id SERIAL PRIMARY KEY, name TEXT ); CREATE TABLE candidate ( id SERIAL PRIMARY KEY, name TEXT, city TEXT ); CREATE TABLE users ( id SERIAL PRIMARY KEY, name TEXT, email TEXT, password TEXT ); CREATE TABLE city ( id SERIAL PRIMARY KEY, name TEXT );
CREATE TABLE IF NOT EXISTS `orders`( `id` INT PRIMARY KEY AUTO_INCREMENT, `order_date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `order_address` VARCHAR(255) NOT NULL, `order_client` INT NOT NULL, FOREIGN KEY (`order_client`) REFERENCES `users` (`id`) ON DELETE CASCADE );
SELECT Right(A.FechaInicioID,2) & "/" & Mid(A.FechaInicioID,5,2) & "/" & Left(A.FechaInicioID,4) AS FechaInicio, Right(A.FechaFinID,2) & "/" & Mid(A.FechaFinID,5,2) & "/" & Left(A.FechaFinID,4) AS FechaFin, Format(A.Percepcion,"0%") AS IGV, PercepcionID FROM TB_Percepcion AS A;
-- phpMyAdmin SQL Dump -- version 4.4.10 -- http://www.phpmyadmin.net -- -- Host: localhost:3306 -- Generation Time: Apr 01, 2016 at 07:32 AM -- Server version: 5.5.42 -- PHP Version: 5.6.10 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- Database: `weteam` -- -- -------------------------------------------------------- -- -- Table structure for table `project` -- CREATE TABLE `project` ( `id` int(11) NOT NULL, `project_name` varchar(64) NOT NULL, `user_name` varchar(64) NOT NULL, `user_phone` varchar(20) NOT NULL, `time` int(11) NOT NULL, `content` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `project_membar` -- CREATE TABLE `project_membar` ( `id` int(11) NOT NULL, `individual_id` int(11) NOT NULL, `project_id` int(11) NOT NULL, `time` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `team` -- CREATE TABLE `team` ( `id` int(11) NOT NULL, `name` varchar(64) NOT NULL, `content` text, `time` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `team_member` -- CREATE TABLE `team_member` ( `id` int(11) NOT NULL, `individual_id` int(11) NOT NULL, `team_id` int(11) NOT NULL, `time` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `type` int(11) DEFAULT NULL, `mail` varchar(128) NOT NULL, `name` varchar(64) NOT NULL, `password` varchar(64) NOT NULL, `time` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Indexes for dumped tables -- -- -- Indexes for table `project` -- ALTER TABLE `project` ADD PRIMARY KEY (`id`); -- -- Indexes for table `project_membar` -- ALTER TABLE `project_membar` ADD PRIMARY KEY (`id`); -- -- Indexes for table `team` -- ALTER TABLE `team` ADD PRIMARY KEY (`id`); -- -- Indexes for table `team_member` -- ALTER TABLE `team_member` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `project` -- ALTER TABLE `project` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `project_membar` -- ALTER TABLE `project_membar` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `team` -- ALTER TABLE `team` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `team_member` -- ALTER TABLE `team_member` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
-- MySQL dump 10.13 Distrib 8.0.13, for Win64 (x86_64) -- -- Host: localhost Database: diplom -- ------------------------------------------------------ -- Server version 8.0.13 /*!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 */; SET NAMES utf8 ; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `user` -- DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; SET character_set_client = utf8mb4 ; CREATE TABLE `user` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) DEFAULT NULL, `surname` varchar(45) DEFAULT NULL, `midleName` varchar(45) DEFAULT NULL, `login` varchar(100) DEFAULT NULL, `password` varchar(100) DEFAULT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user` -- LOCK TABLES `user` WRITE; /*!40000 ALTER TABLE `user` DISABLE KEYS */; INSERT INTO `user` VALUES (32,'Игорь','Романов','Владимирович','Krat','1234'),(33,'Иван','Иванов','Иванович','Teacher','1234'),(34,'Петя','Петров','Петровивич','Admin','1234'),(35,'Серегй','Крылов','Станисловович','student','1234'),(36,'Кирилл','Власов','Андреевич','Student2','1234'),(37,'Романов','Игорь','Владимирович2','injener','1234'),(39,'GGGG','GFFF','OOOOO','Injener62','1234'),(41,'FFFFFFF','PFPFPFP','FAFAFAFAf','Petrovich','1234'),(42,'Frank','Yodic','Frankovix','FFF231','1234'); /*!40000 ALTER TABLE `user` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2019-02-12 18:11:31
/* DECLARE CURSOR C_CARTEIRA_ELO IS */ WITH CTE_PROBLEM AS ( select DISTINCT ct.NU_CONTRATO_SAP, ct.CD_ITEM_CONTRATO, ct.NU_ORDEM_VENDA, ct.CD_PRODUTO_SAP from vnd.elo_carteira ct inner join vnd.elo_agendamento age on ct.cd_elo_agendamento = age.cd_elo_agendamento inner join vnd.elo_agendamento_supervisor sup on age.cd_elo_agendamento = sup.cd_elo_agendamento inner join vnd.elo_agendamento_item item on sup.cd_elo_agendamento_supervisor = item.cd_elo_agendamento_supervisor and item.cd_elo_agendamento_item = ct.cd_elo_agendamento_item LEFT join vnd.elo_agendamento_week wees on item.cd_elo_agendamento_item = wees.cd_elo_agendamento_item and wees.qt_semana <> ct.qt_saldo where age.cd_elo_status in (6, 7,8) and nu_ordem_venda not in ('0', 'x', 'x') and ct.cd_status_customer_service is not null and ct.cd_status_cel_final is not null and ((ct.cd_tipo_agendamento in (22,23,24)) OR ( ct.cd_tipo_agendamento = 25 and ct.cd_status_replan = 32) ) and (ct.qt_agendada_confirmada >= 0 or ct.qt_saldo <> ct.qt_agendada_confirmada) and NVL((SELECT SUM(DDDAY.NU_QUANTIDADE) D FROM VND.ELO_AGENDAMENTO_DAY DDDAY WHERE DDDAY.CD_ELO_AGENDAMENTO_WEEK = wees.CD_ELO_AGENDAMENTO_WEEK),0) <> NVL(wees.qt_semana,0) ) select AGE.CD_ELO_AGENDAMENTO, ct.CD_ELO_CARTEIRA, wees.CD_ELO_AGENDAMENTO_WEEK, ct.cd_tipo_agendamento, ct.cd_elo_agendamento_item, ct.NU_CONTRATO_SAP, ct.CD_ITEM_CONTRATO, ct.NU_ORDEM_VENDA, age.NU_CARTEIRA_VERSION, ct.CD_STATUS_CUSTOMER_SERVICE, ct.CD_INCOTERMS, ct.CD_STATUS_CEL_FINAL, ct.cd_centro_expedidor, ct.ds_centro_expedidor, ct.qt_agendada_confirmada, ct.qt_saldo, (select MAX(QT_SALDO) FROM VND.ELO_CARTEIRA_SAP SAP WHERE SAP.NU_CONTRATO_SAP = CT.NU_CONTRATO_SAP AND SAP.CD_ITEM_CONTRATO = CT.CD_ITEM_CONTRATO AND SAP.CD_PRODUTO_SAP = CT.CD_PRODUTO_SAP AND SAP.CD_INCOTERMS = CT.CD_INCOTERMS AND SAP.NU_ORDEM_VENDA = CT.NU_ORDEM_VENDA) MAX_QT_SALDO_OV_SAP, (select MIN(QT_SALDO) FROM VND.ELO_CARTEIRA_SAP SAP WHERE SAP.NU_CONTRATO_SAP = CT.NU_CONTRATO_SAP AND SAP.CD_ITEM_CONTRATO = CT.CD_ITEM_CONTRATO AND SAP.CD_PRODUTO_SAP = CT.CD_PRODUTO_SAP AND SAP.CD_INCOTERMS = CT.CD_INCOTERMS AND SAP.NU_ORDEM_VENDA = CT.NU_ORDEM_VENDA) MIN_QT_SALDO_OV_SAP, (select MAX(QT_SALDO) FROM VND.ELO_CARTEIRA_SAP SAP WHERE SAP.NU_CONTRATO_SAP = CT.NU_CONTRATO_SAP AND SAP.CD_ITEM_CONTRATO = CT.CD_ITEM_CONTRATO AND SAP.CD_PRODUTO_SAP = CT.CD_PRODUTO_SAP AND SAP.CD_INCOTERMS = CT.CD_INCOTERMS AND SAP.CD_CLIENTE = CT.CD_CLIENTE AND SAP.NU_CARTEIRA_VERSION = AGE.NU_CARTEIRA_VERSION AND SAP.NU_ORDEM_VENDA = CT.NU_ORDEM_VENDA) QT_SALDO_OV_CVERSION_SAP, wees.qt_semana, NVL((SELECT SUM(DDDAY.NU_QUANTIDADE) FROM VND.ELO_AGENDAMENTO_DAY DDDAY WHERE DDDAY.CD_ELO_AGENDAMENTO_WEEK = wees.CD_ELO_AGENDAMENTO_WEEK),0) TOTALDAY from vnd.elo_carteira ct inner join vnd.elo_agendamento age on ct.cd_elo_agendamento = age.cd_elo_agendamento inner join vnd.elo_agendamento_supervisor sup on age.cd_elo_agendamento = sup.cd_elo_agendamento inner join vnd.elo_agendamento_item item on sup.cd_elo_agendamento_supervisor = item.cd_elo_agendamento_supervisor and item.cd_elo_agendamento_item = ct.cd_elo_agendamento_item LEFT join vnd.elo_agendamento_week wees on item.cd_elo_agendamento_item = wees.cd_elo_agendamento_item where EXISTS (select 1 from CTE_PROBLEM ov where ov.nu_ordem_venda = ct.nu_ordem_venda and ov.cd_produto_sap = ct.cd_produto_sap) or EXISTS (select 1 from CTE_PROBLEM ov where ov.nu_contrato_sap = ct.nu_contrato_sap and ov.cd_item_contrato = ct.cd_item_contrato and ov.cd_produto_sap = ct.cd_produto_sap) ; /* TYPE carteira_sap_r IS RECORD ( CD_ELO_CARTEIRA VND.elo_carteira.CD_ELO_CARTEIRA%TYPE, NU_CONTRATO_SAP VND.elo_carteira.NU_CONTRATO_SAP%TYPE, CD_ITEM_CONTRATO VND.elo_carteira.CD_ITEM_CONTRATO%TYPE, NU_ORDEM_VENDA VND.elo_carteira.NU_ORDEM_VENDA%TYPE, NU_CARTEIRA_VERSION VND.elo_carteira.NU_CARTEIRA_VERSION%TYPE, cd_centro_expedidor VND.elo_carteira.cd_centro_expedidor%TYPE, ds_centro_expedidor VND.elo_carteira.ds_centro_expedidor%TYPE ); TYPE carteira_sap_t IS TABLE OF carteira_sap_r; tableof_carteira_sap carteira_sap_t; tableof_carteira_elo carteira_sap_t; BEGIN BEGIN OPEN C_CARTEIRA_ELO; FETCH C_CARTEIRA_ELO BULK COLLECT INTO tableof_carteira_elo LIMIT 10000; CLOSE C_CARTEIRA_ELO; FORALL C_LINHA IN tableof_carteira_elo.first .. tableof_carteira_elo.last UPDATE VND.ELO_CARTEIRA SA SET SA.DS_CENTRO_EXPEDIDOR = tableof_carteira_elo(C_LINHA).DS_CENTRO_EXPEDIDOR WHERE SA.DS_CENTRO_EXPEDIDOR <> tableof_carteira_elo(C_LINHA).DS_CENTRO_EXPEDIDOR AND SA.CD_ELO_CARTEIRA = tableof_carteira_elo(C_LINHA).CD_ELO_CARTEIRA; COMMIT; END; END; / select ct.CD_ELO_CARTEIRA, ct.NU_CONTRATO_SAP, ct.CD_ITEM_CONTRATO, ct.NU_ORDEM_VENDA, '' NU_CARTEIRA_VERSION, ct.cd_centro_expedidor, ct.ds_centro_expedidor, cc.DS_CENTRO_EXPEDIDOR CENTRO_FROM_BASE from vnd.elo_carteira ct inner join ctf.centro_expedidor cc on ct.cd_centro_expedidor = cc.cd_centro_expedidor where ct.ds_centro_expedidor <> cc.ds_centro_expedidor; */
USE web; INSERT INTO types (type_name, extension) VALUES ('Текстов файл', 'txt');
# Anios con mayor cantidad de registro de nombres SELECT sum(cantidad) registros, anio FROM nombres_hist.hist_nombres group by anio order by registros desc LIMIT 5; # Anios con menor cantidad de registro de nombres desde 1978 SELECT sum(cantidad) registros, anio FROM nombres_hist.hist_nombres group by anio having anio >= 1978 order by registros asc; # Cual fueron los nombres mas registrados? SELECT nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres group by nombre having registros > 100 order by registros desc; # Cual fueron los 5 nombres mas registrados por decada - Por posible asociacion historica # 1950 - 1960 (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 1922 AND 1929 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5) UNION (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 1930 AND 1939 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5) UNION (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 1940 AND 1949 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5) UNION (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 1950 AND 1959 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5) UNION (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 1960 AND 1969 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5) UNION (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 1970 AND 1979 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5) UNION (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 1980 AND 1989 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5) UNION (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 1990 AND 1999 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5) UNION (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 2000 AND 2009 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5) UNION (SELECT concat('Decada ',decada) titulo, nombre, sum(cantidad) registros FROM nombres_hist.hist_nombres WHERE anio BETWEEN 2010 AND 2015 GROUP BY nombre, titulo HAVING registros > 100 ORDER BY registros DESC LIMIT 5);
 CREATE PROCEDURE [tSQLt].[RunNew] AS BEGIN EXEC tSQLt.Private_RunMethodHandler @RunMethod = 'tSQLt.Private_RunNew'; END;
SELECT h_id, name, SUM(score) FROM (SELECT s.hacker_id AS h_id, h.name AS name, s.challenge_id AS c_id, MAX(s.score) AS score FROM Submissions s JOIN Hackers h ON s.hacker_id = h.hacker_id GROUP BY s.hacker_id, h.name, s.challenge_id) AS maxScores GROUP BY h_id, name HAVING SUM(score) <> 0 ORDER BY SUM(score) DESC, h_id ASC;
/* SQLyog Ultimate v12.09 (64 bit) MySQL - 5.5.22 : Database - resturant ********************************************************************* */ /*!40101 SET NAMES utf8 */; /*!40101 SET SQL_MODE=''*/; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`resturant` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `resturant`; /* Procedure structure for procedure `SHOW_ITEMS_BASED_ON_BUDGET` */ /*!50003 DROP PROCEDURE IF EXISTS `SHOW_ITEMS_BASED_ON_BUDGET` */; DELIMITER $$ /*!50003 CREATE DEFINER=`root`@`localhost` PROCEDURE `SHOW_ITEMS_BASED_ON_BUDGET`(in AMOUNT_YOU_HAVE int) begin declare NO_OF_ITEMS int; SELECT COUNT(ITEM) into NO_OF_ITEMS FROM food_items WHERE PRICE <=AMOUNT_YOU_HAVE ; if AMOUNT_YOU_HAVE <= 0 then select ' Please enter a valid budget amount'; elseif !NO_OF_ITEMS then select 'Sorry no items avilable at that budget'; else select ITEM,PRICE from food_items where PRICE <=AMOUNT_YOU_HAVE; end if; end */$$ DELIMITER ; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
use ClientDB CREATE TABLE Client_A_Contacts ( first_name varchar(30), last_name varchar(30), city varchar(30), county varchar(30), zip varchar(30), officePhone varchar(30), mobilePhone varchar(30) )
# 改密码 todo truncate table articles; insert into articles (id,title,content) VALUES (1,'101','# 101考试chrome插件(e.101.com和elearning.101.com页面下)在 开始考试或者重新考试页面![image](https://github.com/frankerzeng/e.101.com/blob/master/begin.png)点击插件中的开始考试按钮,等待答案填充完毕即可交卷。需手动提交,防止过快答题导致被查水表'); truncate table navigation; insert into navigation (title,link,css) VALUES ('首页','index','font-weight:bold;font-size: larger;margin-left:40px'); insert into navigation (title,link,css) VALUES ('文章','articles',''); insert into navigation (title,link,css) VALUES ('Git','http://github.com/frankerzeng',''); insert into navigation (title,link,css) VALUES ('面点','fsc','font-weight:bold;font-size:larger;margin-left:40px');
create unique index IDX_PLANNER_SPEAKER_UNIQ_EMAIL on PLANNER_SPEAKER (EMAIL); create index IDX_PLANNER_SPEAKER on PLANNER_SPEAKER (LAST_NAME);
-- script que enumere todos los registros de la tabla SELECT score, name FROM second_table WHERE name IS NOT NULL ORDER BY score DESC;
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Počítač: 127.0.0.1 -- Vytvořeno: Pát 27. zář 2019, 08:08 -- Verze serveru: 10.1.39-MariaDB -- Verze PHP: 7.3.5 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 */; -- -- Databáze: `remante` -- -- -------------------------------------------------------- -- -- Struktura tabulky `produkty` -- CREATE TABLE `produkty` ( `id` int(10) UNSIGNED NOT NULL, `cena` int(11) NOT NULL, `popis` text CHARACTER SET latin1, `kod` varchar(15) CHARACTER SET latin1 NOT NULL, `typy_produktu_id` int(11) NOT NULL, `vyrobci_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; -- -- Vypisuji data pro tabulku `produkty` -- INSERT INTO `produkty` (`id`, `cena`, `popis`, `kod`, `typy_produktu_id`, `vyrobci_id`) VALUES (3, 5313, '', '0414720313', 5, 2), (4, 5139, 'Nový vst?ikova? Common Rail BOSCH PIEZO 0445116030\n', '0445116030', 3, 2), (5, 8452, 'Repasované vysokotlaké ?erpadlo Common rail DELPHI DFP1 R9042A041A repasujeme s použitím originálních náhradních díl? a je kalibrováno na certifikovaném testovacím za?ízení výrobce tohoto dílu. Repasovaný výrobek se funk?n? rovná stavu nového kusu.', 'R9042A041A', 2, 3), (6, 24109, 'Nové vysokotlaké ?erpadlo Common rail BOSCH CP4 0445010507\n', '0445010507', 2, 2), (7, 21900, 'Podávací modul pro vst?ikovaní mo?oviny, známý také pod názvem AdBlue, repasujeme s použitím originálních náhradních díl? a následn? je repasovaný díl kalibrován na testovacím za?ízení výrobce tohoto dílu. Repasovaný výrobek se funk?n? rovná stavu nového kusu.', '0444010008', 8, 2), (9, 4887, 'Nový zadní tlumi? pérování A1643200725\n', 'A1643200725', 6, 2), (10, 44080, 'Repasované vst?ikovací ?erpadlo Zexel VRZ 109144-3062 repasujeme s použitím originálních náhradních díl? a je kalibrováno na certifikovaném testovacím za?ízení výrobce tohoto dílu. Repasovaný výrobek se funk?n? rovná stavu nového kusu.', '109144-3062', 1, 1), (11, 123456, 'Nový vst?ikova? Common Rail BOSCH CRI 0445110338\n', '0445110338', 3, 2), (12, 7093, 'Repasované turbodmychadlo s podtlakovou regulací GARRETT 454231-5010S repasujeme s použitím originálních náhradních díl? a je kalibrováno na certifikovaném testovacím za?ízení výrobce tohoto dílu. Repasovaný výrobek se funk?n? rovná stavu nového kusu.', '454231-5010S', 4, 1), (13, 17164, 'Repasované vst?ikovací ?erpadlo BOSCH VP44 0470504005 repasujeme s použitím originálních náhradních díl? a je kalibrováno na certifikovaném testovacím za?ízení výrobce tohoto dílu. Repasovaný výrobek se funk?n? rovná stavu nového kusu.', '0470504005', 1, 2), (14, 12500, '', '0445116030', 3, 2), (15, 5376, 'Repasované turbodmychadlo s podtlakovou regulací GARRETT 753420-5006S repasujeme s použitím originálních náhradních díl? a je kalibrováno na certifikovaném testovacím za?ízení výrobce tohoto dílu. Repasovaný výrobek se funk?n? rovná stavu nového kusu.', '753420-5006S', 4, 4); -- -------------------------------------------------------- -- -- Struktura tabulky `typy_produktu` -- CREATE TABLE `typy_produktu` ( `id` int(11) NOT NULL, `typ` varchar(100) COLLATE utf8_czech_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; -- -- Vypisuji data pro tabulku `typy_produktu` -- INSERT INTO `typy_produktu` (`id`, `typ`) VALUES (1, 'Vstřikovací čerpadla'), (2, 'Vysokotlaká čerpadla'), (3, 'Vstřikovače'), (4, 'Turbodmychadla'), (5, 'Čerpadlo - tryska PDE/UIS'), (6, 'Tlumiče a kompresory pérovaní'), (7, 'Díly řízení'), (8, 'AdBlue - Podávací modul pro vstřikování močoviny'); -- -------------------------------------------------------- -- -- Struktura tabulky `vyrobci` -- CREATE TABLE `vyrobci` ( `id` int(11) NOT NULL, `vyrobce` varchar(45) COLLATE utf8_czech_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; -- -- Vypisuji data pro tabulku `vyrobci` -- INSERT INTO `vyrobci` (`id`, `vyrobce`) VALUES (1, 'Zexel'), (2, 'Bosch'), (3, 'Delphi'), (4, 'Garett'); -- -- Klíče pro exportované tabulky -- -- -- Klíče pro tabulku `produkty` -- ALTER TABLE `produkty` ADD PRIMARY KEY (`id`), ADD KEY `fk_typy_produktu_id` (`typy_produktu_id`), ADD KEY `fk_vyrobci_id` (`vyrobci_id`); -- -- Klíče pro tabulku `typy_produktu` -- ALTER TABLE `typy_produktu` ADD PRIMARY KEY (`id`); -- -- Klíče pro tabulku `vyrobci` -- ALTER TABLE `vyrobci` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT pro tabulky -- -- -- AUTO_INCREMENT pro tabulku `produkty` -- ALTER TABLE `produkty` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; -- -- AUTO_INCREMENT pro tabulku `typy_produktu` -- ALTER TABLE `typy_produktu` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT pro tabulku `vyrobci` -- ALTER TABLE `vyrobci` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- Omezení pro exportované tabulky -- -- -- Omezení pro tabulku `produkty` -- ALTER TABLE `produkty` ADD CONSTRAINT `fk_typy_produktu_id` FOREIGN KEY (`typy_produktu_id`) REFERENCES `typy_produktu` (`id`), ADD CONSTRAINT `fk_vyrobci_id` FOREIGN KEY (`vyrobci_id`) REFERENCES `vyrobci` (`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 */;
drop table if exists entries; create table entries ( id int not null AUTO_INCREMENT, name varchar(40) not null, title text not null, text text not null, PRIMARY KEY (id) );
select c.* from customer order by name limit @PageSize offset @PageNum * @PageSize
/** * SQL to get record in table BY_SHISETSU_WITHOUT_INS_SRV * @author QuocHN * @version $Id: CareMedicalService_getPreviewShisetsuInsurance_Sel_01.sql 23596 2014-08-27 10:04:01Z p_hoan_kuokku $ */ SELECT BSWIS.SERVICE_CONTENTS, BSWIS.WITHOUT_INSURANCE_SERVICE_KBN, BSWIS.COST_MAX, BSWIS.COST_MIN, BSWIS.COST_CON_KBN, BSWIS.PAYMENT_TERM, BSWIS.PROVIDE_CONTENTS FROM BY_SHISETSU_WITHOUT_INS_SRV BSWIS WHERE BSWIS.SHISETSU_CD = /*shisetsuCd*/'000002095' AND BSWIS.DELETE_FLG = '0'
-- 1)在MySQL中创建ads_gmv_sum_day表 DROP TABLE IF EXISTS ads_gmv_sum_day; CREATE TABLE ads_gmv_sum_day( `dt` varchar(200) DEFAULT NULL COMMENT '统计日期', `gmv_count` bigint(20) DEFAULT NULL COMMENT '当日gmv订单个数', `gmv_amount` decimal(16, 2) DEFAULT NULL COMMENT '当日gmv订单总金额', `gmv_payment` decimal(16, 2) DEFAULT NULL COMMENT '当日支付金额' ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '每日活跃用户数量' ROW_FORMAT = Dynamic; -- 2)向MySQL中插入数据 INSERT INTO `ads_gmv_sum_day` VALUES ('2019-03-01 22:51:37', 1000, 210000.00, 2000.00); INSERT INTO `ads_gmv_sum_day` VALUES ('2019-05-08 22:52:32', 3434, 12413.00, 1.00); INSERT INTO `ads_gmv_sum_day` VALUES ('2019-07-13 22:52:51', 1222, 324345.00, 1.00); INSERT INTO `ads_gmv_sum_day` VALUES ('2019-09-13 22:53:08', 2344, 12312.00, 1.00);
--group by 分组 --在mysql默认情况下,select后字段只能出现以下两种情况 --1.在group by后出现的 2.在聚合函数中出现的 --按照性别分组,查询所有性别 select gender from students group by gender; --计算每一种性别的人数 select gender '性别',count(*) '人数' from students group by gender; --计算每一个年龄的人数 select age '年龄',count(*) '人数' from students group by age; --group by + group_concat(字段名); 将分组结果连接成一个字符串 --查询同种性别中的名字 select gender,group_concat(name) from students GROUP BY gender; +--------+---------------------------------------------------------------------+ | gender | group_concat(name) | +--------+---------------------------------------------------------------------+ | 男 | 彭于晏,刘德华,周杰伦,程坤,郭靖,司马二狗 | | 女 | 小明,小月月,黄蓉,王祖贤,刘亦菲,静香,周杰,凌小小 | | 中性 | 金星 | | 保密 | 凤姐 | +--------+---------------------------------------------------------------------+ --查询每组性别的平均年龄 select gender,round(avg(age),2) from students GROUP BY gender; --group by + having 用于过滤 分组后结果 [where会在group之前执行] --where是在查询时过滤的 having是在分组后进行过滤 --查询每组性别的平均年龄大于30的 select gender,round(avg(age),2) from students GROUP BY gender having avg(age)>30; --你也可以起别名 select gender,round(avg(age),2) AVG from students GROUP BY gender having AVG>30; --查询每种性别的平均年龄和名字 select gender,round(avg(age),2),group_concat(name) from students GROUP BY gender; --查询每种性别中的人数多于两个的性别和名字 select gender,count(gender),group_concat(name) from students GROUP BY gender having count(gender) > 2; --with rollup 汇总 select gender,count(*) from students GROUP BY gender with rollup;
-- 생성 : 회원 CREATE TABLE MEMBER ( u_no NUMBER CONSTRAINT member_pk PRIMARY KEY, u_id VARCHAR2(30) CONSTRAINT member_id_nn NOT NULL, u_pw VARCHAR2(30) CONSTRAINT member_pw_nn NOT NULL, u_name VARCHAR2(30) CONSTRAINT member_name_nn NOT NULL, u_phone VARCHAR2(20) CONSTRAINT member_phone_nn NOT NULL, u_gender VARCHAR2(10) CONSTRAINT member_gender_nn NOT NULL, u_date DATE CONSTRAINT member_date_nn NOT NULL, u_addr VARCHAR2(100) CONSTRAINT member_addr_nn NOT NULL, u_tel VARCHAR2(20), u_mode CHAR(1) CONSTRAINT member_mode_nn NOT NULL, u_joindate DATE CONSTRAINT member_joindate_nn NOT NULL, u_email VARCHAR2(50) CONSTRAINT member_email_nn NOT NULL, u_point NUMBER CONSTRAINT member_point_nn NOT NULL ); CREATE SEQUENCE member_no_seq; -- 생성 : 포인트내역 CREATE TABLE POINT_LOG ( poi_no NUMBER CONSTRAINT point_log_pk PRIMARY KEY, u_no NUMBER CONSTRAINT point_u_no_fk REFERENCES MEMBER(u_no), poi_value NUMBER CONSTRAINT point_value_nn NOT NULL, poi_action VARCHAR2(10) CONSTRAINT point_action_nn NOT NULL, poi_content VARCHAR2(50) CONSTRAINT point_content_nn NOT NULL, poi_date DATE CONSTRAINT point_date NOT NULL ); CREATE SEQUENCE point_log_no_seq; -- 생성 : 상품 CREATE TABLE PRODUCT ( p_no NUMBER CONSTRAINT product_pk PRIMARY KEY, p_company VARCHAR2(30) CONSTRAINT product_company_nn NOT NULL, p_name VARCHAR2(30) CONSTRAINT product_name_nn NOT NULL, p_price NUMBER CONSTRAINT product_price_nn NOT NULL, p_cnt NUMBER CONSTRAINT product_cnt_nn NOT NULL, p_charge NUMBER CONSTRAINT product_charge_nn NOT NULL, p_category VARCHAR2(20) CONSTRAINT product_category_nn NOT NULL, p_m_img_path VARCHAR2(100) CONSTRAINT product_m_image_path_nn NOT NULL, p_s_img_path VARCHAR2(100) CONSTRAINT product_s_image_path_nn NOT NULL, p_date DATE CONSTRAINT product_date_nn NOT NULL ); CREATE SEQUENCE product_no_seq; -- 생성 : 장바구니 테이블 CREATE TABLE BASKET ( b_no NUMBER CONSTRAINT basket_pk PRIMARY KEY, u_no NUMBER CONSTRAINT basket_u_no_fk REFERENCES MEMBER(u_no), p_no NUMBER CONSTRAINT basket_p_no_fk REFERENCES PRODUCT(p_no) ); CREATE SEQUENCE basket_no_seq; -- 생성 : 주문(상품) CREATE TABLE ORDER_PRODUCT ( o_no NUMBER CONSTRAINT order_product_pk PRIMARY KEY, u_no NUMBER CONSTRAINT order_product_u_no_fk REFERENCES MEMBER(u_no), p_no NUMBER CONSTRAINT order_product_p_no_fk REFERENCES PRODUCT(p_no), o_date DATE CONSTRAINT order_product_date_nn NOT NULL, o_phone NUMBER CONSTRAINT order_product_phone_nn NOT NULL, o_addr VARCHAR2(100) CONSTRAINT order_product_addr_nn NOT NULL, o_cnt NUMBER CONSTRAINT order_product_cnt_nn NOT NULL, o_state VARCHAR2(20) CONSTRAINT order_product_state_nn NOT NULL ); CREATE SEQUENCE order_pr_no_seq; -- 생성 : 최근 본 상품 CREATE TABLE VIEW_PRODUCT ( u_no NUMBER, p_no NUMBER, v_date DATE, CONSTRAINT view_product_u_no_fk FOREIGN KEY(u_no) REFERENCES MEMBER(u_no), CONSTRAINT view_product_p_no_fk FOREIGN KEY(p_no) REFERENCES PRODUCT(p_no) ); CREATE SEQUENCE view_pro_no_seq; DROP TABLE view_product; SELECT * FROM view_product; -- 유저 데이터 입력 INSERT INTO USER_TABLE VALUES(1,1,'test1','1111','테스트','010-1111-2222','남자',to_date('2000-01-01', 'YYYY-MM-DD'), '서울 신림동','031-231-1111','N',sysdate,'aaa@naver.com'); INSERT INTO USER_TABLE VALUES(2,2,'test2','2222','김스트','010-7777-7777','남자',to_date('1998-08-08', 'YYYY-MM-DD'), '청주 개신동','043-222-1111','N',sysdate,'bbbb@naver.com'); INSERT INTO USER_TABLE VALUES(3,3,'test3','3333','이스트','010-6666-6666','여자',to_date('2005-05-05', 'YYYY-MM-DD'), '수원 매탄동','031-777-1234','N',sysdate,'cccc@naver.com'); DROP TABLE USER_TABLE; SELECT * FROM USER_TABLE; -- 포인트 데이터 입력 INSERT INTO POINT_TABLE VALUES(1,1000); INSERT INTO POINT_TABLE VALUES(2,2000); INSERT INTO POINT_TABLE VALUES(3,3000); -- 포인트내역 데이터 입력 INSERT INTO POINT_LOG_TABLE VALUES(1,200,'적립','새해보너스',to_date('2021/01/01', 'YYYY/MM/DD')); INSERT INTO POINT_LOG_TABLE VALUES(1,-200,'사용','상품 구매',to_date('2021/01/02', 'YYYY/MM/DD')); INSERT INTO POINT_LOG_TABLE VALUES(1,200,'적립','로그인보너스',to_date('2021/01/03', 'YYYY/MM/DD')); INSERT INTO POINT_LOG_TABLE VALUES(2,200,'적립','새해보너스',to_date('2021/01/01', 'YYYY/MM/DD')); INSERT INTO POINT_LOG_TABLE VALUES(2,-100,'사용','상품 구매',to_date('2021/01/02', 'YYYY/MM/DD')); INSERT INTO POINT_LOG_TABLE VALUES(2,300,'적립','로그인보너스',to_date('2021/01/03', 'YYYY/MM/DD')); INSERT INTO POINT_LOG_TABLE VALUES(3,200,'적립','새해보너스',to_date('2021/01/01', 'YYYY/MM/DD')); INSERT INTO POINT_LOG_TABLE VALUES(3,-100,'사용','상품 구매',to_date('2021/01/02', 'YYYY/MM/DD')); INSERT INTO POINT_LOG_TABLE VALUES(3,500,'적립','로그인보너스',to_date('2021/01/03', 'YYYY/MM/DD')); -- 상품테이블 데이터 입력 INSERT INTO PRODUCT VALUES(1,'사과','에코빈',1000,100,2500,'과일','메인이미지','상세이미지',to_date('2020/11/01', 'YYYY/MM/DD')); INSERT INTO PRODUCT VALUES(2,'바나나','에코빈',2500,30,2500,'과일','메인이미지','상세이미지',to_date('2020/11/01', 'YYYY/MM/DD')); INSERT INTO PRODUCT VALUES(3,'샴푸','에코빈',5500,20,2500,'욕실용품','메인이미지','상세이미지',to_date('2020/12/01', 'YYYY/MM/DD')); INSERT INTO PRODUCT VALUES(4,'체리','에코빈',5000,10,2500,'과일','메인이미지','상세이미지',to_date('2021/01/01', 'YYYY/MM/DD')); INSERT INTO PRODUCT VALUES(5,'바나나','카카오',3500,30,2500,'과일','메인이미지','상세이미지',to_date('2020/11/01', 'YYYY/MM/DD')); -- 장바구니 데이터 입력 INSERT INTO basket VALUES(1,1,3); INSERT INTO basket VALUES(1,2,3); INSERT INTO basket VALUES(1,3,3); INSERT INTO basket VALUES(2,1,3); INSERT INTO basket VALUES(2,2,3); -- 입력 : 주문 테이블 INSERT INTO ORDER_TABLE VALUES(1,1,1,to_date('2020.06.01','YYYY/MM/DD'),'010-5032-1111','충북 청주시 서원구 111',3,'결재완료'); INSERT INTO ORDER_TABLE VALUES(2,1,2,to_date('2020.06.03','YYYY/MM/DD'),'010-5032-2222','충북 청주시 서원구 222',1,'배송완료'); INSERT INTO ORDER_TABLE VALUES(3,1,3,to_date('2020.07.02','YYYY/MM/DD'),'010-5032-3333','충북 청주시 서원구 222',5,'배송완료'); INSERT INTO ORDER_TABLE VALUES(4,2,3,to_date('2020.07.02','YYYY/MM/DD'),'010-5032-3333','충북 청주시 서원구 222',5,'배송완료'); INSERT INTO ORDER_TABLE VALUES(5,2,3,to_date('2020.07.02','YYYY/MM/DD'),'010-5032-3333','충북 청주시 서원구 222',5,'배송완료'); INSERT INTO ORDER_TABLE VALUES(6,3,4,to_date('2020.07.02','YYYY/MM/DD'),'010-5032-3333','충북 청주시 서원구 222',5,'배송완료'); INSERT INTO ORDER_TABLE VALUES(7,1,4,to_date('2018.07.02','YYYY/MM/DD'),'010-5032-3333','충북 청주시 서원구 222',5,'배송완료'); --입력 : 최근 본 상품 INSERT INTO VIEW_PRODUCT VALUES(1,1,to_date('2021-01-25 12:11:05','YYYY-MM-DD hh:mi:ss')); INSERT INTO VIEW_PRODUCT VALUES(1,2,to_date('2021-01-25 12:12:05','YYYY-MM-DD hh:mi:ss')); INSERT INTO VIEW_PRODUCT VALUES(1,3,to_date('2021-01-25 12:13:05','YYYY-MM-DD hh:mi:ss')); INSERT INTO VIEW_PRODUCT VALUES(2,1,to_date('2021-01-25 12:14:05','YYYY-MM-DD hh:mi:ss')); -- select SELECT * FROM USER_TABLE; SELECT * FROM POINT_TABLE; SELECT * FROM POINT_LOG_TABLE; SELECT * FROM PRODUCT; SELECT * FROM BASKET; SELECT * FROM ORDER_TABLE; SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = 'USER_TABLE'; SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = 'POINT_TABLE'; SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = 'POINT_LOG_TABLE'; SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = 'PRODUCT'; SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = 'BASKET'; SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = 'ORDER_TABLE'; -- 이름, 가입일, 포인트 표시 SELECT u_name AS 회원이름, u_date AS 가입일, poi_point AS 포인트 FROM USER_TABLE u, POINT_TABLE p WHERE u.u_no = p.u_no; -- 마이페이지 장바구니 품목 개수 표시 SELECT count(*) AS "장바구니 개수" FROM USER_TABLE u, BASKET b WHERE u.u_no = b.u_no AND b.u_no = 1; -- 장바구니 안에 품목 내역 SELECT pr.p_m_image AS 상품이미지, pr.p_company AS 제조사, pr.p_name AS 상품이름, pr.p_cnt AS 재고, pr.p_price AS 상품가격, b.cnt AS 구매수량, pr.p_charge AS 배송료 FROM USER_TABLE u, PRODUCT pr, BASKET b WHERE pr.p_no = b.p_no AND u.u_no = b.u_no AND u.u_no = 1; -- 주문내역 확인 전체 SELECT pr.p_name AS 상품이름, o.o_date AS 결제일, o.o_no AS 주문번호, pr.p_price * o.o_cnt AS 결제금액, o.o_state AS 주문상태 FROM USER_TABLE u, PRODUCT pr, ORDER_TABLE o WHERE u.u_no = o.u_no AND pr.p_no = o.p_no AND u.u_no = 1; -- 주문내역 확인 (1년전) SELECT pr.p_name AS 상품이름, o.o_date AS 결제일, o.o_no AS 주문번호, pr.p_price * o.o_cnt AS 결제금액, o.o_state AS 주문상태 FROM USER_TABLE u, PRODUCT pr, ORDER_TABLE o WHERE u.u_no = o.u_no AND pr.p_no = o.p_no AND u.u_no = 1 AND o.o_date > ADD_MONTHS(sysdate,-12); -- 최근 본 상품 SELECT pr.p_m_image AS 상품이미지, pr.p_company AS 제조사, pr.p_name AS 상품이름, pr.p_price AS 상품가격, v.v_date AS 쇼핑시간 FROM USER_TABLE u, PRODUCT pr, VIEW_PRODUCT v WHERE u.u_no = v.u_no AND v.p_no = pr.p_no AND u.u_no = 1 ORDER BY v.v_date DESC; SELECT * FROM USER_TABLE; SELECT * FROM POINT_TABLE; SELECT * FROM POINT_LOG_TABLE; SELECT * FROM PRODUCT; SELECT * FROM BASKET; SELECT * FROM ORDER_TABLE; SELECT * FROM VIEW_PRODUCT; -- 포인트 전체 조회 SELECT POI_POINT AS 포인트, POI_CONTENT AS 내용, POI_ACTION AS "획득/사용", POI_DATE AS 날짜 FROM USER_TABLE U, POINT_TABLE P WHERE U.POI_ID = P.POI_ID; -- 포인트 흭득 조회 SELECT POI_POINT AS 포인트, POI_CONTENT AS 내용, POI_ACTION AS "획득/사용", POI_DATE AS 날짜 FROM USER_TABLE U, POINT_TABLE P WHERE U.POI_ID = P.POI_ID AND POI_ACTION = '흭득'; -- 포인트 사용 조회 SELECT POI_POINT AS 포인트, POI_CONTENT AS 내용, POI_ACTION AS "획득/사용", POI_DATE AS 날짜 FROM USER_TABLE U, POINT_TABLE P WHERE U.POI_ID = P.POI_ID AND POI_ACTION = '사용'; -- VIEW 상품 조회 SELECT P_COMPANY AS 판매기업, P_NAME AS 상품명, P_OPTION AS 상품옵션명, P_PRICE AS 상품가격, P_M_IMAGE AS 상품이미지 FROM USER_TABLE U, PRODUCT P WHERE U.P_NO = P.P_NO;
LOCK INSTANCE FOR BACKUP; UNLOCK INSTANCE;
-- for the users table CREATE TABLE users (id BIGSERIAL PRIMARY KEY NOT NULL, email VARCHAR(200) NOT NULL, fullname VARCHAR(200) NOT NULL, password VARCHAR(200) NOT NULL, img Text, verified TEXT, online_socket_id TEXT, UNIQUE(email)); INSERT INTO users (email, fullname, password, img, verified) VALUES ('makindetimi@gmail.com', 'mrmakiaveli', 'qqqq', 'https://imgur.com/Zl6cnIS.png','true'); -- for the posts CREATE TABLE topics (id BIGSERIAL PRIMARY KEY NOT NULL, title VARCHAR(200) NOT NULL, slug VARCHAR(200) NOT NULL, img TEXT, creator_img TEXT, creator VARCHAR(200) NOT NULL, creator_email VARCHAR(200) NOT NULL, is_poster_verified TEXT, views VARCHAR(200), date VARCHAR(200) NOT NULL, time VARCHAR(200) NOT NULL, topic_body TEXT NOT NULL); INSERT INTO topics (title,slug,img,creator_img,creator,date,time,topic_body) VALUES ('how to fight','how-to-fight','img','creator_img','creator','date','time','this is my topic body'); -- for messages CREATE TABLE messages (id BIGSERIAL PRIMARY KEY NOT NULL, img TEXT, msg_room VARCHAR(200) NOT NULL, is_msg_sender_verified TEXT, messages TEXT NOT NULL, messages_with_img TEXT, email VARCHAR(200) NOT NULL, name VARCHAR(200) NOT NULL, date VARCHAR(200) NOT NULL, time VARCHAR(200) NOT NULL); -- for all direct messages CREATE TABLE direct_messages (id BIGSERIAL PRIMARY KEY NOT NULL, img TEXT, sent_from TEXT, sent_to TEXT, is_msg_sender_verified TEXT, messages TEXT NOT NULL, messages_with_img TEXT, name VARCHAR(200) NOT NULL, date VARCHAR(200) NOT NULL, time VARCHAR(200) NOT NULL); INSERT INTO messages (img,msg_room,messages,name,date,time) VALUES ('image','oscar','date','time');
select a.id, a.caption, a.start_date, a.end_date, a.signature_date, a.patient_card_id, a.doctor_id, coalesce(d.organization_id, uuid_in('00000000-0000-0000-0000-000000000000')) as organization_id, coalesce(doctor.last_name || ' ' || doctor.name|| ' ' || doctor.middle_name || ' (' || s.caption || ')', '') as doctor_name, coalesce(s.caption, '') as doctor_speciality_name, a.doctor_speciality_id, a.is_first, a.event_state_enum, a.interaction_type_enum, (select caption from enum_record where enum_type = 'AppointmentState' and code = a.event_state_enum) as event_state, (select caption from enum_record where enum_type = 'InteractionType' and code = a.interaction_type_enum) as interaction_type, a.doctor_recomendation, a.complaints, a.description, coalesce(patient.last_name || ' ' || patient.name|| ' ' || patient.middle_name, '') as person_full_name, coalesce(pc.reg_number || ' (' || patient.last_name || ' ' || patient.name || ' ' || patient.middle_name || ')', '') as patient_card_caption, coalesce(patient.phone, '') as person_phone from mis_appointment a inner join mis_patient_card pc on pc.id = a.patient_card_id and pc.record_state<>4 inner join org_employee d on a.doctor_id = d.id and d.record_state<>4 inner join person as doctor on doctor.id = d.person_id and doctor.record_state<>4 inner join cdn_speciality as s on s.id = a.doctor_speciality_id and s.record_state<>4 inner join person as patient on pc.person_id = patient.id and pc.record_state<>4 where a.record_state <> 4
/* Formatted on 17/06/2014 18:13:14 (QP5 v5.227.12220.39754) */ CREATE OR REPLACE FORCE VIEW MCRE_OWN.V_MCRES_FORI_ABILITATI_EPC ( LINE ) AS SELECT REPLACE ( RPAD (NVL (cod_user_id, ' '), 15, ' ') || ';' || RPAD (NVL (val_foro1, ' '), 50, ' '), CHR (10), ' ') line FROM t_mcres_app_legali_esterni WHERE cod_user_id IS NOT NULL AND val_foro1 IS NOT NULL UNION SELECT REPLACE ( RPAD (NVL (cod_user_id, ' '), 15, ' ') || ';' || RPAD (NVL (val_foro2, ' '), 50, ' '), CHR (10), ' ') line FROM t_mcres_app_legali_esterni WHERE cod_user_id IS NOT NULL AND val_foro2 IS NOT NULL UNION SELECT REPLACE ( RPAD (NVL (cod_user_id, ' '), 15, ' ') || ';' || RPAD (NVL (val_foro3, ' '), 50, ' '), CHR (10), ' ') line FROM t_mcres_app_legali_esterni WHERE cod_user_id IS NOT NULL AND val_foro3 IS NOT NULL UNION SELECT REPLACE ( RPAD (NVL (cod_user_id, ' '), 15, ' ') || ';' || RPAD (NVL (val_foro4, ' '), 50, ' '), CHR (10), ' ') line FROM t_mcres_app_legali_esterni WHERE cod_user_id IS NOT NULL AND val_foro4 IS NOT NULL; GRANT SELECT ON MCRE_OWN.V_MCRES_FORI_ABILITATI_EPC TO MCRE_USR;
-- phpMyAdmin SQL Dump -- version 4.2.9 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Mar 25, 2015 at 07:03 AM -- Server version: 5.6.20 -- PHP Version: 5.4.35 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: `engg` -- -- -------------------------------------------------------- -- -- Table structure for table `Chats` -- CREATE TABLE IF NOT EXISTS `Chats` ( `id` int(5) unsigned NOT NULL, `message` text NOT NULL, `time` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `files` -- CREATE TABLE IF NOT EXISTS `files` ( `file_id` int(10) unsigned NOT NULL, `file_name` varchar(255) COLLATE latin1_general_ci NOT NULL, `file_orig_name` varchar(255) COLLATE latin1_general_ci NOT NULL, `file_path` varchar(255) COLLATE latin1_general_ci NOT NULL, `upload_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `membership` -- CREATE TABLE IF NOT EXISTS `membership` ( `id` int(11) NOT NULL, `firstname` varchar(30) NOT NULL, `lastname` varchar(30) NOT NULL, `state` varchar(30) NOT NULL, `city` varchar(30) NOT NULL, `country` varchar(30) NOT NULL, `zip` int(6) NOT NULL, `address` varchar(500) NOT NULL, `email` varchar(30) NOT NULL, `mobileno` varchar(10) NOT NULL, `landlineno` varchar(15) NOT NULL, `username` varchar(30) NOT NULL, `password` varchar(100) NOT NULL, `date` date NOT NULL, `admin_id` varchar(100) NOT NULL, `status` int(1) NOT NULL ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -- Dumping data for table `membership` -- INSERT INTO `membership` (`id`, `firstname`, `lastname`, `state`, `city`, `country`, `zip`, `address`, `email`, `mobileno`, `landlineno`, `username`, `password`, `date`, `admin_id`, `status`) VALUES (1, '', '', '', '', '', 0, '', '', '', '', 'admin', '0192023a7bbd73250516f069df18b500', '0000-00-00', '', 0); -- -------------------------------------------------------- -- -- Table structure for table `student_list` -- CREATE TABLE IF NOT EXISTS `student_list` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `address` varchar(100) NOT NULL, `year` varchar(100) NOT NULL, `gender` varchar(100) NOT NULL, `interest` varchar(100) NOT NULL, `status` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -- -- Dumping data for table `student_list` -- INSERT INTO `student_list` (`id`, `name`, `address`, `year`, `gender`, `interest`, `status`) VALUES (1, 'admin', 'address', '201', 'male', 'music', 0), (2, 'admin', 'adddress', 'male', '2010', '', 1), (3, 'admin', 'adddress', 'male', '2010', '', 1), (4, 'admin', 'adddress', '2010', 'male', '', 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `Chats` -- ALTER TABLE `Chats` ADD PRIMARY KEY (`id`); -- -- Indexes for table `files` -- ALTER TABLE `files` ADD PRIMARY KEY (`file_id`); -- -- Indexes for table `membership` -- ALTER TABLE `membership` ADD PRIMARY KEY (`id`); -- -- Indexes for table `student_list` -- ALTER TABLE `student_list` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `Chats` -- ALTER TABLE `Chats` MODIFY `id` int(5) unsigned NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `files` -- ALTER TABLE `files` MODIFY `file_id` int(10) unsigned NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `membership` -- ALTER TABLE `membership` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `student_list` -- ALTER TABLE `student_list` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Server version: 10.3.1-MariaDB-10.3.1+maria~stretch - mariadb.org binary distribution -- Server OS: debian-linux-gnu -- HeidiSQL Version: 9.4.0.5125 -- -------------------------------------------------------- /*!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 registration DROP DATABASE IF EXISTS `registration`; CREATE DATABASE IF NOT EXISTS `registration` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `registration`; -- Dumping structure for table registration.member_type DROP TABLE IF EXISTS `member_type`; CREATE TABLE IF NOT EXISTS `member_type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL DEFAULT '0', `description` varchar(50) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -- Dumping data for table registration.member_type: ~3 rows (approximately) DELETE FROM `member_type`; /*!40000 ALTER TABLE `member_type` DISABLE KEYS */; INSERT INTO `member_type` (`id`, `name`, `description`) VALUES (1, 'Platinum', 'salary > 50,000 baht'), (2, 'Gold', 'salary between 30,000 to 50,000'), (3, 'Silver', 'salary < 30,000'); /*!40000 ALTER TABLE `member_type` ENABLE KEYS */; -- Dumping structure for table registration.user DROP TABLE IF EXISTS `user`; CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL DEFAULT '0', `password` varchar(255) NOT NULL DEFAULT '0', `salt` varchar(255) NOT NULL DEFAULT '0', `address` varchar(255) NOT NULL DEFAULT '0', `phone` varchar(50) NOT NULL DEFAULT '0', `reference_code` varchar(12) NOT NULL DEFAULT '0', `member_type_id` int(11) NOT NULL DEFAULT 0, `salary` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; /*!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 */;
/* Navicat MySQL Data Transfer Source Server : Eric Source Server Version : 50552 Source Host : localhost:3306 Source Database : shopping Target Server Type : MYSQL Target Server Version : 50552 File Encoding : 65001 Date: 2017-06-02 23:01:39 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for goodscategory -- ---------------------------- DROP TABLE IF EXISTS `goodscategory`; CREATE TABLE `goodscategory` ( `goodsCategoryId` int(11) NOT NULL AUTO_INCREMENT, `categoryId` int(11) DEFAULT NULL, `goodsId` int(11) DEFAULT NULL, PRIMARY KEY (`goodsCategoryId`), KEY `goodscategory_ibfk_1` (`categoryId`), KEY `goodscategory_ibfk_2` (`goodsId`), CONSTRAINT `goodscategory_ibfk_1` FOREIGN KEY (`categoryId`) REFERENCES `category` (`categoryId`), CONSTRAINT `goodscategory_ibfk_2` FOREIGN KEY (`goodsId`) REFERENCES `goods` (`goodsId`) ) ENGINE=InnoDB AUTO_INCREMENT=33038 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of goodscategory -- ---------------------------- INSERT INTO `goodscategory` VALUES ('11001', '1', '1001'); INSERT INTO `goodscategory` VALUES ('11002', '1', '1002'); INSERT INTO `goodscategory` VALUES ('11003', '1', '1003'); INSERT INTO `goodscategory` VALUES ('11004', '1', '1004'); INSERT INTO `goodscategory` VALUES ('11005', '1', '1005'); INSERT INTO `goodscategory` VALUES ('11006', '1', '1006'); INSERT INTO `goodscategory` VALUES ('22001', '2', '2001'); INSERT INTO `goodscategory` VALUES ('22002', '2', '2002'); INSERT INTO `goodscategory` VALUES ('22003', '2', '2003'); INSERT INTO `goodscategory` VALUES ('22004', '2', '2004'); INSERT INTO `goodscategory` VALUES ('22005', '2', '2005'); INSERT INTO `goodscategory` VALUES ('22006', '2', '2006'); INSERT INTO `goodscategory` VALUES ('33001', '3', '3001'); INSERT INTO `goodscategory` VALUES ('33002', '3', '3002'); INSERT INTO `goodscategory` VALUES ('33003', '3', '3003'); INSERT INTO `goodscategory` VALUES ('33004', '3', '3004'); INSERT INTO `goodscategory` VALUES ('33005', '3', '3005'); INSERT INTO `goodscategory` VALUES ('33006', '3', '3006'); INSERT INTO `goodscategory` VALUES ('33007', '3', '3007'); INSERT INTO `goodscategory` VALUES ('33008', '3', '3008'); INSERT INTO `goodscategory` VALUES ('33009', '3', '3009'); INSERT INTO `goodscategory` VALUES ('33010', '7', '4007'); INSERT INTO `goodscategory` VALUES ('33011', '7', '4008'); INSERT INTO `goodscategory` VALUES ('33012', '7', '4009'); INSERT INTO `goodscategory` VALUES ('33013', '7', '4010'); INSERT INTO `goodscategory` VALUES ('33014', '7', '4011'); INSERT INTO `goodscategory` VALUES ('33015', '7', '4012'); INSERT INTO `goodscategory` VALUES ('33016', '5', '4013'); INSERT INTO `goodscategory` VALUES ('33017', '5', '4014'); INSERT INTO `goodscategory` VALUES ('33018', '5', '4015'); INSERT INTO `goodscategory` VALUES ('33019', '5', '4016'); INSERT INTO `goodscategory` VALUES ('33020', '5', '4017'); INSERT INTO `goodscategory` VALUES ('33021', '4', '4001'); INSERT INTO `goodscategory` VALUES ('33022', '4', '4002'); INSERT INTO `goodscategory` VALUES ('33023', '4', '4003'); INSERT INTO `goodscategory` VALUES ('33024', '4', '4004'); INSERT INTO `goodscategory` VALUES ('33025', '4', '4005'); INSERT INTO `goodscategory` VALUES ('33026', '7', '4018'); INSERT INTO `goodscategory` VALUES ('33027', '7', '4019'); INSERT INTO `goodscategory` VALUES ('33028', '7', '4020'); INSERT INTO `goodscategory` VALUES ('33029', '9', '4021'); INSERT INTO `goodscategory` VALUES ('33030', '5', '4022'); INSERT INTO `goodscategory` VALUES ('33031', '5', '4023'); INSERT INTO `goodscategory` VALUES ('33032', '5', '4024'); INSERT INTO `goodscategory` VALUES ('33033', '5', '4025'); INSERT INTO `goodscategory` VALUES ('33034', '5', '4026'); INSERT INTO `goodscategory` VALUES ('33035', '5', '4027'); INSERT INTO `goodscategory` VALUES ('33036', '5', '4028'); INSERT INTO `goodscategory` VALUES ('33037', '2', '4029');
INSERT INTO user (name, surname, email, password_hash, role, date_of_birth, gender, phone) VALUES ('Den', 'Admin', 'demo@localhost', '$2a$10$ebyC4Z5WtCXXc.HGDc1Yoe6CLFzcntFmfse6/pTj7CeDY5I05w16C', 'ADMIN', 'september 20, 1995', 'MALE', 2323232323);
/** * SQL to get kaisha information * @author HaiTTH * @version $Id: KaishaEditService_getKaishaInfo_Sel_01.sql 11212 2014-07-04 07:26:36Z p_chan_hai $ */ SELECT K.KAISHA_LAST_UPDATE_USER_ID, K.KAISHA_LAST_UPDATE_DATE, K.KAISHA_LAST_KEISAI_USER_ID, K.KAISHA_LAST_KEISAI_DATE, K.KAISHA_KEISAI_REFLECT_KBN, K.KAISHA_CD, K.KAISHA_JUDGE_KBN, K.KAISHA_NAME, K.SHOGO_KBN, K.SHOGO_PLACE_KBN, K.GROUP_NAME, K.GROUP_NAME_PLACE_KBN, K.KAISHA_NAME_KANA, K.KAISHA_ADDRESS, K.KAISHA_ADDRESS_KEN_CD, K.KAISHA_ADDRESS_KEN_NAME, K.KAISHA_ADDRESS_SIKUGUN_CD, K.KAISHA_ADDRESS_SIKUGUN_NAME, K.KAISHA_ADDRESS_CHOSON_CD, K.KAISHA_ADDRESS_CHOSON_NAME, K.KAISHA_ADDRESS_AZA_CD, K.KAISHA_ADDRESS_AZA_NAME, K.KAISHA_ADDRESS_OTHER, K.ESTABLISH_YMD, K.CAPITAL, K.SALE_AMOUNT, K.DAIHYO_PERSON_NAME, K.EMPLOYEE_COUNT, K.BUSINESS_COUNTENTS, K.REMARK, K.CREATE_DATE, K.CREATE_USER_ID, K.CREATE_MODULE_ID, K.UPDATE_DATE, K.UPDATE_USER_ID, K.UPDATE_MODULE_ID, U1.NAME_SEI AS LAST_UPDATE_USER_NAME_SEI, U1.NAME_MEI AS LAST_UPDATE_USER_NAME_MEI, U2.NAME_SEI AS LAST_KEISAI_USER_NAME_SEI, U2.NAME_MEI AS LAST_KEISAI_USER_NAME_MEI FROM BY_KAISHA_KIHON K LEFT JOIN BY_USER U1 ON U1.USER_ID = K.KAISHA_LAST_UPDATE_USER_ID LEFT JOIN BY_USER U2 ON U2.USER_ID = K.KAISHA_LAST_KEISAI_USER_ID WHERE K.KAISHA_CD = /*kaishaCd*/'000001' AND DELETE_FLG = '0'
ALTER TABLE `user` CHANGE COLUMN `PAYMENT_ADAPTER_CONFIG` `PAYMENT_ADAPTER_CONFIG` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `AUTOCONFIRM_VENDORS`, CHANGE COLUMN `PAYMENT_ADAPTER_SELLER_CONFIG` `PAYMENT_ADAPTER_SELLER_CONFIG` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `PAYMENT_ADAPTER_CONFIG`; UPDATE `infoseite` i JOIN `string_info` si ON si.S_TABLE='infoseite' AND si.FK=i.ID_INFOSEITE AND si.BF_LANG=128 SET i.B_SYS=1 WHERE si.V1 IN ('header meta', 'header scripts', 'CODE FUER WEBSTATISTIK');
CREATE PROCEDURE sp_SendInscritos (@ciclo varchar(5), @zona integer, @plantel integer) AS DELETE FROM [mssql.cobaes.edu.mx].cescolar.dbo.inscritos WHERE Zona= @zona AND Plantel= @plantel INSERT INTO [mssql.cobaes.edu.mx].cescolar.dbo.inscritos SELECT al_zona AS Zona, al_numplant AS Plantel, al_semes AS Sem, al_grupo as Grupo, CASE WHEN al_turno='1' THEN '1-Matutino' WHEN al_turno='2' THEN '2-Vespertino' WHEN al_turno='3' THEN '3-Nocturno' END AS Turno, COUNT(DISTINCT or_matric) AS Alumnos, GETDATE() AS Actualizado FROM ordinar INNER JOIN alumnos ON al_matric=or_matric WHERE or_ciclo= @ciclo AND al_estatus='1' GROUP BY al_zona, al_numplant, al_turno, al_semes, al_grupo ORDER BY al_zona, al_numplant, al_turno, al_semes, al_grupo
create database if not exists gp; use gp; create table gptest ( id BIGINT NOT NULL AUTO_INCREMENT, stringforcalc VARCHAR(50) NOT NULL, result double NOT NULL, PRIMARY KEY (id), unique (stringforcalc) );
-- DB: matrix -- -- 单元 -- DROP TABLE IF EXISTS `a_matrix_unit`; CREATE TABLE `a_matrix_unit` ( `id` CHAR(16) NOT NULL, `pid` CHAR(16) DEFAULT NULL, `name` VARCHAR(200) NOT NULL, `icon` VARCHAR(100) DEFAULT NULL, `note` TEXT, `ctime` INTEGER(10) DEFAULT NULL, `mtime` INTEGER(10) DEFAULT NULL, `boost` INTEGER DEFAULT '0', `state` TINYINT DEFAULT '1', PRIMARY KEY (`id`), FOREIGN KEY (`pid`) REFERENCES `a_matrix_unit` (`id`) ON DELETE CASCADE ); CREATE INDEX `IK_a_matrix_unit_unit` ON `a_matrix_unit` (`pid`); CREATE INDEX `IK_a_matrix_unit_state` ON `a_matrix_unit` (`state`); CREATE INDEX `IK_a_matrix_unit_ctime` ON `a_matrix_unit` (`ctime`); CREATE INDEX `IK_a_matrix_unit_mtime` ON `a_matrix_unit` (`mtime`); CREATE UNIQUE INDEX `UK_a_matrix_unit_name` ON `a_matrix_unit` (`name`,`pid`); -- -- 表单 -- DROP TABLE IF EXISTS `a_matrix_form`; CREATE TABLE `a_matrix_form` ( `id` CHAR(16) NOT NULL, `unit_id` CHAR(16) NOT NULL, `name` VARCHAR(200) NOT NULL, `icon` VARCHAR(100) DEFAULT NULL, `note` TEXT, `conf` TEXT NOT NULL, `ctime` INTEGER(10) DEFAULT NULL, `mtime` INTEGER(10) DEFAULT NULL, `boost` INTEGER DEFAULT '0', `state` TINYINT DEFAULT '1', PRIMARY KEY (`id`), FOREIGN KEY (`unit_id`) REFERENCES `a_matrix_unit` (`id`) ON DELETE CASCADE ); CREATE INDEX `IK_a_matrix_form_unit` ON `a_matrix_form` (`unit_id`); CREATE INDEX `IK_a_matrix_form_state` ON `a_matrix_form` (`state`); CREATE INDEX `IK_a_matrix_form_ctime` ON `a_matrix_form` (`ctime`); CREATE INDEX `IK_a_matrix_form_mtime` ON `a_matrix_form` (`mtime`); CREATE UNIQUE INDEX `UK_a_matrix_form_name` ON `a_matrix_form` (`name`,`unit_id`); -- -- 数据 -- DROP TABLE IF EXISTS `a_matrix_data`; CREATE TABLE `a_matrix_data` ( `id` CHAR(16) NOT NULL, `form_id` CHAR(16) NOT NULL, `user_id` CHAR(16) NOT NULL, `name` VARCHAR(255) DEFAULT NULL, `memo` VARCHAR(255) DEFAULT NULL, `meno` VARCHAR(100) DEFAULT NULL, `data` LONGTEXT NOT NULL, `ctime` INTEGER(10) NOT NULL, `etime` INTEGER(10) NOT NULL, `rtime` INTEGER(10) DEFAULT NULL, /* 从哪个时间点恢复 */ `state` TINYINT DEFAULT '1', PRIMARY KEY (`id`,`form_id`,`etime`) ); CREATE INDEX `IK_a_matrix_data_id` ON `a_matrix_data` (`id`); CREATE INDEX `IK_a_matrix_data_form` ON `a_matrix_data` (`form_id`); CREATE INDEX `IK_a_matrix_data_user` ON `a_matrix_data` (`user_id`); CREATE INDEX `IK_a_matrix_data_meno` ON `a_matrix_data` (`meno`); CREATE INDEX `IK_a_matrix_data_state` ON `a_matrix_data` (`state`); CREATE INDEX `IK_a_matrix_data_ctime` ON `a_matrix_data` (`ctime`); CREATE INDEX `IK_a_matrix_data_etime` ON `a_matrix_data` (`etime`); CREATE INDEX `IK_a_matrix_data_rtime` ON `a_matrix_data` (`rtime`); -- -- 预定内置关联资源 -- INSERT INTO a_matrix_unit (`id`, `pid`, `name`, `icon`, `note`, `ctime`, `mtime`, `boost`, `state`) VALUES ('-', NULL, '内置', '', '', 0, 0, 0, 1); INSERT INTO a_matrix_form (`id`, `unit_id`, `name`, `icon`, `note`, `conf`, `ctime`, `mtime`, `boost`, `state`) VALUES ('user', '-', '用户', '', '', '{ "form":"user", "conf":"master", "data-vk":"id", "data-tk":"name", "data-at":"centra/master/user/list", "data-al":"centra/master/user/pick.html", "data-rl":"" }', 0, 0, 0, 6);
CREATE TABLE `branding` ( `b_id` int(11) NOT NULL, `b_name` varchar(250) NOT NULL, `b_url` varchar(500) NOT NULL, `b_reg_date` timestamp NOT NULL DEFAULT current_timestamp(), `b_user_key` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `branding` -- INSERT INTO `branding` (`b_id`, `b_name`, `b_url`, `b_reg_date`, `b_user_key`) VALUES (2, 'Yahoo Changed oN', 'yahoo.com', '2021-09-11 14:01:00', 3); -- -------------------------------------------------------- -- -- Table structure for table `campaigns` -- CREATE TABLE `campaigns` ( `id` int(11) NOT NULL, `campaign_name` varchar(150) CHARACTER SET latin1 NOT NULL, `domain_name` varchar(150) CHARACTER SET latin1 NOT NULL, `selected_style` varchar(150) CHARACTER SET latin1 NOT NULL, `delay` varchar(150) CHARACTER SET latin1 NOT NULL, `branding` varchar(150) CHARACTER SET latin1 NOT NULL, `date_reg` datetime NOT NULL DEFAULT current_timestamp(), `date_update` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `js_code` varchar(255) DEFAULT NULL, `user_key` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `campaigns` -- INSERT INTO `campaigns` (`id`, `campaign_name`, `domain_name`, `selected_style`, `delay`, `branding`, `date_reg`, `date_update`, `js_code`, `user_key`) VALUES (1, 'This is a Campaign', 'campaign.com', 'Rounded', '100', 'Yahoo', '2021-09-10 18:32:00', '2021-09-18 11:08:34', NULL, 3); -- -------------------------------------------------------- -- -- Table structure for table `feedback` -- CREATE TABLE `feedback` ( `fb_id` int(11) NOT NULL, `fb_name` varchar(255) NOT NULL, `fb_description` text NOT NULL, `fb_star` int(11) NOT NULL, `fb_image` text NOT NULL, `fb_created_at` timestamp NOT NULL DEFAULT current_timestamp(), `fb_updated_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `feedback` -- INSERT INTO `feedback` (`fb_id`, `fb_name`, `fb_description`, `fb_star`, `fb_image`, `fb_created_at`, `fb_updated_at`) VALUES (1, 'Reveew', 'This is a Review', 4, 'protecting-data-and-privacy-in-the-cloud.jpg', '2021-09-18 18:04:38', '2021-09-18 18:04:38'), (2, 'I got brilliant', 'Brilliant', 4, '1199.jpg', '2021-09-18 18:08:44', '2021-09-18 18:08:44'), (3, 'I got brilliant', 'sdfsafsafas', 5, '1199.jpg', '2021-09-18 18:52:54', '2021-09-18 18:52:54'); -- -------------------------------------------------------- -- -- Table structure for table `negative_fb` -- CREATE TABLE `negative_fb` ( `nf_id` int(11) NOT NULL, `nf_email` varchar(255) NOT NULL, `nf_phone` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `negative_fb` -- INSERT INTO `negative_fb` (`nf_id`, `nf_email`, `nf_phone`, `created_at`) VALUES (1, 'sumirzai@gmail.com', '0782571943', '2021-09-18 18:07:33'), (2, 'sumirzai@gmail.com', '0782571943', '2021-09-18 18:08:52'); -- -------------------------------------------------------- -- -- Table structure for table `review_link` -- CREATE TABLE `review_link` ( `rev_id` int(11) NOT NULL, `rev_name` varchar(255) NOT NULL, `rev_slug` varchar(255) NOT NULL, `rev_desc` text NOT NULL, `rev_image` text NOT NULL, `rev_approve` int(11) NOT NULL DEFAULT 0, `rev_campaign` varchar(255) NOT NULL, `rev_nmsg1` text NOT NULL, `rev_nmsg2` text NOT NULL, `rev_rating` int(11) NOT NULL, `rev_pmsg` text NOT NULL, `user_key` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `review_link` -- INSERT INTO `review_link` (`rev_id`, `rev_name`, `rev_slug`, `rev_desc`, `rev_image`, `rev_approve`, `rev_campaign`, `rev_nmsg1`, `rev_nmsg2`, `rev_rating`, `rev_pmsg`, `user_key`) VALUES (11, 'Nishat Review Link', 'Nishat', 'This is a slug testing review Link', 'about_me.jpg', 1, 'This', 'This is used for Testing', 'This is used for Testing', 4, 'This is used for Testing', 3), (12, 'Some Testing Review', 'Testing-Review', 'This is a Testing Review For Testing FeedBack Form', 'What-is-a-VPN.png', 1, 'This', 'Why You do not want to Suggest Us.', 'Why You do not want to Suggest Us.', 3, 'Thank you for you Review', 3); -- -------------------------------------------------------- -- -- Table structure for table `sticky_review` -- CREATE TABLE `sticky_review` ( `st_id` int(11) NOT NULL, `st_name` varchar(255) NOT NULL, `st_tags` varchar(255) NOT NULL, `st_desc` text NOT NULL, `st_stars` int(11) NOT NULL, `st_date` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `st_user` int(11) NOT NULL, `st_image` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `sticky_review` -- INSERT INTO `sticky_review` (`st_id`, `st_name`, `st_tags`, `st_desc`, `st_stars`, `st_date`, `st_user`, `st_image`) VALUES (8, 'Updated', 'Updates', 'This is a test upload', 5, '2021-09-17 04:22:00', 3, 'WIN_20210520_12_12_52_Pro.jpg'), (20, 'Ahmad Samad', 'Ahmad, Samad, AFG', 'This is a test Review', 4, '2021-09-17 01:24:00', 2, '1199.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `u_id` int(11) NOT NULL, `u_name` varchar(250) NOT NULL, `u_email` varchar(250) NOT NULL, `u_password` varchar(32) NOT NULL, `u_register_date` timestamp NOT NULL DEFAULT current_timestamp(), `u_token` varchar(250) NOT NULL, `u_statue` int(11) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `users` -- INSERT INTO `users` (`u_id`, `u_name`, `u_email`, `u_password`, `u_register_date`, `u_token`, `u_statue`) VALUES (2, 'Safiullah Mirzai', 'kingsum781@gmail.com', '81dc9bdb52d04dc20036dbd8313ed055', '2021-09-16 10:10:24', '26535dfc36d09acde14e3a98a2396de2', 1), (3, 'Ahmad Rahed', 'sumirzai@gmail.com', '81dc9bdb52d04dc20036dbd8313ed055', '2021-09-16 16:25:52', '66dfd35cae1c4a5b1db6a79ffb7e5716', 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `branding` -- ALTER TABLE `branding` ADD PRIMARY KEY (`b_id`); -- -- Indexes for table `campaigns` -- ALTER TABLE `campaigns` ADD PRIMARY KEY (`id`); -- -- Indexes for table `feedback` -- ALTER TABLE `feedback` ADD PRIMARY KEY (`fb_id`); -- -- Indexes for table `negative_fb` -- ALTER TABLE `negative_fb` ADD PRIMARY KEY (`nf_id`); -- -- Indexes for table `review_link` -- ALTER TABLE `review_link` ADD PRIMARY KEY (`rev_id`); -- -- Indexes for table `sticky_review` -- ALTER TABLE `sticky_review` ADD PRIMARY KEY (`st_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`u_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `branding` -- ALTER TABLE `branding` MODIFY `b_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `campaigns` -- ALTER TABLE `campaigns` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `feedback` -- ALTER TABLE `feedback` MODIFY `fb_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `negative_fb` -- ALTER TABLE `negative_fb` MODIFY `nf_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `review_link` -- ALTER TABLE `review_link` MODIFY `rev_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; -- -- AUTO_INCREMENT for table `sticky_review` -- ALTER TABLE `sticky_review` MODIFY `st_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `u_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; 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 */;
--Procedimiento para la devolucion de un material en prestamo CREATE OR REPLACE PROCEDURE spDevolucion( vIdMat IN prestamo.IdMaterial%TYPE, vNumEjemp IN prestamo.numEjemplar%TYPE, vFechaDev IN DATE ) AS vIdLect prestamo.idLector%TYPE; BEGIN SELECT idLector INTO vIdLect FROM prestamo WHERE idMaterial = vIdMat AND numEjemplar = vNumEjemp; INSERT INTO devuelveEjem(idLector,idMaterial,numEjemplar,fechaDevolucion) VALUES(vIdLect, vIdMat, vNumEjemp, vFechaDev); DELETE FROM prestamo WHERE idMaterial = vIdMat AND numEjemplar = vNumEjemp; COMMIT; END spDevolucion; / SHOW ERRORS
DROP TABLE collaborators;
-- Databricks notebook source -- MAGIC %md -- MAGIC ###Databrick SQL Guide -- MAGIC https://docs.databricks.com/spark/latest/spark-sql/language-manual/create-table.html -- COMMAND ---------- -- MAGIC %fs ls /FileStore/tables/retail_db/orders -- COMMAND ---------- CREATE EXTERNAL Table orders ( order_id int, order_date timestamp, order_customer_id int, order_status string )ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION '/FileStore/tables/retail_db/orders' -- COMMAND ---------- Select * from Orders; -- COMMAND ---------- CREATE EXTERNAL TABLE order_items ( order_item_id INT, order_item_order_id INT, order_item_product_id INT, order_item_quantity INT, order_item_subtotal FLOAT, order_item_product_price FLOAT ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION '/FileStore/tables/retail_db/order_items'; SELECT * FROM order_items; -- COMMAND ---------- CREATE EXTERNAL TABLE products ( product_id INT, product_category_id INT, product_name STRING, product_description STRING, product_price FLOAT, product_image STRING ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION '/FileStore/tables/retail_db/products'; SELECT * FROM products; -- COMMAND ---------- -- MAGIC %md -- MAGIC ### Visualize SQL Results -- COMMAND ---------- Select order_status,count(1) as status_count from Orders group by order_status; -- COMMAND ---------- -- MAGIC %md -- MAGIC ### Join and Select data using Spark SQL -- COMMAND ---------- SELECT order_date, product_name, order_item_subtotal FROM orders JOIN order_items ON order_id = order_item_order_id JOIN products ON product_id = order_item_product_id WHERE order_status IN ('COMPLETE', 'CLOSED'); -- COMMAND ---------- -- MAGIC %md -- MAGIC ###Get Daily Product Revenue Sorted using Spark SQL -- COMMAND ---------- SELECT order_date, product_name, round(sum(order_item_subtotal), 2) AS revenue FROM orders JOIN order_items ON order_id = order_item_order_id JOIN products ON product_id = order_item_product_id WHERE order_status IN ('COMPLETE', 'CLOSED') GROUP BY order_date, product_name ORDER BY order_date, revenue DESC; -- COMMAND ---------- -- MAGIC %md -- MAGIC ### Save output to a table using Spark SQL -- COMMAND ---------- CREATE TABLE daily_product_revenue ( order_date TIMESTAMP, product_name STRING, revenue FLOAT ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION '/FileStore/tables/retail_db/daily_product_revenue' -- COMMAND ---------- --it is taking 200 thread and creating 200 files INSERT OVERWRITE TABLE daily_product_revenue SELECT order_date, product_name, round(sum(order_item_subtotal), 2) AS revenue FROM orders JOIN order_items ON order_id = order_item_order_id JOIN products ON product_id = order_item_product_id WHERE order_status IN ('COMPLETE', 'CLOSED') GROUP BY order_date, product_name ORDER BY order_date, revenue DESC; -- COMMAND ---------- SET spark.sql.shuffle.partitions=2; INSERT OVERWRITE TABLE daily_product_revenue SELECT order_date, product_name, round(sum(order_item_subtotal), 2) AS revenue FROM orders JOIN order_items ON order_id = order_item_order_id JOIN products ON product_id = order_item_product_id WHERE order_status IN ('COMPLETE', 'CLOSED') GROUP BY order_date, product_name ORDER BY order_date, revenue DESC; -- COMMAND ---------- Select * from daily_product_revenue; -- COMMAND ----------
drop database if exists bamazon; create database bamazon; use bamazon; create table products( item_id int not null auto_increment, product varchar(100), department_name varchar(100), price decimal(9, 2), stock_quantity int, product_sales int default 0, primary key (item_id) ); insert into products(product, department_name, price, stock_quantity) values ("apples", "Food", 3.00, 10); insert into products(product, department_name, price, stock_quantity) values ("bananas", "Food", 3.50, 20); insert into products(product, department_name, price, stock_quantity) values ("Mac", "Technology", 2000.00, 5); insert into products(product, department_name, price, stock_quantity) values ("iPhone", "Technology", 799.99, 3); insert into products(product, department_name, price, stock_quantity) values ("Lamp", "Furniture", 40.00, 50); insert into products(product, department_name, price, stock_quantity) values ("Sofa", "Furniture", 500.00, 15); insert into products(product, department_name, price, stock_quantity) values ("Bed", "Furniture", 200.00, 10); insert into products(product, department_name, price, stock_quantity) values ("Black Panther DVD", "Entertainment", 19.99, 50); insert into products(product, department_name, price, stock_quantity) values ("Superman DVD", "Entertainment", 19.99, 50); insert into products(product, department_name, price, stock_quantity) values ("Paper Towels", "Supplies", 5.00, 30); use bamazon; select * from products; use bamazon; create table departments( department_id int not null auto_increment, department_name varchar(100), over_head__costs int, primary key (department_id) );
DROP TABLE IF EXISTS comment; CREATE TABLE comment ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, created TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, comment VARCHAR(255) NOT NULL );
/* ################################################################################ Migration script to change the locus description to the migrated description for haplotypes 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: Dani Welter date: April 30th 2015 version: 1.9.9.041 (pre 2.0) ################################################################################ -------------------------------------------------------- -- UPDATE DESCRIPTION and HAPLOTYPE COUNT to '' for proxy SNPs -------------------------------------------------------- */ UPDATE LOCUS SET DESCRIPTION = '' WHERE MIGRATED_DESCRIPTION LIKE '%rs%'; UPDATE LOCUS SET HAPLOTYPE_SNP_COUNT = '' WHERE MIGRATED_DESCRIPTION LIKE '%rs%';
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: 2016-09-07 08:23:29 -- 服务器版本: 5.7.9 -- PHP Version: 5.6.15 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `xihaxueche` -- -- -------------------------------------------------------- -- -- 表的结构 `cs_coach_shifts` -- DROP TABLE IF EXISTS `cs_coach_shifts`; CREATE TABLE IF NOT EXISTS `cs_coach_shifts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `coach_id` int(11) NOT NULL, `sh_title` varchar(200) NOT NULL, `sh_money` decimal(6,2) NOT NULL, `sh_original_money` decimal(10,2) NOT NULL, `sh_type` int(11) NOT NULL, `sh_tag` varchar(200) NOT NULL, `sh_tag_id` int(11) NOT NULL, `sh_description` varchar(200) NOT NULL COMMENT '描述(如:最快7天上车,4人/车 自行前往)', `is_promote` tinyint(2) NOT NULL DEFAULT '1' COMMENT '是否促销(1:是,2:否)', `coupon_id` int(11) NOT NULL, `sh_license_id` int(11) NOT NULL, `sh_license_name` varchar(200) NOT NULL, `order` bigint(20) NOT NULL, `addtime` bigint(20) NOT NULL DEFAULT '0', `updatetime` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='教练班制表(教练自主设置的招生班制表)'; /*!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.1.11 -- http://www.phpmyadmin.net -- -- Host: vl19749.dinaserver.com -- Generation Time: 24-04-2019 a les 11:53:57 -- Versió del servidor: 5.5.62-0+deb8u1-log -- PHP Version: 5.4.45-0+deb7u14 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: `controlhores_test` -- -- -------------------------------------------------------- /* BORRAMOS TABLAS SI EXISTEN YA */ DROP TABLE IF EXISTS `config`; DROP TABLE IF EXISTS `horas`; DROP TABLE IF EXISTS `imagenes`; DROP TABLE IF EXISTS `items`; DROP TABLE IF EXISTS `password_reset`; DROP TABLE IF EXISTS `users`; -- -- Estructura de la taula `config` -- CREATE TABLE IF NOT EXISTS `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `clave` varchar(80) NOT NULL, `valor` longtext NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `clave` (`clave`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Bolcant dades de la taula `config` -- INSERT INTO `config` (`id`, `clave`, `valor`) VALUES (1, 'logo', ''), (2, 'footer-direccion', ''), (3, 'footer-empresa', ''), (4, 'footer-email', ''); -- -------------------------------------------------------- -- -- Estructura de la taula `horas` -- CREATE TABLE IF NOT EXISTS `horas` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id_client` int(10) unsigned NOT NULL, `horas` mediumint(9) NOT NULL, `data_inici` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `data_final` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `FK_horas_users` (`id_client`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT AUTO_INCREMENT=1 ; -- -- Estructura de la taula `imagenes` -- CREATE TABLE IF NOT EXISTS `imagenes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_client` int(11) unsigned NOT NULL DEFAULT '0', `perfil` varchar(150) NOT NULL DEFAULT 'user-default.png', `fondo` varchar(150) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `id_client` (`id_client`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -- Estructura de la taula `items` -- CREATE TABLE IF NOT EXISTS `items` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `titulo` varchar(180) DEFAULT NULL, `descripcio` longtext NOT NULL, `id_client` int(10) unsigned NOT NULL, `data_inici` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `hores` float unsigned NOT NULL DEFAULT '0', `data_final` timestamp NULL DEFAULT '0000-00-00 00:00:00', `caducada` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `FK_items_users` (`id_client`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT AUTO_INCREMENT=1 ; -- -- Estructura de la taula `password_reset` -- CREATE TABLE IF NOT EXISTS `password_reset` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id_client` int(10) unsigned NOT NULL, `token` varchar(255) NOT NULL, `expira` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `FK_password_reset_users` (`id_client`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -- Estructura de la taula `users` -- CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `nom` char(50) NOT NULL, `rol` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0->customer 1->admin', `estado` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '0-> Bloqueado 1->Activado', `email` char(100) NOT NULL, `data_alta` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `password` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- Restriccions per taules bolcades -- -- -- Restriccions per la taula `horas` -- ALTER TABLE `horas` ADD CONSTRAINT `FK_horas_users` FOREIGN KEY (`id_client`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Restriccions per la taula `imagenes` -- ALTER TABLE `imagenes` ADD CONSTRAINT `FK_imagenes_users` FOREIGN KEY (`id_client`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Restriccions per la taula `items` -- ALTER TABLE `items` ADD CONSTRAINT `FK_items_users` FOREIGN KEY (`id_client`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Restriccions per la taula `password_reset` -- ALTER TABLE `password_reset` ADD CONSTRAINT `FK_password_reset_users` FOREIGN KEY (`id_client`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/* To ensure that a set of columns are unique as a group, set multiple columns as the primary key. */ use Miscellaneous_db; create table person( first_name varchar(50), last_name varchar(50), hobby varchar(50), primary key (first_name,last_name) ); insert into person(first_name,last_name,hobby) values("Tony","Li","skydiving"); insert into person(first_name,last_name,hobby) values("Lena","Wang","base jumping"); insert into person(first_name,last_name,hobby) values("Tony","Li","spelunking"); /* Error Code: 1062. Duplicate entry 'Tony-Li' for key 'PRIMARY' */ insert into person(first_name,last_name,hobby) values("Jet","Li","Wushu"); -- this is okay insert into person(first_name,last_name,hobby) values("Tony","Stark","Tinkering"); -- this is also okay select * from person;
/* todo inserta gögn */
create view "data_platform_prod"."data_science"."stg_flash__dbt_tmp" as ( SELECT ticket_state, ticket_id, transfer_action_id, fk_order_unique_id, fk_seat_unique_id FROM flash.tickets LEFT JOIN flash.forwards USING (ticket_id) );
SELECT LOCATION, SUM(new_deaths) AS Total_Deaths FROM covid_data WHERE LOCATION IS NOT null GROUP BY LOCATION ORDER BY Total_Deaths DESC LIMIT 10
USE employees; SELECT * FROM employees WHERE birth_date LIKE '%-05-23' ORDER BY hire_date LIMIT 20; SELECT DISTINCT titles FROM titles; SELECT DISTINCT last_name FROM employees ORDER BY last_name DESC LIMIT 10; SELECT * FROM employees WHERE hire_date BETWEEEN '1990-01-01' AND '1999-12-31'; AND birth_date LIKE '%-12-25' LIMIT 5; lIMIT 5 OFFSET 0 lIMIT 5 OFFSET 5 lIMIT 5 OFFSET 10 lIMIT 5 OFFSET 0 ((pageN umb -1)) *
INSERT INTO lte.role_user (role_id, user_id) VALUES (1, 5);
-- +micrate Up ALTER TABLE users ADD last_name varchar; -- +micrate Down ALTER TABLE users Drop last_name;
-- phpMyAdmin SQL Dump -- version 3.5.2.2 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jul 10, 2013 at 02:43 PM -- Server version: 5.5.27 -- PHP Version: 5.4.7 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: `ojt_activities` -- CREATE DATABASE `ojt_activities` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `ojt_activities`; -- -------------------------------------------------------- -- -- Table structure for table `tbllogbook` -- CREATE TABLE IF NOT EXISTS `tbllogbook` ( `ID` int(255) NOT NULL AUTO_INCREMENT, `UserID` int(255) NOT NULL, `LogIn` datetime NOT NULL, `LogOut` datetime DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=45 ; -- -- Dumping data for table `tbllogbook` -- INSERT INTO `tbllogbook` (`ID`, `UserID`, `LogIn`, `LogOut`) VALUES (38, 1, '2013-07-10 20:32:43', '2013-07-10 20:33:53'), (39, 2, '2013-07-10 20:34:02', '2013-07-10 14:34:11'), (40, 1, '2013-07-10 20:34:22', '2013-07-10 20:34:27'), (41, 2, '2013-07-10 20:34:44', '2013-07-10 14:41:23'), (44, 2, '2013-07-10 20:41:55', '2013-07-10 14:42:43'); -- -------------------------------------------------------- -- -- Table structure for table `tblusers` -- CREATE TABLE IF NOT EXISTS `tblusers` ( `ID` int(255) NOT NULL AUTO_INCREMENT, `AccountType` enum('Admin','User') NOT NULL DEFAULT 'User', `FirstName` varchar(100) DEFAULT NULL, `MiddleName` varchar(100) DEFAULT NULL, `LastName` varchar(100) DEFAULT NULL, `UserName` varchar(150) NOT NULL, `Password` varchar(255) NOT NULL, `Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ; -- -- Dumping data for table `tblusers` -- INSERT INTO `tblusers` (`ID`, `AccountType`, `FirstName`, `MiddleName`, `LastName`, `UserName`, `Password`, `Date`) VALUES (1, 'User', 'Mark', 'Lagman', 'Gutierrez', 'akocmark', '298c7d559d0364f3a81dc3c57177422c', '2013-07-02 02:30:12'), (2, 'Admin', 'Rachel', NULL, 'Jaro', 'primerg', '07d31fd221d4721dbc590813a6f6a85e', '2013-07-02 21:09:26'), (16, 'User', 'Rex', NULL, 'Manalo', 'rex', '3b86a8ae82d4e8c93c2a174b094f20d7', '2013-07-10 06:18:28'); /*!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 IF NOT EXISTS `prices` ( `brand_id` bigint(20) NOT NULL, `start_date` datetime NOT NULL, `end_date` datetime NOT NULL, `price_list` bigint(20) NOT NULL, `product_id` bigint(20) NOT NULL, `priority` bigint(1) NOT NULL, `price` double NOT NULL, `curr` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO member VALUES('10102','pass','Mike','cool street','test@test.com','January 1, 2017', '100','1','1'), ('10103','pass','Arshad','cool street','test@test.com','June 10th, 2017', '500','1','0'); INSERT INTO driver VALUES('10102','10102','0','1','1'), ('10103','10103','0','1','1'); INSERT INTO rider VALUES('10102','10102'),('10103','10103');
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 -- Generation Time: Oct 27, 2019 at 04:06 AM -- Server version: 5.7.26 -- PHP Version: 7.2.18 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `doan_db` -- -- -------------------------------------------------------- -- -- Table structure for table `cau_hinh_app` -- DROP TABLE IF EXISTS `cau_hinh_app`; CREATE TABLE IF NOT EXISTS `cau_hinh_app` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `cau_hoi_sai` int(11) NOT NULL, `thoi_gian_tra_loi` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `cau_hinh_app` -- INSERT INTO `cau_hinh_app` (`id`, `cau_hoi_sai`, `thoi_gian_tra_loi`, `created_at`, `updated_at`) VALUES (1, 2, 10, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `cau_hinh_diem_cau_hoi` -- DROP TABLE IF EXISTS `cau_hinh_diem_cau_hoi`; CREATE TABLE IF NOT EXISTS `cau_hinh_diem_cau_hoi` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `thu_tu` int(11) NOT NULL, `diem` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `cau_hinh_diem_cau_hoi` -- INSERT INTO `cau_hinh_diem_cau_hoi` (`id`, `thu_tu`, `diem`, `created_at`, `updated_at`) VALUES (1, 1, 90, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `cau_hinh_tro_giup` -- DROP TABLE IF EXISTS `cau_hinh_tro_giup`; CREATE TABLE IF NOT EXISTS `cau_hinh_tro_giup` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `loai_tro_giup` int(11) NOT NULL, `thu_tu` int(11) NOT NULL, `credit` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `cau_hinh_tro_giup` -- INSERT INTO `cau_hinh_tro_giup` (`id`, `loai_tro_giup`, `thu_tu`, `credit`, `created_at`, `updated_at`) VALUES (1, 1, 1, 100, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `cau_hoi` -- DROP TABLE IF EXISTS `cau_hoi`; CREATE TABLE IF NOT EXISTS `cau_hoi` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `noi_dung` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `linh_vuc_id` int(11) NOT NULL, `phuong_an_a` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `phuong_an_b` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `phuong_an_c` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `phuong_an_d` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `dap_an` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `cau_hoi_linh_vuc_id_foreign` (`linh_vuc_id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `cau_hoi` -- INSERT INTO `cau_hoi` (`id`, `noi_dung`, `linh_vuc_id`, `phuong_an_a`, `phuong_an_b`, `phuong_an_c`, `phuong_an_d`, `dap_an`, `created_at`, `updated_at`, `deleted_at`) VALUES (1, 'Loài nào là loài thuộc họ người', 1, 'Khỉ', 'Chó', 'Mèo', 'Vịt', 'Khỉ', NULL, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `chi_tiet_luot_choi` -- DROP TABLE IF EXISTS `chi_tiet_luot_choi`; CREATE TABLE IF NOT EXISTS `chi_tiet_luot_choi` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `luot_choi_id` int(11) NOT NULL, `cau_hoi_id` int(11) NOT NULL, `phuong_an` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `diem` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `chi_tiet_luot_choi` -- INSERT INTO `chi_tiet_luot_choi` (`id`, `luot_choi_id`, `cau_hoi_id`, `phuong_an`, `diem`, `created_at`, `updated_at`) VALUES (1, 1, 1, 'A', 1000, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `goi_credit` -- DROP TABLE IF EXISTS `goi_credit`; CREATE TABLE IF NOT EXISTS `goi_credit` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `ten_goi` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `credit` int(11) NOT NULL, `so_tien` int(11) NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `goi_credit` -- INSERT INTO `goi_credit` (`id`, `ten_goi`, `credit`, `so_tien`, `deleted_at`, `created_at`, `updated_at`) VALUES (1, 'Gói A', 100, 50000, NULL, NULL, NULL), (2, 'Gói B', 150, 70000, NULL, NULL, NULL), (3, 'Gói C', 200, 90000, NULL, NULL, NULL), (4, 'Gói D', 250, 110000, NULL, NULL, NULL), (5, 'Gói E', 300, 130000, NULL, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `lich_su_mua_credit` -- DROP TABLE IF EXISTS `lich_su_mua_credit`; CREATE TABLE IF NOT EXISTS `lich_su_mua_credit` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `nguoi_choi_id` int(11) NOT NULL, `goi_credit_id` int(11) NOT NULL, `credit` int(11) NOT NULL, `so_tien` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `lich_su_mua_credit` -- INSERT INTO `lich_su_mua_credit` (`id`, `nguoi_choi_id`, `goi_credit_id`, `credit`, `so_tien`, `created_at`, `updated_at`) VALUES (1, 1, 1, 100, 10000, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `linh_vuc` -- DROP TABLE IF EXISTS `linh_vuc`; CREATE TABLE IF NOT EXISTS `linh_vuc` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `ten_linh_vuc` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `linh_vuc` -- INSERT INTO `linh_vuc` (`id`, `ten_linh_vuc`, `deleted_at`, `created_at`, `updated_at`) VALUES (1, 'Toán', NULL, NULL, '2019-10-22 23:41:43'), (2, 'Lý', NULL, NULL, NULL), (3, 'Hóa', NULL, NULL, NULL), (4, 'Anh', NULL, NULL, NULL), (5, 'Sinh', NULL, '2019-10-11 00:54:28', '2019-10-11 00:54:28'), (8, 'Sử', NULL, '2019-10-11 01:20:27', '2019-10-11 01:20:27'), (7, 'Địa', NULL, '2019-10-11 01:13:25', '2019-10-11 01:13:25'), (9, 'Công Nghệ', NULL, '2019-10-12 23:52:30', '2019-10-12 23:52:30'), (10, 'Giáo dục công dân', NULL, '2019-10-12 23:53:22', '2019-10-12 23:53:22'), (17, 'Xàm', NULL, '2019-10-23 00:24:31', '2019-10-23 00:24:31'); -- -------------------------------------------------------- -- -- Table structure for table `luot_choi` -- DROP TABLE IF EXISTS `luot_choi`; CREATE TABLE IF NOT EXISTS `luot_choi` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `nguoi_choi_id` int(11) NOT NULL, `so_cau` int(11) NOT NULL, `diem` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `ngay_gio` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `luot_choi` -- INSERT INTO `luot_choi` (`id`, `nguoi_choi_id`, `so_cau`, `diem`, `ngay_gio`, `created_at`, `updated_at`) VALUES (1, 1, 4, '100', '11/12/2017', NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- DROP TABLE IF EXISTS `migrations`; CREATE TABLE IF NOT EXISTS `migrations` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (12, '2019_10_05_012346_create_table_linh-vuc', 1), (13, '2019_10_05_045354_create_table_nguoi_choi', 1), (14, '2019_10_05_051038_create_table_lich_su_mua_credit', 1), (15, '2019_10_05_052219_create_table_goi_credit', 1), (16, '2019_10_05_052541_create_table_cau_hoi', 1), (17, '2019_10_05_054054_create_table_chi_tiet_luot_choi', 1), (18, '2019_10_05_055555_create_table_luot_choi', 1), (19, '2019_10_05_055909_create_table_cau_hinh_diem_cau_hoi', 1), (20, '2019_10_05_060154_create_table_cau_hinh_app', 1), (21, '2019_10_05_060446_create_table_quan_tri_vien', 1), (22, '2019_10_05_061115_ceate_table_cau_hinh_tro_giup', 1), (23, '2019_10_06_234123_them_linh_vuc_controller', 1), (24, '2019_10_09_060032_create_table_them_khoa_ngoai', 2); -- -------------------------------------------------------- -- -- Table structure for table `nguoi_choi` -- DROP TABLE IF EXISTS `nguoi_choi`; CREATE TABLE IF NOT EXISTS `nguoi_choi` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `ten_dang_nhap` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `mat_khau` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `hinh_dai_dien` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `diem_cao_nhat` int(11) NOT NULL, `credit` int(11) NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `nguoi_choi` -- INSERT INTO `nguoi_choi` (`id`, `ten_dang_nhap`, `mat_khau`, `email`, `hinh_dai_dien`, `diem_cao_nhat`, `credit`, `deleted_at`, `created_at`, `updated_at`) VALUES (1, 'TrungNB', 'trung123', 'khactrung01203375867@gmail.com', '', 10000, 10, NULL, NULL, NULL), (2, 'ThinhBL', 'thinh123', 'thinhzjzai@gmail.com', '', 8000, 2, NULL, NULL, NULL), (3, 'TyBT', 'ty123', 'truongthy@gmail.com', '', 9000, 3, NULL, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `quan_tri_vien` -- DROP TABLE IF EXISTS `quan_tri_vien`; CREATE TABLE IF NOT EXISTS `quan_tri_vien` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `ten_dang_nhap` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `mat_khau` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `ho_ten` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `quan_tri_vien` -- INSERT INTO `quan_tri_vien` (`id`, `ten_dang_nhap`, `mat_khau`, `ho_ten`, `created_at`, `updated_at`, `deleted_at`) VALUES (1, 'TrungPham', '123', 'Phạm Khắc Trung', NULL, NULL, NULL), (2, 'TyTruong', '123', 'Trương Văn Ty', NULL, NULL, NULL), (3, 'ThinhTran', '123', 'Trần Văn Thịnh', NULL, NULL, NULL); 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 */;
-- Table: stock profile DROP TABLE IF EXISTS `profile`; CREATE TABLE `profile` ( `code` varchar(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `name` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin, `issue_price` int(11), `time_market` date, PRIMARY KEY (`code`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- Table: histroy info per day DROP TABLE IF EXISTS `optional`; CREATE TABLE `optional` ( `day` date NOT NULL, `code` varchar(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin, `tclose` float(12, 2), `high` float(12, 2), `low` float(12, 2), `topen` float(12, 2), `lclose` float(12, 2), `chg` float(12, 2), `pchg` float(12, 2), `turnover` float(12, 2), `voturnover` float(12, 2), `vaturnover` float(12, 2), `tcap` float(12, 2), `mcap` float(12, 2), PRIMARY KEY (`day`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- phpMyAdmin SQL Dump -- version 4.8.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 03, 2020 at 05:33 AM -- 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: `game` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `id` int(50) NOT NULL, `username` varchar(50) NOT NULL, `password` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id`, `username`, `password`) VALUES (1, 'admin', 'admin'); -- -------------------------------------------------------- -- -- Table structure for table `cart` -- CREATE TABLE `cart` ( `id` int(50) NOT NULL, `uid` int(50) NOT NULL, `pid` int(50) NOT NULL, `product_name` varchar(200) NOT NULL, `product_price` varchar(100) NOT NULL, `product_image` mediumtext NOT NULL, `qty` int(50) NOT NULL, `total_price` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `cart` -- INSERT INTO `cart` (`id`, `uid`, `pid`, `product_name`, `product_price`, `product_image`, `qty`, `total_price`) VALUES (4, 1, 11, 'Arcery', '1500', 'image/action/images.jpg', 1, '1500'), (5, 11, 10, 'cloths', '1500', 'image/rgp/New Doc 2019-08-01 08.20.38.My Docs_9.jpg', 1, '1500'), (6, 11, 9, 'cloths', '1500', 'image/rgp/New Doc 2019-08-01 08.20.38.My Docs_9.jpg', 1, '1500'), (7, 11, 11, 'Arcery', '1500', 'image/action/images.jpg', 1, '1500'); -- -------------------------------------------------------- -- -- Table structure for table `product` -- CREATE TABLE `product` ( `pid` int(50) NOT NULL, `product_name` varchar(100) NOT NULL, `product_price` varchar(100) NOT NULL, `product_type` text NOT NULL, `product_image` mediumtext NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `product` -- INSERT INTO `product` (`pid`, `product_name`, `product_price`, `product_type`, `product_image`) VALUES (9, 'cloths', '1500', 'rgp', 'image/rgp/New Doc 2019-08-01 08.20.38.My Docs_9.jpg'), (10, 'cloths', '1500', 'rgp', 'image/rgp/New Doc 2019-08-01 08.20.38.My Docs_9.jpg'), (11, 'Arcery', '1500', 'action', 'image/action/images.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `uid` int(50) NOT NULL, `fname` text NOT NULL, `lname` text NOT NULL, `uname` varchar(30) NOT NULL, `email` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `address` varchar(500) NOT NULL, `token` varchar(3000) NOT NULL, `status` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`uid`, `fname`, `lname`, `uname`, `email`, `password`, `address`, `token`, `status`) VALUES (11, 'Harshal', 'Ghode', 'harshal', 'harshalghode2019@gmail.com', 'harshal', '', 'e3f38eacb7ac04e843bd75dc7d692938', 'Yes'); -- -- Indexes for dumped tables -- -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`id`); -- -- Indexes for table `cart` -- ALTER TABLE `cart` ADD PRIMARY KEY (`id`); -- -- Indexes for table `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`pid`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`uid`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `cart` -- ALTER TABLE `cart` MODIFY `id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `product` -- ALTER TABLE `product` MODIFY `pid` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `uid` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; 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 */;
-- delete set serveroutput on declare begin delete from cp_emp2 where empno = 2222; dbms_output.put_line(sql%rowcount||'건 삭제되었습니다.'); -- rollback; end; /
-- AUTHORITY_MST MODIFY WITH V_AUTHORITY_GROUP_MST AS ( SELECT GROUP_ID, CASE WHEN /*countryId*/ = 81 THEN GROUP_NAME_JP ELSE CASE WHEN /*countryId*/ = 66 THEN GROUP_NAME_EN ELSE CASE WHEN /*countryId*/ = 1 THEN GROUP_NAME_EN END END END AS GROUP_NAME FROM AUTHORITY_GROUP_MST ) SELECT /*IF (maxCount != null && maxCount != "")*/ TOP /*$maxCount*/ /*END*/ B.CONTACT_KEY, B.PROCESS_TYPE, C.STATUS, D.NODE_NAME, B.START_DATE, DATEDIFF(DAY, B.START_DATE, CASE B.NODE_STATUS WHEN '2' THEN B.END_DATE ELSE /*sysDate*/'' END) AS [DAY], B.PROCESS_NO, B.PROCESS_NO AS SEL_VALUE, B.NODE_ID, C.USER_ID_CHARGE, F.GROUP_NAME, E.CODE_NAME AS PROCESS_KEY_NAME, B.MODIFY_DATE, G.CODE_NAME AS PROCESS_TYPE_NAME, H.BRANCH_NAME, B.TENTATIVE_PROCESS_USER_ID, I.USER_NAME AS TENTATIVE_PROCESS_USER_NAME FROM PROCESS_NODE_STATUS B LEFT JOIN CODE_MASTER E ON E.CODE_ID = B.PROCESS_TYPE AND E.CODE_TYPE = '306' AND E.COUNTRY_ID = /*countryId*/86 LEFT JOIN CODE_MASTER G ON G.CODE_ID = B.PROCESS_TYPE AND G.CODE_TYPE = '262' AND G.COUNTRY_ID = /*countryId*/86 LEFT JOIN BRANCH_MST H ON H.BRANCH_CODE = B.BRANCH_CODE AND H.COUNTRY_ID = /*countryId*/86 /*IF (userId != null && userId != "")*/ INNER JOIN (SELECT DISTINCT NODE_ID, USER_GROUP_ID FROM PROCESS_NODE_ACTION) C1 ON C1.NODE_ID = B.NODE_ID AND C1.USER_GROUP_ID = /*userId*/'' /*END*/ LEFT JOIN PROCESS_NODE_MST C ON B.NODE_ID = C.NODE_ID LEFT JOIN V_AUTHORITY_GROUP_MST F ON F.GROUP_ID = C.USER_ID_CHARGE LEFT JOIN NODE_NAME D ON D.NODE_ID = C.NODE_ID AND D.COUNTRY_ID = /*countryId*/86 LEFT JOIN LEASE_USER I ON I.USER_ID = B.TENTATIVE_PROCESS_USER_ID WHERE B.BRANCH_CODE IN /*listBranchCode*/() /*IF (processType != null && processType != "")*/ AND B.PROCESS_TYPE = /*processType*/'' /*END*/ /*IF (branchSearch != null && branchSearch != "")*/ AND B.BRANCH_CODE = /*branchSearch*/'' /*END*/ /*IF (key != null && key != "")*/ AND B.CONTACT_KEY LIKE '%' + /*key*/'' + '%' /*END*/ /*IF (nodeStatus != null && nodeStatus != "")*/ AND B.NODE_STATUS = /*nodeStatus*/'' /*END*/ /*IF (tentativeUserSearch != null)*/ /*IF (tentativeUserSearch == notSet)*/ AND B.TENTATIVE_PROCESS_USER_ID IS NULL --ELSE AND B.TENTATIVE_PROCESS_USER_ID = /*tentativeUserSearch*/'' /*END*/ /*END*/ ORDER BY C.USER_ID_CHARGE, B.PROCESS_TYPE, B.CONTACT_KEY DESC
create table if not exists users ( my_id int not null primary key, first_name text, second_name text, oauth_token text, oauth_token_secret text ); alter table users owner to postgres; create unique index if not exists users_id_uindex on users (my_id);
CREATE PROC ERP.Usp_Del_Vacacion @ID INT AS BEGIN DELETE FROM ERP.Vacacion WHERE ID = @ID END
# Write your MySQL query statement below SELECT s.id, s.student FROM ( SELECT id - 1 AS id, student FROM seat WHERE (id % 2 = 0) UNION SELECT (CASE WHEN (cnt%2=1) AND id=cnt THEN id ELSE id + 1 END) AS id, student FROM seat, (select count(*) as cnt from seat) as seatcnt WHERE (id % 2 = 1) ) s GROUP BY s.id ASC
CREATE TABLE IF NOT EXISTS languages ( id BIGSERIAL NOT NULL, lang_code VARCHAR(2) NOT NULL, lang_name TEXT NOT NULL, native_name TEXT NOT NULL, created TIMESTAMP, updated TIMESTAMP, PRIMARY KEY (id) ); ALTER TABLE languages DROP CONSTRAINT IF EXISTS unique_lang_code; ALTER TABLE languages ADD CONSTRAINT unique_lang_code UNIQUE (lang_code); ALTER TABLE languages DROP CONSTRAINT IF EXISTS check_lower_lang_code; ALTER TABLE languages ADD CONSTRAINT check_lower_lang_code CHECK (LOWER(lang_code) = lang_code); INSERT INTO languages (lang_code, lang_name, native_name) VALUES ('en', 'English', 'English'), ('ru', 'Russian', 'Русский'), ('fr', 'French', 'Français') ON CONFLICT DO NOTHING;
/** * * @author Hanln * @version $Id: TopService_getShisetsuMedicalTypeList_Sel_01.sql 12474 2014-07-09 02:28:34Z p_re_han $ */ SELECT MED.MEDICAL_ACTIVITY_TYPE ,MED.MEDICAL_INFECTION_ABL_KBN FROM BY_SHISETSU_MEDICAL_TYPE MED WHERE MED.SHISETSU_CD = /*shisetsuCd*/'000001092' AND MED.DELETE_FLG ='0'
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- 主機: 127.0.0.1 -- 產生時間: 2021-04-04 20:27:53 -- 伺服器版本: 10.4.18-MariaDB -- PHP 版本: 8.0.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- 資料庫: `mydatabase` -- -- -------------------------------------------------------- -- -- 資料表結構 `income` -- CREATE TABLE `income` ( `id` int(11) NOT NULL, `year` year(4) NOT NULL, `taiwan` int(255) NOT NULL, `supervisor` int(255) NOT NULL, `professionals` int(255) NOT NULL, `assistant` int(255) NOT NULL, `support` int(255) NOT NULL, `service` int(255) NOT NULL, `production` int(255) NOT NULL, `artisan` int(255) NOT NULL, `assembler` int(255) NOT NULL, `labor` int(255) NOT NULL, `other` int(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 傾印資料表的資料 `income` -- INSERT INTO `income` (`id`, `year`, `taiwan`, `supervisor`, `professionals`, `assistant`, `support`, `service`, `production`, `artisan`, `assembler`, `labor`, `other`) VALUES (1, 1998, 491634, 1026393, 780438, 598091, 435627, 481145, 275582, 458265, 405141, 348018, 375488), (2, 1999, 505026, 1054009, 815010, 611904, 441548, 471643, 298607, 482591, 434524, 352129, 393953), (3, 2000, 507371, 992734, 798509, 614194, 454846, 474232, 301104, 483037, 426002, 363762, 417189), (4, 2001, 500141, 1073694, 819178, 621794, 445282, 462821, 292391, 443957, 414911, 337144, 391501), (5, 2002, 496969, 1044761, 824508, 602062, 431462, 454614, 307398, 442204, 418878, 342782, 406627), (6, 2003, 502996, 1069556, 779763, 626040, 458286, 475062, 287766, 461078, 415246, 341879, 401147), (7, 2004, 510095, 1058436, 827298, 624311, 441643, 470949, 322856, 477510, 429513, 331208, 398182), (8, 2005, 513477, 1052498, 806022, 631088, 459505, 479828, 306181, 482912, 429455, 348952, 403251), (9, 2006, 517942, 1069973, 832130, 636181, 455632, 474205, 334747, 488799, 433826, 345851, 408180), (10, 2007, 521714, 1126367, 831509, 626488, 458249, 477176, 329590, 489235, 439325, 354041, 412452), (11, 2008, 516765, 1121482, 855056, 618841, 444149, 472830, 333622, 492705, 420431, 341275, 411914), (12, 2009, 502611, 1123281, 790234, 616670, 428674, 465757, 319613, 461229, 411796, 323615, 407751), (13, 2010, 515256, 1177850, 783314, 636748, 455193, 479089, 318493, 466926, 429823, 333833, 413969), (14, 2011, 507038, 1174696, 754787, 646974, 438297, 454708, 327862, 467848, 418156, 324910, 406610), (15, 2012, 515897, 1156796, 760348, 636542, 457297, 475769, 368512, 488856, 441004, 335492, 419296), (16, 2013, 516206, 1204823, 774061, 637226, 448869, 474500, 373104, 490447, 446038, 349529, 401975), (17, 2014, 524893, 1264525, 795525, 654329, 453424, 483525, 385289, 502110, 445502, 345194, 394140), (18, 2015, 525285, 1246135, 786182, 672689, 453433, 484972, 389573, 514820, 460344, 352749, 392370), (19, 2016, 532864, 1324810, 808301, 670188, 465015, 497418, 406800, 521522, 465570, 363631, 384295), (20, 2017, 544937, 1345567, 814472, 683678, 463962, 505909, 407297, 551372, 480611, 369282, 386096), (21, 2018, 547731, 1364860, 850113, 702643, 459896, 507944, 436632, 553018, 480055, 384473, 381139), (22, 2019, 557634, 1402814, 851403, 722964, 471106, 517795, 461647, 564991, 500571, 392581, 378611); -- -- 已傾印資料表的索引 -- -- -- 資料表索引 `income` -- ALTER TABLE `income` ADD PRIMARY KEY (`id`); -- -- 在傾印的資料表使用自動遞增(AUTO_INCREMENT) -- -- -- 使用資料表自動遞增(AUTO_INCREMENT) `income` -- ALTER TABLE `income` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23; 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 */;
-- Comments in SQL Start with dash-dash -- -- #1 -- INSERT INTO products (name, price, can_be_returned) VALUES ('chair', '44.00', false); -- #2 -- INSERT INTO products (name, price, can_be_returned) VALUES ('stool', '25.99', true); -- #3 -- INSERT INTO products (name, price, can_be_returned) VALUES ('table', '124.00', false); -- #4 -- SELECT * FROM products; -- #5 -- SELECT name FROM products; -- #6 -- SELECT name, price FROM products; -- #7 -- INSERT INTO products (name, price, can_be_returned) VALUES ('couch', '500.00', true); -- #8 -- SELECT * FROM products WHERE can_be_returned; -- #9 -- SELECT * FROM products WHERE price < '44.00'; -- #10 -- SELECT * FROM products WHERE price BETWEEN 22.50 AND 99.99; -- #11 -- UPDATE products SET price = price - 20; -- #12 -- DELETE FROM products WHERE price < 25; -- 13 -- UPDATE products SET price = price + 20; -- 14 -- UPDATE products SET can_be_returned = 'true';
-- MySQL dump 10.13 Distrib 8.0.19, for Linux (x86_64) -- -- Host: localhost Database: foodshala -- ------------------------------------------------------ -- Server version 8.0.19-0ubuntu0.19.10.3 /*!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 */; /*!50503 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `cust_login` -- DROP TABLE IF EXISTS `cust_login`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `cust_login` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(500) NOT NULL, `pass` varchar(50) NOT NULL, `email` varchar(100) NOT NULL, `priority` varchar(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cust_login` -- LOCK TABLES `cust_login` WRITE; /*!40000 ALTER TABLE `cust_login` DISABLE KEYS */; INSERT INTO `cust_login` VALUES (4,'Customer 1','f5bb0c8de146c67b44babbf4e6584cc0','cust@gmail.com','veg'); /*!40000 ALTER TABLE `cust_login` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `food_menu` -- DROP TABLE IF EXISTS `food_menu`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `food_menu` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(500) NOT NULL, `description` varchar(100) NOT NULL, `rest_id` int NOT NULL, `food_type` varchar(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `food_menu` -- LOCK TABLES `food_menu` WRITE; /*!40000 ALTER TABLE `food_menu` DISABLE KEYS */; INSERT INTO `food_menu` VALUES (3,'Food 1','hello',2,'veg'),(4,'Food 2','World',2,'nonVeg'); /*!40000 ALTER TABLE `food_menu` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `orders` -- DROP TABLE IF EXISTS `orders`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `orders` ( `id` int NOT NULL AUTO_INCREMENT, `custId` int NOT NULL, `foodId` int NOT NULL, `restId` int NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `orders` -- LOCK TABLES `orders` WRITE; /*!40000 ALTER TABLE `orders` DISABLE KEYS */; INSERT INTO `orders` VALUES (6,4,3,2),(7,4,4,2); /*!40000 ALTER TABLE `orders` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `rest_login` -- DROP TABLE IF EXISTS `rest_login`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `rest_login` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(500) NOT NULL, `pass` varchar(50) NOT NULL, `email` varchar(100) NOT NULL, `img_path` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `rest_login` -- LOCK TABLES `rest_login` WRITE; /*!40000 ALTER TABLE `rest_login` DISABLE KEYS */; INSERT INTO `rest_login` VALUES (2,'REstaurent 1','f5bb0c8de146c67b44babbf4e6584cc0','rest@gmail.com','images/20-04-2020-1587378684.png'); /*!40000 ALTER TABLE `rest_login` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2020-04-20 16:05:22
-- SCOTT SELECT * FROM emp; -- emp 테이블에서 사원번호가 7698 인 사원의 이름, 업무, 급여를 출력하시오. SELECT empno, ename, job, sal FROM emp WHERE empno = 7698; -- emp 테이블에서 사원이름이 SMITH인 사람의 이름과 월급, 부서번호를 구하시오. SELECT ename, sal, deptno FROM emp WHERE ename = 'SMITH'; -- 월급이 2500이상 3500미만인 사원의 이름, 입사일, 월급을 구하시오. SELECT ename, hiredate, sal FROM emp WHERE sal BETWEEN 2500 AND 3500; -- 급여가 2000에서 3000사이에 포함되지 않는 사원의 이름, 업무, 급여를 출력하시오. SELECT ename, hiredate, sal FROM emp WHERE sal NOT BETWEEN 2500 AND 3500; -- 81년05월01일과 81년12월03일 사이에 입사한 사원의 이름, 급여, 입사일을 출력하시오. SELECT ename, hiredate, sal FROM emp WHERE hiredate BETWEEN '81/05/01' AND '81/12/03'; -- emp테이블에서 사원번호가 7566,7782,7934인 사원을 제외한 사람들의 사원번호,이름, 월급을 출력하시오. SELECT empno, ename, sal FROM emp WHERE empno NOT IN (7566, 7782, 7934); -- 부서번호 30(deptno)에서 근무하며 -- 월 2,000달러 이하를 받는 -- 81년05월01일 이전에 입사한 사원의 이름, 급여, 부서번호, 입사일을 출력하시오. SELECT ename, sal, deptno, hiredate FROM emp WHERE deptno = 30 AND sal <= 2000 AND hiredate < '81/05/01'; -- emp테이블에서 급여가 2,000와 5,000 사이고 부서번호가 10 또는 30인 사원의 이름과 급여,부서번호를 나열하시오. SELECT ename, sal, deptno FROM emp WHERE (sal BETWEEN 2000 AND 5000) AND (deptno IN (10, 30)); -- 업무가 SALESMAN 또는 MANAGER이면서 급여가 1,600, 2,975 또는 2,850이 아닌 -- 모든 사원의 이름, 업무 및 급여를 표시하시오 SELECT ename, job, sal FROM emp WHERE job IN('SALESMAN', 'MANAGER') AND sal IN(1600, 2975) OR sal NOT IN(2850); -- emp테이블에서 사원이름 중 S가 포함되지 않은 사람들 중 -- 부서번호가 20인 사원들의 이름과 부서번호를 출력하시오. SELECT ename, deptno FROM emp WHERE ename NOT LIKE('%s%') AND deptno = 20; -- emp테이블에서 이름에 A와 E가 있는 모든 사원의 이름을 표시하시오. SELECT ename, deptno FROM emp WHERE ename LIKE('%A%') AND ename LIKE('%E%'); -- emp테이블에서 관리자가 없는 모든 사원의 이름과 업무를 표시하시오. SELECT ename, job FROM emp WHERE MGR IS NOT NULL; -- emp테이블에서 커미션 항목이 입력된 사원들의 이름과 급여, 커미션을 구하시오. SELECT ename, sal, comm FROM emp WHERE COMM IS NOT NULL;
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 -- Czas generowania: 06 Lut 2021, 07:16 -- Wersja serwera: 5.7.31 -- Wersja PHP: 7.2.33 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Baza danych: `react-filters` -- -- -------------------------------------------------------- -- -- Struktura tabeli dla tabeli `stylist` -- DROP TABLE IF EXISTS `stylist`; CREATE TABLE IF NOT EXISTS `stylist` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` text COLLATE utf8_bin NOT NULL, `city` text COLLATE utf8_bin NOT NULL, `desc` text COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Zrzut danych tabeli `stylist` -- INSERT INTO `stylist` (`id`, `name`, `city`, `desc`) VALUES (1, 'Edyta', 'Warszawa', 'Historie z makijażem zaczęła w 2009 roku, gdy po architekturze krajobrazu postanowiła rozwijać się artystycznie stawiając na szkołę wizażu. Szkoła “Atlook” rozkochała Edytę w makijażu, co skłoniło ją do dalszego rozwoju w kierunku charakteryzacji w “Studio Sztuki” – uzyskała tam tytuł technik plastyk.Charakteryzacja to coś co łączy jej dwie pasje – ludzi oraz makijaż/stylizację. Sprawia jej to ogromną przyjemność. Prywatnie również maluje oraz zajmuje się rysunkiem.'); 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 */;
REM calc_opt_comp.sql REM (c)Go-Faster Consultancy Ltd. 2014 set serveroutput on autotrace off SPOOL calc_opt_comp REM DROP TABLE sysadm.gfc_index_stats PURGE; --create working storage table with same structure as INDEX_STATS CREATE TABLE sysadm.gfc_index_stats AS SELECT * FROM index_stats WHERE 1=2 / ALTER TABLE sysadm.gfc_index_stats MODIFY name NOT NULL / CREATE UNIQUE INDEX sysadm.gfc_index_stats ON sysadm.gfc_index_stats (name, partition_name) / undefine table_name DECLARE l_sql VARCHAR2(100); l_owner VARCHAR2(8) := 'SYSADM'; l_table_name VARCHAR2(30) := '&&table_name'; BEGIN FOR i IN ( SELECT i.index_name, ip.partition_name FROM all_indexes i , all_ind_partitions ip WHERE i.index_type like '%NORMAL' AND i.table_owner = l_owner AND i.partitioned = 'YES' AND i.table_name = l_table_name AND ip.index_owner = i.owner AND ip.index_name = i.index_name AND ip.subpartition_count = 0 AND ip.segment_created = 'YES' UNION SELECT i.index_name, isp.subpartition_name FROM all_indexes i , all_ind_subpartitions isp WHERE i.index_type like '%NORMAL' AND i.table_owner = l_owner AND i.partitioned = 'YES' AND i.table_name = l_table_name AND isp.index_owner = i.owner AND isp.index_name = i.index_name AND isp.segment_created = 'YES' UNION SELECT i.index_name, NULL FROM all_indexes i WHERE i.index_type like '%NORMAL' AND i.table_owner = l_owner AND i.table_name = l_table_name AND i.partitioned = 'NO' AND i.segment_created = 'YES' MINUS SELECT name, partition_name FROM sysadm.gfc_index_stats ) LOOP IF i.partition_name IS NULL THEN l_sql := 'ANALYZE INDEX '||l_owner||'.'||i.index_name||' VALIDATE STRUCTURE'; ELSE l_sql := 'ANALYZE INDEX '||l_owner||'.'||i.index_name||' PARTITION ('||i.partition_name||') VALIDATE STRUCTURE'; END IF; dbms_output.put_line(l_sql); EXECUTE IMMEDIATE l_sql; DELETE FROM sysadm.gfc_index_stats g WHERE EXISTS( SELECT 'x' FROM index_stats i WHERE i.name = g.name AND (i.partition_name = g.partition_name OR (i.partition_name IS NULL AND g.partition_name IS NULL))); INSERT INTO sysadm.gfc_index_stats SELECT i.* FROM index_stats i; COMMIT; END LOOP; END; / column table_name format a18 column index_name format a18 column partition_name format a30 column name format a18 column freq format 999 column parts heading 'Num|Parts' format 9999 column prefix_length heading 'Index|Prefix|Length' column weighted_average_saving format 99.9 heading 'Weighted|Average|Saving %' column opt_cmpr_count heading 'Opt Comp|Prefix|Length' column opt_cmpr_pctsave format 99.9 heading 'Saving|%' column blocks heading 'Blocks' format 999,999,999 column est_comp_blocks heading 'Est.|Comp|Blocks' format 999,999,999 column tot_blocks heading 'Total|Blocks' format 999,999,999 column tot_parts heading 'Total|Parts' format 999,999 break on table_name skip 1 on name skip 1 on report compute sum of blocks on name compute sum of blocks on table_name compute sum of blocks on report compute sum of est_comp_blocks on name compute sum of est_comp_blocks on table_name compute sum of est_comp_blocks on report compute sum of parts on name compute sum of parts on table_name compute sum of parts on report ttitle 'Summary Report' set lines 120 pages 99 rem name skip 1 SELECT i.table_name, s.name, s.opt_cmpr_count , count(*) freq , count(partition_name) parts , sum(s.blocks) blocks , sum(s.opt_cmpr_pctsave*blocks)/sum(s.blocks) weighted_average_saving , sum((1-s.opt_cmpr_pctsave/100)*blocks) est_comp_blocks FROM sysadm.gfc_index_stats s, dba_indexes i WHERE s.name = i.index_name AND i.owner = 'SYSADM' --AND s.blocks > 256 GROUP BY i.table_name, s.name, s.opt_cmpr_count ORDER BY i.table_name, s.name, s.opt_cmpr_count / break on table_name on index_name skip 1 compute sum of blocks on index_name compute sum of est_comp_blocks on index_name compute count of partition_name on index_name compute count of partition_name on table_name set lines 170 ttitle 'Partitions with Lower Optimal Prefix Length than Majority' WITH s AS ( select i.table_name, i.index_name, i.prefix_length, s.opt_cmpr_count , s.partition_name , s.blocks , s.opt_cmpr_pctsave from sysadm.gfc_index_stats s, dba_indexes i WHERE s.name = i.index_name AND i.owner = 'SYSADM' ), x as ( SELECT table_name, index_name, opt_cmpr_count , count(*) freq , count(partition_name) parts , sum(blocks) blocks , sum(opt_cmpr_pctsave*blocks)/sum(blocks) weighted_average_saving FROM s --AND blocks > 256 GROUP BY table_name, index_name, opt_cmpr_count ), y as ( select row_number() over (partition by table_name, index_name order by blocks desc) ranking , x.* from x ) select s.table_name, s.index_name, s.prefix_length , y.opt_cmpr_count, y.parts, y.blocks , s.partition_name , s.opt_cmpr_count, s.blocks, s.opt_cmpr_pctsave , ((1-s.opt_cmpr_pctsave/100)*s.blocks) est_comp_blocks from y , s where y.table_name = s.table_name and y.index_name = s.index_name and s.opt_cmpr_count < y.opt_cmpr_count and y.ranking = 1 order by table_name, index_name, partition_name / set lines 130 ttitle 'Detail Report' break on table_name on name skip 1 SELECT i.table_name, s.name, s.partition_name, s.opt_cmpr_count , s.blocks , s.opt_cmpr_pctsave , ((1-s.opt_cmpr_pctsave/100)*s.blocks) est_comp_blocks FROM sysadm.gfc_index_stats s, dba_indexes i WHERE s.name = i.index_name AND i.owner = 'SYSADM' ORDER BY i.table_name, s.name, s.partition_name, s.opt_cmpr_count FETCH FIRST 50 ROWS ONLY / spool off
SELECT * FROM VND.ELO_AGENDAMENTO WHERE CD_ELO_STATUS = 9; SELECT COUNT(1) FROM VND.ELO_AGENDAMENTO_WEEK_FROZZEN WHERE CD_ELO_STATUS_FROZZEN = 8; SELECT * FROM VND.ELO_AGENDAMENTO_DAY_FROZZEN; WITH CTE_FROZZEN AS ( SELECT SUP.CD_ELO_AGENDAMENTO--, WEFR.* FROM VND.ELO_AGENDAMENTO_SUPERVISOR SUP INNER JOIN VND.ELO_AGENDAMENTO_ITEM ITEM ON SUP.CD_ELO_AGENDAMENTO_SUPERVISOR = ITEM.CD_ELO_AGENDAMENTO_SUPERVISOR INNER JOIN VND.ELO_AGENDAMENTO_WEEK WEES ON ITEM.CD_ELO_AGENDAMENTO_ITEM = WEES.CD_ELO_AGENDAMENTO_ITEM INNER JOIN VND.ELO_AGENDAMENTO_WEEK_FROZZEN WEFR ON ITEM.CD_ELO_AGENDAMENTO_ITEM = WEFR.CD_ELO_AGENDAMENTO_ITEM WHERE WEFR.CD_ELO_STATUS_FROZZEN = 3 AND WEFR.DH_ULT_ALTERACAO > (SYSDATE - 365) GROUP BY SUP.CD_ELO_AGENDAMENTO ) --SELECT * FROM CTE_FROZZEN --WHERE CD_ELO_AGENDAMENTO = 50 SELECT DISTINCT AGE.CD_ELO_AGENDAMENTO , AGE.CD_ELO_STATUS, ( SELECT MAX(WEFR.CD_ELO_AGENDAMENTO_WEEK) FROM VND.ELO_AGENDAMENTO_SUPERVISOR SUP INNER JOIN VND.ELO_AGENDAMENTO_ITEM ITEM ON SUP.CD_ELO_AGENDAMENTO_SUPERVISOR = ITEM.CD_ELO_AGENDAMENTO_SUPERVISOR INNER JOIN VND.ELO_AGENDAMENTO_WEEK WEFR ON ITEM.CD_ELO_AGENDAMENTO_ITEM = WEFR.CD_ELO_AGENDAMENTO_ITEM WHERE SUP.CD_ELO_AGENDAMENTO = AGE.CD_ELO_AGENDAMENTO ) TEM_WEEK, FR.* FROM VND.ELO_AGENDAMENTO AGE LEFT JOIN CTE_FROZZEN FR ON AGE.CD_ELO_AGENDAMENTO = FR.CD_ELO_AGENDAMENTO WHERE AGE.CD_ELO_STATUS in( 3,4,5,6,7,8,9) AND FR.CD_ELO_AGENDAMENTO IS NULL; SELECT * FROM VND.ELO_AGENDAMENTO WHERE CD_ELO_STATUS = 9; SELECT SUP.CD_ELO_AGENDAMENTO --INTO V_CD_ELO_AGENDAMENTO FROM VND.ELO_AGENDAMENTO_SUPERVISOR SUP INNER JOIN VND.ELO_AGENDAMENTO_ITEM ITEM ON SUP.CD_ELO_AGENDAMENTO_SUPERVISOR = ITEM.CD_ELO_AGENDAMENTO_SUPERVISOR INNER JOIN VND.ELO_AGENDAMENTO_WEEK_FROZZEN WEFR ON ITEM.CD_ELO_AGENDAMENTO_ITEM = WEFR.CD_ELO_AGENDAMENTO_ITEM WHERE 1=1 AND WEFR.CD_ELO_STATUS_FROZZEN = 3 AND WEFR.DH_ULT_ALTERACAO > (SYSDATE - 365) AND SUP.CD_ELO_AGENDAMENTO = 50; SELECT '50' BATCH_ID , 30 CD_ELO_STATUS_FROZZEN , WEES.CD_ELO_AGENDAMENTO_WEEK , WEES.CD_ELO_AGENDAMENTO_ITEM , WEES.NU_SEMANA , WEES.QT_COTA , WEES.QT_SEMANA , WEES.QT_EMERGENCIAL , CURRENT_DATE DH_ULT_ALTERACAO FROM VND.ELO_AGENDAMENTO_WEEK WEES WHERE EXISTS (SELECT ITEM.CD_ELO_AGENDAMENTO_ITEM FROM VND.ELO_AGENDAMENTO AGE INNER JOIN VND.ELO_AGENDAMENTO_SUPERVISOR SUP ON AGE.CD_ELO_AGENDAMENTO = SUP.CD_ELO_AGENDAMENTO INNER JOIN VND.ELO_AGENDAMENTO_ITEM ITEM ON SUP.CD_ELO_AGENDAMENTO_SUPERVISOR = ITEM.CD_ELO_AGENDAMENTO_SUPERVISOR WHERE AGE.IC_ATIVO = 'S' --AND AGE.CD_ELO_STATUS IN (2,3) AND AGE.CD_ELO_AGENDAMENTO = 50 AND WEES.CD_ELO_AGENDAMENTO_ITEM = ITEM.CD_ELO_AGENDAMENTO_ITEM); SELECT * FROM VND.ELO_AGENDAMENTO_WEEK WHERE CD_ELO_AGENDAMENTO_ITEM = 5353; SELECT * FROM VND.ELO_CARTEIRA WHERE CD_ELO_AGENDAMENTO = 50 AND QT_AGENDADA > 0; SELECT CD_ELO_STATUS_FROZZEN, CD_ELO_AGENDAMENTO_WEEK, COUNT(1) FROM VND.ELO_AGENDAMENTO_WEEK_FROZZEN GROUP BY CD_ELO_STATUS_FROZZEN, CD_ELO_AGENDAMENTO_WEEK HAVING COUNT(1) > 1 ; SELECT * FROM VND.ELO_AGENDAMENTO_WEEK_FROZZEN WHERE CD_ELO_STATUS_FROZZEN = 7 AND DH_ULT_ALTERACAO = TO_DATE('14/06/2018 18:59:06', 'DD/MM/YYYY HH24:MI:SS') AND CD_ELO_AGENDAMENTO_WEEK = 8919; UPDATE VND.ELO_AGENDAMENTO_WEEK_FROZZEN SET CD_ELO_STATUS_FROZZEN = 3 WHERE CD_ELO_STATUS_FROZZEN = 7 AND DH_ULT_ALTERACAO = TO_DATE('14/06/2018 18:59:06', 'DD/MM/YYYY HH24:MI:SS'); UPDATE VND.ELO_AGENDAMENTO_DAY_FROZZEN SET CD_ELO_STATUS_FROZZEN = 3 WHERE CD_ELO_STATUS_FROZZEN = 7 AND DH_ULT_ALTERACAO = TO_DATE('14/06/2018 18:59:06', 'DD/MM/YYYY HH24:MI:SS'); SELECT * FROM VND.ELO_AGENDAMENTO_DAY_FROZZEN WHERE CD_ELO_STATUS_FROZZEN = 7 AND DH_ULT_ALTERACAO = TO_DATE('14/06/2018 18:59:06', 'DD/MM/YYYY HH24:MI:SS'); UPDATE VND.ELO_AGENDAMENTO_WEEK_FROZZEN SET CD_ELO_STATUS_FROZZEN = 3 WHERE CD_ELO_STATUS_FROZZEN NOT IN ( 3, 7); UPDATE VND.ELO_AGENDAMENTO_DAY_FROZZEN SET CD_ELO_STATUS_FROZZEN = 3 WHERE CD_ELO_STATUS_FROZZEN NOT IN ( 3, 7); SELECT * from VND.ELO_AGENDAMENTO_WEEK_FROZZEN WHERE CD_ELO_STATUS_FROZZEN NOT IN ( 3, 7); UPDATE ELO_AGENDAMENTO_WEEK_FROZZEN SET BATCH_ID = 'BA18061405', DH_ULT_ALTERACAO = CURRENT_DATE -0.1 WHERE BATCH_ID = 'BA18061406'; UPDATE ELO_AGENDAMENTO_DAY_FROZZEN SET BATCH_ID = 'BA18061405', DH_ULT_ALTERACAO = CURRENT_DATE -0.1 WHERE BATCH_ID = 'BA18061406'; UPDATE VND.ELO_AGENDAMENTO_WEEK_FROZZEN SET BATCH_ID = 'BA18066', DH_ULT_ALTERACAO = TO_DATE('14/06/2018 18:59:06', 'DD/MM/YYYY HH24:MI:SS') WHERE CD_ELO_STATUS_FROZZEN IN ( 7); UPDATE VND.ELO_AGENDAMENTO_DAY_FROZZEN SET BATCH_ID = 'BA18066', DH_ULT_ALTERACAO = TO_DATE('14/06/2018 18:59:06', 'DD/MM/YYYY HH24:MI:SS') WHERE CD_ELO_STATUS_FROZZEN IN ( 7); SELECT CURRENT_DATE - 0.1 FROM DUAL; UPDATE VND.ELO_AGENDAMENTO_WEEK_FROZZEN SET BATCH_ID = 'BA18060606' WHERE CD_ELO_STATUS_FROZZEN IN ( 7) and BATCH_ID = 'BA18066'; UPDATE VND.ELO_AGENDAMENTO_day_FROZZEN SET BATCH_ID = 'BA18060606' WHERE CD_ELO_STATUS_FROZZEN IN ( 7) and BATCH_ID = 'BA18066';
CREATE PROCEDURE `getDeskByOffice` (IN `office_id` INT(8), IN `office_location` VARCHAR(50)) BEGIN SELECT * FROM `desk` where `fk_office_id`=`office_id` and `fk_office_location`=`office_location`; END DELIMITER $$ CREATE PROCEDURE `getOpenDesks` (IN `officeid` INT(8), IN `officelocation` VARCHAR(50), IN `desk_id` VARCHAR(50), IN `floor_num` INT(8), IN `from` DATE, IN `to` DATE, IN `startindex` INT(8), IN `numOnPage` INT(8)) BEGIN SELECT * FROM `desk` JOIN `office` ON `fk_office_id`=`office_id` AND `fk_office_location`=`office_location` WHERE CONCAT(`fk_office_location`, `fk_office_id`, `fk_floor_num`, `desk_id`) NOT IN (SELECT CONCAT(`fk_office_location`, `fk_office_id`, `fk_floor_num`, `fk_desk_id`) AS `deskKey` FROM `reservation` WHERE `start_date` BETWEEN `from` and `to`) AND desk.desk_id=`desk_id` AND desk.fk_floor_num=`floor_num` AND desk.fk_office_id=`officeid` AND desk.fk_office_location=`officelocation` LIMIT `startindex`, `numOnPage`; END$$ DELIMITER ; DELIMITER $$ CREATE PROCEDURE `getOpenDesksAtOffice` (IN `officeid` INT(8), IN `officelocation` VARCHAR(50), IN `from` DATE, IN `to` DATE, IN `startindex` INT(8), IN `numOnPage` INT(8)) BEGIN SELECT * FROM `desk` JOIN `office` ON `fk_office_id`=`office_id` AND `fk_office_location`=`office_location` WHERE CONCAT(`fk_office_location`, `fk_office_id`, `fk_floor_num`, `desk_id`) NOT IN (SELECT CONCAT(`fk_office_location`, `fk_office_id`, `fk_floor_num`, `fk_desk_id`) AS `deskKey` FROM `reservation` WHERE `start_date` BETWEEN `from` and `to`) AND desk.fk_office_id=`officeid` AND desk.fk_office_location=`officelocation` LIMIT `startindex`, `numOnPage`; END$$ DELIMITER ; DELIMITER $$ CREATE PROCEDURE `getAllOpenDesks` (IN `from` DATE, IN `to` DATE, IN `startindex` INT(8), IN `numOnPage` INT(8)) BEGIN SELECT * FROM `desk` JOIN `office` ON `fk_office_id`=`office_id` AND `fk_office_location`=`office_location` WHERE CONCAT(`fk_office_location`, `fk_office_id`, `fk_floor_num`, `desk_id`) NOT IN (SELECT CONCAT(`fk_office_location`, `fk_office_id`, `fk_floor_num`, `fk_desk_id`) AS `deskKey` FROM `reservation` WHERE `start_date` BETWEEN `from` and `to`) LIMIT `startindex`, `numOnPage`; END$$ DELIMITER ; CREATE PROCEDURE `createDesk` (IN `desk_id` VARCHAR(50), IN `floor_num` INT(8), IN `office_id` INT(8), IN `office_location` VARCHAR(50), IN `capacity` INT(8)) BEGIN INSERT INTO `desk` (`desk_id`, `fk_floor_num`, `fk_office_id`, `fk_office_location`, `capacity`) VALUES (`desk_id`, `floor_num`, `office_id`, `office_location`, `capacity`); END DELIMITER ; DELIMITER $$ CREATE PROCEDURE `deleteDesks` (IN `id` INT(8), IN `city` VARCHAR(50), IN `floorNum` INT(8)) BEGIN DELETE FROM `desk` WHERE `fk_office_id` = `id` AND `fk_office_location` = `city` AND `fk_floor_num` = `floorNum`; END DELIMITER ; DELIMITER $$
drop database if exists ge; create database ge; use ge; create table player ( player_id integer auto_increment primary key, username varchar(16) not null unique key, password varchar(64) not null, nickname varchar(16) not null unique key, email varchar(64) not null, banned bit default 0, activated bit default 0, location_object_id integer, ship_state_id integer, ship_config_id integer ); -- links for account activation via email create table player_activation_hash ( player_activation_hash_id integer auto_increment primary key, activation_hash varchar(32), player_id integer not null ); -- shipType info create table ship_state (-- dynamic state of the shipType ship_state_id integer auto_increment primary key, ship_state_move_speed float not null default 0, ship_state_rotation_speed float not null default 0, ship_state_hp integer not null, ship_state_energy integer not null, ship_state_armor_durability integer not null ); create table ship_type ( ship_type_id integer auto_increment primary key, ship_type_name varchar(32) not null unique key, ship_type_armor integer not null, ship_type_armor_durability integer not null, ship_type_energy_max integer not null, ship_type_hp_max integer not null, ship_type_energy_regen integer not null, ship_type_hp_regen integer not null, ship_type_move_max_speed float not null, ship_type_move_acceleration float not null, ship_type_rotation_max_speed float not null, ship_type_rotation_acceleration float not null, weapon_slots_count integer not null, bonus_slots_count integer not null ); create table ship_config (-- static state of the shipType ship_config_id integer auto_increment primary key, ship_config_move_max_speed float not null, ship_config_move_acceleration float not null, ship_config_rotation_max_speed float not null, ship_config_rotation_acceleration float not null, ship_config_armor integer not null, ship_config_energy_max integer not null, ship_config_hp_max integer not null, ship_config_energy_regen integer not null, ship_config_hp_regen integer not null, ship_type_id integer not null, engine_item_id integer not null ); create table ship_config_bonus_slot ( ship_config_bonus_slot_id integer auto_increment primary key, ship_config_id integer not null, item_id integer not null ); create table ship_config_weapon_slot ( ship_config_weapon_slot_id integer auto_increment primary key, ship_config_id integer not null, item_id integer not null ); -- game item create table item_type ( item_type_id integer auto_increment primary key, item_type_name varchar(16) not null unique key -- engine, bullet, bonus, sale ); create table item ( item_id integer auto_increment primary key, item_name varchar(32) not null unique key, item_description varchar(64) not null, item_price integer not null, item_type_id integer not null ); create table bonus_type ( bonus_type_id integer auto_increment primary key, bonus_type_name varchar(32) not null unique key -- armor, hp_regen, energy_regen, speed(rotation, move), acceleration(rotation,move), bullet ); create table bonus ( bonus_id integer auto_increment primary key, bonus_value integer not null, bonus_type_id integer not null, item_id integer not null ); create table weapon_type ( weapon_type_id integer auto_increment primary key, weapon_type_name varchar(32) not null unique key -- rocket, laser ); create table weapon ( weapon_id integer auto_increment primary key, damage integer not null, shot_delay integer not null, bullet_speed float not null, max_distance integer not null, energy_cost integer not null, -- amount of energy for one shot weapon_type_id integer not null, item_id integer not null ); create table engine ( engine_id integer auto_increment primary key, move_acceleration_bonus float not null, move_max_speed_bonus float not null, rotation_acceleration_bonus float not null, rotation_max_speed_bonus float not null, item_id integer not null ); create table inventory_item ( inventory_item_id integer auto_increment primary key, amount integer not null default 1, item_id integer not null, player_id integer not null ); create table location ( location_id integer auto_increment primary key, location_name varchar(32) not null, location_width integer not null, location_height integer not null ); create table location_object ( location_object_id integer auto_increment primary key, location_object_behavior_type_id integer not null, location_object_type_id integer not null, object_native_id integer not null, -- defines the primary key of table depending on object type rotation_angle float not null default 0, position_x float not null, position_y float not null, location_id integer not null ); create table location_object_type ( location_object_type_id integer auto_increment primary key, object_type_name varchar(16) not null -- rocket, player, asteroid ); create table location_object_behavior_type ( location_object_behavior_type_id integer auto_increment primary key, object_behavior_type_name varchar(16) not null ); alter table location_object add constraint fk_location_object_location foreign key (location_id) references location (location_id), add constraint fk_location_object_location_object_type foreign key (location_object_type_id) references location_object_type (location_object_type_id), add constraint fk_location_object_location_object_behavior_type foreign key (location_object_behavior_type_id) references location_object_behavior_type (location_object_behavior_type_id); alter table bonus add constraint fk_bonus_item foreign key (item_id) references item (item_id), add constraint fk_bonus_bonus_type foreign key (bonus_type_id) references bonus_type (bonus_type_id); alter table engine add constraint fk_engine_type_item foreign key (item_id) references item (item_id); alter table inventory_item add constraint fk_inventory_item_item foreign key (item_id) references item (item_id), add constraint fk_inventory_item_player foreign key (player_id) references player (player_id); alter table item add constraint fk_item_item_type foreign key (item_type_id) references item_type (item_type_id); alter table ship_config add constraint fk_ship_config_engine_item foreign key (engine_item_id) references item (item_id), add constraint fk_ship_config_ship_type foreign key (ship_type_id) references ship_type (ship_type_id); alter table ship_config_bonus_slot add constraint fk_ship_config_bonus_slot_item foreign key (item_id) references item (item_id), add constraint fk_ship_config_bonus_slot_ship_config foreign key (ship_config_id) references ship_config (ship_config_id); alter table ship_config_weapon_slot add constraint fk_ship_config_weapon_slot_item foreign key (item_id) references item (item_id), add constraint fk_ship_config_weapon_slot_ship_config foreign key (ship_config_id) references ship_config (ship_config_id); alter table weapon add constraint fk_weapon_item foreign key (item_id) references item (item_id), add constraint fk_weapon_weapon_type foreign key (weapon_type_id) references weapon_type (weapon_type_id); alter table player_activation_hash add constraint fk_player_activation_hash_player foreign key (player_activation_hash_id) references player (player_id); alter table player add constraint fk_player_ship_config foreign key (ship_config_id) references ship_config (ship_config_id), add constraint fk_player_ship_state foreign key (ship_state_id) references ship_state (ship_state_id), add constraint fk_player_location_object foreign key (location_object_id) references location_object (location_object_id);
select * from KRIM_ENTITY_ADDR_T where ver_nbr = 3 ; select * from KRIM_ENTITY_AFLTN_T where ver_nbr = 3; select * from KRIM_ENTITY_EMAIL_T where ver_nbr = 3 ; select * from KRIM_ENTITY_EMP_INFO_T where ver_nbr = 3 ; select * from KRIM_ENTITY_ENT_TYP_T where ver_nbr = 3 ; select * from KRIM_ENTITY_NM_T where ver_nbr = 3; select * from KRIM_ENTITY_PHONE_T where ver_nbr = 3 ; select * from KRIM_ENTITY_T where ver_nbr = 3; select * from KRIM_PRNCPL_T where ver_nbr = 3 ; select * from KRIM_ROLE_MBR_T where ver_nbr = 3 ; select * from KRIM_ROLE_MBR_ATTR_DATA_T where ver_nbr = 3 ; select * from KRIM_ENTITY_T; select * from KRIM_ENTITY_ENT_TYP_T; select * from KRIM_ENTITY_ADDR_T; select * from KRIM_ENTITY_NM_T; select * from KRIM_PRNCPL_T; select * from all_constraints where constraint_type ='R' and delete_rule = 'CASCADE' and TABLE_NAME = 'KRIM_ENTITY_ENT_TYP_T'; select * from KRIM_ENTITY_ADDR_T; select * from KRIM_PRNCPL_T where prncpl_nm = 'pcall'; delete from KRIM_ENTITY_T where ver_nbr = 3; delete from KRIM_ENTITY_ADDR_T where ver_nbr = 3 ; delete from KRIM_ENTITY_AFLTN_T where ver_nbr = 3; delete from KRIM_ENTITY_EMAIL_T where ver_nbr = 3 ; delete from KRIM_ENTITY_EMP_INFO_T where ver_nbr = 3 ; delete from KRIM_ENTITY_ENT_TYP_T where ver_nbr = 3 ; delete from KRIM_ENTITY_NM_T where ver_nbr = 3; delete from KRIM_ENTITY_PHONE_T where ver_nbr = 3 ; delete from KRIM_PRNCPL_T where ver_nbr = 3 ; delete from KRIM_ROLE_MBR_T where ver_nbr = 3 ; delete from KRIM_ROLE_MBR_ATTR_DATA_T where ver_nbr = 3 ;
# Host: localhost (Version: 5.7.9-log) # Date: 2015-11-16 00:12:18 # Generator: MySQL-Front 5.3 (Build 4.234) /*!40101 SET NAMES utf8 */; # # Structure for table "categorias" # CREATE TABLE `categorias` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `nome` varchar(120) DEFAULT NULL, `descricao` text, `plano_conta_id` int(11) DEFAULT NULL, `tipo` enum('DEBITO','CREDITO') NOT NULL DEFAULT 'DEBITO', PRIMARY KEY (`Id`), KEY `plano_conta_id` (`plano_conta_id`), CONSTRAINT `categorias_ibfk_1` FOREIGN KEY (`plano_conta_id`) REFERENCES `categorias` (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; # # Structure for table "funcionarios" # CREATE TABLE `funcionarios` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `nome` varchar(150) NOT NULL DEFAULT '', `matricula` varchar(20) DEFAULT NULL, `cargo` varchar(30) DEFAULT NULL, `funcao` varchar(120) DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # # Structure for table "centros_custo" # CREATE TABLE `centros_custo` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `nome` varchar(255) NOT NULL DEFAULT '', `descricao` text, `tipo` enum('CX','CT','CC','CR','UO','FJ','FF','CJ','CF') NOT NULL DEFAULT 'CX', `numero_conta` varchar(6) DEFAULT NULL, `banco_conta` varchar(60) DEFAULT NULL, `numero_cartao` varchar(20) DEFAULT NULL, `vencimento_cartao` date DEFAULT NULL, `limite_cartao` float(15,2) DEFAULT '0.00', `tipo_unidade_setor` varchar(20) DEFAULT NULL, `numero_externo_setor` varchar(5) DEFAULT NULL, `hierarquia_setor_id` int(11) DEFAULT NULL, `funcionario_id` int(11) DEFAULT NULL, `rua` varchar(180) DEFAULT NULL, `numero` varchar(10) DEFAULT NULL, `bairro` varchar(50) DEFAULT NULL, `cidade` varchar(80) DEFAULT NULL, `cep` varchar(10) DEFAULT NULL, `telefone` varchar(20) DEFAULT NULL, `cpf` varchar(14) DEFAULT NULL, `cnpj` varchar(20) DEFAULT NULL, `centro_custo_id` int(11) DEFAULT NULL, PRIMARY KEY (`Id`), KEY `hierarquia_id` (`hierarquia_setor_id`), KEY `funcionario_id` (`funcionario_id`), CONSTRAINT `centros_custo_ibfk_1` FOREIGN KEY (`hierarquia_setor_id`) REFERENCES `centros_custo` (`Id`), CONSTRAINT `centros_custo_ibfk_2` FOREIGN KEY (`funcionario_id`) REFERENCES `funcionarios` (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; # # Structure for table "registros_importacao" # CREATE TABLE `registros_importacao` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `data` date DEFAULT NULL, `sistema` varchar(150) DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # # Structure for table "movimentos" # CREATE TABLE `movimentos` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `categoria_id` int(11) NOT NULL DEFAULT '0', `data` date NOT NULL DEFAULT '0000-00-00', `numero_parcela` int(3) NOT NULL DEFAULT '1', `valor` float(15,2) NOT NULL DEFAULT '0.00', `observacao` text, `tipo` enum('TRANSFERENCIA','DESPESA','RECEITA') NOT NULL DEFAULT 'TRANSFERENCIA', `centro_custo_transferencia_id` int(11) DEFAULT NULL COMMENT 'usado apenas quando transferencia', `registro_importacao_id` int(11) DEFAULT NULL COMMENT 'usado apenas quando receita importado de outro sistema', `destino_id` int(11) DEFAULT NULL, PRIMARY KEY (`Id`), KEY `centro_custo_transferencia_id` (`centro_custo_transferencia_id`), KEY `registro_importacao_id` (`registro_importacao_id`), KEY `categoria_id` (`categoria_id`), KEY `FK_9uqtwptxsxqcs3aogetlrhdy6` (`destino_id`), CONSTRAINT `FK_9uqtwptxsxqcs3aogetlrhdy6` FOREIGN KEY (`destino_id`) REFERENCES `centros_custo` (`Id`), CONSTRAINT `movimentos_ibfk_1` FOREIGN KEY (`centro_custo_transferencia_id`) REFERENCES `centros_custo` (`Id`), CONSTRAINT `movimentos_ibfk_2` FOREIGN KEY (`registro_importacao_id`) REFERENCES `registros_importacao` (`Id`), CONSTRAINT `movimentos_ibfk_3` FOREIGN KEY (`categoria_id`) REFERENCES `categorias` (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; # # Structure for table "detalhe_movimentos" # CREATE TABLE `detalhe_movimentos` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `centro_custo_id` int(11) NOT NULL DEFAULT '0', `movimento_id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`Id`), KEY `centro_custo_id` (`centro_custo_id`), KEY `movimento_id` (`movimento_id`), CONSTRAINT `detalhe_movimentos_ibfk_1` FOREIGN KEY (`centro_custo_id`) REFERENCES `centros_custo` (`Id`), CONSTRAINT `detalhe_movimentos_ibfk_2` FOREIGN KEY (`movimento_id`) REFERENCES `movimentos` (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; # # Structure for table "estados_caixa" # CREATE TABLE `estados_caixa` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `tipo` enum('REALIZADO','NAO_REALIZADO','ATRASADO') NOT NULL DEFAULT 'NAO_REALIZADO', `data` date DEFAULT NULL, `movimento_id` int(11) DEFAULT NULL, PRIMARY KEY (`Id`), KEY `movimento_id` (`movimento_id`), CONSTRAINT `estados_caixa_ibfk_1` FOREIGN KEY (`movimento_id`) REFERENCES `movimentos` (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
select distinct city from station where ID % 2=0 order by city asc;
/* * Copyright 2013-2016 Uncharted Software Inc. * * Property of Uncharted(TM), formerly Oculus Info Inc. * https://uncharted.software/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -- ----------------------------- -- Influent Data Views 1.2 DRAFT -- ----------------------------- -- -- FINANCIAL FLOW - ALL -- Used to build the aggregate flow diagrams -- -- FromEntityId - entity UID that is the source of the transactions -- FromEntityType - type of src entity: O = owner summary, A = account, S = cluster summary entity -- ToEntityId - entity UID that is the target of the transactions -- ToEntityType - type of dst entity: O = owner summary, A = account, S = cluster summary entity -- FirstTransaction - datetime of first transaction -- LastTransaction - datetime of last transaction -- Amount - aggregate amount -- create table FinFlow (FromEntityId varchar(100), FromEntityType varchar(1), ToEntityId varchar(100), ToEntityType varchar(1), FirstTransaction datetime, LastTransaction datetime, Amount float, CONSTRAINT pk_FF_ID PRIMARY KEY (FromEntityId, ToEntityId)); create table FinEntity(EntityId varchar(100) PRIMARY KEY, IncomingLinks int, UniqueIncomingLinks int, OutgoingLinks int, UniqueOutgoingLinks int, NumTransactions int, MaxTransaction float, AvgTransaction float, StartDate datetime, EndDate datetime); -- -- FINANCIAL FLOW - AGGREGATED BY TIME -- Used to build the aggregate flow diagrams (aggregated by time) -- and used to build the highlighted sub-section of the time series charts on entities. -- -- FromEntityId - entity UID that is the source of the transactions -- FromEntityType - type of src entity: O = owner summary, A = account, S = cluster summary entity -- ToEntityId - entity UID that is the target of the transactions -- ToEntityType - type of dst entity: O = owner summary, A = account, S = cluster summary entity -- Amount - aggregate amount for this time period -- Date - start of the time period -- create table FinFlowDaily (FromEntityId varchar(100), FromEntityType varchar(1), ToEntityId varchar(100), ToEntityType varchar(1), Amount float, PeriodDate datetime, CONSTRAINT pk_FFD_ID PRIMARY KEY (FromEntityId, ToEntityId, PeriodDate)); create table FinFlowWeekly (FromEntityId varchar(100), FromEntityType varchar(1), ToEntityId varchar(100), ToEntityType varchar(1), Amount float, PeriodDate datetime, CONSTRAINT pk_FFW_ID PRIMARY KEY (FromEntityId, ToEntityId, PeriodDate)); create table FinFlowMonthly (FromEntityId varchar(100), FromEntityType varchar(1), ToEntityId varchar(100), ToEntityType varchar(1), Amount float, PeriodDate datetime, CONSTRAINT pk_FFM_ID PRIMARY KEY (FromEntityId, ToEntityId, PeriodDate)); create table FinFlowQuarterly (FromEntityId varchar(100), FromEntityType varchar(1), ToEntityId varchar(100), ToEntityType varchar(1), Amount float, PeriodDate datetime, CONSTRAINT pk_FFQ_ID PRIMARY KEY (FromEntityId, ToEntityId, PeriodDate)); create table FinFlowYearly (FromEntityId varchar(100), FromEntityType varchar(1), ToEntityId varchar(100), ToEntityType varchar(1), Amount float, PeriodDate datetime, CONSTRAINT pk_FFY_ID PRIMARY KEY (FromEntityId, ToEntityId, PeriodDate)); -- -- FINANCIAL ENTITY SUMMARY -- Used to build the time series charts on entities (aggregated by time). -- -- EntityId - entity UID -- Date - start of the time period -- InboundAmount - aggregate credits for this time period -- IncomingLinks - unique inbound transactions by entity -- OutboundAmount - aggregate debits for this time period -- OutgoingLinks - unique outbound transactions by entity -- Balance - aggregate credits - debits up until this time period -- create table FinEntityDaily (EntityId varchar(100), PeriodDate datetime, InboundAmount float, IncomingLinks int, OutboundAmount float, OutgoingLinks int, Balance float, CONSTRAINT pk_FED_ID PRIMARY KEY (EntityId, PeriodDate)); create table FinEntityWeekly (EntityId varchar(100), PeriodDate datetime, InboundAmount float, IncomingLinks int, OutboundAmount float, OutgoingLinks int, Balance float, CONSTRAINT pk_FEW_ID PRIMARY KEY (EntityId, PeriodDate)); create table FinEntityMonthly (EntityId varchar(100), PeriodDate datetime, InboundAmount float, IncomingLinks int, OutboundAmount float, OutgoingLinks int, Balance float, CONSTRAINT pk_FEM_ID PRIMARY KEY (EntityId, PeriodDate)); create table FinEntityQuarterly (EntityId varchar(100), PeriodDate datetime, InboundAmount float, IncomingLinks int, OutboundAmount float, OutgoingLinks int, Balance float, CONSTRAINT pk_FEQ_ID PRIMARY KEY (EntityId, PeriodDate)); create table FinEntityYearly (EntityId varchar(100), PeriodDate datetime, InboundAmount float, IncomingLinks int, OutboundAmount float, OutgoingLinks int, Balance float, CONSTRAINT pk_FEY_ID PRIMARY KEY (EntityId, PeriodDate)); -- -- CLUSTER SUMMARY -- Used to summarize an entity with a large number of associated entities (e.g. account owner with a large number of accounts) -- It is up to each application to determine what cluster summaries to generate based on the size of data -- -- EntityId - entity UID of cluster entity -- Property - name of summary property -- Tag - Property_Tag to associate with property -- Type - FL_PropertyType data type of property value (DOUBLE, LONG, BOOLEAN, STRING, DATE, GEO, OTHER) -- Value - the string representation of the property value -- Stat - an associated stat for the property value such as frequency or weight -- -- NOTES: Cluster summaries that represent an account owner should have an account owner property that associates the entity id of the account owner to the cluster summary: -- Ex: EnitityId = 'cluster123', Property = 'ownerId', Tag = 'ACCOUNT_OWNER', Type = 'String', Value = 'partner123', Stat = 0 -- Cluster summaries that do not support branching should have a property of UNBRANCHABLE (by default all cluster summaries are branchable) -- Ex: EnitityId = 'cluster123', Property = 'UNBRANCHABLE', Tag = 'ENTITY_TYPE', Type = 'BOOLEAN', Value = 'true', Stat = 0 create table ClusterSummary (EntityId varchar(100), Property varchar(50), Tag varchar(50), Type varchar(50), Value varchar(200), Stat float, CONSTRAINT pk_CS_ID PRIMARY KEY (EntityId, Property, Value)); -- -- CLUSTER SUMMARY MEMBERS -- Used to keep track of entities that are members of a cluster summary -- It is up to each application to determine what cluster summaries to generate based on the size of data -- -- SummaryId - UID of cluster summary -- EntityId - member entity UID -- create table ClusterSummaryMembers (SummaryId varchar(100), EntityId varchar(100), CONSTRAINT pk_CSM_ID PRIMARY KEY (SummaryId, EntityId)); -- -- DATA VIEW DRIVERS -- These scripts will populate the data views above. -- -- Step 1. Modify this to pull data from your raw data. Add any transactions to cluster summaries as well. -- insert into FinFlowDaily SELECT `source_id`, 'A', `dest_id`, 'A', SUM(`amount`), DATE(`dt`) FROM YOUR_RAW_DATA group by `source_id`, `dest_id`, DATE(`dt`); -- build FinEntity insert into FinEntity (EntityId, IncomingLinks, UniqueIncomingLinks, OutgoingLinks, UniqueOutgoingLinks, NumTransactions, MaxTransaction, AvgTransaction, StartDate, EndDate) Select EntityId, sum(IncomingLinks) as IncomingLinks, sum(UniqueIncomingLinks) as UniqueIncomingLinks, sum(OutgoingLinks) as OutgoingLinks , sum(UniqueOutgoingLinks) as UniqueOutgoingLinks, sum(numTransactions) as NumTransactions, max(MaxTransaction) as MaxTransactions, sum(TotalTransactions) / sum(numTransactions) as AvgTransactions, min(StartDate) as StartDate, max(EndDate) as EndDate From ( select `dest_id` as EntityId, count(`source_id`) as IncomingLinks, count( distinct `source_id` ) as UniqueIncomingLinks, 0 as OutgoingLinks, 0 as UniqueOutgoingLinks, count(`dest_id`) as numTransactions, max(`amount`) as MaxTransaction, sum(`amount`) as TotalTransactions, min(`dt`) as StartDate, max(`dt`) as EndDate from YOUR_RAW_DATA group by `dest_id` UNION select `source_id` as EntityId, 0 as IncomingLinks, 0 as UniqueIncomingLinks, count(`dest_id`) as OutgoingLinks, count( distinct `dest_id` ) as UniqueOutgoingLinks, sum( case when `source_id` <> `dest_id` then 1 else 0 end ) as numTransactions, max(`amount`) as MaxTransaction, sum(`amount`) as TotalTransactions, min(`dt`) as StartDate, max(`dt`) as EndDate from YOUR_RAW_DATA group by `source_id` )q group by EntityId create index ix_ff_id on FinEntity (EntityId); -- -- Step 2. The rest of the script will collect data from FinFlowDaily. -- Execute the rest of this script "as-is". -- -- build the rest of the FinFlow aggregations insert into FinFlowWeekly select FromEntityId, FromEntityType, ToEntityId, ToEntityType, sum(Amount), DATE_ADD(DATE(PeriodDate), INTERVAL ((1) - DAYOFWEEK(DATE(PeriodDate)) - 6 ) DAY) from FinFlowDaily group by FromEntityId, FromEntityType, ToEntityId, ToEntityType, DATE_ADD(DATE(PeriodDate), INTERVAL ((1) - DAYOFWEEK(DATE(PeriodDate)) - 6 ) DAY); insert into FinFlowMonthly select FromEntityId, FromEntityType, ToEntityId, ToEntityType, sum(Amount), CONCAT(CONCAT(CONCAT(convert(YEAR(DATE(PeriodDate)),char(4)),'/'),convert(MONTH(DATE(PeriodDate)),char(2))),'/01') from FinFlowDaily group by FromEntityId, FromEntityType, ToEntityId, ToEntityType, CONCAT(CONCAT(CONCAT(convert(YEAR(DATE(PeriodDate)),char(4)),'/'),convert(MONTH(DATE(PeriodDate)),char(2))),'/01'); insert into FinFlowQuarterly select FromEntityId, FromEntityType, ToEntityId, ToEntityType, sum(Amount), CONCAT(CONCAT(CONCAT(convert(YEAR(DATE(PeriodDate)),char(4)),'/'),case when QUARTER(DATE(PeriodDate))=1 then '01' when QUARTER(DATE(PeriodDate))=2 then '04' when QUARTER(DATE(PeriodDate))=3 then '07' when QUARTER(DATE(PeriodDate))=4 then '010' end),'/01') from FinFlowMonthly group by FromEntityId, FromEntityType, ToEntityId, ToEntityType, CONCAT(CONCAT(CONCAT(convert(YEAR(DATE(PeriodDate)),char(4)),'/'),case when QUARTER(DATE(PeriodDate))=1 then '01' when QUARTER(DATE(PeriodDate))=2 then '04' when QUARTER(DATE(PeriodDate))=3 then '07' when QUARTER(DATE(PeriodDate))=4 then '010' end),'/01'); insert into FinFlowYearly select FromEntityId, FromEntityType, ToEntityId, ToEntityType, sum(Amount), CONCAT(convert(YEAR( DATE(PeriodDate)),char(4)),'/01/01') from FinFlowMonthly group by FromEntityId, FromEntityType, ToEntityId, ToEntityType, CONCAT(convert(YEAR( DATE(PeriodDate)),char(4)),'/01/01'); -- create FinFlow indices create index ix_ffd_from on FinFlowDaily (FromEntityId, PeriodDate, ToEntityId, Amount); create index ix_ffd_to on FinFlowDaily (ToEntityId, PeriodDate, FromEntityId, Amount); create index ix_ffw_from on FinFlowWeekly (FromEntityId, PeriodDate, ToEntityId, Amount); create index ix_ffw_to on FinFlowWeekly (ToEntityId, PeriodDate, FromEntityId, Amount); create index ix_ffm_from on FinFlowMonthly (FromEntityId, PeriodDate, ToEntityId, Amount); create index ix_ffm_to on FinFlowMonthly (ToEntityId, PeriodDate, FromEntityId, Amount); create index ix_ffq_from on FinFlowQuarterly (FromEntityId, PeriodDate, ToEntityId, Amount); create index ix_ffq_to on FinFlowQuarterly (ToEntityId, PeriodDate, FromEntityId, Amount); create index ix_ffy_from on FinFlowYearly (FromEntityId, PeriodDate, ToEntityId, Amount); create index ix_ffy_to on FinFlowYearly (ToEntityId, PeriodDate, FromEntityId, Amount); -- build FinFlow insert into FinFlow select FromEntityId, FromEntityType, ToEntityId, ToEntityType, min(DATE(PeriodDate)), max(DATE(PeriodDate)), sum(Amount) from FinFlowDaily group by FromEntityId, FromEntityType, ToEntityId, ToEntityType; create index ix_ff_to_from on FinFlow (ToEntityId, FromEntityId); create index ix_ff_from_to on FinFlow (FromEntityId, ToEntityId); -- build FinEntityDaily create table temp_ids (Entity varchar(100)); create index tids on temp_ids (Entity); insert into temp_ids select distinct FromEntityId from FinFlowYearly union select distinct ToEntityId from FinFlowYearly; insert into FinEntityDaily select Entity, DATE(PeriodDate), sum(case when ToEntityId = Entity and FromEntityType = 'A' then Amount else 0 end), sum(case when ToEntityId = Entity and FromEntityType = 'A' then 1 else 0 end), -- calculate inbound degree sum(case when FromEntityId = Entity and ToEntityType = 'A' then Amount else 0 end), sum(case when FromEntityId = Entity and ToEntityType = 'A' then 1 else 0 end), -- calculate outbound degree 0 -- TODO calculate balance from temp_ids join FinFlowDaily on FromEntityId = Entity or ToEntityId = Entity group by Entity, DATE(PeriodDate); -- cleanup drop table temp_ids; -- build the rest of the FinEntity aggregations insert into FinEntityWeekly select EntityId, DATE_ADD(DATE(PeriodDate), INTERVAL ((1) - DAYOFWEEK(DATE(PeriodDate)) - 6 ) DAY), sum(InboundAmount), sum(IncomingLinks), sum(OutboundAmount), sum(OutgoingLinks), 0 from FinEntityDaily group by EntityId, DATE_ADD(DATE(PeriodDate), INTERVAL ((1) - DAYOFWEEK(DATE(PeriodDate)) - 6 ) DAY); insert into FinEntityMonthly select EntityId, CONCAT(CONCAT(CONCAT(convert(YEAR( DATE(PeriodDate)),char(4)),'/'),convert(MONTH(DATE(PeriodDate)),char(2))),'/01'), sum(InboundAmount), sum(IncomingLinks), sum(OutboundAmount), sum(OutgoingLinks), 0 from FinEntityDaily group by EntityId, CONCAT(CONCAT(CONCAT(convert(YEAR( DATE(PeriodDate)),char(4)),'/'),convert(MONTH(DATE(PeriodDate)),char(2))),'/01'); insert into FinEntityQuarterly select EntityId, CONCAT(CONCAT(CONCAT(convert(YEAR( DATE(PeriodDate)),char(4)),'/'),case when QUARTER(DATE(PeriodDate))=1 then '01' when QUARTER(DATE(PeriodDate))=2 then '04' when QUARTER(DATE(PeriodDate))=3 then '07' when QUARTER(DATE(PeriodDate))=4 then '010' end),'/01'), sum(InboundAmount), sum(IncomingLinks), sum(OutboundAmount), sum(OutgoingLinks), 0 from FinEntityMonthly group by EntityId, CONCAT(CONCAT(CONCAT(convert(YEAR( DATE(PeriodDate)),char(4)),'/'),case when QUARTER(DATE(PeriodDate))=1 then '01' when QUARTER(DATE(PeriodDate))=2 then '04' when QUARTER(DATE(PeriodDate))=3 then '07' when QUARTER(DATE(PeriodDate))=4 then '010' end),'/01'); insert into FinEntityYearly select EntityId, CONCAT(convert(YEAR( DATE(PeriodDate)),char(4)),'/01/01'), sum(InboundAmount), sum(IncomingLinks), sum(OutboundAmount), sum(OutgoingLinks), 0 from FinEntityQuarterly group by EntityId, CONCAT(convert(YEAR( DATE(PeriodDate)),char(4)),'/01/01'); create index ix_fed on FinEntityDaily (EntityId, PeriodDate, InboundAmount, OutboundAmount); create index ix_few on FinEntityWeekly (EntityId, PeriodDate, InboundAmount, OutboundAmount); create index ix_fem on FinEntityMonthly (EntityId, PeriodDate, InboundAmount, OutboundAmount); create index ix_feq on FinEntityQuarterly (EntityId, PeriodDate, InboundAmount, OutboundAmount); create index ix_fey on FinEntityYearly (EntityId, PeriodDate, InboundAmount, OutboundAmount); create index ix_csum on ClusterSummary (EntityId); create index ix_cmem on ClusterSummaryMembers (SummaryId); -- -- Step 3. Create summary stats table -- create table DataSummary ( SummaryOrder int NOT NULL, SummaryKey varchar(100) NOT NULL, SummaryLabel varchar(1000) NULL, SummaryValue text NULL, UnformattedNumeric float NULL, UnformattedDatetime datetime NULL, CONSTRAINT pk_ds_order PRIMARY KEY (SummaryOrder) ); -- -- Step 4. Populate summary stats table with statistic data -- -- Modify this section as needed to reflect the nature of your dataset. -- The first stat in the table should be a description of your dataset. The following -- inserts show an example of typical summary statistics. Note that you will in most cases -- want to format the values nicely for reading. The script as is here will simply -- copy most types of values over in their default format. UnformattedNumeric -- and UnformattedDatetime are added to provide a reference in case the formatted -- value corrupts or loses valuable information. -- Modify the following to create a summary description insert into DataSummary (SummaryOrder, SummaryKey, SummaryLabel, SummaryValue, UnformattedNumeric, UnformattedDatetime) values ( 1, 'InfoSummary', 'About', 'Some interesting description of your dataset can be written here.' ); -- The following calculates the number of accounts in the data insert into DataSummary (SummaryOrder, SummaryKey, SummaryLabel, SummaryValue, UnformattedNumeric, UnformattedDatetime) values ( 2, 'NumAccounts', 'Accounts', CAST((select count(*) from FinEntity) AS varchar), (select count(*) from FinEntity), NULL ); -- The following calculates the number of transactions in the data insert into DataSummary (SummaryOrder, SummaryKey, SummaryLabel, SummaryValue, UnformattedNumeric, UnformattedDatetime) values ( 3, 'NumTransactions', 'Transactions', CAST((select count(*) from YOUR_RAW_DATA) AS varchar), (select count(*) from YOUR_RAW_DATA), NULL ); -- The following calculates the earliest transaction in the data insert into DataSummary (SummaryOrder, SummaryKey, SummaryLabel, SummaryValue, UnformattedNumeric, UnformattedDatetime) values ( 4, 'StartDate', 'Earliest Transaction', CAST((select MIN(firstTransaction) from FinFlow) AS varchar), NULL, (select MIN(firstTransaction) from FinFlow) ); -- The following calculates the latest transaction in the data insert into DataSummary (SummaryOrder, SummaryKey, SummaryLabel, SummaryValue, UnformattedNumeric, UnformattedDatetime) values ( 5, 'EndDate', 'Latest Transaction', CAST((select MAX(lastTransaction) from FinFlow) AS varchar), NULL, (select MAX(lastTransaction) from FinFlow) ); -- Other statistics can be entered in a similar fashion.
CREATE TABLE developer ( id INTEGER PRIMARY KEY IDENTITY, name TEXT, skills TEXT, img TEXT ); INSERT INTO developer VALUES (1, 'Simon', '', 'https://pbs.twimg.com/profile_images/858987821394210817/oMccbXv6_bigger.jpg'); INSERT INTO developer VALUES (2, 'Max', '', 'https://pbs.twimg.com/profile_images/953978653624455170/j91_AYfd_400x400.jpg'); INSERT INTO developer VALUES (3, 'Ben', '', 'https://pbs.twimg.com/profile_images/1060037170688417792/vZ7iAWXV_400x400.jpg'); CREATE TABLE product ( id INTEGER PRIMARY KEY IDENTITY, name TEXT, creatorId INTEGER ); INSERT INTO product (id, name, creatorId) VALUES (1, 'Ionic Academy', 1); INSERT INTO product (id, name, creatorId) VALUES (2, 'Software Startup Manual', 1); INSERT INTO product (id, name, creatorId) VALUES (3, 'Ionic Framework', 2); INSERT INTO product (id, name, creatorId) VALUES (4, 'Drifty Co', 2); INSERT INTO product (id, name, creatorId) VALUES (5, 'Drifty Co', 3); INSERT INTO product (id, name, creatorId) VALUES (6, 'Ionicons', 3);
PARAMETERS [@FleteID] Text (255); SELECT A.FleteID, A.ProveedorID, B.RUC, B.RazonSocial, A.ComprobanteID, C.ComprobanteNombre, A.Serie, A.Numero, A.FechaID, Format(A.Monto,"#,##0.00;(#,##0.00)") AS Monto, Format(A.Jabas,"#,##0;(#,##0)") AS Jabas FROM ( (SELECT * FROM TB_Flete WHERE (FleteID=[@FleteID] OR [@FleteID] IS NULL)) AS A LEFT JOIN TB_FleteProveedor AS B ON A.ProveedorID=B.ProveedorID) LEFT JOIN TB_ComprobanteCompra AS C ON A.ComprobanteID=C.ComprobanteID
# TABLE CREATION drop table if exists child; drop table if exists ddate; drop table if exists contract; drop table if exists reservation; drop table if exists users; create table Child ( child_id int primary key auto_increment, cname char(20), age int, user_id int references users(user_id) ); create table ddate( dday date primary key, offday bool ); create table Contract( contract_id int primary key auto_increment, regular bool, child_id int references Child(child_id), startDay date references ddate(dday), startMorning bool, startAfternoon bool, endDay date references ddate(dday), endMorning bool, endAfternoon bool ); create table users( user_id int not null auto_increment, user_name char(45), phone char(15), email char(45) unique, primary key(user_id) ); # # POPULATING USERS # insert into users(user_name, phone, email) values("Duplan", "06 66 66 66", "duplan@email.com"); insert into users(user_name, phone, email) values("Cante", "07 77 77 77", "cante@email.com"); insert into users(user_name, phone, email) values("Segard", "08 88 88 88", "segard@email.com"); insert into users(user_name, phone, email) values("Elkhiati", "09 99 99 99", "elkhiati@email.com"); insert into users(user_name, phone, email) values("Carricajo", "05 55 55 55", "carricajo@email.com"); # # POPULATING CHILD # #Duplan family insert into child(cname, age, user_id) values("Kevin", 12, 1); insert into child(cname, age, user_id) values("Brian", 20, 1); insert into child(cname, age, user_id) values("Brandon", 17, 1); insert into child(cname, age, user_id) values("Mike", 8, 1); #Cante family insert into child(cname, age, user_id) values("Socrate", 22, 2); insert into child(cname, age, user_id) values("Descartes", 11, 2); insert into child(cname, age, user_id) values("Epicure", 25, 2); insert into child(cname, age, user_id) values("Platon", 1, 2); #Segard family insert into child(cname, age, user_id) values("Vojtech", 12, 1); insert into child(cname, age, user_id) values("Martina", 20, 1); insert into child(cname, age, user_id) values("Janek", 13, 1); insert into child(cname, age, user_id) values("Mikulach", 22, 1); #Elkhiati family insert into child(cname, age, user_id) values("Marron", 12, 1); insert into child(cname, age, user_id) values("Jaune", 10, 1); insert into child(cname, age, user_id) values("Vert", 28, 1); insert into child(cname, age, user_id) values("Bleu", 1, 1); #Carricajo family insert into child(cname, age, user_id) values("Juan", 10, 1); insert into child(cname, age, user_id) values("Hernandez", 33, 1); insert into child(cname, age, user_id) values("Iniesta", 50, 1); insert into child(cname, age, user_id) values("Isco", 2, 1); # # POPULATING DDATE (30 days) # insert into ddate values('2018-01-01', FALSE); insert into ddate values('2018-01-02', FALSE); insert into ddate values('2018-01-03', FALSE); insert into ddate values('2018-01-04', FALSE); insert into ddate values('2018-01-05', FALSE); insert into ddate values('2018-01-06', FALSE); insert into ddate values('2018-01-07', FALSE); insert into ddate values('2018-01-08', FALSE); insert into ddate values('2018-01-09', FALSE); insert into ddate values('2018-01-10', FALSE); insert into ddate values('2018-01-11', FALSE); insert into ddate values('2018-01-12', FALSE); insert into ddate values('2018-01-13', FALSE); insert into ddate values('2018-01-14', FALSE); insert into ddate values('2018-01-15', FALSE); insert into ddate values('2018-01-16', FALSE); insert into ddate values('2018-01-17', FALSE); insert into ddate values('2018-01-18', FALSE); insert into ddate values('2018-01-19', FALSE); insert into ddate values('2018-01-20', FALSE); insert into ddate values('2018-01-21', FALSE); insert into ddate values('2018-01-22', FALSE); insert into ddate values('2018-01-23', FALSE); insert into ddate values('2018-01-24', FALSE); insert into ddate values('2018-01-25', FALSE); insert into ddate values('2018-01-26', FALSE); insert into ddate values('2018-01-27', FALSE); insert into ddate values('2018-01-28', FALSE); insert into ddate values('2018-01-29', FALSE); insert into ddate values('2018-01-30', FALSE); # # Populating contracts # insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 1, '2018-01-01', true, true, '2018-01-01', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 2, '2018-01-02', true, true, '2018-01-02', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 3, '2018-01-03', true, true, '2018-01-03', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 4, '2018-01-04', true, true, '2018-01-04', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 5, '2018-01-05', true, true, '2018-01-05', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 6, '2018-01-06', true, true, '2018-01-06', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 7, '2018-01-07', true, true, '2018-01-07', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 8, '2018-01-08', true, true, '2018-01-08', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 9, '2018-01-09', true, true, '2018-01-09', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 10, '2018-01-10', true, true, '2018-01-10', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 11, '2018-01-11', true, true, '2018-01-11', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 12, '2018-01-12', true, true, '2018-01-12', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 13, '2018-01-13', true, true, '2018-01-13', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 14, '2018-01-14', true, true, '2018-01-14', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 15, '2018-01-15', true, true, '2018-01-15', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 16, '2018-01-16', true, true, '2018-01-16', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 17, '2018-01-17', true, true, '2018-01-17', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 18, '2018-01-18', true, true, '2018-01-18', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 19, '2018-01-19', true, true, '2018-01-19', false, false); insert into contract(regular, child_id, startDay, startMorning, startAfternoon, endDay, endMorning, endAfternoon) values(false, 20, '2018-01-20', true, true, '2018-01-20', false, false);
create sequence BURI_TEST_USER_SEQ start with 34 increment by 1;
use bookstore; Select nombre, apellido, usuario from empleado left join usuario on empleado.idempleado = usuario.idempleado; Select email from empleado inner join usuario on empleado.idempleado = usuario.idempleado where usuario.activo = 1; Select Count(autor) as autor from publicacion where autor = 'Eric G. Coronel Castillo'; Select Sum(cantidad) as cantidad from venta inner join empleado on venta.idempleado = empleado.idempleado where empleado.nombre = 'Emilio'; Select * from venta; Select * from empleado;