text stringlengths 6 9.38M |
|---|
/* Required Query Support */
/* List all the patients currently admitted to the hospital */
select pid, firstname, lastname from patient
where discharged is NULL;
/* List all patients who have received outpatient services within a given date range. List only
patient identification number and name. */
select pid, ... |
SELECT *
FROM Invoice join Customer on(Invoice.customerId= customer.customerId)
where customer.country = 'Brazil'
|
-- MySQL dump 10.13 Distrib 8.0.23, for Win64 (x86_64)
--
-- Host: localhost Database: testetezus2
-- ------------------------------------------------------
-- Server version 8.0.23
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESU... |
BEGIN
INSERT INTO TBL_LOG(col_data1,
col_data2,
col_bigdata1)
values('invoked CUST_2VV',
'(CLOB) INPUT=',
INPUT);
:validationresult := 0;
:ErrorCode :=-1;
:ErrorMessage := 'OOops. wrong )))';
END; |
CREATE OR REPLACE FUNCTION public.dblink_get_notify(conname text, OUT notify_name text, OUT be_pid integer, OUT extra text)
RETURNS SETOF record
LANGUAGE c
STRICT
AS '$libdir/dblink', $function$dblink_get_notify$function$
|
/*=================================*/
/* Suppression des contraintes */
/*=================================*/
${dropConstraintScript(AP_TOTO.FK_MERETOTO_TOTO)}
${dropConstraintScript(AP_TOTO.FK_MERETOTO2_TOTO)}
/*==============================*/
/* Creation des contraintes */
/*=============================... |
drop table if exists `compose`;
CREATE TABLE `compose` (
`id` smallint(4) unsigned NOT NULL COMMENT '编号',
`name` varchar(8) NOT NULL COMMENT '名称',
`material1` smallint(4) unsigned NOT NULL COMMENT '原料1',
`quantity1` tinyint(1) unsigned NOT NULL COMMENT '数量1',
`material2` smallint(4) unsigned NOT NULL COMMENT '原料2... |
DROP TABLE IF EXISTS 'users';
CREATE TABLE
IF NOT EXISTS users
(email VARCHAR
(255) PRIMARY KEY NOT NULL,
firstname VARCHAR
(255) NOT NULL,
lastname VARCHAR
(255) NOT NULL,
date VARCHAR
(20) NOT NULL,
balance INT DEFAULT 0,
gold INT DEFAULT 0,
silver INT DEFAULT 0,
bronze INT DEFAULT 0,
... |
delete from HtmlLabelIndex where id=21030
/
delete from HtmlLabelInfo where indexid=21030
/
INSERT INTO HtmlLabelIndex values(21030,'使用部门')
/
INSERT INTO HtmlLabelInfo VALUES(21030,'使用部门',7)
/
INSERT INTO HtmlLabelInfo VALUES(21030,'use department',8)
/
INSERT INTO HtmlLabelInfo VALUES(21030,'使用部門',9)
/
delete fr... |
DROP PROCEDURE IF EXISTS reporting_cf.SP_campaign_history_ACHD_CF;
CREATE PROCEDURE reporting_cf.`SP_campaign_history_ACHD_CF`()
BEGIN
/*******************************************************************************************************************
--- NAME : SP_campaign_history_ACHD_CF
--- DESCRIPTION: script... |
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you ma... |
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 01 Jan 2021 pada 23.44
-- Versi server: 10.4.16-MariaDB
-- Versi PHP: 7.4.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@C... |
Use TravelExperts
select * from Products_Suppliers
select * from Suppliers
select * from Products
SELECT *
FROM Products
INNER JOIN Products_Suppliers
ON Products.ProductId=Products_Suppliers.ProductId
SELECT Products.ProductId, ProdName, Suppliers.SupplierId, SupName
FROM Products
INNER JOIN Products_Suppliers
ON P... |
Set Serveroutput On;
Accept Var_Owner Prompt "Enter the owner name:"
accept Var_Role prompt "Enter the role name:"
DECLARE
Owner_Nm Varchar2(30) := Upper('&Var_Owner');
ROLE_NM VARCHAR2(30) := Upper('&Var_Role');
Rolling_Count Number;
Start_Dts Date := Sysdate;
End_Dts Date;
elapsed_time number;
... |
-- 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_SUBSTI... |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE SEQUENCE HIBERNATE_SEQUENCE
INCREMENT 1
MINVALUE 100
MAXVALUE 9223372036854775807
START 100
CACHE 1;
CREATE TABLE ADDRESS
(
ID BIGINT NOT NULL,
HOUSE_NUMBER CHARACTER VARYING(255),
STREET CHARACTER VARYING(255),
ZIP_CODE CHARACTER VARYIN... |
use WFA3DotNet
--1.Creation of Table Product
create table Product
(
ProductID int IDENTITY(1,1) PRIMARY KEY,
Description varchar(30) NOT NULL,
SetQty int NOT NULL DEFAULT 1,
Rate DECIMAL(10,2),
CONSTRAINT CHK_Product CHECK ((Rate>=18 AND Rate<=5000) AND (SetQty=1 OR SetQty=5 OR SetQty=10))
)
--2.Inserting the valu... |
Create table types (
type_id int(2) unsigned primary key,
name varchar(12) not null,
tier_1_min int(1) not null,
tier_2_min int(1),
tier_3_min int(1),
tier_4_min int(1));
insert into types
values(1, 'Adept', 2, 3, 4, NULL, 1),
(2, 'Assassin', 2, 4, 6, NULL, 1),
(3, 'Brawler', 2, 4, 6... |
--1.4. Calcular A = (pi * r)^2 donde r = 10 y la función Pi() para pi
select POWER((PI() * 10),2) |
CREATE DATABASE atom_pocket;
\c atom_pocket;
CREATE TABLE dompet(
id SERIAL,
nama varchar NOT NULL,
referensi varchar,
deskripsi varchar,
isActive boolean NOT NULL DEFAULT TRUE,
PRIMARY KEY (id)
);
CREATE TABLE kategori(
id SERIAL,
nama varchar NOT NULL,
deskripsi varchar,
isActive boolean NOT NULL DEFAUL... |
DROP TABLE IF EXISTS `timetracker_downgrade_migration_temp`.`project_user`;
-- CREATE TABLE "projects" -------------------------------------
CREATE TABLE `timetracker_downgrade_migration_temp`.`project_user` (
`id` Char( 36 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
`created_at` DateTime NULL DEFAULT CURREN... |
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 20, 2016 at 08:51 AM
-- Server version: 10.1.10-MariaDB
-- PHP Version: 7.0.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLI... |
INSERT INTO burgers (burger_name) VALUES ('Double Bacon Cheese Burger');
INSERT INTO burgers (burger_name) VALUES ('BBQ Burger');
INSERT INTO burgers (burger_name) VALUES ('Hawaiian Burger');
SELECT * FROM burgers; |
SELECT dbms_result_cache.status() FROM dual;
------------
ENABLED
-- SQLs that use result cache hint from DASH
select
sum(10) secs,
sum(sum(10)) over () as totalsec,
round((sum(10)/ sum(sum(10)) over ()) *100,2) percento,
dash.SQL_ID,
event,
case when lower(sql_text) like '%result%cache%' THEN 'RC' el... |
DROP DATABASE IF EXISTS bamazon;
CREATE DATABASE bamazon;
USE bamazon;
/* CUSTOMERS */
CREATE TABLE `Customers`(
customer_id INT NOT NULL AUTO_INCREMENT,
first_name VARCHAR(20) NOT NULL,
last_name VARCHAR(20) NOT NULL,
PRIMARY KEY (customer_id)
);
/* DEPARTMENTS*/
CREATE TABLE `Departments`(
depa... |
Rem
Rem $Header: plitblm.sql 21-mar-96.20:31:02 csexton Exp $
Rem
Rem plitblm.sql
Rem
Rem Copyright (c) Oracle Corporation 1995, 1996. All Rights Reserved.
Rem
Rem NAME
Rem plitblm.sql - package PLITBLM
Rem
Rem DESCRIPTION
Rem PL/sql Index-TaBLe Methods
Rem Package for index-table op... |
update HtmlLabelIndex set indexdesc='被返聘人' where id=16109
/
update HtmlLabelInfo set labelname='被返聘人' where indexid=16109 and languageid=7
/
update HtmlLabelIndex set indexdesc='返聘开始日期' where id=16110
/
update HtmlLabelInfo set labelname='返聘开始日期' where indexid=16110 and languageid=7
/
update HtmlLabelIndex set indexd... |
-- migrate:up
CREATE TABLE stripe.payouts (
id text primary key,
object text,
date text,
type text,
amount bigint,
method text,
status text,
created integer,
updated integer,
currency text,
livemode boolean,
metadata jsonb,
automatic boolean,
recipient text,
... |
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 21, 2018 at 07:32 AM
-- Server version: 10.1.35-MariaDB
-- PHP Version: 7.2.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD... |
create table if not exists address(
zipcode char(5) null,
sido varchar(20) null,
sigungu varchar(20) null,
doro varchar(20) null,
building1 int(5) null,
building2 int(5) null
);
SELECT clnt_code, clnt_name, clnt_addr, clnt_tel, clnt_isExist
FROM client
where clnt_isExist= true; |
update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'common.schema.version';
update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'entitylink.schema.version';
update ACT_GE_PROPERTY set VALUE_ = '6.5.0.1' where NAME_ = 'identitylink.schema.version';
alter table ACT_RU_JOB add ELEMENT_ID_ NVARCHAR2(255... |
ALTER TABLE workflow_agent ADD agenttype char(1)
/
ALTER TABLE workflow_agent ADD operatorid int
/
ALTER TABLE workflow_agent ADD operatordate char(10)
/
ALTER TABLE workflow_agent ADD operatortime char(8)
/
INSERT INTO HtmlLabelIndex values(17860,'批量回收')
/
INSERT INTO HtmlLabelInfo VALUES(17860,'批量回收',7)
/
INSE... |
TRUNCATE TABLE user_role CASCADE;
TRUNCATE TABLE usr CASCADE;
|
SET SERVEROUTPUT ON
DECLARE
v_exist NUMBER := 0;
BEGIN
BEGIN
SELECT 1
INTO v_exist
FROM cpi.giis_reports
WHERE report_id = 'BONDS_ENDT';
IF v_exist = 1 THEN
DBMS_OUTPUT.put_line ('BONDS_ENDT already exists.');
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN... |
CREATE TABLE `mkt_feed_collection_membership` (
`id` int(11) unsigned AUTO_INCREMENT NOT NULL PRIMARY KEY,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`app_id` int(11) UNSIGNED NOT NULL,
`order` smallint,
`obj_id` int(11) UNSIGNED NOT NULL,
UNIQUE (`obj_id`, `app_id`)
) ENGINE... |
create table if not exists gguser(
id text unique primary key,
email text,
password text,
username text,
location text,
emailConfirmation text,
confirmed boolean,
resetPasswordToken text,
resetPasswordExp text
);
create table if not exists ngo(
id text unique primary key references gguser,
emailT... |
1. dasar subquery
2. subquery dengan operator komparasi
3. contoh pengunaan subquery update,delete,select
4. subquery dengan in dan not in
5. subquery terikat
6. subquery didalam field
7. subquery di dalam from
8. sub query exists dan not exists
------------------------------------
-- db dms 2
select
distinct s.s... |
DROP TABLE IF EXISTS diff;
CREATE TABLE diff (
id int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
owner_name varchar(20) NOT NULL DEFAULT '' COMMENT '所有者姓名',
diff_time timestamp NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '对比时间',
source_file_content varchar(1024) NOT NULL DEFAULT '' COMMENT '源文件内容',
targe... |
INSERT INTO `musiclist_user` VALUES (1, '我喜欢的音乐', 1, '2020-02-02 17:03:51', NULL, NULL, NULL, 0, 0);
INSERT INTO `musiclist_user` VALUES (1, 'Z_ce的年度歌单', 2, '2020-02-02 17:03:54', NULL, NULL, NULL, 1, 1);
INSERT INTO `musiclist_user` VALUES (1, '日系', 3, '2020-02-02 17:03:57', NULL, NULL, NULL, 1, 1);
INSERT INTO `music... |
CREATE DATABASE IF NOT EXISTS hva_bigdata_indv_assignment;
USE hva_bigdata_indv_assignment;
CREATE TABLE IF NOT EXISTS `movielens_tmdb_imdb` (
`id` INT PRIMARY KEY NOT NULL,
`tmdb_id` INT NOT NULL,
`imdb_id` INT NOT NULL
);
CREATE TABLE IF NOT EXISTS `tmdb_genres` (
`id` INT PRIMARY KEY NOT NULL,
`name` VARCHAR... |
-- Revoke all privileges
revoke all privileges on *.* from 'pwdss_app_write'@'localhost';
-- Grant privileges for selecting, updating and inserting
grant select, update, insert on pwdss.* to 'pwdss_app_write'@'localhost';
-- Flush privileges
flush privileges;
|
--查询所有表
select * from user_tables;
--用户信息
select * from t_cms_user;
--客户信息
select * from t_cms_customer;
--产品管理
select * from T_PRODUCT_MANAGE;
--产品计费规则
select * from T_PRODUCT_CHARGE;
|
/* Subconsultas
Son consultas que se ejecutan dentro de otras consultas
*/
/* Consulta para saber qué usuarios tienen publicaciones*/
SELECT * FROM usuarios WHERE id IN(SELECT usuario_id FROM entradas);
/* DESGLOCE DE LA SENTENCIA*/
SELECT usuario_id FROM entradas;
/*LO QUE ESTÁ ENTRE PARENTESIS ES LO QUE DEVUELVE LA S... |
SELECT
--[DRA].[RID] as RID,
[STU].[GR] as [userGrade],
[DRA].[ST] as [userType],
[DRI].[SR] AS [Serial Number],
[DRI].[BC] AS [BarCode],
CONVERT(VARCHAR(10),[DRA].[DT],101) AS [Issued],
CONVERT(VARCHAR(10),[DRA].[RD],101) AS [Returned]
FROM (SELECT STU.*
FROM STU
WHERE DEL = 0 and TG = '' )
STU RIGHT JOIN ((SELE... |
{{ dbt_utils.date_spine(
datepart="day",
start_date="cast('2021-01-01' as date)",
end_date="dateadd(week, 1, current_date)"
)
}} |
-- Crear BD
CREATE DATABASE to_do_app;
--
-- COPIAR A LA BASE DE DATOS después de Realizar las migraciones
INSERT INTO `roles` (`id`, `nombre`, `descripcion`, `condicion`) VALUES
(NULL, 'Usuario', 'Usuario de la aplicación', 1);
INSERT INTO `personas` (`id`, `nombre`, `tipo_documento`, `num_documento`, `direccion`... |
CREATE FUNCTION [Transform].[fnDimEmployeeVersions] ()
RETURNS TABLE
AS
RETURN
( SELECT
[EmployeeKey]
,[EmployeeCode]
,[StartDate]
,[EndDate]
,ROW_NUMBER() OVER(
PARTITION BY [EmployeeCode]
ORDER BY [StartDate]
) AS 'Version'
FROM [Model].[DimEmployee] WITH (NOLOCK)
);
|
-- APPOINTMENT
ALTER TABLE `appointment` CHANGE `appointment_id` `appointment_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `appointment` ADD UNIQUE (
`employee_id` ,
`user_id` ,
`time_slot_id` ,
`procedure_id`
);
ALTER TABLE `beauty_parlour`.`appointment` DROP INDEX `employee_id` ,
ADD UNIQUE `uniqu... |
delete from SystemlogItem where itemid = '105'
/
insert into SystemLogItem (itemid,lableid,itemdesc) values('105',16260,'合同管理')
/
delete from SystemlogItem where itemid = '110'
/
insert into SystemLogItem (itemid,lableid,itemdesc) values('110',15786,'合同模板')
/ |
CREATE TABLE categories (
categories SMALLINT PRIMARY KEY,
description VARCHAR(20)
);
--DROP TABLE products;
CREATE TABLE products (
products SERIAL PRIMARY KEY,
description VARCHAR(40) NOT NULL,
price NUMERIC(10,4) NOT NULL,
tax NUMERIC(10,4) NOT NULL,
category SMALLINT REFERENCES categories(categori... |
## ********************************************
## Coppermine Photo Gallery
## ************************
## Copyright (c) 2003-2009 Coppermine Dev Team
## v1.1 originally written by Gregory DEMAR
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Pu... |
DROP SCHEMA IF EXISTS test_1;
CREATE SCHEMA IF NOT EXISTS test_1;
DROP SCHEMA IF EXISTS test_2;
CREATE SCHEMA IF NOT EXISTS test_2; |
INSERT INTO `#__role_privs` VALUES (0, '__cgaf', 'app', 'controller','1'),
(0, '__cgaf', 'auth', 'controller','1' ),
(0, '__cgaf', 'user', 'menu','1'),
(3, '__cgaf', 'manage', 'controller','31' ),
(3, '__cgaf', 'app', 'controller','31' ),
(3, '__cgaf', 'system', 'manage','31' );
|
CREATE DATABASE `task_managment`;
use `task_managment`;
#-------------------statuses-------------------
CREATE TABLE `statuses` (
`status_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(15) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`status_id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6... |
create table SRB_Event (
uuid_ VARCHAR(75) null,
eventId LONG not null primary key,
companyId LONG,
groupId LONG,
userId LONG,
createDate DATE null,
modifiedDate DATE null,
name VARCHAR(75) null,
description VARCHAR(75) null,
date_ DATE null,
status INTEGER,
statusByUserId LONG,
statusByUserName VARCHAR(75... |
CREATE DATABASE IF NOT EXISTS `db_springboot_backend` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `db_springboot_backend`;
-- MySQL dump 10.13 Distrib 5.7.25, for Linux (x86_64)
--
-- Host: localhost Database: db_springboot_backend
-- ------------------------------------------------------
-- Server version 5.7.2... |
SELECT * FROM VOTES
ORDER BY INSERT_DATETIME %s;
|
CREATE TABLE bikes
(
bike_id int PRIMARY KEY
);
#COPY bikes(bike_id) FROM '/home/masimou/Desktop/cyclists_network/tfl/csv/bikes.csv' #DELIMITER ',' CSV HEADER;
CREATE TABLE stations
(
station_id int PRIMARY KEY,
station_name varchar(250) NOT NULL
);
SELECT AddGeometryColumn('public','stations','location',4326,'Po... |
delete from DET;
delete from PRO;
delete from COM;
delete from FOU;
delete from CLI;
insert into CLI values (1,'Maria','Pologne','4867427275','varsovie','var','B');
insert into CLI values (2,'Ana','Autriche','4905219433','vienne','vien','B');
insert into CLI values (3,'Antonio','Espagne','7062001573','madrid',... |
delete from HtmlLabelIndex where id=21147
/
delete from HtmlLabelInfo where indexid=21147
/
INSERT INTO HtmlLabelIndex values(21147,'年度截至当月冻结预算')
/
INSERT INTO HtmlLabelInfo VALUES(21147,'年度截至当月冻结预算',7)
/
INSERT INTO HtmlLabelInfo VALUES(21147,'As of the month to freeze the annual budget',8)
/
delete from HtmlLab... |
select *
from (select avg(ss_list_price) B1_LP
,count(ss_list_price) B1_CNT
,count(distinct ss_list_price) B1_CNTD
from store_sales
where ss_quantity between 0 and 5
and (ss_list_price between 129 and 129+10
or ss_coupon_amt between 12475 and 12475+1000
... |
CREATE DATABASE gestion_coproTilleuls DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE gestion_coproTilleuls;
DROP TABLE RESIDENTS_APPARTEMENTS;
DROP TABLE APPARTEMENTS;
DROP TABLE BATIMENTS;
DROP TABLE EVENEMENTS;
DROP TABLE MESSAGES;
DROP TABLE BILLETS;
DROP TABLE CATEGORIES;
DROP TABLE AGENDAS;
DROP TABLE A... |
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you ma... |
CREATE TABLE modules (
service_id bigint NOT NULL,
name character varying(60) NOT NULL,
method character varying(60) DEFAULT 'require'::character varying
);
CREATE TABLE redirects (
service_id bigint NOT NULL,
address character varying(255) NOT NULL
);
CREATE TABLE services (
id bigint NOT NUL... |
-- phpMyAdmin SQL Dump
-- version 4.4.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jul 24, 2016 at 06:53 PM
-- Server version: 5.6.26
-- PHP Version: 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 */;... |
CREATE VIEW `zadanie4` AS
select * from nabial
where producent=4 and waga>=100
order by waga desc; |
/*资产流程新增:资产领用*/
CREATE or REPLACE PROCEDURE CptUseLogUse_Insert
(capitalid_1 integer,
usedate_2 char,
usedeptid_3 integer,
useresourceid_4 integer,
usecount_5 number,
maintaincompany_8 varchar2,
fee_9 decimal,
usestatus_10 varchar,
remark_11 varchar2,
useaddress_12 varchar2,
sptcount_... |
SELECT PartNum, Description, ListPrice
FROM PARTS
WHERE Category = 'Motherboards'; |
CREATE TABLE referrershop (
id CHAVE NOT NULL,
id_referrer CHAVE NOT NULL,
id_shop CHAVE NOT NULL,
cache_visitors INTEGER,
cache_visits INTEGER,
cache_pages INTEGER,
cache_registrations INTEGER,
cache_orders INTEGER,
cache_sales D... |
/*
Navicat MySQL Data Transfer
Source Server : Locahost
Source Server Version : 50710
Source Host : localhost:3306
Source Database : kahina
Target Server Type : MYSQL
Target Server Version : 50710
File Encoding : 65001
Date: 2016-02-16 17:57:50
*/
SET FOREIGN_KEY_CHECKS=0;
-- ---... |
DELETE FROM task
WHERE goalsid = $1;
|
select Name, count(Duration) as Quantity
from (
select Name, SpaceWalkID
from Astronaut left outer join AstronautDoSpaceWalk on Astronaut.Name = AstronautDoSpaceWalk.AstronautName) as ASW
left outer join SpaceWalk on SpaceWalk.ID = ASW.SpaceWalkID
group by(Name)
order by(Quantity) desc; |
-- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Client : localhost
-- Généré le : Jeu 22 Mars 2018 à 21:43
-- Version du serveur : 5.7.21-0ubuntu0.16.04.1
-- Version de PHP : 7.0.25-0ubuntu0.16.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101... |
2) Creation de la table TYPECOMPTE
3) Ajout de la clé étrangère (licence_id) à la table GESTIONNAIRE
4) Changement du type de donnée de la table CONNEXION (date_deconnexion)
5) Affichage du nombre d'utilisateur total et en cours
6) Modification du fichier require administration->module->master->dashboard->required.ph... |
/*
Navicat MySQL Data Transfer
Source Server : feng
Source Server Version : 50528
Source Host : localhost:3306
Source Database : mall
Target Server Type : MYSQL
Target Server Version : 50528
File Encoding : 65001
Date: 2017-09-25 14:27:32
*/
SET FOREIGN_KEY_CHECKS=0;
-- ---------... |
CREATE SCHEMA IF NOT EXISTS slickrent;
CREATE TABLE slickrent.login_platform (
id SMALLSERIAL NOT NULL PRIMARY KEY,
platform TEXT UNIQUE NOT NULL
);
INSERT INTO slickrent.login_platform (id, platform) VALUES (0, 'NATIVE');
INSERT INTO slickrent.login_platform (id, platform) VALUES (1, 'FB');
INSERT INTO slickren... |
USE codeup_test_db;
# All albums in your table.
SELECT id AS "ID",
artist AS "Artist",
name AS "Album",
release_date AS "Release Year",
sales AS "Sales",
genre AS "Genre"
FROM albums;
# All albums released before 1980
SELECT id AS "ID... |
drop table if exists admin;
drop table if exists classes;
drop table if exists score;
drop table if exists student;
/*==============================================================*/
/* Table: admin */
/*==============================================================*/... |
-- the source for this section is
-- contracts_ddl.sql
-- Normally, catalog_id and price_list_id would reference the appropriate table it is possible not to use those tables though, which is why the reference is not included
create table dbc_contract (
contract_id varchar2(40) not null,
display_name varchar2(2... |
insert into jobseeker (name, fb_id, email_address, phone_number, location,
uid)
values ('John Doe', 'fakefbid', 'jdoe@gmail.com', '4163557894',
'Mississauga, ON', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11') ON CONFLICT DO NOTHING;
insert into jobseeker (name, fb_id, email_address, phone_number, location,
uid)
... |
CREATE TABLE students
(
id INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
email VARCHAR(255) NULL,
date_of_birth DATETIME NOT NULL,
sex ENUM('male', 'female') NOT NULL,
group_name VARCHAR(255) NOT NULL,
faculty_name VARCHA... |
alter table ACT_RU_EXECUTION add CALLBACK_ID_ nvarchar(255);
alter table ACT_RU_EXECUTION add CALLBACK_TYPE_ nvarchar(255);
update ACT_GE_PROPERTY set VALUE_ = '6.2.0.0' where NAME_ = 'schema.version'; |
/*
role이란?
사용자에게 보다 효율적으로 권한을 부여할 수 있도록 여러 개의 권한
을 묶어 놓은 것을 말한다. 사용자를 생성하면 바로 사용할 수 있는
것이 아니라, 각종 권한을 부여해야 하는데 role을 통해서 손 쉽게
다양한 권한을 한번에 부여 할 수 있다..
롤의 종류
1. connect 롤
주로 사용자가 데이터베이스에 접속할 수 있도록 하는 기본적인
데이터베이스의 권한이라고 할 수 있다.
ex) ALTER SESSION, CREATE CLUSTER, CREATE DATABASE LINK,
CREATE SEQUENCE, CREATE SESSION, CRE... |
-- primary_column 테이블의 자식 테이블을 생성.
-- id를 사용하여 부가적인 정보를 더 저장할 때.
-- 자식테이블의 컬럼명과 데이터형의 크기는 달라도 된다.
select * from PRIMARY_TABLE;
select * from FOREIGN_COLUMN;
create table foreign_column(
id varchar2(20) constraint fk_id references primary_column(id) on delete cascade,
subject varchar2(30),
score number(3)
... |
create table nts_user_company
(
id bigint auto_increment
primary key,
user_id bigint null,
company_id bigint null
)
charset = utf8mb4;
create index index_company_id
on nts_user_company (company_id);
create index index_user_id
on nts_user_company (user_id);
INSERT INTO coldc... |
/*
DDL (Data Definition Language) : 데이터 정의 언어(★★★★★)
- 객체(OBJECT)를 만들고(CREATE), 수정(ALTER), 삭제(DROP) 하는 등
데이터 전체 구조를 정의하는 언어로
주로 DB관리자, 설계자가 사용함
- 오라클에서 말하는 객체 :
TABLE, VIEW, SEQUENCE, INDEX, PACKAGE, TRIGGER,
PROCEDURE, FUNCTION, SYNONYM(동의어), USER
--------------------------------------------... |
-- --------------------------------------------------------
-- Vært: 127.0.0.1
-- Server-version: 10.1.36-MariaDB - mariadb.org binary distribution
-- ServerOS: Win32
-- HeidiSQL Version: 9.5.0.5196
-- -------------------------------------------... |
USE gcp_d65e847e3db0bf733ff7;
#....................
# 4 skins
INSERT INTO attires(type, source) VALUES ('skin','Cara1');
INSERT INTO attires(type, source) VALUES ('skin','Cara2');
INSERT INTO attires(type, source) VALUES ('skin','Cara3');
INSERT INTO attires(type, source) VALUES ('skin','Cara4');
#...................... |
select round(ifnull(avg(cnt),0),2) as average_sessions_per_user
from(
select user_id, count(distinct session_id) cnt
from activity
where datediff('2019-07-27',activity_date)<30
and datediff('2019-07-27',activity_date)>=0
group by user_id
) a
|
ALTER PUBLICATION alterd_publication_event SET
(publish = 'insert, update', publish_via_partition_root = false);
|
CREATE DATABASE IF NOT EXISTS `tp5_cmt` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `tp5_cmt`;
-- 用户表
DROP TABLE IF EXISTS `cmt_user`;
CREATE TABLE `cmt_user` (
`user_id` mediumint(6) unsigned NOT NULL AUTO_INCREMENT,
`role_id` SMALLINT (6) NOT NULL DEFAULT '0', --角色id
`parent_id` SMALLINT (6) ... |
SELECT TOP 1 [FirstName]
,[LastName]
FROM [EDDSDBO].[User] AS instUser (NOLOCK)
JOIN [EDDSDBO].[UserCaseUser] AS caseUser (NOLOCK)
ON instUser.[ArtifactID] = caseUser.[UserArtifactID]
WHERE caseUser.[CaseUserArtifactID] = @CaseUserArtifactId AND caseUser.[CaseArtifactID] = @CaseArtifactId |
DELETE
FROM user_roles;
DELETE
FROM users;
DELETE
FROM dishes;
DELETE
FROM restaurants;
DELETE
FROM votes;
ALTER SEQUENCE GLOBAL_SEQ RESTART WITH 100000;
INSERT INTO users (name, email, password)
VALUES ('Admin', 'admin@gmail.com', '$2a$10$nkIkAuiTPDwI1apyvvkALuGjLzlH4z6drw.P4.kRTzWnV7c5eai9K'),
('User', 'user... |
ALTER TABLE realty_users
ADD COLUMN national_formatted_number TEXT;
ALTER TABLE facebook_scraped_posts
ADD COLUMN phone_number TEXT;
ALTER TABLE facebook_scraped_posts
ADD COLUMN national_formatted_number TEXT;
ALTER TABLE vk_posts
ADD COLUMN phone_number TEXT;
ALTER TABLE vk_posts
ADD COLUMN national_formatted_numb... |
-- #1 Select all the records from the "Customers" table.
SELECT * FROM customers;
-- #2 Get distinct countries from the Customers table.
SELECT country FROM customers;
-- #3 Get all the records from the table Customers where the Customer’s ID starts with “BL”.
SELECT * FROM customers WHERE customer_id LIKE 'B... |
CREATE TABLE IF NOT EXISTS
SC_AudioApp.Album
(
id SERIAL,
name VARCHAR(80) NOT NULL,
refArtists VARCHAR(80) NOT NULL,
year INTEGER,
CONSTRAINT pk_album PRIMARY KEY (id),
CONSTRAINT un_album UNIQUE (name, refArtists)
);
|
create or replace function delta_estrangeiro
return int
is
--declaracao do cursor
cursor c_new is select * from RFB_ESTRANGEIRO tb order by tb.uri;
cursor c_old is select * from RFB_ESTRANGEIRO_old tbold order by tbold.uri;
--declaracao das variaveis c_new
uri RFB_ESTRANGEIRO.uri%TYPE;
nome RFB_ESTRA... |
-- 여기는 USER2 입니다 |
SELECT
j.JobId,
ISNULL(SUM(p.Price * op.Quantity), 0) AS [Total]
FROM Orders AS o
INNER JOIN OrderParts AS op
ON op.OrderId = o.OrderId
INNER JOIN Parts AS p
ON p.PartId = op.PartId
RIGHT JOIN Jobs AS j
ON j.JobId = o.JobId
GROUP BY j.JobId, j.FinishDate
HAVING j.FinishDate IS NOT NULL
ORDER BY [Total] DES... |
CREATE or REPLACE PROCEDURE CRM_CustomerInfo_Delete
(id_1 integer,
deleted_1 smallint,
flag out integer ,
msg out varchar2,
thecursor IN OUT cursor_define.weavercursor)
AS
begin
UPDATE CRM_CustomerInfo SET deleted = deleted_1 WHERE ( id = id_1);
delete from CRM_Contract where ( crmId = id_1);
end;
/
d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.