text stringlengths 6 9.38M |
|---|
-- criando ficha cadastral de proprietario
create table proprietario
(
nome varchar(30) not null,
enderprop varchar(30) not null,
estcivil varchar(30) null,
cpf varchar(30) not null,
rg varchar(30) not null,
contato varchar(30) null,
email varchar(30) not null,
banco varchar(30) not null,
agencia int... |
--oracle
alter table F_DATACATALOG add CREATOR VARCHAR2(32);
alter table F_DATACATALOG add UPDATOR VARCHAR2(32);
alter table F_DATACATALOG RENAME COLUMN LASTMODIFYDATE TO UPDATEDATE;
alter table F_OPTDEF add CREATOR VARCHAR2(32);
alter table F_OPTDEF add UPDATOR VARCHAR2(32);
alter table F_OPTDEF RENAME COLUMN LASTM... |
-- {{ ref('snowplow_days') }}
{{
config(
materialized='date_partitioned_table',
date_source='snowplow_days',
date_field='date_day',
date_partitioned_base_schema='snowplow',
date_partitioned_base_relation='event_daily',
filter_output=False
)
}}
with all_events ... |
# Write your MySQL query statement below
# 执行用时:326 ms, 在所有 MySQL 提交中击败了91.25%的用户
# 内存消耗:0 B, 在所有 MySQL 提交中击败了100.00%的用户
select Name as Customers from Customers c where c.Id not in
(select CustomerId from Orders)
/* Write your T-SQL query statement below */
# 不加distinct会超时
# 0 / 12 个通过测试用例
# 状态:超出时间限制
# 提交时间:几秒前
#... |
/*
Navicat MySQL Data Transfer
Source Server : docker-master
Source Server Version : 50717
Source Host : 192.168.249.128:3307
Source Database : db-test
Target Server Type : MYSQL
Target Server Version : 50717
File Encoding : 65001
Date: 2017-03-07 10:13:47
*/
SET FOREIGN_KEY_CHECK... |
DELIMITER $$
CREATE PROCEDURE `PRO_BOOKING`(
IN pi_player_id bigint,
IN pi_match_id bigint,
IN pi_match_day date,
IN pi_type int,
IN pi_create_user_id bigint,
IN pi_comment VARCHAR(2000),
OUT po_response VARCHAR(200))
BEGIN
DECLARE v_booking_id bigint unsigned DEFAULT 1;
INSERT INTO `football`.`booking` (`n_player_id... |
CREATE table Role(
id serial unique primary key ,
name text,
is_admin boolean
);
CREATE table Users(
id serial primary key ,
name text,
email text,
password_hash text,
role int,
fo... |
create user &&REPLICATION_USER identified by "&PASSWORD" DEFAULT TABLESPACE &&DEFAULT_REPLICATION_TABLESPACE;
alter user &&REPLICATION_USER quota unlimited on &&DEFAULT_REPLICATION_TABLESPACE;
grant resource,create session to &&REPLICATION_USER ;
grant select on v_$database to &&REPLICATION_USER ;
grant select on v... |
--Fix printer corrupted printer settings in Macola by removing the user's records from this table
SELECT * FROM printdft_sql WHERE prt_df_user LIKE 'RWALKER%'
DELETE FROM printdft_sql WHERE prt_df_user LIKE 'RWALKER%'
|
DROP DATABASE IF EXISTS `super_rent`; /*Add by Eli*/ |
CREATE TABLE `country` (
`countryId` int(11) NOT NULL AUTO_INCREMENT,
`countryName` varchar(100) NOT NULL,
PRIMARY KEY (`countryId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
create index IX_4A6E107E on opencps_feedback (email); |
CREATE TABLE `T_VERSION` (
`Version` int NOT NULL PRIMARY KEY,
`UpTime` timestamp NOT NULL
) DEFAULT CHARSET=utf8;
INSERT INTO `T_VERSION` VALUES ('0', now());
CREATE TABLE `T_ROLE` (
`Id` int(11) NOT NULL PRIMARY KEY,
`Name` varchar(64) NOT NULL,
`Authorities` varchar(1024) NOT NULL,
`ReadOnly` tinyint(1... |
select
cc_call_center_id Call_Center,
cc_name Call_Center_Name,
cc_manager Manager,
sum(cr_net_loss) Returns_Loss
from
call_center,
catalog_returns,
date_dim,
customer,
customer_address,
customer_demographics,
household_demographics
where catalog_returns.cr_call_center_sk =... |
-- 消息模版表
CREATE TABLE message_template (
id bigserial not null,
tenant_id bigint default 0 not null,
app_module VARCHAR(50),
code VARCHAR(20) NOT NULL,
title VARCHAR(100) NOT NULL,
content VARCHAR(500) NOT NULL,
ext_data VARCHAR(500),
is_deleted BOOL... |
with prs as (
select pr.id,
pr.dup_repo_id as repo_id,
pr.dup_repo_name as repo_name,
pr.created_at,
pr.merged_at,
pr.event_id
from
gha_pull_requests pr
where
pr.created_at >= '{{from}}'
and pr.created_at < '{{to}}'
and pr.event_id = (
select s.event_id from gha_pull_requ... |
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: May 07, 2018 at 07:52 PM
-- Server version: 10.1.28-MariaDB
-- PHP Version: 7.1.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OL... |
ALGORITHM differents
VAR
set1:ARRAY_OF INTEGER[10];
set2:ARRAY_OF INTEGER[10];
i,j:INTEGER;
sum:INTEGER:=0;
Found:BOOLEAN;
BEGIN
FOR i FROM 0 TO set1.length-1 DO
found :=false;
FOR j FROM 0 TO set2.length-1 DO
IF (set1[i]=set2[j]) THEN
... |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255) NOT NULL,
PRIMARY KEY (Code)
);
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255) NOT NULL ,
Price DECIMAL NOT NULL ,
Manufacturer INTEGER NOT NULL,
PRIMARY KEY (Code),
FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)
) E... |
use plats_journal
select A.annonsid, A.annonsrubrik, A.yrkesbenamning,A.yrkesbenamningId,Y.name, Y.yrkesgrupp,G.name,G.yrkesomrade,O.name from Annons A, Yrke Y, Yrkesgrupp G, Yrkesomrade O where A.yrkesbenamningid=Y.id and Y.yrkesgrupp=G.id and G.yrkesomrade=O.id;
|
WITH PHARMA_SALES_DATA AS(
SELECT
"snowflake"."SCHEMA_INFO"."SALESDAILY_S"."DATUM" AS "DATUM",
"snowflake"."SCHEMA_INFO"."SALESDAILY_S"."M01AB" AS "M01AB",
"snowflake"."SCHEMA_INFO"."SALESDAILY_S"."M01AE" AS "M01AE",
"snowflake"."SCHEMA_INFO"."SALESDAILY_S"."N02BA" AS "N02BA",
"snowflake"."SCHEMA_INFO"."SALES... |
delete from TASK_CALL_INFO where task_type='0000';
commit;
delete from TASK_CALL_INFO where task_type='0001';
commit;
delete from TASK_CALL_INFO where task_type='0002';
commit;
delete from TASK_CALL_INFO where task_type='0003';
commit;
delete from TASK_CALL_INFO;
commit;
delete from task_call_info_his;
commit;
insert ... |
/**
* @name importFields
* @public
*/
Select *
From impexceltablefields t
Where :impFileType = t.impfile
Order by t.cellnumber |
--Returns summary information about missing index groups, for example, the performance improvements that could be gained by implementing a specific group of missing indexes.
select *
from sys.dm_db_missing_index_group_stats
--Returns detailed information about a missing index; for example, it returns the name and ide... |
--Problem 04
SELECT TOP (5)
e.EmployeeID
,e.FirstName
,e.Salary
,d.[Name]
FROM Employees AS e
JOIN Departments AS d ON e.DepartmentID=d.DepartmentID
WHERE e.Salary>15000
ORDER BY d.DepartmentID ASC
|
drop table if exists t_board;
create table t_board (
bno int unsigned not null auto_increment primary key,
title varchar(200) not null,
content text null,
writer varchar(50) not null,
regdate timestamp not null default now(),
upddate timestamp not null default now() on update now(),
viewcnt in... |
CREATE TABLE ABS (x INT);
-- error 42601: syntax error: near "ABS"
CREATE TABLE ACOS (x INT);
-- error 42601: syntax error: near "ACOS"
CREATE TABLE ALL (x INT);
-- error 42601: syntax error: near "ALL"
CREATE TABLE ALLOCATE (x INT);
-- error 42601: syntax error: near "ALLOCATE"
CREATE TABLE ALTER (x INT);
-- error... |
CREATE DATABASE IF NOT EXISTS gcloud_trade;
USE gcloud_trade;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for tb_trade_info
-- 商品交易订单
-- ----------------------------
DROP TABLE IF EXISTS `tb_trade_info`;
CREATE TABLE `tb_trade_info` (
`id` BIGINT(30... |
alter table ore_calcs change column character_id esi_char_id bigint not null; |
SELECT FirstName, LastName, 2021 - Birth
FROM Actors
WHERE ActorId IN (SELECT ActorId FROM MovieActors WHERE MovieId IN
(SELECT Id FROM Movies WHERE ReleaseYear > 1980))
ORDER BY Birth
|
-- MABD TP1 SQL avec la base MONDIAL
-- -------------------- binome -------------------------
-- NOM BECIRSPAHIC
-- Prenom LUCAS
-- NOM FERNANDEZ
-- Prenom STEBAN
-- -----------------------------------------------------
-- pour se connecter à oracle:
-- sqlplus E1234567/E1234567@oracle
-- remplacer E12345657 par la... |
insert into migration_history (version, notes)
values ('201506030000', '
1) В документе добавляем новое поле: date_end дата завершения действия документа.
2) Названия видов теперь заканчиваются на _view.
3) Сущность ownership_type переименовываем в legal_form
');
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ... |
ALTER TABLE users
ALTER COLUMN pass TYPE VARCHAR(100);
|
BEGIN TRANSACTION;
INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, surname AS LastName, '' as Email, '' AS ServiceURLs, created as Created FROM users;
COMMIT;
|
SELECT
SUM(下发名单量) 下发总量, SUM(成功数) 成功总数, round(SUM(成功数)/SUM(下发名单量),4) 平均转化率,
round(SUM(邮件1转化率)/COUNT(*),4) 邮件1平均转化率,
round(SUM(邮件2转化率)/COUNT(*),4) 邮件2平均转化率,
round(SUM(邮件3转化率)/COUNT(*),4) 邮件3平均转化率,
round(SUM(邮件4转化率)/COUNT(*),4) 邮件4平均转化率,
round(SUM(邮件5转化率)/COUNT(*),4) 邮件5平均转化率,
round(SUM(邮件6转化率)/COUNT(*),4) 邮... |
create table question
(
id int auto_increment,
creator int,
title varchar2(64),
description text,
tag varchar2(256),
comment_count int default 0,
view_count int default 0,
like_count int default 0,
gmt_create bigint,
gmt_modified bigint,
constraint question_pk
primary key (id)
);
comment on table question... |
/*
Navicat MySQL Data Transfer
Source Server : prd-cbest
Source Server Version : 80016
Source Host : db.haproxy.cbest.gam:36601
Source Database : e_welfare
Target Server Type : MYSQL
Target Server Version : 80016
File Encoding : 65001
Date: 2021-02-02 15:49:40
*/
SET FOREIGN_KEY_C... |
# Host: 127.0.0.1 (Version 5.1.50-community)
# Date: 2018-01-14 14:47:06
# Generator: MySQL-Front 6.0 (Build 2.20)
#
# Structure for table "categorias"
#
DROP TABLE IF EXISTS `categorias`;
CREATE TABLE `categorias` (
`idcategoria` bigint(20) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL,
PRIMARY KE... |
create table users(
id int(6) not null auto_increment,
role varchar(20) not null,
fname varchar(60) not null,
lname varchar(60) not null,
middle_name varchar(50),
preffered_name varchar(50),
prefix varchar(20),
suffix varchar(10),
title varchar(60),
dob varchar(10) not null,
... |
-- phpMyAdmin SQL Dump
-- version 4.3.6
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 18, 2015 at 04:43 PM
-- Server version: 5.5.41-0ubuntu0.14.04.1
-- PHP Version: 5.5.9-1ubuntu4.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=... |
/* Formatted on 5/14/2019 4:54:05 PM (QP5 v5.206) */
-- Start of DDL Script for Table GPLATFORM.GAPI_SERVICES_HOSTS
-- Generated 5/14/2019 4:54:05 PM from GPLATFORM@HSDEV
CREATE TABLE gapi_services_hosts
(
service_id VARCHAR2 (255),
domain VARCHAR2 (255),
CONSTRAINT fk_gapi_service_id FOREIGN KEY (... |
CREATE TABLE `series` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`slug` varchar(255) NOT NULL,
`description` text NOT NULL,
`published` tinyint(1) NOT NULL DEFAULT '0',
`is_archived` tinyint(1) NOT NULL DEFAULT '0',
`created` timestamp... |
DROP TABLE if exists REVISION cascade;
DROP TABLE if exists NETTOYAGE cascade;
DROP TABLE if exists SITUATION cascade;
DROP TABLE if exists VOITURE cascade;
DROP TABLE if exists EMPLACEMENT cascade;
DROP TABLE if exists CATEGORIE;
DROP TABLE if exists CONDUCTEUR;
DROP TABLE if exists LOCATION;
DROP TABLE if exists VILL... |
USE bottega-university;
INSERT INTO
grades(grade, grades_students_id, grades_courses_id)
VALUES
(76, 1, 1),
(82, 1, 2),
(69, 2, 3),
(92, 2, 4),
(88, 2, 5),
(77, 3, 1),
(83, 3, 2),
(74, 3, 5),
(66, 4, 3),
(81, 4, 4),
(79, 5, 2),
(95, 5, 3); |
CREATE TABLE ubuntu (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
code_name NVARCHAR(128) NOT NULL,
version NVARCHAR(64) NOT NULL
);
INSERT INTO ubuntu (code_name, version)
VALUES ('Trusty Tahr', '14.04 LTS');
INSERT INTO ubuntu (code_name, version)
VALUES ('Saucy Salamander', '13.10');
INSER... |
/*
SQLyog Ultimate v12.3.1 (64 bit)
MySQL - 5.7.24-log : Database - result
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CH... |
Create Procedure dbo.[FSU_sp_InsertManualUpdate]
(
@ClientId Int,
@FsuId Int,
@FileName nvarchar(100),
@TargetTool int,
@LocalPath nvarchar(1000)
)
As
Begin
insert into tblInstallationDetail
(ClientID,
FSUID,
FileName,
TargetTool,
LocalPath,
SeverityType,
InstallationDate,
Mode,
Status)
values
(@Clie... |
CREATE OR REPLACE PROCEDURE PROC_SP_BTS AS
BEGIN
DECLARE
CURSOR C_JOB IS
SELECT BTS.INT_ID,
CITY.PROVINCE_NAME,
CITY.REGION_NAME,
CITY.CITY_NAME,
BTS.VILLAGE_NAME,
BTS.GRID_NUM,
BTS.OPERATE_DEPARTMENT,
BTS.BTS_CODE BT... |
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1
-- Généré le : mer. 18 déc. 2019 à 15:54
-- Version du serveur : 10.1.37-MariaDB
-- Version de PHP : 7.2.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!4010... |
Select * from (
Select grup, univer, spec, ayani, id, p_ball as ball from ixtisas
Union
Select grup, univer, spec, ayani, id, b_ball as ball from ixtisas) as T where grup = 1 and ball < 600 order by ball desc limit 15;
|
connect sys as sysdba
/*Pop-Up for password
/*Connected*/
create user book_store identified by obs123;
/*User Created*/
/*Giving certain priveledges to user*/
grant connect to book_store;
grant create session to book_store;
grant create sequence to book_store;
grant unlimited tablespace to book_store;
grant create t... |
SQL_UP = """
CREATE TABLE `demo_table_work` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL,
`author` varchar(40) NOT NULL,
`submission_date` date DEFAULT NULL,
PRIMARY KEY (`id`)
);
"""
SQL_DOWN = """
DROP TABLE demo_table_work;
"""
|
INSERT INTO Accounts(PersonId, Balance) VALUES
(2, 5000),
(4, 8500.55),
(1, 1222.80),
(3, 55.23),
(5, 8999) |
-- REMOVE ALL FROM TABLES
DELETE FROM dbo.Participants;
DELETE FROM dbo.TaskResults;
DELETE FROM dbo.TestResults;
DELETE FROM dbo.Tasks;
DELETE FROM dbo.Tests;
--RESET AUTO INCREMENT IDS
DBCC CHECKIDENT ('[Participants]', RESEED, 0);
DBCC CHECKIDENT ('[TaskResults]', RESEED, 0);
DBCC CHECKIDENT ('[Tasks]', RESEED, 0);
... |
CREATE TABLE cook (
id IDENTITY,
name VARCHAR(50),
location VARCHAR(255),
image_url VARCHAR(50),
is_active BOOLEAN,
CONSTRAINT pk_cook_id PRIMARY KEY (id)
);
CREATE TABLE user_detail (
id IDENTITY,
first_name VARCHAR(50),
last_name VARCHAR(50),
role VARCHAR(50),
enabled BOOLEAN,
password VA... |
/*
Name: Listing Views through article body
Data source: 4
Created By: Admin
Last Update At: 2016-11-21T20:04:41.577692+00:00
*/
SELECT Listing,
MG_LA.street_address +','+ MG_LA.city+','+MG_LA.zip_code + MG_LA.country Listing_address,
MG_HL.agent_name as Agent,
nvl(MG_HL.brokerage_name,"") as Brokerage,
sum(Views)... |
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.2.6-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 9.4.0.5125
-- -------------------------------------------------... |
-- aku80 / 14.01.2011
-- MM
-- alter table users
alter table users
add FIRSTNAME VARCHAR2(100 CHAR);
alter table users
add LASTNAME VARCHAR2(100 CHAR);
alter table users
add EMAIL VARCHAR2(150 CHAR);
alter table users
add PHONE VARCHAR2(150 CHAR);
alter table users
add ORGANIZATION... |
-- Drop database if exists DBTonysKinal2019063;
create database DBTonysKinal2019063;
use DBTonysKinal2019063;
-- =========================== CREACION DE TABLAS ===========================
-- Creando tabla Tipo_Plato
DELIMITER $$
create procedure sp_Crear_Tipo_Plato()
BEGIN
create table Tipo_Plato(codigoTipoPl... |
ALTER TABLE user_account ADD UNIQUE (email); |
--
-- Copyright 2010-2016 the original author or authors.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unles... |
CREATE PROCEDURE EDITAR_COMPUTADORA
@ID_COMP int,
@NUMERO int,
@ESTADO VARCHAR(20)
AS
BEGIN
UPDATE COMPUTADORA
SET NUMERO=@NUMERO,
ESTADO=@ESTADO
WHERE ID_COMP=@ID_COMP
END |
CREATE TABLE `subjects` (
`subject_id` INTEGER NOT NULL AUTO_INCREMENT,
`subject_name` VARCHAR(100) NOT NULL,
`subject_status` VARCHAR(10) NOT NULL DEFAULT 'Active',
`last_updated_by` INTEGER NOT NULL,
`last_updated_on` DATE,
PRIMARY KEY (`subject_id`)
)
ENGINE = InnoDB;
ALTER TABLE `subjects` ADD `subject_... |
ALTER TABLE cadaster ALTER COLUMN type TYPE varchar(255) USING type::varchar;
|
/*
Navicat Premium Data Transfer
Source Server : WSL
Source Server Type : MySQL
Source Server Version : 80018
Source Host : wslhost:3306
Source Schema : bi_ye_she_ji
Target Server Type : MySQL
Target Server Version : 80018
File Encoding : 65001
Date: 10/02/2020 13:48... |
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1:3306
-- Généré le : mar. 06 oct. 2020 à 08:03
-- Version du serveur : 10.4.10-MariaDB
-- Version de PHP : 5.6.40
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*... |
-- Adminer 4.2.5 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `mahasiswa`;
CREATE TABLE `mahasiswa` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nama` varchar(255) NOT NULL,
`alamat` varchar(255) NOT NULL,
`lat` varch... |
select title from books where title like "%Stories%";
select title,pages from books order by pages desc limit 1;
select concat(title," - ",released_year) as "summary" from books order by released_year desc limit 3;
select title,author_lname from books where author_lname like "% %";
select title,released_yea... |
START TRANSACTION;
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE `banco` ADD `cnpj` VARCHAR(14) NOT NULL AFTER `agencia`;
ALTER TABLE `banco` ADD CONSTRAINT `Fk_BancoCondominio` FOREIGN KEY (`cnpj`) REFERENCES `condominio`(`cnpj`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `cazulo`.`banco` DROP PRIMARY KEY, ADD PRIMARY... |
-- 蔵書
INSERT INTO 蔵書.品目
(書籍番号, タイトル, 著者)
VALUES
('masuda-2017','現場で役立つシステム設計の原則','増田 亨'),
('evans-2011','ドメイン駆動設計','エリックエヴァンス'),
('fowler-2017','リファクタリング','マーチンファウラー'),
('kanzaki-2019','RDRA 2.0 ハンドブック','神崎 善治')
;
INSERT INTO 蔵書.蔵書
(蔵書番号, 書籍番号)
VALUES
(1, 'masuda-2017'),
(2, 'evans-2011'),
... |
-- Your SQL goes here
create table user (
id serial primary key,
user_id varchar(36) not null,
username text not null,
public_key text not null,
next_public_key text not null
) |
create table endereco (
id int not null AUTO_INCREMENT,
logradouro varchar(30),
numero varchar(6),
complemento varchar(20),
cidade varchar(20),
uf varchar(12),
cep varchar(9),
primary key (id)
);
insert into endereco (id, logradouro, numero, complemento, cidade, uf, cep)
values (1,'a... |
-- finding leap Year
create or replace function is_leap(y int) returns int begin declare t int; set t = 0; if y%400 =0 then return 1; end if; if y % 100 = 0 then return 0; end if; if y%4 = 0 then return 1; end if; return t; end |
-- Elapsed days between two years (excluding y1 and y2)
create or replace function ydays... |
CREATE TABLE LanguageCodes (
LangID char(3) NOT NULL, -- Three-letter code
CountryID char(2) NOT NULL, -- Main country where used
LangStatus char(1) NOT NULL, -- L(iving), N(early extinct),
-- E(xtinct)
Name varchar(75) NOT NULL); ... |
SELECT * FROM transaction_data
LIMIT 10;
SELECT full_name, email FROM transaction_data
WHERE zip = 20252;
SELECT full_name, email FROM transaction_data
WHERE full_name = "Art Vandelay"
OR full_name LIKE "% der %";
SELECT ip_address, email FROM transaction_data
WHERE ip_address LIKE "10.%";
SEL... |
/*
Creates the neccessary entries for TaskTypes and TimeTypes
*/
/*
Task Type:
*/
IF NOT EXISTS(SELECT TOP(1) [Name] FROM TimeManagement.TaskType)
BEGIN
DBCC CHECKIDENT ('[TimeManagement].[TaskType]', RESEED, 1)
INSERT INTO[TimeManagement].TaskType VALUES ( 'Development');
INSERT INTO[TimeManagement].TaskType VAL... |
alter table message add raw character varying not null default ''; |
CREATE DATABASE IF NOT EXISTS `bookshop` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `bookshop`;
-- MySQL dump 10.13 Distrib 5.6.17, for Win32 (x86)
--
-- Host: localhost Database: bookshop
-- ------------------------------------------------------
-- Server version 5.0.51b-community-nt-log
/*!40101 SET @O... |
Run the four queries below in `psql postgres`
INSERT INTO bookmarks (url) VALUES
('http://www.makersacademy.com');
INSERT INTO bookmarks (url) VALUES
('http:/www.destroyallsoftware.com');
INSERT INTO bookmarks (url) VALUES
('http://www.twitter.com');
INSERT INTO bookmarks (url) VALUES
('http://www.google.com');
|
SELECT
ar.Name AS 'Artist',
SUM(il.Quantity) AS 'Tracks Sold'
FROM Artist ar
JOIN Album al ON ar.ArtistId = al.ArtistId
JOIN Track t ON al.AlbumId = t.AlbumId
JOIN InvoiceLine il ON t.TrackId = il.TrackId
GROUP BY ar.Name
ORDER BY SUM(il.Quantity) DESC
LIMIT 3; |
-- LABORATORY WORK 3
-- BY Mitrokhin_Oleksii
/*1. Написати PL/SQL код, що додає постачальників, щоб сумарна кількість усіх постачальників була 7. Ключі постачальників v1….vn.
Решта значень обов’язкових полів відповідає полям постачальника з ключем BRS01.
10 балів*/
/*2. Написати PL/SQL код, що по вказаному ключу за... |
SET FOREIGN_KEY_CHECKS = 0;
DROP DATABASE IF EXISTS unidad9_anexo;
CREATE DATABASE unidad9_anexo CHARACTER SET utf8mb4;
USE unidad9_anexo;
CREATE TABLE alumno (
id INT UNSIGNED PRIMARY KEY,
nombre VARCHAR(100) NOT NULL,
apellido1 VARCHAR(100) NOT NULL,
apellido2 VARCHAR(100),
f... |
insert into usr(id, created, email, password, role, status, updated, username) VALUES
(2, '2020-05-05', 'test@gmail.com', '$2a$08$fL7u5xcvsZl78su29x1ti.dxI.9rYO8t0q5wk2ROJ.1cdR53bmaVG', 'ROLE_USER', 'Active', '2020-05-05', 'test'); |
--Procedure to drop all views from DB
CREATE OR REPLACE PROCEDURE DROP_ALL_VIEWS AS
BEGIN
FOR i IN (SELECT view_name FROM user_views)
LOOP
EXECUTE IMMEDIATE('DROP VIEW ' || user || '.' || i.view_name);
END LOOP;
END DROP_ALL_VIEWS;
-- dynamicall creates a view displaying the total number of ... |
-- select columns id and name from Students, aliased as s.
-- the left join keyword returns all tables from the left table (table 1), and the matching
-- records from the right table (table 2).
-- the left join clause allows you to query data from multiple tables.
-- because we need to reference columns in another tab... |
/*
DESCRIPTION:
Initial field mapping and prelimilary data cleaning for BIS job applications data
INPUTS:
dob_jobapplications
OUTPUTS:
_INIT_BIS_devdb (
uid text,
job_number text,
job_type text,
job_desc text,
_occ_initial text,
_occ_proposed text,
stories_init numeric,
stories_prop text,
zoning... |
mysql> SELECT NOW();
+---------------------+
| NOW() |
+---------------------+
| 2011-10-24 14:04:48 |
+---------------------+
1 row in set (0.00 sec)
mysql> SELECT SHA('hello world!');
+------------------------------------------+
| SHA('hello world!') |
+--------------------------... |
-- @description parquet insert vary pagesize/rowgroupsize
-- @created 2013-08-09 20:33:16
-- @modified 2013-08-09 20:33:16
-- @tags HAWQ parquet
--start_ignore
drop table if exists pTable1;
drop table if exists pTable3_from;
drop table if exists pTable3_to;
drop table if exists pTable4_from;
drop table if exists pTab... |
INSERT INTO burgers (burger_name) VALUES ("Jalapeno Burger"), ("Big Mac"), ("Plain Burger");
SELECT * FROM burgers;
|
--------------------------------------------------------
-- DDL for Table MOBILEUM_ASP_IBHW
--------------------------------------------------------
CREATE TABLE MOBILEUM_ASP_IBHW
( PAIS CHAR(3 CHAR),
FECHA DATE,
CNT_LLAMADAS NUMBER,
CNT_POLITICA_RESTRICCION NUMBER,
CNT_BOLQ_REL_TIPO_GEST NUMBER,
CNT_... |
■問題文
貸し出し記録テーブル(rental)上、returned列が9(紛失)であるレコードについて、
対応する書籍情報テーブル(books)上の書籍情報を削除してみましょう。
■実行文
# 書籍情報テーブルのデータを削除する
DELETE FROM
books
# 貸し出し記録テーブル上returned列が9(紛失)である書籍情報の場合のみ削除する
WHERE
isbn IN
(
SELECT
isbn
FROM
rental
WHERE
returned = '9'
)
;
■返却値
mysql> DELETE FROM
-> books
-> WHERE
->... |
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username TEXT UNIQUE,
password TEXT,
admin BOOLEAN DEFAULT false
);
CREATE TABLE reviews (
id SERIAL PRIMARY KEY,
content TEXT,
user_id INTEGER REFERENCES users,
sent_at TIMESTAMP,
restaurant_id INTEGER REFERENCES restaurants,
stars INT... |
USE bottega_university_project_schema;
-- groups students by courses
SELECT grades_course_id, grades.grades_student_id, students.students_name
FROM grades
RIGHT JOIN students ON grades.grades_student_id = students.students_id
ORDER BY grades.grades_course_id; |
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.2 (Debian 12.2-4)
-- Dumped by pg_dump version 13.1 (Debian 13.1-1+b1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalo... |
--Data Analysis
--#1: List the following details of each employee: employee number, last name, first name, sex, and salary.
--Merge employee table and salary table and pull requested fields
select employees.emp_no, employees.last_name, employees.first_name, employees.sex, salaries.salary
from salaries
inner join emplo... |
UPDATE products
SET description= $2
WHERE id = $1;
|
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 27-06-2017 a las 22:04:15
-- Versión del servidor: 5.7.14
-- Versión de PHP: 7.0.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHAR... |
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 09, 2021 at 08:08 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 8.0.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIEN... |
-- 一级菜单
insert into sys_menu values('400', 'Inventory Management', '0', '20', '#', 'M', '0', '', 'fa fa-archive font12', 'admin', '2018-03-01', 'admin', '2018-03-01', 'Inventory Management');
-- 二级菜单
insert into sys_menu values('410', 'Stock In', '400', '1', '/inventory/inStock', 'C', '0', 'inventory:i... |
alter table genomic_align_group change group_id group_id bigint(20) unsigned NOT NULL auto_increment;
delete from meta where meta_key="schema_version";
insert into meta (meta_key,meta_value) values ("schema_version",36);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.