text stringlengths 6 9.38M |
|---|
DROP DATABASE IF EXISTS meme_battle;
CREATE DATABASE meme_battle;
-- for the manager account
INSERT INTO users
(email, password,isManager, createdAt, updatedAt)
VALUES("chaosdoggs522@gmail.com", "Chaosdo1", true, "2018-12-02 16:25:26", "2018-12-02 16:25:26" );
INSERT INTO clickerUpgrades
(clickPower, morePe... |
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 25, 2019 at 05:04 AM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 5.6.30
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SE... |
UPDATE Jogo SET Descricao = 'SEM DESCRIÇÃO'
ALTER TABLE Jogo ADD Descricao VARCHAR(MAX) NOT NULL;
ALTER TABLE Jogo ADD Imagem VARCHAR(MAX)
ALTER TABLE Jogo ADD Video VARCHAR(MAX)
ALTER TABLE Jogo ADD IdSelo INT NOT NULL DEFAULT 1 CONSTRAINT FK_IdSelo FOREIGN KEY REFERENCES Selo(Id); |
CONNECT TO STAGING
;
ALTER TABLE eaadmin.LICENSE
ADD COLUMN PID VARCHAR(32)
;
REORG TABLE EAADMIN.LICENSE use TEMPSPACE1; |
DROP TABLE IF EXISTS public.dim_city;
CREATE TABLE IF NOT EXISTS public.dim_city (
city varchar(256),
state_code varchar(50),
city_id BIGINT,
PRIMARY KEY(city_id)
);
DROP TABLE IF EXISTS public.dim_airport_codes;
CREATE TABLE IF NOT EXISTS public.dim_airport_codes (
icao_code varchar(256),
type varchar(256),
... |
-- +goose Up
create table accounts (
id varchar(128) primary key,
created_at timestamp default now(),
fullname text,
email text not null unique,
username text
);
-- +goose Down
drop table accounts;
|
alter table boyo_user add subId int(11) not Null;
CREATE TABLE IF NOT EXISTS `boyo_appTask` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`appId` int(11) NOT NULL,
`userId` int(11) NOT NULL,
`likeGame` int(11) NOT NULL, ... |
-- MySQL dump 10.13 Distrib 8.0.23, for Win64 (x86_64)
--
-- Host: gymdb.cn9na2fi4oel.ap-south-1.rds.amazonaws.com Database: Gym Database
-- ------------------------------------------------------
-- Server version 8.0.20
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHA... |
DROP DATABASE IF EXISTS dsw;
CREATE DATABASE dsw;
USE dsw;
CREATE TABLE IF NOT EXISTS tb_users (
id int AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255),
email VARCHAR(255),
password VARCHAR(255),
created_at TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS tb_tasks (
id int... |
--description <prevents insertion of bids before the auction start time and after the aution end time>
pragma foreign_keys = on;
drop trigger if exists trigger11;
create trigger trigger11 before insert on bids
when (select strftime('%Y%m%d%H%M%S',new.time)) < (select strftime('%Y%m%d%H%M%S',(select started
... |
-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Oct 11, 2018 at 10:47 AM
-- Server version: 10.1.25-MariaDB
-- PHP Version: 7.1.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 04, 2021 at 05:24 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIE... |
CREATE procedure sp_insert_Subchannel(@SubChannelDesc nVarchar(255))
As
If Not Exists(Select SubChannelID From SubChannel Where Description=@SubChannelDesc)
Begin
Insert Into SubChannel (Description) Values (@SubChannelDesc)
Select @@IDENTITY
End
Else
Select 0
|
--// ROUND: 숫자 반올림
SELECT salary,
salary/30 일급,
ROUND(salary/30, 0) 적용결과0,
ROUND(salary/30, 1) 적용결과1,
ROUND(salary/30, -1) 적용결과minus1
FROM employees;
--// TRUNC: 숫자 절삭(버림
SELECT salary,
salary/30 일급,
TRUNC(salary/30, 0) 적용결과0,
TRUNC(salary/30, 1) 적용결과1,
TRUNC(salary/30, -1) 적용결과minus1
F... |
select memberName, MEMEBERADDRESS from memberTBL;
select * from MEMBERTBL where MEMBERNAME='Áö¿îÀÌ';
create table "my testTBL" (id number(3));
drop table "my testTBL"; |
■問題
以下はアンケート回答テーブル(quest)から都道府県、性別ごとに評価平均を求める為のSQL命令ですが、
2点誤りがあります。誤りを指摘してください。
SELECT
prefecture,
sex,
age,
AVG(answer1) IS 評価平均
FROM
quest
GROUP BY
prefecture,
sex
;
■指摘・実行文
指摘1:別名を設定する場合はISではなくASを使用する必要がある
指摘2:グループ化を行う場合取得列には集計対象となる列しか指定できないためageは取得列に指定できない
# 都道府県、性別ごとに評価平均値を評価平均と別名をつけ取得
SELECT
prefecture,
... |
DROP TABLE IF EXISTS `User_Management_Data`;
Create table User_Management_Data(
`ID` bigint(20) NOT null AUTO_INCREMENT,
`Description` varchar(200) default null,
`Safe_Rating` bigint(10) not null,
`Safe_Time` varchar(100) not null,
`Journey_Starting_Point` varchar(200) not null,
`Journey_Destination_Poin... |
-- Table definitions for the tournament project.
-- The purpose of this file is to set up our data structure: the tables and views.
--
-- drop if exists
DROP DATABASE IF EXISTS tournament;
-- create database
Create database tournament;
-- connect the database
\c tournament
-- drop if exists
DROP TABLE IF EXISTS P... |
USE psdb;
SELECT *
FROM psdb.employees where psdb.employees.first_name="Basil" and psdb.employees.gender<>"M";
|
SELECT
id
, name
, LENGTH(name) AS length_name
, REPLACE(name, 'スナック', 'ポテトチップス') AS replace_name
FROM
receipt_item
ORDER BY
id
LIMIT
5;
/*
id | name | length_name | replace_name
----+------------+-------------+-----------------
1 | スナックA | 5 | ポテトチップスA
2 | さくらんぼ | ... |
/* Создание таблицы ролей пользователя */
CREATE TABLE /*PREFIX*/ACCOUNT_ROLES
(
ROLE_ID VARCHAR(32) NOT NULL,
ACCOUNT_ID VARCHAR(32) NOT NULL,
PRIMARY KEY (ROLE_ID,ACCOUNT_ID),
FOREIGN KEY (ROLE_ID) REFERENCES /*PREFIX*/ACCOUNTS (ACCOUNT_ID),
FOREIGN KEY (ACCOUNT_ID) REFERENCES /*PREFIX*/ACCOUNTS (ACCOUNT_I... |
CREATE TABLE IF NOT EXISTS payments (
id serial,
customer_name varchar(255) not null,
primary key(product_id)
);
INSERT INTO payments(customer_name) VALUES ("alvin.tan@tokopedia.com");
INSERT INTO payments(customer_name) VALUES ("aliyyil.mustofa@tokopedia.com");
INSERT INTO payments(customer_name) VALUES... |
drop table if exists Tract;
drop table if exists County;
CREATE TABLE County (
CountyId varchar(128) not null,
State varchar(128) not null,
CountyName varchar(128) not null,
Primary Key (CountyId)
);
CREATE TABLE Tract (
TractId BIGINT(20) not null,
State varchar(128) not null,
CountyId varchar... |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 15, 2019 at 09:39 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.3.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
CREATE TABLE departments(
department_id INT AUTO_INCREMENT,
department_name VARCHAR(30) NOT NULL,
over_head_costs DECIMAL NOT NULL,
PRIMARY KEY (department_id)
);
INSERT INTO departments(department_name, over_head_costs)
VALUES ('Electronics', 10000);
INSERT INTO departments(department_name, over_head_co... |
SET foreign_key_checks = 0;
use sa;
CREATE TABLE sa.teams_to_update AS (
SELECT ot.id as id, t.team_long_name as name
FROM european_soccer.teams as t JOIN sa.participants_football_lookup as l ON t.team_api_id = l.id_esdb
JOIN ods.participants as ot ON l.id_ods=ot.id
WHERE t.team_long_name <> ot.name
);
UPDATE o... |
CREATE FUNCTION RLARP.FN_CONSH(TCOM VARCHAR(2))
RETURNS TABLE (COMP VARCHAR(100), DESCR VARCHAR(100), CURR VARCHAR(2), CONS VARCHAR(100))
--should add a parameter that is the target company or consolidation level such that a list of child companies are returned
RETURN
WITH RECURSIVE CH
(PRNT, CHLD, LVL, IDX)
AS
(
... |
DROP TABLE if exists employee_dtl;
DROP TABLE if exists AUTHORITIES;
DROP TABLE if exists USERS;
DROP TABLE if exists app_users;
create table employee_dtl (
id varchar(255) not null,
email varchar(255),
name varchar(255),
primary key (id)
);
create table users (
username varchar(50) not null primary key,
... |
## TAQ & CRSP cusip merge scripts ##
#---------------------------------------------------------------------------------------------------
# IMPORT DATA
#---------------------------------------------------------------------------------------------------
SET GLOBAL innodb_file_per_table=1;
# crsp_msenames
CREATE TABLE... |
USE courseplanner;
drop table selection_sets;
drop table completion_req;
drop table course_offerings;
drop table prereqs;
drop table degree;
drop table courses;
drop database courseplanner; |
-- phpMyAdmin SQL Dump
-- version 3.5.2
-- http://www.phpmyadmin.net
--
-- Host: internal-db.s142412.gridserver.com
-- Generation Time: Feb 07, 2017 at 01:26 AM
-- Server version: 5.6.32-78.1
-- PHP Version: 5.3.29
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT... |
set echo on;
set serveroutput on;
CREATE OR REPLACE TRIGGER trg_prod_QOH_on_line_delete
AFTER DELETE ON LINE FOR EACH ROW
BEGIN
UPDATE PRODUCT
SET P_QOH = P_QOH + :old.LINE_UNITS
where P_CODE = :old.P_CODE;
END;
/
COMMIT;
SELECT P_CODE, P_QOH FROM PRODUCT WHERE P_CODE='54778-2T';
SELECT * FROM LINE WHERE P_CODE='5477... |
CREATE DEFINER=`administrator`@`localhost` PROCEDURE `selectBusinessImages`(IN BID int)
BEGIN
SELECT bi.name, bi.path
FROM business_images bi
WHERE bi.business_id = BID;
END |
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 15, 2020 at 07:36 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.1.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OL... |
WITH CUR AS (
SELECT
MAST,
MPLT,
------resin requirement qty--------------------------------------------
SUM(
CASE MAJG||RQBY||REPL
WHEN '710R2' THEN
ERQTY
ELSE 0
END
) RES_REQ_QTY,
------resin byproduct qty----------------------------------------------
SUM(
CASE MAJG||RQBY||REPL
... |
SELECT DISTINCT(name) FROM people
INNER JOIN stars ON stars.person_id = people.id
INNER JOIN movies ON movies.id = stars.movie_id
WHERE movies.id IN
(
SELECT movie_id FROM movies
INNER JOIN stars ON stars.movie_id = movies.id
INNER JOIN people ON people.id = stars.person_id
WHERE p... |
CREATE TABLE `notes` (
`id` int(9) NOT NULL,
`usr_id` int(9) NOT NULL,
`note` varchar(2048) NOT NULL,
`type` int(2) NOT NULL,
`created` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`expired` datetime NOT NULL,
`project_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
CREATE TABLE `basecollectionitem` (
`TableId` int(11) NOT NULL AUTO_INCREMENT,
`Id` char(64) DEFAULT NULL,
`Data` blob,
`ItemProcessed` tinyint(1) DEFAULT NULL,
`CreatedDate` datetime DEFAULT NULL,
PRIMARY KEY (`TableId`),
UNIQUE KEY `TableId_UNIQUE` (`TableId`),
UNIQUE KEY `Id_UNIQUE` (`Id`)
) ENGINE=I... |
-- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Host: localhost:8889
-- Generation Time: Nov 23, 2015 at 08:37 AM
-- Server version: 5.5.34
-- PHP Version: 5.5.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `testtask`
--
-- ---------------------------... |
/* -*- coding: utf-8 -*- */
--
-- 商品と在庫
--
-- 商品
create table items (
id integer primary key
, name varchar(255) not null unique
);
insert into items (id, name)
values (1001, '天気の子 パンフレット')
, (1002, '天気の子 サントラCD')
, (1003, '小説 天気の子')
;
-- 在庫
create table inventories (
item_id int... |
SELECT * FROM items
WHERE item_type LIKE '%' || $1 || '%'; |
-- Limpa sessoes nesse banco de dados
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'todo'
AND pid <> pg_backend_pid();
-- Exclui banco de dados se existe
DROP DATABASE IF EXISTS todo;
-- Cria o banco de dados
CREATE DATABASE todo;
-- Create Usuário
CR... |
/*
Name : vwPersonProfile
Object Type: VIEW
Dependency : PERSON(TABLE), PROFILE(TABLE)
*/
use BIGGYM;
create or replace view vwPersonProfile as
select
per.ID PERSONid,
prf.ID PERSONPROFILEid,
per.FIRST_NAME,
per.LAST_NAME,
per.BIRTH_DATE DOB,
per.gender,
per.body_heigh... |
drop DATABASE if EXISTS mybatis;
create database if not EXISTS mybatis DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
use mybatis;
CREATE TABLE t_user
(
user_id BIGINT AUTO_INCREMENT
COMMENT '用户ID'
PRIMARY KEY,
user_name VARCHAR(64) NOT NULL
COMMENT '用户名',
mobile VAR... |
CREATE TABLE `dpd_settings` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL DEFAULT '',
`value` TEXT NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; |
-- customer_group_map
--
-- This table contains what customers belong in what user groups.
CREATE TABLE customer_group_map (
user_group_id NUMBER NOT NULL REFERENCES user_groups(id), -- The group associated with this record
customer_id NUMBER NOT NULL REFERENCES customers(id), -- The customer associated with this r... |
create database ClothesFirm;
use ClothesFirm;
create table Store(
StoreID char(8),
ManagerID char(8),
StoreName nvarchar(50),
StoreLocation nvarchar(20),
StoreAddress nvarchar(100),
StorePhone nvarchar(20),
primary key(StoreID)
);
create table Staff(
StaffID char(8),
StoreID char(8),
StaffName nvarchar(50),
StaffSal... |
create or replace function ea.passwordCheck(@password long varchar)
returns integer
begin
if @password not regexp '(?=^.{6,}$)((?=.*\d)|(?=.*\W))(?=.*[a-z])(?=.*[A-Z]).*$' then
return 0
else
return 1
end if
end
;
|
CREATE TABLE child_test (
`id` INT,
`name` TEXT,
`parent_id_1` INT,
`parent_id_2` VARCHAR(255),
PRIMARY KEY (`id`)
);
|
-- phpMyAdmin SQL Dump
-- version 4.4.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 08, 2017 at 02:06 PM
-- Server version: 5.6.26
-- PHP Version: 5.5.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;... |
CREATE proc spr_get_customer_from_beat
(
@Categoryid int,
@Beatid int,
@FromDate datetime,
@ToDate datetime
)
as
select customer.customerid , customer.company_name, sum(invoicedetail.amount)
from invoiceabstract, invoicedetail, Customer, items
where
invoiceabstract.invoiceid = invoicedetail.invoicei... |
/*
Name: MG Views From Widgets detailing target
Data source: 4
Created By: Admin
Last Update At: 2015-10-09T15:22:15.170538+00:00
*/
SELECT date, replace(widget,'mansion_global_','') AS widget,
sum(CASE WHEN page_url CONTAINS '/developments/' THEN Amount ELSE integer('0') END) AS Developments,
... |
CREATE PROCEDURE SP_Insert_DispatchDetail
(@DispatchID [int],
@Product_Code [nvarchar](15),
@Quantity Decimal(18,6),
@Batch_Code [int],
@SalePrice Decimal(18,6),
@FlagWord [int],
@UOM [decimal],
@UOMQty Decimal(18,6),
@UOMPrice Decimal(18,6))... |
1) WAQ to display all software developers in dept 30.
Solution -> select * from employee where job='junior Engineer';
2)WAQ to display the list for all the software developer in dept no 40 and havong salary greater than 5000.
Solution -> select * from employee where job='junior Engineer' and dept_no=40 and salary>... |
use dbJinShop;
create table ROLE (
roleId integer auto_increment,
roleCode char(5),
roleName nvarchar(10),
primary key(roleId)
);
create table STAFF(
staffId integer auto_increment,
fullName nvarchar(50),
userName varchar(50),
password varchar(50),
age integer,
gender bit,
addres... |
DECLARE
studentname intern.first_name %TYPE := 'Gizemnur';
universityname intern.university %TYPE;
PROCEDURE FindUniversity
(firstname IN intern.first_name %TYPE , universityname OUT intern.university %TYPE )
IS
BEGIN
SELECT university into universityname FROM intern WHERE (first_na... |
INSERT INTO core_crm_available_service(
myid,mykatastima,title, aliasname)
VALUES (1,:mykatastima,'Κούρεμα', 'kourema'),
(2,:mykatastima,'Λούσιμο', 'lousimo'),
(3,:mykatastima,'Βάψιμο', 'vapsimo'),
(4,:mykatastima,'Ανταύγιες', 'antavgies');
|
insert into employees (id, "name", last_name, "position",regular_post,count_of_vacation,count_of_children_care)
values (1000, 'Adam', 'Smith', 'Manage', 'Full', 26, 8);
insert into employees (id, "name", last_name, "position",regular_post,count_of_vacation,count_of_children_care)
values (1001, 'Jan', 'Nowak', 'Program... |
TIPO B
Nombre: <Pon aquí tu nombre>
************************************************************************
INSTRUCCIONES:
==============
-Salva este fichero con las iniciales de tu nombre y apellidos,
en el directorio "C:\Examen\ ":
Ejemplo: José María Rivera Calvete
JMRC.txt
-Pon tu nombre al ejercicio y ... |
CREATE TABLE TREKK_I_LOEPENDE_UTBETALING
(
ID BIGINT PRIMARY KEY,
FK_BEHANDLING_ID BIGINT REFERENCES BEHANDLING (ID) NOT NULL,
FOM TIMESTAMP(3),
TOM TIMESTAMP(3),
FEILUTBETALT_BELOEP NUMERIC,
VERSJON BIGINT DEFAULT 0 ... |
insert into shared_entry(shared_entry_id, entry_id, quote, account_id)
values (1,1,'LOL',1),
(2,2,'Great',2),
(3,2,'Happy',3)
;
|
/* Создание таблицы стоянок */
CREATE TABLE /*PREFIX*/PARKS
(
PARK_ID VARCHAR(32) NOT NULL,
STREET_ID VARCHAR(32) NOT NULL,
HOUSE VARCHAR(10),
NAME VARCHAR(100) NOT NULL,
DESCRIPTION VARCHAR(250) NOT NULL,
MAX_COUNT INTEGER,
PRIORITY INTEGER,
PRIMARY KEY (PARK_ID),
FOREIGN KEY (STREET_ID) REFERENCES ... |
CREATE KEYSPACE play WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
CREATE TABLE tweets (
track text,
tweet_date timeuuid,
tweet blob,
PRIMARY KEY ((track), tweet_date)
) WITH CLUSTERING ORDER BY (tweet_date desc) AND
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
c... |
-- 1 Listado de todos los clientes.
SELECT * FROM Clientes
-- 2 Listado de todos los proyectos.
SELECT * FROM Proyectos
-- 3 Listado con nombre, descripción, costo, fecha de inicio y de fin de todos los proyectos.
SELECT Nombre, Descripcion, Costo, FechaInicio, FechaFin FROM Proyectos
-- 4 Listado con... |
CREATE TABLE "book" (
"book_id" char(10) PRIMARY KEY,
"title" text UNIQUE NOT NULL,
"cover" varchar DEFAULT 'not_available.jpg',
"abstract" text NOT NULL,
"interview" text,
"is_suggested" boolean DEFAULT false,
"is_bestseller" boolean DEFAULT false,
"publication_date" date NOT NULL,
"genre" varchar,
... |
REM Code Effect
REM ***********************************************************************
REM 0 Turn off all attributes
REM 1 Set bright mode
REM 4 Set underline mode
REM 5 Set blink mode
REM 7 Exchange foreground and background colors
REM 8 Hide text (foreground color would be th... |
ALTER TABLE VEDTAK ADD COLUMN ansvarlig_beslutter varchar; |
--CREATE DEPT table
CREATE table departments
(
dept_no varchar(20) Primary key,
dept_name varchar(20)
)
--Create Employee table
Create table employees
(
emp_no int Primary Key,
birth_date date,
first_name varchar(20),
last_name varchar(20),
gender varchar(1),
hire_date date
)
--Crete Employee table
CREATE ... |
-- add a user
INSERT INTO `users` (username, email, password)
VALUES (:usernameInput, :emailInput, :passwordInput);
--insert budget
INSERT IGNORE INTO budgets (userId, budgetMonth) VALUES (?, ?)
-- insert bugetCategories
INSERT IGNORE INTO budgetCategories (budgetId, categoryId)
SELECT budgets.budgetId, categories.c... |
insert into `Dept` values(1,"管理组",1);
insert into `Manager` values(1,"admin",1,"admin");
INSERT INTO `model_set` VALUES (1, '项目管理', '/projectIndex', 1, 0, '菜单管理');
INSERT INTO `model_set` VALUES (5, '测试报告管理', '/Report', 1, 0, '菜单管理');
INSERT INTO `model_set` VALUES (6, '测试手机号管理', '/testIndex', 1, 0, '菜单管理');
INSERT INT... |
--Write a SQL statement to create a view that displays the users from the Users table that have been in the system today.
CREATE VIEW [Logged View] AS
SELECT Username, [Login Time]
FROM Users
WHERE
DAY([Login Time]) = DAY (GETDATE()) |
ALTER TABLE map__planets ADD player_id int references players(id);
|
CREATE TABLE smoke_report (
id INTEGER PRIMARY KEY AUTOINCREMENT,
project INTEGER NOT NULL,
developer INTEGER NOT NULL,
added TEXT NOT NULL,
architecture TEXT DEFAULT '',
platform TEXT DEFAULT '',
pass INTEGER DEFAULT 0,
fail ... |
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Jul 12, 2019 at 12:46 PM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @O... |
select avg(diff)
from (
SELECT kw.dsp_user_id, search_date, conv_date, datediff(conv_date,search_date) as diff
from (
select dsp_user_id
,MIN(cf_event_ts) as search_date
from edb.edb_conversion_feed
where ds... |
CREATE TABLE IF NOT EXISTS thought (
id int NOT NULL AUTO_INCREMENT,
description varchar(255),
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS thought_child (
thought_id int NOT NULL,
child_id int NOT NULL,
CONSTRAINT thought_child PRIMARY KEY(thought_id, child_id),
FOREIGN KEY(thought... |
-- phpMyAdmin SQL Dump
-- version 4.4.14
-- http://www.phpmyadmin.net
--
-- 主機: 127.0.0.1
-- 產生時間: 2016-07-05 17:28:14
-- 伺服器版本: 5.6.26
-- PHP 版本: 5.6.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET... |
SELECT * FROM individuals;
SELECT * FROM employeehistory;
SELECT * FROM fundcompanies;
SELECT * FROM funds;
SELECT * FROM companies;
|
DROP TABLE IF EXISTS `tag_article`;
DROP TABLE IF EXISTS `role_permission`;
DROP TABLE IF EXISTS `user_role`;
DROP TABLE IF EXISTS `vote`;
DROP TABLE IF EXISTS `comment`;
DROP TABLE IF EXISTS `article`;
DROP TABLE IF EXISTS `tag`;
DROP TABLE IF EXISTS `category`;
DROP TABLE IF EXISTS `user`;
DROP TABLE IF EXISTS `role`... |
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Client : 127.0.0.1
-- Généré le : Dim 27 Mai 2018 à 11:47
-- Version du serveur : 5.7.14
-- Version de PHP : 5.6.25
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET... |
/* ====================================================================== */
/* Banco de dados para o trabalho da disciplina: Algoritmo 2 */
/* ---------------------------------------------------------------------- */
/* Sistema de Biblioteca: SisBib */
/* =========... |
DROP DATABASE IF EXISTS video_games_review;
CREATE DATABASE video_games_review;
USE video_games_review;
CREATE TABLE IF NOT EXISTS videoGames (
videoGameID INT NOT NULL AUTO_INCREMENT,
videoGameName VARCHAR(45) NOT NULL UNIQUE,
videoGameStudio VARCHAR(45) NOT NULL,
systemName VA... |
-- select * from ds_leaderboard;
-- select * from ds_leaderboard where language_id=1;
-- select * from ds_leaderboard ignore index(pl) where language_id=1;
-- select name,language_id from ds_leaderboard where language_id between 1 and 5;
EXPLAIN SELECT * FROM ds_leaderboard WHERE country='India' GROUP BY language_id
|
step 1-- Create Student Table
CREATE TABLE Student
(
ID INT PRIMARY KEY,
Name VARCHAR(50),
Gender VARCHAR(50),
DOB DATE,
Branch VARCHAR(50)
)
step 2-- Insert into Student Table
INSERT INTO Student VALUES(1, 'krati', 'Female','1999-01-28', 'CSE')
INSERT INTO Student VALUES(2, 'Sakshi', 'Female','1998-09-11',... |
FROM mysql:8.0
ADD ./db/schema.sql /docker-entrypoint-initdb.d/1-schema.sql
|
drop table BigData_work.Data_Wiz;
drop table BigData_work.t1;
drop table BigData_work.t2;
create table BigData_work.Data_Wiz(col1 varchar(30), id int);
insert into BigData_work.Data_Wiz select 'kitten ',1;
insert into BigData_work.Data_Wiz select 'pop', 2;
insert into BigData_work.Data_Wiz select 'moo', 3;
insert into... |
-- Table: tipo_dni
-- DROP TABLE tipo_dni;
CREATE TABLE tipo_dni
(
id_tipo_dni serial NOT NULL primary key,
nombre_tipo_dni character varying,
descripcion_tipo_dni character varying
);
INSERT INTO tipo_dni(id_tipo_dni,nombre_tipo_dni,descripcion_tipo_dni)VALUES(1,'DNI','Documento Nacional de Identidad');
INSER... |
function PosicionesConformadaNueva2018($idtemporada, $idcategoria, $iddivision) {
$sql = " select
m.equipo,
sum(m.puntos) as puntos,
sum(m.goles) as goles,
sum(m.golescontra) as golescontra,
sum(m.pj) as pj,
sum(m.pg) as pg,
sum(m.pp) as pp,
sum(m.pe) as pe,
sum(m.amarillas) as amarillas,
sum(m.rojas) as rojas,... |
USE soft_uni;
#-- 1. Employee Address
SELECT
e.employee_id, e.job_title, e.address_id, a.address_text
FROM
employees AS e
INNER JOIN
addresses AS a
ON
e.address_id = a.address_id
ORDER BY e.address_id
LIMIT 5;
#-- 2. Addresses with Towns
SELECT
e.first_name, e.last_name, t.name AS 'town', a.addres... |
USE dmab0914_2sem_7;
CREATE TABLE PartOrders
(
id int NOT NULL,
quantity int NOT NULL,
currentPrice int NOT NULL,
productID int NOT NULL,
PRIMARY KEY(id),
CONSTRAINT fk_partOrder_ProductID FOREIGN KEY(productID) REFERENCES Products(id)
ON DELETE CASCADE
ON UPDATE CASCADE
); |
--Write a query to display the names of those students that are between the ages of 18 and 20.
select student_name
from students
where age between 18 and 20;
--Write a query to display all of those students that contain the letters "ch" in their name or their name ends with the letters "nd".
select *
from students
w... |
-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : lun. 15 oct. 2018 à 02:06
-- Version du serveur : 5.7.19-0ubuntu0.16.04.1
-- Version de PHP : 7.0.31-1+ubuntu16.04.1+deb.sury.org+1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTI... |
-- phpMyAdmin SQL Dump
-- version 4.5.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 25, 2016 at 05:24 AM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 7.0.13
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CL... |
-- dba-registry.sql
-- show current components and versions
-- see dba-registry-history.sql for upgrades
set linesize 200 trimspool on
set pagesize 60
col comp_name head 'Component' format a40
col modified format a10 head 'Modified'
col namespace format a15 head 'Namespace'
col version format a15 head 'Version'
sel... |
use bootcamp;
create table user (
id int not null primary key auto_increment,
name varchar(50) not null,
address varchar(50) not null,
city varchar(35) not null,
state char(2) not null,
zipcode varchar(5) not null,
email varchar(254),
phone varchar(20),
role varchar(50)
);
create table ... |
CREATE DATABASE javapooldb;
\c javapooldb;
CREATE USER root WITH PASSWORD 'root';
GRANT ALL PRIVILEGES ON DATABASE javapooldb TO root;
CREATE TABLE IF NOT EXISTS public.auto
(
ID INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
MODEL VARCHAR(255) NOT NULL,
MAXSPEED INT NOT NULL,
MIL... |
CREATE TABLE pictures (
id SERIAL PRIMARY KEY,
url VARCHAR(250)
);
|
--1、求平均薪水最高的部门的部门编号
select t1.deptno
from (select avg(sal) avg_sal, deptno from emp e group by deptno) t1,
(select max(avg(sal)) max_sal from emp e group by deptno) t2
where t1.avg_sal = t2.max_sal
--2、求部门平均薪水的等级
select *
from salgrade sg,
(select avg(sal) avg_sal, deptno from emp e group by deptno... |
CREATE TABLE `feedback` (
id int not null auto_increment primary key,
user_id int not null,
message text not null,
rate varchar(150) not null,
isactive tinyint(1) not null default 1,
lastupdated timestamp not null default current_timestamp on update current_timestamp
)engine=innodb default chars... |
/*Challenge #1: Customer View (Minimum Requirement)
-- Challenge #1: Customer View (Minimum Requirement)
-- Create a MySQL Database called bamazon.X
-- Then create a Table inside of that database called products.X
-- The products table should have each of the following columns:X
/*Create a MySQL Database called bama... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.