text stringlengths 6 9.38M |
|---|
# 10. Mostre todos os dados da tabela `purchase_orders`
# em ordem decrescente ordenados por `created_by` em que o `created_by`
# é maior ou igual a 3. E como critério de desempate para a ordenação,
# ordene também os resultados pelo `id` de forma crescente.
SELECT * FROM northwind.purchase_orders
WHERE created_by >= 3 ORDER BY created_by DESC, id ASC;
|
CREATE TABLE Loper (brikkenr INT,
navn VARCHAR(50),
klasse CHAR(10),
klubb VARCHAR(20),
starttid INT,
lopstid INT,
status CHAR(3),
PRIMARY KEY(brikkenr));
CREATE TABLE Reg (sekvnr INT,
brikkenr INT,
postnr INT,
tid INT,
PRIMARY KEY(sekvnr, brikkenr));
CREATE TABLE Loype (lnr INT,
sekvnr INT,
postnr INT,
PRIMARY KEY(lnr, sekvnr));
CREATE TABLE Klasse (klassenavn CHAR(10),
lnr INT,
PRIMARY KEY(klassenavn));
INSERT INTO Loper VALUES (123123, 'Fritz', 'H50', 'Old stars', 0, 0, 'dns'),
(123124, 'Måns', 'H50', 'Old stars', 0, 0, 'dns'),
(123125, 'Olle', 'H50', 'Old stars', 0, 0, 'dns');
INSERT INTO Klasse VALUES ('H50', 1);
INSERT INTO Loype VALUES (1, 0, 0), (1, 1, 31), (1, 2, 32), (1, 3, 33), (1, 4, 34), (1, 5, 35), (1, 6, 36), (1, 7, 37), (1, 8, 150), (1, 9, 175); |
DROP TABLE IF EXISTS `dictionary_history`;
CREATE TABLE IF NOT EXISTS `dictionary_history` (
`NR_SEQUENCE` int(255) NOT NULL AUTO_INCREMENT,
`NR_SEQ_OBJECT` int(255) NOT NULL,
`DS_CONTENT` mediumtext,
`DT_INSERTION` date NOT NULL,
`CD_USER` int(255) NOT NULL,
PRIMARY KEY (`NR_SEQUENCE`),
UNIQUE KEY `nr_sequence_UNIQUE` (`NR_SEQUENCE`),
KEY `DIC_DICHIS_FK_idx` (`NR_SEQ_OBJECT`),
KEY `FK_DICHIST_USER_idx` (`CD_USER`),
CONSTRAINT `FK_DICHIST_USER` FOREIGN KEY (`CD_USER`) REFERENCES `application_user` (`nr_sequence`),
CONSTRAINT `FK_DIC_DICHIST` FOREIGN KEY (`NR_SEQ_OBJECT`) REFERENCES `dictionary` (`nr_sequence`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; |
create proc sp_modify_Beat(@BEATID INT,@ACTIVE INT)
AS
update Beat set Active = @ACTIVE where BeatID = @BEATID
|
create table "users" (
"id" BLOB(16) PRIMARY KEY NOT NULL,
"name" VARCHAR(254) NOT NULL,
"email" VARCHAR(254),
"password" VARCHAR(254) NOT NULL,
"session_token" VARCHAR(254) NOT NULL
);
create unique index "unique_name" on "users" ("name"); |
CREATE PROCEDURE spr_list_trading_margins_brandwise_detail(@BRANDID INT,
@FROMDATE DATETIME,
@TODATE DATETIME)
AS
SELECT Items.Product_Code, "Item Name" = Items.ProductName,
"Trading Margin (%c.)" = (ISNULL(Sum(a.Amount),0)
- Sum(ISNULL(a.PurchasePrice, 0))
- ABS(ISNULL(SUM(a.STPayable), 0))
- ABS(ISNULL(SUM(a.CSTPayable), 0))
- IsNull(Sum(Case Isnull(InvoiceAbstract.TaxOnMRP,0)
When 1 Then
(a.MRP * a.Quantity) * dbo.fn_get_TaxOnMRP(a.TaxSuffered) / 100
Else
(a.PurchasePrice * a.TaxSuffered) / 100
End),0)
- ISNULL((SELECT ISNULL(Sum(InvoiceDetail.Amount),0)
- sum(abs(InvoiceDetail.STPayable))
- sum(InvoiceDetail.PurchasePrice)
- sum(abs(InvoiceDetail.CSTPayable))
- IsNull(Sum(Case Isnull(InvoiceAbstract.TaxOnMRP,0)
When 1 Then
(InvoiceDetail.MRP * InvoiceDetail.Quantity) * dbo.fn_get_TaxOnMRP(InvoiceDetail.TaxSuffered) / 100
Else
(InvoiceDetail.PurchasePrice * InvoiceDetail.TaxSuffered) / 100
End),0)
FROM InvoiceDetail, InvoiceAbstract
WHERE InvoiceDetail.InvoiceID = InvoiceAbstract.InvoiceID
AND (InvoiceAbstract.InvoiceType = 4 Or (InvoiceType = 2 And InvoiceDetail.Quantity < 0))
AND InvoiceAbstract.Status & 128 = 0
AND InvoiceAbstract.InvoiceDate BETWEEN @FROMDATE AND @TODATE
AND InvoiceDetail.Product_Code = Items.Product_Code
GROUP BY InvoiceAbstract.TaxOnMRP), 0))
FROM InvoiceDetail a, InvoiceAbstract, Items
WHERE a.InvoiceID = InvoiceAbstract.InvoiceID
AND InvoiceAbstract.InvoiceType <> 4
AND a.Product_Code = Items.Product_Code
AND a.Quantity > 0
AND InvoiceAbstract.InvoiceDate BETWEEN @FROMDATE AND @TODATE
AND InvoiceAbstract.Status & 128 = 0
AND Items.BrandID = @BRANDID
GROUP BY Items.Product_Code, Items.ProductName
|
CREATE OR REPLACE FUNCTION public.get_follower_publications(follower_last_name character varying, follower_first_name character varying, follower_middle_name character varying)
RETURNS TABLE(publication_name character varying)
LANGUAGE sql
AS $function$
select distinct hp."name"
from home_subscription hs, home_follower hf , home_follower_subscription hfs , home_release hr , home_publication hp
where hfs.follower_id = hf.id and
hfs.subscription_id = hs.id and
hs.release_id = hr.id and
hp.id = hr.publication_id and
(hf.first_name = follower_first_name and hf.last_name = follower_last_name and hf.middle_name = follower_middle_name);
$function$
;
|
create procedure sp_acc_getrefdetails(@NewRefID Int)
as
Select ReferenceNo,Remarks
from ManualJournal where NewRefID = @NewRefID
|
--1) 유공과와 생물과, 식영과 학생을 검색하라
SELECT *
FROM student
WHERE major='유공'
OR major ='생물'
OR major ='식영';
--2) 화학과가 아닌 학생중에 1학년 학생을 검색하라
SELECT *
FROM student
WHERE NOT major='화학'
AND syear =1
ORDER BY sname;
--3) 물리학과 3학년 학생을 검색하라
SELECT *
FROM student
WHERE major='물리'
AND syear =3
ORDER BY sname;
--4) 평점이 2.0에서 3.0사이인 학생을 검색하라
SELECT *
FROM student
WHERE avr BETWEEN 2.0 AND 3.0
ORDER BY avr DESC;
--5) 교수가 지정되지 않은 과목중에 학점이 3학점인 과목을 검색하라
SELECT *
FROM course
WHERE pno IS NULL
AND st_num =3;
--6) 화학과 관련된 과목중 평점이 2학점 이하인 과목을 검색하라
SELECT *
FROM course
WHERE cname LIKE '%화학%'
AND st_num<=2;
--7) 화학과 정교수를 검색하라
SELECT *
FROM professor
WHERE section='화학'
AND orders ='정교수'
ORDER BY pname;
--8) 물리학과 학생중에 성이 사마씨인 학생을 검색하라
SELECT *
FROM student
WHERE major='물리'
AND sname LIKE '사마%';
--9) 부임일이 1995년 이전인 정교수를 검색하라
SELECT *
FROM professor
WHERE hiredate < '1995/01/01'
AND orders='정교수'
ORDER BY hiredate DESC;
--10) 성과 이름이 각각 1글자인 교수를 검색하라
SELECT *
FROM professor
WHERE pname LIKE '__'
ORDER BY pname; |
migrations/2019-12-19-060141_init/up.sql |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Erstellungszeit: 07. Jul 2019 um 22:35
-- Server-Version: 5.7.25
-- PHP-Version: 7.3.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Datenbank: `store`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `categories`
--
CREATE TABLE `categories` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`slug` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Daten für Tabelle `categories`
--
INSERT INTO `categories` (`id`, `name`, `slug`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'test', 'test_slug', '2019-07-07 22:00:00', '2019-07-15 22:00:00', '2019-07-09 22:00:00'),
(2, 'test2', 'test_slug2', '2019-07-07 22:00:00', '2019-07-15 22:00:00', '2019-07-09 22:00:00');
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `orders`
--
CREATE TABLE `orders` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`unit_price` float NOT NULL,
`total` float NOT NULL,
`status` varchar(255) NOT NULL,
`order_no` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `payments`
--
CREATE TABLE `payments` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`order_no` varchar(255) NOT NULL,
`amount` float NOT NULL,
`status` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `products`
--
CREATE TABLE `products` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`price` float NOT NULL,
`description` text NOT NULL,
`category_id` int(11) NOT NULL,
`sub_category_id` int(11) NOT NULL,
`image_path` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `sub_categories`
--
CREATE TABLE `sub_categories` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`slug` varchar(255) NOT NULL,
`category_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`fullname` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`address` text NOT NULL,
`role` varchar(50) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indizes der exportierten Tabellen
--
--
-- Indizes für die Tabelle `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indizes für die Tabelle `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`id`);
--
-- Indizes für die Tabelle `payments`
--
ALTER TABLE `payments`
ADD PRIMARY KEY (`id`);
--
-- Indizes für die Tabelle `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indizes für die Tabelle `sub_categories`
--
ALTER TABLE `sub_categories`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indizes für die Tabelle `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT für exportierte Tabellen
--
--
-- AUTO_INCREMENT für Tabelle `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT für Tabelle `orders`
--
ALTER TABLE `orders`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `payments`
--
ALTER TABLE `payments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `products`
--
ALTER TABLE `products`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `sub_categories`
--
ALTER TABLE `sub_categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT für Tabelle `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
create table member(
mid varchar2(30) primary key,
mpw varchar2(20) not null,
mname varchar2(20) not null unique,
mprofile varchar2(300),
mtel varchar2(20),
maddr1 varchar2(200),
maddr2 varchar2(200),
gender varchar2(5),
agegroup varchar2(5),
rdate varchar2(20)
) |
use bakalaurinis;
CREATE TABLE Users(
Id CHAR(38) NOT NULL,
FirstName VARCHAR(128) NULL,
LastName VARCHAR(128) NULL,
UserName VARCHAR(64) NOT NULL,
NormalizedUserName VARCHAR(64) NOT NULL,
Email VARCHAR(64) NOT NULL,
NormalizedEmail VARCHAR(64) NOT NULL,
EmailConfirmed bit NOT NULL,
PasswordHash VARCHAR(128) NULL,
PhoneNumber VARCHAR(32) NULL,
PhoneNumberConfirmed bit NOT NULL,
PhotoUrl VARCHAR(128) NULL,
Address VARCHAR(256) NULL,
ConcurrencyStamp VARCHAR(128) NULL,
SecurityStamp VARCHAR(128) NULL,
RegistrationDate datetime NULL,
LastLoginDate datetime NULL,
LockoutEnabled bit NOT NULL,
LockoutEndDateTimeUtc datetime NULL,
TwoFactorEnabled bit NOT NULL,
AccessFailedCount int NOT NULL,
CONSTRAINT PK_IdentityUser PRIMARY KEY (Id)
);
CREATE VIEW GetTotalNumberOfUsers
AS
SELECT COUNT(*) AS TotalNumberOfUsers
FROM Users;
CREATE TABLE Roles(
Id CHAR(38) NOT NULL,
Name VARCHAR(32) NOT NULL,
NormalizedName VARCHAR(32) NOT NULL,
ConcurrencyStamp VARCHAR(128) NULL,
CONSTRAINT PK_Roles PRIMARY KEY (Id)
);
CREATE TABLE UsersClaims(
Id CHAR(38) NOT NULL,
UserId CHAR(38) NOT NULL,
ClaimType VARCHAR(65) NOT NULL,
ClaimValue VARCHAR(65) NOT NULL,
CONSTRAINT PK_UsersClaims PRIMARY KEY (Id)
);
CREATE TABLE UsersLogins(
LoginProvider VARCHAR(32) NOT NULL,
ProviderKey VARCHAR(64) NOT NULL,
UserId CHAR(38) NOT NULL,
ProviderDisplayName VARCHAR(32) NOT NULL,
CONSTRAINT PK_UsersLogins PRIMARY KEY (LoginProvider, ProviderKey)
);
CREATE TABLE UsersRoles(
UserId CHAR(38) NOT NULL,
RoleId CHAR(38) NOT NULL,
CONSTRAINT PK_UsersRoles PRIMARY KEY (UserId, RoleId)
);
ALTER TABLE Users MODIFY COLUMN EmailConfirmed bit NOT NULL DEFAULT 0;
ALTER TABLE Users MODIFY COLUMN PhoneNumberConfirmed bit NOT NULL DEFAULT 0;
ALTER TABLE Users MODIFY COLUMN LockoutEnabled bit NOT NULL DEFAULT 0;
ALTER TABLE Users MODIFY COLUMN TwoFactorEnabled bit NOT NULL DEFAULT 0;
ALTER TABLE Users MODIFY COLUMN AccessFailedCount int NOT NULL DEFAULT 0;
ALTER TABLE UsersClaims ADD CONSTRAINT FK_UsersClaims_Users FOREIGN KEY(UserId) REFERENCES Users(Id)
ON UPDATE CASCADE
ON DELETE CASCADE;
ALTER TABLE UsersLogins ADD CONSTRAINT FK_UsersLogins_Users FOREIGN KEY(UserId)
REFERENCES Users (Id)
ON UPDATE CASCADE
ON DELETE CASCADE;
ALTER TABLE UsersRoles ADD CONSTRAINT FK_UsersRoles_Roles FOREIGN KEY(RoleId)
REFERENCES Roles (Id)
ON UPDATE CASCADE
ON DELETE CASCADE;
ALTER TABLE UsersRoles ADD CONSTRAINT FK_UsersRoles_Users FOREIGN KEY(UserId)
REFERENCES Users (Id)
ON UPDATE CASCADE
ON DELETE CASCADE;
INSERT INTO Roles(Id, Name, NormalizedName, ConcurrencyStamp) VALUES ('642A2EBD-1B2F-4321-B294-028C3A27E0A2', 'User', 'USER', '1FE5B345-A5E0-496E-8956-B48D21AA37CC');
INSERT INTO Roles(Id, Name, NormalizedName, ConcurrencyStamp) VALUES ('D2A35AEC-402A-4BE6-9D7F-682C0B5D3FEF', 'Administrator', 'ADMINISTRATOR', 'BD480BB1-7D73-4393-AA09-51B11AAC949E');
INSERT INTO Users (Id, FirstName, LastName, UserName, NormalizedUserName, Email, NormalizedEmail, EmailConfirmed, PasswordHash, PhoneNumber, PhoneNumberConfirmed, PhotoUrl, Address, ConcurrencyStamp, SecurityStamp, RegistrationDate, LastLoginDate, LockoutEnabled, LockoutEndDateTimeUtc, TwoFactorEnabled, AccessFailedCount) VALUES ('810BAD28-CED4-427A-9A88-5A17682304DA', 'Tomas', 'Valiunas', 'admin@dadmin.com', 'ADMIN@ADMIN.com', 'admin@admin.com', 'ADMIN@ADMIN.com', 1, 'AQAAAAEAACcQAAAAEFKjcOnLHrAhew3z9YUjO/vGiExMDrNi54ZyUKACsW8rn1vDTleOUvJeNoEG3JU4fQ==', '+306981908600', 1, NULL, 'Kyprou 14, Agia Varvara', '70C14A94-36D7-4CF7-973E-0425742980A8', 'A1991EC9-C0F3-40A5-8457-61032D13B1CD', '2018-04-08', NULL, 0, NULL, 0, 0);
INSERT INTO UsersRoles (UserId, RoleId) VALUES ('810BAD28-CED4-427A-9A88-5A17682304DA', '642A2EBD-1B2F-4321-B294-028C3A27E0A2');
INSERT INTO UsersRoles (UserId, RoleId) VALUES ('810BAD28-CED4-427A-9A88-5A17682304DA', 'D2A35AEC-402A-4BE6-9D7F-682C0B5D3FEF');
CREATE TABLE Category (Id int(10) NOT NULL AUTO_INCREMENT, Name varchar(255) NOT NULL, Description varchar(512), PRIMARY KEY (Id));
CREATE TABLE Category_Problem (CategoryId int(10) NOT NULL, ProblemId int(10) NOT NULL, PRIMARY KEY (CategoryId, ProblemId));
CREATE TABLE Comment (Id int(10) NOT NULL AUTO_INCREMENT, Text varchar(5000) NOT NULL, UserId CHAR(38) NOT NULL, ProblemId int(10) NOT NULL, PRIMARY KEY (Id));
CREATE TABLE InternetUser (Id int(10) NOT NULL AUTO_INCREMENT, FirstName varchar(255) NOT NULL, LastName varchar(255) NOT NULL, Description varchar(512), Location varchar(255), IpAddress varchar(255), PRIMARY KEY (Id));
CREATE TABLE InternetUserDevice (Id int(10) NOT NULL AUTO_INCREMENT, Name varchar(255) NOT NULL, Manufacturer varchar(255), MacAddress varchar(255), WarrantyExpiration date, Description varchar(512), InternetUserId int(10) NOT NULL, PRIMARY KEY (Id));
CREATE TABLE Problem (Id int(10) NOT NULL AUTO_INCREMENT, Name varchar(255) NOT NULL, Description varchar(9000) NOT NULL, Location varchar(512), Created datetime NOT NULL, AssignedUser CHAR(38), StatusId int(10) NOT NULL, InternetUserId int(10), CONSTRAINT Id PRIMARY KEY (Id));
CREATE TABLE Problem_Tag (TagId int(10) NOT NULL, ProblemId int(10) NOT NULL, PRIMARY KEY (TagId, ProblemId));
CREATE TABLE Status (Id int(10) NOT NULL AUTO_INCREMENT, Name varchar(50) NOT NULL, PRIMARY KEY (Id));
CREATE TABLE `Tag` (Id int(10) NOT NULL AUTO_INCREMENT, Name varchar(50) NOT NULL, PRIMARY KEY (Id));
CREATE TABLE TimeSpent (Id int(10) NOT NULL AUTO_INCREMENT, HoursSpent decimal(2, 0) DEFAULT 0 NOT NULL, Description varchar(512), DateRecorded timestamp DEFAULT NOW() NOT NULL, UserId CHAR(38) NOT NULL, ProblemId int(10) NOT NULL, PRIMARY KEY (Id));
ALTER TABLE Problem ADD CONSTRAINT FKProblem611514 FOREIGN KEY (AssignedUser) REFERENCES `Users` (Id);
ALTER TABLE Comment ADD CONSTRAINT FKComment537324 FOREIGN KEY (UserId) REFERENCES `Users` (Id);
ALTER TABLE Comment ADD CONSTRAINT FKComment818660 FOREIGN KEY (ProblemId) REFERENCES Problem (Id);
ALTER TABLE Problem_Tag ADD CONSTRAINT FKProblem_Ta147632 FOREIGN KEY (ProblemId) REFERENCES Problem (Id);
ALTER TABLE Problem_Tag ADD CONSTRAINT FKProblem_Ta741275 FOREIGN KEY (TagId) REFERENCES `Tag` (Id);
ALTER TABLE TimeSpent ADD CONSTRAINT FKTimeSpent911204 FOREIGN KEY (UserId) REFERENCES `Users` (Id);
ALTER TABLE TimeSpent ADD CONSTRAINT FKTimeSpent807458 FOREIGN KEY (ProblemId) REFERENCES Problem (Id);
ALTER TABLE Category_Problem ADD CONSTRAINT FKCategory_P899810 FOREIGN KEY (CategoryId) REFERENCES Category (Id);
ALTER TABLE Category_Problem ADD CONSTRAINT FKCategory_P650586 FOREIGN KEY (ProblemId) REFERENCES Problem (Id);
ALTER TABLE Problem ADD CONSTRAINT FKProblem836090 FOREIGN KEY (StatusId) REFERENCES Status (Id);
ALTER TABLE Problem ADD CONSTRAINT FKProblem951214 FOREIGN KEY (InternetUserId) REFERENCES InternetUser (Id);
ALTER TABLE InternetUserDevice ADD CONSTRAINT FKInternetUs985626 FOREIGN KEY (InternetUserId) REFERENCES InternetUser (Id);
alter table problem ADD FULLTEXT INDEX (Name,Description,Location);
ALTER TABLE `bakalaurinis`.`internetuser`
ADD COLUMN `InternetPlan` VARCHAR(255) NULL DEFAULT NULL AFTER `IpAddress`,
ADD COLUMN `Created` DATE NULL DEFAULT NOW() AFTER `InternetPlan`;
ALTER TABLE `bakalaurinis`.`internetuser`
CHANGE COLUMN `Description` `Description` NVARCHAR(512) NULL DEFAULT NULL ;
ALTER TABLE `bakalaurinis`.`timespent`
CHANGE COLUMN `Description` `Description` NVARCHAR(512) NULL DEFAULT NULL ;
ALTER TABLE `bakalaurinis`.`users`
CHANGE COLUMN `Address` `Address` NVARCHAR(256) NULL DEFAULT NULL ;
ALTER TABLE `bakalaurinis`.`internetuser`
CHANGE COLUMN `FirstName` `FirstName` NVARCHAR(255) NOT NULL ,
CHANGE COLUMN `LastName` `LastName` NVARCHAR(255) NOT NULL ;
ALTER TABLE `bakalaurinis`.`problem`
CHANGE COLUMN `Name` `Name` NVARCHAR(255) NOT NULL ,
CHANGE COLUMN `Description` `Description` NVARCHAR(9000) NOT NULL ,
CHANGE COLUMN `Location` `Location` NVARCHAR(512) NULL DEFAULT NULL ;
ALTER TABLE `bakalaurinis`.`category`
CHANGE COLUMN `Name` `Name` NVARCHAR(255) NOT NULL ,
CHANGE COLUMN `Description` `Description` NVARCHAR(512) NULL DEFAULT NULL ;
CREATE TABLE `bakalaurinis`.`ping_results` (
`id` INT NOT NULL AUTO_INCREMENT,
`internetUserId` INT NOT NULL,
`ipAddress` VARCHAR(255) NOT NULL,
`time` BIGINT NULL,
`recorded` DATETIME NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
CONSTRAINT `fk_ping_internetuser`
FOREIGN KEY (`internetUserId`)
REFERENCES `bakalaurinis`.`internetuser` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
ALTER TABLE `bakalaurinis`.`internetuser`
CHANGE COLUMN `Location` `Location` NVARCHAR(255) NULL DEFAULT NULL ;
ALTER TABLE `bakalaurinis`.`ping_results`
ADD COLUMN `status` VARCHAR(45) NOT NULL AFTER `recorded`;
CREATE TABLE `bakalaurinis`.`current_user_coordinates` (
`id` INT NOT NULL AUTO_INCREMENT,
`user_id` CHAR(38) NOT NULL,
`lat` FLOAT(10,6) NOT NULL,
`lng` FLOAT(10,6) NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_coordinates_user_idx` (`user_id` ASC),
CONSTRAINT `fk_coordinates_user`
FOREIGN KEY (`user_id`)
REFERENCES `bakalaurinis`.`users` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
ALTER TABLE `bakalaurinis`.`current_user_coordinates`
ADD COLUMN `modifyDate` DATETIME NOT NULL AFTER `lng`;
ALTER TABLE `bakalaurinis`.`current_user_coordinates`
ADD UNIQUE INDEX `user_id_UNIQUE` (`user_id` ASC);
ALTER TABLE `bakalaurinis`.`internetuser`
CHANGE COLUMN `IpAddress` `IpAddress` NVARCHAR(255) NULL DEFAULT NULL ;
alter table internetuser ADD FULLTEXT INDEX (FirstName,LastName, Location,IpAddress);
ALTER TABLE `bakalaurinis`.`internetuser`
ADD COLUMN `ContractId` INT NULL AFTER `Created`;
ALTER TABLE `bakalaurinis`.`internetuser`
ADD COLUMN `StatusId` INT NOT NULL DEFAULT 1 AFTER `ContractId`;
ALTER TABLE `bakalaurinis`.`internetuserdevice`
DROP FOREIGN KEY `FKInternetUs985626`;
ALTER TABLE `bakalaurinis`.`internetuserdevice`
CHANGE COLUMN `InternetUserId` `InternetUserId` INT(10) NULL ;
ALTER TABLE `bakalaurinis`.`internetuserdevice`
ADD CONSTRAINT `FKInternetUs985626`
FOREIGN KEY (`InternetUserId`)
REFERENCES `bakalaurinis`.`internetuser` (`Id`);
|
USE TurnosImg;
CREATE TABLE turnos (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
nombre TEXT NOT NULL,
email TEXT NOT NULL,
tel TEXT NOT NULL,
edad INTEGER,
talla FLOAT,
altura FLOAT,
nacimiento TIMESTAMP NOT NULL,
cpelo TEXT,
fechaturno TIMESTAMP NOT NULL,
horaturno TEXT NOT NULL,
diagnostico longblob,
extension TEXT
);
|
CREATE Procedure sp_acc_con_insert_receivedAccountdata(
@CompanyID nVarchar(15),
@Date DateTime,
@AccountID Int,
@AccountName nVarchar (120),
@AccountGroupID Int,
@OpeningBalance Decimal(18,2),
@ClosingBalance Decimal(18,2),
@Depreciation Decimal(18,2),
@Fixed Int)
As
Set @Date=dbo.StripDateFromTime(@Date)
If Not Exists(Select Top 1 AccountID from ReceiveAccount Where CompanyID=@CompanyID and Date=@Date and AccountID=@AccountID)
Begin
Insert Into ReceiveAccount Values(@CompanyID,
@Date,
@AccountID,
@AccountName,
@AccountGroupID,
@OpeningBalance,
@ClosingBalance,
@Depreciation,
@Fixed)
End
Else
Begin
Update ReceiveAccount Set AccountGroupID=@AccountGroupID,
OpeningBalance=@OpeningBalance,
ClosingBalance=@ClosingBalance,
Depreciation=@Depreciation,
Fixed=@Fixed
Where CompanyID=@CompanyID and Date=@Date and AccountID=@AccountID
End
|
--修改日期:20121015
--修改人:祁继鸿
--修改内容:增加录入付款单帐号透支时参数
--参数设置:
insert into bt_param (CODE, SYS_CODE, NAME, PARAM_VALUE1, PARAM_VALUE2, PARAM_VALUE3, PARAM_TYPE, RMK, REVERSE1, REVERSE2, REVERSE3, REVERSE4, REVERSE5, REVERSE6, REVERSE7, REVERSE8, REVERSE9, REVERSE10)
values ('account_overdraft', 'nis', '录入付款单帐号透支时', '0', null, null, '0', '0,只提醒不控制;1,控制', '0,只提醒不控制;1,控制', '', '', '', '', 1.00, 35.00, null, null, null);
commit;
|
insert into user values(1, 'bruce.dickinson', 'bruce.dickinson');
insert into cars(id, name, giphy_url) values (1, 'Sandero', 'top-gear-james-may-MwAwJp223HQaI');
insert into cars(id, name, giphy_url) values (2, 'Fox', 'foxes-Kt3lpGbEkM8i4');
insert into cars(id, name, giphy_url) values (3, 'Gol', 'univisiondeportes-chile-ca2016-copa-america-centenario-26BRN3E8QvX3xabhm');
insert into cars(id, name, giphy_url) values (4, 'Uno', 'studiosoriginals-numbers-gilphabet-l0ExncehJzexFpRHq');
insert into cars(id, name, giphy_url) values (5, 'Veloster', 'pubsa-j0PJisEbmAybKM0RyN');
insert into cars(id, name, giphy_url) values (6, 'Classic', 'classic-brando-marlon-13cwA6tNZHQ4rS');
insert into cars(id, name, giphy_url) values (7, 'L200', 'mundomit-mitsubishi-l200-xUNd9zZAgp8kEBCi6A'); |
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50540
Source Host : localhost:3306
Source Database : commerce
Target Server Type : MYSQL
Target Server Version : 50540
File Encoding : 65001
Date: 2016-03-07 11:51:57
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `admin`
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`id` mediumint(6) unsigned NOT NULL AUTO_INCREMENT,
`uname` varchar(40) NOT NULL COMMENT '用户名',
`pwd` char(32) NOT NULL COMMENT '密码',
`status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '用户状态 0 :正常 1:删除 可扩展',
`created` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间´',
`updated` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间´',
`permission` int(11) DEFAULT '0' COMMENT '权限编码',
`nick` varchar(30) DEFAULT NULL COMMENT '真实姓名',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of admin
-- ----------------------------
INSERT INTO `admin` VALUES ('2', 'admin', '85022fc9f722fa2c8e3bec4643a1a34f', '0', '0', '1457320537', '1', '');
-- ----------------------------
-- Table structure for `admin_permission`
-- ----------------------------
DROP TABLE IF EXISTS `admin_permission`;
CREATE TABLE `admin_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '索引',
`rolename` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`rolecode` varchar(2048) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '管理员管理的模块代码',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of admin_permission
-- ----------------------------
INSERT INTO `admin_permission` VALUES ('1', '超级管理员', 'all');
INSERT INTO `admin_permission` VALUES ('2', '查看', null);
-- ----------------------------
-- Table structure for `admin_power`
-- ----------------------------
DROP TABLE IF EXISTS `admin_power`;
CREATE TABLE `admin_power` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(30) NOT NULL COMMENT '权限名',
`pid` int(11) NOT NULL COMMENT '外键',
`module_name` varchar(128) NOT NULL COMMENT '当前模块名',
`action_name` varchar(128) NOT NULL COMMENT '当前操作名',
`isshow` tinyint(1) NOT NULL DEFAULT '1' COMMENT '标识',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='权限表';
-- ----------------------------
-- Records of admin_power
-- ----------------------------
INSERT INTO `admin_power` VALUES ('1', '广告管理', '0', 'banners', '', '1');
INSERT INTO `admin_power` VALUES ('2', '新增广告', '1', 'banners', 'add', '1');
INSERT INTO `admin_power` VALUES ('3', '修改广告', '1', 'banners', 'get|edit', '1');
INSERT INTO `admin_power` VALUES ('4', '删除广告', '1', 'banners', 'del', '1');
INSERT INTO `admin_power` VALUES ('5', '广告列表', '1', 'banners', 'index', '1');
INSERT INTO `admin_power` VALUES ('6', '修改密码', '0', 'auth', 'auth_pwd', '1');
INSERT INTO `admin_power` VALUES ('7', '用户管理', '0', 'user', '', '1');
INSERT INTO `admin_power` VALUES ('8', '用户列表', '7', 'user', 'index', '1');
INSERT INTO `admin_power` VALUES ('9', '重置密码', '7', 'user', 'reset_pwd', '1');
INSERT INTO `admin_power` VALUES ('10', '关闭账号', '7', 'user', 'close', '1');
INSERT INTO `admin_power` VALUES ('11', 'IP剧管理', '0', 'story', '', '1');
INSERT INTO `admin_power` VALUES ('12', 'IP剧列表', '11', 'story', 'index', '1');
INSERT INTO `admin_power` VALUES ('13', 'IP剧删除', '11', 'story', 'del', '1');
INSERT INTO `admin_power` VALUES ('14', 'IP剧分类列表', '11', 'story', 'category', '1');
INSERT INTO `admin_power` VALUES ('15', 'IP剧添加', '11', 'story', 'add', '1');
INSERT INTO `admin_power` VALUES ('16', 'IP剧修改', '11', 'story', 'get|edit', '1');
-- ----------------------------
-- Table structure for `banners`
-- ----------------------------
DROP TABLE IF EXISTS `banners`;
CREATE TABLE `banners` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`story_id` int(11) DEFAULT NULL COMMENT '对应story表ID',
`image` varchar(100) DEFAULT NULL COMMENT '图片',
`title` varchar(100) DEFAULT NULL COMMENT '图片说明',
`url` varchar(1000) DEFAULT NULL COMMENT '网址',
`format` int(11) DEFAULT NULL COMMENT '0剧,1网站链接',
`sort` int(11) DEFAULT '0' COMMENT '排序',
`status` tinyint(2) DEFAULT '0' COMMENT '0正常,1删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of banners
-- ----------------------------
INSERT INTO `banners` VALUES ('1', '0', 'http://cosimage.b0.upaiyun.com/commerce/banner/20160301/1456817789.png', '语戏商务端上线了', 'https://www.baidu.com', '1', '1', '0');
INSERT INTO `banners` VALUES ('2', '0', 'http://cosimage.b0.upaiyun.com/commerce/banner/20160301/1456819643.png', '222', 'https://www.baidu.com', '1', '2', '0');
-- ----------------------------
-- Table structure for `story`
-- ----------------------------
DROP TABLE IF EXISTS `story`;
CREATE TABLE `story` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(512) DEFAULT NULL COMMENT '剧名称',
`image` varchar(200) DEFAULT NULL COMMENT '图片',
`category` varchar(128) DEFAULT NULL COMMENT '分类,分隔',
`status` tinyint(1) DEFAULT '0' COMMENT '0上架1删除2已售',
`buy_user_id` int(11) DEFAULT NULL COMMENT '购买方',
`buy_time` int(11) DEFAULT NULL COMMENT '购买时间',
`intro` varchar(512) DEFAULT NULL COMMENT '简介',
`created` int(11) DEFAULT NULL COMMENT '创建时间',
`updated` int(11) DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of story
-- ----------------------------
INSERT INTO `story` VALUES ('1', '222', '', '1,4', '2', '1', '111111', '1111', null, '1457068524');
INSERT INTO `story` VALUES ('2', '', '', '3', '0', null, null, '1', null, '1457068151');
INSERT INTO `story` VALUES ('3', '222222', '', '2,3,9', '1', null, null, '222', null, '1457068552');
INSERT INTO `story` VALUES ('4', '66666666', 'http://cosimage.b0.upaiyun.com/commerce/story/20160304/1457068240.png', '4,10', '0', null, null, '简介简介简介简介简介简介简介简介简介简介简介简介简介简介简介', '1457000436', '1457068250');
INSERT INTO `story` VALUES ('5', '22222222', '', null, '0', null, null, '1111111111111', '1457000574', '1457000574');
INSERT INTO `story` VALUES ('6', '4444444444', 'http://cosimage.b0.upaiyun.com/commerce/banner/20160303/1457001110.png', '2,4,9', '0', null, null, '44444444444444', '1457001284', '1457001284');
-- ----------------------------
-- Table structure for `story_category`
-- ----------------------------
DROP TABLE IF EXISTS `story_category`;
CREATE TABLE `story_category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) DEFAULT NULL COMMENT '分类',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='剧分类';
-- ----------------------------
-- Records of story_category
-- ----------------------------
INSERT INTO `story_category` VALUES ('1', '剧情');
INSERT INTO `story_category` VALUES ('2', '恐怖');
INSERT INTO `story_category` VALUES ('3', '科幻');
INSERT INTO `story_category` VALUES ('4', '悬疑');
INSERT INTO `story_category` VALUES ('5', '动作');
INSERT INTO `story_category` VALUES ('6', '都市');
INSERT INTO `story_category` VALUES ('7', '竞技');
INSERT INTO `story_category` VALUES ('8', '玄幻');
INSERT INTO `story_category` VALUES ('9', '古风');
INSERT INTO `story_category` VALUES ('10', '后宫');
-- ----------------------------
-- Table structure for `story_message`
-- ----------------------------
DROP TABLE IF EXISTS `story_message`;
CREATE TABLE `story_message` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`content` text COMMENT '内容',
`status` tinyint(2) DEFAULT '0' COMMENT '0正常1删除',
`msg` varchar(4) DEFAULT NULL COMMENT '戏文排序id',
`created` int(11) DEFAULT NULL,
`updated` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='剧内容';
-- ----------------------------
-- Records of story_message
-- ----------------------------
-- ----------------------------
-- Table structure for `story_read`
-- ----------------------------
DROP TABLE IF EXISTS `story_read`;
CREATE TABLE `story_read` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`story_id` int(11) DEFAULT NULL COMMENT '对应story表ID',
`user_id` int(11) DEFAULT NULL COMMENT '对应user表ID',
`created` int(11) DEFAULT NULL,
`status` tinyint(1) DEFAULT '0' COMMENT '0正常1删除',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='浏览历史表';
-- ----------------------------
-- Records of story_read
-- ----------------------------
-- ----------------------------
-- Table structure for `story_want`
-- ----------------------------
DROP TABLE IF EXISTS `story_want`;
CREATE TABLE `story_want` (
`id` int(11) NOT NULL DEFAULT '0',
`story_id` int(11) DEFAULT NULL COMMENT '剧id',
`application_no` char(12) DEFAULT NULL COMMENT '申请编号(提交日期,后四位为当天顺序编号)',
`order_state` tinyint(2) DEFAULT NULL COMMENT '1、等待提交方案中2、方案已提交,审核中3、合作成功4、合作未成功,亲下次再来哦',
`story_state` tinyint(2) DEFAULT NULL COMMENT '1、排队中2、已重新上架,等待竞选',
`created` int(11) DEFAULT NULL COMMENT '提交时间',
`status` tinyint(1) DEFAULT '0' COMMENT '0正常1删除',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='我想要的剧';
-- ----------------------------
-- Records of story_want
-- ----------------------------
-- ----------------------------
-- Table structure for `suggestion`
-- ----------------------------
DROP TABLE IF EXISTS `suggestion`;
CREATE TABLE `suggestion` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '对应用户表ID',
`content` varchar(1024) DEFAULT NULL COMMENT '反馈的内容',
`is_deal` tinyint(2) DEFAULT '0' COMMENT '是否处理0未处理,1已处理',
`created` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='用户意见反馈表';
-- ----------------------------
-- Records of suggestion
-- ----------------------------
-- ----------------------------
-- Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`salt` char(4) DEFAULT NULL COMMENT '盐',
`password` char(32) DEFAULT NULL,
`image` varchar(255) DEFAULT NULL COMMENT '头像',
`name` varchar(64) DEFAULT NULL COMMENT '名称',
`email` varchar(50) DEFAULT NULL COMMENT '邮箱',
`phone` varchar(50) DEFAULT NULL COMMENT '电话',
`status` tinyint(1) DEFAULT '0' COMMENT '0正常1删除2关闭账号',
`created` int(11) DEFAULT NULL,
`updated` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='用户表';
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', '2222', 'ec340797adedf76174c84d32fd88b4be', 'http://cosimage.b0.upaiyun.com/commerce/banner/20160301/1456817789.png', '44', '4@qq.com', '010-22', '2', '1456789890', '1456789890');
INSERT INTO `user` VALUES ('2', '3333', null, 'http://cosimage.b0.upaiyun.com/commerce/banner/20160301/1456817789.png', '44', '44@qq.com', '010-1231', '0', '1456787890', '1456787890');
|
--- Author: Francisco Munoz Alvarez
--- Date : 20/07/2013
--- Script: redo_current_status.sql
--- Description: Shows some very important information regarding
--- redo log files. The script reports on threads, number of
--- membes per group, whether a group was archived or not, size,
--- and SCN#
column first_change# format 999,999,999 heading Change#
column group# format 9,999 heading Grp#
column thread# format 999 heading Th#
column sequence# format 999,999 heading Seq#
column members format 999 heading Mem
column archived format a4 heading Arc?
column first_time format a25 heading First|Time
break on thread#
set pages 100 lines 132 feedback off
ttitle CENTER 'Current Redo Log Status'
spool log_stat.txt
SELECT thread#, group#, sequence#,
bytes, members,archived,status,first_change#,
to_char(first_time,'dd-mon-yyyy hh24:mi') first_time
FROM sys.v_$log
ORDER BY thread#, group#;
spool off
clear breaks
clear columns
ttitle off
|
USE BKEL;
CREATE TABLE IF NOT EXISTS TEXTBOOK (
Isbn DECIMAL(13,0) NOT NULL,
Title VARCHAR(255) NOT NULL,
Field VARCHAR(255),
PRIMARY KEY (Isbn)
);
LOAD DATA INFILE '/mnt/DAE242A5E242862B/Code/db/Excel/textbook.csv'
INTO TABLE TEXTBOOK
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(Isbn, Title, Field); |
/*
Check vacuum running status
*/
SELECT relname,
last_vacuum,
last_autovacuum
FROM pg_stat_user_tables; |
DROP TABLE IF EXISTS `relationships`;
CREATE TABLE `relationships` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(50),
`description` TEXT,
`type` VARCHAR(50),
`createdat` DATETIME,
`updatedat` DATETIME,
`deletedat` DATETIME
);
INSERT INTO `relationships` ( `name`,`description`,`type` ) VALUES ( 'Primary','Phone student can be contacted at.','phone' );
INSERT INTO `relationships` ( `name`,`description`,`type` ) VALUES ( 'cell','Students Cell.','phone' );
INSERT INTO `relationships` ( `name`,`description`,`type` ) VALUES ( 'Home','Students Home.','phone' );
INSERT INTO `relationships` ( `name`,`description`,`type` ) VALUES ( 'Primary','Email student can be contacted at.','email' );
INSERT INTO `relationships` ( `name`,`description`,`type` ) VALUES ( 'Primary','Address student can be contacted at.','address' );
|
CREATE TABLE `ding_task` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(60) COLLATE utf8mb4_bin NOT NULL COMMENT '任务名称',
`start_at` time NOT NULL COMMENT '开始时间',
`end_at` time NOT NULL COMMENT '结束时间',
`max_count` int(11) NOT NULL COMMENT '人数上限',
`repeat_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '重复类型,1: 一次; 2: 工作日; 3: 每周五;',
`enabled` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否启用,0: 否; 1: 是;',
`apply_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '报名状态,1: 未开始; 2: 进行中; 3: 已结束; 4: 已停止;',
`manager_id` int(10) unsigned NOT NULL COMMENT '管理人员 ID',
`description` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '报名描述',
`ding_webhook` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '钉钉 webhook 地址',
`notice_type` varchar(60) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '提醒类型(多选,逗号分隔),1:开始时;2:结束时;3:有报名时;4:整点;11:通知所有人;',
`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除,0: 否; 1: 是;',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`created_by` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建人',
`updated_by` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新人',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='钉钉报名任务表';
CREATE TABLE `ding_task_apply` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ding_task_id` int(10) unsigned NOT NULL COMMENT '关联的钉钉报名任务 ID',
`ding_task_name` varchar(60) COLLATE utf8mb4_bin NOT NULL COMMENT '关联的钉钉报名任务名称',
`apply_date` date NOT NULL COMMENT '报名日期',
`completed` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否完成,0: 否; 1: 是;',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_ding_task_id_apply_date` (`ding_task_id`,`apply_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='钉钉报名任务申请表';
CREATE TABLE `ding_task_apply_staff` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ding_task_apply_id` int(10) unsigned NOT NULL COMMENT '关联的钉钉报名任务申请 ID',
`staff_id` int(10) unsigned NOT NULL COMMENT '申请人 ID',
`remark` varchar(60) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注',
`cancelled` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否取消,0: 否; 1: 是;',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_ding_task_apply_id_staff_id` (`ding_task_apply_id`,`staff_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='钉钉报名任务申请人员表'; |
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema orderbook
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `orderbook` ;
-- -----------------------------------------------------
-- Schema orderbook
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `orderbook` DEFAULT CHARACTER SET utf8 ;
USE `orderbook` ;
-- -----------------------------------------------------
-- Table `orderbook`.`stock`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `orderbook`.`stock` ;
CREATE TABLE IF NOT EXISTS `orderbook`.`stock` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`symbol` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `name_UNIQUE` (`name` ASC) VISIBLE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `orderbook`.`stock_order`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `orderbook`.`stock_order` ;
CREATE TABLE IF NOT EXISTS `orderbook`.`stock_order` (
`id` INT NOT NULL AUTO_INCREMENT,
`side` ENUM('SELL', 'BUY') NOT NULL,
`status` ENUM('COMPLETED', 'IN-PROGRESS', 'CANCELLED') NOT NULL,
`stock_id` INT NOT NULL,
`quantity` INT NOT NULL,
`datetime` TIMESTAMP NOT NULL,
`price` DECIMAL(10,2) NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_order_stock1_idx` (`stock_id` ASC) VISIBLE,
CONSTRAINT `fk_order_stock1`
FOREIGN KEY (`stock_id`)
REFERENCES `orderbook`.`stock` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `orderbook`.`trade`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `orderbook`.`trade` ;
CREATE TABLE IF NOT EXISTS `orderbook`.`trade` (
`id` INT NOT NULL AUTO_INCREMENT,
`datetime` TIMESTAMP NOT NULL,
`quantity` INT NOT NULL,
`price` DECIMAL(10,2) NOT NULL,
`buy_order_id` INT NOT NULL,
`sell_order_id` INT NOT NULL,
`stock_id` INT NOT NULL,
PRIMARY KEY (`id`, `buy_order_id`, `sell_order_id`),
INDEX `fk_trade_stock_order1_idx` (`buy_order_id` ASC) VISIBLE,
INDEX `fk_trade_stock_order2_idx` (`sell_order_id` ASC) VISIBLE,
INDEX `fk_trade_stock1_idx` (`stock_id` ASC) VISIBLE,
CONSTRAINT `fk_trade_stock_order1`
FOREIGN KEY (`buy_order_id`)
REFERENCES `orderbook`.`stock_order` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_trade_stock_order2`
FOREIGN KEY (`sell_order_id`)
REFERENCES `orderbook`.`stock_order` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_trade_stock1`
FOREIGN KEY (`stock_id`)
REFERENCES `orderbook`.`stock` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `orderbook`.`order_transaction`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `orderbook`.`order_transaction` ;
CREATE TABLE IF NOT EXISTS `orderbook`.`order_transaction` (
`id` INT NOT NULL AUTO_INCREMENT,
`quantity` INT NOT NULL,
`datetime` TIMESTAMP NOT NULL,
`transactiontype` ENUM('CREATED', 'FULFILLED', 'PARTIALLY-FULFILLED', 'CANCELLED') NOT NULL,
`stock_order_id` INT NOT NULL,
PRIMARY KEY (`id`, `stock_order_id`),
INDEX `fk_order_transaction_stock_order1_idx` (`stock_order_id` ASC) VISIBLE,
CONSTRAINT `fk_order_transaction_stock_order1`
FOREIGN KEY (`stock_order_id`)
REFERENCES `orderbook`.`stock_order` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
-- Annual (new Business or Renewal)
select concat(pol.polPolicyNumber, "/", pol.polRenewalIndex, "/", pol.polMtaIndex) as Id,
pol.polQuotationNumber as QuoteNumber, pol.polStatus as Status, pol.polInceptionDate as Inception, pol.polExpiryDate as Expiry,
extractvalue(polAttribute, '//attribute[@id="purchaseTimeStamp"]/@value') as PurchaseTimeStamp,
extractvalue(ash.ashAssessmentLines, '//line[@name="product total premium"]/detail/amount/@amount') as Premium
from polpolicy pol
join jpolaslash aslash on pol.polUID = aslash.UIDpol
join ashassessmentsheet ash on aslash.assessmentSheetListUIDash = ash.ashUID
where pol.polStatus in ('ON_RISK', 'SUBMITTED')
and str_to_date(extractvalue(pol.polAttribute, '//attribute[@id="purchaseTimeStamp"]/@value'), '%Y-%m-%d') >= '2019-04-01'
and str_to_date(extractvalue(pol.polAttribute, '//attribute[@id="purchaseTimeStamp"]/@value'), '%Y-%m-%d') <= '2019-04-23'
and extractvalue(pol.polAttribute, '//attribute[@id="term"]/@value') = 365
order by PurchaseTimeStamp;
-- Monthly New Business
select concat(pol.polPolicyNumber, "/", pol.polRenewalIndex, "/", pol.polMtaIndex) as Id,
pol.polQuotationNumber as QuoteNumber, pol.polStatus as Status, pol.polInceptionDate as Inception, pol.polExpiryDate as Expiry,
extractvalue(polAttribute, '//attribute[@id="purchaseTimeStamp"]/@value') as PurchaseTimeStamp,
extractvalue(ash.ashAssessmentLines, '//line[@name="product total premium"]/detail/amount/@amount') as Premium
from polpolicy pol
join jpolaslash aslash on pol.polUID = aslash.UIDpol
join ashassessmentsheet ash on aslash.assessmentSheetListUIDash = ash.ashUID
where pol.polRenewalIndex = 0
and pol.polStatus in ('ON_RISK', 'SUBMITTED')
and str_to_date(extractvalue(pol.polAttribute, '//attribute[@id="purchaseTimeStamp"]/@value'), '%Y-%m-%d') >= '2019-04-01'
and str_to_date(extractvalue(pol.polAttribute, '//attribute[@id="purchaseTimeStamp"]/@value'), '%Y-%m-%d') <= '2019-04-23'
and extractvalue(pol.polAttribute, '//attribute[@id="term"]/@value') = 30
order by PurchaseTimeStamp;
-- Monthly Renewal
select concat(pol.polPolicyNumber, "/", pol.polRenewalIndex, "/", pol.polMtaIndex) as Id,
pol.polQuotationNumber as QuoteNumber, pol.polStatus as Status, pol.polInceptionDate as Inception, pol.polExpiryDate as Expiry,
extractvalue(polAttribute, '//attribute[@id="purchaseTimeStamp"]/@value') as PurchaseTimeStamp,
extractvalue(ash.ashAssessmentLines, '//line[@name="product total premium"]/detail/amount/@amount') as Premium
from polpolicy pol
join jpolaslash aslash on pol.polUID = aslash.UIDpol
join ashassessmentsheet ash on aslash.assessmentSheetListUIDash = ash.ashUID
where pol.polRenewalIndex > 0
and pol.polStatus in ('ON_RISK', 'SUBMITTED')
and str_to_date(extractvalue(pol.polAttribute, '//attribute[@id="purchaseTimeStamp"]/@value'), '%Y-%m-%d') >= '2019-04-01'
and str_to_date(extractvalue(pol.polAttribute, '//attribute[@id="purchaseTimeStamp"]/@value'), '%Y-%m-%d') <= '2019-04-23'
and extractvalue(pol.polAttribute, '//attribute[@id="term"]/@value') = 30
order by PurchaseTimeStamp;
|
set linesi 150 trims on pages 10000 head on echo off feedback on
col id format 9999999
col own format a10
col tab format a30
col col format a30
col alg format a30
col val format a50
col con format a50
select id,own,tab,col,alg,valcon from data_mask_list;
|
CREATE TABLE [comment] (
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
[text] VARCHAR(500) NULL,
[user] VARCHAR(255) NULL,
[added_date] DATETIME NULL,
[work_item_id] INTEGER NOT NULL,
[version] INTEGER NOT NULL,
FOREIGN KEY(work_item_id) REFERENCES work_item(id)
); |
INSERT INTO PERSON(FirstName, LastName) VALUES ('Wiktor', 'Androsiuk');
INSERT INTO PERSON(FirstName, LastName) VALUES ('Przemysław', 'Gołębski');
INSERT INTO PERSON(FirstName, LastName) VALUES ('Paweł', 'Kalbarczyk');
INSERT INTO PERSON(FirstName, LastName) VALUES ('Jakub', 'Dzieciątko');
INSERT INTO EMPLOYEE(HireDate, Person_IdPerson) VALUES (current_date, 1);
INSERT INTO EMPLOYEE(HireDate, Person_IdPerson) VALUES (current_date, 2);
INSERT INTO Customer(PhoneNumber, Email, Person_IdPerson) VALUES ('123456789', 'pawelkalbarczyk@gmail.com', 3);
INSERT INTO Customer(PhoneNumber, Email, Person_IdPerson) VALUES ('987654321', 'jakubdzieciatko@gmail.com', 4);
INSERT INTO "Order"(Name, Description, Cost) VALUES ('Drinks', 'Soft drinks inluding cola, pepsi, sprite, lemonade', 30);
INSERT INTO "Order"(Name, Description, Cost) VALUES ('Snacks', 'Chips, sweets, peanuts', 42.9);
INSERT INTO "Order"(Name, Description, Cost) VALUES ('Pizza Party', 'Selection of pizzas for whole group', 79.99);
INSERT INTO Equipment(Name, PurchaseDate, Type, Producent, WarrantyDate) VALUES ('PC', current_date, 'Gaming Machine', 'Lenovo', current_date);
INSERT INTO Equipment(Name, PurchaseDate, Type, Producent, WarrantyDate) VALUES ('PC', current_date, 'Gaming Machine', 'Alienware', current_date);
INSERT INTO Equipment(Name, PurchaseDate, Type, Producent, WarrantyDate) VALUES ('Dell Monitor', current_date, 'Monitor', 'Dell', current_date);
INSERT INTO Equipment(Name, PurchaseDate, Type, Producent, WarrantyDate) VALUES ('PS5', current_date, 'Console', 'Sony', current_date);
INSERT INTO Equipment(Name, PurchaseDate, Type, Producent, WarrantyDate) VALUES ('XBOX', current_date, 'Console', 'Microsoft', current_date);
INSERT INTO Station(Specialization, InspectionDate) VALUES ('Esport', current_date);
INSERT INTO Station(Specialization, InspectionDate) VALUES ('Esport', current_date);
INSERT INTO Station(Specialization, InspectionDate) VALUES ('Esport', current_date);
INSERT INTO Station(Specialization, InspectionDate) VALUES ('Casual', current_date);
INSERT INTO Station(Specialization, InspectionDate) VALUES ('Family', current_date);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (1, 1);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (1, 2);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (1, 3);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (1, 3);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (2, 2);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (3, 2);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (3, 3);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (3, 3);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (4, 4);
INSERT INTO Stations_Equipment(Station_StationNumber, Equipment_SerialNumber) VALUES (5, 5);
INSERT INTO Booking(Date, Hour, RequiredEmployees, NumberOfPeople, Cost, Customer_IdCustomer, Opinion, Notes) VALUES (current_date, current_time, 3, 1, 50, 1, 5, 'opinion1');
INSERT INTO Booking(Date, Hour, RequiredEmployees, NumberOfPeople, Cost, Customer_IdCustomer, Opinion, Notes) VALUES (current_date, current_time, 12, 2, 200, 1, 5, 'opinion2');
INSERT INTO Booking(Date, Hour, RequiredEmployees, NumberOfPeople, Cost, Customer_IdCustomer, Opinion, Notes) VALUES (current_date, current_time, 4, 1, 50, 1, 4, 'opinion3');
INSERT INTO Booking(Date, Hour, RequiredEmployees, NumberOfPeople, Cost, Customer_IdCustomer, Opinion, Notes) VALUES (current_date, current_time, 1, 1, 50, 1, 2, 'opinion4');
INSERT INTO Booking(Date, Hour, RequiredEmployees, NumberOfPeople, Cost, Customer_IdCustomer, Opinion, Notes) VALUES (current_date, current_time, 3, 2, 120, 1, 5, 'opinion5');
INSERT INTO Booking(Date, Hour, RequiredEmployees, NumberOfPeople, Cost, Customer_IdCustomer, Opinion, Notes) VALUES (current_date, current_time, 3, 1, 50, 2, 6, 'opinion6');
INSERT INTO Booking(Date, Hour, RequiredEmployees, NumberOfPeople, Cost, Customer_IdCustomer, Opinion, Notes) VALUES (current_date, current_time, 12, 2, 200, 2, 1, 'opinion7');
INSERT INTO Booking(Date, Hour, RequiredEmployees, NumberOfPeople, Cost, Customer_IdCustomer, Opinion, Notes) VALUES (current_date, current_time, 4, 1, 50, 2, 2, 'opinion8');
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (1, 1);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (2, 1);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (2, 2);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (3, 2);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (4, 1);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (4, 4);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (5, 1);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (6, 1);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (6, 3);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (7, 3);
INSERT INTO Stations_Bookings(Booking_IdBooking, Station_StationNumber) VALUES (8, 4);
INSERT INTO Extras(Booking_IdBooking, Order_IdOrder) VALUES (2, 1);
INSERT INTO Extras(Booking_IdBooking, Order_IdOrder) VALUES (5, 2);
INSERT INTO Extras(Booking_IdBooking, Order_IdOrder) VALUES (7, 3);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (1, 1);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (2, 1);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (2, 2);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (3, 2);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (4, 2);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (5, 1);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (5, 2);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (6, 2);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (7, 1);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (7, 2);
INSERT INTO Assignments(Booking_IdBooking, Employee_IdEmployee) VALUES (8, 1);
|
SELECT ID,name, SALARY
FROM employees
|
-- note: all the sql we used are here,
-- some of them are written in a dynamic way
-- so it's not possible to write all the possibilities for it.
INSERT INTO Purchase_Record(`record_ID`,`purchase_Date`,`amount_Paid`)
VALUES (
CONCAT('p',UNIX_TIMESTAMP(NOW())),
#{purchaseRecord.purchaseDate,jdbcTpye=DATE},
#{purchaseRecord.amountPaid,jdbcTpye=REAL}
)
INSERT INTO Purchase(`account_ID`,`game_ID`,`record_ID`)
VALUES (
#{purchaseRecord.accountID,jdbcTpye=VARCHAR},
#{purchaseRecord.gameID,jdbcTpye=VARCHAR},
#{purchaseRecord.recordID,jdbcTpye=VARCHAR},
)
DELETE FROM Purchase_Record
WHERE `record_ID` = (
SELECT `record_ID`
FROM Purchase
WHERE `game_ID` = #{gameId,jdbcTpye=VARCHAR}
)
INSERT INTO User_Account(`account_ID`,`gender`,`registeration_Date`,`age`,`account_Name`)
VALUES (
CONCAT('a',UNIX_TIMESTAMP(NOW())),
#{userAccount.gender,jdbcTpye=VARCHAR},
#{userAccount.registeration_Date,jdbcTpye=VARCHAR},
#{userAccount.age,jdbcTpye=VARCHAR},
#{userAccount.account_Name,jdbcTpye=VARCHAR}
)
DELETE FROM User_Account
WHERE `account_ID` = #{accountID,jdbcTpye=VARCHAR}
SELECT (`account_ID`,
`gender`,
`registeration_Date`,
`age`,
`account_Name`)
FROM User_Account
SELECT (`membership_ID`,
`status`,
`fee_PerMonth`,
`data_Joined`,
`account_ID`)
FROM Joined_Membership
SELECT (`account_ID`,
`gender`,
`registeration_Date`,
`age`,
`account_Name`)
FROM User_Account
WHERE `account_Name` = #{accountName,jdbcTpye=VARCHAR}
SELECT ${aggregationType}(`age`)
FROM User_Account
UPDATE Developed_Games
SET `price` = 5
WHERE `price` <= 15
UPDATE Developed_Games
SET `price` = `price` - 10
WHERE age > 15
UPDATE Purchase_Record
SET `amount_Paid` = 0
WHERE `purchase_Date` > `1998-05-20 16:00:00`
UPDATE Developed_Games
SET `ageLimit` = 19
WHERE `price` > 100
SELECT min(`price`), `ageLimit`
FROM Developed_Games
GROUP BY `ageLimit`
HAVING COUNT(*) > 2
SELECT `account_Name`
FROM Purchase p, User_Account u, Purchase_Record pr
WHERE p.`account_ID` = u.`account_ID` AND p.`record_ID` = pr.`record_ID`
AND p.`amount_Paid` = (SELECT max(p2.`amount_Paid`)
FROM Purchase2 p2)
SELECT DISTINCT `account_Name`,max(`amount_Paid`)
FROM Purchase_Record,User_Account
WHERE `gender`= 'female'
SELECT `game_Type`,max(`price`)
FROM Developed_Games
WHERE `ageLimit`> 20
GROUP BY `game_Type`
SELECT `account_Name`
FROM User_Account U
WHERE NOT EXISTS (SELECT `game_ID`
FROM Developed_Games D
WHERE NOT EXISTS (SELECT P.`account_ID`
FROM Purchase P
WHERE P.`game_ID` = D.`game_ID`
AND P.`account_ID` = U.`account_ID`))
|
ALTER PROCEDURE SP_RECEPCION_SKU_INSERT_DE
@PRO_CODIGO INT,
@DOC_NUMERO INT,
@PROT_CODIGO INT,
@BOD_CODIGO VARCHAR(10),
@DOC_TIPO VARCHAR(100),
@EMP_CODIGO INT
AS
BEGIN
-- INSERTA UN SKU, CON LA INFORMACIÓN DISPONIBLE EN LA TABLA SKU DEL WMS_BD
INSERT INTO SKU (
SKU_CODIGO,
SKU_QTY,
SKU_LINEA,
SKU_NOMBRE,
SKU_VOLUMEN,
SKU_PESO,
SKU_DIAS,
SKU_ACEPTACION,
PRO_CODIGO,
PROT_CODIGO,
PROT_NOMBRE,
BOD_CODIGO,
EMP_CODIGO,
USU_CODIGO,
USU_RUT,
USU_NOMBRE,
DOC_NUMERO,
DOC_TIPO,
DOC_NOMBRE,
DOC_CIUDAD,
DOC_COMUNA
)
SELECT
SKU_CODIGO,
MAX(SKU_QTY) - SUM(ISNULL(SKU_QTY_REAL,0)) AS SKU_QTY,
SKU_LINEA,
SKU_NOMBRE,
SKU_VOLUMEN,
SKU_PESO,
SKU_DIAS,
SKU_ACEPTACION,
@PRO_CODIGO, -- PROCESO ACTUAL, NO EL DEL SKU
PROT_CODIGO,
PROT_NOMBRE,
BOD_CODIGO,
EMP_CODIGO,
USU_CODIGO,
USU_RUT,
USU_NOMBRE,
DOC_NUMERO,
DOC_TIPO,
DOC_NOMBRE,
DOC_CIUDAD,
DOC_COMUNA
FROM SKU
WHERE
DOC_NUMERO = @DOC_NUMERO
AND PROT_CODIGO = @PROT_CODIGO
AND BOD_CODIGO = @BOD_CODIGO
AND DOC_TIPO = @DOC_TIPO
AND EMP_CODIGO = @EMP_CODIGO
GROUP BY
SKU_CODIGO,
SKU_LINEA,
SKU_NOMBRE,
SKU_VOLUMEN,
SKU_PESO,
SKU_DIAS,
SKU_ACEPTACION,
PROT_CODIGO,
PROT_NOMBRE,
BOD_CODIGO,
EMP_CODIGO,
USU_CODIGO,
USU_RUT,
USU_NOMBRE,
DOC_NUMERO,
DOC_TIPO,
DOC_NOMBRE,
DOC_CIUDAD,
DOC_COMUNA
HAVING MAX(SKU_QTY) - SUM(ISNULL(SKU_QTY_REAL,0)) > 0
END
|
-- Sequence and defined type
CREATE SEQUENCE IF NOT EXISTS password_reset_token_id_seq;
-- Table Definition
CREATE TABLE "public"."password_reset_token" (
"id" int4 NOT NULL DEFAULT nextval('password_reset_token_id_seq' :: regclass),
"email" varchar NOT NULL,
"token" varchar,
"created_at" timestamptz NOT NULL,
"updated_at" timestamptz NOT NULL,
"deleted_at" timestamptz,
"due_at" timestamptz,
PRIMARY KEY ("id")
);
|
Create Procedure mERP_sp_InsertRecdMarginDetail
( @RecdID int=0, @Name nVArchar(255)= NULL, @Catlevel nVarchar(510)= NULL, @Percentage Decimal(18,6)= 0, @MarginDate datetime = NULL, @Type nVarchar(255)= NULL)
As
Insert into tbl_mERP_RecdMarginDetail ( RecdID, CategoryName, Categorylevel, Percentage, MarginDate, Type)
Values (@RecdID, @Name, @Catlevel, @Percentage, @MarginDate, @Type)
Select @@IDENTITY
|
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
CREATE TABLE IF NOT EXISTS `answers` (
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
`user` mediumint(4) NOT NULL DEFAULT '0',
`question` mediumint(4) NOT NULL DEFAULT '0',
`option_s` varchar(4) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `questions` (
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
`body` text NOT NULL,
`option_a` text NOT NULL,
`option_b` text NOT NULL,
`option_c` text NOT NULL,
`option_d` text NOT NULL,
`answer` varchar(4) NOT NULL DEFAULT '',
`subject` varchar(255) NOT NULL DEFAULT '',
`points` tinyint(4) NOT NULL DEFAULT '0',
`random` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `user` (
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`admin` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `user` (`id`, `username`, `password`, `admin`) VALUES
(1, 'ADMIN', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 1),
(2, 'TEAM1', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 0),
(3, 'TEAM2', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 0),
(4, 'TEAM3', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 0),
(5, 'TEAM4', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 0),
(6, 'TEAM5', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 0),
(7, 'TEAM6', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 0);
CREATE TABLE IF NOT EXISTS `variables` (
`name` varchar(255) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
CREATE Procedure sp_update_Payment_Adjustment ( @BillID Int,
@AdjustedRef nvarchar(255),
@AdjustedAmount Decimal(18,6),
@PaymentID Int)
As
Update BillAbstract Set AdjRef = @AdjustedRef, AdjustedAmount = @AdjustedAmount,
PaymentID = @PaymentID Where BillID = @BillID
|
USE `soft_uni`;
#-- 1. Find Names of All Employees by First Name
SELECT `first_name`, `last_name`
FROM `employees`
WHERE LEFT(`first_name`, 2) = 'Sa'
ORDER BY `employee_id`;
#-- 2. Find Names of All employees by Last Name
SELECT `first_name`, `last_name`
FROM `employees`
WHERE `last_name` LIKE ('%ei%')
ORDER BY `employee_id`;
#-- 3. Find First Names of All Employees
SELECT `first_name`, `last_name`
FROM `employees`
WHERE
`department_id` in (3, 10) AND
YEAR(`hire_date`) >= 1995 AND
YEAR(`hire_date`) <= 2005
ORDER BY `employee_id`;
#-- 4. Find All Employees Except Engineers
SELECT `first_name`, `last_name`
FROM `employees`
WHERE `job_title` NOT LIKE ('%engineer%')
ORDER BY `employee_id`;
#-- 5. Find Towns with Name Length
SELECT `name`
FROM `towns`
WHERE CHAR_LENGTH(`name`) IN (5, 6)
ORDER BY `name`;
#-- 6. Find Towns Starting With
SELECT `town_id`, `name`
FROM `towns`
WHERE `name` REGEXP '^[MmKkBbEe]'
ORDER BY `name`;
#-- 7. Find Towns Not Starting With
SELECT `town_id`, `name`
FROM `towns`
WHERE `name` REGEXP '^[^RBDrbd]'
ORDER BY `name`;
#-- 8. Create View Employees Hired After 2000 Year
CREATE VIEW `v_employees_hired_after_2000` AS
SELECT `first_name`, `last_name`
FROM `employees`
WHERE YEAR(`hire_date`) > 2000;
SELECT * FROM `v_employees_hired_after_2000`;
#-- 9. Length of Last Name
SELECT `first_name`, `last_name`
FROM `employees`
WHERE CHAR_LENGTH(`last_name`) = 5;
#-- 10. Countries Holding ‘A’ 3 or More Times
USE `geography`;
SELECT `country_name`, `iso_code`
FROM `countries`
WHERE (CHAR_LENGTH(`country_name`) - CHAR_LENGTH(REPLACE(LOWER(`country_name`), 'a', ''))) >= 3
ORDER BY `iso_code`;
#-- 11. Mix of Peak and River Names
SELECT
`peak_name`,
`river_name`,
CONCAT('',
LOWER(`peak_name`),
LOWER(SUBSTRING(`river_name`, 2))) AS 'mix'
FROM
`peaks`,
`rivers`
WHERE
LOWER(RIGHT(`peak_name`, 1)) = LOWER(LEFT(`river_name`, 1))
ORDER BY `mix`;
#-- 12. Games from 2011 and 2012 year
USE `diablo`;
SELECT `name`, DATE_FORMAT(`start`, '%Y-%m-%d') AS 'start'
FROM `games`
WHERE YEAR(`start`) BETWEEN 2011 AND 2012
ORDER BY `start`, `name`
LIMIT 50;
#-- 13. User Email Providers
SELECT `user_name`, SUBSTRING_INDEX(`email`, '@', -1) AS 'Email Provider'
FROM `users`
ORDER BY `Email Provider`, `user_name`;
#-- 14. Get Users with IP Address Like Pattern
SELECT `user_name`, `ip_address`
FROM `users`
WHERE `ip_address` LIKE '___.1%.%.___'
ORDER BY `user_name`;
#-- 15. Show All Games with Duration and Part of the Day
SELECT
`name` AS 'game',
CASE
WHEN HOUR(`start`) BETWEEN 0 AND 11 THEN 'Morning'
WHEN HOUR(`start`) BETWEEN 12 AND 17 THEN 'Afternoon'
ELSE 'Evening'
END AS 'Part of the Day',
CASE
WHEN `duration` <= 3 THEN 'Extra Short'
WHEN `duration` BETWEEN 4 AND 6 THEN 'Short'
WHEN `duration` BETWEEN 7 AND 10 THEN 'Long'
ELSE 'Extra Long'
END AS 'Duration'
FROM
`games`
ORDER BY `name`;
#-- 16. Orders Table
USE `orders`;
SELECT
`product_name`,
`order_date`,
DATE_ADD(`order_date`, INTERVAL 3 DAY) AS 'pay_due',
DATE_ADD(`order_date`, INTERVAL 1 MONTH) AS 'deliver_due'
FROM
`orders`; |
SELECT Track.Name, Track.Composer
FROM Track INNER JOIN InvoiceLine
ON InvoiceLine.TrackId = Track.TrackId |
ALTER TABLE {$prefix}session
ADD COLUMN platform varchar(31) NULL DEFAULT NULL COMMENT 'A platform like ios or android' AFTER duration,
ADD COLUMN appId varchar(200) NULL DEFAULT NULL COMMENT 'An external app id registered with the platform' AFTER platform,
ADD COLUMN version varchar(34) NULL DEFAULT NULL COMMENT 'The version of the platform' AFTER appId,
ADD COLUMN formFactor enum('mobile','tablet','desktop') DEFAULT NULL after version,
DROP INDEX userId,
ADD INDEX user (userId, platform, appId);
ALTER TABLE {$prefix}device
MODIFY formFactor enum('mobile','tablet','desktop') DEFAULT NULL;
ALTER TABLE {$prefix}user
MODIFY signedUpWith varchar(31) NOT NULL COMMENT 'A platform like ios or android, or "none", "mobile", "email"'; |
-- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Aug 14, 2014 at 12:06 PM
-- Server version: 5.5.36
-- PHP Version: 5.4.27
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: `cohud`
--
-- --------------------------------------------------------
--
-- Table structure for table `about`
--
CREATE TABLE IF NOT EXISTS `about` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`history` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `about`
--
INSERT INTO `about` (`id`, `history`) VALUES
(1, '<p>Mrs. Delorane had died of decline: people would say to one another, in confidence, they hoped Ellin might escape it. The largest and <b>best farm</b> in the neighbourhood of Timberdale, larger than even that of the Ashtons, was called the Dower Farm.</p><p>Out-of-doors he was the keen, active, thorough farmer; indoors he lived as a gentleman. He had four children: three boys and one girl. Nothing must prevent her journey upon the desert!</p>');
-- --------------------------------------------------------
--
-- Table structure for table `accordion`
--
CREATE TABLE IF NOT EXISTS `accordion` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`accordion_description` text NOT NULL,
`accordion_title` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `accordion`
--
INSERT INTO `accordion` (`id`, `accordion_description`, `accordion_title`) VALUES
(1, 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'Don''t miss our treats 1'),
(3, '<p>Dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>', 'Holiday Services');
-- --------------------------------------------------------
--
-- Table structure for table `blog`
--
CREATE TABLE IF NOT EXISTS `blog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` text NOT NULL,
`detailed_desc` text NOT NULL,
`image_url1` varchar(255) NOT NULL,
`image_url2` varchar(255) NOT NULL,
`image_url3` varchar(255) NOT NULL,
`create_date` int(11) NOT NULL,
`analyse` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `blog`
--
INSERT INTO `blog` (`id`, `name`, `description`, `detailed_desc`, `image_url1`, `image_url2`, `image_url3`, `create_date`, `analyse`) VALUES
(1, 'Kennedy', '"ARE you comin'' to the dawncin'', Lady Speedway?" asked the American in his best transatlantic liner accent. "Most decidedly not!" Mind you, this answer from Lady Speedway meant red lights ahead. At the Hotel Biscuit...', '"ARE you comin'' to the dawncin'', Lady Speedway?" asked the American in his best transatlantic liner accent. "Most decidedly not!" Mind you, this answer from Lady Speedway meant red lights ahead. At the Hotel Biscuit...', '7e12f5b01c7cf22930172f085cc87f29.jpg', '113ca1ed1ada42f2e16a2ef40e91c7b5.jpg', '03b8d7f0c8c45b88ed3b1e53bcccd5d5.jpg', 1408009269, 10),
(2, 'Field Marshal', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'd9b43e362f8867299573134a242a07fd.jpg', 'f245a6f4c9da51de402e2d3180ff6f43.jpg', '39ce1e46a99d81af9d3e719ed6d5c455.jpg', 1407926828, 4),
(3, 'Hotel Biscuit', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', '4131c9787fe341e72519fa7103b85811.jpg', 'a7dd7bbbd5a494af8fadff8ead37801a.jpg', 'ab8199a177744d856e6ff92f16e5ba4d.jpg', 1407926894, 2),
(4, 'Lady Speedway', '"ARE you comin'' to the dawncin'', Lady Speedway?" asked the American in his best transatlantic liner accent. "Most decidedly not!" Mind you, this answer from Lady Speedway meant red lights ahead. At the Hotel Biscuit ...', '"ARE you comin'' to the dawncin'', Lady Speedway?" asked the American in his best transatlantic liner accent. "Most decidedly not!" Mind you, this answer from Lady Speedway meant red lights ahead. At the Hotel Biscuit ...', 'd567366fcbe814b5bc351611078e6236.jpg', '1e01db96cbd8df485603bae54c628429.jpg', '5c845b9841da3a7c288624242206342e.jpg', 1407926945, 4),
(5, 'Transatlantic', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'cc7175f0a473ddf8dbd563e8b1abfc7b.jpg', 'b088862976fc66b5e29554a409e3f39d.jpg', 'ae3035de8ca0bceafb5aa28404fb252c.jpg', 1407926981, 4),
(6, 'Private Theater', '"ARE you comin'' to the dawncin'', Lady Speedway?" asked the American in his best transatlantic liner accent. "Most decidedly not!" Mind you, this answer from Lady Speedway meant red lights ahead. At the Hotel Biscuit ...', '"ARE you comin'' to the dawncin'', Lady Speedway?" asked the American in his best transatlantic liner accent. "Most decidedly not!" Mind you, this answer from Lady Speedway meant red lights ahead. At the Hotel Biscuit ...', 'b7e6c6f3f011e4c1481d21d2ce050794.jpg', 'b47dfd415a369fd27929fb3e93ebc594.jpg', 'f4ecdbb8b6c5600994b82216a2496983.jpg', 1407927013, 4);
-- --------------------------------------------------------
--
-- Table structure for table `catdetail`
--
CREATE TABLE IF NOT EXISTS `catdetail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cat_id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`image_url` varchar(255) NOT NULL,
`image_url1` varchar(255) NOT NULL,
`image_url2` varchar(255) NOT NULL,
`image_url3` varchar(255) NOT NULL,
`detailed_desc` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `catdetail`
--
INSERT INTO `catdetail` (`id`, `cat_id`, `title`, `description`, `image_url`, `image_url1`, `image_url2`, `image_url3`, `detailed_desc`) VALUES
(3, 3, 'OLD TRAIN 3', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.', '49dd3c2837d5b8b894eb663348bd5b07.jpg', 'c629fe331988d2ada8b61c31eb5fa4b1.jpg', 'a27800689c6bdb02097d9390ac331657.jpg', 'b9a071d59371674b1f998c1204f4d19b.jpg', 'Phasellus nec nibh id arcu pharetra blandit. Nullam mollis, lacus nec lacinia porttitor, odio eros laoreet nibh, at scelerisque magna justo eu turpis. Duis sed risus sit amet nunc cursus suscipit. Duis sed est turpis. Sed imperdiet elit eget massa consectetur sit amet rhoncus purus sagittis. Ut vitae nulla tempus erat accumsan porta a ut turpis. Suspendisse pharetra sagittis tellus, eu viverra neque molestie id.');
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE IF NOT EXISTS `category` (
`cat_id` int(11) NOT NULL AUTO_INCREMENT,
`cat` varchar(255) NOT NULL,
PRIMARY KEY (`cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `category`
--
INSERT INTO `category` (`cat_id`, `cat`) VALUES
(1, 'nature'),
(3, 'Trains'),
(4, 'terain');
-- --------------------------------------------------------
--
-- Table structure for table `clients`
--
CREATE TABLE IF NOT EXISTS `clients` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`image_url` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `clients`
--
INSERT INTO `clients` (`id`, `image_url`) VALUES
(1, 'b8ef48f3e4598e3d0e81ce3d3c79a366.gif');
-- --------------------------------------------------------
--
-- Table structure for table `features`
--
CREATE TABLE IF NOT EXISTS `features` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`letter` varchar(255) NOT NULL,
`title` varchar(255) NOT NULL,
`subtitle` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
--
-- Dumping data for table `features`
--
INSERT INTO `features` (`id`, `letter`, `title`, `subtitle`) VALUES
(4, 'K', 'Awosome design', 'Awosome design'),
(6, 'M', 'Responds well', 'Responds well'),
(7, 'A', 'quality template', 'quality template');
-- --------------------------------------------------------
--
-- Table structure for table `gallery`
--
CREATE TABLE IF NOT EXISTS `gallery` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`image_url` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `gallery`
--
INSERT INTO `gallery` (`id`, `title`, `image_url`) VALUES
(1, 'water fall 2', 'cb9241fa86cde2695afa129a777220f7.jpg'),
(3, 'castle', '100993d99935e30a27607e337a49506a.jpg'),
(4, 'red house', '1e07ea05883ea6410c2c7c6d9d02bfa5.jpg'),
(5, 'forest', '255a93ea19fff221e83a2bc54f722513.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `news`
--
CREATE TABLE IF NOT EXISTS `news` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` text NOT NULL,
`detailed_desc` text NOT NULL,
`image_url1` varchar(255) NOT NULL,
`create_date` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `news`
--
INSERT INTO `news` (`id`, `name`, `description`, `detailed_desc`, `image_url1`, `create_date`) VALUES
(1, 'Field Marshal 2', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', '6e610aa285b6da4e68ef4d54d573fe76.jpg', 1408009785),
(2, 'Lady Speedway', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'ccdf3cb908abd81bfc4e3a250c2dec23.jpg', 1407912050),
(3, 'Hotel Biscuit', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'e1c088281ac8f6d56945e7ef1a2651df.jpg', 1407912077),
(4, 'Transatlantic', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'She was the Field Marshal of the Front Porch Knitting Needle Hussars, nicknamed "Hussies." Her approbation was olive oil; her discountenance prickly heat. "Of course," she added, "while recognizing that expatiation does not include brevity ...', 'be823ab20277f9d53445e79214e9e9cf.jpg', 1407912113);
-- --------------------------------------------------------
--
-- Table structure for table `quote`
--
CREATE TABLE IF NOT EXISTS `quote` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`quote` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `quote`
--
INSERT INTO `quote` (`id`, `quote`) VALUES
(1, '"Vision is the art of seeing what is invisible to others" - Jonathan Swift');
-- --------------------------------------------------------
--
-- Table structure for table `rollover`
--
CREATE TABLE IF NOT EXISTS `rollover` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`head` text NOT NULL,
`sub_head` text NOT NULL,
`image_url` varchar(255) NOT NULL,
`image_url_thumb` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `rollover`
--
INSERT INTO `rollover` (`id`, `head`, `sub_head`, `image_url`, `image_url_thumb`) VALUES
(3, 'Dare to', 'Hope 1', '8eae07eb96ddef923f5dcc8a4a393796.gif', 'c3b367a0970876f7d0edaf0c512c87e8.gif'),
(4, 'Dare to', 'Dream', '52fa4a630f7c62cd63a5cfcae23d11fc.gif', 'dc1916d4f708ee3bc5ab3ed169ca1fe6.gif');
-- --------------------------------------------------------
--
-- Table structure for table `service`
--
CREATE TABLE IF NOT EXISTS `service` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`service` text NOT NULL,
`title` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `service`
--
INSERT INTO `service` (`id`, `service`, `title`) VALUES
(2, 'Duis sit amet risus nunc. Maecenas a elementum urna. Quisque euismod pellentesque sem in feugiat. Mauris nulla urna, euismod sit amet placerat et, adipiscing sit amet nisi. Maecenas libero purus, pulvinar at blandit a, auctor non nulla. Fusce vitae tortor erat', 'Product 1'),
(3, 'Duis sit amet risus nunc. Maecenas a elementum urna. Quisque euismod pellentesque sem in feugiat. Mauris nulla urna, euismod sit amet placerat et, adipiscing sit amet nisi. Maecenas libero purus, pulvinar at blandit a, auctor non nulla. Fusce vitae tortor erat', 'Product 3');
-- --------------------------------------------------------
--
-- Table structure for table `tab`
--
CREATE TABLE IF NOT EXISTS `tab` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`description` text,
`tab_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `tab`
--
INSERT INTO `tab` (`id`, `title`, `description`, `tab_id`) VALUES
(1, 'why choose us', '<p>This is simple tab 1''s content. Pretty neat, huh? Lorem ipsum dolor sit amet, consectetur adipiscing elit. Et non ex maxima parte de tota iudicabis? Item de contrariis, a quibus ad genera formasque generum.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Et non ex maxima parte de tota iudicabis? Item de contrariis, a quibus ad genera formasque generum venerunt. Sit enim idem caecus, debilis. Duo Reges: constructio interrete.</p><p>Sit enim idem caecus, debilis. Duo Reges: constructio interrete.</p>', 1),
(2, 'How we work', 'This is simple tab 2''s content. Now you see it! Lorem ipsum dolor sit amet, consectetur adipiscing elit. Et non ex maxima parte de tota iudicabis? Item de contrariis, a quibus ad genera formasque generum.', 2),
(3, 'Completion date', 'This is simple tab 3''s content. It''s, you know...okay. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Et non ex maxima parte de tota iudicabis? Item de contrariis, a quibus ad genera formasque generum.', 3);
-- --------------------------------------------------------
--
-- Table structure for table `team`
--
CREATE TABLE IF NOT EXISTS `team` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` text NOT NULL,
`facebook_url` varchar(255) NOT NULL,
`twitter_url` varchar(255) NOT NULL,
`image_url` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `team`
--
INSERT INTO `team` (`id`, `name`, `description`, `facebook_url`, `twitter_url`, `image_url`) VALUES
(2, 'Kennedy BERNSKI', 'one of our best shooting model, working for this company since the beginning.', 'http://facebook.com', 'http://twitter.com', '7bb833d3c94739b8e3c02a6a4be771b7.jpg'),
(3, 'YOLANDA BERNSKI', 'One of our best shooting model, working for this company since the beginning.', 'http://facebook.com', 'http://twitter.com', '8ec7904a74cb1e09cb34ba24bc3b997e.jpg'),
(4, 'LUNA GALLIANO', 'One of our best shooting model, working for this company since the beginning.', 'http://facebook.com', 'http://twitter.com', 'b025e583ee4a7f925b3198af960a6f7b.jpg'),
(5, 'KATRINA BERNSKI', 'One of our best shooting model, working for this company since the beginning.', 'http://facebook.com', 'http://twitter.com', '06df66c93c0c72f42f3254594c05b774.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `testimonial`
--
CREATE TABLE IF NOT EXISTS `testimonial` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`client_name` varchar(255) NOT NULL,
`testimonial` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `testimonial`
--
INSERT INTO `testimonial` (`id`, `client_name`, `testimonial`) VALUES
(2, 'MARTIN - Kenn', '"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco."');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(256) NOT NULL,
`password` varchar(256) NOT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_id`, `user_name`, `password`) VALUES
(1, 'admin', '63a9f0ea7bb98050796b649e85481845');
-- --------------------------------------------------------
--
-- Table structure for table `what_we_do`
--
CREATE TABLE IF NOT EXISTS `what_we_do` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`detailed` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `what_we_do`
--
INSERT INTO `what_we_do` (`id`, `title`, `description`, `detailed`) VALUES
(2, 'Photography 1', 'Swine short ribs meatball irure bacon nulla pork belly cupidatat meatloaf cow. Nulla corned beef sunt ball tip, qui bresaola enim jowl. Capicola short ribs minim salami nulla nostrud pastrami.', '<p>Mrs. Delorane had died of decline: people would say to one another, in confidence, they hoped Ellin might escape it. The largest and <strong>best farm</strong> in the neighbourhood of Timberdale, larger than even that of the Ashtons, was called the Dower Farm.</p>\n\n<p>Out-of-doors he was the keen, active, thorough farmer; indoors he lived as a gentleman. He had four children: three boys and one girl. Nothing must prevent her journey upon the desert!</p>\n');
/*!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 users (
id BIGINT NOT NULL,
name VARCHAR(30) NOT NULL,
hire_date DATE NOT NULL,
CONSTRAINT PRIMARY KEY (id)
) ENGINE = InnoDB;
CREATE TABLE todo (
id BIGINT NOT NULL,
title VARCHAR(127) NOT NULL,
description VARCHAR(255) NOT NULL,
created_at DATETIME NOT NULL,
CONSTRAINT PRIMARY KEY (id),
INDEX todo_title_idx (title)
) ENGINE = InnoDB;
CREATE TABLE todo_reporters (
user_id BIGINT NOT NULL,
todo_id BIGINT NOT NULL,
CONSTRAINT PRIMARY KEY (user_id, todo_id)
, CONSTRAINT FOREIGN KEY (user_id) REFERENCES users (id)
, CONSTRAINT FOREIGN KEY (todo_id) REFERENCES todo (id)
) ENGINE = InnoDB;
CREATE TABLE todo_history (
id BIGINT NOT NULL,
todo_id BIGINT NOT NULL,
operator BIGINT NOT NULL ,
state INT NOT NULL,
created_at DATETIME NOT NULL,
CONSTRAINT PRIMARY KEY (id),
CONSTRAINT FOREIGN KEY (todo_id) REFERENCES todo (id),
CONSTRAINT FOREIGN KEY (operator) REFERENCES users (id),
INDEX todo_history_todo_created_idx (todo_id ASC, created_at DESC)
) ENGINE = InnoDB;
CREATE TABLE generated_ids(
pk_name VARCHAR(63) NOT NULL PRIMARY KEY,
generated_id BIGINT NOT NULL
) ENGINE = InnoDB;
INSERT INTO generated_ids (pk_name, generated_id) VALUES
('user_id', 0)
, ('todo_id', 0)
, ('todo_history_id', 0)
;
|
SELECT DISTINCT u.userID, u.userName
FROM chirpUsers u, chirpFollowers f, chirpPosts p, ChirpReads r
WHERE u.userID = f.userID -- Find a follower of this user ...
AND f.followerID = p.posterID -- who issued a post ...
AND r.posterID = p.posterID -- and that particular post was read ...
AND r.postNum = p.postNum
AND u.userID = r.postReader; -- by this user
-- Requires DISTINCT
-- Or
-- SELECT u.userID, u.userName
-- FROM chirpUsers u
-- WHERE EXISTS ( SELECT *
-- FROM chirpFollowers f, chirpPosts p, ChirpReads r
-- WHERE u.userID = f.userID
-- AND f.followerID = p.posterID
-- AND r.posterID = p.posterID
-- AND r.postNum = p.postNum
-- AND u.userID = r.postReader
-- );
-- Doesn't require DISTINCT |
USE mysql;
DROP FUNCTION IF EXISTS r_ext;
CREATE FUNCTION r_ext RETURNS STRING SONAME 'mysqlr.so';
SELECT r_ext("rnorm", 10);
|
CREATE SEQUENCE s START WITH 100 INCREMENT BY 10;
CREATE SEQUENCE s2 START WITH -100 INCREMENT BY -10;
CREATE SEQUENCE s3 START WITH -100 INCREMENT BY 10 MINVALUE=-100 MAXVALUE=1000;
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
SELECT NEXTVAL(s2);
SELECT NEXTVAL(s2);
SELECT NEXTVAL(s2);
SELECT NEXTVAL(s3);
SELECT NEXTVAL(s3);
SELECT NEXTVAL(s3);
|
--Add a column called "ManufacturerTwo"
ALTER TABLE Products
ADD ManufacturerTwo varchar(25) NULL;
--Drop the "Manufacturer" column
ALTER TABLE Products
DROP COLUMN ManufacturerTwo;
--Add a column called "UPC"
ALTER TABLE Products
ADD UPC varchar(25) NULL;
--Change the UPC column type to text from varchar
ALTER TABLE Products
ALTER COLUMN UPC text;
--Drop the UPC column
ALTER TABLE Products
DROP COLUMN UPC;
|
-- +goose Up
create table tokens (
token varchar(128) primary key,
created_at timestamp default now(),
account_id varchar(128) references accounts
);
-- +goose Down
drop table tokens;
|
CREATE TABLE `crm_chart` (
`id` BIGINT(20) UNSIGNED NOT NULL,
`name` VARCHAR(64) NOT NULL COMMENT 'The name of the chart',
`config` JSON NOT NULL COMMENT 'Chart & reporting configuration',
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME DEFAULT NULL,
`deleted_at` DATETIME DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
-- Needed for Milestone 1
create table fammyuser
(
keyid serial not null
constraint fammyuser_pk
primary key,
username varchar(50) not null,
profilepicpath varchar(500)
);
create unique index fammyuser_username_uindex
on fammyuser (username);
insert into fammyuser (username, profilepicpath)
values ('Dan Ortega',null);
insert into fammyuser (username, profilepicpath)
values ('Jenn Bohorquez',null);
insert into fammyuser (username, profilepicpath)
values ('Amie Ortega',null);
insert into fammyuser (username, profilepicpath)
values ('Annie Ortega',null);
--------------------------------------------------------------
create table authentication
(
keyid serial not null
constraint authentication_pk
primary key,
userid serial not null
constraint authentication_fammyuser_keyid_fk
references fammyuser,
password varchar(200) not null
);
insert into authentication (userid, password)
values ('1','somepasstemp');
/* just for testing table !!
create table firsttable
(
numba integer
);*/ |
1 Coffee Store
2 Python RPG Game
3 Draw Canvas
4 Socket Chat
5 Wiki-express
6 Job Press
7 Weather App-Angular
8 Calculator
9 Blackjack
10 Memory Game
11 Tic Tac Toe
12 To Do List
13 SentiMotion
1 jQuery
2 JavaScript
3 HTML
4 CSS
5 Python
6 MongoDB
7 PostgreSQL
8 Mongoose
9 AngularJS
10 Boostrap
11 node.js
12 Express
13 Socket.IO
14 Animate.css
15 Ruby
16 Ruby on Rails
17 Java
18 C++
1 Allen Thompson
2 Regan Co
3 Matt Brimmer
4 Dave Pham
5 Cody Barber
6 Kyle Luck
7 Tim Sanders
8 DeeAnn Kendrick
9 Shanda Kennedy
10 Anthony Thompson
11 Carolyn Daniels
12 Sandhya Kumari
update commit set time_stamp = '2016-05-01 12:21:05' where id = 1;
update commit set time_stamp = '2016-05-01 12:21:05' where id = 2;
update commit set time_stamp = '2016-05-02 10:30:18' where id = 3;
update commit set time_stamp = '2016-06-29 08:38:26' where id = 4;
update commit set time_stamp = '2016-07-14 14:42:46' where id = 5;
update commit set time_stamp = '2016-07-04 17:12:01' where id = 6;
update commit set time_stamp = '2016-06-22 11:02:33' where id = 7;
update commit set time_stamp = '2016-06-03 18:11:09' where id = 8;
update commit set time_stamp = '2016-07-21 15:20:10' where id = 9;
update commit set time_stamp = '2016-05-27 11:38:16' where id = 10;
update commit set time_stamp = '2016-07-44 14:42:36' where id = 11;
update commit set time_stamp = '2016-06-14 07:18:51' where id = 12;
update commit set time_stamp = '2016-05-21 19:02:53' where id = 13;
update commit set time_stamp = '2016-06-03 18:11:09' where id = 14;
update commit set time_stamp = '2016-07-21 15:20:10' where id = 15;
update commit set time_stamp = '2016-05-27 11:38:16' where id = 16;
update commit set time_stamp = '2016-07-44 14:42:36' where id = 17;
update commit set time_stamp = '2016-07-44 14:42:36' where id = 18;
update commit set time_stamp = '2016-06-14 07:18:51' where id = 19;
update commit set time_stamp = '2016-06-22 11:02:33' where id = 20;
update commit set time_stamp = '2016-07-14 14:42:46' where id = 21;
update commit set time_stamp = '2016-07-04 17:12:01' where id = 22;
update commit set time_stamp = '2016-06-22 11:02:33' where id = 23;
update commit set time_stamp = '2016-06-03 18:11:09' where id = 24;
update commit set time_stamp = '2016-07-21 15:20:10' where id = 25;
update commit set time_stamp = '2016-05-27 11:38:16' where id = 26;
update commit set time_stamp = '2016-07-44 14:42:36' where id = 27;
update commit set time_stamp = '2016-06-14 07:18:51' where id = 28;
update commit set time_stamp = '2016-05-21 19:02:53' where id = 29;
update commit set time_stamp = '2016-05-01 12:21:05' where id = 30;
update commit set time_stamp = '2016-05-02 10:30:18' where id = 31;
update commit set time_stamp = '2016-06-29 08:38:26' where id = 32;
update commit set time_stamp = '2016-07-14 14:42:46' where id = 33;
update commit set time_stamp = '2016-07-04 17:12:01' where id = 34;
update commit set time_stamp = '2016-06-22 11:02:33' where id = 35;
update commit set time_stamp = '2016-07-04 17:12:01' where id = 36;
update commit set time_stamp = '2016-06-22 11:02:33' where id = 37;
update commit set time_stamp = '2016-06-03 18:11:09' where id = 38;
update commit set time_stamp = '2016-07-21 15:20:10' where id = 39;
update commit set time_stamp = '2016-05-27 11:38:16' where id = 40;
update commit set time_stamp = '2016-07-44 14:42:36' where id = 41;
update commit set time_stamp = '2016-06-14 07:18:51' where id = 42;
update commit set time_stamp = '2016-05-21 19:02:53' where id = 43;
update commit set time_stamp = '2016-06-03 18:11:09' where id = 44;
|
CREATE DATABASE IF NOT EXISTS `airlmsdb` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `airlmsdb`;
-- MySQL dump 10.13 Distrib 5.7.17, for macos10.12 (x86_64)
--
-- Host: localhost Database: airlmsdb
-- ------------------------------------------------------
-- Server version 5.7.20
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `annc`
--
DROP TABLE IF EXISTS `annc`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `annc` (
`anncId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`anncTitle` varchar(100) DEFAULT NULL,
`annc` varchar(1000) DEFAULT NULL,
`courseId` int(10) unsigned NOT NULL,
`anncPublish` tinyint(4) NOT NULL,
PRIMARY KEY (`anncId`),
UNIQUE KEY `annc_id_UNIQUE` (`anncId`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `annc`
--
LOCK TABLES `annc` WRITE;
/*!40000 ALTER TABLE `annc` DISABLE KEYS */;
INSERT INTO `annc` VALUES (3,'exam','sdfsdfsd',2,1),(4,'break','today is break',3,1),(5,'new student','Hkhhhkjerewrewr',3,1),(6,'new course','Khjbbhjjbjbhj',3,1),(8,'quiz','sdfdsf fdsfdd dsdsfdfdfsfdsdfd dfsfdffds sdfdsfdsf sdfdsfdfdsf',2,0),(9,'quiz-latest','dsfdsfdssdfdsf',2,0),(10,'exam change','jbkjbk',2,0),(11,'group study','jn,nmnm, ,n,n',2,0),(19,'final exam','cvcv',2,0),(21,'dsfsd','dsfdsfdsf',1,0),(22,'Final exam time change','The final is changed to Dec 12th',1,0),(23,'Final exam time change','The final exam will be changed to Dec12th',1,0),(24,'Test','this is a test for new announcement',1,0);
/*!40000 ALTER TABLE `annc` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `course`
--
DROP TABLE IF EXISTS `course`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `course` (
`courseId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`courseName` varchar(45) DEFAULT NULL,
`courseLoc` varchar(45) DEFAULT NULL,
PRIMARY KEY (`courseId`),
UNIQUE KEY `courseid_UNIQUE` (`courseId`)
) ENGINE=InnoDB AUTO_INCREMENT=909001 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `course`
--
LOCK TABLES `course` WRITE;
/*!40000 ALTER TABLE `course` DISABLE KEYS */;
INSERT INTO `course` VALUES (1,'computer vision','CSI'),(2,'enpm612','CSI'),(3,'algorithm','JMP'),(4,'data science','abc'),(5,'data mining','JMP'),(10,'music','AVW'),(77,'drawing','AVW'),(123,'art','TBA'),(1211,'vollyball','JMP'),(1999,'football','TBA'),(12345,'vollyball','ABD'),(909000,'XML technoloy','JMP');
/*!40000 ALTER TABLE `course` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `enrollment`
--
DROP TABLE IF EXISTS `enrollment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `enrollment` (
`courseId` int(11) NOT NULL,
`userId` int(11) NOT NULL,
PRIMARY KEY (`courseId`,`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `enrollment`
--
LOCK TABLES `enrollment` WRITE;
/*!40000 ALTER TABLE `enrollment` DISABLE KEYS */;
INSERT INTO `enrollment` VALUES (1,3),(1,4),(1,8),(1,22),(2,3),(2,15),(2,22),(3,3),(3,15),(3,22),(123,13),(123,14),(1999,2),(909000,22);
/*!40000 ALTER TABLE `enrollment` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `syllabus`
--
DROP TABLE IF EXISTS `syllabus`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `syllabus` (
`syllabusId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`syllabus` varchar(3000) DEFAULT NULL,
`courseId` int(10) unsigned NOT NULL,
`type` varchar(45) DEFAULT NULL,
`published` varchar(45) DEFAULT NULL,
PRIMARY KEY (`syllabusId`),
UNIQUE KEY `syllabus_id_UNIQUE` (`syllabusId`)
) ENGINE=InnoDB AUTO_INCREMENT=390 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `syllabus`
--
LOCK TABLES `syllabus` WRITE;
/*!40000 ALTER TABLE `syllabus` DISABLE KEYS */;
INSERT INTO `syllabus` VALUES (376,'this a test syllabus',2,'1','1'),(383,'test here!',3,'1','0'),(389,'this is a new syllabus',1,'1','0');
/*!40000 ALTER TABLE `syllabus` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`userId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`userName` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
`userRole` varchar(45) DEFAULT NULL,
PRIMARY KEY (`userId`),
UNIQUE KEY `userid_UNIQUE` (`userId`)
) ENGINE=InnoDB AUTO_INCREMENT=25 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 (1,'admin','admin','admin'),(2,'Danmei Ye','root','student'),(3,'Jinan','root','student'),(4,'Jinshuo','12345','student'),(5,'Kanaha','fsdfsd','student'),(6,'Joe','111111','student'),(7,'Jack','sdf','student'),(8,'Lisa','111111','student'),(9,'Minging','111111','instructor'),(10,'Zhang','sdfdsdsfsdf','student'),(21,'Mike','123456','instructor'),(22,'instructor','instructor','instructor'),(23,'Jinan1234','12345','student'),(24,'Ming Lee','123456','student');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-12-10 0:16:37
|
CREATE TABLE users (
user_id SERIAL PRIMARY KEY,
user_name VARCHAR(255),
user_email VARCHAR(255),
user_password VARCHAR(255)
);
--DUMMY USER
INSERT INTO users
(user_name, user_email, user_password)
VALUES
('MarioFanatic99', 'mario@mario.com', '123'); |
/* Formatted on 5/14/2019 4:52:35 PM (QP5 v5.206) */
-- Start of DDL Script for Table GPLATFORM.GAPI_SERVICES
-- Generated 5/14/2019 4:52:32 PM from GPLATFORM@HSDEV
CREATE TABLE gapi_services
(
id VARCHAR2 (255),
identifier VARCHAR2 (255),
name VARCHAR2 (255),
matchinguri VARCHAR2 (500),
matchinguriregex VARCHAR2 (500),
touri VARCHAR2 (500),
protected NUMBER (1, 0) DEFAULT 0,
apidocumentation VARCHAR2 (500),
iscachingactive NUMBER (1, 0) DEFAULT 0,
isactive NUMBER (1, 0) DEFAULT 1,
healthcheckurl VARCHAR2 (500),
lastactivetime NUMBER,
servicemanagementhost VARCHAR2 (250),
servicemanagementport VARCHAR2 (250),
ratelimit NUMBER,
ratelimitexpirationtime NUMBER,
isreachable NUMBER (1, 0) DEFAULT 0,
groupid VARCHAR2 (255),
usegroupattributes NUMBER (1, 0) DEFAULT 0,
protectedexclude CLOB,
hosts CLOB,
servicemanagementendpoints CLOB,
applicationgroupid VARCHAR2 (255),
CONSTRAINT gapiserv_id UNIQUE (id),
CONSTRAINT gapiserv_identifier UNIQUE (identifier),
CONSTRAINT gapiserv_uri UNIQUE (matchinguri),
CONSTRAINT gapiserv_urireg UNIQUE (matchinguriregex),
CONSTRAINT fk_gapi_service_groupid FOREIGN KEY (groupid) REFERENCES gapi_services_groups (id) ON DELETE SET NULL,
CONSTRAINT fk_gapi_appgroupid FOREIGN KEY (applicationgroupid) REFERENCES gapi_services_apps_groups (id) ON DELETE SET NULL
)
|
# Updating the schema version
UPDATE meta SET meta_value = 45 where meta_key = "schema_version";
# Add new column in the genomic_align_block table
ALTER TABLE genomic_align_block ADD group_id bigint unsigned DEFAULT NULL;
# Move "default" and "split" groups to the new column
UPDATE genomic_align_block gab, genomic_align ga, genomic_align_group gag SET gab.group_id = gag.group_id
WHERE gab.genomic_align_block_id = ga.genomic_align_block_id AND ga.genomic_align_id = gag.genomic_align_id
AND gag.type IN ("default", "split");
DELETE FROM genomic_align_group WHERE type IN ("default", "split");
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 10, 2018 at 09:49 AM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 7.2.1
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: `bloodbank`
--
-- --------------------------------------------------------
--
-- Table structure for table `bloodgroup`
--
CREATE TABLE `bloodgroup` (
`bg_id` int(100) NOT NULL,
`bg_name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `bloodgroup`
--
INSERT INTO `bloodgroup` (`bg_id`, `bg_name`) VALUES
(13, 'o+'),
(14, 'o-'),
(15, 'AB+'),
(16, 'AB-'),
(17, 'A+'),
(18, 'A-'),
(19, 'B+'),
(21, 'B-');
-- --------------------------------------------------------
--
-- Table structure for table `camp`
--
CREATE TABLE `camp` (
`camp_id` int(100) NOT NULL,
`camp_title` varchar(500) NOT NULL,
`organised_by` varchar(500) NOT NULL,
`state` int(100) NOT NULL,
`city` int(100) NOT NULL,
`pic` varchar(900) NOT NULL,
`detail` varchar(1000) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `camp`
--
INSERT INTO `camp` (`camp_id`, `camp_title`, `organised_by`, `state`, `city`, `pic`, `detail`) VALUES
(10, 'Matenzawa', 'Redcross', 10, 12, '1.jpg', 'Come donate blood and save lives'),
(11, 'Hazina ', 'Wold Health Organization', 7, 9, '1-199.jpg', 'Come and donate. Save a life today'),
(12, 'Thuguma', 'Redcross', 8, 11, '43e4Blood-donors.jpg', 'Lets save life'),
(13, 'Maasai Bazar', 'Redcross', 9, 10, '2015040715164038676.jpg', 'Blood needed to save lives'),
(14, 'Kilopi', 'Maurice ', 8, 11, 'Screenshot (6).png', 'Hello');
-- --------------------------------------------------------
--
-- Table structure for table `city`
--
CREATE TABLE `city` (
`city_id` int(100) NOT NULL,
`city_name` varchar(100) NOT NULL,
`pin_code` varchar(100) NOT NULL,
`district` varchar(100) NOT NULL,
`state` int(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `city`
--
INSERT INTO `city` (`city_id`, `city_name`, `pin_code`, `district`, `state`) VALUES
(9, 'Nairobi', '00100', 'Easteigh', 7),
(10, 'Isinya', '0800', 'Olerai', 9),
(11, 'Nyandarua', '0200', 'Sagana', 8),
(12, 'Ndalani', '0300', 'Tawani', 10),
(13, 'Skuta', '0800', 'Mothinga', 11),
(14, 'Kiluochi', '0300', 'Bondo', 12);
-- --------------------------------------------------------
--
-- Table structure for table `contacts`
--
CREATE TABLE `contacts` (
`row_id` int(100) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`mobile` varchar(100) NOT NULL,
`subj` varchar(700) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `contacts`
--
INSERT INTO `contacts` (`row_id`, `name`, `email`, `mobile`, `subj`) VALUES
(1, 'Daniel nganga ', 'nganga@gmail.com', '0712345345', 'when will the next donation be'),
(2, 'jobiso', 'jobomos@gmail.com', '0712345678', 'hello I want to donate blood');
-- --------------------------------------------------------
--
-- Table structure for table `donarregistration`
--
CREATE TABLE `donarregistration` (
`donar_id` int(100) NOT NULL,
`name` varchar(100) NOT NULL,
`gender` varchar(100) NOT NULL,
`age` varchar(100) NOT NULL,
`mobile` varchar(100) NOT NULL,
`b_id` int(100) NOT NULL,
`email` varchar(100) NOT NULL,
`pwd` int(100) NOT NULL,
`pic` varchar(1000) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `donarregistration`
--
INSERT INTO `donarregistration` (`donar_id`, `name`, `gender`, `age`, `mobile`, `b_id`, `email`, `pwd`, `pic`) VALUES
(21, 'Kamau waruinge', 'male', '24', '0718145129', 13, 'kamau10@gmail.com', 123, 'download.png'),
(22, 'kahama mukui', 'male', '23', '0718145128', 13, 'kahama94@gmail.com', 123, 'download.png'),
(23, 'Mukui kahama', 'female', '24', '0719761185', 13, 'mukui@gmail.com', 123, 'download.png'),
(24, 'Sadam Hussein', 'male', '24', '0723457432', 13, 'sadam@gmail.com', 123, 'download.png'),
(25, 'Kennedy Wahome', 'male', '23', '0718145132', 15, 'ken@gmail.com', 123, 'download.png'),
(26, 'daniel nganga', 'male', '40', '0712345345', 13, 'nganga@gmail.com', 123, 'download.png'),
(27, 'Job omondi', 'male', '23', '0712345890', 14, 'job@gmail.com', 123, 'WIN_20180306_18_02_18_Pro.jpg'),
(28, 'Faith Njeri', 'female', '24', '0721345678', 14, 'faith@gmail.com', 123, 'Maurice.jpg'),
(29, 'kahama', 'male', '24', '0718145129', 13, 'kahama94@gmail.com', 123, 'surprised-woman-cartoon-hand-drawn-image-drawing_csp51093395.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `donation`
--
CREATE TABLE `donation` (
`donation_id` int(100) NOT NULL,
`camp_id` int(100) NOT NULL,
`ddate` datetime NOT NULL,
`units` int(100) NOT NULL,
`detail` varchar(800) NOT NULL,
`email` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `donation`
--
INSERT INTO `donation` (`donation_id`, `camp_id`, `ddate`, `units`, `detail`, `email`) VALUES
(1, 11, '2018-03-03 00:00:00', 3, 'for a friend', 'nganga@gmail.com'),
(2, 10, '2018-04-20 00:00:00', 1, 'Donated blood in matenzawa', 'jobomos@gmail.com');
-- --------------------------------------------------------
--
-- Table structure for table `gallary`
--
CREATE TABLE `gallary` (
`camp_id` int(100) NOT NULL,
`pic_id` int(100) NOT NULL,
`title` varchar(400) NOT NULL,
`pic` varchar(800) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `gallary`
--
INSERT INTO `gallary` (`camp_id`, `pic_id`, `title`, `pic`) VALUES
(10, 45, 'Ready To Save ', '1-199.jpg'),
(10, 46, 'Life Matters', 'DSCF4819.jpg'),
(10, 47, 'Blood is Life', '43e4Blood-donors.jpg'),
(11, 48, 'Saving Life', '00431997-b9e1b755ceaa2f3d3e2cde8372d18b3b-arc614x376-w285-us1.png'),
(11, 49, 'Okoa Maisha', '50f2cbfe808447f28ccc22f1bd5be187.jpg'),
(11, 50, 'Life First', '_70186192_70186007 (1).jpg'),
(12, 51, 'Come All', '_70186192_70186007 (1).jpg'),
(12, 52, 'Life First', '43e4Blood-donors.jpg'),
(12, 53, 'Blood Needed', '1.jpg'),
(12, 54, 'Save Life First', '50f2cbfe808447f28ccc22f1bd5be187.jpg'),
(13, 55, 'Save a Life', '20130924-kenya-blood-drive-main-1.jpg'),
(13, 56, 'Life Saving Act', '201309231230310776.jpg'),
(13, 57, 'Come Save Lives', '1379873931048_1379873931048_r.jpg'),
(13, 58, 'Come All', '43e4Blood-donors.jpg'),
(14, 59, 'Kilopi', 'Screenshot (5).png');
-- --------------------------------------------------------
--
-- Table structure for table `requestes`
--
CREATE TABLE `requestes` (
`req_id` int(100) NOT NULL,
`name` varchar(100) NOT NULL,
`gender` varchar(100) NOT NULL,
`age` varchar(100) NOT NULL,
`mobile` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`bgroup` varchar(100) NOT NULL,
`reqdate` date NOT NULL,
`detail` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `state`
--
CREATE TABLE `state` (
`state_id` int(100) NOT NULL,
`state_name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `state`
--
INSERT INTO `state` (`state_id`, `state_name`) VALUES
(7, 'Nairobi'),
(8, 'Nyandarua'),
(9, 'Kajiado'),
(10, 'Makueni'),
(11, 'Nyeri'),
(12, 'Homabayi'),
(13, 'Embu'),
(15, 'Kwale');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`username` varchar(100) NOT NULL,
`pwd` varchar(100) NOT NULL,
`typeofuser` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`username`, `pwd`, `typeofuser`) VALUES
('manu', 'manu', 'Admin'),
('mukui', '123', 'General');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `bloodgroup`
--
ALTER TABLE `bloodgroup`
ADD PRIMARY KEY (`bg_id`);
--
-- Indexes for table `camp`
--
ALTER TABLE `camp`
ADD PRIMARY KEY (`camp_id`);
--
-- Indexes for table `city`
--
ALTER TABLE `city`
ADD PRIMARY KEY (`city_id`);
--
-- Indexes for table `contacts`
--
ALTER TABLE `contacts`
ADD PRIMARY KEY (`row_id`);
--
-- Indexes for table `donarregistration`
--
ALTER TABLE `donarregistration`
ADD PRIMARY KEY (`donar_id`);
--
-- Indexes for table `donation`
--
ALTER TABLE `donation`
ADD PRIMARY KEY (`donation_id`);
--
-- Indexes for table `gallary`
--
ALTER TABLE `gallary`
ADD PRIMARY KEY (`pic_id`);
--
-- Indexes for table `requestes`
--
ALTER TABLE `requestes`
ADD PRIMARY KEY (`req_id`);
--
-- Indexes for table `state`
--
ALTER TABLE `state`
ADD PRIMARY KEY (`state_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `bloodgroup`
--
ALTER TABLE `bloodgroup`
MODIFY `bg_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `camp`
--
ALTER TABLE `camp`
MODIFY `camp_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `city`
--
ALTER TABLE `city`
MODIFY `city_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `contacts`
--
ALTER TABLE `contacts`
MODIFY `row_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `donarregistration`
--
ALTER TABLE `donarregistration`
MODIFY `donar_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
--
-- AUTO_INCREMENT for table `donation`
--
ALTER TABLE `donation`
MODIFY `donation_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `gallary`
--
ALTER TABLE `gallary`
MODIFY `pic_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=60;
--
-- AUTO_INCREMENT for table `requestes`
--
ALTER TABLE `requestes`
MODIFY `req_id` int(100) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `state`
--
ALTER TABLE `state`
MODIFY `state_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
insert into company
(id,company_name,company_domain,status) values (1,'crystalball','crystalballcorp.com',1);
#--;
insert into company
(id,company_name,company_domain,status) values (2,'IBM','ibm.com',1);
#--;
insert into company
(id,company_name,company_domain,status) values (3,'Kana Communications','kana.com',1);
#--;
insert into company
(id,company_name,company_domain,status) values (4,'Kaiser Permanente','kp.org',1);
#--;
insert into company
(id,company_name,company_domain,status) values (5,'Oracle','oracle.com',1);
#--;
insert into company
(id,company_name,company_domain,status) values (6,'Electronic Arts','ea.com',1);
#--;
insert into company
(id,company_name,company_domain,status) values (7,'Cisco','cisco.com',1);
#--;
insert into company
(id,company_name,company_domain,status) values (8,'Apple','apple.com',1);
#--;
insert into company
(id,company_name,company_domain,status) values (9,'Network Appliance','netapp.com',1);
#--;
|
CREATE TABLE IF NOT EXISTS `phonebook` (
`id` int(11) NOT NULL auto_increment,
`firstname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
`age` int(11) NOT NULL,
`phonenumber` varchar(12) NOT NULL,
`type` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; |
CREATE TABLE rv.s_WeatherObservatoryLocation_DataPoint (
WeatherObservatoryLocationHashKey CHAR(32) NOT NULL
, LoadDate DATETIME2 NOT NULL
, RecordSource VARCHAR(500) NOT NULL
, HashDiff CHAR(32) NOT NULL
, [lat] NUMERIC(10,5)
, [lon] NUMERIC(10,5)
, [name] NVARCHAR(300)
, [country] NVARCHAR(300)
, [continent] NVARCHAR(300)
, [elevation] NUMERIC(10,5)
, CONSTRAINT [PK_s_WeatherObservatoryLocation_DataPoint] PRIMARY KEY NONCLUSTERED
(
WeatherObservatoryLocationHashKey ASC
, LoadDate ASC
)
); |
create table tblbooks(
id bigserial primary key,
name varchar,
author varchar,
category varchar
); |
CREATE OR REPLACE FORCE VIEW HDFIN.V1_MQ_912
(DE011, CZDM, DE084, DE083)
AS
select "DE011","CZDM","DE084","DE083" from (
select de011,'006' czdm,de084,de083 from cs083 where de022 = 110108 and nvl(jsde001,0) = 0 and nvl(hdde100,1) <> 9
union all
select de011,'006',de082,de081 from cs081 where de022 = 110108) order by de011,de084
/*银行mq通讯接口 912报文
DE011 年份
CZDM 财政代码 海财是006
DE084 预算科目编码
DE083 预算科目名你
create by xiazhong 2012.12.07
*/
;
|
SELECT Departments.Name
FROM Departments |
# SQL select query exercise
#
# World database layout:
# To use this database from a default MySQL install, type: use world;
# Table: City
# Columns: Id,Name,CountryCode,District,Population
# Table: Country
# Columns: Code, Name, Continent, Region, SurfaceArea, IndepYear, Population, LifeExpectancy, GNP, Capital
# Table: CountryLanguage
# Columns: CountryCode, Language, IsOfficial,Percentage
USE world;
# 1: Get a query to return "Hello World", 123
# (Hint: 1 row, 2 columns)
SELECT CONCAT('Hello ',SCHEMA_NAME,'!') AS Text, 123 AS Number FROM information_schema.schemata WHERE SCHEMA_NAME = 'world';
# 2: Get everything from the city table
# (Hint: Many many rows) (Only the first 100)
SELECT * FROM city LIMIT 0, 100;
# 3: Get everything on the cities whose district is "aceh"
# (Hint: 2 rows)
SELECT * FROM city WHERE District = 'aceh';
# 4: Get only the name of the cities where the countrycode is "bfa"
select Name from city where CountryCode = 'bfa';
# 5: Get both the name and district of the cities where the countrycode is "tto"
select Name, district from city where CountryCode = 'tto';
# 6: Get the name and district named as nm,dist from the cities where the countrycode is "arm"
select Name as nm, District as dist from city where CountryCode = 'arm';
# 7: Get the cities with a name that starts with "bor" (4 rows)
SELECT * FROM city WHERE Name LIKE 'Bor%';
# 8: Get the cities with a name that contains the string "orto" (7 rows)
SELECT * FROM city WHERE Name LIKE '%orto%';
# 9: Get the cities that has a population below 1000 (11 rows)
SELECT * FROM city WHERE population < 1000;
# 10: Get the unique countrycodes from the cities that has a population below 1000 (9 rows)
SELECT DISTINCT CountryCode FROM city WHERE population < 1000;
# 11: Get the cities with the countrycode UKR that has more than 1000000 (one million) in population
SELECT * FROM city WHERE population > 1000000 and countrycode = 'ukr';
# 12: Get the cities with a population of below 200 or above 9500000 (9.5 million) (7 rows)
SELECT * FROM city WHERE population > 9500000 OR population < 200;
# 13: Get the cities with the countrycodes TJK, MRT, AND, PNG, SJM (7 rows)
SELECT * FROM city WHERE countrycode IN ('tjk','mrt','and','png','sjm');
# 14: Get the cities with a population between 200 and 700 inclusive (7 rows)
SELECT * FROM city WHERE population >= 200 AND population <= 700;
# 15: Get the countries with a population between 8000 and 20000 inclusive (8 rows)
SELECT * FROM country WHERE population >= 8000 AND population <= 20000;
# 16: Get the name of the countries with a independence year (indepyear) before year 0
select Name from country where IndepYear < 0;
# 17: Get the countries that has no recorded independence year and a population above 1000000
SELECT * FROM country WHERE IndepYear IS NULL AND Population > 1000000;
# 18: Get countries with a SurfaceArea below 10 and a defined LifeExpectancy (2 rows)
SELECT * FROM country WHERE SurfaceArea < 10 AND LifeExpectancy IS NOT NULL;
|
insert into discount (amount, is_percent, tour_id, user_id) values (5, true, 4, 1); |
CREATE TABLE `t_tech_stat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tech_id` int(11) DEFAULT NULL,
`star_rate` float(5,2) DEFAULT '3.5' COMMENT '星级',
`balance` float(10,2) DEFAULT '0.00' COMMENT '余额',
`unpaid_orders` int(11) DEFAULT '0' COMMENT '未付账订单条数',
`total_orders` int(11) DEFAULT '0' COMMENT '订单总条数',
`comment_count` int(11) DEFAULT '0' COMMENT '评论条数',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_t_tech_stat_tech_id` (`tech_id`)
) DEFAULT CHARSET=utf8;
|
-- index-usage-awr.sql
-- jared still 2016-12-07
-- jkstill@gmail.com
--
-- not definitive, dependent on AWR data
-- the more AWR data, the better.
-- currently does not handle partition specific index info
-- eg. STATUS value is valid only for non-partitioned indexes
set linesize 300 trimspool on
set pagesize 60
col index_used_awr head 'IDX|USED|AWR' format a4
col index_type format a18
col owner format a15
col degree format a6
col leaf_blocks head 'LEAF|BLOCKS' format 99,999,999
col distinct_keys head 'DISTINCT|KEYS' format 9,999,999,999
col avg_leaf_blocks_per_key head 'AVG LEAF|BLOCKS|PER KEY' format 99,999,999
col avg_data_blocks_per_key head 'AVG DATA|BLOCKS|PER KEY' format 99,999,999
col clustering_factor head 'CLUSTER|FACTOR' format 9,999,999,999
col num_rows head 'NUM ROWS' format 9,9999,999,999
--spool index-usage-awr.txt
with users2chk as (
select
username
from dba_users
where default_tablespace not in ('SYSTEM','SYSAUX')
and username not in ('SQLTXPLAIN')
),
indexes as (
select owner, table_name, table_owner, index_name, join_index, partitioned, degree
, leaf_blocks, distinct_keys
, avg_leaf_blocks_per_key, avg_data_blocks_per_key
, clustering_factor, num_rows ,
case
when domidx_status is NULL then
case
when funcidx_status is NULL then
'BTREE - ' || status
when funcidx_status = 'ENABLED' then
'FUNCIDX - ENABLED'
when funcidx_status = 'DISABLED' then
'FUNCIDX - DISABLED'
else 'UNKNOWN IDX Type(1)'
end
when domidx_status = 'VALID' then
'DOMIDX - VALID'
when domidx_status = 'IDXTYP_INVLD' then
'DOMIDX - INVALID'
else
'UNKNOWN IDX Type(2)'
end index_type
from dba_indexes i
join users2chk u on u.username = i.owner
),
indexes_used as (
select distinct
object_owner owner
, object_name index_name
from dba_hist_sql_plan sp
join users2chk u on u.username = sp.object_owner
and sp.object_type = 'INDEX'
)
select i.owner
, t.table_name
, t.blocks - nvl(t.empty_blocks,0) table_blocks
, i.index_name
, i.index_type
, i.join_index
, i.partitioned , i.degree
, i.leaf_blocks, i.distinct_keys
, i.avg_leaf_blocks_per_key, i.avg_data_blocks_per_key
, i.clustering_factor, i.num_rows
, decode(iu.index_name,null,'NO','YES') index_used_awr
from indexes i
join dba_tables t on t.owner = i.table_owner
and t.table_name = i.table_name
full outer join indexes_used iu on iu.owner = i.owner
and iu.index_name = i.index_name
order by 1,2
/
--spool off
--ed index-usage-awr.txt
|
PRAGMA foreign_keys = OFF;
CREATE TABLE songs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
time INTEGER NOT NULL,
audio_url TEXT NOT NULL,
duration REAL,
lyrics TEXT
);
CREATE TABLE song_artists (
id INTEGER PRIMARY KEY AUTOINCREMENT,
artist_id INTEGER NOT NULL,
song_id INTEGER NOT NULL,
FOREIGN KEY (artist_id) REFERENCES artists (id),
FOREIGN KEY (song_id) REFERENCES songs (id)
);
CREATE TABLE album_artists (
id INTEGER PRIMARY KEY AUTOINCREMENT,
artist_id INTEGER NOT NULL,
album_id INTEGER NOT NULL,
FOREIGN KEY (album_id) REFERENCES albums (id),
FOREIGN KEY (artist_id) REFERENCES artists (id)
);
CREATE TABLE album_songs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
song_id INTEGER NOT NULL,
album_id INTEGER NOT NULL,
index_in_album INTEGER,
FOREIGN KEY (album_id) REFERENCES albums (id),
FOREIGN KEY (song_id) REFERENCES songs (id)
);
CREATE TABLE single_songs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
song_id INTEGER NOT NULL,
year INTEGER NOT NULL,
time INTEGER NOT NULL,
FOREIGN KEY (song_id) REFERENCES songs (id)
);
CREATE TABLE albums (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
year INTEGER,
time INTEGER NOT NULL
);
CREATE TABLE artists (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
time INTEGER NOT NULL
);
CREATE TABLE liked_songs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
song_id INTEGER NOT NULL,
time INTEGER NOT NULL,
FOREIGN KEY (song_id) REFERENCES songs (id)
);
CREATE TABLE playbacks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
time_started INTEGER NOT NULL,
time_ended INTEGER NOT NULL,
song_id INTEGER NOT NULL
);
CREATE TABLE pauses (
id INTEGER PRIMARY KEY AUTOINCREMENT,
time INTEGER NOT NULL,
playback_id INTEGER NOT NULL,
FOREIGN KEY (playback_id) REFERENCES playbacks (id)
);
CREATE TABLE resumes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
time INTEGER NOT NULL,
playback_id INTEGER NOT NULL,
FOREIGN KEY (playback_id) REFERENCES playbacks (id)
);
CREATE TABLE seeks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
time INTEGER NOT NULL,
position INTEGER NOT NULL,
playback_id INTEGER NOT NULL,
FOREIGN KEY (playback_id) REFERENCES playbacks (id)
);
|
SELECT user_id, meta_key, meta_value
FROM wp_usermeta
WHERE meta_key = 'rcp_expiration'
AND meta_value != 'none';
UPDATE wp_usermeta
SET meta_value = 'none'
WHERE meta_key = 'rcp_expiration'
AND meta_value != 'none';
|
SELECT SECCIÓN, SUM(PRECIO) FROM PRODUCTOS GROUP BY SECCIÓN;
/* seleccionamos la seccion y sumamos el precio de la tabla productos agrupados por seccion a la que corresponden */
SELECT SECCIÓN, SUM(PRECIO) AS SUMA_ARTICULOS FROM PRODUCTOS GROUP BY SECCIÓN;
/* Cambiar el nombre de la columna con la clausula as de modo que nos permita ordenar debido ala agrupacion */
SELECT SECCIÓN, SUM(PRECIO) AS SUMA_ARTICULOS FROM PRODUCTOS GROUP BY SECCIÓN ORDER BY Suma_Articulos;
/* Agrupado correctamente */
SELECT SECCIÓN, AVG(PRECIO) AS MEDIA_ARTICULOS FROM PRODUCTOS GROUP BY SECCIÓN HAVING SECCIÓN="DEPORTES" OR SECCIÓN="CONFECCIÓN" ORDER BY MEDIA_ARTICULOS;
/* Hallando la media de los precios totales de dos tablas y ordenandolos de menor a mayor segun su valor monetario */
SELECT POBLACIÓN, COUNT(POBLACIÓN) AS SUMA_POR_POBLACION FROM CLIENTES GROUP BY POBLACIÓN ORDER BY POBLACIÓN;
/* Seleccionar la poblacion y contar cuantos hay de esa misma poblacion transformar el nombre de la tabla clientes y agruparlo por poblacion y ordenarlo de menor a mayor */
SELECT SECCIÓN,/* No pueden ir un tercero se imprime el primer registro de la tabla no el mas alto */ MAX(PRECIO) AS PRECIO_MAYOR FROM PRODUCTOS GROUP BY SECCIÓN;
SELECT SECCIÓN,/* No pueden ir un tercero se imprime el primer registro de la tabla no el mas alto */ MAX(PRECIO) AS PRECIO_MAYOR FROM PRODUCTOS WHERE SECCIÓN="CERÁMICA" GROUP BY SECCIÓN;
SELECT SECCIÓN,/* No pueden ir un tercero se imprime el primer registro de la tabla no el mas alto */ MAX(PRECIO) AS PRECIO_MAYOR FROM PRODUCTOS WHERE SECCIÓN="CONFECCIÓN" GROUP BY SECCIÓN;
SELECT SECCIÓN,/* No pueden ir un tercero se imprime el primer registro de la tabla no el mas bajo */ MIN(PRECIO) AS PRECIO_MAYOR FROM PRODUCTOS WHERE SECCIÓN="CERÁMICA" GROUP BY SECCIÓN; |
SELECT FirstName, LastName FROM Employees
WHERE LEN([LastName])=5 |
/*
出运明细-产品资料
*/
delimiter $
drop trigger if exists Tgr_ShipmentsLine_AftereInsert $
create trigger Tgr_ShipmentsLine_AftereInsert after insert
on ShipmentsLine
for each row
begin
/*定义变量*/
declare sSOL_RecordID varchar(255);
set sSOL_RecordID=new.SOL_RecordID;
call Proc_SalesOrders_LsatShipingState(sSOL_RecordID);-- 销售合同-余货不发
call Proc_SalesOrders_SumShippingQty(sSOL_RecordID);-- 销售合同-出货数量
end$
delimiter ; |
select * from perposts where user_id = $1 |
/*
Ejercicio 5
Persona = (DNI (PK), Apellido, Nombre, Fecha_Nacimiento, Estado_Civil, Genero)
Alumno = (DNI (PK-FK), Legajo, Año_Ingreso)
Profesor = (DNI (PK-FK), Matricula, Nro_Expediente)
Titulo = (Cod_Titulo (PK), Nombre, Descripción)
Titulo-Profesor = (Cod_Titulo (PK-FK), DNI (PK-FK), Fecha)
Curso = (Cod_Curso (PK), Nombre, Descripción, Fecha_Creacion, Cantidad_Horas)
Alumno-Curso = (DNI (PK-FK), Cod_Curso (PK-FK), Año (PK), Desempeño, Calificación)
Profesor-Curso = (DNI (PK-FK), Cod_Curso (PK-FK), Fecha_Desde (PK), Fecha_Hasta)
*/
/* 1. Listar nombre, descripción y fecha de creación de los cursos que se encuentra inscripto el alumno con legajo 1089. Ordenar por nombre y fecha de creación descendentemente. */
SELECT Nombre, Descripción, Fecha_Creacion
FROM Curso AS C
INNER JOIN Alumno-Curso AS AC ON (C.Cod_Curso = AC.Cod_Curso)
INNER JOIN Alumno AS A ON (AC.DNI = A.DNI)
WHERE (A.Legajo = 1089)
ORDER BY Nombre DESC, Fecha_Creacion DESC
/* 2. Agregar un profesor con los datos que prefiera y con título ‘Licenciado en Sistemas’. */
INSERT INTO Persona (DNI, Apellido, Nombre, Fecha_Nacimiento, Estado_Civil, Genero)
VALUE (123456789, Ramirez, Pedro, 1/1/1950, "Casado", "Hombre")
INSERT INTO Alumno (DNI (PK-FK), Matricula, Nro_Expediente)
VALUE (123456789, 1, 1)
INSERT INTO Titulo-Profesor (Cod_Titulo (PK-FK), DNI (PK-FK), Fecha)
VALUES (SELECT Cod_Titulo FROM Titulo AS T WHERE (T.Nombre = "Licenciado en Sistemas"), 123456789, Date.Today)
/* 3. Listar el DNI, apellido, nombre y matrícula de aquellos profesores que posean menos de 5 títulos. Dicho listado deberá estar ordenado por apellido y nombre. */
SELECT DNI, apellido, nombre, matricula
FROM Profesor AS P
--INNER JOIN Titulo-Profesor AS TP ON (P.DNI = TP.DNI) -- NO CONTEMPLA NULOS
LEFT JOIN Titulo-Profesor AS TP ON (P.DNI = TP.DNI)
INNER JOIN Persona AS PP ON (P.DNI = PP.DNI)
GROUP BY Apellido, Nombre, Matricula, P.DNI
HAVING (COUNT(*) < 5)
ORDER BY Apellido, Nombre
/* 4. Listar el DNI, apellido, nombre y cantidad de horas que dicta cada profesor. */
SELECT DNI, Apellido, Nombre, SUM(Cantidad_Horas)
FROM Profesor AS P
INNER JOIN Profesor-Curso AS PC ON (P.DNI = PC.DNI)
INNER JOIN Persona AS PP ON (P.DNI = PP.DNI)
GROUP BY Apellido, Nombre, P.DNI
/* 5. Listar nombre,descripción del curso que posea más alumnos inscriptos y del que posea menos alumnos inscriptos durante 2016. */
SELECT Nombre, Descripción
FROM Curso AS C
INNER JOIN Alumno-Curso AS AC ON (C.Cod_Curso = AC.Cod_Curso)
WHERE (AC.Año = 2016)
GROUP BY Nombre, Descripción, C.Cod_Curso
HAVING (COUNT(*) >= ALL ( -- MAYOR O IGUAL POR SI HAY MÁS DE UN MÁXIMO
SELECT COUNT(*) AS cantAlumnos
FROM Alumno-Curso AS AC1
WHERE (AC.Año = 2016)
GROUP BY AC1.Cod_Curso)
OR
COUNT(*) <= ALL (
SELECT COUNT(*) AS cantAlumnos
FROM Alumno-Curso AS AC1
WHERE (AC.Año = 2016)
GROUP BY AC1.Cod_Curso))
/* 6. Listar el DNI, apellido, nombre, género y fecha de nacimiento de los alumnos inscriptos al curso con nombre “tuning de oracle” en 2019 y que no tengan calificación superior a 5 en ningún curso. */
/* 7. Listar el DNI, Apellido, Nombre, Legajo de alumnos que realizaron cursos durante 2018 pero no cursaron durante 2019. */
/* 8. Listar nombre, apellido, DNI, fecha de nacimiento, estado civil y género de profesores que tengan cursos activos actualmente o tengan de alumno al alumno DNI:34567487. */
/* 9. Dar de baja el alumno con DNI 38746662. Realizar todas las bajas necesarias para no dejar el conjunto de relaciones en estado inconsistente. */
/* 10. Listar para cada curso nombre y la cantidad de alumnos inscriptos en 2020. */
|
create procedure mERPFYCP_get_stkreq_received_count ( @yearenddate datetime )
as
Select count(*) from SRAbstractReceived where (status & 128) = 0 and DocumentDate <= @yearenddate
|
create table Iupload
(
ImageId int primary key identity,
ImageUrl varchar(100) not null,
ImageName varchar(50) not null
) |
CREATE TABLE Accounts (
username VARCHAR(20),
firstName VARCHAR(20),
lastName VARCHAR(20),
password VARCHAR(20),
contactNum VARCHAR(20),
email VARCHAR(40),
isSatff BOOLEAN,
);
INSERT INTO Accounts VALUES ('mike', 'Michael', 'Price', 'password', '0347259873', 'me@gmail', TRUE),
('tom', 'Thomas', 'Miller', 'password1', '4859285483', 'edgyman@hotmail', TRUE),
('jakeb', 'Jakeb', 'Pont', 'qwe', '8484848484', 'noobmaster69@yahoo', TRUE),
('pete', 'Peter', 'Parker', 'pass1', '48484848', 'spiderDude@gmail', FALSE),
('harry', 'Harry', 'Potter', 'pass2', '00000001', 'wizARdDude@hogworts', FALSE),
('john', 'John', 'Snow', 'pass3', '33849825', 'youaremyqueen@got', FALSE); |
PRAGMA foreign_keys = OFF
drop table if exists "Document"
PRAGMA foreign_keys = ON
create table "Document" (
Id TEXT not null,
OriginalName TEXT,
Description TEXT,
Date DATETIME,
Author TEXT,
FileName TEXT,
primary key (Id)
)
|
select sc_rdc.gerar_arquivo_habilita_produto_job()
select sc_rdc.enviar_arquivo_habilita_produto_cielo(1005708972);
|
-----------------------------------------------------------------------------------------------------------
-- List Databases
-- Configuration: /etc/hive/conf
-----------------------------------------------------------------------------------------------------------
SHOW DATABASES;
-----------------------------------------------------------------------------------------------------------
-- Create Database: Datawarehouse location: /user/hive/warehouse/rc_project_youtube.db
-----------------------------------------------------------------------------------------------------------
CREATE DATABASE IF NOT EXISTS rc_project_youtube;
-----------------------------------------------------------------------------------------------------------
-- Select Database to Use
-----------------------------------------------------------------------------------------------------------
USE rc_project_youtube;
-----------------------------------------------------------------------------------------------------------
-- CREATING AND LOADING DATA: BOOKS
-----------------------------------------------------------------------------------------------------------
-- Related Video ID Not required for Analysis
CREATE TABLE IF NOT EXISTS rc_project_youtube.videos
(id STRING, uploader STRING, interval INT, category STRING,
length INT, views INT, rating double, ratingcount INT,
comments INT)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;
LOAD DATA LOCAL INPATH '/mnt/home/edureka_424232/projects/youtube/artifacts/youtubedata.txt.txt'
OVERWRITE INTO TABLE rc_project_youtube.videos;
---------------------------------------------------------------------------------------------------------
-- A: Find out the top 5 categories with maximum number of videos uploaded.
----------------------------------------------------------------------------------------------------------
SELECT v.category, count(v.category) AS totalupload
FROM rc_project_youtube.videos v
GROUP BY v.category
ORDER BY totalupload desc
limit 5;
---------------------------------------------------------------------------------------------------------
-- B: Find out the top 10 rated videos.
----------------------------------------------------------------------------------------------------------
SELECT v.id, v.ratingcount
FROM rc_project_youtube.videos v
ORDER BY v.ratingcount desc
limit 10;
---------------------------------------------------------------------------------------------------------
-- C: Find out the most viewed videos.
----------------------------------------------------------------------------------------------------------
SELECT v.id, v.views
FROM rc_project_youtube.videos v
ORDER BY v.views desc
limit 1;
----------------------------------------------------------------------------------------------------------
-- Drop table:
----------------------------------------------------------------------------------------------------------
DROP TABLE rc_project_youtube.videos;
----------------------------------------------------------------------------------------------------------
-- Drop Database:
----------------------------------------------------------------------------------------------------------
DROP DATABASE rc_project_youtube; |
SELECT p.first_name, p.last_name, COUNT(DISTINCT(o.id)) as order_id, SUM(oi.quantity) as quantity, SUM((oi.quantity*(i.price-oi.discount))) AS total_money
FROM person p LEFT JOIN
(order_ o
JOIN order_item oi ON o.id = oi.order_id
JOIN item i
ON oi.item_id = i.id
) ON p.id = o.person_id
GROUP BY p.id |
CREATE procedure sp_acc_updateassetdetail(@batchnumber nvarchar(30),@accountid integer,
@apvid integer,@rate decimal(18,6),@mfrdate datetime,@location nvarchar(50),
@supplierid integer,@billno nvarchar(50),@billdate datetime = '',@assetsmfrno nvarchar(50),
@inspectiondate datetime,@warrantyperiod nvarchar(50),@insurancefromdate datetime,
@insurancetodate datetime,@amcfromdate datetime,@amctodate datetime,
@personresponsible nvarchar(50),@billamount decimal(18,6),@apvdate datetime,
@dateofcapitalization datetime = '')
as
insert into Batch_Assets(BatchNumber,
AccountID,
APVID,
Rate,
Saleable,
MfrDate,
Location,
SupplierID,
BillNo,
BillDate,
AssetsMfrNo,
InspectionDate,
WarrantyPeriod,
InsuranceFromDate,
InsuranceToDate,
AMCFromDate,
AMCToDate,
PersonResponsible,
BillAmount,
OPWDV,
APVDate,
CreationTime,
OldBillDate)
values(@batchnumber,
@accountid,
@apvid,
@rate,
1,
@mfrdate,
@location,
@supplierid,
@billno,
@dateofcapitalization,
@assetsmfrno,
@inspectiondate,
@warrantyperiod,
@insurancefromdate,
@insurancetodate,
@amcfromdate,
@amctodate,
@personresponsible,
@billamount,
@rate,
@apvdate,
getdate(),
@billdate)
|
INSERT INTO clients (
slug,
hash
) VALUES (?, ?)
|
SELECT productName as "Product Name", SUM(orderdetails.quantityOrdered) as "Total # Ordered",
SUM(orderdetails.quantityOrdered)*orderdetails.priceEach as "Total Sale"
FROM products
INNER JOIN orderdetails ON products.productCode=orderdetails.productCode
GROUP BY orderdetails.productCode
ORDER BY SUM(orderdetails.quantityOrdered)*orderdetails.priceEach DESC |
create procedure SP_DeleteUser
(
@UserID int
)
as begin
Delete from UserTable where
UserID = @UserID
end |
SELECT * FROM lineitems_3nf l
INNER JOIN donuts_3nf d ON d.DonutID = l.DonutID
INNER JOIN orders_3nf o ON o.OrderID = l.OrderID
INNER JOIN customers_3nf c ON c.CustomerID = o.CustomerID |
/*
Navicat Premium Data Transfer
Source Server : 本地数据库-mysql5.7
Source Server Type : MySQL
Source Server Version : 50724
Source Host : localhost:3306
Source Schema : wxlogin
Target Server Type : MySQL
Target Server Version : 50724
File Encoding : 65001
Date: 02/05/2019 11:33:43
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`open_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'open_id',
`skey` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'skey',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`last_visit_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后登录时间',
`session_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'session_key',
`city` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '市',
`province` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '省',
`country` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '国',
`avatar_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像',
`gender` tinyint(11) NULL DEFAULT NULL COMMENT '性别',
`nick_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网名',
PRIMARY KEY (`open_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '微信用户信息' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
|
CREATE TABLE `name` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
`permission` varchar(45) DEFAULT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_id_UNIQUE` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=70 DEFAULT CHARSET=utf8;
|
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: ifb299
-- ------------------------------------------------------
-- Server version 5.7.19-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `app_place_department`
--
DROP TABLE IF EXISTS `app_place_department`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `app_place_department` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`place_id` int(11) NOT NULL,
`department_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `app_place_department_place_id_e0240d3a_uniq` (`place_id`,`department_id`),
KEY `app_place_department_department_id_53950fe8_fk_app_department_id` (`department_id`),
CONSTRAINT `app_place_department_department_id_53950fe8_fk_app_department_id` FOREIGN KEY (`department_id`) REFERENCES `app_department` (`id`),
CONSTRAINT `app_place_department_place_id_d6b408db_fk_app_place_id` FOREIGN KEY (`place_id`) REFERENCES `app_place` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `app_place_department`
--
LOCK TABLES `app_place_department` WRITE;
/*!40000 ALTER TABLE `app_place_department` DISABLE KEYS */;
INSERT INTO `app_place_department` VALUES (1,2,2),(2,2,3),(3,2,4),(4,2,5),(5,2,6),(6,2,7),(7,3,2),(8,3,3),(9,3,4),(10,3,5),(11,3,6),(12,3,7),(13,4,2),(14,4,3),(15,4,4),(16,4,5),(17,4,6),(18,4,7),(19,5,2),(20,5,3),(21,5,4),(22,5,5),(23,5,6),(24,5,7),(25,6,2),(26,6,3),(27,6,5),(28,6,7),(29,6,8);
/*!40000 ALTER TABLE `app_place_department` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2017-10-28 18:26:44
|
/*
** Question: https://leetcode.com/problems/tournament-winners/
*/
-- method 1, Oracle
WITH Scores AS (
SELECT player, SUM(score) AS total_score
FROM (
SELECT first_player AS player, first_score AS score
FROM Matches
UNION ALL
SELECT second_player AS player, second_score AS score
FROM Matches
)
GROUP BY player
)
SELECT
t1.group_id, t1.player_id
FROM
(
SELECT
p.player_id,
p.group_id,
s.total_score,
RANK() OVER (
PARTITION BY p.group_id ORDER BY s.total_score DESC, p.player_id
) AS pos
FROM Players p
INNER JOIN Scores s
ON p.player_id = s.player
) t1
WHERE t1.pos = 1
|
SET SERVEROUTPUT ON
-- Exemplo de exception
DECLARE
v_idade number;
BEGIN
v_idade :='zzzzz';
EXCEPTION WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20001, 'Erro desconhecido: ' || sqlerrm );
END;
-- Outro exemplo utilizando 2 declarees
DECLARE
v_numero_par number;
v_erro_numero_par exception;
BEGIN
FOR x IN 1..10 LOOP
begin
if mod(x,2)=0 then
raise v_erro_numero_par;
end if;
exception when v_erro_numero_par then
DBMS_OUTPUT.PUT_LINE(X || 'É par');
-- RAISE_APPLICATION_ERROR(-20003, 'Erro desconhecido: ' || sqlerrm );
end;
END LOOP;
Exception
when others then
RAISE_APPLICATION_ERROR(-20001, 'Erro desconhecido: ' || sqlerrm );
END;
|
SELECT * FROM cicntp --Contacts
SELECT * FROM cicmpy --Company file - Companies and Vendors
SELECT * FROM bnkacc --Bank Account Cross Ref.
SELECT * FROM banktransactions --Bank Trx.
SELECT * FROM gbkmut --? AR/AP
SELECT * FROM amutak --? Cash Entries
SELECT * FROM amutas --
|
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table additional_info (
id bigint auto_increment not null,
full_name varchar(255),
userinfo bigint,
constraint uq_additional_info_userinfo unique (userinfo),
constraint pk_additional_info primary key (id)
);
create table contact_dto (
id bigint auto_increment not null,
user_id varchar(255),
friend_id varchar(255),
approved tinyint(1) default 0,
constraint pk_contact_dto primary key (id)
);
create table user (
id bigint auto_increment not null,
username varchar(255),
password varchar(255),
user_id varchar(255),
constraint pk_user primary key (id)
);
alter table additional_info add constraint fk_additional_info_userinfo foreign key (userinfo) references user (id) on delete restrict on update restrict;
# --- !Downs
alter table additional_info drop foreign key fk_additional_info_userinfo;
drop table if exists additional_info;
drop table if exists contact_dto;
drop table if exists user;
|
--2b
/*
DROP TABLE IF EXISTS AdventureWorksDW2019.dbo.stg_dimemp
DROP TABLE IF EXISTS AdventureWorksDW2019.dbo.scd_dimemp
--2a
SELECT dm.FirstName,dm.EmployeeKey, dm.LastName,dm.Title
INTO stg_dimemp
FROM DimEmployee as dm
WHERE dm.EmployeeKey BETWEEN 270 AND 275;
*/
--2c
/*
DROP TABLE IF EXISTS AdventureWorksDW2019.dbo.scd_dimemp
CREATE TABLE AdventureWorksDW2019.dbo.scd_dimemp
(EmployeeKey INT,
FirstName NVARCHAR(50),
LastName NVARCHAR(50),
Title NVARCHAR(50),
StartDate DATETIME,
EndDate DATETIME);
*/
/*
update stg_dimemp
set LastName = 'Nowak'
where EmployeeKey = 270;
update stg_dimemp
set TITLE = 'Senior Design Engineer'
where EmployeeKey = 274;
*/
/*
update stg_dimemp
set FIRSTNAME = 'Ryszard'
where EmployeeKey = 275
*/
/*
update Stg_DimEmp
set FIRSTNAME = 'Ryszard'
where EmployeeKey = 275;
*/
SELECT * FROM stg_dimemp;
SELECT * FROM scd_dimemp;
|
do $$
BEGIN
BEGIN
ALTER TABLE public."Usuario"
ADD COLUMN "TelefonoContacto" character varying;
EXCEPTION
WHEN duplicate_column THEN RAISE NOTICE 'column TelefonoContacto already exist in table Usuario.';
END;
END;
$$; |
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema bolsa_trabajo
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema bolsa_trabajo
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `bolsa_trabajo` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ;
USE `bolsa_trabajo` ;
-- -----------------------------------------------------
-- Table `bolsa_trabajo`.`t_admin`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bolsa_trabajo`.`t_admin` (
`id_admin` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(125) NULL DEFAULT NULL,
`materno` VARCHAR(125) NULL DEFAULT NULL,
`paterno` VARCHAR(125) NULL DEFAULT NULL,
`correo` VARCHAR(125) NULL DEFAULT NULL,
`contrasenia` VARCHAR(125) NULL DEFAULT NULL,
PRIMARY KEY (`id_admin`))
ENGINE = InnoDB
AUTO_INCREMENT = 4
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
-- -----------------------------------------------------
-- Table `bolsa_trabajo`.`t_categoria`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bolsa_trabajo`.`t_categoria` (
`id_categoria` INT NOT NULL AUTO_INCREMENT,
`id_admin` INT NOT NULL,
`nombre_categoria` VARCHAR(125) NULL DEFAULT NULL,
`descripcion` TEXT NULL DEFAULT NULL,
PRIMARY KEY (`id_categoria`),
INDEX `id_admin` (`id_admin` ASC) VISIBLE,
CONSTRAINT `t_categoria_ibfk_1`
FOREIGN KEY (`id_admin`)
REFERENCES `bolsa_trabajo`.`t_admin` (`id_admin`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
AUTO_INCREMENT = 4
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
-- -----------------------------------------------------
-- Table `bolsa_trabajo`.`t_municipios_alcaldias`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bolsa_trabajo`.`t_municipios_alcaldias` (
`id_municipios_alcaldias` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(125) NULL DEFAULT NULL,
PRIMARY KEY (`id_municipios_alcaldias`))
ENGINE = InnoDB
AUTO_INCREMENT = 81
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
-- -----------------------------------------------------
-- Table `bolsa_trabajo`.`t_reclutador`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bolsa_trabajo`.`t_reclutador` (
`id_reclutador` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(125) NULL DEFAULT NULL,
`materno` VARCHAR(125) NULL DEFAULT NULL,
`paterno` VARCHAR(125) NULL DEFAULT NULL,
`numero_telefonico` TEXT NULL DEFAULT NULL,
`correo` TEXT NULL DEFAULT NULL,
`contrasenia` TEXT NULL DEFAULT NULL,
PRIMARY KEY (`id_reclutador`))
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
-- -----------------------------------------------------
-- Table `bolsa_trabajo`.`t_trabajos`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bolsa_trabajo`.`t_trabajos` (
`id_trabajo` INT NOT NULL AUTO_INCREMENT,
`id_reclutador` INT NULL DEFAULT NULL,
`nombre_trabajo` VARCHAR(255) NULL DEFAULT NULL,
`salario` VARCHAR(225) NULL DEFAULT NULL,
`municipio_alcaldia` VARCHAR(225) NULL DEFAULT NULL,
`direccion` VARCHAR(225) NULL DEFAULT NULL,
`horario_entrada` VARCHAR(225) NULL DEFAULT NULL,
`horario_salida` VARCHAR(225) NULL DEFAULT NULL,
`dias_semana` VARCHAR(225) NULL DEFAULT NULL,
`requisitos` TEXT NULL DEFAULT NULL,
`tiempo_contratacion` VARCHAR(225) NULL DEFAULT NULL,
`fecha_insersion` DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id_trabajo`),
INDEX `id_reclutador` (`id_reclutador` ASC) VISIBLE,
CONSTRAINT `t_trabajos_ibfk_1`
FOREIGN KEY (`id_reclutador`)
REFERENCES `bolsa_trabajo`.`t_reclutador` (`id_reclutador`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
AUTO_INCREMENT = 28
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
#llenamos la tabla t_municipios_alcaldias
INSERT INTO t_municipios_alcaldias (nombre)VALUES ('acambay de ruíz castañeda'), ('acolman'), ('aculco'), ('almoloya de alquisiras'), ('almoloya de juarez'), ('almoloya del rio'),('amanalco'),('amatepec'),
('amecameca'), ('apaxco'), ('atenco'), ('atizapan'), ('atizapan de zaragoza'), ('atlacomulco'),('atlautla'),('axapusco'), ('ayapango'),('calimaya'),('chalpulhuac'),('coacalco de berriozabal'),('coatepec harinas'),('cocotitlan'),
('coyotepec'), ('cuautitlan'), ('chalco'), ('chapa de mota'), ('chapultepec'), ('chiaultla'),('chicoloapan'),('chiconcuac'), ('chimalhuacan'),('donato guerra'),('ecatepec de morelos'),('ecatzingo'),('huehuetoca'),('huehuetoca'),
('hueypoxtla'), ('huixquilucan'), ('isidro fabela'), ('ixtapaluca'), ('ixtapan de la sal'), ('ixtapan del oro'),('ixtalhuaca'),('xalatalco'), ('jaltenco'),('jilotepec'),('jilotzingo'),('jiquiplico'),('jocotitlan'),('joquincingo'),
('juchitepec'), ('lerma'), ('malinalco'), ('melchor ocampo'), ('metepec'), ('Mexicaltzongo'),('morelos'),('axapusco'), ('la paz'),('ozumba'),('papalotlan'),('temamatla'),('santo tomas'),('ocuilan');
INSERT INTO t_municipios_alcaldias (nombre)VALUES ('albaro obregon'), ('azcapotzalco'), ('benito juarez'), ('coyoacan'), ('Cuajimalpa'),('cuautemoc'),('gustavo a. madero'), ('izatacalco'), ('iztapalapa'),('magdalena contreras'),('miguel hidalgo'), ('milpa alta'), ('tlahuac'), ('talpan'), ('venustiano carranza'), ('xochimilco'); |
SELECT DISTINCT sq1.CART_ID
FROM(SELECT CART_ID
FROM CART_PRODUCTS
WHERE NAME = 'Milk') sq1
JOIN(SELECT CART_ID
FROM CART_PRODUCTS
WHERE NAME = 'Yogurt') sq2
ON sq1.CART_ID = sq2.CART_ID; |
-- bad-date.sql
-- Is there a year 0?
-- Oracle thinks there is
alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
select
to_date('0001-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss') bd,
to_date('0001-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss')-365 bd365,
to_date('0001-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss')-366 bd366
from dual
/
|
CREATE TABLE IF NOT EXISTS `se_shop_price_parameter` (
`id` bigint unsigned NOT NULL auto_increment,
`price_id` integer unsigned NOT NULL,
`parameter_id` integer unsigned NOT NULL,
`value` text,
`updated_at` timestamp NOT NULL default '0000-00-00 00:00:00' on update CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `price_id` (`price_id`),
KEY `parameter_id` (`parameter_id`)
) ENGINE=innoDB DEFAULT CHARSET=utf8;
ALTER TABLE `se_shop_price_parameter` ADD CONSTRAINT `se_shop_price_parameter_ibfk_1` FOREIGN KEY (`price_id`) REFERENCES `se_shop_price` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `se_shop_price_parameter` ADD CONSTRAINT `se_shop_price_parameter_ibfk_2` FOREIGN KEY (`parameter_id`) REFERENCES `se_shop_parameter` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
insert into exchange_value(id,frm,to,conversion_multiple) values(1,'USD','INR',75.05);
insert into exchange_value(id,frm,to,conversion_multiple) values(2,'ASD','INR',55.50);
insert into exchange_value(id,frm,to,conversion_multiple) values(3,'CAD','INR',70); |
Create table Goods
(Id int, Names varchar(30), Groups int, PRIMARY KEY (Id));
Create table GoodsGroups
(Id int, Names varchar (10), PRIMARY KEY (Id));
Create table GoodsSales
(Id int, Goods_Id int, Quantity int, Sale_date date, PRIMARY KEY (Id));
INSERT GoodsGroups VALUES (1, 'food');
INSERT GoodsGroups VALUES (2, 'furniture');
INSERT GoodsGroups VALUES (3, 'pets');
INSERT Goods VALUES (1, 'dog', 3);
INSERT Goods VALUES (2, 'table', 2);
INSERT Goods VALUES (3, 'apple',1);
INSERT Goods VALUES (4, 'lime',1);
INSERT Goods VALUES (5, 'chair',2);
INSERT Goods VALUES (6, 'bread',1);
INSERT Goods VALUES (7, 'cat',3);
INSERT GoodsSales VALUES (1, 1,2,'2020-08-04');
INSERT GoodsSales VALUES (2, 2,1,'2020-05-25');
INSERT GoodsSales VALUES (3, 3,2,'2019-08-17');
INSERT GoodsSales VALUES (4, 6,8,'2020-09-01');
INSERT GoodsSales VALUES (5, 2,1,'2013-12-04');
INSERT GoodsSales VALUES (6, 7,1,'2015-04-23');
INSERT GoodsSales VALUES (7, 1,6,'2013-12-04');
INSERT GoodsSales VALUES (8, 4,6,'2013-11-22');
INSERT GoodsSales VALUES (9, 5,1,'2017-09-24');
INSERT GoodsSales VALUES (10, 7,1,'2020-12-04');
|
/*
SQLyog Ultimate v10.42
MySQL - 5.5.36 : Database - db_jamkesda_r2
*********************************************************************
*/
/*!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*/`db_jamkesda_r2` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `db_jamkesda_r2`;
/*Table structure for table `tbl_class` */
DROP TABLE IF EXISTS `tbl_class`;
CREATE TABLE `tbl_class` (
`id_class` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama_class` varchar(50) DEFAULT NULL,
`keterangan_class` text,
PRIMARY KEY (`id_class`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_detail_idc` */
DROP TABLE IF EXISTS `tbl_detail_idc`;
CREATE TABLE `tbl_detail_idc` (
`id_detail_idc` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_idc` int(11) DEFAULT NULL,
`id_sjp_seo` int(11) DEFAULT NULL,
PRIMARY KEY (`id_detail_idc`)
) ENGINE=InnoDB AUTO_INCREMENT=524 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_detail_ppk` */
DROP TABLE IF EXISTS `tbl_detail_ppk`;
CREATE TABLE `tbl_detail_ppk` (
`id_detail_ppk` int(11) NOT NULL AUTO_INCREMENT,
`id_ppk` int(11) DEFAULT NULL,
`id_sjp_seo` int(11) DEFAULT NULL,
PRIMARY KEY (`id_detail_ppk`)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_hubungan` */
DROP TABLE IF EXISTS `tbl_hubungan`;
CREATE TABLE `tbl_hubungan` (
`id_hub` int(2) NOT NULL AUTO_INCREMENT,
`nama_hub` varchar(50) NOT NULL,
PRIMARY KEY (`id_hub`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_idc` */
DROP TABLE IF EXISTS `tbl_idc`;
CREATE TABLE `tbl_idc` (
`id_idc` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama_idc` varchar(150) NOT NULL,
`id_kategori_idc` int(11) unsigned NOT NULL,
PRIMARY KEY (`id_idc`),
KEY `fk_tbl_idc_tbl_kategori_idc1_idx1` (`id_kategori_idc`),
CONSTRAINT `fk_tbl_idc_tbl_kategori_idc1` FOREIGN KEY (`id_kategori_idc`) REFERENCES `tbl_kategori_idc` (`id_kategori_idc`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2272 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_jaminan` */
DROP TABLE IF EXISTS `tbl_jaminan`;
CREATE TABLE `tbl_jaminan` (
`id_jaminan` int(11) unsigned NOT NULL AUTO_INCREMENT,
`jumlah_jaminan` double DEFAULT NULL,
`keterangan_jaminan` text,
PRIMARY KEY (`id_jaminan`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_kartu_jaminan` */
DROP TABLE IF EXISTS `tbl_kartu_jaminan`;
CREATE TABLE `tbl_kartu_jaminan` (
`id_kartu_jaminan` int(11) NOT NULL AUTO_INCREMENT,
`kode_jaminan` varchar(48) DEFAULT NULL,
`tahun` varchar(12) DEFAULT NULL,
`aktif` enum('Y','N') DEFAULT 'Y',
`limit_kartu` enum('Y','N') NOT NULL DEFAULT 'N',
`id_jaminan` int(11) DEFAULT NULL,
`id_wilayah` int(11) DEFAULT NULL,
`id_peserta` int(11) DEFAULT NULL,
`id_stamp_edit` int(11) DEFAULT NULL,
`id_stamp_input` int(11) DEFAULT NULL,
`id_class` int(11) DEFAULT NULL,
PRIMARY KEY (`id_kartu_jaminan`)
) ENGINE=InnoDB AUTO_INCREMENT=378056 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_kategori_idc` */
DROP TABLE IF EXISTS `tbl_kategori_idc`;
CREATE TABLE `tbl_kategori_idc` (
`id_kategori_idc` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama_kategori_idc` varchar(5) DEFAULT NULL,
PRIMARY KEY (`id_kategori_idc`)
) ENGINE=InnoDB AUTO_INCREMENT=2037 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_kecamatan` */
DROP TABLE IF EXISTS `tbl_kecamatan`;
CREATE TABLE `tbl_kecamatan` (
`id_kecamatan` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama_kecamatan` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id_kecamatan`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_kelurahan` */
DROP TABLE IF EXISTS `tbl_kelurahan`;
CREATE TABLE `tbl_kelurahan` (
`id_kelurahan` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nama_kelurahan` varchar(25) DEFAULT NULL,
`kode_pos` varchar(7) DEFAULT NULL,
`id_kecamatan` int(11) DEFAULT '0',
PRIMARY KEY (`id_kelurahan`)
) ENGINE=MyISAM AUTO_INCREMENT=64 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_peserta` */
DROP TABLE IF EXISTS `tbl_peserta`;
CREATE TABLE `tbl_peserta` (
`id_peserta` int(11) NOT NULL AUTO_INCREMENT,
`nama_peserta` varchar(48) DEFAULT NULL,
`no_ktp` varchar(60) DEFAULT NULL,
`tempat_lahir` varchar(150) DEFAULT NULL,
`tanggal_lahir` date DEFAULT NULL,
`agama` varchar(24) DEFAULT NULL,
`rt` char(15) DEFAULT NULL,
`rw` char(15) DEFAULT NULL,
`alamat` text,
`kelurahan` varchar(75) DEFAULT NULL,
`kecamatan` varchar(75) DEFAULT NULL,
`kk` varchar(100) DEFAULT NULL,
`kode_pos_peserta` varchar(18) DEFAULT NULL,
`pekerjaan` varchar(30) DEFAULT NULL,
`no_telp` varchar(45) DEFAULT NULL,
`aktif` enum('Y','N') DEFAULT 'Y',
`jenis_kelamin` enum('L','P') DEFAULT NULL,
`id_stamp_edit` int(11) DEFAULT NULL,
`id_stamp_input` int(11) DEFAULT NULL,
PRIMARY KEY (`id_peserta`)
) ENGINE=InnoDB AUTO_INCREMENT=382449 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_ppk` */
DROP TABLE IF EXISTS `tbl_ppk`;
CREATE TABLE `tbl_ppk` (
`id_ppk` int(11) NOT NULL AUTO_INCREMENT,
`no_ppk` varchar(6) NOT NULL,
`tipe_ppk` varchar(2) NOT NULL,
`tipe_trf` varchar(3) NOT NULL,
`nama_ppk` varchar(50) NOT NULL,
`alamat_ppk` text NOT NULL,
`kota_ppk` varchar(50) NOT NULL DEFAULT 'Depok',
`tlp_ppk` varchar(15) NOT NULL,
`fax_ppk` varchar(25) NOT NULL,
PRIMARY KEY (`id_ppk`)
) ENGINE=MyISAM AUTO_INCREMENT=42 DEFAULT CHARSET=latin1 COMMENT='tabel_rumah_sakit_puskesmas_jamkesda';
/*Table structure for table `tbl_sjp_seo` */
DROP TABLE IF EXISTS `tbl_sjp_seo`;
CREATE TABLE `tbl_sjp_seo` (
`id_sjp_seo` int(11) unsigned NOT NULL AUTO_INCREMENT,
`no_sjp_seo` varchar(25) DEFAULT NULL,
`no_sjp` varchar(50) DEFAULT NULL,
`jenis_rawat` enum('jalan','inap') DEFAULT NULL,
`tgl_input` date DEFAULT NULL,
`tgl_masuk` date DEFAULT NULL,
`tgl_mulai_jaminan` date DEFAULT NULL,
`tgl_selesai_jaminan` date DEFAULT NULL,
`catatan_petugas` text,
`scanning` text,
`usg` text,
`lainnya` text,
`id_kartu_jaminan` int(11) unsigned DEFAULT NULL,
`id_stamp_edit` int(11) unsigned DEFAULT NULL,
`id_stamp_input` int(11) unsigned DEFAULT NULL,
`nip` varchar(25) DEFAULT NULL,
`dinas` varchar(50) DEFAULT NULL,
`atas_nama` varchar(50) DEFAULT NULL,
`jabatan` varchar(25) DEFAULT NULL,
`nama` varchar(35) DEFAULT NULL,
PRIMARY KEY (`id_sjp_seo`),
UNIQUE KEY `id_sjp_seo` (`id_sjp_seo`)
) ENGINE=MyISAM AUTO_INCREMENT=231 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_stamp_activity` */
DROP TABLE IF EXISTS `tbl_stamp_activity`;
CREATE TABLE `tbl_stamp_activity` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_user` int(11) DEFAULT NULL,
`login_time` varchar(25) DEFAULT NULL,
`logout_time` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=52 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_stamp_edit` */
DROP TABLE IF EXISTS `tbl_stamp_edit`;
CREATE TABLE `tbl_stamp_edit` (
`id_stamp_edit` int(11) unsigned NOT NULL AUTO_INCREMENT,
`tanggal_edit` datetime DEFAULT NULL,
`id_user` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id_stamp_edit`)
) ENGINE=MyISAM AUTO_INCREMENT=312 DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*Table structure for table `tbl_stamp_input` */
DROP TABLE IF EXISTS `tbl_stamp_input`;
CREATE TABLE `tbl_stamp_input` (
`id_stamp_input` int(11) unsigned NOT NULL AUTO_INCREMENT,
`tanggal_input` datetime DEFAULT NULL,
`id_user` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id_stamp_input`)
) ENGINE=MyISAM AUTO_INCREMENT=222 DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*Table structure for table `tbl_stamp_peralihan` */
DROP TABLE IF EXISTS `tbl_stamp_peralihan`;
CREATE TABLE `tbl_stamp_peralihan` (
`id_stamp_peralihan` int(11) NOT NULL AUTO_INCREMENT,
`tanggal` date DEFAULT NULL,
`id_kartu_jaminan` int(11) DEFAULT NULL,
`id_user` int(11) DEFAULT NULL,
PRIMARY KEY (`id_stamp_peralihan`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_tahun` */
DROP TABLE IF EXISTS `tbl_tahun`;
CREATE TABLE `tbl_tahun` (
`id_tahun` int(11) unsigned NOT NULL AUTO_INCREMENT,
`tahun` varchar(4) DEFAULT NULL,
`keterangan_tahun` text,
PRIMARY KEY (`id_tahun`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*Table structure for table `tbl_user` */
DROP TABLE IF EXISTS `tbl_user`;
CREATE TABLE `tbl_user` (
`id_user` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(25) DEFAULT NULL,
`username` varchar(25) DEFAULT NULL,
`password` varchar(35) DEFAULT NULL,
`active` enum('Y','N') DEFAULT 'Y',
`level` enum('user','admin') DEFAULT NULL,
`photo` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id_user`)
) ENGINE=MyISAM AUTO_INCREMENT=38 DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
/*Table structure for table `tbl_wilayah` */
DROP TABLE IF EXISTS `tbl_wilayah`;
CREATE TABLE `tbl_wilayah` (
`id_wilayah` int(11) NOT NULL AUTO_INCREMENT,
`no_wilayah` varchar(4) DEFAULT NULL,
`nama_wilayah` varchar(100) DEFAULT NULL,
`nama_kecamatan` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id_wilayah`)
) ENGINE=MyISAM AUTO_INCREMENT=80 DEFAULT CHARSET=latin1;
/*!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 */;
|
CREATE PROCEDURE [sp_insert_TargetMeasure]
(@Description_2 [nvarchar](128))
AS INSERT INTO [TargetMeasure]
([Description])
VALUES
(@Description_2)
select @@identity
|
DATABASE NAMR `test`
loging table name `form`
urlshort table name `url_shorten`
CREATE TABLE IF NOT EXISTS `url_shorten` (
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`url` tinytext NOT NULL,
`short_code` varchar(50) NOT NULL,
`hits` int(11) NOT NULL,
`added_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
INSERT INTO `redirect` VALUES ('a', 'https://github.com/rajatranjan/php-url-shortener', NOW(), 1); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.