blob_id
stringlengths 40
40
| language
stringclasses 1
value | repo_name
stringlengths 5
133
| path
stringlengths 3
276
| src_encoding
stringclasses 33
values | length_bytes
int64 23
9.61M
| score
float64 2.52
5.28
| int_score
int64 3
5
| detected_licenses
listlengths 0
44
| license_type
stringclasses 2
values | text
stringlengths 23
9.43M
| download_success
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
e1b7bef7ddefd7b80c421b740c76c0bd8e09b1ad
|
SQL
|
MadVitaliy/trpz_2_all_labs
|
/Lab2/Lab2.sql
|
WINDOWS-1251
| 8,294
| 3.734375
| 4
|
[] |
no_license
|
use Lab1ClassWork;
--1
select * from Discipline;
select * from StudyGroup;
select * from Position;
--2
select distinct Surname +' '+ Name +' '+ Patronymic as "", Oklad from Employee;
--3
select DateExam, Mark, StudentId, EmployeeId from Exam;
--4
select Surname +' '+ Name +' '+ Patronymic as "", Stipendia, RecordBook
from Student where Stipendia < 300;
--5
select Surname +' '+ Name +' '+ Patronymic as "", Stipendia, RecordBook, BirthdayCity
from Student where Stipendia > 500 and BirthdayCity = '';
--6
select Surname +' '+ Name +' '+ Patronymic as "", RecordBook, BirthdayCity
from Student where BirthdayCity != '';
--7
select Surname +' '+ Name +' '+ Patronymic as "", RecordBook, BirthdayCity
from Student where BirthdayCity = '' or BirthdayCity like '%';
--8
select Surname +' '+ Name +' '+ Patronymic as "", Stipendia, RecordBook, BirthdayCity
from Student where (Stipendia = 300 and BirthdayCity = '') or BirthdayCity = '';
--9
select Surname +' '+ Name +' '+ Patronymic as "", Birthday, RecordBook
from Student where Birthday between '1989-01-01' and '1990-12-31' ;
--10
select Surname +' '+ Name +' '+ Patronymic as "", Birthday, RecordBook, Stipendia
from Student where Birthday between '1989-01-01' and '1990-12-31' and Stipendia >= 600;
--11
select Surname +' '+ Name +' '+ Patronymic as "", Birthday, RecordBook
from Student where Birthday not between '1989-01-01' and '1990-12-31';
--12
select * from Exam where DisciplineId IN(2,3) and EmployeeId in(1,8);
--12.1
select Surname +' '+ Name +' '+ Patronymic as "", Stipendia, RecordBook, BirthdayCity
from Student where Stipendia = 300 and (BirthdayCity = '' or BirthdayCity = '')
--13
select * from Employee where Surname like '%';
--14
select * from Employee where year(Birthday) = 1966;
select * from Employee where Birthday like '1966%';
--15
select * from Employee where month(Birthday) = 5;
select * from Employee where Birthday like '____-05-__';
--16
select * from Employee where Birthday like '%05%';
--17
select * from Employee where month(Birthday) = 5 and Nadbavka >= 500;
select * from Employee where Birthday like '%%%%-05-%%' and Nadbavka >= 500;
--18
select * from Student where Patronymic is NOT NULL and not Stipendia = 500;
--19
select * from Student where Patronymic is NULL;
--20
select Surname +' '+ Name +' '+ Patronymic as "", EmployeeId
from Employee where DutiesId in (select DutiesId from Duties where PositionId
in (select PositionId from Position where Name like ''));
--select e.Surname +' '+ e.Name +' '+ e.Patronymic as "", d.DutiesId from Employee e
--Join Duties d on d.DutiesId = e.DutiesId;
--23
select distinct Surname +' '+ Name +' '+ Patronymic as ""
from Employee order by "" ASC;--DESC
--24
select distinct Stipendia from Student order by 1;
--25
select COUNT(*) as 'count' from Student;
--26
select COUNT(distinct Surname + Name + Patronymic) as 'count' from Student;
--27.1
select COUNT(distinct Name) as 'count' from Student;
--27.2
select COUNT(distinct Name + Surname) as 'count' from Student;
--27.3
select COUNT(distinct Patronymic) as 'count' from Student;
--28
select COUNT(*) as 'count' from Student where Stipendia = 300;
--29
select COUNT(*) as 'count', MIN(Oklad) as 'min', AVG(Oklad) as 'avg',
MAX(Oklad) as 'max' from Employee;
--29.1
select DutiesId ,COUNT(*) as 'count', MIN(Oklad) as 'min', AVG(Oklad) as 'avg',
MAX(Oklad) as 'max' from Employee group by DutiesId order by 1;
--30
select DutiesId ,COUNT(*) as 'count', MIN(Oklad) as 'min', AVG(Oklad) as 'avg',
MAX(Oklad) as 'max' from Employee e group by DutiesId having AVG(Oklad) > 3000 order by 1 ;
--31
select DutiesId ,COUNT(*) as 'count', MIN(Oklad) as 'min', AVG(Oklad) as 'avg',
MAX(Oklad) as 'max' from Employee where DutiesId in (select DutiesId from Duties where PositionId
not in (select PositionId from Position where Name like '')) group by DutiesId order by 1;
--32
select count(distinct Surname) from Student;
--33
select count(Surname) from Student where surname like '%';
--34
select distinct DutiesId from Employee where (Oklad + Nadbavka) > 5000;
select DutiesId from Employee group by DutiesId
having AVG(Oklad) + AVG(Nadbavka) > 5000 order by 1 ;
--35
select BirthdayCity as '̳' ,Count(*) as 'ʳ '
from Employee group by BirthdayCity order by 1;
select BirthdayCity as '̳' ,
Count(distinct Surname + Name + Patronymic) as 'ʳ '
from Employee group by BirthdayCity order by 1;
--select * from Employee where BirthdayCity = '';
--36
select Mark as '', COUNT(distinct StudentId) as 'ʳ ',
count(distinct DisciplineId)as 'ʳ '
from Exam group by Mark order by 1;
--select Mark, StudentId, DisciplineId from Exam order by 1,2;
--37
select DisciplineId as ' ',
COUNT(StudentId) as 'ʳ '
from Exam where Mark > 2 group by DisciplineId order by 1;
--38
select DisciplineId as ' ',
COUNT(StudentId) as 'ʳ '
from Exam where Mark = 5 group by DisciplineId order by 1;
--39
select DateExam as '',
COUNT(*) as 'ʳ '
from Exam group by DateExam order by 1;
--40
select DateExam as '', COUNT(*) as 'ʳ '
from Exam group by DateExam having COUNT(*) > 5 order by 1;
--41
--
select StudentId from Student where Stipendia <= 500 and BirthdayCity = '';
-- , ,
select Mark as '', COUNT(*) as 'ʳ 䳺 <= 500'
from Exam where StudentId in
(select StudentId from Student where Stipendia <= 500 and BirthdayCity = '')
group by Mark order by 1;
--:
--42
--e.Surname +' '+ e.Name +' '+ e.Patronymic as "", e.Birthday,
--e.Oklad, e.Nadbavka p.Name from Employee e inner joint where e.Birthday between '1945-01-01' and '1965-12-31'
--and (e.Oklad + e.Nadbavka) >= 5000;
select e.Surname +' '+ e.Name +' '+ e.Patronymic as "", e.Birthday, e.Oklad, e.Nadbavka, p.Name
from Employee e join Position p on e.DutiesId in
(select d.DutiesId from Duties d where d.PositionId not in (select PositionId from Position));
--select e.Surname +' '+ e.Name +' '+ e.Patronymic as "", e.Birthday,
--e.Oklad, e.Nadbavka p.Name from Employee e inner join Position p on e.DutiesId in
--(select DutiesId from Duties where PositionId not in (select PositionId from Position)
select Surname +' '+ Name +' '+ Patronymic as "", EmployeeId
from Employee where DutiesId in (select DutiesId from Duties where PositionId
in (select PositionId from Position where Name like ''));
--43
select BirthdayCity, AVG(Oklad) from Employee
where Birthday between '1945-01-01' and '1965-12-31' group by BirthdayCity
--44
select COUNT(Patronymic) as 'count' from Employee;
select COUNT(distinct Patronymic) as 'count' from Employee;
select COUNT(*) as 'count' from Employee where Patronymic is NULL;
--45
select avg(Oklad) from Employee;
select Sum(Oklad)/COUNT(Oklad) from Employee;
--46
select min(Oklad) as 'min', MAX(Oklad) as 'max', min(Oklad)*100 as 'min*100',
max(Oklad)*100 as 'max*100' from Employee;
--47
select StudentId, avg(Mark) as 'avg' from Exam group by StudentId having avg(Mark)>3;
--48
select Surname +' '+ Name +' '+ Patronymic as "", sum(Oklad+Nadbavka) as 'Vyplata'
from Employee where Oklad+Nadbavka > 4300 group by Surname +' '+ Name +' '+ Patronymic;
--49
--50
select Surname +' '+ Name +' '+ Patronymic as "", BirthdayCity
from Employee where exist (select sum(Oklad+Nadbavka)
from Employee where Oklad+Nadbavka > 4300 group by Surname +' '+ Name +' '+ Patronymic;)
--Oklad+Nadbavka > 4300 group by Surname +' '+ Name +' '+ Patronymic;
| true
|
15dc5045eaca4b728d8d326bf91160ea67df0cbb
|
SQL
|
shaqtee/adi_scafolding
|
/storage/laratrust26-7.sql
|
UTF-8
| 26,454
| 2.953125
| 3
|
[
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jul 25, 2021 at 09:33 PM
-- Server version: 10.5.10-MariaDB-log
-- PHP Version: 7.4.19
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `laratrust`
--
-- --------------------------------------------------------
--
-- Table structure for table `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `files`
--
CREATE TABLE `files` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`fileable_id` bigint(20) UNSIGNED NOT NULL,
`fileable_type` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `files`
--
INSERT INTO `files` (`id`, `name`, `fileable_id`, `fileable_type`, `created_at`, `updated_at`) VALUES
(1, 'public/image.jpg', 20, 'App\\Models\\Product', '2021-07-25 05:15:07', '2021-07-25 05:15:07');
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(9, '2021_07_07_072443_laratrust_setup_tables', 2),
(10, '2021_07_13_222226_create_products_table', 3),
(11, '2021_07_25_113824_create_taggables_table', 4),
(12, '2021_07_25_115605_create_tags_table', 5),
(14, '2021_07_25_120447_create_files_table', 6);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `permissions`
--
CREATE TABLE `permissions` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `permissions`
--
INSERT INTO `permissions` (`id`, `name`, `display_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'users-create', 'Create Users', 'Create Users', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(2, 'users-read', 'Read Users', 'Read Users', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(3, 'users-update', 'Update Users', 'Update Users', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(4, 'users-delete', 'Delete Users', 'Delete Users', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(5, 'payments-create', 'Create Payments', 'Create Payments', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(6, 'payments-read', 'Read Payments', 'Read Payments', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(7, 'payments-update', 'Update Payments', 'Update Payments', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(8, 'payments-delete', 'Delete Payments', 'Delete Payments', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(9, 'profile-read', 'Read Profile', 'Read Profile', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(10, 'profile-update', 'Update Profile', 'Update Profile', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(11, 'module_1_name-create', 'Create Module_1_name', 'Create Module_1_name', '2021-07-11 03:51:48', '2021-07-11 03:51:48'),
(12, 'module_1_name-read', 'Read Module_1_name', 'Read Module_1_name', '2021-07-11 03:51:48', '2021-07-11 03:51:48'),
(13, 'module_1_name-update', 'Update Module_1_name', 'Update Module_1_name', '2021-07-11 03:51:48', '2021-07-11 03:51:48'),
(14, 'module_1_name-delete', 'Delete Module_1_name', 'Delete Module_1_name', '2021-07-11 03:51:48', '2021-07-11 03:51:48');
-- --------------------------------------------------------
--
-- Table structure for table `permission_role`
--
CREATE TABLE `permission_role` (
`permission_id` bigint(20) UNSIGNED NOT NULL,
`role_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `permission_role`
--
INSERT INTO `permission_role` (`permission_id`, `role_id`) VALUES
(1, 1),
(1, 2),
(2, 1),
(2, 2),
(3, 1),
(3, 2),
(4, 1),
(4, 2),
(5, 1),
(6, 1),
(7, 1),
(8, 1),
(9, 1),
(9, 2),
(9, 3),
(10, 1),
(10, 2),
(10, 3),
(11, 4),
(12, 4),
(13, 4),
(14, 4);
-- --------------------------------------------------------
--
-- Table structure for table `permission_user`
--
CREATE TABLE `permission_user` (
`permission_id` bigint(20) UNSIGNED NOT NULL,
`user_id` bigint(20) UNSIGNED NOT NULL,
`user_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `permission_user`
--
INSERT INTO `permission_user` (`permission_id`, `user_id`, `user_type`) VALUES
(1, 12, 'App\\Models\\User'),
(2, 12, 'App\\Models\\User'),
(3, 12, 'App\\Models\\User'),
(4, 12, 'App\\Models\\User'),
(5, 12, 'App\\Models\\User'),
(6, 12, 'App\\Models\\User'),
(7, 12, 'App\\Models\\User'),
(8, 12, 'App\\Models\\User'),
(9, 12, 'App\\Models\\User'),
(10, 12, 'App\\Models\\User'),
(2, 13, 'App\\Models\\User'),
(9, 13, 'App\\Models\\User'),
(10, 13, 'App\\Models\\User');
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
CREATE TABLE `products` (
`id` bigint(20) UNSIGNED NOT NULL,
`nama_produk` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`harga` bigint(20) UNSIGNED NOT NULL,
`deskripsi` text COLLATE utf8mb4_unicode_ci NOT NULL,
`kategori` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`foto` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`id`, `nama_produk`, `harga`, `deskripsi`, `kategori`, `foto`, `created_at`, `updated_at`) VALUES
(20, 'Pot Bunga', 120000, 'Modern Style from Yojuma', 'Barang Bekas', 'https://source.unsplash.com/aMMbyCb8fSo/600x600', NULL, NULL),
(21, 'Furniture Set', 650000, 'Modern Style from Hannah Busing', 'Barang Bekas', 'https://source.unsplash.com/nME9TubZtSo/600x600', NULL, NULL),
(22, 'Tas Cantik', 1250000, 'Modern Style from Mohammad Metri', 'Barang Bekas', 'https://source.unsplash.com/gw97geWhUPI/600x600', NULL, NULL),
(23, 'Mesin Kopi Praktis', 750000, 'Modern Style from Joshua Davis', 'Barang Bekas', 'https://source.unsplash.com/auuDZ0hglhM/600x600', NULL, NULL),
(24, 'Sepeda Jadul', 930000, 'Modern Style from Laura Petrilli', 'Barang Bekas', 'https://source.unsplash.com/tEFc4IUBGKA/600x600', NULL, NULL),
(25, 'Tupperware Handmate', 5000, 'Modern Style from Chris King', 'Barang Bekas', 'https://source.unsplash.com/JZw4AVP58d0/600x600', NULL, NULL),
(26, 'Mesin Ketik Jadul', 194000, 'Modern Style from Rishi Laishram', 'Barang Bekas', 'https://source.unsplash.com/orW_8JcNk4M/600x600', NULL, NULL),
(27, 'Kursi Meja Cantik', 145000, 'Modern Style from Inside Weather', 'Barang Bekas', 'https://source.unsplash.com/90ApxSJTTdg/600x600', NULL, NULL),
(28, 'Kacamata Bunder', 475900, 'Modern Style from Charles Deluvio', 'Barang Bekas', 'https://source.unsplash.com/1-nx1QR5dTE/600x600', NULL, NULL),
(29, 'Sepatu Unik', 60000, 'Modern Style from Alexandra Gorn', 'Barang Bekas', 'https://source.unsplash.com/CJ6SJO_yR5w/600x600', NULL, NULL),
(30, 'Packaging Susu', 10000, 'Plant-Based. Build a better planet.', 'Bahan Kue', 'https://source.unsplash.com/7mr6Yx-8WLc/600x600', NULL, NULL),
(31, 'Marmit Peanut Butter', 27000, 'Photos by Brett Jordan', 'Bahan Kue', 'https://source.unsplash.com/vbiFp8ro1Vw/600x600', NULL, NULL),
(32, 'Spageti', 30000, 'Photos by Deva Darshan', 'Bahan Kue', 'https://source.unsplash.com/F0ot6ma5Fdo/600x600', NULL, NULL),
(33, 'Tepung Tapioka', 25000, 'Photos by David Fedulov', 'Bahan Kue', 'https://source.unsplash.com/x6oBAbzzXo4/600x600', NULL, NULL),
(34, 'Coklat Import', 24000, 'Photos by Scarlet Alt', 'Bahan Kue', 'https://source.unsplash.com/I1CkORYYz6s/600x600', NULL, NULL),
(35, 'Permen Hias', 29500, 'Photos by Amit Lahav', 'Bahan Kue', 'https://source.unsplash.com/3oDQKoKPMng/600x600', NULL, NULL),
(36, 'Vegan Bechamel Sauce', 32750, 'Import from Canada', 'Bahan Kue', 'https://source.unsplash.com/DIcCGj91qOg/600x600', NULL, NULL),
(37, 'Cakers Photomate', 65000, 'That\'s Her Business', 'Bahan Kue', 'https://source.unsplash.com/7RWjlGWQ7S8/600x600', NULL, NULL),
(38, 'Set Hampers Packaging', 120000, 'Photos by Nguyen Linh', 'Bahan Kue', 'https://source.unsplash.com/rwatU6FCGRU/600x600', NULL, NULL),
(39, 'Kemasan Kertas', 2000, 'Photos by Yu Hosoi', 'Bahan Kue', 'https://source.unsplash.com/ViR3a0rx18w/600x600', NULL, NULL),
(40, 'Editing Video', 1000000, 'Photos by Emmanuel', 'Produk Digital', 'https://source.unsplash.com/UVlmNi4CaBQ/600x600', NULL, NULL),
(41, 'Mobile App Webview', 20000000, 'Photos by Rahul Chakraborty', 'Produk Digital', 'https://source.unsplash.com/xsGxhtAsfSA/600x600', NULL, NULL),
(42, 'Logo Design', 300000, 'Photos by Dylan Calluy', 'Produk Digital', 'https://source.unsplash.com/sZ9Glt1wmgU/600x600', NULL, NULL),
(43, 'T-Shirt Sablon Custom', 135000, 'Photos by Geofroy Danest', 'Produk Digital', 'https://source.unsplash.com/uhKVcZNBv80/600x600', NULL, NULL),
(44, 'Editing by Request', 500000, 'Abdulbadi Present', 'Produk Digital', 'https://source.unsplash.com/KukKYcxGOwU/600x600', NULL, NULL),
(45, 'Sesi Foto', 1250000, 'Photos by Dylann Ferreira', 'Produk Digital', 'https://source.unsplash.com/aM-reLiIabA/600x600', NULL, NULL),
(46, 'Audio Editing', 1250000, 'Photos by Axel Mencia', 'Produk Digital', 'https://source.unsplash.com/5SoYbzKhqfA/600x600', NULL, NULL),
(47, 'Social Media Maintain', 4000000, 'Photos by Deny Simanjuntak', 'Produk Digital', 'https://source.unsplash.com/pYoj2nyokOg/600x600', NULL, NULL),
(48, 'Foto Produk', 1250000, 'Photos by Laura Chouette', 'Produk Digital', 'https://source.unsplash.com/0uO0m798HmU/600x600', NULL, NULL),
(49, 'Instagram Maintain', 1250000, 'Photos by Charles Deluvio', 'Produk Digital', 'https://source.unsplash.com/FdDkfYFHqe4/600x600', NULL, NULL),
(50, 'Jeans Grosir', 68000, 'Photos by Maudefl', 'Fashion', 'https://source.unsplash.com/EDSTj4kCUcw/600x600', NULL, NULL),
(51, 'Detective Style Set', 2100000, 'Photos by Benjamin Rascoe', 'Fashion', 'https://source.unsplash.com/ItqFmSxKnIg/600x600', NULL, NULL),
(52, 'Chanel Parfum', 235000, 'Photos by Laura Chouette', 'Fashion', 'https://source.unsplash.com/MrYhyccrNO0/600x600', NULL, NULL),
(53, 'Jam Tangan', 175000, 'Photos by Krismawan Kadek', 'Fashion', 'https://source.unsplash.com/9VYig9LmUmE/600x600', NULL, NULL),
(54, 'Sepatu Kantoran', 275000, 'Photos by Iman Ameli', 'Fashion', 'https://source.unsplash.com/jng0VFa-jRw/600x600', NULL, NULL),
(55, 'Topi Piknik', 99000, 'Photos by Hans Jurgen', 'Fashion', 'https://source.unsplash.com/Yz4jCyp9JiM/600x600', NULL, NULL),
(56, 'Red Sweater', 125000, 'Photos by Alireza Kazemi', 'Fashion', 'https://source.unsplash.com/80krFvBowBg/600x600', NULL, NULL),
(57, 'Black Sweater', 125000, 'Photos by Alireza Esmaeeli', 'Fashion', 'https://source.unsplash.com/BGSZ1t80rpM/600x600', NULL, NULL),
(58, 'Blue Sweater', 1250000, 'Photos by Danny Protas', 'Fashion', 'https://source.unsplash.com/EJoQus959qo/600x600', NULL, NULL),
(59, 'Sepatu Lucu', 1250000, 'Photos by Mahabis Footwear', 'Fashion', 'https://source.unsplash.com/DyUDs65NmBk/600x600', NULL, NULL),
(60, 'Hand Sanitizer', 35000, 'Photos by Austin Piwinski', 'Kesehatan', 'https://source.unsplash.com/9jUoQWGoOXw/600x600', NULL, NULL),
(61, 'Nora Tropical', 210000, 'Nora Brands', 'Kesehatan', 'https://source.unsplash.com/IbfC88l5u8c/600x600', NULL, NULL),
(62, 'Omega3', 195000, 'Photos by Andreas M', 'Kesehatan', 'https://source.unsplash.com/AizSoIlfKRc/600x600', NULL, NULL),
(63, 'Masker Gas', 111000, 'Photos by Obi Onyeador', 'Kesehatan', 'https://source.unsplash.com/zYq4ShRBnHs/600x600', NULL, NULL),
(64, 'Jamu', 165000, 'Photos by Mehrshad', 'Kesehatan', 'https://source.unsplash.com/P7MkoYvSnLI/600x600', NULL, NULL),
(65, 'Masker Medis', 20000, 'Photos by Bud Nug', 'Kesehatan', 'https://source.unsplash.com/6IF101xBjI0/600x600', NULL, NULL),
(66, 'Masker Batik', 15000, 'Photos by Visual', 'Kesehatan', 'https://source.unsplash.com/aWBzaYPcPDA/600x600', NULL, NULL),
(67, 'Pink Stethoscope', 35000, 'Photos by Christopel Boswell', 'Kesehatan', 'https://source.unsplash.com/GEzNsJarkGU/600x600', NULL, NULL),
(68, 'Obat Batuk', 70000, 'Photos by Biolabs', 'Kesehatan', 'https://source.unsplash.com/PcHu6W2sKpg/600x600', NULL, NULL),
(69, 'Sabun Cair', 27000, 'Photos by Jonathan Cooper', 'Kesehatan', 'https://source.unsplash.com/mQ-RCaADQxs/600x600', NULL, NULL),
(70, 'Mandee Rice 5kg', 245000, 'Photos by Wahaj Sufian', 'Sembako', 'https://source.unsplash.com/ocd_xKscv1I/600x600', NULL, NULL),
(71, 'Kacang Arab', 175000, 'Mockup Graphics', 'Sembako', 'https://source.unsplash.com/v_a3DWpOFc0/600x600', NULL, NULL),
(72, 'Gula', 50000, 'Photos by Lena Myzovets', 'Sembako', 'https://source.unsplash.com/SY_J8ud1pNo/600x600', NULL, NULL),
(73, 'Telur', 70000, 'Photos by Fabizio', 'Sembako', 'https://source.unsplash.com/8-V0kdrwNs4/600x600', NULL, NULL),
(74, 'Jagung', 64000, 'Photos by Inticate Explorer', 'Sembako', 'https://source.unsplash.com/j-GJ1Vqc1SI/600x600', NULL, NULL),
(75, 'Garam', 50000, 'Photos by Curioso', 'Sembako', 'https://source.unsplash.com/lnbR0E65Yn4/600x600', NULL, NULL),
(76, 'Daging Sapi', 89500, 'Photos by John Cameron', 'Sembako', 'https://source.unsplash.com/6-5Ul3I6vSE/600x600', NULL, NULL),
(77, 'Daging Ayam', 35000, 'Photos by Huynt Quyet', 'Sembako', 'https://source.unsplash.com/YgirePmHPZU/600x600', NULL, NULL),
(78, 'Susu', 35000, 'Photos by Autum Hassett', 'Sembako', 'https://source.unsplash.com/nOctn3PEC0E/600x600', NULL, NULL),
(79, 'Cooking Oil', 70000, 'Photos by Lottie Griffiths', 'Sembako', 'https://source.unsplash.com/fzPHKbIt1IE/600x600', NULL, NULL),
(80, 'Kentang Goreng', 5000, 'Photos by Fernando', 'Snack', 'https://source.unsplash.com/R3f2emOt1bU/600x600', NULL, NULL),
(81, 'Love Corn', 6000, 'Photos by Tyler Nix', 'Snack', 'https://source.unsplash.com/TF8Inmn3Dtw/600x600', NULL, NULL),
(82, 'Zigzag Irvins', 7000, 'Photos by Tony Pham', 'Snack', 'https://source.unsplash.com/4zetMBTnoT4/600x600', NULL, NULL),
(83, 'Pulsitos', 4500, 'Pulsitos Brands', 'Snack', 'https://source.unsplash.com/uToWEwMctE8/600x600', NULL, NULL),
(84, 'Muddy Bites', 6500, 'Photos by Tyler Nix', 'Snack', 'https://source.unsplash.com/KLvJr6leOFg/600x600', NULL, NULL),
(85, 'Hampers Lebaran', 50000, 'Photos by Tanaphong Toochinda', 'Snack', 'https://source.unsplash.com/_f8S_o9xQK8/600x600', NULL, NULL),
(86, 'Kacang Mente', 325000, 'Mockup Graphics', 'Snack', 'https://source.unsplash.com/y6PeMgIa2Xo/600x600', NULL, NULL),
(87, 'Popcorn', 10000, 'Photos by Sumeet B', 'Snack', 'https://source.unsplash.com/M5DRKOFiv-o/600x600', NULL, NULL),
(88, 'Coklat Gula-Gula', 6500, 'American Heritage Chocolate', 'Snack', 'https://source.unsplash.com/uHHC3xS9u3o/600x600', NULL, NULL),
(89, 'Sushi Set', 98000, 'Photos by Farhad Ibrahimzade', 'Snack', 'https://source.unsplash.com/lKk2xzM0YFU/600x600', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
CREATE TABLE `roles` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `roles`
--
INSERT INTO `roles` (`id`, `name`, `display_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'superadministrator', 'Superadministrator', 'Superadministrator', '2021-07-11 03:51:47', '2021-07-11 03:51:47'),
(2, 'administrator', 'Administrator', 'Administrator', '2021-07-11 03:51:48', '2021-07-11 03:51:48'),
(3, 'user', 'User', 'User', '2021-07-11 03:51:48', '2021-07-11 03:51:48'),
(4, 'role_name', 'Role Name', 'Role Name', '2021-07-11 03:51:48', '2021-07-11 03:51:48');
-- --------------------------------------------------------
--
-- Table structure for table `role_user`
--
CREATE TABLE `role_user` (
`role_id` bigint(20) UNSIGNED NOT NULL,
`user_id` bigint(20) UNSIGNED NOT NULL,
`user_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'App\\Models\\User'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `role_user`
--
INSERT INTO `role_user` (`role_id`, `user_id`, `user_type`) VALUES
(2, 12, 'App\\Models\\User'),
(3, 12, 'App\\Models\\User'),
(3, 13, 'App\\Models\\User');
-- --------------------------------------------------------
--
-- Table structure for table `taggables`
--
CREATE TABLE `taggables` (
`tag_id` bigint(20) UNSIGNED NOT NULL,
`taggable_id` bigint(20) UNSIGNED NOT NULL,
`taggable_type` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `taggables`
--
INSERT INTO `taggables` (`tag_id`, `taggable_id`, `taggable_type`, `created_at`, `updated_at`) VALUES
(1, 20, 'App\\Models\\Product', NULL, NULL),
(1, 21, 'App\\Models\\Product', NULL, NULL),
(6, 59, 'App\\Models\\Product', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `tags`
--
CREATE TABLE `tags` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`label` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `tags`
--
INSERT INTO `tags` (`id`, `name`, `label`, `created_at`, `updated_at`) VALUES
(1, 'Furniture', NULL, '2021-07-25 05:01:28', '2021-07-25 05:01:28'),
(2, 'Tas', NULL, NULL, NULL),
(3, 'Peralatan', NULL, NULL, NULL),
(4, 'Aksesoris', NULL, NULL, NULL),
(5, 'Sweater', NULL, NULL, NULL),
(6, 'Sepatu', NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Superadministrator', 'superadministrator@app.com', NULL, '$2y$10$0pOgXBcOO2Aiak3Y9Z3pdeD70jxbVcwigTylhUtmLgI0P33gy6qra', NULL, '2021-07-07 13:20:22', '2021-07-07 13:20:22'),
(2, 'Franz Bergnaum', 'nasir47@example.com', '2021-07-07 14:07:22', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'g7yg9j64G4', '2021-07-07 14:07:22', '2021-07-07 14:07:22'),
(3, 'Dr. Tyree Koss PhD', 'tianna.west@example.org', '2021-07-07 14:07:22', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'oKMPvsKPWb', '2021-07-07 14:07:22', '2021-07-07 14:07:22'),
(4, 'Reva Parker', 'dooley.susie@example.org', '2021-07-07 14:07:22', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Gtnwciwz6r', '2021-07-07 14:07:22', '2021-07-07 14:07:22'),
(5, 'Breana Bartell I', 'linnea63@example.net', '2021-07-07 14:07:22', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'k2hmnlgOUz', '2021-07-07 14:07:22', '2021-07-07 14:07:22'),
(6, 'Hailie Swift', 'omckenzie@example.org', '2021-07-07 14:07:22', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'ahCXy5CbvX', '2021-07-07 14:07:22', '2021-07-07 14:07:22'),
(7, 'Prof. Hester O\'Connell', 'jennifer56@example.com', '2021-07-07 14:14:55', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', '13GVoiWbEb', '2021-07-07 14:14:55', '2021-07-07 14:14:55'),
(8, 'Prof. Maxine Kshlerin', 'kody81@example.com', '2021-07-07 14:14:55', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'DSskn8e1bA', '2021-07-07 14:14:55', '2021-07-07 14:14:55'),
(9, 'Mrs. Matilda Hackett', 'ukreiger@example.net', '2021-07-07 14:14:55', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'PsFoKTMqMt', '2021-07-07 14:14:55', '2021-07-07 14:14:55'),
(10, 'Marian Batz', 'shany.leannon@example.com', '2021-07-07 14:14:55', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'KtqyJvDr7V', '2021-07-07 14:14:55', '2021-07-07 14:14:55'),
(11, 'Brown Gutmann MD', 'kaitlyn.heidenreich@example.com', '2021-07-07 14:14:55', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'AVtsqE04Kh', '2021-07-07 14:14:55', '2021-07-07 14:14:55'),
(12, 'abdulbadi', 'adi.sakti@live.com', NULL, '$2y$10$J4hIOhd.bic8sEyc04hla.KSsx/Wqa.VA1ZAJ/EFEMDZuYUKu.wjS', NULL, '2021-07-07 14:16:45', '2021-07-07 14:16:45'),
(13, 'shaqtee', 'shaqtee@gmail.com', NULL, '$2y$10$MmElZCLCigvMSPvAQh5e7uyXGzDpBoDRJErxZhphnBTKPTdXPjuzm', NULL, '2021-07-07 14:17:55', '2021-07-07 14:17:55');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);
--
-- Indexes for table `files`
--
ALTER TABLE `files`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `permissions_name_unique` (`name`);
--
-- Indexes for table `permission_role`
--
ALTER TABLE `permission_role`
ADD PRIMARY KEY (`permission_id`,`role_id`),
ADD KEY `permission_role_role_id_foreign` (`role_id`);
--
-- Indexes for table `permission_user`
--
ALTER TABLE `permission_user`
ADD PRIMARY KEY (`user_id`,`permission_id`,`user_type`),
ADD KEY `permission_user_permission_id_foreign` (`permission_id`);
--
-- Indexes for table `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `roles_name_unique` (`name`);
--
-- Indexes for table `role_user`
--
ALTER TABLE `role_user`
ADD PRIMARY KEY (`user_id`,`role_id`,`user_type`),
ADD KEY `role_user_role_id_foreign` (`role_id`);
--
-- Indexes for table `tags`
--
ALTER TABLE `tags`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `files`
--
ALTER TABLE `files`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=90;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tags`
--
ALTER TABLE `tags`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `permission_role`
--
ALTER TABLE `permission_role`
ADD CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `permission_user`
--
ALTER TABLE `permission_user`
ADD CONSTRAINT `permission_user_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `role_user`
--
ALTER TABLE `role_user`
ADD CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
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 */;
| true
|
5162eb6c1fd04fe07dd74a35c681fca6e0d09d44
|
SQL
|
sblashuk/epam-cource-cinema
|
/src/main/resources/sql/insert-data.sql
|
UTF-8
| 1,520
| 2.921875
| 3
|
[] |
no_license
|
INSERT INTO auditorium (name, number_of_seats) VALUES
('Small', 50),
('Big', 100);
INSERT INTO event_rating (name) VALUES
('LOW'),
('MID'),
('HIGH');
INSERT INTO event (name, base_price, event_rating_id) VALUES
('Kingsman 2', 5.0, 1);
INSERT INTO role (role_name) VALUES
('admin'),
('user'),
('manager');
INSERT INTO user (first_name, last_name, email, birthday, password) VALUES
('Siarhei', 'Blashuk', 'Siarhei_Blashuk@epam.com', '1996-07-18', '$2a$10$zh4mEB7Frd31jn1UZQv1AuT2bJI2di6aXmOp.Uv0EhIzKsgQlkKIG'),
('Admin', 'Admin', 'admin@mail.com', '1997-02-21', '$2a$10$zh4mEB7Frd31jn1UZQv1AuT2bJI2di6aXmOp.Uv0EhIzKsgQlkKIG'),
('User', 'User', 'user@mail.com', '1997-02-21', '$2a$10$zh4mEB7Frd31jn1UZQv1AuT2bJI2di6aXmOp.Uv0EhIzKsgQlkKIG'),
('Manager', 'Manager', 'manager@mail.com', '1997-02-21', '$2a$10$zh4mEB7Frd31jn1UZQv1AuT2bJI2di6aXmOp.Uv0EhIzKsgQlkKIG');
INSERT INTO event_auditoriums (event_id, auditorium_id, start_time) VALUES
(1, 2, '2017-10-01 18:30:00');
INSERT INTO ticket (user_id, event_id, date_time, seat) VALUES
(1, 1, '2017-10-01 18:30:00', 10),
(2, 1, '2017-10-01 18:30:00', 11),
(3, 1, '2017-10-01 18:30:00', 12),
(4, 1, '2017-10-01 18:30:00', 13),
(1, 1, '2017-10-01 18:30:00', 14),
(2, 1, '2017-10-01 18:30:00', 15),
(3, 1, '2017-10-01 18:30:00', 16),
(4, 1, '2017-10-01 18:30:00', 17);
INSERT INTO user_roles (user_id, role_id) VALUES
(1, 1),
(2, 1),
(3, 2),
(4, 3);
INSERT INTO user_account (user_id, money) VALUES
(1, 1000.0),
(2, 100.0),
(3, 100.0),
(4, 100.0);
| true
|
cf7dbcd3f2587e2f9a76190178e1e267e508f4f7
|
SQL
|
Naudar79/www
|
/php-training-mysql/reunion_island.sql
|
UTF-8
| 807
| 3.5625
| 4
|
[] |
no_license
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
--
-- Base de données : `becode`
--
-- --------------------------------------------------------
--
-- Structure de la table `hiking`
--
CREATE TABLE `hiking` (
`id` int(11) NOT NULL,
`name` varchar(400) NOT NULL,
`difficulty` char(30) NOT NULL,
`distance` int(11) NOT NULL,
`duration` time NOT NULL,
`height_difference` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `hiking`
--
ALTER TABLE `hiking`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `hiking`
--
ALTER TABLE `hiking`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
| true
|
7887f33011f682ce5f89daf6537a6e6f61ff41a6
|
SQL
|
rexfordcode/codefights
|
/databases/queriesExecution.sql
|
UTF-8
| 2,561
| 4.0625
| 4
|
[] |
no_license
|
/*
https://app.codesignal.com/arcade/db/exotic-dishes/Mxv2EhqjsGs3oPkNG
You're working at a company that sells handmade toys. You're supposed to write a monthly report for your managers about how the company is doing. It takes a lot of time to create these reports manually, so you decided to write a function that will make the process easier.
Information for your reports is given in three tables:
orders (information about the orders made throughout the month):
order_id: the unique order ID;
order_type: either "Buy" or "Sell";
date_placed: the date the order was made;
order_qty: the quantity of ordered items;
order_price: the price of the order;
execution (information about executed orders):
execution_id: the unique execution ID;
order_id: foreign key referencing orders.order_id;
execution_date: the date of the execution;
execution_qty: the quantity of bought or sold items;
execution_price: the cost of the execution;
queries (queries which results should be in the reports):
query_name: the name of the query;
code: the code of the query that should be executed; it's guaranteed that each code returns exactly one value.
In order to prepare the required values for your next report, you should create a new table with columns query_name and val. For each query_name, the result of the executed query should be stored in the respective val column. The table should be sorted by query_name in ascending order.
Example
For the following tables orders:
order_id order_type date_placed order_qty order_price
1 Buy 2014-03-15 5 50
2 Buy 2014-02-03 15 23
3 Sell 2014-01-16 45 2
4 Sell 2014-01-17 10 7
execution:
execution_id order_id execution_date execution_qty execution_price
1 1 2014-03-16 2 49
2 1 2014-03-17 3 51
3 2 2014-02-03 15 22
4 3 2014-01-17 45 2
and queries:
query_name code
AVG_EXEC_PRICE SELECT AVG(execution_price) FROM `execution`
COUNT_EXECUTIONS SELECT COUNT(execution_id) FROM `execution`
MIN_ORDER_DATE SELECT MIN(date_placed) FROM `orders`
SUM_ORD_QTY SELECT SUM(order_qty) FROM `orders`
the output should be
query_name val
AVG_EXEC_PRICE 31.000000000
COUNT_EXECUTIONS 4
MIN_ORDER_DATE 2014-01-16
SUM_ORD_QTY 75
*/
CREATE PROCEDURE queriesExecution()
BEGIN
SET @v = CONCAT(
(SELECT group_concat(
concat('select "',
query_name,
'" query_name, (',
code,
') val')
SEPARATOR ' union ') FROM queries),
' order by 1');
PREPARE query FROM @v;
execute query;
END
| true
|
ef126889129c87ba71f8c5dd26dee65ea30d5b9b
|
SQL
|
liwen666/lw_code
|
/tempcode/src/main/java/commons/execscript/sql/bgt/common/common_239_.sql
|
GB18030
| 18,563
| 3.234375
| 3
|
[] |
no_license
|
CREATE OR REPLACE PROCEDURE IND_SP_ZYAuditSumProc(v_TaskID varchar2,v_DestModelID varchar2,v_AgencyID varchar2)
AS
v_RelaTableName varchar2(32);
v_UserManaDistrict varchar2(32);
v_AuditTypeID varchar2(32);
v_ModelID varchar2(32);
-- v_TaskBudgetLevel varchar2(10);
v_SQL varchar2(30000);
v_sql2 varchar2(500);
-- v_DataStartDate varchar2(20);
-- v_DataEndDate varchar2(20);
BEGIN
SELECT DBTableName INTO v_RelaTableName FROM Dict_t_Model WHERE TableID = v_DestModelID;
--SELECT DistrictID INTO v_UserManaDistrict FROM Tra_v_UserManaDistrict WHERE UserID = v_UserID;
--SELECT AGENCY INTO v_UserManaDistrict FROM FASP_T_CAUSER WHERE GUID = v_UserID;
v_UserManaDistrict := v_AgencyID;
--SELECT AuditTypeID INTO v_AuditTypeID FROM Ind_t_Audittype WHERE AuditTypeName = 'רõӶ';
/* SELECT '' TaskBudgetLevel,CreateDate,EndDate
INTO v_TaskBudgetLevel,v_DataStartDate,v_DataEndDate
FROM CDT_T_TASKINFO where TaskID = v_TaskID;*/
/* SELECT '' TaskBudgetLevel,DataStartDate,DataEndDate
INTO v_TaskBudgetLevel,v_DataStartDate,v_DataEndDate
FROM CDT_T_TASKINFO where TaskID = v_TaskID;
/*
ϼ´ָܱ IND_T_ZBDJHZB
Ӷָܱ IND_T_DZDJHZB
*/
--ˢ»ܱ
/* FOR c1 IN (SELECT ModelID FROM Ind_t_AuditSumDef WHERE AuditTypeID = v_AuditTypeID) LOOP
v_ModelID := c1.ModelID;
IND_SP_AuditSumProc(v_TaskID,v_AuditTypeID,v_ModelID,v_UserManaDistrict);
END LOOP;*/
--ֱִл
v_SQL := 'DELETE FROM B3_BZXJZYZFQKBFZ WHERE agencyid = '''||v_UserManaDistrict||'''';
EXECUTE IMMEDIATE v_SQL;
v_SQL := 'INSERT INTO B3_BZXJZYZFQKBFZ
(DataKey,
agencyid,
EXPFUNCGUID,
FUNDTYPEGUID,
ZY,
BZ,
XDWH,
SFJSBZ,
BMLX,
XDLX,
AMT,
SENDDOCTIME,
FININTORGGUID,
INPUTDISTRICT)
SELECT RAWTOHEX(SYS_GUID()) AS DataKey,
AgencyID,
Z_THSZCGNKM,
ConnStrA(DISTINCT (SELECT x.Name || '' ''
FROM (SELECT ID, NAME FROM FASP_V_PUBFUNDTYPE) x
WHERE x.ID = FUNDTYPEGUID) || ''''),
ConnStrA(DISTINCT ZY || ''''),
ConnStrA(DISTINCT BZ || ''''),
XDWH,
ConnStrA(DISTINCT (SELECT x.Name || '' ''
FROM (SELECT ID, NAME FROM FASP_V_PUBPUBBOOL) x
WHERE x.ID = SFJSBZ) || ''''),
ConnStrA(DISTINCT (SELECT x.Name || '' ''
FROM (SELECT ID, NAME FROM FASP_V_PUBSUPDEP) x
WHERE x.ID = BMLX) || ''''),
ConnStrA(DISTINCT (SELECT x.Name || '' ''
FROM (SELECT ID, NAME FROM CODE_T_PUBXDLX) x
WHERE x.ID = XDLX) || ''''),
Sum(AMT),
ConnStrA(DISTINCT SENDDOCTIME || ''''),
ConnStrA(DISTINCT (SELECT x.Name || '' ''
FROM (SELECT ID, NAME FROM FASP_V_PUBDEPARTMENT) x
WHERE x.ID = FININTORGGUID) || ''''),
INPUTDISTRICT
FROM (SELECT aa.*,
CASE
WHEN EXISTS
(SELECT 1
FROM FASP_V_PUBEXPFUNC x
WHERE rownum < 2
AND SubStr(x.ShowID, 1, 5) IN (''23003'', ''23004'')
AND aa.TRANPAYFUNC = x.ID) THEN
aa.EXPFUNCGUID
ELSE
aa.TRANPAYFUNC
END as Z_THSZCGNKM
FROM BAS_T_ZYZYZFZBB aa) a
WHERE agencyid = '''||v_UserManaDistrict||''''||'
GROUP BY INPUTDISTRICT, XDWH, AgencyID, Z_THSZCGNKM';
EXECUTE IMMEDIATE v_SQL;
/* v_sql2 := 'delete from a where b= ''B3_BZXJZYZFQKBFZ''';
EXECUTE IMMEDIATE v_SQL2;
insert into a(a,b) values (v_SQL,'B3_BZXJZYZFQKBFZ');*/
v_SQL := 'DELETE FROM B4_BJDJZBQKBFZ WHERE agencyid = '''||v_UserManaDistrict||'''';
EXECUTE IMMEDIATE v_SQL;
v_SQL := 'INSERT INTO B4_BJDJZBQKBFZ
(DataKey, agencyid, EXPFUNCGUID, AMT, XDWH, BZ, SJAGENCYID)
SELECT RAWTOHEX(SYS_GUID()) AS DataKey,
AgencyID,
EXPFUNCGUID,
Sum(AMT),
XDWH,
ConnStrA(DISTINCT BZ || ''''),
SJAGENCYID
FROM BAS_T_BJDJZBQKB a
WHERE agencyid = '''||v_UserManaDistrict||''''||'
GROUP BY XDWH, SJAGENCYID, AgencyID, EXPFUNCGUID';
EXECUTE IMMEDIATE v_SQL;
/* v_sql2 := 'delete from a where b= ''B4_BJDJZBQKBFZ''';
EXECUTE IMMEDIATE v_SQL2;
insert into a(a,b) values (v_SQL,'B4_BJDJZBQKBFZ' );*/
--ɾ˽
v_SQL := 'DELETE FROM '||v_RelaTableName||' WHERE TaskID = '''||v_TaskID||'''' || ' and agencyid = '''||v_UserManaDistrict||'''';
EXECUTE IMMEDIATE v_SQL;
/*
year, province, dbversion, status, taskid, datakey, orderid, needupdate, finyear, agencyid,
xdwh, senddoctime, finintorgguid, ysxm, tranpayfunc, expfuncguid, fundtypeguid, sfjsbz, amt, bdwjewy, cewy, dzxx, bz, expstrname, sjagencyid
DATAKEY,ORDERID,FINYEAR,AGENCYID,XDWH,SENDDOCTIME,FININTORGGUID,YSXM,TRANPAYFUNC,EXPFUNCGUID,EXPSTRNAME,FUNDTYPEGUID,SFJSBZ,AMT,BDWJEWY,CEWY,DZXX,SJAGENCYID,BZ
*/
v_SQL :='
INSERT INTO '||v_RelaTableName||' (
DATAKEY,ORDERID,FINYEAR,AGENCYID,XDWH,SENDDOCTIME,FININTORGGUID,YSXM,EXPFUNCGUID,FUNDTYPEGUID,SFJSBZ,AMT,BDWJEWY,CEWY,DZXX,SJAGENCYID,BZ
)
SELECT RAWTOHEX(SYS_GUID()) AS DataKey,
rownum as orderid,
a.finyear,
a.agencyid,
a.xdwh,
a.senddoctime,
a.FININTORGGUID,
a.YSXM,
a.EXPFUNCGUID,
a.FUNDTYPEGUID,
a.SFJSBZ,
a.AMT,
0 as BDWJEWY,
a.AMT as CEWY,
''001'' AS DZXX,
a.inputdistrict,
a.bz
FROM B3_BZXJZYZFQKBFZ a
WHERE NOT EXISTS(SELECT 1 FROM B4_BJDJZBQKBFZ b WHERE TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid)
AND a.AgencyID = '''||v_UserManaDistrict||'''
UNION ALL
SELECT RAWTOHEX(SYS_GUID()) AS DataKey,
rownum as orderid,
b.finyear,
b.agencyid,
b.xdwh,
'''' as senddoctiem,
'''' as FININTORGGUID,
'''' as YSXM,
b.EXPFUNCGUID,
'''' as FUNDTYPEGUID,
'''' as SFJSBZ,
0 as AMT,
b.amt as BDWJEWY,
0-b.amt as CEWY,
''002'' AS DZXX,
b.sjagencyid as sjagencyid,
'''' as bz
FROM B4_BJDJZBQKBFZ b
WHERE NOT EXISTS(SELECT 1 FROM B3_BZXJZYZFQKBFZ a WHERE TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid)
AND b.AgencyID = '''||v_UserManaDistrict||'''
UNION ALL
SELECT RAWTOHEX(SYS_GUID()) AS DataKey,
rownum as orderid,
a.finyear,
a.agencyid,
a.xdwh,
a.senddoctime,
a.FININTORGGUID,
a.YSXM,
a.EXPFUNCGUID,
a.FUNDTYPEGUID,
a.SFJSBZ,
a.AMT,
0 as BDWJEWY,
a.AMT as CEWY,
''003'' AS DZXX,
a.inputdistrict,
a.bz
FROM B3_BZXJZYZFQKBFZ a,FASP_V_PUBEXPFUNC aa
WHERE EXISTS(SELECT 1 FROM B4_BJDJZBQKBFZ b WHERE TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid)
AND a.EXPFUNCGUID = aa.ID
AND NOT EXISTS(SELECT 1 FROM B4_BJDJZBQKBFZ b,FASP_V_PUBEXPFUNC ba WHERE ba.ID = b.EXPFUNCGUID AND TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid AND ba.LvlID LIKE aa.LvlID || ''%'')
AND a.AgencyID = '''||v_UserManaDistrict||'''
UNION ALL
SELECT RAWTOHEX(SYS_GUID()) AS DataKey,
rownum as orderid,
b.finyear,
b.agencyid,
b.xdwh,
'''' as senddoctiem,
'''' as FININTORGGUID,
'''' as YSXM,
b.EXPFUNCGUID,
'''' as FUNDTYPEGUID,
'''' as SFJSBZ,
0 as AMT,
b.amt as BDWJEWY,
0-b.amt as CEWY,
''004'' AS DZXX,
b.sjagencyid as sjagencyid,
'''' as bz
FROM B4_BJDJZBQKBFZ b,FASP_V_PUBEXPFUNC ba
WHERE EXISTS(SELECT 1 FROM B3_BZXJZYZFQKBFZ a WHERE TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid)
AND ba.ID = b.EXPFUNCGUID
AND NOT EXISTS(SELECT 1 FROM B3_BZXJZYZFQKBFZ a,FASP_V_PUBEXPFUNC aa WHERE aa.ID = a.EXPFUNCGUID AND TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid AND ba.LvlID LIKE aa.LvlID || ''%'')
AND b.AgencyID = '''||v_UserManaDistrict||'''
UNION ALL
SELECT RAWTOHEX(SYS_GUID()) AS DataKey,
rownum as orderid,
a.finyear,
a.agencyid,
a.xdwh,
a.senddoctime,
a.FININTORGGUID,
a.YSXM,
a.EXPFUNCGUID,
a.FUNDTYPEGUID,
a.SFJSBZ,
a.amt,
Nvl((SELECT Sum(Nvl(b.amt,0)) FROM B4_BJDJZBQKBFZ b,FASP_V_PUBEXPFUNC ba WHERE b.AgencyID = '''||v_UserManaDistrict||''' AND b.EXPFUNCGUID = ba.ID AND TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid AND ba.LvlID LIKE aa.LvlID || ''%''),0),
a.amt - Nvl((SELECT Sum(Nvl(b.amt,0)) FROM B4_BJDJZBQKBFZ b,FASP_V_PUBEXPFUNC ba WHERE b.AgencyID = '''||v_UserManaDistrict||''' AND b.EXPFUNCGUID = ba.ID AND TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid AND ba.LvlID LIKE aa.LvlID || ''%''),0),
''005'' AS DZXX,
a.inputdistrict,
a.bz
FROM B3_BZXJZYZFQKBFZ a,FASP_V_PUBEXPFUNC aa
WHERE a.EXPFUNCGUID = aa.ID
AND a.amt <> Nvl((
SELECT Sum(Nvl(b.amt,0))
FROM B4_BJDJZBQKBFZ b,FASP_V_PUBEXPFUNC ba
WHERE b.AgencyID = '''||v_UserManaDistrict||'''
AND b.EXPFUNCGUID = ba.ID
AND TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid
AND ba.LvlID LIKE aa.LvlID || ''%''
AND NOT EXISTS(
SELECT 1
FROM B3_BZXJZYZFQKBFZ xa,FASP_V_PUBEXPFUNC xaa
WHERE xa.AgencyID = b.AgencyID
AND xa.EXPFUNCGUID = b.EXPFUNCGUID
AND TRA_F_CNLOWCASE(xa.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and xa.inputdistrict = b.sjagencyid
AND xa.EXPFUNCGUID = xaa.ID
AND xa.amt = Nvl((SELECT Sum(Nvl(xb.amt,0)) FROM B4_BJDJZBQKBFZ xb,FASP_V_PUBEXPFUNC xba WHERE xb.AgencyID = '''||v_UserManaDistrict||''' AND xb.EXPFUNCGUID = xba.ID AND TRA_F_CNLOWCASE(xa.xdwh) = TRA_F_CNLOWCASE(xb.xdwh) and xa.agencyid = xb.agencyid and xa.inputdistrict = xb.sjagencyid AND xba.LvlID LIKE xaa.LvlID || ''%''),0)
AND EXISTS(SELECT 1 FROM B4_BJDJZBQKBFZ xb2,FASP_V_PUBEXPFUNC xb2a WHERE xb2.AgencyID = '''||v_UserManaDistrict||''' AND TRA_F_CNLOWCASE(xb2.xdwh) = TRA_F_CNLOWCASE(xa.xdwh) and xa.agencyid = xb2.agencyid and xa.inputdistrict = xb2.sjagencyid AND xb2.EXPFUNCGUID = xb2a.ID AND xb2a.LvlID LIKE xaa.LvlID || ''%'')
AND xa.AgencyID = '''||v_UserManaDistrict||'''
)
),0)
AND EXISTS(SELECT 1 FROM B4_BJDJZBQKBFZ b2,FASP_V_PUBEXPFUNC b2a WHERE b2.AgencyID = '''||v_UserManaDistrict||''' AND TRA_F_CNLOWCASE(b2.xdwh) = TRA_F_CNLOWCASE(a.xdwh) and a.agencyid = b2.agencyid and a.inputdistrict = b2.sjagencyid AND b2.EXPFUNCGUID = b2a.ID AND b2a.LvlID LIKE aa.LvlID || ''%'')
AND a.AgencyID = '''||v_UserManaDistrict||'''
AND NOT EXISTS(
SELECT 1
FROM B3_BZXJZYZFQKBFZ xa,FASP_V_PUBEXPFUNC xaa
WHERE xa.AgencyID = a.AgencyID
AND xa.EXPFUNCGUID = a.EXPFUNCGUID
AND TRA_F_CNLOWCASE(xa.xdwh) = TRA_F_CNLOWCASE(a.xdwh) and xa.inputdistrict = a.inputdistrict
AND xa.EXPFUNCGUID = xaa.ID
AND xa.amt = Nvl((SELECT Sum(Nvl(xb.amt,0)) FROM B4_BJDJZBQKBFZ xb,FASP_V_PUBEXPFUNC xba WHERE xb.AgencyID = '''||v_UserManaDistrict||''' AND xb.EXPFUNCGUID = xba.ID AND TRA_F_CNLOWCASE(xa.xdwh) = TRA_F_CNLOWCASE(xb.xdwh) and xa.agencyid = xb.agencyid and xa.inputdistrict = xb.sjagencyid AND xba.LvlID LIKE xaa.LvlID || ''%''),0)
AND EXISTS(SELECT 1 FROM B4_BJDJZBQKBFZ xb2,FASP_V_PUBEXPFUNC xb2a WHERE xb2.AgencyID = '''||v_UserManaDistrict||''' AND TRA_F_CNLOWCASE(xb2.xdwh) = TRA_F_CNLOWCASE(xa.xdwh) and xa.agencyid = xb2.agencyid and xa.inputdistrict = xb2.sjagencyid AND xb2.EXPFUNCGUID = xb2a.ID AND xb2a.LvlID LIKE xaa.LvlID || ''%'')
AND xa.AgencyID = '''||v_UserManaDistrict||'''
)
UNION ALL
SELECT RAWTOHEX(SYS_GUID()) AS DataKey,
rownum as orderid,
a.finyear,
a.agencyid,
a.xdwh,
a.senddoctime,
a.FININTORGGUID,
a.YSXM,
a.EXPFUNCGUID,
a.FUNDTYPEGUID,
a.SFJSBZ,
a.AMT,
a.AMT as BDWJEWY,
0 as CEWY,
''009'' AS DZXX,
a.inputdistrict,
a.bz
FROM B3_BZXJZYZFQKBFZ a,FASP_V_PUBEXPFUNC aa
WHERE a.EXPFUNCGUID = aa.ID
AND a.amt = Nvl((
SELECT Sum(Nvl(b.amt,0))
FROM B4_BJDJZBQKBFZ b,FASP_V_PUBEXPFUNC ba
WHERE b.AgencyID = '''||v_UserManaDistrict||'''
AND b.EXPFUNCGUID = ba.ID
AND TRA_F_CNLOWCASE(a.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.inputdistrict = b.sjagencyid
AND ba.LvlID LIKE aa.LvlID || ''%''
AND NOT EXISTS(
SELECT 1
FROM B3_BZXJZYZFQKBFZ xa,FASP_V_PUBEXPFUNC xaa
WHERE xa.AgencyID = b.AgencyID
AND xa.EXPFUNCGUID = b.EXPFUNCGUID
AND TRA_F_CNLOWCASE(xa.xdwh) = TRA_F_CNLOWCASE(b.xdwh) and xa.inputdistrict = b.sjagencyid
AND xaa.LvlID LIKE aa.LvlID || ''%''
AND xaa.ID <> aa.ID
AND xa.EXPFUNCGUID = xaa.ID
AND xa.amt = Nvl((SELECT Sum(Nvl(xb.amt,0)) FROM B4_BJDJZBQKBFZ xb,FASP_V_PUBEXPFUNC xba WHERE xb.AgencyID = '''||v_UserManaDistrict||''' AND xb.EXPFUNCGUID = xba.ID AND TRA_F_CNLOWCASE(xa.xdwh) = TRA_F_CNLOWCASE(xb.xdwh) and xa.agencyid = xb.agencyid and xa.inputdistrict = xb.sjagencyid AND xba.LvlID LIKE xaa.LvlID || ''%''),0)
AND EXISTS(SELECT 1 FROM B4_BJDJZBQKBFZ xb2,FASP_V_PUBEXPFUNC xb2a WHERE xb2.AgencyID = '''||v_UserManaDistrict||''' AND TRA_F_CNLOWCASE(xb2.xdwh) = TRA_F_CNLOWCASE(xa.xdwh) and xa.agencyid = xb2.agencyid and xa.inputdistrict = xb2.sjagencyid AND xb2.EXPFUNCGUID = xb2a.ID AND xb2a.LvlID LIKE xaa.LvlID || ''%'')
AND xa.AgencyID = '''||v_UserManaDistrict||'''
)
),0)
AND EXISTS(SELECT 1 FROM B4_BJDJZBQKBFZ b2,FASP_V_PUBEXPFUNC b2a WHERE b2.AgencyID = '''||v_UserManaDistrict||''' AND TRA_F_CNLOWCASE(b2.xdwh) = TRA_F_CNLOWCASE(a.xdwh) and a.agencyid = b2.agencyid and a.inputdistrict = b2.sjagencyid AND b2.EXPFUNCGUID = b2a.ID AND b2a.LvlID LIKE aa.LvlID || ''%'')
AND a.AgencyID = '''||v_UserManaDistrict||'''
AND NOT EXISTS(
SELECT 1
FROM B3_BZXJZYZFQKBFZ xa,FASP_V_PUBEXPFUNC xaa
WHERE xa.AgencyID = a.AgencyID
AND xa.EXPFUNCGUID = a.EXPFUNCGUID
AND TRA_F_CNLOWCASE(xa.xdwh) = TRA_F_CNLOWCASE(a.xdwh) and xa.inputdistrict = a.inputdistrict
AND xaa.LvlID LIKE aa.LvlID || ''%''
AND xaa.ID <> aa.ID
AND xa.EXPFUNCGUID = xaa.ID
AND xa.amt = Nvl((SELECT Sum(Nvl(xb.amt,0)) FROM B4_BJDJZBQKBFZ xb,FASP_V_PUBEXPFUNC xba WHERE xb.AgencyID = '''||v_UserManaDistrict||''' AND xb.EXPFUNCGUID = xba.ID AND TRA_F_CNLOWCASE(xa.xdwh) = TRA_F_CNLOWCASE(xb.xdwh) and xa.agencyid = xb.agencyid and xa.inputdistrict = xb.sjagencyid AND xba.LvlID LIKE xaa.LvlID || ''%''),0)
AND EXISTS(SELECT 1 FROM B4_BJDJZBQKBFZ xb2,FASP_V_PUBEXPFUNC xb2a WHERE xb2.AgencyID = '''||v_UserManaDistrict||''' AND TRA_F_CNLOWCASE(xb2.xdwh) = TRA_F_CNLOWCASE(xa.xdwh) and xa.agencyid = xb2.agencyid and xa.inputdistrict = xb2.sjagencyid AND xb2.EXPFUNCGUID = xb2a.ID AND xb2a.LvlID LIKE xaa.LvlID || ''%'')
AND xa.AgencyID = '''||v_UserManaDistrict||'''
)
';
--update thstest set a = v_sql;
--dbms_output.put_line(v_SQL);
EXECUTE IMMEDIATE v_SQL;
/* v_sql2 := 'delete from a where b= '''|| v_RelaTableName||'''';
EXECUTE IMMEDIATE v_SQL2;
insert into a(a,b) values (v_SQL,v_RelaTableName );*/
update BAS_T_ZYZFDZXJGQKB a set a.EXPSTRNAME = 'һת֧֧'
where EXISTS(SELECT 1 FROM FASP_V_PUBEXPFUNC x WHERE rownum < 2 AND SubStr(x.ShowID,1,5) ='23002' AND a.TRANPAYFUNC = x.ID)
and a.agencyid = v_AgencyID;
update BAS_T_ZYZFDZXJGQKB a set a.EXPSTRNAME = 'רת֧֧'
where EXISTS(SELECT 1 FROM FASP_V_PUBEXPFUNC x WHERE rownum < 2 AND SubStr(x.ShowID,1,5) ='23003' AND a.TRANPAYFUNC = x.ID)
and a.agencyid = v_AgencyID;
update BAS_T_ZYZFDZXJGQKB a set a.EXPSTRNAME = 'Իת֧֧'
where EXISTS(SELECT 1 FROM FASP_V_PUBEXPFUNC x WHERE rownum < 2 AND SubStr(x.ShowID,1,5)= '23004' AND a.TRANPAYFUNC = x.ID)
and a.agencyid = v_AgencyID;
update BAS_T_ZYZYZFZBB a set a.DZJG = (select b.dzxx from BAS_T_ZYZFDZXJGQKB b where a.inputdistrict = b.sjagencyid and TRA_F_CNLOWCASE(a.xdwh =TRA_F_CNLOWCASE(b.xdwhand a.agencyid = b.agencyid and a.EXPFUNCGUID = b.EXPFUNCGUID )
where exists( select 1 from BAS_T_ZYZFDZXJGQKB c where a.inputdistrict = c.sjagencyid and a.agencyid =c.agencyid and TRA_F_CNLOWCASE(a.xdwh= TRA_F_CNLOWCASE(c.xdwh and a.EXPFUNCGUID = c.EXPFUNCGUID)
and EXISTS(SELECT 1 FROM FASP_V_PUBEXPFUNC x WHERE rownum < 2 AND SubStr(x.ShowID,1,5) IN ('23003','23004') AND a.TRANPAYFUNC = x.ID)
and a.agencyid = v_AgencyID;
update BAS_T_ZYZYZFZBB a set a.DZJG = (select b.dzxx from BAS_T_ZYZFDZXJGQKB b where a.inputdistrict = b.sjagencyid and TRA_F_CNLOWCASE(a.xdwh) =TRA_F_CNLOWCASE(b.xdwh) and a.agencyid = b.agencyid and a.TRANPAYFUNC = b.EXPFUNCGUID)
where exists( select 1 from BAS_T_ZYZFDZXJGQKB c where a.inputdistrict = c.sjagencyid and a.agencyid =c.agencyid and TRA_F_CNLOWCASE(a.xdwh= TRA_F_CNLOWCASE(c.xdwh and a.TRANPAYFUNC = c.EXPFUNCGUID)
and EXISTS(SELECT 1 FROM FASP_V_PUBEXPFUNC x WHERE rownum < 2 AND SubStr(x.ShowID,1,5) not IN ('23003','23004') AND a.TRANPAYFUNC = x.ID)
and a.agencyid = v_AgencyID;
update BAS_T_ZYZYZFZBB a set a.ISWZZ = (select '1' from BAS_T_ZYZFDZXJGQKB b where b.dzxx = '009' and a.inputdistrict = b.sjagencyid and TRA_F_CNLOWCASE(a.xdwh =TRA_F_CNLOWCASE(b.xdwhand a.agencyid = b.agencyid and a.EXPFUNCGUID = b.EXPFUNCGUID )
where exists( select 1 from BAS_T_ZYZFDZXJGQKB c where c.dzxx = '009' and a.inputdistrict = c.sjagencyid and a.agencyid =c.agencyid and TRA_F_CNLOWCASE(a.xdwh= TRA_F_CNLOWCASE(c.xdwh and a.EXPFUNCGUID = c.EXPFUNCGUID)
and EXISTS(SELECT 1 FROM FASP_V_PUBEXPFUNC x WHERE rownum < 2 AND (SubStr(x.ShowID,1,5) IN ('23003','23004') or x.ShowID in ('2300220','2300221','2300222','2300223','2300203','2300228','2300229','2300230','2300231') ) AND a.TRANPAYFUNC = x.ID)
and a.agencyid = v_AgencyID;
update BAS_T_ZYZYZFZBB a set a.ISWZZ = (select '0' from BAS_T_ZYZFDZXJGQKB b where a.inputdistrict = b.sjagencyid and TRA_F_CNLOWCASE(a.xdwh =TRA_F_CNLOWCASE(b.xdwhand a.agencyid = b.agencyid and a.TRANPAYFUNC = b.EXPFUNCGUID )
where exists( select 1 from BAS_T_ZYZFDZXJGQKB c where a.inputdistrict = c.sjagencyid and a.agencyid =c.agencyid and TRA_F_CNLOWCASE(a.xdwh= TRA_F_CNLOWCASE(c.xdwh and a.TRANPAYFUNC = c.EXPFUNCGUID)
and EXISTS(SELECT 1 FROM FASP_V_PUBEXPFUNC x WHERE rownum < 2 AND (SubStr(x.ShowID,1,5) not IN ('23003','23004') and x.ShowID not in ('2300220','2300221','2300222','2300223','2300203','2300228','2300229','2300230','2300231') ) AND a.TRANPAYFUNC = x.ID)
and a.agencyid = v_AgencyID;
/* update BAS_T_ZYZYZFZBB a set a.iswzz = '1' where a.dzjg = '009' and a.agencyid = v_agencyid;*/
return;
END;
--2-ת֧-05121059 -
| true
|
867c9401a1699eff04d82790a131cf4959ecfb68
|
SQL
|
xt-coder/sina-services
|
/sina-dao/src/main/java/cc/pp/sina/dao/weirenwu/bozhu_price.sql
|
UTF-8
| 2,438
| 3.1875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.1.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: 2014-03-12 14:26:38
-- 服务器版本: 5.5.34-MariaDB-log
-- PHP Version: 5.5.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `pp_fenxi`
--
-- --------------------------------------------------------
--
-- 表的结构 `bozhu_price`
--
CREATE TABLE IF NOT EXISTS `bozhu_price` (
`username` bigint(32) unsigned NOT NULL COMMENT '用户id',
`sourceid` int(10) unsigned NOT NULL COMMENT 'bz_price_source表ID',
`typeid` tinyint(2) unsigned NOT NULL COMMENT '价格类型,见价格类型表',
`price` decimal(10,2) unsigned NOT NULL COMMENT '价格',
`update_time` datetime NOT NULL,
UNIQUE KEY `username_sourceid_typeid_unique` (`username`,`sourceid`,`typeid`),
KEY `sourceid` (`sourceid`),
KEY `typeid` (`typeid`),
KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微博账号报价、分析价表';
--
-- 转存表中的数据 `bozhu_price`
--
INSERT INTO `bozhu_price` (`username`, `sourceid`, `typeid`, `price`, `update_time`) VALUES
(1699668020, 1, 1, '5.00', '2013-10-12 01:02:03'),
(1699668020, 1, 2, '5.00', '2013-10-12 01:02:03'),
(1699668020, 2, 1, '5.00', '2013-10-12 01:02:03'),
(1772605247, 1, 1, '5.00', '2013-10-12 01:02:03'),
(1772605247, 1, 2, '5.00', '2013-10-12 01:02:03'),
(1772605247, 1, 3, '5.00', '2013-10-12 01:02:03'),
(1772605247, 1, 4, '5.00', '2013-10-12 01:02:03'),
(1772605247, 2, 1, '5.00', '2013-10-12 01:02:03'),
(1772605247, 2, 3, '5.00', '2013-10-12 01:02:03');
--
-- 限制导出的表
--
--
-- 限制表 `bozhu_price`
--
ALTER TABLE `bozhu_price`
ADD CONSTRAINT `FK_bozhu_price_bozhu` FOREIGN KEY (`username`) REFERENCES `bozhu` (`username`),
ADD CONSTRAINT `FK_bozhu_price_bozhu_price_source` FOREIGN KEY (`sourceid`) REFERENCES `bozhu_price_source` (`id`),
ADD CONSTRAINT `FK_bozhu_price_bozhu_price_type` FOREIGN KEY (`typeid`) REFERENCES `bozhu_price_type` (`id`);
/*!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 */;
| true
|
125b75d1b6ede0ceaaff67b011216e8b4b26c791
|
SQL
|
PS2Solutions/Cars_DataBase
|
/DML/UpdateQuotMaterialDetails.sql
|
UTF-8
| 355
| 2.65625
| 3
|
[] |
no_license
|
DELIMITER $$
CREATE PROCEDURE `UpdateQuotMaterialDetails`(IN `QuoteID` INT(11), IN `MaterialID` INT(11), IN `UnitRate` decimal(10,3), IN `Quantity` INT(10), IN `Amount` decimal(10,3))
BEGIN
INSERT INTO
quotationdetails(QuotationID, MaterialID, UnitRate, Quantity, Amount)
VALUES(QuoteID, MaterialID, UnitRate, Quantity, Amount);
END$$
DELIMITER ;
| true
|
c09774b24fb4161eb088ef9645b2bd83393d4cef
|
SQL
|
jaimersoncorreia/bdii
|
/lista02/lista02.sql
|
UTF-8
| 423
| 3.34375
| 3
|
[] |
no_license
|
#a
select P.nome, P.cpf, P.email, I.data, I.tipo_inscricao_id, I.codigo from participante_inscricao I join participante P on (I.participante_id = P.id) limit 5;
select P.nome, P.cpf, P.email, I.data, I.tipo_inscricao_id, I.codigo from participante_inscricao I join participante P on (I.participante_id = P.id) limit 5;
select T.descricao from tipo_inscricao T join participante_inscricao A on (T.id = A.tipo_inscricao_id)
| true
|
be900891fcea6fae9bc293a7b4be19c3d7938db6
|
SQL
|
e1313326363/Centro-de-rehabilitacion-de-Alcoholismo-y-Drogadiccion_2
|
/Clinica_script.sql
|
UTF-8
| 23,432
| 3.34375
| 3
|
[] |
no_license
|
/*==============================================================*/
/* DBMS name: PostgreSQL 8 */
/* Created on: 16/11/2021 1:29:48 */
/*==============================================================*/
/*==============================================================*/
/* Table: INGRESO */
/*==============================================================*/
create table INGRESO (
ID_INGRESO INT4 not null,
ID_PACIENTE INT4 not null,
FECHA_INGRESO DATE not null,
FECHA_SALIDA DATE not null,
FECHA_CEREMONIADESALIDA DATE not null,
CANTIDAD_INGRESOS INT4 not null,
CANTIDADSALIDAS_CORRECTAS INT4 not null,
CANTIDADSALIDAS_INCORRECTAS INT4 not null,
INCIDENTE_VIOLENTO INT4 not null,
constraint PK_INGRESO primary key (ID_INGRESO)
);
/*==============================================================*/
/* Index: INGRESO_PK */
/*==============================================================*/
create unique index INGRESO_PK on INGRESO (
ID_INGRESO
);
/*==============================================================*/
/* Index: RELATIONSHIP_2_FK */
/*==============================================================*/
create index RELATIONSHIP_2_FK on INGRESO (
ID_PACIENTE
);
/*==============================================================*/
/* Table: PACIENTE */
/*==============================================================*/
create table PACIENTE (
ID_PACIENTE INT4 not null,
ID_PROFESIONAL INT4 not null,
NOMBRE_PACIENTE VARCHAR(30) not null,
APELLIDO_PACIENTE VARCHAR(30) not null,
CI_PACIENTE VARCHAR(30) not null,
SEXO_PACIENTE VARCHAR(20) not null,
RAZA_PACIENTE VARCHAR(20) not null,
FECHA_NACIMIENTO DATE not null,
constraint PK_PACIENTE primary key (ID_PACIENTE)
);
/*==============================================================*/
/* Index: PACIENTE_PK */
/*==============================================================*/
create unique index PACIENTE_PK on PACIENTE (
ID_PACIENTE
);
/*==============================================================*/
/* Index: RELATIONSHIP_13_FK */
/*==============================================================*/
create index RELATIONSHIP_13_FK on PACIENTE (
ID_PROFESIONAL
);
/*==============================================================*/
/* Table: PAGO */
/*==============================================================*/
create table PAGO (
ID_PAGO INT4 not null,
ID_PLAN INT4 not null,
ID_INGRESO INT4 not null,
ID_SERVICIO INT4 not null,
FECHA_PAGO DATE not null,
METODO_PAGO VARCHAR(50) not null,
constraint PK_PAGO primary key (ID_PAGO)
);
/*==============================================================*/
/* Index: PAGO_PK */
/*==============================================================*/
create unique index PAGO_PK on PAGO (
ID_PAGO
);
/*==============================================================*/
/* Index: RELATIONSHIP_4_FK */
/*==============================================================*/
create index RELATIONSHIP_4_FK on PAGO (
ID_PLAN
);
/*==============================================================*/
/* Index: RELATIONSHIP_3_FK */
/*==============================================================*/
create index RELATIONSHIP_3_FK on PAGO (
ID_INGRESO
);
/*==============================================================*/
/* Index: RELATIONSHIP_5_FK */
/*==============================================================*/
create index RELATIONSHIP_5_FK on PAGO (
ID_SERVICIO
);
/*==============================================================*/
/* Table: PATOLOGIA */
/*==============================================================*/
create table PATOLOGIA (
ID_PATOLOGIA INT4 not null,
ID_PACIENTE INT4 not null,
TIPO_PATOLOGIA VARCHAR(30) not null,
FECHA_ESTIMADAPATOLOGIA DATE not null,
OBSERVACIONES_PATOLOGIA VARCHAR(50) not null,
CANTIDAD_PATOLOGIA INT4 not null,
constraint PK_PATOLOGIA primary key (ID_PATOLOGIA)
);
/*==============================================================*/
/* Index: PATOLOGIA_PK */
/*==============================================================*/
create unique index PATOLOGIA_PK on PATOLOGIA (
ID_PATOLOGIA
);
/*==============================================================*/
/* Index: RELATIONSHIP_1_FK */
/*==============================================================*/
create index RELATIONSHIP_1_FK on PATOLOGIA (
ID_PACIENTE
);
/*==============================================================*/
/* Table: PLAN */
/*==============================================================*/
create table PLAN (
ID_PLAN INT4 not null,
TIPO_PLAN VARCHAR(30) not null,
PRECIO_PLAN MONEY not null,
DURACION_PLAN VARCHAR(30) not null,
constraint PK_PLAN primary key (ID_PLAN)
);
/*==============================================================*/
/* Index: PLAN_PK */
/*==============================================================*/
create unique index PLAN_PK on PLAN (
ID_PLAN
);
/*==============================================================*/
/* Table: PROFESIONAL */
/*==============================================================*/
create table PROFESIONAL (
ID_PROFESIONAL INT4 not null,
NOMBRE_PROFESIONAL VARCHAR(30) not null,
APELLIDO_PROFESIONAL VARCHAR(30) not null,
CI_PROFESIONAL VARCHAR(30) not null,
TIPO_PROFESIONAL VARCHAR(30) not null,
ESPECIALIDAD_PROFESIONAL VARCHAR(30) not null,
constraint PK_PROFESIONAL primary key (ID_PROFESIONAL)
);
/*==============================================================*/
/* Index: PROFESIONAL_PK */
/*==============================================================*/
create unique index PROFESIONAL_PK on PROFESIONAL (
ID_PROFESIONAL
);
/*==============================================================*/
/* Table: RELATIONSHIP_10 */
/*==============================================================*/
create table RELATIONSHIP_10 (
ID_SERVICIO INT4 not null,
ID_PROFESIONAL INT4 not null,
constraint PK_RELATIONSHIP_10 primary key (ID_SERVICIO, ID_PROFESIONAL)
);
/*==============================================================*/
/* Index: RELATIONSHIP_10_PK */
/*==============================================================*/
create unique index RELATIONSHIP_10_PK on RELATIONSHIP_10 (
ID_SERVICIO,
ID_PROFESIONAL
);
/*==============================================================*/
/* Index: RELATIONSHIP_10_FK */
/*==============================================================*/
create index RELATIONSHIP_10_FK on RELATIONSHIP_10 (
ID_SERVICIO
);
/*==============================================================*/
/* Index: RELATIONSHIP_11_FK */
/*==============================================================*/
create index RELATIONSHIP_11_FK on RELATIONSHIP_10 (
ID_PROFESIONAL
);
/*==============================================================*/
/* Table: RELATIONSHIP_7 */
/*==============================================================*/
create table RELATIONSHIP_7 (
ID_TRATAMIENTO INT4 not null,
ID_PROFESIONAL INT4 not null,
constraint PK_RELATIONSHIP_7 primary key (ID_TRATAMIENTO, ID_PROFESIONAL)
);
/*==============================================================*/
/* Index: RELATIONSHIP_7_PK */
/*==============================================================*/
create unique index RELATIONSHIP_7_PK on RELATIONSHIP_7 (
ID_TRATAMIENTO,
ID_PROFESIONAL
);
/*==============================================================*/
/* Index: RELATIONSHIP_7_FK */
/*==============================================================*/
create index RELATIONSHIP_7_FK on RELATIONSHIP_7 (
ID_TRATAMIENTO
);
/*==============================================================*/
/* Index: RELATIONSHIP_8_FK */
/*==============================================================*/
create index RELATIONSHIP_8_FK on RELATIONSHIP_7 (
ID_PROFESIONAL
);
/*==============================================================*/
/* Table: SERVICIO */
/*==============================================================*/
create table SERVICIO (
ID_SERVICIO INT4 not null,
ID_PACIENTE INT4 not null,
TIPO_SERVICIO VARCHAR(30) not null,
CANTIDAD_SERVICIO INT4 not null,
OBSERVACIONES_SERVICIO VARCHAR(50) not null,
constraint PK_SERVICIO primary key (ID_SERVICIO)
);
/*==============================================================*/
/* Index: SERVICIO_PK */
/*==============================================================*/
create unique index SERVICIO_PK on SERVICIO (
ID_SERVICIO
);
/*==============================================================*/
/* Index: RELATIONSHIP_12_FK */
/*==============================================================*/
create index RELATIONSHIP_12_FK on SERVICIO (
ID_PACIENTE
);
/*==============================================================*/
/* Table: TRATAMIENTO */
/*==============================================================*/
create table TRATAMIENTO (
ID_TRATAMIENTO INT4 not null,
ID_PACIENTE INT4 not null,
ID_SERVICIO INT4 not null,
TIPO_TRATAMIENTO VARCHAR(30) not null,
FECHA_TRATAMIENTO DATE not null,
NOMBRE_TRATAMIENTO VARCHAR(30) not null,
CANTIDAD_TRATAMIENTOS INT4 not null,
constraint PK_TRATAMIENTO primary key (ID_TRATAMIENTO)
);
/*==============================================================*/
/* Index: TRATAMIENTO_PK */
/*==============================================================*/
create unique index TRATAMIENTO_PK on TRATAMIENTO (
ID_TRATAMIENTO
);
/*==============================================================*/
/* Index: RELATIONSHIP_6_FK */
/*==============================================================*/
create index RELATIONSHIP_6_FK on TRATAMIENTO (
ID_SERVICIO
);
/*==============================================================*/
/* Index: RELATIONSHIP_9_FK */
/*==============================================================*/
create index RELATIONSHIP_9_FK on TRATAMIENTO (
ID_PACIENTE
);
alter table INGRESO
add constraint FK_INGRESO_RELATIONS_PACIENTE foreign key (ID_PACIENTE)
references PACIENTE (ID_PACIENTE)
on delete restrict on update restrict;
alter table PACIENTE
add constraint FK_PACIENTE_RELATIONS_PROFESIO foreign key (ID_PROFESIONAL)
references PROFESIONAL (ID_PROFESIONAL)
on delete restrict on update restrict;
alter table PAGO
add constraint FK_PAGO_RELATIONS_INGRESO foreign key (ID_INGRESO)
references INGRESO (ID_INGRESO)
on delete restrict on update restrict;
alter table PAGO
add constraint FK_PAGO_RELATIONS_PLAN foreign key (ID_PLAN)
references PLAN (ID_PLAN)
on delete restrict on update restrict;
alter table PAGO
add constraint FK_PAGO_RELATIONS_SERVICIO foreign key (ID_SERVICIO)
references SERVICIO (ID_SERVICIO)
on delete restrict on update restrict;
alter table PATOLOGIA
add constraint FK_PATOLOGI_RELATIONS_PACIENTE foreign key (ID_PACIENTE)
references PACIENTE (ID_PACIENTE)
on delete restrict on update restrict;
alter table RELATIONSHIP_10
add constraint FK_RELATION_RELATIONS_SERVICIO foreign key (ID_SERVICIO)
references SERVICIO (ID_SERVICIO)
on delete restrict on update restrict;
alter table RELATIONSHIP_10
add constraint FK_RELATION_RELATIONS_PROFESIO foreign key (ID_PROFESIONAL)
references PROFESIONAL (ID_PROFESIONAL)
on delete restrict on update restrict;
alter table RELATIONSHIP_7
add constraint FK_RELATION_RELATIONS_TRATAMIE foreign key (ID_TRATAMIENTO)
references TRATAMIENTO (ID_TRATAMIENTO)
on delete restrict on update restrict;
alter table RELATIONSHIP_7
add constraint FK_RELATION_RELATIONS_PROFESIO foreign key (ID_PROFESIONAL)
references PROFESIONAL (ID_PROFESIONAL)
on delete restrict on update restrict;
alter table SERVICIO
add constraint FK_SERVICIO_RELATIONS_PACIENTE foreign key (ID_PACIENTE)
references PACIENTE (ID_PACIENTE)
on delete restrict on update restrict;
alter table TRATAMIENTO
add constraint FK_TRATAMIE_RELATIONS_SERVICIO foreign key (ID_SERVICIO)
references SERVICIO (ID_SERVICIO)
on delete restrict on update restrict;
alter table TRATAMIENTO
add constraint FK_TRATAMIE_RELATIONS_PACIENTE foreign key (ID_PACIENTE)
references PACIENTE (ID_PACIENTE)
on delete restrict on update restrict;
--Tabla Profesional
insert into profesional (id_profesional,nombre_profesional,apellido_profesional,ci_profesional,tipo_profesional,especialidad_profesional)
values(1,'Arturo','Zambrano','1303988313','Interno','psiquiatria clinica');
insert into profesional (id_profesional,nombre_profesional,apellido_profesional,ci_profesional,tipo_profesional,especialidad_profesional)
values(2,'Josue','Moreira','1305506469','Interno','psiquiatria clinica');
insert into profesional (id_profesional,nombre_profesional,apellido_profesional,ci_profesional,tipo_profesional,especialidad_profesional)
values(3,'Juan','Cornejo','1315546895','Interno','psiquiatria clinica');
insert into profesional (id_profesional,nombre_profesional,apellido_profesional,ci_profesional,tipo_profesional,especialidad_profesional)
values(4,'Manuel','Muñoz','1305547895','Externo','psiquiatria clinica');
insert into profesional (id_profesional,nombre_profesional,apellido_profesional,ci_profesional,tipo_profesional,especialidad_profesional)
values(5,'Miguel','Muñoz','1305548756','Externo','psiquiatria clinica');
--Tabla Paciente
insert into paciente (id_paciente,id_profesional, nombre_paciente, apellido_paciente, ci_paciente, sexo_paciente, raza_paciente, fecha_nacimiento)
values (1,1,'Ian','Velez','1313326363','Maculino','Mestizo','2002-05-26');
insert into paciente(id_paciente,id_profesional, nombre_paciente, apellido_paciente, ci_paciente, sexo_paciente, raza_paciente, fecha_nacimiento)
values (2,2,'Winter','Meza','1325564549','Masculino','Mestizo','2000-08-12');
insert into paciente (id_paciente,id_profesional, nombre_paciente, apellido_paciente, ci_paciente, sexo_paciente, raza_paciente, fecha_nacimiento)
values (3,3,'Enrique','Moreira','1305546584','Masculino','Mestizo','1998-11-17');
insert into paciente (id_paciente,id_profesional, nombre_paciente, apellido_paciente, ci_paciente, sexo_paciente, raza_paciente, fecha_nacimiento)
values (4,4,'Mariana','Solorzano','1303988313','Femenino','Mestizo','1999-10-26');
insert into paciente (id_paciente,id_profesional, nombre_paciente, apellido_paciente, ci_paciente, sexo_paciente, raza_paciente, fecha_nacimiento)
values (5,5,'Yanina','Arteaga','1305489795','Femenino','Mestizo','1999-05-15');
--Tabla Ingreso
insert into ingreso (id_ingreso,id_paciente,fecha_ingreso,fecha_salida,fecha_ceremoniadesalida,cantidad_ingresos,cantidadsalidas_correctas,cantidadsalidas_incorrectas,incidente_violento)
values (1,1,'2020-10-05','2021-01-01','2021-01-15',1,1,0,0);
insert into ingreso (id_ingreso,id_paciente,fecha_ingreso,fecha_salida,fecha_ceremoniadesalida,cantidad_ingresos,cantidadsalidas_correctas,cantidadsalidas_incorrectas,incidente_violento)
values (2,2,'2020-05-10','2021-05-04','2021-05-15',2,1,1,1);
insert into ingreso (id_ingreso,id_paciente,fecha_ingreso,fecha_salida,fecha_ceremoniadesalida,cantidad_ingresos,cantidadsalidas_correctas,cantidadsalidas_incorrectas,incidente_violento)
values (3,3,'2020-11-19','2021-10-09','2021-10-15',2,1,1,0);
insert into ingreso (id_ingreso,id_paciente,fecha_ingreso,fecha_salida,fecha_ceremoniadesalida,cantidad_ingresos,cantidadsalidas_correctas,cantidadsalidas_incorrectas,incidente_violento)
values (4,4,'2020-11-19','2021-10-09','2021-10-15',1,1,0,1);
insert into ingreso (id_ingreso,id_paciente,fecha_ingreso,fecha_salida,fecha_ceremoniadesalida,cantidad_ingresos,cantidadsalidas_correctas,cantidadsalidas_incorrectas,incidente_violento)
values (5,5,'2020-10-05','2021-01-01','2021-01-15',2,1,1,0);
--Tabla Servicio
insert into servicio (id_servicio,id_paciente,tipo_servicio,cantidad_servicio,observaciones_servicio)
values (1,1,'Interno',5,'Desintoxicacion');
insert into servicio (id_servicio,id_paciente,tipo_servicio,cantidad_servicio,observaciones_servicio)
values (2,2,'Interno',2,'Ayuda Emocional');
insert into servicio (id_servicio,id_paciente,tipo_servicio,cantidad_servicio,observaciones_servicio)
values (3,3,'Interno',3,'Desintoxicacion');
insert into servicio (id_servicio,id_paciente,tipo_servicio,cantidad_servicio,observaciones_servicio)
values (4,4,'Externo',1,'Llamada');
insert into servicio (id_servicio,id_paciente,tipo_servicio,cantidad_servicio,observaciones_servicio)
values (5,5,'Externo',3,'Llamada');
--Tabla Plan
insert into plan (id_plan,tipo_plan,precio_plan,duracion_plan)
values (1,'Drogadicción',200,'6 meses');
insert into plan (id_plan,tipo_plan,precio_plan,duracion_plan)
values (2,'Drogadicción',400,'1 año');
insert into plan (id_plan,tipo_plan,precio_plan,duracion_plan)
values (3,'Drogadicción',400,'1 año');
insert into plan (id_plan,tipo_plan,precio_plan,duracion_plan)
values (4,'Alcoholismo',400,'1 año');
insert into plan (id_plan,tipo_plan,precio_plan,duracion_plan)
values (5,'Alcoholismo',400,'1 año');
--Tabla Pago
insert into pago (id_pago,id_plan,id_ingreso,id_servicio,fecha_pago,metodo_pago)
values (1,1,1,1,'2020-10-05','Efectivo');
insert into pago (id_pago,id_plan,id_ingreso,id_servicio,fecha_pago,metodo_pago)
values (2,2,2,2,'2020-05-10','Efectivo');
insert into pago (id_pago,id_plan,id_ingreso,id_servicio,fecha_pago,metodo_pago)
values (3,3,3,3,'2020-11-19','Efectivo');
insert into pago (id_pago,id_plan,id_ingreso,id_servicio,fecha_pago,metodo_pago)
values (4,4,4,4,'2020-11-19','Efectivo');
insert into pago (id_pago,id_plan,id_ingreso,id_servicio,fecha_pago,metodo_pago)
values (5,5,5,5,'2020-10-05','Efectivo');
--Tabla Patologia
insert into patologia (id_patologia,id_paciente,tipo_patologia,fecha_estimadapatologia,observaciones_patologia,cantidad_patologia)
values (1,1,'Enfermedades cardíacas','2010-05-10','Problemas en valvula pulmonar',1);
insert into patologia (id_patologia,id_paciente,tipo_patologia,fecha_estimadapatologia,observaciones_patologia,cantidad_patologia)
values (2,2,'transmisión sexual','2018-10-10','VIH',1);
insert into patologia (id_patologia,id_paciente,tipo_patologia,fecha_estimadapatologia,observaciones_patologia,cantidad_patologia)
values (3,3,'Enfermedades cardíacas','2012-07-11','Problemas en valvula tricúspide',1);
insert into patologia (id_patologia,id_paciente,tipo_patologia,fecha_estimadapatologia,observaciones_patologia,cantidad_patologia)
values (4,4,'Enfermedades cardíacas','2015-08-25','Problemas en valvula tricúspide',1);
insert into patologia (id_patologia,id_paciente,tipo_patologia,fecha_estimadapatologia,observaciones_patologia,cantidad_patologia)
values (5,5,'transmisión sexual','2019-01-01','Sida',1);
--Tabla Tratamiento
insert into tratamiento (id_tratamiento,id_paciente,id_servicio,tipo_tratamiento,fecha_tratamiento,nombre_tratamiento,cantidad_tratamientos)
values (1,1,1,'Drogadicción','2020-10-05','Desintoxicación',1);
insert into tratamiento (id_tratamiento,id_paciente,id_servicio,tipo_tratamiento,fecha_tratamiento,nombre_tratamiento,cantidad_tratamientos)
values (2,2,2,'Drogadicción','2020-05-10','Terapia de Apoyo',2);
insert into tratamiento (id_tratamiento,id_paciente,id_servicio,tipo_tratamiento,fecha_tratamiento,nombre_tratamiento,cantidad_tratamientos)
values (3,3,3,'Drogadicción','2020-11-19','Terapia de Apoyo',2);
insert into tratamiento (id_tratamiento,id_paciente,id_servicio,tipo_tratamiento,fecha_tratamiento,nombre_tratamiento,cantidad_tratamientos)
values (4,4,4,'Alcoholismo','2020-11-19','Terapia Espiritual',1);
insert into tratamiento (id_tratamiento,id_paciente,id_servicio,tipo_tratamiento,fecha_tratamiento,nombre_tratamiento,cantidad_tratamientos)
values (5,5,5,'Alcoholismo','2020-10-05','Terapia Espiritual',2);
--Tabla Relacion 10
insert into relationship_10 (id_profesional,id_servicio)
values (1,1);
insert into relationship_10 (id_profesional,id_servicio)
values (2,2);
insert into relationship_10 (id_profesional,id_servicio)
values (3,3);
insert into relationship_10 (id_profesional,id_servicio)
values (4,4);
insert into relationship_10 (id_profesional,id_servicio)
values (5,5);
--Relacion 7
insert into relationship_7 (id_profesional,id_tratamiento)
values (1,1);
insert into relationship_7 (id_profesional,id_tratamiento)
values (2,2);
insert into relationship_7 (id_profesional,id_tratamiento)
values (3,3);
insert into relationship_7 (id_profesional,id_tratamiento)
values (4,4);
insert into relationship_7 (id_profesional,id_tratamiento)
values (5,5);
| true
|
af0a17e1659b63508e78819cc97e1e5a16fadee8
|
SQL
|
mattias/go-pcdsh
|
/migrations/2_create_log_attributes_table.sql
|
UTF-8
| 292
| 3.109375
| 3
|
[] |
no_license
|
-- +migrate Up
CREATE TABLE log_attributes (
id int not null auto_increment,
log_id int not null,
`key` varchar(255),
value varchar(255),
primary key (id),
index (`key`),
index (value ),
foreign key (log_id) references logs(id)
);
-- +migrate Down
DROP TABLE log_attributes;
| true
|
f1b3bb1eaf73e59dd956c0172cacc678542485c8
|
SQL
|
AlysterF/sql_murder_mystery
|
/scripts.sql
|
UTF-8
| 1,531
| 4.03125
| 4
|
[] |
no_license
|
--SQLite used directly in the challenge website (https://mystery.knightlab.com/)
--Recover the crime scene report
SELECT
*
FROM
crime_scene_report
WHERE
date = 20180115
AND city = "SQL City"
AND type = "murder";
--Finding the first witness
SELECT
*
FROM
person
WHERE
address_street_name = "Northwestern Dr"
ORDER BY
address_number DESC
LIMIT
1;
--Finding the second witness
SELECT
*
FROM
person
WHERE
name LIKE "%Annabel%"
AND address_street_name = "Franklin Ave";
--Interview with the witnesses
SELECT
*
FROM
interview
WHERE
person_id = 14887
OR person_id = 16371;
--Find the main suspect and see what he has to say about the crime
SELECT
gm.person_id
,gm.name
,i.transcript
FROM
get_fit_now_member gm
JOIN
get_fit_now_check_in gci
ON gci.membership_id = gm.id
JOIN
person p
ON p.id = gm.person_id
JOIN
drivers_license d
ON d.id = p.license_id
JOIN
interview i
ON i.person_id = gm.person_id
WHERE
gm.id LIKE "48Z%"
AND gm.membership_status = "gold"
AND gci.check_in_date = 20180109;
--Find the mastermind of the crime
SELECT
p.name
,ic.annual_income
,COUNT(*) AS times_attended_event
FROM
drivers_license dl
JOIN
person p
ON p.license_id = dl.id
JOIN
facebook_event_checkin fb
ON fb.person_id = p.id
JOIN
income ic
ON ic.ssn = p.ssn
WHERE
car_make = "Tesla"
AND car_model = "Model S"
AND hair_color = "red"
AND gender = "female"
AND height BETWEEN 65 AND 67
AND fb.event_name = "SQL Symphony Concert"
AND fb.date BETWEEN 20171201 AND 20171231
GROUP BY
p.name;
| true
|
75dea0cbc61beeb9e77eafa834c81cb9d9198ec0
|
SQL
|
ebrahimsalehi1/frontend_projects
|
/SQL/Alikonjkav/code.sql
|
UTF-8
| 362
| 3.8125
| 4
|
[] |
no_license
|
-- Section1
select id from users where nick like 'am%' order by id
-- Section2
select from_user_id
from relations
group by from_user_id
order by 1
-- Section3
select id
from messages
where (from_user_id,to_user_id)
not in (
select from_user_id,to_user_id
from relations
where blocked=true
) and deleted_at is not null
and edited_at is not null
order by 1
| true
|
afa30160247e605396d6bc7726b3ed47ed08a14a
|
SQL
|
christiantriadataro/Pharmacy-Managament-System
|
/pharmacydb.sql
|
UTF-8
| 3,477
| 3.40625
| 3
|
[
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 10, 2021 at 04:58 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `pharmacydb`
--
CREATE DATABASE IF NOT EXISTS `pharmacydb` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `pharmacydb`;
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`username` varchar(50) NOT NULL,
`pass` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`username`, `pass`) VALUES
('admin', '1234'),
('superadmin', '1234');
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE `category` (
`PHARMAID` int(11) NOT NULL,
`PHARMNAME` varchar(50) NOT NULL,
`DESCRIPTION` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `drug`
--
CREATE TABLE `drug` (
`DRUGID` int(11) NOT NULL,
`DRUGNAME` varchar(50) NOT NULL,
`DRUGCATEGORY` varchar(50) NOT NULL,
`DRUGQUANTITY` int(11) NOT NULL,
`DRUGPRICE` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `drug`
--
INSERT INTO `drug` (`DRUGID`, `DRUGNAME`, `DRUGCATEGORY`, `DRUGQUANTITY`, `DRUGPRICE`) VALUES
(1, 'Neozep', 'Antibacterials', 13, 15);
-- --------------------------------------------------------
--
-- Table structure for table `pharmacist`
--
CREATE TABLE `pharmacist` (
`PharmaID` int(5) NOT NULL,
`PharmaName` varchar(50) NOT NULL,
`PharmaPass` varchar(50) NOT NULL,
`PharmaGender` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `pharmacist`
--
INSERT INTO `pharmacist` (`PharmaID`, `PharmaName`, `PharmaPass`, `PharmaGender`) VALUES
(4, 'MARK', 'MALE', 'MALE'),
(9, 'sdaf', 'dsfsfa', 'MALE'),
(11, 'dfsafdsf', 'fasfssads', 'MALE'),
(15, 'Dataro', 'MALE', 'MALE'),
(123, 'dfsaff', 'sfsdafsda', 'MALE'),
(1321, 'dfafda', 'dsaffas', 'MALE');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `category`
--
ALTER TABLE `category`
ADD PRIMARY KEY (`PHARMAID`);
--
-- Indexes for table `drug`
--
ALTER TABLE `drug`
ADD PRIMARY KEY (`DRUGID`);
--
-- Indexes for table `pharmacist`
--
ALTER TABLE `pharmacist`
ADD PRIMARY KEY (`PharmaID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
MODIFY `PHARMAID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `drug`
--
ALTER TABLE `drug`
MODIFY `DRUGID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `pharmacist`
--
ALTER TABLE `pharmacist`
MODIFY `PharmaID` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1322;
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 */;
| true
|
44af155858e19b52b87a4869cd6113cbc2320821
|
SQL
|
DalavanCloud/hawq
|
/src/test/regress/sql/goh_gphdfs.sql
|
UTF-8
| 9,526
| 3.375
| 3
|
[
"MIT",
"BSD-4-Clause-UC",
"BSD-3-Clause",
"ISC",
"bzip2-1.0.6",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-4-Clause",
"Artistic-2.0",
"PostgreSQL",
"LicenseRef-scancode-unknown"
] |
permissive
|
\c hdfs
--
-- Create demoprot (for testing)
--
CREATE OR REPLACE FUNCTION write_to_file() RETURNS integer as '$libdir/gpextprotocol.so', 'demoprot_export' LANGUAGE C STABLE;
CREATE OR REPLACE FUNCTION read_from_file() RETURNS integer as '$libdir/gpextprotocol.so', 'demoprot_import' LANGUAGE C STABLE;
DROP PROTOCOL IF EXISTS demoprot;
CREATE PROTOCOL demoprot (readfunc = 'read_from_file', writefunc = 'write_to_file'); -- should succeed
--
-- Cleanup script
--
create external web table cleanup(a int)
execute 'rm -rf $GP_SEG_DATADIR/hdfsfile.*;' on all
format 'text';
create external web table touchfile(a int)
execute 'touch $GP_SEG_DATADIR/hdfsfile.out;' on all
format 'text';
--
-- Test 0: String serialization in/out test
--
select * from cleanup;
drop table test1;
CREATE TABLE test1(
v0 text,
v1 time,
v2 timestamp,
v3 numeric
)
WITH (appendonly = true) DISTRIBUTED BY (v0);
insert into test1 values(
'aaaaddddcccc',
'00:00:00',
'2004-10-19 10:23:54',
123.1231231241231242
);
insert into test1 values(
lpad('aaaaddddcccc', 2000, 's'),
null,
'2004-10-19 10:23:54',
null
);
insert into test1(v0) select relname from pg_class;
drop external table example_out;
CREATE WRITABLE EXTERNAL TABLE example_out(like test1)
location('demoprot://hdfsfile.out')
FORMAT 'CUSTOM' (formatter='gphdfs_export') distributed by (v0);
insert into example_out select * from test1;
drop external web table example_in;
CREATE EXTERNAL WEB TABLE example_in(like test1)
execute 'cat $GP_SEG_DATADIR/hdfsfile.out'
FORMAT 'CUSTOM' (formatter='gphdfs_import');
select * from example_in except select * from test1;
select * from test1 except select * from example_in;
--
-- Test 1: Complete type in/out test
--
select * from cleanup;
drop table test1;
CREATE TABLE test1(
v0 bigint,
v1 boolean,
v2 bytea,
v3 varchar,
v4 char(5),
v5 date,
v6 float8,
v7 integer,
v8 numeric,
v9 real,
va smallint,
vb text,
vc time,
vd timestamp
)
WITH (appendonly = true) DISTRIBUTED BY (v0);
insert into test1 values(
12345,
true,
E'\\001\\002\\003\\004\\005\\006\\007'::bytea,
'abcdef',
'xxxxx',
'2001-10-05',
123.1231231241231242,
556677,
9.99999999,
1123.123,
444,
'aaaaddddcccc',
'00:00:00',
'2004-10-19 10:23:54'
);
insert into test1(v0) select oid from pg_class;
drop external table example_out;
CREATE WRITABLE EXTERNAL TABLE example_out(like test1)
location('demoprot://hdfsfile.out')
format 'custom' (formatter='gphdfs_export') distributed by (v0);
insert into example_out select * from test1;
drop external web table example_in;
CREATE EXTERNAL WEB TABLE example_in(like test1)
execute 'cat $GP_SEG_DATADIR/hdfsfile.out'
FORMAT 'CUSTOM' (formatter='gphdfs_import');
select * from example_in except select * from test1;
select * from test1 except select * from example_in;
--
-- Test 2: pg_class dump/restore test
--
select * from cleanup;
drop external table hdfsformatter_out;
CREATE WRITABLE EXTERNAL TABLE hdfsformatter_out(like pg_class)
location('demoprot://hdfsfile.out')
FORMAT 'CUSTOM' (formatter='gphdfs_export');
drop external table hdfsformatter_in;
CREATE EXTERNAL TABLE hdfsformatter_in(like pg_class)
location('demoprot://hdfsfile.out')
FORMAT 'CUSTOM' (formatter='gphdfs_import');
drop table tmp_in;
create table tmp_in(like pg_class);
drop table tmp_pg_class;
create table tmp_pg_class(like pg_class);
insert into tmp_pg_class select * from pg_class;
insert into hdfsformatter_out select * from tmp_pg_class;
insert into tmp_in select * from hdfsformatter_in;
select relname, relnamespace, reltype, relowner, relam, relfilenode, reltablespace, reltoastrelid, reltoastidxid, relaosegrelid, relaosegidxid,
relhasindex, relisshared, relkind, relstorage, relnatts, relchecks, reltriggers,
relukeys, relfkeys, relrefs, relhasoids, relhaspkey, relhasrules, relhassubclass, reloptions
from tmp_in
except
select relname, relnamespace, reltype, relowner, relam, relfilenode, reltablespace, reltoastrelid, reltoastidxid, relaosegrelid, relaosegidxid,
relhasindex, relisshared, relkind, relstorage, relnatts, relchecks, reltriggers,
relukeys, relfkeys, relrefs, relhasoids, relhaspkey, relhasrules, relhassubclass, reloptions
from tmp_pg_class;
select relname, relnamespace, reltype, relowner, relam, relfilenode, reltablespace,
relpages, reltoastrelid, reltoastidxid, relaosegrelid, relaosegidxid,
relhasindex, relisshared, relkind, relstorage, relnatts, relchecks, reltriggers,
relukeys, relfkeys, relrefs, relhasoids, relhaspkey, relhasrules, relhassubclass, reloptions
from tmp_pg_class
except
select relname, relnamespace, reltype, relowner, relam, relfilenode, reltablespace,
relpages, reltoastrelid, reltoastidxid, relaosegrelid, relaosegidxid,
relhasindex, relisshared, relkind, relstorage, relnatts, relchecks, reltriggers,
relukeys, relfkeys, relrefs, relhasoids, relhaspkey, relhasrules, relhassubclass, reloptions
from tmp_in;
drop external table hdfsformatter_out;
drop external table hdfsformatter_in;
drop table tmp_in;
drop table tmp_pg_class;
--
-- Test 3: Negative test (missing byte at the end)
--
select * from cleanup;
drop table test1;
CREATE TABLE test1(
v0 bigint,
v1 boolean,
v2 bytea,
v3 varchar,
v4 char(5),
v5 date,
v6 float8,
v7 integer,
v8 numeric,
v9 real,
va smallint,
vb text,
vc time,
vd timestamp
)
WITH (appendonly = true) DISTRIBUTED BY (v0);
insert into test1 values(
12345,
true,
E'\\001\\002\\003\\004\\005\\006\\007'::bytea,
'abcdef',
'xxxxx',
'2001-10-05',
123.1231231241231242,
556677,
9.99999999,
1123.123,
444,
'aaaaddddcccc',
'00:00:00',
'2004-10-19 10:23:54'
);
insert into test1(v0) select oid from pg_class;
drop external table example_out;
CREATE WRITABLE EXTERNAL TABLE example_out(like test1)
location('demoprot://hdfsfile.out')
format 'custom' (formatter='gphdfs_export') distributed by (v0);
insert into example_out select * from test1;
-- corrupt the file here
create external web table ewt1(a int)
execute 'dd if=$GP_SEG_DATADIR/hdfsfile.out of=$GP_SEG_DATADIR/hdfsfile.corrupt bs=1 count=1' on all
format 'text';
select * from ewt1;
drop external web table ewt1;
drop external web table example_in;
CREATE EXTERNAL WEB TABLE example_in(like test1)
execute 'cat $GP_SEG_DATADIR/hdfsfile.corrupt'
FORMAT 'CUSTOM' (formatter='gphdfs_import');
select * from example_in except select * from test1;
--
-- Test 4: Negative test (type mismatch)
--
select * from cleanup;
drop table test1;
CREATE TABLE test1(
v0 bigint
)
WITH (appendonly = true) DISTRIBUTED BY (v0);
insert into test1 values(
12345
);
insert into test1(v0) select oid from pg_class;
drop external table example_out;
CREATE WRITABLE EXTERNAL TABLE example_out(like test1)
location('demoprot://hdfsfile.out')
format 'custom' (formatter='gphdfs_export') distributed by (v0);
insert into example_out select * from test1;
drop external web table example_in;
CREATE EXTERNAL WEB TABLE example_in(a boolean)
execute 'cat $GP_SEG_DATADIR/hdfsfile.out'
FORMAT 'CUSTOM' (formatter='gphdfs_import');
select * from example_in;
drop external web table example_in;
CREATE EXTERNAL WEB TABLE example_in(a1 int, a boolean)
execute 'cat $GP_SEG_DATADIR/hdfsfile.out'
FORMAT 'CUSTOM' (formatter='gphdfs_import');
select * from example_in;
--
-- Test 5: gphdfs protocol (just declare an external table)
--
drop external table example_out;
CREATE WRITABLE EXTERNAL TABLE example_out(like pg_class)
location ('gphdfs://localhost:9000/gpdb_out')
FORMAT 'CUSTOM' (formatter='gphdfs_export');
drop external table example_in;
CREATE EXTERNAL TABLE example_in(like pg_class)
location ('gphdfs://localhost:9000/gpdb_out/*')
FORMAT 'CUSTOM' (formatter='gphdfs_import');
--
-- Test 6: formatter SREH
--
select * from cleanup;
select * from touchfile;
drop table test1;
CREATE TABLE test1(
v0 bigint,
v1 bigint
)
WITH (appendonly = true) DISTRIBUTED BY (v0);
insert into test1 values(12345, 123444);
drop external table example_out;
CREATE WRITABLE EXTERNAL TABLE example_out(like test1)
location('demoprot://hdfsfile.out')
format 'custom' (formatter='gphdfs_export') distributed by (v0);
insert into example_out select * from test1;
drop table test1;
CREATE TABLE test1(
v0 bigint
)
WITH (appendonly = true) DISTRIBUTED BY (v0);
insert into test1 values(12345);
drop external table example_out;
CREATE WRITABLE EXTERNAL TABLE example_out(like test1)
location('demoprot://hdfsfile.out')
format 'custom' (formatter='gphdfs_export') distributed by (v0);
insert into example_out select * from test1;
drop external table example_out;
CREATE WRITABLE EXTERNAL TABLE example_out(a boolean)
location('demoprot://hdfsfile.out')
FORMAT 'CUSTOM' (formatter='gphdfs_export')
distributed by (a);
insert into example_out values(true);
insert into example_out values(false);
drop external table example_out;
CREATE WRITABLE EXTERNAL TABLE example_out(like test1)
location('demoprot://hdfsfile.out')
format 'TEXT' distributed by (v0);
insert into example_out select * from test1;
drop external web table example_in;
CREATE EXTERNAL WEB TABLE example_in(a boolean)
execute 'cat $GP_SEG_DATADIR/hdfsfile.out'
FORMAT 'CUSTOM' (formatter='gphdfs_import')
log errors into errtbl SEGMENT REJECT LIMIT 1000 rows;
select * from example_in order by 1;
select relname, filename, linenum, bytenum, errmsg, rawdata, rawbytes from errtbl order by 1,2,3,4,5,6,7;
--
-- End of Test (drop stuff)
--
select * from cleanup;
| true
|
f5d9e8611d82395249ac32faf5184fc3ee9cbf29
|
SQL
|
ciscucordo/escacsvdt
|
/bd/BASEDADES_ESCACSVDT_MYSQL.sql
|
UTF-8
| 11,008
| 3.59375
| 4
|
[] |
no_license
|
/*per connectar a la bd root dins el SHELL:
SHELL>mysql --host=localhost --user=root --password=anderssenvsk12 escacsvdt
*/
/*per connectar a la bd escacsvdt dins el SHELL:
SHELL>mysql --host=localhost --user=escacsvdt --password=escacsvdt escacsvdt
*/
/*-------------------------------INICI executar des de BDVAIO-------------------------------*/
/*creem l'usuari escacsvdt*/
CREATE USER 'escacsvdt'@'%' IDENTIFIED BY 'escacsvdt';
/*aplicar privilegis a l'usuari escacsvdt*/
GRANT ALL PRIVILEGES ON *.*
TO 'escacsvdt'@'%'
IDENTIFIED BY 'escacsvdt'
WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
FLUSH PRIVILEGES;
/*creem base de dades escacsvdt*/
CREATE DATABASE escacsvdt
DEFAULT CHARACTER SET 'utf8'
DEFAULT COLLATE 'utf8_general_ci';
/*--------------------------------FI executar des de BDVAIO--------------------------------*/
USE escacsvdt;
DROP TABLE IF EXISTS PARTIDA;
DROP TABLE IF EXISTS JUGADESOBERTURA;
DROP TABLE IF EXISTS JUGADESGRAELLA;
DROP TABLE IF EXISTS HISTORIALJUGADOR;
DROP TABLE IF EXISTS LOGS;
DROP TABLE IF EXISTS OBERTURA;
DROP TABLE IF EXISTS GRAELLA;
DROP TABLE IF EXISTS REPTE;
DROP TABLE IF EXISTS JUGADOR;
CREATE TABLE IF NOT EXISTS JUGADOR (
ID INT (3) NOT NULL AUTO_INCREMENT,
NOM VARCHAR (50) NOT NULL,
COGNOMS VARCHAR (100) NOT NULL,
NICK VARCHAR (50) DEFAULT 'Invitat ' NOT NULL, /*si NO és del Club Escacs VDT, es dirà "Invitat X" (X depenent dels Invitats que hi hagi) */
PASSWORD VARCHAR (10) DEFAULT 'demo' NOT NULL, /*si NO és del Club Escacs VDT, el password serà "demo"*/
HORAULTIMLOGIN TIMESTAMP NOT NULL,
DIRECCIO VARCHAR (100),
POBLACIO VARCHAR (50),
CP VARCHAR (5),
PROVINCIA VARCHAR (50),
TELEFON VARCHAR (15),
EMAIL VARCHAR (50),
ACTIU INT (1) DEFAULT 0, /*si és 0, està de baixa*/
PERFIL INT (1) DEFAULT 1, /*si és 1, és un jugador pertanyent a Club Escacs VDT, si és Invitat serà 0 !!!*/
ELO INT (4) DEFAULT 0,
IP VARCHAR (50),
PORT VARCHAR (5),
ESTAT INT (1) DEFAULT -1, /*desconnectat=-1, lliure=0, reptant=1, jugant=2*/
PRIMARY KEY (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS GRAELLA (
ID INT(6) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS JUGADESGRAELLA (
ID INT (6) NOT NULL AUTO_INCREMENT,
IDGRAELLA INT (6) NOT NULL,
NUMJUGADA INT (3) NOT NULL,
COLOR VARCHAR (1) NOT NULL,
JUGADA VARCHAR (100) NOT NULL, /*es guarda l'anotació de la jugada en format HTML*/
PRIMARY KEY (ID),
FOREIGN KEY (IDGRAELLA) REFERENCES GRAELLA (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS OBERTURA (
ID INT (3) NOT NULL AUTO_INCREMENT,
NOM VARCHAR (100) NOT NULL,
PRIMARY KEY (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS JUGADESOBERTURA (
ID INT (6) NOT NULL AUTO_INCREMENT,
IDOBERTURA INT (3) NOT NULL,
NUMJUGADA INT (3) NOT NULL,
JUGADAORIGENBLANQUES VARCHAR (5) NOT NULL,
JUGADAORDESTIBLANQUES VARCHAR (5) NOT NULL,
JUGADAORIGENNEGRES VARCHAR (5) NOT NULL,
JUGADADESTINEGRES VARCHAR (5) NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (IDOBERTURA) REFERENCES OBERTURA (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS REPTE (
ID INT (6) NOT NULL AUTO_INCREMENT,
IDJUGADORREPTADOR INT (3) NOT NULL,
IDJUGADORREPTAT INT (3),
COLORJUGADORREPTADOR VARCHAR(1) NOT NULL,
HORAINICI TIMESTAMP NOT NULL,
TEMPS INT (6) NOT NULL, /*en segons!!!*/
TEMPSINCREMENT INT (3) NOT NULL, /*en segons!!!*/
AMBEVALUACIOELO INT (1) DEFAULT 0 NOT NULL,
ESTAT INT (1) DEFAULT 0 NOT NULL, /*cancel·lat=-1, pendent=0, acceptat=1*/
DINSSALAJUGADORREPTADOR INT (1),
DINSSALAJUGADORREPTAT INT (1),
PRIMARY KEY (ID),
FOREIGN KEY (IDJUGADORREPTADOR) REFERENCES JUGADOR (ID),
FOREIGN KEY (IDJUGADORREPTAT) REFERENCES JUGADOR (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS PARTIDA (
ID INT (6) NOT NULL AUTO_INCREMENT,
IDREPTE INT (6) NOT NULL,
IDJUGADORBLANQUES INT (3) NOT NULL,
IDJUGADORNEGRES INT (3) NOT NULL,
HORAINICI TIMESTAMP NOT NULL,
TEMPS INT (6) NOT NULL, /*en segons!!!*/
TEMPSINCREMENT INT (3) NOT NULL, /*en segons!!!*/
AMBEVALUACIOELO INT (1) DEFAULT 0 NOT NULL,
IDGRAELLA INT (6),
IDOBERTURA INT (3),
ESTAT INT (1) DEFAULT 0 NOT NULL, /*cancel·lada=-1, jugant=0, ajornada=1, finalitzada=2*/
RESULTAT INT (1), /*blanques=1, empat=2, negres=3*/
PRIMARY KEY (ID),
FOREIGN KEY (IDREPTE) REFERENCES REPTE (ID),
FOREIGN KEY (IDJUGADORBLANQUES) REFERENCES JUGADOR (ID),
FOREIGN KEY (IDJUGADORNEGRES) REFERENCES JUGADOR (ID),
FOREIGN KEY (IDGRAELLA) REFERENCES GRAELLA (ID),
FOREIGN KEY (IDOBERTURA) REFERENCES OBERTURA (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS POSICIOTAULER (
ID INT (6) NOT NULL AUTO_INCREMENT,
IDPARTIDA INT (6) NOT NULL,
NUMJUGADA INT (3) NOT NULL,
COLORULTIMAJUGADA VARCHAR(1) NOT NULL, /*posició després de realitzar la jugada del color*/
POSICIO VARCHAR(1000) NOT NULL, /*guardem la posició de les peces al tauler, separat per ','*/
PRIMARY KEY (ID),
FOREIGN KEY (IDPARTIDA) REFERENCES PARTIDA (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS HISTORIALJUGADOR (
ID INT (6) NOT NULL AUTO_INCREMENT,
IDJUGADOR INT (3) NOT NULL,
NUM_HISTORIAL INT (6) NOT NULL,
HORA TIMESTAMP NOT NULL,
IDPARTIDA INT (6),
ELO INT (4) NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (IDJUGADOR) REFERENCES JUGADOR (ID),
FOREIGN KEY (IDPARTIDA) REFERENCES PARTIDA (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
insert into JUGADOR (nom, cognoms, nick, password) values ('Xavier', 'Masclans', 'xavier_masclans', 'xmasclans');
insert into JUGADOR (nom, cognoms, nick, password) values ('Àngel', 'Exojo', 'angel_exojo', 'aexojo');
insert into JUGADOR (nom, cognoms, nick, password) values ('David', 'Alcaraz', 'david_alcaraz', 'dalcaraz');
insert into JUGADOR (nom, cognoms, nick, password) values ('Jordi', 'Cervelló', 'jordi_cervello', 'jcervello');
insert into JUGADOR (nom, cognoms, nick, password) values ('Agustín', 'Fernández', 'agustin_fernandez', 'afernandez');
insert into JUGADOR (nom, cognoms, nick, password) values ('Arnau', 'Masclans', 'arnau_masclans', 'amasclans');
insert into JUGADOR (nom, cognoms, nick, password) values ('Àngel', 'Boixader', 'angelboixader', 'aboixader');
insert into JUGADOR (nom, cognoms, nick, password) values ('Enric', 'Folch', 'enric_folch', 'efolch');
insert into JUGADOR (nom, cognoms, nick, password) values ('Alfons', 'Nateras', 'alfonso_nateras', 'anateras');
insert into JUGADOR (nom, cognoms, nick, password) values ('Joaquim', 'Navajas', 'joaquim_navajas', 'jnavajas');
insert into JUGADOR (nom, cognoms, nick, password) values ('Joan', 'Turon', 'joan_turon', 'jturon');
insert into JUGADOR (nom, cognoms, nick, password) values ('Oriol', 'Torrillas', 'oriol_torrillas', 'otorrillas');
insert into JUGADOR (nom, cognoms, nick, password) values ('Óscar', 'Barroso', 'oscar_barroso', 'obarroso');
insert into JUGADOR (nom, cognoms, nick, password) values ('Dani', 'Fernández', 'dani_fernandez', 'dfernandez');
insert into JUGADOR (nom, cognoms, nick, password) values ('Gerard', 'Rius', 'gerard_rius', 'grius');
insert into JUGADOR (nom, cognoms, nick, password) values ('David', 'González', 'david_gonzalez', 'dgonzadez');
insert into JUGADOR (nom, cognoms, nick, password) values ('Aleix', 'Centelles', 'aleix_centelles', 'acentelles');
insert into JUGADOR (nom, cognoms, nick, password) values ('Pere', 'Castells', 'pere_castells', 'pcastells');
insert into JUGADOR (nom, cognoms, nick, password) values ('Francesc', 'Cordomí', 'francesc_cordomi', 'fcordomi');
insert into JUGADOR (nom, cognoms, nick, password) values ('Joan', 'Izquierdo', 'joan_izquierdo', 'jizquierdo');
insert into JUGADOR (nom, cognoms, nick, password) values ('Jordi', 'Casas', 'jordi_casas', 'jcasas');
insert into JUGADOR (nom, cognoms, nick, password) values ('Josep', 'Barea', 'josep_barea', 'jbarea');
insert into JUGADOR (nom, cognoms, nick, password) values ('Josep', 'Navajas', 'josep_navajas', 'jnavajas');
insert into JUGADOR (nom, cognoms, nick, password) values ('Raúl', 'Alfonso', 'raul_alfonso', 'ralfonso');
insert into JUGADOR (nom, cognoms, nick, password) values ('Josep', 'Guzmán', 'josep_guzman', 'jguzman');
insert into JUGADOR (nom, cognoms, nick, password) values ('Stefan', 'Alexandry', 'stefan_alexandry', 'salexandry');
insert into JUGADOR (nom, cognoms, nick, password) values ('Albert', 'Valls', 'albert_valls', 'avalls');
insert into JUGADOR (nom, cognoms, nick, password) values ('Isidre', 'Camprubí', 'isidre_camprubi', 'icamprubi');
insert into JUGADOR (nom, cognoms, nick, password) values ('Josep', 'Plantada', 'josep_plantada', 'jplantada');
insert into JUGADOR (nom, cognoms, nick, password) values ('Jordi', 'Salvany', 'jordi_salvany', 'jsalvany');
insert into JUGADOR (nom, cognoms, nick, password) values ('Pol', 'Méndez', 'pol_mendez', 'pmendez');
insert into JUGADOR (nom, cognoms, nick, password) values ('Mercè Montserrat', 'Oviedo', 'montserrat_oviedo', 'moviedo');
insert into JUGADOR (nom, cognoms, nick, password) values ('Artur', 'Salvany', 'artur_salvany', 'asalvany');
insert into JUGADOR (nom, cognoms, nick, password) values ('Enric', 'Vallejo', 'enric_vallejo', 'evallejo');
insert into JUGADOR (nom, cognoms, nick, password) values ('Ayoub', 'Elkhafi', 'ayoub_elkhafi', 'aelkhafi');
insert into JUGADOR (nom, cognoms, nick, password) values ('Antoni', 'Navajas', 'antoni_navajas', 'anavajas');
insert into JUGADOR (nom, cognoms, nick, password) values ('Ariadna', 'Alfonso', 'ariadna_alfonso', 'aalfonso');
insert into JUGADOR (nom, cognoms, nick, password) values ('Maria', 'Alfonso', 'maria_alfonso', 'malfonso');
insert into JUGADOR (nom, cognoms, nick, password) values ('Erika', 'García', 'erika_garcia', 'egarcia');
insert into JUGADOR (nom, cognoms, nick, password) values ('Arnau', 'González', 'arnau_gonzalez', 'agonzalez');
insert into JUGADOR (nom, cognoms, nick, password) values ('David', 'Cregut', 'cregut', 'cregut');
insert into JUGADOR (nom, cognoms, nick, password) values ('Pedro', 'García', 'pedro_garcia', 'pgarcia');
insert into JUGADOR (nom, cognoms, nick, password) values ('Alfonso', 'Chavero', 'alfonso_chavero', 'achavero');
insert into JUGADOR (nom, cognoms, nick, password) values ('Werner', 'Katz', 'werner_katz', 'wkatz');
insert into JUGADOR (nom, cognoms, nick, password) values ('Juan Manuel', 'Bouzas', 'juan_bouzas', 'jbouzas');
| true
|
3166b9c7cc1aed2bfd60ff54e1afc1f07597a59b
|
SQL
|
eniko50/proba
|
/materijal/22_Baze_podataka_2/zadaci/student.sql
|
UTF-8
| 1,941
| 3.6875
| 4
|
[] |
no_license
|
DROP DATABASE vp;
CREATE DATABASE vp;
USE vp;
create table student (
id integer auto_increment,
br_indeksa varchar(10) not null,
ime varchar(100) not null,
prezime varchar(100) not null,
primary key (id)
);
create table predmet (
id integer auto_increment,
naziv varchar(200) not null,
primary key(id)
);
create table ispit (
id integer auto_increment,
student_id integer,
predmet_id integer,
ocena integer,
primary key (id),
foreign key (student_id) references student(id),
foreign key (predmet_id) references predmet(id)
);
insert into student (id, br_indeksa, ime, prezime) values (1, 'e12','Pera', 'Peric');
insert into student (id, br_indeksa, ime, prezime) values (2, 'e15','Steva', 'Stevic');
insert into student (id, br_indeksa, ime, prezime) values (3, 'e18','Marko', 'Markovic');
insert into student (id, br_indeksa, ime, prezime) values (4, 'e22','Mitar', 'Mitrovic');
insert into student (id, br_indeksa, ime, prezime) values (5, 'e25','Jovan', 'Jovanovic');
insert into predmet (id, naziv) values (1,'Matematicka analiza');
insert into predmet (id, naziv) values (2,'Web programiranje');
insert into predmet (id, naziv) values (3,'Objektno orjentisano programiranje');
insert into predmet (id, naziv) values (4,'Racunarska inteligencija');
insert into ispit (student_id, predmet_id, ocena) values (1,1,7);
insert into ispit (student_id, predmet_id, ocena) values (1,2,8);
insert into ispit (student_id, predmet_id, ocena) values (1,3,7);
insert into ispit (student_id, predmet_id, ocena) values (2,1,7);
insert into ispit (student_id, predmet_id, ocena) values (2,2,9);
insert into ispit (student_id, predmet_id, ocena) values (2,3,9);
insert into ispit (student_id, predmet_id, ocena) values (3,1,10);
insert into ispit (student_id, predmet_id, ocena) values (3,3,10);
insert into ispit (student_id, predmet_id, ocena) values (4,2,8);
insert into ispit (student_id, predmet_id, ocena) values (4,3,9);
| true
|
66a88b7e7bb32727ed516d55c1b62521b3ff7599
|
SQL
|
manikandanganesh2791/StudentApplication
|
/ddl-scripts02.sql
|
UTF-8
| 8,265
| 2.75
| 3
|
[] |
no_license
|
/* Source-Staging of admissions_info */
CREATE TABLE `Stg_admissions_info` (
`application_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`creation_date` CHAR(10) CHARACTER SET utf8 DEFAULT NULL,
`last_updated_date` CHAR(10) CHARACTER SET utf8 DEFAULT NULL,
`submitted_date` CHAR(10) CHARACTER SET utf8 DEFAULT NULL,
`fee_payment_type` VARCHAR(16) CHARACTER SET utf8 DEFAULT NULL,
`payment_card_type` VARCHAR(16) CHARACTER SET utf8 DEFAULT NULL,
`applicant_last_name` VARCHAR(19) NOT NULL DEFAULT '',
`applicant_first_name` VARCHAR(20) NOT NULL DEFAULT '',
`applicant_middle_name` VARCHAR(21) NOT NULL DEFAULT '',
`current_city` VARCHAR(32) CHARACTER SET utf8 DEFAULT '',
`current_state_province` VARCHAR(32) CHARACTER SET utf8 DEFAULT '',
`current_country` VARCHAR(32) CHARACTER SET utf8 DEFAULT '',
`current_zipcode` VARCHAR(32) CHARACTER SET utf8 DEFAULT '',
`email_address` VARCHAR(25) DEFAULT '',
`permanent_city` VARCHAR(32) CHARACTER SET utf8 DEFAULT '',
`permanent_state_province` VARCHAR(32) CHARACTER SET utf8 DEFAULT '',
`permanent_country` VARCHAR(32) CHARACTER SET utf8 DEFAULT '',
`permanent_zipcode` VARCHAR(32) CHARACTER SET utf8 DEFAULT '',
`country_of_citizenship` VARCHAR(32) CHARACTER SET utf8 DEFAULT NULL,
`ethnicity_indian` VARCHAR(32) CHARACTER SET utf8 DEFAULT NULL,
`ethnicity_asian` VARCHAR(32) CHARACTER SET utf8 DEFAULT NULL,
`ethnicity_black` VARCHAR(32) CHARACTER SET utf8 DEFAULT NULL,
`ethnicity_hawaiian` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`ethnicity_white` VARCHAR(32) CHARACTER SET utf8 DEFAULT NULL,
`ethnicity_hispanic` VARCHAR(8) CHARACTER SET utf8 DEFAULT NULL,
`gender` VARCHAR(16) CHARACTER SET utf8 DEFAULT NULL,
`date_of_birth` VARCHAR(10) DEFAULT NULL,
`department_name` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`intended_entry_term` VARCHAR(16) CHARACTER SET utf8 DEFAULT NULL,
`program` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`current_county` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`gre_quantitative_perc` INT(8) DEFAULT NULL,
`gre_analytical_perc` INT(8) DEFAULT NULL,
`gre_verbal_perc` INT(8) DEFAULT NULL,
`college_name_1` VARCHAR(128) CHARACTER SET utf8 DEFAULT NULL,
`college_country_1` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`international_1` VARCHAR(1) DEFAULT NULL,
`college_name_2` VARCHAR(128) CHARACTER SET utf8 DEFAULT NULL,
`college_country_2` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`international_2` VARCHAR(1) DEFAULT NULL,
`college_name_3` VARCHAR(128) CHARACTER SET utf8 DEFAULT NULL,
`college_country_3` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`international_3` VARCHAR(1) DEFAULT NULL,
`rec_firstname_1` VARCHAR(17) DEFAULT NULL,
`rec_lastname_1` VARCHAR(16) DEFAULT NULL,
`rec_country_1` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`rec_lttr_received_dt_1` VARCHAR(20) CHARACTER SET utf8 DEFAULT NULL,
`rec_firstname_2` VARCHAR(17) DEFAULT NULL,
`rec_lastname_2` VARCHAR(16) DEFAULT NULL,
`rec_country_2` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`rec_lttr_received_dt_2` VARCHAR(20) CHARACTER SET utf8 DEFAULT NULL,
`rec_firstname_3` VARCHAR(17) DEFAULT NULL,
`rec_lastname_3` VARCHAR(16) DEFAULT NULL,
`rec_country_3` VARCHAR(64) CHARACTER SET utf8 DEFAULT NULL,
`rec_lttr_received_dt_3` VARCHAR(20) CHARACTER SET utf8 DEFAULT NULL,
`prog_actn` VARCHAR(8) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=INNODB DEFAULT CHARSET=latin1;
/*Dim_Date*/
CREATE TABLE `dim_date` (
`date_key` INT(11) DEFAULT NULL,
`the_date` VARCHAR(30),
`the_year` SMALLINT(6) DEFAULT NULL,
`the_quarter` TINYINT(4) DEFAULT NULL,
`the_month` TINYINT(4) DEFAULT NULL,
`the_week` TINYINT(4) DEFAULT NULL,
`day_of_year` SMALLINT(6) DEFAULT NULL,
`day_of_month` TINYINT(4) DEFAULT NULL,
`day_of_week` TINYINT(4) DEFAULT NULL
) ENGINE=MYISAM DEFAULT CHARSET=utf8;
/* Dim_Department */
CREATE TABLE `dim_department` (
`Dept_ID` VARCHAR(16) NOT NULL,
`department_name` VARCHAR(64) DEFAULT NULL,
`program` VARCHAR(64) DEFAULT NULL,
PRIMARY KEY (`Dept_ID`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
/* Dim_Prg_act */
CREATE TABLE `dim_prg_act` (
`prog_actn_ID` VARCHAR(8) NOT NULL,
`prog_actn` VARCHAR(8) DEFAULT NULL,
`is_applied` BINARY(1) DEFAULT NULL,
`is_admitted` BINARY(1) DEFAULT NULL,
`is_accepted` BINARY(1) DEFAULT NULL,
PRIMARY KEY (`prog_actn_ID`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
/*Dim_region*/
CREATE TABLE `dim_region` (
`Region_ID` INT AUTO_INCREMENT,
`country` VARCHAR(32) DEFAULT '' ,
`state` VARCHAR(32) DEFAULT '',
`city` VARCHAR(32) DEFAULT '',
`zipcode` VARCHAR(32) DEFAULT '',
PRIMARY KEY (`Region_ID`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
/*Dim_stud_application*/
CREATE TABLE `dim_stud_application` (
`application_id` INT(10) NOT NULL,
`applicant_last_name` VARCHAR(19) NOT NULL DEFAULT '',
`applicant_first_name` VARCHAR(20) NOT NULL DEFAULT '',
`applicant_middle_name` VARCHAR(21) NOT NULL DEFAULT '',
`name_prefix` VARCHAR(8) DEFAULT NULL,
`email_address` VARCHAR(25) NOT NULL DEFAULT '',
`gender` VARCHAR(16) DEFAULT NULL,
`date_of_birth` VARCHAR(10) DEFAULT NULL,
`country_of_citizenship` VARCHAR(32) DEFAULT NULL,
`native_language_response` VARCHAR(64) DEFAULT NULL,
`financial_aid_response` VARCHAR(8) DEFAULT NULL,
`external_support` VARCHAR(8) DEFAULT NULL,
`current_city` VARCHAR(32) DEFAULT NULL,
`current_state_province` VARCHAR(32) DEFAULT NULL,
`current_country` VARCHAR(32) DEFAULT NULL,
`current_zipcode` VARCHAR(32) DEFAULT NULL,
`permanent_city` VARCHAR(32) DEFAULT NULL,
`permanent_state_province` VARCHAR(32) DEFAULT NULL,
`permanent_zipcode` VARCHAR(32) DEFAULT NULL,
`permanent_county` VARCHAR(32) DEFAULT NULL,
`current_county` VARCHAR(32) DEFAULT NULL,
`college_name_1` VARCHAR(128) DEFAULT NULL,
`college_country_1` VARCHAR(64) DEFAULT NULL,
`international_1` VARCHAR(1) DEFAULT NULL,
`college_name_2` VARCHAR(128) DEFAULT NULL,
`college_country_2` VARCHAR(64) DEFAULT NULL,
`international_2` VARCHAR(1) DEFAULT NULL,
`college_name_3` VARCHAR(128) DEFAULT NULL,
`college_country_3` VARCHAR(64) DEFAULT NULL,
`international_3` VARCHAR(1) DEFAULT NULL,
`rec_firstname_1` VARCHAR(17) DEFAULT NULL,
`rec_lastname_1` VARCHAR(16) DEFAULT NULL,
`rec_country_1` VARCHAR(64) DEFAULT NULL,
`rec_lttr_received_dt_1` VARCHAR(20) DEFAULT NULL,
`rec_firstname_2` VARCHAR(17) DEFAULT NULL,
`rec_lastname_2` VARCHAR(16) DEFAULT NULL,
`rec_country_2` VARCHAR(64) DEFAULT NULL,
`rec_lttr_received_dt_2` VARCHAR(20) DEFAULT NULL,
`rec_firstname_3` VARCHAR(17) DEFAULT NULL,
`rec_lastname_3` VARCHAR(16) DEFAULT NULL,
`rec_country_3` VARCHAR(64) DEFAULT NULL,
`rec_lttr_received_dt_3` VARCHAR(20) DEFAULT NULL,
`gre_quantitative_perc` INT(8) DEFAULT NULL,
`gre_analytical_perc` INT(8) DEFAULT NULL,
`gre_verbal_perc` INT(8) DEFAULT NULL,
`intended_entry_term` VARCHAR(16) DEFAULT NULL,
PRIMARY KEY (`application_id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
/*Dim_Junk*/
CREATE TABLE dim_junked
( Junk_Id INT(50) NOT NULL AUTO_INCREMENT,
group_key VARCHAR(50),
`ethnicity_indian` VARCHAR(50) NOT NULL DEFAULT ' ',
`ethnicity_asian` VARCHAR(50) NOT NULL DEFAULT ' ',
`ethnicity_black` VARCHAR(50) NOT NULL DEFAULT ' ',
`ethnicity_hawaiian` VARCHAR(50) NOT NULL DEFAULT ' ',
`ethnicity_white` VARCHAR(50) NOT NULL DEFAULT ' ',
`ethnicity_hispanic` VARCHAR(50) NOT NULL DEFAULT ' ',
PRIMARY KEY (Junk_id));
/*Fact_application*/
CREATE TABLE `fact_application` (
`FID` INT(11) NOT NULL AUTO_INCREMENT,
`application_id` INT(10) ,
`Dept_ID` VARCHAR(16) ,
`Junk_ID` VARCHAR(50) ,
`prog_actn_ID` VARCHAR(8) ,
`Created_date_key` INT(11) ,
`Submitted_date_key` INT(11) ,
`Last_Updated_date_key` INT(11) ,
`Region_ID` INT(11) ,
`gre_quantitative_perc` INT(8) ,
`gre_analytical_perc` INT(8) ,
`gre_verbal_perc` INT(8) ,
`intended_entry_term` VARCHAR(16) ,
`is_applied` BINARY(1) ,
`is_admitted` BINARY(1) ,
`is_accepted` BINARY(1) ,
PRIMARY KEY (`FID`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
| true
|
03b226a19937b82992818c1c4dd17375b67cb7d3
|
SQL
|
JaviCodx/cs50x
|
/pset7/movies/9.sql
|
UTF-8
| 153
| 3.578125
| 4
|
[] |
no_license
|
SELECT name FROM people WHERE id IN (
SELECT stars.person_id FROM stars
JOIN movies
ON stars.movie_id = movies.id
and movies.year = 2004)
ORDER BY birth
| true
|
633025a7fe86b560acc857e1936f2f6c0f6742f9
|
SQL
|
monti773/bamazon
|
/schema.sql
|
UTF-8
| 1,317
| 3.390625
| 3
|
[] |
no_license
|
CREATE DATABASE bamazon;
USE bamazon;
CREATE TABLE products (
item_id INT(100) AUTO_INCREMENT,
product_name VARCHAR(40) NOT NULL,
department_name VARCHAR(40) NOT NULL,
price DECIMAL(10,2) NOT NULL,
stock_quantity INT(100) NOT NULL,
product_sales DECIMAL(10,2) NOT NULL,
PRIMARY KEY (item_id)
);
INSERT INTO products (product_name, department_name, price, stock_quantity, product_sales)
VALUES ("Atari", "Electronics", 230.00, 50, 300.00),
("Turneck", "Clothing", 30.00, 10, 30.00),
("Yoga mat", "Furniture", 40.00, 40, 400.00),
("Cell Phone", "Electronics", 500.00, 20, 700.00),
("Pillow", "Furniture", 20.00, 10, 0),
("Chair", "Furniture", 40.00, 4, 800),
("Shelf", "Furniture", 65.00, 5, 500.00),
("Dress", "Clothing", 445.00, 10, 240.00),
("Pants", "Clothing", 68.00, 25, 300.00),
("Jshorts", "Clothing", 123.00, 30, 100.00);
CREATE TABLE departments (
department_id INT AUTO_INCREMENT,
department_name VARCHAR(40) NOT NULL,
over_head_costs DECIMAL(10,2) NOT NULL,
PRIMARY KEY (department_id)
);
INSERT INTO departments (department_name, over_head_costs)
VALUES ("Electronics", 2000),
("Clothing", 500),
("Furniture", 1000);
| true
|
7f18b6715ed35f2ccc4e5c8c172c9d309f199815
|
SQL
|
giggals/Csharp
|
/Joins, Subqueries, CTE and Indices/10. Employees Summary/SQLQuery1.sql
|
UTF-8
| 328
| 3.9375
| 4
|
[
"MIT"
] |
permissive
|
SELECT TOP(50) e.EmployeeID , e.FirstName + ' ' + e.LastName AS EmployeeName,
m.FirstName + ' ' + m.LastName AS ManagerName , d.[Name] AS DepartmenName
FROM Employees AS e
JOIN Employees AS m
ON m.EmployeeID = e.ManagerID
JOIN Departments AS d
ON d.DepartmentID = e.DepartmentID
ORDER BY e.EmployeeID
| true
|
7354ea21cd0250eaf654289b21b5f4a8b149c2ea
|
SQL
|
daniel2483/SQLPractice
|
/queries/SQL_Create_Report.sql
|
UTF-8
| 1,167
| 2.984375
| 3
|
[] |
no_license
|
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `Create_report`
(cod_site int,
fecha_deteccion datetime,
proceso_id int,
texto_id int,
texto text,
tt_ref varchar(15),
cod_prioridad int,
responsable_id int,
rep_publico VARCHAR(5),
cod_tipo_reporte int )
begin
declare ESTADO_CERRADO int default 1;
declare REGISTRA_APERTURA int default 1;
declare INFORMANTE int default 3; #Fron Ofice CR
declare G_t_max DOUBLE;
set G_t_max= 24;
insert into averia
(prioridad_id,informante_id,gne_rep,fecho_detec,fecho_recep,estado_id,reg_id_open,proceso_id,texto_id,texto,public,tt_ref,gne_repa,t_max,tipo_rep_id,persona_id,info_notif,reg_id_close)
values
(cod_prioridad,INFORMANTE,cod_site,fecha_deteccion,now_instancia(),ESTADO_CERRADO,REGISTRA_APERTURA,proceso_id,texto_id,texto,rep_publico,tt_ref,
cod_site,G_t_max,cod_tipo_reporte,responsable_id,texto,1);
end
| true
|
0e530548ed508824173bcbb5916896fb54d1a85a
|
SQL
|
bborzechowski/spring-database-auth-basic
|
/src/main/resources/start.sql
|
UTF-8
| 589
| 2.734375
| 3
|
[] |
no_license
|
-- roles
insert into role(role_id, role)
values (1, 'ADMIN');
insert into role(role_id, role)
values (2, 'USER');
-- users
insert into user(id, active, email, lastname, login, name, password)
values (1, 1, 'teges@mail.com', 'Nowak', 'admin', 'Stefan', '$2a$10$z7iFcwS4VpDYYb82VZVsl.11EmMqlQUpNv.Ukz4w5Cyulva5nq45q');
insert into user(id, active, email, lastname, login, name, password)
values (2, 1, 'test456@mail.com', 'Kowalski', 'user', 'Adam', '$2a$10$MQUy8M/E6O5OIeUBf0XT0eHubWFkOfa6fbQvbeReal1Q.wJyzkBKO');
-- add roles into users
insert into user_role(user_id, role_id) values (1, 1);
insert into user_role(user_id, role_id) values (1, 2);
insert into user_role(user_id, role_id) values (2, 2);
| true
|
8e338c7964c9b5576e808e99be1e0faa919b42d6
|
SQL
|
crypteaux/CSCI_5125
|
/queries/04.sql
|
UTF-8
| 236
| 2.859375
| 3
|
[] |
no_license
|
SELECT name, title
FROM person NATURAL JOIN works NATURAL JOIN job NATURAL JOIN job_profile
WHERE name = 'Daniel DeKerlegand'
UNION
SELECT name, title
FROM person NATURAL JOIN worked NATURAL JOIN job NATURAL JOIN job_profile
WHERE name = 'Daniel DeKerlegand';
| true
|
3fcce85c882beac7f71560bf68b3b92e648ab5f5
|
SQL
|
danstowell/solar-panel-detection
|
/db/fit.sql
|
UTF-8
| 1,268
| 3.5
| 4
|
[] |
no_license
|
/*
** Create table containing fit dataset
*/
\echo Creating fit table ...
drop table if exists raw.fit;
drop table if exists fit;
create table raw.fit (
fit_id int,
extension char(1),
postcode_stub varchar(7),
technology varchar(24),
installed_capacity float,
declared_net_capacity float,
application_date date,
commissioning_date date,
mcs_issue_date date,
export_status varchar(30),
tariff_code varchar(20),
tariff_description varchar(100),
installation_type varchar(25),
country varchar(15),
local_authority varchar(40),
govt_office_region varchar(40),
constituency varchar(60),
accreditation_route varchar(6),
mpan_prefix float,
comm_school varchar(40),
llsoa_code varchar(20)
);
\copy raw.fit from '../data/processed/fit.csv' delimiter ',' csv header;
-- Restrict raw.fit to Solar PV only
select * into fit
from raw.fit
where technology = 'Photovoltaic';
-- Add roughly calculated area for raw.fit entries to aid matching.
-- Solar PV has power approx. 52W / m^2
alter table fit
add column "area" float;
update fit
set area = declared_net_capacity/52;
| true
|
c116412e3894ced968b58871809b8b437fb8e585
|
SQL
|
BAEintelli/TIL
|
/quiz 1.sql
|
UTF-8
| 1,404
| 4.1875
| 4
|
[
"MIT"
] |
permissive
|
#1. country 테이블에서 중복을 제거한 Continent를 조회하세요.
SELECT DISTINCT(Continent)
FROM country
#2. 한국 도시중에 인구가 100만이 넘는 도시를 조회하여 인구순으로 내림차순하세요.
SELECT *
FROM city
WHERE CountryCode="KOR" AND Population > 1000000
ORDER BY Population DESC
#3. city 테이블에서 population이 800만 ~ 1000만 사이인 도시 데이터를 인구수순으로 내림차순하세요.
SELECT *
FROM city
WHERE Population BETWEEN 8000000 AND 10000000
ORDER BY Population DESC
#4. country 테이블에서 1940 ~ 1950년도 사이에 독립한 국가들을 조회하고 독립한 년도 순으로 오름차순하세
#요.
SELECT CODE, concat(NAME, "(",IndepYear,")") AS "NameInd", Continent, Population
FROM country
WHERE IndepYear between 1940 and 1950
ORDER BY IndepYear
#5. contrylanguage 테이블에서 스페인어, 한국어, 영어를 95% 이상 사용하는 국가 코드를 Percentage로 내
#림차순하여 아래와 같이 조회하세요.
SELECT CountryCode, Language, Percentage
FROM countrylanguage
WHERE Language IN ("English","Korean","Spanish") AND Percentage > 95
ORDER BY Percentage DESC
# 6. country 테이블에서 Code가 A로 시작하고 GovernmentForm에 Republic이 포함되는 데이터를 아래와
#같이 조회하세요.
SELECT *
FROM country
WHERE Code LIKE "A%" AND GovernmentForm LIKE "%Republic%"
| true
|
806b4f70f980be475eee79b9f96c47b657d1a554
|
SQL
|
c-eng/holbertonschool-higher_level_programming
|
/0x0E-SQL_more_queries/13-count_shows_by_genre.sql
|
UTF-8
| 221
| 3.859375
| 4
|
[] |
no_license
|
-- Display genres and number of shows linked to genre
SELECT name, count(*) AS number_of_shows
FROM tv_genres
INNER JOIN tv_show_genres ON tv_genres.id=tv_show_genres.genre_id
GROUP BY name
ORDER BY number_of_shows DESC;
| true
|
3ca7ce832e44b2b265380badea74d370dccfc04c
|
SQL
|
yanoandri/SalesOrder-Pro
|
/PFSHelper.DataAccessLayer/dbFrameworkPFS/dbFrameworkPFS/dbo/Stored Procedures/uspTMPT_FirstStagingPscRmwCipDelete.sql
|
UTF-8
| 865
| 2.625
| 3
|
[] |
no_license
|
/***********************************************************************************************************************
Copyright (c) 2015 PT Profescipta Wahanatehnik. All Rights Reserved.
This software, all associated documentation, and all copies
DESCRIPTION
Name : uspTMPT_FirstStagingPscRmwCipDelete
Desc : This store procedure is use to delete TMPT_FIRST_STAGING_PSC_RMW_CIP
Create Date : 29 Jan 2015 - Created By : PFS Generator v5.1
Modified Date : - Modified By :
Comments :
Sample Data :
***********************************************************************************************************************/
CREATE PROCEDURE dbo.uspTMPT_FirstStagingPscRmwCipDelete
(
@iFirstStagingPscRmwCipID INT
)
AS
BEGIN
DELETE TMPT_FIRST_STAGING_PSC_RMW_CIP
WHERE TMPT_FIRST_STAGING_PSC_RMW_CIP_ID = @iFirstStagingPscRmwCipID
END
| true
|
bb91609a578ae265e50adc7a33a68a8f4c53bf6a
|
SQL
|
Al-ta-iR/yandex.praktikum
|
/09_ data_extraction/04.sql
|
UTF-8
| 236
| 3.328125
| 3
|
[] |
no_license
|
SELECT festival_name AS festival_name,
extract(WEEK
FROM festival_date) AS festival_week
FROM festivals
WHERE festival_city = 'Москва'
AND festival_date < '2018-09-30'
AND festival_date > '2018-07-23'
| true
|
784a447d36583f65163f8b179c57a4ec28e541a2
|
SQL
|
DamonWcl/jeesite
|
/web/db/db2/filemanager.sql
|
UTF-8
| 2,058
| 3.453125
| 3
|
[
"GPL-1.0-or-later",
"AGPL-3.0-only",
"Apache-2.0",
"AGPL-3.0-or-later",
"LicenseRef-scancode-other-copyleft"
] |
permissive
|
/* Drop Tables */
DROP TABLE js_filemanager_shared;
DROP TABLE js_filemanager_folder;
/* Create Tables */
-- 文件管理文件夹
CREATE TABLE js_filemanager_folder
(
id varchar(64) NOT NULL,
parent_code varchar(64) NOT NULL,
parent_codes varchar(1000) NOT NULL,
tree_sort decimal(10) NOT NULL,
tree_sorts varchar(1000) NOT NULL,
tree_leaf char(1) NOT NULL,
tree_level decimal(4) NOT NULL,
tree_names varchar(1000) NOT NULL,
folder_name vargraphic(100) NOT NULL,
group_type varchar(64) NOT NULL,
office_code varchar(64),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks vargraphic(500),
corp_code varchar(64) DEFAULT '0' NOT NULL,
corp_name vargraphic(100) DEFAULT 'JeeSite' NOT NULL,
PRIMARY KEY (id)
);
-- 文件管理共享表
CREATE TABLE js_filemanager_shared
(
id varchar(64) NOT NULL,
folder_id varchar(64),
file_upload_id varchar(64),
file_name vargraphic(500) NOT NULL,
receive_user_code varchar(100) NOT NULL,
receive_user_name vargraphic(200) NOT NULL,
click_num numeric(10),
status char(1) DEFAULT '0' NOT NULL,
create_by varchar(64) NOT NULL,
create_date timestamp NOT NULL,
update_by varchar(64) NOT NULL,
update_date timestamp NOT NULL,
remarks vargraphic(500),
PRIMARY KEY (id)
);
/* Create Indexes */
CREATE INDEX idx_sys_file_tree_pc ON js_filemanager_folder (parent_code);
CREATE INDEX idx_sys_file_tree_ts ON js_filemanager_folder (tree_sort);
CREATE INDEX idx_sys_file_tree_tss ON js_filemanager_folder (tree_sorts);
CREATE INDEX idx_sys_file_tree_gt ON js_filemanager_folder (group_type);
CREATE INDEX idx_sys_file_tree_oc ON js_filemanager_folder (office_code);
CREATE INDEX idx_sys_file_tree_cb ON js_filemanager_folder (create_by);
CREATE INDEX idx_sys_file_share_ruc ON js_filemanager_shared (receive_user_code);
CREATE INDEX idx_sys_file_share_cb ON js_filemanager_shared (create_by);
| true
|
d98883ebfb5042781088912b76ae75f040e1779b
|
SQL
|
bluepoet/SimpleBoardService
|
/board.sql
|
UTF-8
| 261
| 2.53125
| 3
|
[] |
no_license
|
CREATE TABLE `board` (
`article_no` INT(11) NOT NULL,
`title` VARCHAR(100) NOT NULL,
`content` VARCHAR(1000) NOT NULL,
`author` VARCHAR(30) NOT NULL,
`score` INT(11) DEFAULT '0',
PRIMARY KEY (`article_no`)
) ENGINE=INNODB DEFAULT CHARSET=utf8
| true
|
d95489a6c04978579aae56da7e4e2ccb016858fa
|
SQL
|
EnsemblGenomes/RNAseqTHS
|
/make_tables.sql
|
UTF-8
| 2,681
| 3.4375
| 3
|
[] |
no_license
|
/*
reset existing DB:
*/
DROP TABLE IF EXISTS CRAMS;
DROP TABLE IF EXISTS ORGS;
DROP TABLE IF EXISTS AERUNS;
DROP TABLE IF EXISTS ENASUBS;
DROP TABLE IF EXISTS STUDY;
DROP TABLE IF EXISTS SAMPLE;
DROP TABLE IF EXISTS ATTRIBUTES;
DROP TABLE IF EXISTS NAME_CHECK;
/*
set up DB:
*/
CREATE TABLE IF NOT EXISTS CRAMS (
analysis_id VARCHAR(12) NOT NULL,
run_id VARCHAR(12),
title TINYTEXT,
filename VARCHAR(150),
md5 CHAR(32),
date DATE NOT NULL,
file_exists BOOLEAN,
piperun TINYINT,
finished BOOLEAN DEFAULT 0,
PRIMARY KEY (analysis_id)
);
CREATE TABLE IF NOT EXISTS ORGS (
organism VARCHAR(200) NOT NULL,
reference_organism VARCHAR(150) NOT NULL,
piperun TINYINT,
finished BOOLEAN,
PRIMARY KEY (organism,reference_organism)
);
CREATE TABLE IF NOT EXISTS AERUNS (
biorep_id VARCHAR(12) NOT NULL,
run_id VARCHAR(12),
cram_url VARCHAR(150),
md5_sum CHAR(32),
sample_id VARCHAR(14),
study_id VARCHAR(14),
assembly VARCHAR(60),
org VARCHAR(150),
ref_org VARCHAR(150),
ena_date DATE,
ae_date DATE,
quality SMALLINT,
status VARCHAR(20),
piperun TINYINT,
uploaded BOOLEAN DEFAULT 0,
submitted BOOLEAN DEFAULT 0,
finished BOOLEAN DEFAULT 0,
PRIMARY KEY (biorep_id)
);
CREATE TABLE IF NOT EXISTS ENASUBS (
analysis_id VARCHAR(12) NOT NULL,
run_id VARCHAR(12) NOT NULL,
biorep_id VARCHAR(50),
submission_id VARCHAR(12),
piperun TINYINT,
PRIMARY KEY (analysis_id,run_id)
);
CREATE TABLE IF NOT EXISTS STUDY (
study_id VARCHAR(12) NOT NULL,
prj_id VARCHAR(12),
alias TINYTEXT,
title TEXT,
abstract TEXT,
description TEXT,
piperun TINYINT,
has_samples BOOLEAN DEFAULT 0,
has_dim BOOLEAN DEFAULT 0,
written BOOLEAN DEFAULT 0,
finished BOOLEAN DEFAULT 0,
PRIMARY KEY (study_id)
);
CREATE TABLE IF NOT EXISTS SAMPLE (
sample_id VARCHAR(12) NOT NULL,
primary_id VARCHAR(12),
alias TINYTEXT,
center TINYTEXT,
scientific_name TINYTEXT,
title TEXT,
description TEXT,
piperun TINYINT,
written BOOLEAN DEFAULT 0,
PRIMARY KEY (sample_id)
);
CREATE TABLE IF NOT EXISTS ATTRIBUTES (
sample_id VARCHAR(12) NOT NULL,
tag VARCHAR(100),
value TINYTEXT,
piperun TINYINT,
PRIMARY KEY (sample_id, tag)
);
CREATE TABLE IF NOT EXISTS NAME_CHECK (
species_production_name VARCHAR(150) NOT NULL,
assembly_accession VARCHAR(20),
assembly_name VARCHAR(150) NOT NULL,
assembly_default VARCHAR(150),
url_name VARCHAR(150),
alt VARCHAR(150),
piperun TINYINT,
PRIMARY KEY (species_production_name, assembly_name)
);
| true
|
d9a426b2bbc6839d3bdbb886df45e5ccc47257af
|
SQL
|
xiaeryu/LeetCode
|
/departmentHighestSalary.sql
|
UTF-8
| 748
| 4.15625
| 4
|
[] |
no_license
|
#########################################################################
## LeetCode Number 184 Department Highest Salary
## Problem description can be found here:
## https://leetcode.com/problems/department-highest-salary/
## MySQL query statement
#########################################################################
# Write your MySQL query statement below
SELECT Department.Name AS Department, M.Name AS Employee, M.Salary AS Salary
FROM Department
JOIN
(SELECT E.Name, E.Salary, E.DepartmentId
FROM Employee E,
(SELECT MAX(Salary) AS ms, DepartmentId
FROM Employee
GROUP BY DepartmentId) T
WHERE E.Salary = T.ms
AND E.DepartmentId = T.DepartmentId
) M
WHERE Department.Id = M.DepartmentId
| true
|
6b3114693adba589753b1cfbc52b494c6013fad2
|
SQL
|
emanuelgostner/flashcardsystem
|
/src/main/resources/schema.sql
|
UTF-8
| 2,320
| 4
| 4
|
[] |
no_license
|
CREATE DATABASE IF NOT EXISTS massedterm;
CREATE TABLE IF NOT EXISTS users (
username VARCHAR(128) PRIMARY KEY,
password VARCHAR(128) NOT NULL,
enabled CHAR(1) CHECK (ENABLED IN ('Y','N') ) NOT NULL
);
CREATE TABLE IF NOT EXISTS authorities (
username VARCHAR(128) NOT NULL,
authority VARCHAR(128) NOT NULL
);
CREATE TABLE IF NOT EXISTS stacks (
stackid INT PRIMARY KEY AUTO_INCREMENT,
stackname VARCHAR(255) NOT NULL,
USER VARCHAR(255) NOT NULL,
deleted BOOLEAN DEFAULT 0,
FOREIGN KEY (USER ) REFERENCES users(username)
);
CREATE TABLE IF NOT EXISTS cards (
cardid INT PRIMARY KEY AUTO_INCREMENT,
stackid INT NOT NULL,
question VARCHAR(255) NOT NULL,
answer VARCHAR(255) NOT NULL,
FOREIGN KEY (stackid) REFERENCES stacks(stackid)
);
CREATE TABLE IF NOT EXISTS rounds (
roundid INT PRIMARY KEY AUTO_INCREMENT,
stackid INT NOT NULL,
timestamp datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
USER VARCHAR(255) NOT NULL,
FOREIGN KEY (stackid) REFERENCES stacks(stackid)
);
CREATE TABLE IF NOT EXISTS responses (
responseid INT PRIMARY KEY AUTO_INCREMENT,
roundid INT NOT NULL,
cardid INT NOT NULL,
isCorrect BOOLEAN NOT NULL DEFAULT 0,
timestamp datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
USER VARCHAR(255) NOT NULL,
FOREIGN KEY (roundid) REFERENCES rounds(roundid),
FOREIGN KEY (cardid) REFERENCES cards(cardid)
);
/*insert into users (username, password, enabled) values (
'admin',
'password',
true
);
insert into authorities (username, authority) values(
'admin',
'ROLE_ADMIN'
);*/
-- ALTER TABLE authorities ADD CONSTRAINT AUTHORITIES_UNIQUE UNIQUE (username, authority);
-- ALTER TABLE authorities ADD CONSTRAINT AUTHORITIES_FK1 FOREIGN KEY (username) REFERENCES users (username) ENABLE;
/*
create table users (
username varchar_ignorecase(50) not null primary key,
password varchar_ignorecase(50) not null,
enabled boolean not null
);
create table authorities (
username varchar_ignorecase(50) not null,
authority varchar_ignorecase(50) not null,
constraint fk_authorities_users foreign key(username) references users(username)
);
create unique index ix_auth_username on authorities (username,authority);
*/
| true
|
9e8c91f8d657af349d6c8dc4e4ac8ea4e4aef50b
|
SQL
|
anishmo99/SQL
|
/higherThan75Marks.sql
|
UTF-8
| 86
| 2.75
| 3
|
[
"MIT"
] |
permissive
|
SELECT NAME
FROM STUDENTS
WHERE MARKS > 75
ORDER BY SUBSTRING(NAME, -3, 3) ASC, ID ASC
| true
|
98090f346570c8767282448bb45875452beb4451
|
SQL
|
mail4deepali/Mangalam
|
/SQLScripts/2020_02_03_15_29_PunamGhule Created table user_candidate_map.sql
|
UTF-8
| 403
| 3.4375
| 3
|
[] |
no_license
|
CREATE TABLE user_candidate_map (
id smallint primary key,
user_id smallint,
candidate_id smallint
) ;
ALTER TABLE public.user_candidate_map
ADD CONSTRAINT user_user_id_map_fkey FOREIGN KEY (user_id)
REFERENCES public.user_table (id);
ALTER TABLE public.user_candidate_map
ADD CONSTRAINT user_candidate_id_map_fkey FOREIGN KEY (candidate_id)
REFERENCES public.candidate (id);
| true
|
71f6d5f48831b1efb89fe4ab73e935f4d5a0cc81
|
SQL
|
silence-do-good/stress-test-Postgres-and-MySQL
|
/dump/high/day23/select2227.sql
|
UTF-8
| 177
| 2.6875
| 3
|
[] |
no_license
|
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-22T22:27:00Z' AND timestamp<'2017-11-23T22:27:00Z' AND temperature>=4 AND temperature<=50
| true
|
f3262dd455f0a2bf87eb37a454b251fdd6b68535
|
SQL
|
cem-ege-saygili/CoursePlanner
|
/inputs/sampleCreateViewQueries/view4.sql
|
UTF-8
| 890
| 3.921875
| 4
|
[] |
no_license
|
CREATE VIEW FreshmanCourses_NumClassesForClassTypes AS
SELECT
c.CourseSubject || ' ' || c.CourseCatalog as "Course Name",
cl.ClassComponent as "Class Type",
count(*) as "Number of Classes"
from Classes cl
natural join Class_Course_Infos cci
natural join Courses c
where
c.CourseCatalog < 200 and c.CourseSubject != 'ELC'
group by c.CourseSubject, c.CourseCatalog, cl.ClassComponent
order by "Course Name", "Number of Classes" desc, cci.CourseId, cl.ClassComponent;
--Create a view for the following query:
--Show course name, class type and number of respective classes
--from the entries whose course corresponds to a freshman course
--order the results according to their class counts from highest to lowest
--while keeping the same courses together as a bulk
--(i.e. all ACWR 101 courses appear one after another,
--ordered in a descending fashion by the number of classes)
| true
|
4e7d3893f688a1c6e20f7bcc8a60e617e0ce1de2
|
SQL
|
silence-do-good/stress-test-Postgres-and-MySQL
|
/dump/high/day28/select1307.sql
|
UTF-8
| 178
| 2.65625
| 3
|
[] |
no_license
|
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-27T13:07:00Z' AND timestamp<'2017-11-28T13:07:00Z' AND temperature>=44 AND temperature<=64
| true
|
92c0adcf0ef9f2d67ade65dd5cfa167802720b88
|
SQL
|
WilliamSlackBros/EstudosCmdsSql
|
/exemplo de criacao de tabela.sql
|
UTF-8
| 5,315
| 3.25
| 3
|
[] |
no_license
|
CREATE TABLE "DBAMV"."PW_REGISTRO_ALTA"
( "CD_REGISTRO_ALTA" NUMBER(8,0) NOT NULL ENABLE,
"DT_REGISTRO_ALTA" DATE,
"CD_ATENDIMENTO" NUMBER,
"CD_PRESTADOR" NUMBER(12,0),
"CD_DOCUMENTO_CLINICO" NUMBER(8,0),
"CD_USUARIO" VARCHAR2(30 BYTE),
"TP_SITUACAO" VARCHAR2(20 BYTE),
"DS_OBS_ALTA" VARCHAR2(2000 BYTE),
"CD_ATENDIMENTO_PAI" NUMBER(10,0),
"CD_MOT_ALT" NUMBER,
"DT_ALTA_MEDICA" DATE,
"HR_ALTA_MEDICA" DATE,
"DT_PREVISTA_ALTA" DATE,
"CD_SETOR_OBITO" NUMBER(4,0),
"NR_DECLARACAO_OBITO" VARCHAR2(11 BYTE),
"CD_CID_OBITO" VARCHAR2(6 BYTE),
"NM_USUARIO_ALTA_MEDICA" VARCHAR2(30 BYTE),
"CD_PRESTADOR_EM_ATENDIMENTO" VARCHAR2(30 BYTE),
"CD_PRO_INT" VARCHAR2(10 BYTE),
"CD_PRO_INT_PROCEDIMENTO_ENTRAD" VARCHAR2(10 BYTE),
"CD_PROCEDIMENTO_ALTA" VARCHAR2(10 BYTE),
"CD_SSM_CIH" VARCHAR2(10 BYTE),
"CD_CONVENIO" NUMBER(3,0),
"CD_CID" VARCHAR2(6 BYTE),
"DS_PROGRAMA_ALTA" VARCHAR2(200 BYTE),
"DT_PROGRAMA_ALTA" DATE,
"NM_USUARIO_PROG_ALTA" VARCHAR2(30 BYTE),
"SN_OBITO" VARCHAR2(1 BYTE),
"SN_BUSCA_ATIVA" VARCHAR2(1 BYTE) DEFAULT 'N' NOT NULL ENABLE,
"TP_BUSCA_ATIVA" VARCHAR2(1 BYTE) DEFAULT '0' NOT NULL ENABLE,
"DH_ALTA_MEDICA_LANCADA" DATE,
"CD_DOCUMENTO_CLINICO_DOC" NUMBER(8,0),
"CD_DOCUMENTO_CLINICO_MOT_ALT" NUMBER(8,0),
"CD_DOCUMENTO_CLINICO_ESTADIAM" NUMBER,
CONSTRAINT "CNT_PW_REGISTRO_ALTA_PK" PRIMARY KEY ("CD_REGISTRO_ALTA")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "MV2000_I" ENABLE,
CONSTRAINT "CNT_PW_REGISTRO_ALTA_1_CK" CHECK ( TP_SITUACAO IN ( 'FECHADA', 'CANCELADA' )) ENABLE,
CONSTRAINT "CNT_PW_REGISTRO_ALTA_ATEND_FK" FOREIGN KEY ("CD_ATENDIMENTO")
REFERENCES "DBAMV"."ATENDIME" ("CD_ATENDIMENTO") ENABLE,
CONSTRAINT "CNT_PW_REGISTRO_ALTA_PREST_FK" FOREIGN KEY ("CD_PRESTADOR")
REFERENCES "DBAMV"."PRESTADOR" ("CD_PRESTADOR") ENABLE,
CONSTRAINT "CNT_PW_REG_ALTA_DOC_CLI_FK" FOREIGN KEY ("CD_DOCUMENTO_CLINICO")
REFERENCES "DBAMV"."PW_DOCUMENTO_CLINICO" ("CD_DOCUMENTO_CLINICO") ENABLE,
CONSTRAINT "CNT_PW_REG_ALTA_DOC_CLI_EST_FK" FOREIGN KEY ("CD_DOCUMENTO_CLINICO_ESTADIAM")
REFERENCES "DBAMV"."PW_DOCUMENTO_CLINICO" ("CD_DOCUMENTO_CLINICO") ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "MV2000_D" ;
COMMENT ON COLUMN "DBAMV"."PW_REGISTRO_ALTA"."CD_REGISTRO_ALTA" IS 'Indica o código dos registros da tabela de registro de alta(pk).';
COMMENT ON COLUMN "DBAMV"."PW_REGISTRO_ALTA"."DT_REGISTRO_ALTA" IS 'Indica a data da alta.';
COMMENT ON COLUMN "DBAMV"."PW_REGISTRO_ALTA"."CD_ATENDIMENTO" IS 'Código do atendimento da alta.';
COMMENT ON COLUMN "DBAMV"."PW_REGISTRO_ALTA"."CD_PRESTADOR" IS 'Código do prestador da alta.';
COMMENT ON COLUMN "DBAMV"."PW_REGISTRO_ALTA"."CD_DOCUMENTO_CLINICO" IS 'Código do documento clínico (FK).';
COMMENT ON COLUMN "DBAMV"."PW_REGISTRO_ALTA"."CD_USUARIO" IS 'Código do usuário da alta.';
COMMENT ON COLUMN "DBAMV"."PW_REGISTRO_ALTA"."TP_SITUACAO" IS 'Tipo da situalão da alta, se ela esta Fechada ou Cancelada.';
COMMENT ON COLUMN "DBAMV"."PW_REGISTRO_ALTA"."CD_DOCUMENTO_CLINICO_ESTADIAM" IS 'Indica o código do documento clínico do estadiamento criado junto com o finalização da alta';
COMMENT ON TABLE "DBAMV"."PW_REGISTRO_ALTA" IS 'Armazena as informações da alta do paciente.';
CREATE INDEX "DBAMV"."CNT_PW_REG_ALTA_DOC_CLI_EST_IX" ON "DBAMV"."PW_REGISTRO_ALTA" ("CD_DOCUMENTO_CLINICO_ESTADIAM")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "MV2000_I" ;
CREATE INDEX "DBAMV"."IND_PW_REGISTRO_ALTA_ATEND_FK" ON "DBAMV"."PW_REGISTRO_ALTA" ("CD_ATENDIMENTO")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "MV2000_I" ;
CREATE INDEX "DBAMV"."IND_PW_REGISTRO_ALTA_PREST_FK" ON "DBAMV"."PW_REGISTRO_ALTA" ("CD_PRESTADOR")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "MV2000_I" ;
CREATE INDEX "DBAMV"."IND_PW_REG_ALTA_DOC_CLI_FK" ON "DBAMV"."PW_REGISTRO_ALTA" ("CD_DOCUMENTO_CLINICO")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "MV2000_I" ;
CREATE OR REPLACE TRIGGER "DBAMV"."TRG_SIC_CIH_ATENDIME"
AFTER INSERT OR UPDATE OF cd_ssm_cih ON dbamv.pw_registro_alta
FOR EACH ROW
BEGIN
UPDATE dbamv.atendime SET cd_ssm_cih = :new.cd_ssm_cih WHERE cd_atendimento = :new.cd_atendimento ;
END;
/
ALTER TRIGGER "DBAMV"."TRG_SIC_CIH_ATENDIME" ENABLE;
| true
|
2166c3a56066731f69b6cd4ec594933e2f4aff19
|
SQL
|
zihanbobo/guns-vip
|
/_docs/_guns_rest_mysql.sql
|
UTF-8
| 60,410
| 3.375
| 3
|
[] |
no_license
|
DROP DATABASE IF EXISTS guns;
CREATE DATABASE IF NOT EXISTS guns DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
USE guns;
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50727
Source Host : localhost:3306
Source Schema : guns
Target Server Type : MySQL
Target Server Version : 50727
File Encoding : 65001
Date: 09/10/2019 20:40:08
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for database_info
-- ----------------------------
DROP TABLE IF EXISTS `database_info`;
CREATE TABLE `database_info` (
`db_id` bigint(20) NOT NULL COMMENT '主键id',
`db_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据库名称(英文名称)',
`jdbc_driver` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'jdbc的驱动类型',
`user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据库连接的账号',
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据库连接密码',
`jdbc_url` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'jdbc的url',
`remarks` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注,摘要',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`db_id`) USING BTREE,
UNIQUE INDEX `NAME_UNIQUE`(`db_name`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据库信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of database_info
-- ----------------------------
INSERT INTO `database_info` VALUES (1181910831377588226, 'master', 'com.mysql.cj.jdbc.Driver', 'root', 'root', 'jdbc:mysql://127.0.0.1:3306/guns?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT', '主数据源,项目启动数据源!', '2019-10-09 20:34:35');
-- ----------------------------
-- Table structure for oa_myleave
-- ----------------------------
DROP TABLE IF EXISTS `oa_myleave`;
CREATE TABLE `oa_myleave` (
`MYLEAVE_ID` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`USERNAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户名',
`TYPE` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '类型',
`STARTTIME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '开始时间',
`ENDTIME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '结束时间',
`WHENLONG` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '时长',
`REASON` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '事由',
PRIMARY KEY (`MYLEAVE_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for oauth_user_info
-- ----------------------------
DROP TABLE IF EXISTS `oauth_user_info`;
CREATE TABLE `oauth_user_info` (
`oauth_id` bigint(20) NOT NULL COMMENT '主键id',
`user_id` bigint(20) NOT NULL COMMENT '用户主键id',
`nick_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '昵称',
`avatar` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '头像',
`blog` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户网址',
`company` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '所在公司',
`location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '位置',
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户备注(各平台中的用户个人介绍)',
`gender` int(11) DEFAULT NULL COMMENT '性别,1-男,0-女',
`source` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户来源',
`token` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户授权的token',
`uuid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '第三方平台的用户唯一di',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建用户',
`update_time` datetime(0) DEFAULT NULL COMMENT '更新时间',
`update_user` bigint(20) DEFAULT NULL COMMENT '更新用户',
PRIMARY KEY (`oauth_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '第三方用户信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sys_config
-- ----------------------------
DROP TABLE IF EXISTS `sys_config`;
CREATE TABLE `sys_config` (
`id` bigint(20) NOT NULL COMMENT '主键',
`name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称',
`code` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '属性编码标识',
`dict_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '是否是字典中的值',
`dict_type_id` bigint(20) DEFAULT NULL COMMENT '字典类型的编码',
`value` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '属性值,如果是字典中的类型,则为dict的code',
`remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_time` datetime(0) DEFAULT NULL COMMENT '更新时间',
`update_user` bigint(20) DEFAULT NULL COMMENT '更新人',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '参数配置' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_config
-- ----------------------------
INSERT INTO `sys_config` VALUES (1143324237579165697, '验证码开关', 'GUNS_KAPTCHA_OPEN', 'Y', 1106120265689055233, 'DISABLE', '是否开启验证码', '2019-06-24 12:46:43', 1, '2019-06-25 09:04:42', 1);
INSERT INTO `sys_config` VALUES (1143386834613694465, '阿里云短信的keyId', 'GUNS_SMS_ACCESSKEY_ID', 'N', NULL, 'xxxkey', '阿里云短信的密钥key', '2019-06-25 13:13:59', 1, '2019-06-25 13:19:21', 1);
INSERT INTO `sys_config` VALUES (1143386953933254657, '阿里云短信的secret', 'GUNS_SMS_ACCESSKEY_SECRET', 'N', NULL, 'xxxsecret', '阿里云短信的secret', '2019-06-25 13:14:28', 1, NULL, NULL);
INSERT INTO `sys_config` VALUES (1143387023449649154, '阿里云短信的签名', 'GUNS_SMS_SIGN_NAME', 'N', NULL, 'xxxsign', '阿里云短信的签名', '2019-06-25 13:14:44', 1, NULL, NULL);
INSERT INTO `sys_config` VALUES (1143387131109044225, '阿里云短信登录的模板号', 'GUNS_SMS_LOGIN_TEMPLATE_CODE', 'N', NULL, 'SMS_XXXXXX', '阿里云短信登录的模板号', '2019-06-25 13:15:10', 1, NULL, NULL);
INSERT INTO `sys_config` VALUES (1143387225019510785, '验证码短信失效时间', 'GUNS_SMS_INVALIDATE_MINUTES', 'N', NULL, '2', '验证码短信失效时间', '2019-06-25 13:15:32', 1, NULL, NULL);
INSERT INTO `sys_config` VALUES (1143468689664876546, '管理系统名称', 'GUNS_SYSTEM_NAME', 'N', NULL, 'Guns快速开发平台', '管理系统名称', '2019-06-25 18:39:15', 1, NULL, NULL);
INSERT INTO `sys_config` VALUES (1143468867767607297, '默认系统密码', 'GUNS_DEFAULT_PASSWORD', 'N', NULL, '111111', '默认系统密码', '2019-06-25 18:39:57', 1, NULL, NULL);
INSERT INTO `sys_config` VALUES (1143469008025133058, 'OAuth2登录用户的账号标识', 'GUNS_OAUTH2_PREFIX', 'N', NULL, 'oauth2', 'OAuth2登录用户的账号标识', '2019-06-25 18:40:31', 1, NULL, NULL);
INSERT INTO `sys_config` VALUES (1145207130463191041, '顶部导航条是否开启', 'GUNS_DEFAULT_ADVERT', 'Y', 1106120265689055233, 'ENABLE', '顶部Guns广告是否开启', '2019-06-30 13:47:11', 1, '2019-06-30 13:47:20', 1);
INSERT INTO `sys_config` VALUES (1145915627211370498, 'Guns发布的编号', 'GUNS_SYSTEM_RELEASE_VERSION', 'N', NULL, '20191009', '用于防止浏览器缓存相关的js和css', '2019-07-02 12:42:30', 1, NULL, NULL);
INSERT INTO `sys_config` VALUES (1145915627211370499, '文件上传路径', 'GUNS_FILE_UPLOAD_PATH', 'N', NULL, '/Users/stylefeng/tmp/gunsTempFiles/', '文件上传默认目录', '2019-08-30 09:10:40', 1, NULL, NULL);
INSERT INTO `sys_config` VALUES (1145915627211370500, 'BPMN文件上传路径', 'GUNS_BPMN_FILE_UPLOAD_PATH', 'N', NULL, '/Users/stylefeng/tmp/gunsTempFiles/', '工作流文件上传默认目录', '2019-08-30 09:10:40', 1, NULL, NULL);
-- ----------------------------
-- Table structure for sys_dept
-- ----------------------------
DROP TABLE IF EXISTS `sys_dept`;
CREATE TABLE `sys_dept` (
`dept_id` bigint(20) NOT NULL COMMENT '主键id',
`pid` bigint(20) DEFAULT 0 COMMENT '父部门id',
`pids` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '父级ids',
`simple_name` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '简称',
`full_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '全称',
`description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '描述',
`version` int(11) DEFAULT NULL COMMENT '版本(乐观锁保留字段)',
`sort` int(11) DEFAULT NULL COMMENT '排序',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) DEFAULT NULL COMMENT '修改时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
PRIMARY KEY (`dept_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_dept
-- ----------------------------
INSERT INTO `sys_dept` VALUES (24, 0, '[0],', '总公司', '总公司', '', NULL, 1, NULL, NULL, NULL, NULL);
INSERT INTO `sys_dept` VALUES (25, 24, '[0],[24],', '开发部', '开发部', '', NULL, 2, NULL, NULL, NULL, NULL);
INSERT INTO `sys_dept` VALUES (26, 24, '[0],[24],', '运营部', '运营部', '', NULL, 3, NULL, NULL, NULL, NULL);
INSERT INTO `sys_dept` VALUES (27, 24, '[0],[24],', '战略部', '战略部', '', NULL, 4, NULL, NULL, NULL, NULL);
-- ----------------------------
-- Table structure for sys_dict
-- ----------------------------
DROP TABLE IF EXISTS `sys_dict`;
CREATE TABLE `sys_dict` (
`dict_id` bigint(20) NOT NULL COMMENT '字典id',
`dict_type_id` bigint(20) NOT NULL COMMENT '所属字典类型的id',
`code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典编码',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典名称',
`parent_id` bigint(20) NOT NULL COMMENT '上级代码id',
`parent_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '所有上级id',
`status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'ENABLE' COMMENT '状态(字典)',
`sort` int(11) DEFAULT NULL COMMENT '排序',
`description` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '字典的描述',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) DEFAULT NULL COMMENT '更新时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
PRIMARY KEY (`dict_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '基础字典' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_dict
-- ----------------------------
INSERT INTO `sys_dict` VALUES (1106120532442595330, 1106120208097067009, 'M', '男', 0, '[0]', 'ENABLE', NULL, '', '2019-03-14 17:11:00', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1106120574163337218, 1106120208097067009, 'F', '女', 0, '[0]', 'ENABLE', NULL, '', '2019-03-14 17:11:10', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1106120645697191938, 1106120265689055233, 'ENABLE', '启用', 0, '[0]', 'ENABLE', NULL, '', '2019-03-14 17:11:27', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1106120699468169217, 1106120265689055233, 'DISABLE', '禁用', 0, '[0]', 'ENABLE', NULL, '', '2019-03-14 17:11:40', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1106120784318939137, 1106120322450571266, 'ENABLE', '启用', 0, '[0]', 'ENABLE', NULL, '', '2019-03-14 17:12:00', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1106120825993543682, 1106120322450571266, 'FREEZE', '冻结', 0, '[0]', 'ENABLE', 1, '', '2019-03-14 17:12:10', '2019-03-16 10:56:36', 1, 1);
INSERT INTO `sys_dict` VALUES (1106120875872206849, 1106120322450571266, 'DELETED', '已删除', 0, '[0]', 'ENABLE', -1221, '', '2019-03-14 17:12:22', '2019-03-16 10:56:53', 1, 1);
INSERT INTO `sys_dict` VALUES (1106120935070613505, 1106120388036902914, 'Y', '删除', 0, '[0]', 'ENABLE', 23333, '', '2019-03-14 17:12:36', '2019-03-16 10:58:53', 1, 1);
INSERT INTO `sys_dict` VALUES (1106120968910258177, 1106120388036902914, 'N', '未删除', 0, '[0]', 'ENABLE', 1212211221, '', '2019-03-14 17:12:44', '2019-03-16 10:59:03', 1, 1);
INSERT INTO `sys_dict` VALUES (1149218674746355713, 1149217131989069826, 'BASE_SYSTEM', '系统管理', 0, '[0]', 'ENABLE', 1, '系统管理平台', '2019-07-11 15:27:38', '2019-07-11 20:27:14', 1, 1);
INSERT INTO `sys_dict` VALUES (1160533174626959361, 1160532704105742337, '00101', '办公审批', 0, '[0]', 'ENABLE', 10, '', '2019-08-11 20:47:25', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160533264645111810, 1160532704105742337, '00102', '行政审批', 0, '[0]', 'ENABLE', 20, '', '2019-08-11 20:47:47', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160533377727741954, 1160532775455047681, 'KEY_LEAVE', '请假流程标识', 0, '[0]', 'ENABLE', 10, '', '2019-08-11 20:48:14', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160533455343337474, 1160532775455047681, 'KEY_FINANCE', '财务流程标识', 0, '[0]', 'ENABLE', 20, '', '2019-08-11 20:48:32', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160533574843252737, 1160532886713155585, '00401', '事假', 0, '[0]', 'ENABLE', 10, '', '2019-08-11 20:49:01', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160533625615302658, 1160532886713155585, '00402', '婚假', 0, '[0]', 'ENABLE', 20, '', '2019-08-11 20:49:13', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160533707215486977, 1160532886713155585, '00403', '产假', 0, '[0]', 'ENABLE', 30, '', '2019-08-11 20:49:32', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160533765403066370, 1160532886713155585, '00404', '病假', 0, '[0]', 'ENABLE', 40, '', '2019-08-11 20:49:46', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160533863834992641, 1160532886713155585, '00405', '公假', 0, '[0]', 'ENABLE', 50, '', '2019-08-11 20:50:09', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160533945309347841, 1160532886713155585, '00406', '年假', 0, '[0]', 'ENABLE', 60, '', '2019-08-11 20:50:29', NULL, 1, NULL);
INSERT INTO `sys_dict` VALUES (1160534007389241346, 1160532886713155585, '00407', '其他', 0, '[0]', 'ENABLE', 70, '', '2019-08-11 20:50:44', NULL, 1, NULL);
-- ----------------------------
-- Table structure for sys_dict_type
-- ----------------------------
DROP TABLE IF EXISTS `sys_dict_type`;
CREATE TABLE `sys_dict_type` (
`dict_type_id` bigint(20) NOT NULL COMMENT '字典类型id',
`code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典类型编码',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典类型名称',
`description` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '字典描述',
`system_flag` char(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '是否是系统字典,Y-是,N-否',
`status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'ENABLE' COMMENT '状态(字典)',
`sort` int(11) DEFAULT NULL COMMENT '排序',
`create_time` datetime(0) DEFAULT NULL COMMENT '添加时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_time` datetime(0) DEFAULT NULL COMMENT '修改时间',
`update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
PRIMARY KEY (`dict_type_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '字典类型表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_dict_type
-- ----------------------------
INSERT INTO `sys_dict_type` VALUES (1106120208097067009, 'SEX', '性别', '', 'Y', 'ENABLE', 4, '2019-03-14 17:09:43', 1, NULL, NULL);
INSERT INTO `sys_dict_type` VALUES (1106120265689055233, 'STATUS', '状态', '', 'Y', 'ENABLE', 3, '2019-03-14 17:09:57', 1, NULL, NULL);
INSERT INTO `sys_dict_type` VALUES (1106120322450571266, 'ACCOUNT_STATUS', '账号状态', '', 'Y', 'ENABLE', 40, '2019-03-14 17:10:10', 1, '2019-08-11 20:46:38', 1);
INSERT INTO `sys_dict_type` VALUES (1106120388036902914, 'DEL_FLAG', '是否删除', '', 'Y', 'ENABLE', 2, '2019-03-14 17:10:26', 1, '2019-03-27 16:26:31', 1);
INSERT INTO `sys_dict_type` VALUES (1149217131989069826, 'SYSTEM_TYPE', '系统分类', '系统所有分类的维护', 'Y', 'ENABLE', 50, '2019-07-11 15:21:30', 1, '2019-08-11 20:46:47', 1);
INSERT INTO `sys_dict_type` VALUES (1160532704105742337, 'FLOW_CATEGARY', '工作流分类', '工作流分类', 'Y', 'ENABLE', 60, '2019-08-11 20:45:33', 1, NULL, NULL);
INSERT INTO `sys_dict_type` VALUES (1160532775455047681, 'FLOW_KEY', '工作流标识', '工作流标识', 'Y', 'ENABLE', 70, '2019-08-11 20:45:50', 1, NULL, NULL);
INSERT INTO `sys_dict_type` VALUES (1160532886713155585, 'LEAVE_TYPE', '请假类型', '请假类型', 'Y', 'ENABLE', 80, '2019-08-11 20:46:17', 1, '2019-08-11 20:46:23', 1);
-- ----------------------------
-- Table structure for sys_file_info
-- ----------------------------
DROP TABLE IF EXISTS `sys_file_info`;
CREATE TABLE `sys_file_info` (
`file_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键id',
`file_bucket` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '文件仓库(oss仓库)',
`file_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件名称',
`file_suffix` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '文件后缀',
`file_size_kb` bigint(20) DEFAULT NULL COMMENT '文件大小kb',
`final_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件唯一标识id',
`file_path` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '存储路径',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) DEFAULT NULL COMMENT '修改时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建用户',
`update_user` bigint(20) DEFAULT NULL COMMENT '修改用户',
PRIMARY KEY (`file_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '文件信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_file_info
-- ----------------------------
INSERT INTO `sys_file_info` VALUES ('1167385745179131905', NULL, '请假流程.bpmn20.xml', 'xml', 6, '1167385745179131905.xml', '/Users/stylefeng/tmp/gunsTempFiles/1167385745179131905.xml', '2019-08-30 18:37:05', NULL, 1, NULL);
-- ----------------------------
-- Table structure for sys_login_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_login_log`;
CREATE TABLE `sys_login_log` (
`login_log_id` bigint(20) NOT NULL COMMENT '主键',
`log_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '日志名称',
`user_id` bigint(20) DEFAULT NULL COMMENT '管理员id',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`succeed` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '是否执行成功',
`message` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT '具体消息',
`ip_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '登录ip',
PRIMARY KEY (`login_log_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '登录记录' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_login_log
-- ----------------------------
INSERT INTO `sys_login_log` VALUES (1181910611650551809, '登录日志', 1, '2019-10-09 20:33:43', '成功', NULL, '127.0.0.1');
INSERT INTO `sys_login_log` VALUES (1181910871433191426, '登录日志', 1, '2019-10-09 20:34:45', '成功', NULL, '127.0.0.1');
INSERT INTO `sys_login_log` VALUES (1181911161716776961, '登录日志', 1, '2019-10-09 20:35:54', '成功', NULL, '127.0.0.1');
INSERT INTO `sys_login_log` VALUES (1181911228527845377, '登录日志', 1, '2019-10-09 20:36:10', '成功', NULL, '0:0:0:0:0:0:0:1');
INSERT INTO `sys_login_log` VALUES (1181911546368008194, '退出日志', 1, '2019-10-09 20:37:26', '成功', NULL, '0:0:0:0:0:0:0:1');
INSERT INTO `sys_login_log` VALUES (1181911580539002882, '登录日志', 1, '2019-10-09 20:37:34', '成功', NULL, '127.0.0.1');
INSERT INTO `sys_login_log` VALUES (1181911623811637249, '登录日志', 1, '2019-10-09 20:37:45', '成功', NULL, '0:0:0:0:0:0:0:1');
-- ----------------------------
-- Table structure for sys_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` (
`menu_id` bigint(20) NOT NULL COMMENT '主键id',
`code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '菜单编号',
`pcode` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '菜单父编号',
`pcodes` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '当前菜单的所有父菜单编号',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '菜单名称',
`icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '菜单图标',
`url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'url地址',
`sort` int(65) DEFAULT NULL COMMENT '菜单排序号',
`levels` int(65) DEFAULT NULL COMMENT '菜单层级',
`menu_flag` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '是否是菜单(字典)',
`description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
`status` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT 'ENABLE' COMMENT '菜单状态(字典)',
`new_page_flag` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '是否打开新页面的标识(字典)',
`open_flag` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '是否打开(字典)',
`system_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '系统分类(字典)',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) DEFAULT NULL COMMENT '修改时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
PRIMARY KEY (`menu_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '菜单表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_menu
-- ----------------------------
INSERT INTO `sys_menu` VALUES (105, 'system', '0', '[0],', '系统管理', 'layui-icon layui-icon-set', '/admin', 20, 1, 'Y', NULL, 'ENABLE', NULL, '1', 'BASE_SYSTEM', NULL, '2019-03-29 16:32:27', NULL, 1);
INSERT INTO `sys_menu` VALUES (106, 'mgr', 'system', '[0],[system],', '用户管理', '', 'mgr', 10, 2, 'Y', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (107, 'mgr_add', 'mgr', '[0],[system],[mgr],', '添加用户', NULL, '/mgr/add', 1, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (108, 'mgr_edit', 'mgr', '[0],[system],[mgr],', '修改用户', NULL, '/mgr/edit', 2, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (109, 'mgr_delete', 'mgr', '[0],[system],[mgr],', '删除用户', NULL, '/mgr/delete', 3, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (110, 'mgr_reset', 'mgr', '[0],[system],[mgr],', '重置密码', NULL, '/mgr/reset', 4, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (111, 'mgr_freeze', 'mgr', '[0],[system],[mgr],', '冻结用户', NULL, '/mgr/freeze', 5, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (112, 'mgr_unfreeze', 'mgr', '[0],[system],[mgr],', '解除冻结用户', NULL, '/mgr/unfreeze', 6, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (113, 'mgr_setRole', 'mgr', '[0],[system],[mgr],', '分配角色', NULL, '/mgr/setRole', 7, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (114, 'role', 'system', '[0],[system],', '角色管理', '', 'role', 20, 2, 'Y', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:12', NULL, 1);
INSERT INTO `sys_menu` VALUES (115, 'role_add', 'role', '[0],[system],[role],', '添加角色', NULL, '/role/add', 1, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:12', NULL, 1);
INSERT INTO `sys_menu` VALUES (116, 'role_edit', 'role', '[0],[system],[role],', '修改角色', NULL, '/role/edit', 2, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:12', NULL, 1);
INSERT INTO `sys_menu` VALUES (117, 'role_remove', 'role', '[0],[system],[role],', '删除角色', NULL, '/role/remove', 3, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:12', NULL, 1);
INSERT INTO `sys_menu` VALUES (118, 'role_setAuthority', 'role', '[0],[system],[role],', '配置权限', NULL, '/role/setAuthority', 4, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:12', NULL, 1);
INSERT INTO `sys_menu` VALUES (119, 'menu', 'system', '[0],[system],', '菜单管理', '', 'menu', 50, 2, 'Y', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:25', NULL, 1);
INSERT INTO `sys_menu` VALUES (120, 'menu_add', 'menu', '[0],[system],[menu],', '添加菜单', NULL, '/menu/add', 1, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:25', NULL, 1);
INSERT INTO `sys_menu` VALUES (121, 'menu_edit', 'menu', '[0],[system],[menu],', '修改菜单', NULL, '/menu/edit', 2, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:25', NULL, 1);
INSERT INTO `sys_menu` VALUES (122, 'menu_remove', 'menu', '[0],[system],[menu],', '删除菜单', NULL, '/menu/remove', 3, 3, 'N', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:25', NULL, 1);
INSERT INTO `sys_menu` VALUES (128, 'log', 'system', '[0],[system],', '业务日志', '', 'log', 70, 2, 'Y', NULL, 'ENABLE', NULL, '0', 'BASE_SYSTEM', NULL, '2019-06-30 13:48:39', NULL, 1);
INSERT INTO `sys_menu` VALUES (130, 'druid', 'system', '[0],[system],', '监控管理', '', '/druid', 80, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:50:06', NULL, 1);
INSERT INTO `sys_menu` VALUES (131, 'dept', 'system', '[0],[system],', '部门管理', '', 'dept', 30, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:53', NULL, 1);
INSERT INTO `sys_menu` VALUES (132, 'dict', 'system', '[0],[system],', '字典管理', '', 'dictType', 40, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:04', NULL, 1);
INSERT INTO `sys_menu` VALUES (133, 'loginLog', 'system', '[0],[system],', '登录日志', '', 'loginLog', 60, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:29', NULL, 1);
INSERT INTO `sys_menu` VALUES (134, 'log_clean', 'log', '[0],[system],[log],', '清空日志', NULL, '/log/delLog', 3, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:39', NULL, 1);
INSERT INTO `sys_menu` VALUES (135, 'dept_add', 'dept', '[0],[system],[dept],', '添加部门', NULL, '/dept/add', 1, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:53', NULL, 1);
INSERT INTO `sys_menu` VALUES (136, 'dept_update', 'dept', '[0],[system],[dept],', '修改部门', NULL, '/dept/update', 1, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:53', NULL, 1);
INSERT INTO `sys_menu` VALUES (137, 'dept_delete', 'dept', '[0],[system],[dept],', '删除部门', NULL, '/dept/delete', 1, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:53', NULL, 1);
INSERT INTO `sys_menu` VALUES (138, 'dict_add', 'dict', '[0],[system],[dict],', '添加字典', NULL, '/dictType/addItem', 1, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:04', NULL, 1);
INSERT INTO `sys_menu` VALUES (139, 'dict_update', 'dict', '[0],[system],[dict],', '修改字典', NULL, '/dictType/editItem', 1, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:04', NULL, 1);
INSERT INTO `sys_menu` VALUES (140, 'dict_delete', 'dict', '[0],[system],[dict],', '删除字典', NULL, '/dictType/delete', 1, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:04', NULL, 1);
INSERT INTO `sys_menu` VALUES (141, 'notice', 'system', '[0],[system],', '通知管理', '', 'notice', 90, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:44', NULL, 1);
INSERT INTO `sys_menu` VALUES (142, 'notice_add', 'notice', '[0],[system],[notice],', '添加通知', NULL, '/notice/add', 1, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:44', NULL, 1);
INSERT INTO `sys_menu` VALUES (143, 'notice_update', 'notice', '[0],[system],[notice],', '修改通知', NULL, '/notice/update', 2, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:44', NULL, 1);
INSERT INTO `sys_menu` VALUES (144, 'notice_delete', 'notice', '[0],[system],[notice],', '删除通知', NULL, '/notice/delete', 3, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:44', NULL, 1);
INSERT INTO `sys_menu` VALUES (145, 'sys_message', 'dashboard', '[0],[dashboard],', '消息通知', 'layui-icon layui-icon-tips', '/system/notice', 30, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-04-08 22:49:39', NULL, 1);
INSERT INTO `sys_menu` VALUES (149, 'api_mgr', 'dev_tools', '[0],[dev_tools],', '接口文档', 'fa-leaf', '/swagger-ui.html', 30, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-15 18:13:00', NULL, 1);
INSERT INTO `sys_menu` VALUES (150, 'to_menu_edit', 'menu', '[0],[system],[menu],', '菜单编辑跳转', '', '/menu/menu_edit', 4, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:25', NULL, 1);
INSERT INTO `sys_menu` VALUES (151, 'menu_list', 'menu', '[0],[system],[menu],', '菜单列表', '', '/menu/list', 5, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:25', NULL, 1);
INSERT INTO `sys_menu` VALUES (152, 'to_dept_update', 'dept', '[0],[system],[dept],', '修改部门跳转', '', '/dept/dept_update', 4, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:53', NULL, 1);
INSERT INTO `sys_menu` VALUES (153, 'dept_list', 'dept', '[0],[system],[dept],', '部门列表', '', '/dept/list', 5, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:53', NULL, 1);
INSERT INTO `sys_menu` VALUES (154, 'dept_detail', 'dept', '[0],[system],[dept],', '部门详情', '', '/dept/detail', 6, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:53', NULL, 1);
INSERT INTO `sys_menu` VALUES (155, 'to_dict_edit', 'dict', '[0],[system],[dict],', '修改菜单跳转', '', '/dict/dict_edit', 4, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:04', NULL, 1);
INSERT INTO `sys_menu` VALUES (156, 'dict_list', 'dict', '[0],[system],[dict],', '字典列表', '', '/dict/list', 5, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:04', NULL, 1);
INSERT INTO `sys_menu` VALUES (157, 'dict_detail', 'dict', '[0],[system],[dict],', '字典详情', '', '/dict/detail', 6, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:04', NULL, 1);
INSERT INTO `sys_menu` VALUES (158, 'log_list', 'log', '[0],[system],[log],', '日志列表', '', '/log/list', 2, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:39', NULL, 1);
INSERT INTO `sys_menu` VALUES (159, 'log_detail', 'log', '[0],[system],[log],', '日志详情', '', '/log/detail', 3, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:39', NULL, 1);
INSERT INTO `sys_menu` VALUES (160, 'del_login_log', 'loginLog', '[0],[system],[loginLog],', '清空登录日志', '', '/loginLog/delLoginLog', 1, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:29', NULL, 1);
INSERT INTO `sys_menu` VALUES (161, 'login_log_list', 'loginLog', '[0],[system],[loginLog],', '登录日志列表', '', '/loginLog/list', 2, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:49:29', NULL, 1);
INSERT INTO `sys_menu` VALUES (162, 'to_role_edit', 'role', '[0],[system],[role],', '修改角色跳转', '', '/role/role_edit', 5, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:12', NULL, 1);
INSERT INTO `sys_menu` VALUES (163, 'to_role_assign', 'role', '[0],[system],[role],', '角色分配跳转', '', '/role/role_assign', 6, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:12', NULL, 1);
INSERT INTO `sys_menu` VALUES (164, 'role_list', 'role', '[0],[system],[role],', '角色列表', '', '/role/list', 7, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:12', NULL, 1);
INSERT INTO `sys_menu` VALUES (165, 'to_assign_role', 'mgr', '[0],[system],[mgr],', '分配角色跳转', '', '/mgr/role_assign', 8, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (166, 'to_user_edit', 'mgr', '[0],[system],[mgr],', '编辑用户跳转', '', '/mgr/user_edit', 9, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (167, 'mgr_list', 'mgr', '[0],[system],[mgr],', '用户列表', '', '/mgr/list', 10, 3, 'N', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-06-30 13:48:07', NULL, 1);
INSERT INTO `sys_menu` VALUES (171, 'dev_tools', '0', '[0],', '开发管理', 'layui-icon layui-icon-code-circle', '#', 30, 1, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-05-11 13:40:27', NULL, 1);
INSERT INTO `sys_menu` VALUES (172, 'dashboard', '0', '[0],', '主控面板', 'layui-icon layui-icon-home', '#', 10, 1, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', NULL, '2019-04-08 22:48:15', NULL, 1);
INSERT INTO `sys_menu` VALUES (1110777136265838594, 'demos_show', 'dev_tools', '[0],[dev_tools],', '模板页面', 'layui-icon layui-icon-template', '#', 40, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-03-27 13:34:41', '2019-06-15 18:13:11', 1, 1);
INSERT INTO `sys_menu` VALUES (1110777366856089602, 'excel_import', 'demos_show', '[0],[dev_tools],[demos_show],', 'excel导入', '', '/excel/import', 10, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-03-27 13:35:36', '2019-06-15 18:13:11', 1, 1);
INSERT INTO `sys_menu` VALUES (1110777491464667137, 'excel_export', 'demos_show', '[0],[dev_tools],[demos_show],', 'excel导出', '', '/excel/export', 20, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-03-27 13:36:06', '2019-06-15 18:13:11', 1, 1);
INSERT INTO `sys_menu` VALUES (1110787391943098370, 'advanced_form', 'demos_show', '[0],[dev_tools],[demos_show],', '高级表单', '', '/egForm', 30, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-03-27 14:15:26', '2019-06-15 18:13:11', 1, 1);
INSERT INTO `sys_menu` VALUES (1110839216310329346, 'pdf_view', 'demos_show', '[0],[dev_tools],[demos_show],', '文档预览', '', '/loadPdfFile', 40, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-03-27 17:41:22', '2019-06-15 18:13:11', 1, 1);
INSERT INTO `sys_menu` VALUES (1111545968697860098, 'console', 'dashboard', '[0],[dashboard],', '项目介绍', '', '/system/console', 10, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-03-29 16:29:45', '2019-04-09 20:57:08', 1, 1);
INSERT INTO `sys_menu` VALUES (1111546189892870145, 'console2', 'dashboard', '[0],[dashboard],', '统计报表', '', '/system/console2', 20, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-03-29 16:30:38', '2019-04-08 22:49:48', 1, 1);
INSERT INTO `sys_menu` VALUES (1127085735660421122, 'code_generate', 'dev_tools', '[0],[dev_tools],', '代码生成', '', '/gen', 20, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-05-11 13:39:14', '2019-06-15 18:12:45', 1, 1);
INSERT INTO `sys_menu` VALUES (1139826657964593154, 'meta_data', 'dev_tools', '[0],[dev_tools],', '系统配置', '', '#', 10, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-06-15 17:27:07', '2019-06-15 18:12:35', 1, 1);
INSERT INTO `sys_menu` VALUES (1139827152854716418, 'data_source', 'meta_data', '[0],[dev_tools],[meta_data],', '数据源管理', '', '/databaseInfo', 10, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-06-15 17:29:05', '2019-06-15 18:12:35', 1, 1);
INSERT INTO `sys_menu` VALUES (1142957882422112257, 'SYS_CONFIG', 'meta_data', '[0],[dev_tools],[meta_data],', '参数配置', 'fa-star', '/sysConfig', 5, 3, 'Y', '', 'ENABLE', '', '', 'BASE_SYSTEM', '2019-06-24 08:49:28', '2019-06-24 08:57:34', 1, 1);
INSERT INTO `sys_menu` VALUES (1142957882422112258, 'SYS_CONFIG_ADD', 'SYS_CONFIG', '[0],[dev_tools],[meta_data],[SYS_CONFIG],', '参数配置添加', 'fa-star', '', 999, 4, 'N', '', 'ENABLE', '', '', 'BASE_SYSTEM', '2019-06-24 08:49:28', '2019-06-24 08:57:34', 1, 1);
INSERT INTO `sys_menu` VALUES (1142957882422112259, 'SYS_CONFIG_EDIT', 'SYS_CONFIG', '[0],[dev_tools],[meta_data],[SYS_CONFIG],', '参数配置修改', 'fa-star', '', 999, 4, 'N', '', 'ENABLE', '', '', 'BASE_SYSTEM', '2019-06-24 08:49:28', '2019-06-24 08:57:34', 1, 1);
INSERT INTO `sys_menu` VALUES (1142957882426306562, 'SYS_CONFIG_DELETE', 'SYS_CONFIG', '[0],[dev_tools],[meta_data],[SYS_CONFIG],', '参数配置删除', 'fa-star', '', 999, 4, 'N', '', 'ENABLE', '', '', 'BASE_SYSTEM', '2019-06-24 08:49:28', '2019-06-24 08:57:34', 1, 1);
INSERT INTO `sys_menu` VALUES (1144441072852684801, 'SYS_POSITION', 'system', '[0],[system],', '职位管理', 'fa-star', '/position', 35, 2, 'Y', '', 'ENABLE', '', '', 'BASE_SYSTEM', '2019-06-28 11:03:09', '2019-06-28 11:06:42', 1, 1);
INSERT INTO `sys_menu` VALUES (1144441072852684802, 'SYS_POSITION_ADD', 'SYS_POSITION', '[0],[system],[SYS_POSITION],', '职位表添加', 'fa-star', '', 999, 3, 'N', '', 'ENABLE', '', '', 'BASE_SYSTEM', '2019-06-28 11:03:09', '2019-06-28 11:06:42', 1, 1);
INSERT INTO `sys_menu` VALUES (1144441072852684803, 'SYS_POSITION_EDIT', 'SYS_POSITION', '[0],[system],[SYS_POSITION],', '职位表修改', 'fa-star', '', 999, 3, 'N', '', 'ENABLE', '', '', 'BASE_SYSTEM', '2019-06-28 11:03:09', '2019-06-28 11:06:42', 1, 1);
INSERT INTO `sys_menu` VALUES (1144441072852684804, 'SYS_POSITION_DELETE', 'SYS_POSITION', '[0],[system],[SYS_POSITION],', '职位表删除', 'fa-star', '', 999, 3, 'N', '', 'ENABLE', '', '', 'BASE_SYSTEM', '2019-06-28 11:03:09', '2019-06-28 11:06:42', 1, 1);
INSERT INTO `sys_menu` VALUES (1149955324929765378, 'system_info', 'dashboard', '[0],[dashboard],', '系统监控', 'layui-icon-star-fill', '/system/systemInfo', 40, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-07-13 16:14:49', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158737199356919809, 'online_office', '0', '[0],', '在线办公', 'layui-icon-cellphone', '#', 40, 1, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:50:51', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158737313060306945, 'office_model', 'online_office', '[0],[online_office],', '工作流程', 'layui-icon-star-fill', '#', 10, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:51:18', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158737441812856834, 'model_manager', 'office_model', '[0],[online_office],[office_model],', '模型管理', 'layui-icon-star-fill', '/model', 10, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:51:49', '2019-08-06 22:05:44', 1, 1);
INSERT INTO `sys_menu` VALUES (1158737665570586625, 'procdef', 'office_model', '[0],[online_office],[office_model],', '流程管理', 'layui-icon-star-fill', '/process', 20, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:52:42', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158737892184637441, 'process_on', 'office_model', '[0],[online_office],[office_model],', '运行中流程', 'layui-icon-star-fill', '/taskRunning', 30, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:53:36', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158738158376140801, 'hiprocdef', 'office_model', '[0],[online_office],[office_model],', '历史流程', 'layui-icon-star-fill', '/historyProc', 40, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:54:40', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158738253440040962, 'task_manager', 'online_office', '[0],[online_office],', '任务管理', 'layui-icon-star-fill', '#', 20, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:55:03', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158738549708898305, 'approve', 'online_office', '[0],[online_office],', '申请审批', 'layui-icon-star-fill', '#', 30, 2, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:56:13', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158738875899920385, 'rutask', 'task_manager', '[0],[online_office],[task_manager],', '待办任务', 'layui-icon-star-fill', '/taskWaiting', 10, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:57:31', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158739014999818241, 'havetask', 'task_manager', '[0],[online_office],[task_manager],', '已办任务', 'layui-icon-star-fill', '/taskHistory', 20, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:58:04', NULL, 1, NULL);
INSERT INTO `sys_menu` VALUES (1158739122743099393, 'leave', 'approve', '[0],[online_office],[approve],', '请假审批', 'layui-icon-star-fill', '/myleave', 10, 3, 'Y', NULL, 'ENABLE', NULL, NULL, 'BASE_SYSTEM', '2019-08-06 21:58:30', NULL, 1, NULL);
-- ----------------------------
-- Table structure for sys_notice
-- ----------------------------
DROP TABLE IF EXISTS `sys_notice`;
CREATE TABLE `sys_notice` (
`notice_id` bigint(20) NOT NULL COMMENT '主键',
`title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '标题',
`content` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT '内容',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_time` datetime(0) DEFAULT NULL COMMENT '修改时间',
`update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
PRIMARY KEY (`notice_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '通知表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_notice
-- ----------------------------
INSERT INTO `sys_notice` VALUES (6, '欢迎', 'hi,Guns旗舰版发布了!', '2017-01-11 08:53:20', 1, '2018-12-28 23:24:48', 1);
INSERT INTO `sys_notice` VALUES (8, '你好', '你好,世界!', '2017-05-10 19:28:57', 1, '2018-12-28 23:28:26', 1);
-- ----------------------------
-- Table structure for sys_operation_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_operation_log`;
CREATE TABLE `sys_operation_log` (
`operation_log_id` bigint(20) NOT NULL COMMENT '主键',
`log_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '日志类型(字典)',
`log_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '日志名称',
`user_id` bigint(65) DEFAULT NULL COMMENT '用户id',
`class_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '类名称',
`method` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT '方法名称',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`succeed` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '是否成功(字典)',
`message` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT '备注',
PRIMARY KEY (`operation_log_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作日志' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_operation_log
-- ----------------------------
INSERT INTO `sys_operation_log` VALUES (1181911142028713986, '业务日志', '配置权限', 1, 'cn.stylefeng.guns.sys.modular.rest.controller.RestRoleController', 'setAuthority', '2019-10-09 20:35:50', '成功', '角色名称=超级管理员,资源名称=用户管理,添加用户,修改用户,删除用户,重置密码,冻结用户,解除冻结用户,分配角色,分配角色跳转,编辑用户跳转,用户列表,角色管理,添加角色,修改角色,删除角色,配置权限,修改角色跳转,角色分配跳转,角色列表,菜单管理,添加菜单,修改菜单,删除菜单,菜单编辑跳转,菜单列表,业务日志,清空日志,日志列表,日志详情,部门管理,添加部门,修改部门,删除部门,修改部门跳转,部门列表,部门详情,字典管理,添加字典,修改字典,删除字典,修改菜单跳转,字典列表,字典详情,登录日志,清空登录日志,登录日志列表,通知管理,添加通知,修改通知,删除通知,职位管理,职位表添加,职位表修改,职位表删除,在线办公,工作流程,模型管理,流程管理,运行中流程,历史流程,任务管理,待办任务,已办任务,申请审批,请假审批');
INSERT INTO `sys_operation_log` VALUES (1181911459046793218, '业务日志', '配置权限', 1, 'cn.stylefeng.guns.sys.modular.system.controller.RoleController', 'setAuthority', '2019-10-09 20:37:05', '成功', '角色名称=超级管理员,资源名称=系统管理,用户管理,添加用户,修改用户,删除用户,重置密码,冻结用户,解除冻结用户,分配角色,分配角色跳转,编辑用户跳转,用户列表,角色管理,添加角色,修改角色,删除角色,配置权限,修改角色跳转,角色分配跳转,角色列表,菜单管理,添加菜单,修改菜单,删除菜单,菜单编辑跳转,菜单列表,业务日志,清空日志,日志列表,日志详情,部门管理,添加部门,修改部门,删除部门,修改部门跳转,部门列表,部门详情,字典管理,添加字典,修改字典,删除字典,修改菜单跳转,字典列表,字典详情,登录日志,清空登录日志,登录日志列表,通知管理,添加通知,修改通知,删除通知,职位管理,职位表添加,职位表修改,职位表删除');
INSERT INTO `sys_operation_log` VALUES (1181911697056768002, '业务日志', '配置权限', 1, 'cn.stylefeng.guns.sys.modular.system.controller.RoleController', 'setAuthority', '2019-10-09 20:38:02', '成功', '角色名称=超级管理员,资源名称=系统管理,用户管理,添加用户,修改用户,删除用户,重置密码,冻结用户,解除冻结用户,分配角色,分配角色跳转,编辑用户跳转,用户列表,角色管理,添加角色,修改角色,删除角色,配置权限,修改角色跳转,角色分配跳转,角色列表,菜单管理,添加菜单,修改菜单,删除菜单,菜单编辑跳转,菜单列表,业务日志,清空日志,日志列表,日志详情,部门管理,添加部门,修改部门,删除部门,修改部门跳转,部门列表,部门详情,字典管理,添加字典,修改字典,删除字典,修改菜单跳转,字典列表,字典详情,登录日志,清空登录日志,登录日志列表,通知管理,添加通知,修改通知,删除通知');
-- ----------------------------
-- Table structure for sys_position
-- ----------------------------
DROP TABLE IF EXISTS `sys_position`;
CREATE TABLE `sys_position` (
`position_id` bigint(20) NOT NULL COMMENT '主键id',
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '职位名称',
`code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '职位编码',
`sort` int(11) NOT NULL COMMENT '顺序',
`status` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'ENABLE' COMMENT '状态(字典)',
`remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`update_user` bigint(20) DEFAULT NULL COMMENT '更新者',
`update_time` datetime(0) DEFAULT NULL COMMENT '更新时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建者',
PRIMARY KEY (`position_id`) USING BTREE,
UNIQUE INDEX `CODE_UNI`(`code`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '职位表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_position
-- ----------------------------
INSERT INTO `sys_position` VALUES (1, '董事长', 'President', 1, 'ENABLE', NULL, '2019-06-27 18:14:43', 1, NULL, NULL);
INSERT INTO `sys_position` VALUES (2, '总经理', 'GM', 2, 'ENABLE', NULL, '2019-06-27 18:14:43', 1, NULL, NULL);
-- ----------------------------
-- Table structure for sys_relation
-- ----------------------------
DROP TABLE IF EXISTS `sys_relation`;
CREATE TABLE `sys_relation` (
`relation_id` bigint(20) NOT NULL COMMENT '主键',
`menu_id` bigint(20) DEFAULT NULL COMMENT '菜单id',
`role_id` bigint(20) DEFAULT NULL COMMENT '角色id',
PRIMARY KEY (`relation_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色和菜单关联表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_relation
-- ----------------------------
INSERT INTO `sys_relation` VALUES (1138325281010921473, 105, 5);
INSERT INTO `sys_relation` VALUES (1138325281031892994, 132, 5);
INSERT INTO `sys_relation` VALUES (1138325281044475906, 138, 5);
INSERT INTO `sys_relation` VALUES (1138325281057058818, 139, 5);
INSERT INTO `sys_relation` VALUES (1138325281069641730, 140, 5);
INSERT INTO `sys_relation` VALUES (1138325281082224642, 155, 5);
INSERT INTO `sys_relation` VALUES (1138325281099001858, 156, 5);
INSERT INTO `sys_relation` VALUES (1138325281111584770, 157, 5);
INSERT INTO `sys_relation` VALUES (1138325281124167682, 141, 5);
INSERT INTO `sys_relation` VALUES (1138325281136750593, 142, 5);
INSERT INTO `sys_relation` VALUES (1138325281149333506, 143, 5);
INSERT INTO `sys_relation` VALUES (1138325281161916418, 144, 5);
INSERT INTO `sys_relation` VALUES (1138325281174499329, 171, 5);
INSERT INTO `sys_relation` VALUES (1138325281187082241, 149, 5);
INSERT INTO `sys_relation` VALUES (1138325281199665154, 1127085735660421122, 5);
INSERT INTO `sys_relation` VALUES (1138325281216442370, 172, 5);
INSERT INTO `sys_relation` VALUES (1138325281229025281, 145, 5);
INSERT INTO `sys_relation` VALUES (1138325281245802498, 1111545968697860098, 5);
INSERT INTO `sys_relation` VALUES (1138325281258385410, 1111546189892870145, 5);
INSERT INTO `sys_relation` VALUES (1181911696314376193, 105, 1);
INSERT INTO `sys_relation` VALUES (1181911696318570497, 106, 1);
INSERT INTO `sys_relation` VALUES (1181911696326959106, 107, 1);
INSERT INTO `sys_relation` VALUES (1181911696331153409, 108, 1);
INSERT INTO `sys_relation` VALUES (1181911696339542018, 109, 1);
INSERT INTO `sys_relation` VALUES (1181911696347930626, 110, 1);
INSERT INTO `sys_relation` VALUES (1181911696352124929, 111, 1);
INSERT INTO `sys_relation` VALUES (1181911696360513538, 112, 1);
INSERT INTO `sys_relation` VALUES (1181911696364707842, 113, 1);
INSERT INTO `sys_relation` VALUES (1181911696368902145, 165, 1);
INSERT INTO `sys_relation` VALUES (1181911696373096449, 166, 1);
INSERT INTO `sys_relation` VALUES (1181911696381485058, 167, 1);
INSERT INTO `sys_relation` VALUES (1181911696385679362, 114, 1);
INSERT INTO `sys_relation` VALUES (1181911696389873665, 115, 1);
INSERT INTO `sys_relation` VALUES (1181911696398262274, 116, 1);
INSERT INTO `sys_relation` VALUES (1181911696406650881, 117, 1);
INSERT INTO `sys_relation` VALUES (1181911696410845186, 118, 1);
INSERT INTO `sys_relation` VALUES (1181911696415039489, 162, 1);
INSERT INTO `sys_relation` VALUES (1181911696419233793, 163, 1);
INSERT INTO `sys_relation` VALUES (1181911696427622402, 164, 1);
INSERT INTO `sys_relation` VALUES (1181911696431816706, 119, 1);
INSERT INTO `sys_relation` VALUES (1181911696436011010, 120, 1);
INSERT INTO `sys_relation` VALUES (1181911696440205314, 121, 1);
INSERT INTO `sys_relation` VALUES (1181911696448593922, 122, 1);
INSERT INTO `sys_relation` VALUES (1181911696452788226, 150, 1);
INSERT INTO `sys_relation` VALUES (1181911696452788227, 151, 1);
INSERT INTO `sys_relation` VALUES (1181911696461176834, 128, 1);
INSERT INTO `sys_relation` VALUES (1181911696465371138, 134, 1);
INSERT INTO `sys_relation` VALUES (1181911696473759745, 158, 1);
INSERT INTO `sys_relation` VALUES (1181911696477954050, 159, 1);
INSERT INTO `sys_relation` VALUES (1181911696486342658, 131, 1);
INSERT INTO `sys_relation` VALUES (1181911696490536962, 135, 1);
INSERT INTO `sys_relation` VALUES (1181911696494731265, 136, 1);
INSERT INTO `sys_relation` VALUES (1181911696503119874, 137, 1);
INSERT INTO `sys_relation` VALUES (1181911696503119875, 152, 1);
INSERT INTO `sys_relation` VALUES (1181911696511508481, 153, 1);
INSERT INTO `sys_relation` VALUES (1181911696519897090, 154, 1);
INSERT INTO `sys_relation` VALUES (1181911696519897091, 132, 1);
INSERT INTO `sys_relation` VALUES (1181911696528285698, 138, 1);
INSERT INTO `sys_relation` VALUES (1181911696532480001, 139, 1);
INSERT INTO `sys_relation` VALUES (1181911696545062913, 140, 1);
INSERT INTO `sys_relation` VALUES (1181911696549257217, 155, 1);
INSERT INTO `sys_relation` VALUES (1181911696553451521, 156, 1);
INSERT INTO `sys_relation` VALUES (1181911696557645826, 157, 1);
INSERT INTO `sys_relation` VALUES (1181911696561840130, 133, 1);
INSERT INTO `sys_relation` VALUES (1181911696566034434, 160, 1);
INSERT INTO `sys_relation` VALUES (1181911696574423042, 161, 1);
INSERT INTO `sys_relation` VALUES (1181911696578617346, 141, 1);
INSERT INTO `sys_relation` VALUES (1181911696578617347, 142, 1);
INSERT INTO `sys_relation` VALUES (1181911696587005953, 143, 1);
INSERT INTO `sys_relation` VALUES (1181911696591200258, 144, 1);
-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
`role_id` bigint(20) NOT NULL COMMENT '主键id',
`pid` bigint(20) DEFAULT NULL COMMENT '父角色id',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '角色名称',
`description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '提示',
`sort` int(11) DEFAULT NULL COMMENT '序号',
`version` int(11) DEFAULT NULL COMMENT '乐观锁',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) DEFAULT NULL COMMENT '修改时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建用户',
`update_user` bigint(20) DEFAULT NULL COMMENT '修改用户',
PRIMARY KEY (`role_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO `sys_role` VALUES (1, 0, '超级管理员', 'administrator', 1, 1, NULL, NULL, NULL, NULL);
INSERT INTO `sys_role` VALUES (5, 1, '第三方登录', 'oauth_role', 2, NULL, NULL, '2019-06-11 13:59:40', NULL, 1);
-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
`user_id` bigint(20) NOT NULL COMMENT '主键id',
`avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '头像',
`account` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '账号',
`password` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '密码',
`salt` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'md5密码盐',
`name` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '名字',
`birthday` datetime(0) DEFAULT NULL COMMENT '生日',
`sex` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '性别(字典)',
`email` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '电子邮件',
`phone` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '电话',
`role_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '角色id(多个逗号隔开)',
`dept_id` bigint(20) DEFAULT NULL COMMENT '部门id(多个逗号隔开)',
`status` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '状态(字典)',
`create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
`create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_time` datetime(0) DEFAULT NULL COMMENT '更新时间',
`update_user` bigint(20) DEFAULT NULL COMMENT '更新人',
`version` int(11) DEFAULT NULL COMMENT '乐观锁',
PRIMARY KEY (`user_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '管理员表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_user
-- ----------------------------
INSERT INTO `sys_user` VALUES (1, '1124606971782160385', 'admin', '17db03c22596b7609c7c9704f16663e0', 'abcdef', 'stylefeng', '2018-11-16 00:00:00', 'M', 'sn93@qq.com', '18200000000', '1', 25, 'ENABLE', '2016-01-29 08:49:53', NULL, '2019-06-28 14:38:19', 24, 25);
-- ----------------------------
-- Table structure for sys_user_pos
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_pos`;
CREATE TABLE `sys_user_pos` (
`user_pos_id` bigint(20) NOT NULL COMMENT '主键id',
`user_id` bigint(20) NOT NULL COMMENT '用户id',
`pos_id` bigint(20) NOT NULL COMMENT '职位id',
PRIMARY KEY (`user_pos_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户职位关联表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_user_pos
-- ----------------------------
INSERT INTO `sys_user_pos` VALUES (1144495219551617025, 1, 1);
SET FOREIGN_KEY_CHECKS = 1;
| true
|
ec6a4c71f3bf76b8e487bdd5e1b5a1b8b954ecb4
|
SQL
|
ilya5006/excel-parser
|
/export.sql
|
UTF-8
| 6,162
| 3.3125
| 3
|
[] |
no_license
|
— —-
— Globals
— —-
— SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
— SET FOREIGN_KEY_CHECKS=0;
— —-
— Table 'personal_data_employees'
—
— —-
DROP TABLE IF EXISTS `personal_data_employees`;
CREATE TABLE `personal_data_employees` (
`id_employee` MEDIUMINT(5) NOT NULL AUTO_INCREMENT,
`first_name` VARCHAR(50) NOT NULL,
`second_name` VARCHAR(50) NOT NULL,
`father_name` VARCHAR(50) NULL DEFAULT NULL,
`login` VARCHAR(50) NOT NULL,
`pASSword` VARCHAR(50) NOT NULL,
`id_role` TINYINT(2) NOT NULL,
`id_position` TINYINT(3) NOT NULL,
PRIMARY KEY (`id_employee`)
);
— —-
— Table 'role_employees'
—
— —-
DROP TABLE IF EXISTS `role_employees`;
CREATE TABLE `role_employees` (
`id_role` TINYINT(2) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(30) NOT NULL,
PRIMARY KEY (`id_role`)
);
— —-
— Table 'images'
—
— —-
DROP TABLE IF EXISTS `images`;
CREATE TABLE `images` (
`id_employee` MEDIUMINT(5) NOT NULL,
`type` VARCHAR(25) NOT NULL,
`image` BLOB NOT NULL,
`size` VARCHAR(25) NOT NULL,
PRIMARY KEY (`id_employee`)
);
— —-
— Table 'products'
—
— —-
DROP TABLE IF EXISTS `products`;
CREATE TABLE `products` (
`article` MEDIUMINT(7) NOT NULL,
`name` VARCHAR(100) NOT NULL,
`id_brand` MEDIUMINT(6) NOT NULL,
`cost_price` DECIMAL(10,2) NOT NULL,
`result_price` DECIMAL(10,2) NOT NULL,
PRIMARY KEY (`article`)
);
— —-
— Table 'brands'
—
— —-
DROP TABLE IF EXISTS `brands`;
CREATE TABLE `brands` (
`id_brand` MEDIUMINT(6) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL,
`country_manufacturer` VARCHAR(25) NOT NULL,
PRIMARY KEY (`id_brand`)
);
— —-
— Table 'positions'
—
— —-
DROP TABLE IF EXISTS `positions`;
CREATE TABLE `positions` (
`id_position` TINYINT(3) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id_position`)
);
— —-
— Table 'sendings'
—
— —-
DROP TABLE IF EXISTS `sendings`;
CREATE TABLE `sendings` (
`id_sending` MEDIUMINT(7) NOT NULL AUTO_INCREMENT,
`author` MEDIUMINT(5) NOT NULL,
`date_of_start` DATE NOT NULL,
`id_pr_manager` MEDIUMINT(5) NULL DEFAULT NULL,
`id_tag_send` TINYINT(2) NOT NULL,
`id_influencer` INT(7) NOT NULL,
PRIMARY KEY (`id_sending`)
);
— —-
— Table 'tages'
—
— —-
DROP TABLE IF EXISTS `tages`;
CREATE TABLE `tages` (
`id_tag_sand` TINYINT(2) NOT NULL AUTO_INCREMENT,
`name_tag_send` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id_tag_sand`)
);
— —-
— Table 'influencers'
—
— —-
DROP TABLE IF EXISTS `influencers`;
CREATE TABLE `influencers` (
`id_influencer` INT(7) NOT NULL AUTO_INCREMENT,
`nick_name` VARCHAR(100) NOT NULL,
`name` VARCHAR(50) NOT NULL,
`family_name` VARCHAR(50) NOT NULL,
`father_name` VARCHAR(50) NOT NULL,
`email` VARCHAR(100) NULL DEFAULT NULL,
`telephone` VARCHAR(15) NULL DEFAULT NULL,
`id_method_communications` TINYINT(2) NOT NULL,
PRIMARY KEY (`id_influencer`)
);
— —-
— Table 'methods_communications'
—
— —-
DROP TABLE IF EXISTS `methods_communications`;
CREATE TABLE `methods_communications` (
`id_method_communications` TINYINT(2) NOT NULL AUTO_INCREMENT,
`name_method` VARCHAR(20) NOT NULL,
PRIMARY KEY (`id_method_communications`)
);
— —-
— Foreign Keys
— —-
ALTER TABLE `personal_data_employees` ADD FOREIGN KEY (id_role) REFERENCES `role_employees` (`id_role`);
ALTER TABLE `personal_data_employees` ADD FOREIGN KEY (id_position) REFERENCES `positions` (`id_position`);
ALTER TABLE `images` ADD FOREIGN KEY (id_employee) REFERENCES `personal_data_employees` (`id_employee`);
ALTER TABLE `products` ADD FOREIGN KEY (id_brand) REFERENCES `brands` (`id_brand`);
ALTER TABLE `sendings` ADD FOREIGN KEY (author) REFERENCES `personal_data_employees` (`id_employee`);
ALTER TABLE `sendings` ADD FOREIGN KEY (id_pr_manager) REFERENCES `personal_data_employees` (`id_employee`);
ALTER TABLE `sendings` ADD FOREIGN KEY (id_tag_send) REFERENCES `tages` (`id_tag_sand`);
ALTER TABLE `sendings` ADD
FOREIGN KEY (id_influencer) REFERENCES `influencers` (`id_influencer`);
ALTER TABLE `influencers` ADD FOREIGN KEY (id_method_communications) REFERENCES `methods_communications` (`id_method_communications`);
— —-
— Table Properties
— —-
— ALTER TABLE `personal_data_employees` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— ALTER TABLE `role_employees` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— ALTER TABLE `images` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— ALTER TABLE `products` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— ALTER TABLE `brands` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— ALTER TABLE `positions` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— ALTER TABLE `sendings` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— ALTER TABLE `tages` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— ALTER TABLE `influencers` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— ALTER TABLE `methods_communications` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
— —-
— Test Data
— —-
— INSERT INTO `personal_data_employees` (`id_employee`,`first_name`,`second_name`,`father_name`,`login`,`pASSword`,`id_role`,`id_position`) VALUES
— ('','','','','','','','');
— INSERT INTO `role_employees` (`id_role`,`name`) VALUES
— ('','');
— INSERT INTO `images` (`id_employee`,`type`,`image`,`size`) VALUES
— ('','','','');
— INSERT INTO `products` (`article`,`name`,`id_brand`,`cost_price`,`result_price`) VALUES
— ('','','','','');
— INSERT INTO `brands` (`id_brand`,`name`,`country_manufacturer`) VALUES
— ('','','');
— INSERT INTO `positions` (`id_position`,`name`) VALUES
— ('','');
— INSERT INTO `sendings` (`id_sending`,`author`,`date_of_start`,`id_pr_manager`,`id_tag_send`,`id_influencer`) VALUES
— ('','','','','','');
— INSERT INTO `tages` (`id_tag_sand`,`name_tag_send`) VALUES
— ('','');
— INSERT INTO `influencers` (`id_influencer`,`nick_name`,`name`,`family_name`,`father_name`,`email`,`telephone`,`id_method_communications`) VALUES
— ('','','','','','','','');
— INSERT INTO `methods_communications` (`id_method_communications`,`name_method`) VALUES
— ('','');
| true
|
9d2fb32e5c2e25d6dea8e43b3526aac140901f32
|
SQL
|
Galaraz/SQL_Playground
|
/mysql-one-for-all/desafio2.sql
|
UTF-8
| 259
| 3.234375
| 3
|
[] |
no_license
|
CREATE VIEW estatisticas_musicais AS
SELECT COUNT(DISTINCT S.song_id)AS cancoes,
COUNT(DISTINCT ART.artist_id) AS artistas,
COUNT(DISTINCT ALB.album_id) AS albuns
FROM SpotifyClone.songs AS S
JOIN SpotifyClone.artists AS ART
JOIN SpotifyClone.albums AS ALB;
| true
|
c65f9294a91a6e1f56b1a7e4c68ed7e0df5c0457
|
SQL
|
bmillss/PotLuck
|
/assessment8sql.sql
|
UTF-8
| 592
| 2.828125
| 3
|
[] |
no_license
|
create schema potluck;
use potluck;
create table TeamMember(Id integer auto_increment,
FirstName varchar(50)not null,
LastName varchar(50) not null,
EmailAddress varchar(50) not null,
AttendanceDate varchar(50) not null,
GuestName varchar(50),
primary key(Id));
create table Dish(Id integer not null auto_increment,
TMName varchar(50) not null,
PhoneNumber varchar(25) not null,
DishName varchar(50) not null,
DishDescription varchar(100)not null,
Category varchar(25) not null,
primary key(Id));
insert into dish values (1,"Brandon Miller", "704-995-1920",
"Fishdish", "Fishy dish", "Main");
| true
|
0943902a9b8fe40e4de33629cb6aac89ad3e65d4
|
SQL
|
arifcse11/custom-mvc
|
/custom-mvc.sql
|
UTF-8
| 2,598
| 3.140625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 20, 2018 at 08:35 AM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 7.2.2
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: `custom-mvc`
--
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`body` text NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `posts`
--
INSERT INTO `posts` (`id`, `user_id`, `title`, `body`, `created_at`) VALUES
(1, 2, 'Post One', 'Description for post one.', '2018-03-19 18:16:22'),
(2, 2, 'Post Two', 'Description for post two.', '2018-03-19 18:16:22'),
(3, 3, 'Post Three', 'Description for post three.', '2018-03-20 13:08:39');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `created_at`) VALUES
(1, 'John Doe', 'jdoe@gmail.com', '123', '2018-03-19 14:32:45'),
(2, 'Arif', 'arifcse11@gmail.com', '$2y$10$8g5KKjIUvN5FyDDaHPHElO/xJu4vX3wTsc5zPfar1ETbp00uIaEq6', '2018-03-19 14:58:45'),
(3, 'Lejon Khan', 'lejon@gmail.com', '$2y$10$x29Vl1IGSCXnGwJM/gHo/OQJwDysvzgeNpUBG2J.ExvUsdvNJR0.a', '2018-03-20 13:08:08');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
82c08ba0f9fe5936eb172878e3d03987f039f19e
|
SQL
|
spark-2020/utils
|
/MySQL/sot_contracts_quotes/statuses_voucher_template.sql
|
UTF-8
| 9,654
| 4.25
| 4
|
[
"Apache-2.0"
] |
permissive
|
# What this script will do:
#
# - Create a table `statuses_voucher_template` to list the possible statutes for a record.
# - Create a trigger `uuid_statuses_voucher_template` to automatically generate the UUID for a new record.
# - Create a table `logs_statuses_voucher_template` to log all the changes in the table.
# - Create a trigger `logs_statuses_voucher_template_insert` to automatically log INSERT operations on the table `statuses_voucher_template`.
# - Create a trigger `logs_statuses_voucher_template_update` to automatically log UPDATE operations on the table `statuses_voucher_template`.
# - Create a trigger `logs_statuses_voucher_template_delete` to automatically log DELETE operations on the table `statuses_voucher_template`.
# - Insert some sample data in the table `statuses_voucher_template`.
#
# Constaints:
# - The status name must be unique.
# - The Interface to create the record MUST exist in the table `db_interfaces`
# - The Interface to update the record MUST exist in the table `db_interfaces`
#
# Automations and Triggers:
# - The UUID for a new record is automatically generated.
# - Logs of each changes in this table are recorded in the table `logs_statuses_voucher_template`
#
# Sample data are inserted in the table:
# - Record that must exist in the table `db_interfaces`
# - field `interface`, value 'sql_seed_script'.
#
# Create the table `statuses_voucher_template`
CREATE TABLE `statuses_voucher_template` (
`uuid` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'The globally unique UUID for this record',
`interface_id_creation` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'What is the id of the interface sytem that was used to CREATE the record?',
`interface_id_update` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'What is the id of the interface sytem that was used to UPDATE the record?',
`is_obsolete` tinyint(1) DEFAULT '0' COMMENT 'is this obsolete?',
`order` int(10) NOT NULL DEFAULT '0' COMMENT 'Order in the list',
`is_active` tinyint(1) DEFAULT '0' COMMENT 'This satus is considered as ACTIVE',
`voucher_template_status` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Designation',
`voucher_template_status_description` text COLLATE utf8mb4_unicode_520_ci COMMENT 'Description/help text',
PRIMARY KEY (`uuid`),
UNIQUE KEY `unique_voucher_template_status_designation` (`voucher_template_status`) COMMENT 'The designation must be unique',
KEY `voucher_template_status_interface_id_creation` (`interface_id_creation`),
KEY `voucher_template_status_interface_id_update` (`interface_id_update`),
CONSTRAINT `voucher_template_status_interface_id_creation` FOREIGN KEY (`interface_id_creation`) REFERENCES `db_interfaces` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `voucher_template_status_interface_id_update` FOREIGN KEY (`interface_id_update`) REFERENCES `db_interfaces` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ROW_FORMAT=DYNAMIC
;
# Make sure that a UUID is generated each time a new record is created in the table `statuses_voucher_template`.
CREATE TRIGGER `uuid_statuses_voucher_template`
BEFORE INSERT ON `statuses_voucher_template`
FOR EACH ROW
SET new.uuid = uuid()
;
# Create the table `logs_statuses_voucher_template` to store the changes in the data
CREATE TABLE `logs_statuses_voucher_template` (
`action` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'The action that was performed on the table',
`action_datetime` TIMESTAMP NULL DEFAULT NULL COMMENT 'Timestamp - when was the operation done',
`uuid` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'The globally unique UUID for this record',
`interface_id_creation` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'What is the id of the interface sytem that was used to CREATE the record?',
`interface_id_update` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'What is the id of the interface sytem that was used to UPDATE the record?',
`is_obsolete` tinyint(1) DEFAULT '0' COMMENT 'is this obsolete?',
`order` int(10) NOT NULL DEFAULT '0' COMMENT 'Order in the list',
`is_active` tinyint(1) DEFAULT '0' COMMENT 'This satus is considered as ACTIVE',
`voucher_template_status` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'Designation',
`voucher_template_status_description` text COLLATE utf8mb4_unicode_520_ci COMMENT 'Description/help text',
KEY `statuses_voucher_template_uuid` (`uuid`) COMMENT 'Index the UUID for improved performances'
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci ROW_FORMAT=DYNAMIC
;
# After a successful INSERT in the table `statuses_voucher_template`
# Record all the data Inserted in the table `statuses_voucher_template`
# The information will be stored in the table `logs_statuses_voucher_template`
DELIMITER $$
CREATE TRIGGER `logs_statuses_voucher_template_insert` AFTER INSERT ON `statuses_voucher_template`
FOR EACH ROW
BEGIN
INSERT INTO `logs_statuses_voucher_template` (
`action`,
`action_datetime`,
`uuid`,
`interface_id_creation`,
`interface_id_update`,
`is_obsolete`,
`order`,
`is_active`,
`voucher_template_status`,
`voucher_template_status_description`
)
VALUES
('INSERT',
NOW(),
NEW.`uuid`,
NEW.`interface_id_creation`,
NEW.`interface_id_update`,
NEW.`is_obsolete`,
NEW.`order`,
NEW.`is_active`,
NEW.`voucher_template_status`,
NEW.`voucher_template_status_description`
)
;
END
$$
DELIMITER ;
# After a successful UPDATE in the table `statuses_voucher_template`
# Record all the values for the old record
# Record all the values for the new record
# data Inserted in the table `statuses_voucher_template`
# The information will be stored in the table `logs_statuses_voucher_template`
DELIMITER $$
CREATE TRIGGER `logs_statuses_voucher_template_update` AFTER UPDATE ON `statuses_voucher_template`
FOR EACH ROW
BEGIN
INSERT INTO `logs_statuses_voucher_template` (
`action`,
`action_datetime`,
`uuid`,
`interface_id_creation`,
`interface_id_update`,
`is_obsolete`,
`order`,
`is_active`,
`voucher_template_status`,
`voucher_template_status_description`
)
VALUES
('UPDATE-OLD_VALUES',
NOW(),
OLD.`uuid`,
OLD.`interface_id_creation`,
OLD.`interface_id_update`,
OLD.`is_obsolete`,
OLD.`order`,
OLD.`is_active`,
OLD.`voucher_template_status`,
OLD.`voucher_template_status_description`
),
('UPDATE-NEW_VALUES',
NOW(),
NEW.`uuid`,
NEW.`interface_id_creation`,
NEW.`interface_id_update`,
NEW.`is_obsolete`,
NEW.`order`,
NEW.`is_active`,
NEW.`voucher_template_status`,
NEW.`voucher_template_status_description`
)
;
END
$$
DELIMITER ;
# After a successful DELETE in the table `statuses_voucher_template`
# Record all the values for the old record
# The information will be stored in the table `logs_statuses_voucher_template`
DELIMITER $$
CREATE TRIGGER `logs_statuses_voucher_template_delete` AFTER DELETE ON `statuses_voucher_template`
FOR EACH ROW
BEGIN
INSERT INTO `logs_statuses_voucher_template` (
`action`,
`action_datetime`,
`uuid`,
`interface_id_creation`,
`interface_id_update`,
`is_obsolete`,
`order`,
`is_active`,
`voucher_template_status`,
`voucher_template_status_description`
)
VALUES
('DELETE',
NOW(),
OLD.`uuid`,
OLD.`interface_id_creation`,
OLD.`interface_id_update`,
OLD.`is_obsolete`,
OLD.`order`,
OLD.`is_active`,
OLD.`voucher_template_status`,
OLD.`voucher_template_status_description`
)
;
END
$$
DELIMITER ;
# We need to get the uuid for the value `sql_seed_script` in the table `db_interfaces`
# We put this into the variable [@UUID_sql_seed_script]
SELECT `uuid`
INTO @UUID_sql_seed_script
FROM `db_interfaces`
WHERE `interface` = 'sql_seed_script'
;
# Insert sample values in the table
INSERT INTO `statuses_voucher_template`(
`interface_id_creation`,
`is_obsolete`,
`order`,
`is_active`,
`voucher_template_status`,
`voucher_template_status_description`
)
VALUES
(@UUID_sql_seed_script, 0, 0, 0, 'UNKNOWN','We have no information about the voucher_template status. This is an INACTIVE Status'),
(@UUID_sql_seed_script, 0, 10, 0, 'PROJECT','This is a project. This is an INACTIVE Status'),
(@UUID_sql_seed_script, 0, 20, 0, 'DRAFT','The project has been approved and we have a draft of the template. This is an ACTIVE Status'),
(@UUID_sql_seed_script, 0, 30, 0, 'READY','The template is ready but we have no voucher using the template yet. This is an INACTIVE Status'),
(@UUID_sql_seed_script, 0, 40, 1, 'LIVE','The template is ready and in use. This is an ACTIVE Status'),
(@UUID_sql_seed_script, 0, 50, 1, 'SUNSET','The template is currently used but we should NOT use it for new vouchers. This is an ACTIVE Status'),
(@UUID_sql_seed_script, 0, 60, 0, 'TERMINATED','The contract with the merchant has been terminated. This is an INACTIVE Status'),
(@UUID_sql_seed_script, 0, 70, 0, 'DUPLICATE','This is a duplicate of an existing record. This is an INACTIVE Status')
;
| true
|
b38f7aaef764472b541c0c1e48ec1386b675cc17
|
SQL
|
LadoBago/Coursera.WebDevSpring
|
/Assignments/library/src/main/resources/db/migration/V1_0_0__Init_Db.sql
|
UTF-8
| 618
| 3.671875
| 4
|
[] |
no_license
|
CREATE SEQUENCE book_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
MAXVALUE 2147483647
CACHE 1;
CREATE TABLE book (
id integer NOT NULL DEFAULT nextval('book_id_seq'),
title VARCHAR (255),
description VARCHAR (255),
PRIMARY KEY (id));
CREATE SEQUENCE author_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
MAXVALUE 2147483647
CACHE 1;
CREATE TABLE author (
id integer NOT NULL DEFAULT nextval('author_id_seq'),
name VARCHAR (255),
PRIMARY KEY (id));
CREATE TABLE book_author (
book_id integer NOT NULL ,
author_id integer NOT NULL ,
PRIMARY KEY (book_id, author_id));
| true
|
c56a5dbadccdca38047b7e459676bd6d7dfa8a34
|
SQL
|
Rashld/SQL
|
/stepic_sql/2_3_09.sql
|
UTF-8
| 1,208
| 3.84375
| 4
|
[] |
no_license
|
Задание
Выведите список всех источников клиентов и суммарный объем заказов по каждому источнику. Результат должен включать также записи для источников, по которым не было заказов.
Ожидаемый формат результата:
+-------------+----------------+
| source_name | sale_sum |
+-------------+----------------+
| source 1 | 111.00 |
| source 2 | 222.00 |
| source 3 | 333.00 |
...
NB! В запросе для соединения нескольких источников данных операцию соединения можно использовать многократно. Например, для соединения таблиц A, B и C можно использовать запрос вида:
SELECT * FROM A
LEFT OUTER JOIN B
ON A.b_id = B.id
LEFT OUTER JOIN C
ON a.c_id = C.id
;
select s.name source_name
, sum(o.sale_sum) sale_sum
from source as s
left join client as c on c.source_id = s.id
left join sale as o on o.client_id = c.id
group by s.name;
| true
|
87f401645370053f63a18f3d3e25a7ed840a75d2
|
SQL
|
sitmeister/SQL_Employee_Tracker
|
/db/seeds.sql
|
UTF-8
| 752
| 3.3125
| 3
|
[
"MIT"
] |
permissive
|
USE employees_db;
INSERT INTO departments (name)
VALUES ("Instructor"),
("Teaching Assistant"),
("Student"),
("Student Support");
INSERT INTO roles (title, salary, department_id)
VALUES ("Main Instructor", 1000000.00, 1),
("TA", 80000.00, 2),
("Student", -14000.00, 3),
("Student Relations", 150000.00, 4);
INSERT INTO employees (first_name, last_name, role_id)
VALUES ("Leah", "Nelson", 1),
("Christian", "Henry", 2),
("Megan", "Henning", 2),
("Ronald", "Sit", 3),
("Emilio", "Estevez", 3),
("Damien", "Luzzo", 3),
("Ismeny", "Saguilan", 3),
("Carlos", "Hernandez", 3),
("Sean", "Flemming", 4);
UPDATE employees
SET manager_id = 1
WHERE id IN (2,3);
| true
|
fd797c5e765239d6ffd6e768797b24c153e378c0
|
SQL
|
dhenriquedba/SQL
|
/scripts_auxiliares/IOT.sql
|
UTF-8
| 1,898
| 3.34375
| 3
|
[] |
no_license
|
CREATE TABLE TESTE_CONTA (
NR_SEQ_PESSOA NUMBER(6),
NR_SEQ_CTACONTAB NUMBER(6),
NR_CTACONTAB VARCHAR2(30 byte),
DS_CTACONTAB VARCHAR2(50 byte),
NR_SEQ_CTACONTAB_PAI NUMBER(6),
DS_DET_CTACONTAB VARCHAR2(1000 byte),
CONSTRAINT R_550_1 FOREIGN KEY(NR_SEQ_PESSOA, NR_SEQ_CTACONTAB_PAI)
REFERENCES TESTE_CONTA(NR_SEQ_PESSOA, NR_SEQ_CTACONTAB),
CONSTRAINT XAK1CONTAS_CONTABEIS_1 UNIQUE(NR_SEQ_PESSOA, NR_CTACONTAB)
USING INDEX TABLESPACE USER_DATA
STORAGE ( INITIAL 256K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1)
PCTFREE 10 INITRANS 2 MAXTRANS 255,
CONSTRAINT XAK2CONTAS_CONTABEIS_1 UNIQUE(NR_SEQ_PESSOA, NR_SEQ_CTACONTAB_PAI, DS_CTACONTAB)
USING INDEX TABLESPACE USER_DATA
STORAGE ( INITIAL 256K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1)
PCTFREE 10 INITRANS 2 MAXTRANS 255,
CONSTRAINT XPKCONTAS_CONTABEIS_1 PRIMARY KEY(NR_SEQ_PESSOA, NR_SEQ_CTACONTAB))
ORGANIZATION INDEX
TABLESPACE USER_DATA
PCTFREE 10 INITRANS 1 MAXTRANS 255
STORAGE ( INITIAL 256K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1)
LOGGING ;
INSERT INTO TESTE_CONTA select NR_SEQ_PESSOA, NR_SEQ_CTACONTAB, NR_CTACONTAB, DS_CTACONTAB, NR_SEQ_CTACONTAB_PAI,
DS_DET_CTACONTAB
from erp_tectraining.contas_contabeis;
COMMIT;
select 'insert into teste_conta (NR_SEQ_PESSOA,NR_SEQ_CTACONTAB,DS_CTACONTAB) '||chr(10)||
' values ('||NR_SEQ_PESSOA||','||NR_SEQ_CTACONTAB||','''||DS_CTACONTAB||''');'
from teste_conta;
select NR_SEQ_CTACONTAB,DS_CTACONTAB from teste_conta;
select column_name, position, constraint_name
from dba_cons_columns
where table_name = 'TESTE_CONTA' and constraint_name like '%PK%';
| true
|
3d9ab6f542688b4a46ff915aee9c3713ea77efe8
|
SQL
|
pmirand6/soliris
|
/base_datos/bajada_pablo/soliris/FU_VAL_PAC_EDAD.sql
|
UTF-8
| 1,807
| 3.390625
| 3
|
[] |
no_license
|
-- --------------------------------------------------------
-- Host: localhost
-- Versión del servidor: 5.7.24 - MySQL Community Server (GPL)
-- SO del servidor: Win64
-- HeidiSQL Versión: 11.0.0.5965
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Volcando estructura para función soliris.FU_VAL_PAC_EDAD
DELIMITER //
CREATE FUNCTION `FU_VAL_PAC_EDAD`(`v_edad` int,
`v_sexo` varchar(5)) RETURNS text CHARSET latin1
BEGIN
DECLARE res text;
DECLARE edad_ped int;
DECLARE edad_c_g int;
SET edad_ped = (SELECT
SUBSTRING_INDEX(GROUP_CONCAT(valor), ',', 1) AS e_ped
FROM configuracion
WHERE tipo = 'edad_paciente');
SET edad_c_g = (SELECT
SUBSTRING_INDEX(GROUP_CONCAT(valor), ',', -1) AS e_c_ges
FROM configuracion
WHERE tipo = 'edad_paciente');
CASE
WHEN (v_edad <= edad_ped) THEN SET res = (SELECT
CONCAT_WS(',', nota, FU_CLE_TAGS(nota))
FROM configuracion
WHERE valor = edad_ped);
WHEN ((v_edad > edad_ped AND
v_edad <= edad_c_g) AND
(v_sexo = 'F')) THEN SET res = (SELECT
CONCAT_WS(',', nota, FU_CLE_TAGS(nota))
FROM configuracion
WHERE valor = edad_c_g);
END CASE;
RETURN res;
END//
DELIMITER ;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true
|
2b473b6a0f430fdcbbdd0610df34c7ab9780aae0
|
SQL
|
mateuszrusiecki/test_b2b
|
/plugins/Photo/schema.sql
|
UTF-8
| 639
| 3.25
| 3
|
[] |
no_license
|
--
-- Struktura tabeli dla `photos`
--
CREATE TABLE IF NOT EXISTS `photos` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`img` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`slug` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`page_id` int(10) unsigned DEFAULT NULL,
`title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`x` int(11) DEFAULT NULL,
`y` int(11) DEFAULT NULL,
`order` int(6) unsigned NOT NULL DEFAULT '1',
`modified` datetime NOT NULL,
`created` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Dowiazane fotografie do modeli';
| true
|
8de416b85dca3e2dee6b4392d50a914a28f1ae02
|
SQL
|
geralvaredo/MySQL
|
/PL - SQL/PLSQL - Parte II/Teoria/28 - FUNCTION.sql
|
UTF-8
| 1,112
| 3.59375
| 4
|
[] |
no_license
|
CREATE FUNCTION check_sal RETURN Boolean IS
dept_id employees.department_id%TYPE;
empno employees.employee_id%TYPE;
sal employees.salary%TYPE;
avg_sal employees.salary%TYPE;
BEGIN
empno:=205;
SELECT salary,department_id INTO sal,dept_id FROM employees
WHERE employee_id= empno;
SELECT avg(salary) INTO avg_sal FROM employees WHERE department_id=dept_id;
IF sal > avg_sal THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
END;
----------------------------------------------------------------------------------
SET VERIFY OFF
DROP FUNCTION check_sal;
/
CREATE FUNCTION check_sal( empno employees.employee_id%TYPE) RETURN Boolean IS
dept_id employees.department_id%TYPE;
sal employees.salary%TYPE;
avg_sal employees.salary%TYPE;
BEGIN
SELECT salary,department_id INTO sal,dept_id FROM employees
WHERE employee_id=empno;
SELECT avg(salary) INTO avg_sal FROM employees WHERE department_id=dept_id;
IF sal > avg_sal THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
END;
| true
|
0d9172e3fe4d7eba8b2aab0dbc64fbac93fa97ab
|
SQL
|
AldythNahak/Java-Persistence-API
|
/db_kampus.sql
|
UTF-8
| 1,259
| 2.765625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 24, 2017 at 02:48 PM
-- Server version: 5.5.24-log
-- PHP Version: 5.4.3
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: `db_kampus`
--
-- --------------------------------------------------------
--
-- Table structure for table `tb_mahasiswa`
--
CREATE TABLE IF NOT EXISTS `tb_mahasiswa` (
`nim` int(11) NOT NULL,
`nama` varchar(50) NOT NULL,
`progdi` varchar(30) NOT NULL,
PRIMARY KEY (`nim`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tb_mahasiswa`
--
INSERT INTO `tb_mahasiswa` (`nim`, `nama`, `progdi`) VALUES
(672015001, 'Joko', 'Teknik Informatika'),
(672015002, 'Susanto', 'Teknik Informatika'),
(672015003, 'Ika', 'Teknik Informatika');
/*!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 */;
| true
|
0394c18842d5ba6cdff119841ff7a50ae6021bb6
|
SQL
|
ibismurilloa/CIO
|
/SCRIPTCRISTIAN.sql
|
ISO-8859-10
| 4,156
| 3.65625
| 4
|
[] |
no_license
|
CREATE DATABASE DB_CIO
USE DB_CIO
--TABLA CAMIONERO CREADA POR CRISTIAN RIVERA MUOZ
CREATE TABLE CAMIONERO
(
CED_CAMIONERO VARCHAR(20) PRIMARY KEY,
NOMBRE VARCHAR(20),
APELLIDO VARCHAR(20),
TELEFONO VARCHAR(20),
DIRECCION VARCHAR(20),
SALARIO FLOAT
)
--TABLA CAMIONES CREADA POR CRISTIAN RIVERA MUOZ
CREATE TABLE CAMIONES
(
MATRICULA VARCHAR(20) PRIMARY KEY,
CED_CAMIONERO VARCHAR(20),
POTENCIA VARCHAR(10),
MODELO VARCHAR(15),
TIPO VARCHAR(20)
)
--CREACION DE LA LLAVE FORANEA A CAMIONERO CRISTIAN RIVERA MUOZ
ALTER TABLE CAMIONES
ADD CONSTRAINT FK_CAMIONES_CED_CAMINERO_CAMIONERO_CED_CAMIONERO
FOREIGN KEY(CED_CAMIONERO)
REFERENCES CAMIONERO (CED_CAMIONERO)
--PRUEBA DE FORANEA CRISTIAN RIVERA MUOZ
SELECT * FROM CAMIONERO, CAMIONES WHERE CAMIONERO.CED_CAMIONERO='10045'
--PROCEDIMIENTO DE GUARDAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP_GUARDAR_CAMIONERO
@CED_CAMIONERO VARCHAR(20),
@NOMBRE VARCHAR(20),
@APELLIDO VARCHAR(20),
@TELEFONO VARCHAR(20),
@DIRECCION VARCHAR(20),
@SALARIO VARCHAR(20)
AS
BEGIN
INSERT INTO CAMIONERO(CED_CAMIONERO,NOMBRE,APELLIDO,TELEFONO,DIRECCION,SALARIO)
VALUES(@CED_CAMIONERO,@NOMBRE,@APELLIDO,@TELEFONO,@DIRECCION,@SALARIO)
END
EXECUTE USP_GUARDAR_CAMIONERO '100','PEPO','RAMIREZ','121212','C14#45-45','100025'
EXECUTE USP_GUARDAR_CAMIONERO '10045','LUCA','MUOZ','1245454','C24#44-95','12121100025'
EXECUTE USP_GUARDAR_CAMIONERO '1045','LUCAS','PEREZ','1245454','C24#90-95','1214545848'
SELECT * FROM CAMIONERO
--PROCEDIMIENTO DE GUARDAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP_GUARDAR_CAMIONES
@MATRICULA VARCHAR(10),
@CED_CAMIONERO VARCHAR(20),
@POTENCIA VARCHAR(10),
@MODELO VARCHAR(15),
@TIPO VARCHAR(20)
AS
BEGIN
INSERT INTO CAMIONES(MATRICULA,CED_CAMIONERO,POTENCIA,MODELO,TIPO)
VALUES(@MATRICULA,@CED_CAMIONERO,@POTENCIA,@MODELO,@TIPO)
END
EXECUTE USP_GUARDAR_CAMIONES '100A2','10045','25CV','VOLVO 2015','DOBLE TROQUE'
--PROCEDIMIENTO DE ACTUALIZAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP_ACTUALIZAR_CAMIONERO
@CED_CAMIONERO VARCHAR(20),
@NOMBRE VARCHAR(20),
@APELLIDO VARCHAR (20),
@TELEFONO VARCHAR(20),
@DIRECCION VARCHAR(20),
@SALARIO VARCHAR(20)
AS
BEGIN
UPDATE CAMIONERO SET NOMBRE=@NOMBRE,APELLIDO=@APELLIDO,TELEFONO=@TELEFONO,DIRECCION=@DIRECCION,SALARIO=@SALARIO
WHERE CED_CAMIONERO=@CED_CAMIONERO
END
EXECUTE USP_ACTUALIZAR_CAMIONERO '100','PEDRO','RODRIGUEZ','121212','C14#45-45','100025'
--PROCEDIMIENTO DE ACTUALIZAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP__ACTULIZAR_CAMIONES
@MATRICULA VARCHAR(20),
@CED_CAMIONERO VARCHAR(20),
@POTENCIA VARCHAR(10),
@MODELO VARCHAR(15),
@TIPO VARCHAR(20)
AS
BEGIN
UPDATE CAMIONES SET CED_CAMIONERO=@CED_CAMIONERO,POTENCIA=@POTENCIA,MODELO=@MODELO,TIPO=@TIPO
WHERE MATRICULA=@MATRICULA
END
EXECUTE USP__ACTULIZAR_CAMIONES '100A2','100','25CV','VOLVO 2015','DOBLE TROQUE'
--PROCEDIMIENTO DE ELIMINAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP_ELIMINAR_CAMIONERO
@CED_CAMIONERO VARCHAR(20)
AS
BEGIN
DELETE FROM CAMIONERO WHERE CED_CAMIONERO=@CED_CAMIONERO
END
EXECUTE USP_ELIMINAR_CAMIONERO '1045'
--PROCEDIMIENTO DE ELIMINAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP_ELIMINAR_CAMIONES
@MATRICULA VARCHAR(20)
AS
BEGIN
DELETE FROM CAMIONES WHERE MATRICULA=@MATRICULA
END
EXECUTE USP_ELIMINAR_CAMIONES '100A2'
--PROCEDIMIENTO DE CONSULTAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP_CONSULTAR_CAMIONERO
@CED_CAMIONERO VARCHAR(20)
AS
BEGIN
SELECT * FROM CAMIONERO WHERE CED_CAMIONERO=@CED_CAMIONERO
END
EXECUTE USP_CONSULTAR_CAMIONERO '10045'
--PROCEDIMIENTO DE CONSULTAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP_CONSULTAR_CAMIONES
@MATRICULA VARCHAR(20)
AS
BEGIN
SELECT * FROM CAMIONES WHERE MATRICULA=@MATRICULA
END
EXECUTE USP_CONSULTAR_CAMIONES '100A2'
--PROCEDIMIENTO DE LISTAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP_LISTIAR_CAMIONERO
AS
BEGIN
SELECT NOMBRE,SALARIO FROM CAMIONERO
END
EXECUTE USP_LISTIAR_CAMIONERO
--PROCEDIMIENTO DE LISTAR CREADA POR CRISTIAN RIVERA MUOZ
CREATE PROCEDURE USP_LISTAR_CAMIONES
AS
BEGIN
SELECT * FROM CAMIONES
END
EXECUTE USP_LISTAR_CAMIONES
| true
|
12f0e33ba9f69da7655bc49dacc5b72bc2e0512a
|
SQL
|
Yundnir/Projeto-Vaccinus
|
/backup/Projeto_PI_Grupo_11_Vaccinus.sql
|
UTF-8
| 2,925
| 3.359375
| 3
|
[] |
no_license
|
create database dbVacina;
use dbVacina;
create table tbUsuario (
idUsuario int primary key auto_increment,
nome varchar (50),
email varchar (40),
telefone char (12),
cnpj char (18),
senha varchar (100)
);
insert into tbUsuario (nome, email, telefone, cnpj, senha) values
('Renato Paulino', 'renato.paulino@bandtec.com.br', '1199999-9990', '92.754.738/0001-62', 'qualquercoisa0' ),
('Priscila Choi', 'priscila.choi@bandtec.com.br', '1199999-9991', '31.435.813/0001-38', 'qualquercoisa1'),
('Nicolas Carvalho', 'nicolas.carvalho@bandtec.com.br', '1199999-9992', '78.654.450/0001-95', 'qualquercoisa2'),
('Andre Santos', 'andre.santos@bandtec.com.br', '1199999-9993', '88.823.133/0001-09', 'qualquercoisa3'),
('Matheus Daniel', 'matheus.boaventura@bandtec.com.br', '1199999-9994', '72.330.495/0001-28', 'qualquercoisa4'),
('Guilherme Santos', 'guilherme.santos@bandtec.com.br', '1199999-9995', '92.754.738/0001-62', 'qualquercoisa5');
-- Tabela de transporte/destino para onde a vacina está sendo encaminhada
create table tbDestino (
idDestino int primary key auto_increment,
partida varchar (50),
destino varchar (50)
);
insert into tbDestino (partida, destino) values
('São Paulo/SP', 'Rio Grande/AC'),
('Rio de Janeiro/RJ', 'Porto Alegre/RS'),
('São Paulo/SP', 'Osasco/SP'),
('Campina Grande/PB', 'Belem/PA');
create table tbControleTemp (
idControleTemp int primary key auto_increment,
sobre_temperatura varchar (8),
abaixo_temperatura varchar (8)
);
insert into tbControleTemp values (null,'10°C', '-6°C'),
(null,'9°C', '-3°C'),
(null,'12°C', '-3,5°C'),
(null,'8°C', '-7°C');
create table tbContainerTemp ( -- ACRESCENTAR A CHAVE ESTRANGEIRA
idContainer int primary key auto_increment,
datahora varchar (30),
temperatura varchar (7),
fkUsuario int,
fkControleTemp int,
foreign key (fkUsuario) references tbUsuario (idUsuario),
foreign key (fkControleTemp) references tbControleTemp (idControleTemp)
);
insert into tbContainerTemp (datahora, temperatura, fkUsuario, fkControleTemp) values
('01/10/2020 12:00', '3ºC', 1, 3),
('02/10/2020 13:00', '4ºC', 2, 2),
('03/10/2020 14:00', '2,5ºC', 3, 4),
('04/10/2020 14:30', '3,25ºC', 5, 1);
create table tbVacinas (
idVacina int primary key auto_increment,
nomeVacina varchar(60),
datahora date,
loteVacina varchar(20),
fkDestino int,
fkContainerTemp int,
foreign key (FkDestino) references tbDestino (idDestino),
foreign key (fkContainerTemp) references tbContainerTemp (idContainer)
);
insert into tbVacinas(nomeVacina, datahora, loteVacina, fkDestino, fkContainerTemp) values
('Febre Amarela', '2020/10/09', '149VPOO', 2, 3),
('H1N1', '2020/10/12', '150VPOO', 3, 1),
('Sarampo', '2020/01/09', '151VPOO', 4, 2);
select * from tbVacinas;
-- Tabela de Relatório - Registro (máxima e mínima)
-- Tabela de temperatura no tempo real dentro do Container
select * from tbContainerTemp;
select * from tbUsuario;
select * from tbContainerTemp;
select * from tbControleTemp;
select * from tbDestino;
desc tbDestino;
| true
|
90c6ec1979ab1f4d6919e10b65a4432749e825d2
|
SQL
|
katyush0611/PHP-school-project
|
/public/php-project.sql
|
UTF-8
| 5,567
| 3.390625
| 3
|
[
"MIT"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 27, 2018 at 07:51 PM
-- 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: `php-project`
--
-- --------------------------------------------------------
--
-- Table structure for table `courses`
--
CREATE TABLE `courses` (
`id` int(4) NOT NULL,
`name` varchar(60) DEFAULT NULL,
`img` varchar(250) DEFAULT NULL,
`description` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `courses`
--
INSERT INTO `courses` (`id`, `name`, `img`, `description`) VALUES
(4875, 'JAVA ', 'java.png', 'Java is a general-purpose computer-programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers \"write once, run anywhere\" (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.'),
(6933, ' PHP', 'phplogo.png', 'Hypertext Preprocessor (or simply PHP) is a server-side scripting language designed for web development but also used as a general-purpose programming language.'),
(7825, 'JS', '5b0aee9c1ba232.09099072.png', 'high-level, interpreted programming language. It is a language which is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm. As a multi-paradigm language, JavaScript supports event-driven, functional, and imperative programming styles.'),
(8223, 'css 3', 'csslogo.png', 'Cascading Style Sheets - is a style sheet language used for describing the presentation of a document written in a markup language like HTML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.'),
(9841, 'SQL', '5b0aef92118254.58459017.png', 'Structured Query Language - is a domain-specific language used in programming and designed for managing data held in a relational database management system, or for stream processing in a relational data stream management system . It is particularly useful in handling structured data where there are relations between different entities/variables of the data.');
-- --------------------------------------------------------
--
-- Table structure for table `exchange`
--
CREATE TABLE `exchange` (
`course_id` int(4) DEFAULT NULL,
`student_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `exchange`
--
INSERT INTO `exchange` (`course_id`, `student_id`) VALUES
(4875, 93),
(6933, 94),
(9841, 94),
(4875, 94),
(7825, 95),
(6933, 95),
(8223, 96),
(7825, 96),
(7825, 97),
(9841, 97),
(4875, 97),
(6933, 98),
(7825, 98),
(9841, 98),
(4875, 98);
-- --------------------------------------------------------
--
-- Table structure for table `premissions`
--
CREATE TABLE `premissions` (
`premission` varchar(60) NOT NULL,
`name` varchar(60) NOT NULL,
`username` varchar(20) NOT NULL,
`password` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `premissions`
--
INSERT INTO `premissions` (`premission`, `name`, `username`, `password`) VALUES
('principal', 'Mr.Oscar', 'oscarbaby', 12345),
('sales', 'Vika Lepos', 'vikvik', 54321),
('teacher', 'Gary Bruce', 'garyy', 99999);
-- --------------------------------------------------------
--
-- Table structure for table `students`
--
CREATE TABLE `students` (
`id` int(11) NOT NULL,
`name` varchar(60) DEFAULT NULL,
`img` varchar(250) DEFAULT NULL,
`phone` varchar(10) NOT NULL,
`email` varchar(60) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `students`
--
INSERT INTO `students` (`id`, `name`, `img`, `phone`, `email`) VALUES
(93, 'Shani', '5b0aebd546dfe6.35302215.png', '0544456789', 'shani1010@gmail.com'),
(94, 'Mark', '5b0aec060d9fe5.51124092.png', '0502745689', '1mark1@mail.ru'),
(95, 'Ron', '5b0aec2d1b5c27.77545188.png', '0528256295', 'roooon123@walla.com'),
(96, 'Shelly', '5b0aec69bda2a3.20833328.png', '0548760912', 'shon@gmail.com'),
(97, 'Nataly', '5b0aec8ec94b82.03468949.png', '0504567889', 'sofovsds@gmail.com'),
(98, 'Shon', '5b0aeccd64e9d8.74153291.png', '0522745328', 'oscarar@walla.com');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `courses`
--
ALTER TABLE `courses`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `exchange`
--
ALTER TABLE `exchange`
ADD KEY `course_id` (`course_id`),
ADD KEY `student_id` (`student_id`);
--
-- Indexes for table `students`
--
ALTER TABLE `students`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=99;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `exchange`
--
ALTER TABLE `exchange`
ADD CONSTRAINT `exchange_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`),
ADD CONSTRAINT `exchange_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
4e76cda4ff089374fcd44ebd32929c7c1ddf8755
|
SQL
|
hanbomal/BOMALpro
|
/WebContent/sql/study_relation.sql
|
UTF-8
| 323
| 2.5625
| 3
|
[] |
no_license
|
DROP table studyrelation PURGE ;
CREATE table studyrelation(
memberId VARCHAR2(100) ,
studyName VARCHAR2(100) ,
joinPoint INT,
nickName VARCHAR2(100) ,
joinDate DATE NOT NULL ,
lastDate DATE NOT NULL ,
position VARCHAR2(100),
leader VARCHAR2(100),
status INT
);
SELECT *
FROM studyrelation;
| true
|
42d90d7692d0976439d1ed7123327c1cc7834240
|
SQL
|
CUBRID/cubrid-testcases
|
/sql/_17_sql_extension2/_02_full_test/_05_date_time_function/_02_year/cases/year_007.sql
|
UTF-8
| 1,672
| 2.671875
| 3
|
[
"BSD-3-Clause"
] |
permissive
|
--pass out-of-range data of string type to the parameter
--1. [error] out-of-range argument: date type
select year(date'13/11/1989');
select year(date'05/33/1901');
select year(date'2/20/10000');
select year(date'0-1-1');
select year(date'1999-04-31');
select year(date'03-02-31');
--2. [error] out-of-range argument: timestamp type
select year(timestamp'23:00:00 13/01');
select year(timestamp'04:14:07 1/19/2038');
select year(timestamp'03:15:07 1/19/2038');
select year(timestamp'03:14:08 1/19/2038');
select year(timestamp'03:14:07 2/19/2038');
select year(timestamp'03:14:07 1/20/2038');
select year(timestamp'03:14:07 1/19/2039');
--??
select year(timestamp'03:14:07 PM 1/19/2038');
select year(timestamp'0:0:0 PM 1969-01-01');
select year(timestamp'11:03:22 PM 1864-01-23');
select year(timestamp'2300-12-12 22:02:33');
select year(timestamp'2020-23-11 03:14:66 pm');
select year(timestamp'1970-10-101 0:0');
select year(timestamp'1999/12/11 3:14:7 am');
select year(timestamp'2010-4-31 3:14:7 am');
--3. [error] out-of-range argument: datetime type
select year(datetime'2010-10 10:10:100:00 am');
select year(datetime'24:59:59:999 12/31/9999');
select year(datetime'23:60:59:999 12/31/9999');
select year(datetime'23:59:60:999 12/31/9999');
select year(datetime'23:59:59:1000 12/31/9999');
select year(datetime'23:59:59:999 13/31/9999');
select year(datetime'23:59:59:999 12/32/9999');
select year(datetime'23:59:59:999 12/31/10000');
select year(datetime'20:33:61:111 1990-10-19 ');
select year(datetime'2/31/2022 10:20:30:400');
select year(datetime'12/31/9999 23:59:59:999');
select year(datetime'0-12-12 23:59:59:999');
| true
|
29088f8801eb0a26c3feba60506e2db29ce62e53
|
SQL
|
bogiesoft/YiiHotelReservation
|
/protected/modules/openbooking/data/yii-booking-th.sql
|
UTF-8
| 6,826
| 3.46875
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 04, 2015 at 12:47 PM
-- Server version: 5.6.12-log
-- PHP Version: 5.4.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_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `res`
--
CREATE DATABASE IF NOT EXISTS `res` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `res`;
-- --------------------------------------------------------
--
-- Table structure for table `reservation`
--
CREATE TABLE IF NOT EXISTS `reservation` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`roomid` bigint(20) NOT NULL COMMENT 'เลขที่ห้อง',
`datefrom` date NOT NULL COMMENT 'เข้าพัก',
`numberofnights` smallint(6) NOT NULL COMMENT 'คืนที่พัก',
`dateto` date NOT NULL COMMENT 'คืนห้อง',
`onlinepayment` int(11) NOT NULL COMMENT 'ชำระเงิน Online',
`confirmreservation` int(11) NOT NULL COMMENT 'ยืนยันการจอง',
`roomsavailable` int(11) NOT NULL COMMENT 'ห้องว่าง',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ข้อมูลการจอง' AUTO_INCREMENT=5 ;
--
-- Dumping data for table `reservation`
--
INSERT INTO `reservation` (`id`, `roomid`, `datefrom`, `numberofnights`, `dateto`, `onlinepayment`, `confirmreservation`, `roomsavailable`) VALUES
(1, 101, '2015-01-04', 5, '2015-01-09', 500, 1, 2),
(2, 102, '2015-01-04', 2, '2015-01-06', 500, 1, 2),
(3, 101, '2015-01-03', 1, '2015-01-04', 500, 1, 1),
(4, 101, '2015-01-05', 1, '2015-01-06', 500, 0, 1);
-- --------------------------------------------------------
--
-- Table structure for table `reservationdetails`
--
CREATE TABLE IF NOT EXISTS `reservationdetails` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`reservationid` int(11) NOT NULL COMMENT 'รหัสรายการ',
`title` varchar(15) NOT NULL COMMENT 'คำนำหน้าชื่อ',
`firstname` varchar(255) NOT NULL COMMENT 'ชื่อ',
`lastname` varchar(255) NOT NULL COMMENT 'นามสกุล',
`contactnumber` varchar(20) CHARACTER SET latin1 NOT NULL COMMENT 'เบอร์ติดต่อ',
`emailaddress` varchar(255) CHARACTER SET latin1 NOT NULL COMMENT 'Email',
`postaddress` varchar(255) NOT NULL COMMENT 'ที่อยู่ทางไปรษณีย์',
`city` varchar(255) NOT NULL COMMENT 'จังหวัด',
`county` varchar(255) NOT NULL,
`country` varchar(255) NOT NULL COMMENT 'ประเทศ',
`postcode` varchar(10) CHARACTER SET latin1 NOT NULL COMMENT 'รหัสไปรษณีย์',
`otherinfo` varchar(255) NOT NULL COMMENT 'ข้อมูลเสริม',
PRIMARY KEY (`id`),
KEY `reservationid` (`reservationid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='รายละเอียดการจอง' AUTO_INCREMENT=4 ;
--
-- Dumping data for table `reservationdetails`
--
INSERT INTO `reservationdetails` (`id`, `reservationid`, `title`, `firstname`, `lastname`, `contactnumber`, `emailaddress`, `postaddress`, `city`, `county`, `country`, `postcode`, `otherinfo`) VALUES
(1, 1, 'นาย', 'ทรงวุฒิ', 'กาญจนโกศัย', '083-949-5153', 'songwutk@gmail.com', '169/9 ถ.ร่องซ้อ', 'ในเวียง', 'เมือง ', 'แพร่', '54000', 'แปะก่อนนะ'),
(2, 2, 'นาย', 'พิสูทธิ์', 'สุริยะวงศ์', '083-949-5154', 'qingxi.cartoon@gmail.com', '169/9 ถ.ร่องซ้อ', 'ในเวียง', 'เมือง', 'แพร่', '54000', ''),
(3, 3, 'น.ส', 'สุภาพ', 'สุริยะวงศ์', '08-5242-2255', 'maenongc@gmail.com', '169/9 ถ.ร่องซ้อ', 'ในเวียง', 'เมือง', 'แพร่', '54000', '');
-- --------------------------------------------------------
--
-- Table structure for table `roomcharge`
--
CREATE TABLE IF NOT EXISTS `roomcharge` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`roomid` int(11) NOT NULL COMMENT 'เลขที่ห้อง',
`price` int(11) NOT NULL COMMENT 'ราคา',
PRIMARY KEY (`id`),
KEY `roomid` (`roomid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='อัตราค่าที่พัก' AUTO_INCREMENT=3 ;
--
-- Dumping data for table `roomcharge`
--
INSERT INTO `roomcharge` (`id`, `roomid`, `price`) VALUES
(1, 101, 500),
(2, 102, 500);
-- --------------------------------------------------------
--
-- Table structure for table `roomdetails`
--
CREATE TABLE IF NOT EXISTS `roomdetails` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`roomid` int(11) NOT NULL COMMENT 'เลขที่ห้อง',
`description` varchar(128) NOT NULL COMMENT 'ข้อมูลเสริม',
PRIMARY KEY (`id`),
KEY `roomid` (`roomid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ข้อมูลห้อง' AUTO_INCREMENT=3 ;
--
-- Dumping data for table `roomdetails`
--
INSERT INTO `roomdetails` (`id`, `roomid`, `description`) VALUES
(1, 101, 'เตียงคู่'),
(2, 102, 'เตียงคู่');
-- --------------------------------------------------------
--
-- Table structure for table `roomtype`
--
CREATE TABLE IF NOT EXISTS `roomtype` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`description` varchar(128) NOT NULL COMMENT 'ประเภท',
`quantity` int(11) NOT NULL COMMENT 'จำนวน',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ประเภทห้อง' AUTO_INCREMENT=103 ;
--
-- Dumping data for table `roomtype`
--
INSERT INTO `roomtype` (`id`, `description`, `quantity`) VALUES
(101, 'ห้องธรรมดา ชั้น 1', 2),
(102, 'ห้องธรรมดา ชั้น 2', 1);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `reservationdetails`
--
ALTER TABLE `reservationdetails`
ADD CONSTRAINT `reservationdetails_ibfk_3` FOREIGN KEY (`reservationid`) REFERENCES `reservation` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `roomcharge`
--
ALTER TABLE `roomcharge`
ADD CONSTRAINT `roomcharge_ibfk_1` FOREIGN KEY (`roomid`) REFERENCES `roomtype` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `roomdetails`
--
ALTER TABLE `roomdetails`
ADD CONSTRAINT `roomdetails_ibfk_1` FOREIGN KEY (`roomid`) REFERENCES `roomtype` (`id`) ON DELETE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true
|
29efb553bf11d716843083ffa65706e7005b5a51
|
SQL
|
AnnBond/MyFirstBlog-MFB-
|
/post.sql
|
UTF-8
| 6,579
| 2.859375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.4.15.5
-- http://www.phpmyadmin.net
--
-- Хост: 127.0.0.1:3306
-- Время создания: Авг 02 2017 г., 23:55
-- Версия сервера: 5.5.48
-- Версия PHP: 5.4.45
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 */;
--
-- База данных: `blog_project`
--
-- --------------------------------------------------------
--
-- Структура таблицы `post`
--
CREATE TABLE IF NOT EXISTS `post` (
`id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `post`
--
INSERT INTO `post` (`id`, `title`, `description`, `date`) VALUES
(25, 'post 4', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(26, 'post 5', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(27, 'post 6', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(28, 'post 7', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(29, 'post 8', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(30, 'post 9', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(31, 'Post 10', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(32, 'Post 11', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(33, 'Post 12', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(34, 'post 13', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(35, 'Post 14', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(36, 'post 15', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(37, 'post 16', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(38, 'post 17', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(39, 'post 18', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30'),
(40, 'post 19', '19è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un te', '2017-07-30'),
(41, 'post 20', 'è un testo segnaposto utilizzato nel settore della tipografia e della stampa. Lorem Ipsum è considerato il testo segnaposto standard sin dal sedicesimo secolo, quando un anonimo tipografo prese una cassetta di caratteri e li assemblò per preparare un test', '2017-07-30');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `post`
--
ALTER TABLE `post`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `post`
--
ALTER TABLE `post`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=60;
/*!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 */;
| true
|
eed23a86c93851f93113309bd433d09b27864bad
|
SQL
|
ipsdileeprakesh/PG-Practices
|
/March_10.SQL
|
UTF-8
| 355
| 2.828125
| 3
|
[] |
no_license
|
SQL
---
1. Demonstrate the usage of GROUP BY in SQL
2. Demonstrate the usage of ORDER BY in SQL
3. Demonstrate the usage of simple join between 3 tables
4. Create a table with Primary key and demonstrate the constraint violation
PostgreSQL
----------
1. How to find the OS uptime and PostgreSQL uptime
2. Display top 10 Biggest tables in my database
| true
|
87a3ead64469a76ca295285f8f817467d319d0aa
|
SQL
|
yefc/CBOE
|
/subprojects/Classic/ChemInv/config/oracle_install_scripts/Create_blank_ChemInv_DB/sql/Create/Create_Synonyms.sql
|
UTF-8
| 4,575
| 2.71875
| 3
|
[] |
no_license
|
-- Copyright Cambridgesoft Corp 2001-2006 all rights reserved
--#########################################################
-- Create schema views
--#########################################################
connect &&InstallUser/&&sysPass@&&serverName
prompt '#########################################################'
prompt 'Creating synonyms ...'
prompt '#########################################################'
DECLARE
PROCEDURE createSynonym(synName IN varchar2) IS
n NUMBER;
BEGIN
select count(*) into n from dba_synonyms where Upper(synonym_name) = synName;
if n = 0 then
execute immediate 'CREATE PUBLIC SYNONYM ' || synName || ' FOR &&schemaName..' || synName;
end if;
END createSynonym;
BEGIN
createSynonym('INV_UNITS');
createSynonym('INV_UNIT_TYPES');
createSynonym('INV_UNIT_CONVERSION');
createSynonym('INV_COMPOUNDS');
createSynonym('INV_SYNONYMS');
createSynonym('INV_CONTAINERS');
createSynonym('INV_LOCATIONS');
createSynonym('INV_LOCATION_TYPES');
createSynonym('INV_CONTAINER_TYPES');
createSynonym('INV_SUPPLIERS');
createSynonym('INV_PHYSICAL_STATE');
createSynonym('INV_CONTAINER_STATUS');
createSynonym('INV_RESERVATIONS');
createSynonym('INV_RESERVATION_TYPES');
createSynonym('INV_API_ERRORS');
createSynonym('INV_GRID_FORMAT');
createSynonym('INV_GRID_FILL_TEMPLATE');
createSynonym('INV_GRID_POSITION');
createSynonym('INV_GRID_STORAGE');
createSynonym('INV_GRID_ELEMENT');
createSynonym('INV_ENUMERATION');
createSynonym('INV_ENUMERATION_SET');
createSynonym('INV_ESET_TYPE');
createSynonym('INV_ENUM_VALUES');
createSynonym('INV_PHYSICAL_PLATE');
createSynonym('INV_PLATE_FORMAT');
createSynonym('INV_PLATE_TYPES');
createSynonym('INV_PLATES');
createSynonym('INV_PLATE_HISTORY');
createSynonym('INV_PLATE_ACTIONS');
createSynonym('INV_WELLS');
createSynonym('INV_WELL_COMPOUNDS');
createSynonym('INV_ALLOWED_CTYPES');
createSynonym('INV_ALLOWED_LTYPES');
createSynonym('INV_ALLOWED_PTYPES');
createSynonym('INV_BARCODE_DESC');
createSynonym('INV_REQUESTS');
createSynonym('INV_SOLVENTS');
createSynonym('INV_REPORTTYPES');
createSynonym('INV_CONTAINER_ORDER');
createSynonym('CUSTOM_CHEM_ORDER');
createSynonym('CUSTOM_ACX_ST_VENDORS');
createSynonym('INV_CONTAINER_ORDER_REASON');
createSynonym('INV_EHS_CAS_SUBSTANCE');
createSynonym('INV_EHS_CATNUM_SUBSTANCE');
createSynonym('INV_EHS_SUBSTANCES');
createSynonym('INV_EXCLUDE_CONTAINER_TYPES');
createSynonym('INV_OWNERS');
createSynonym('INV_PICKLISTS');
createSynonym('INV_PROJECT_JOB_INFO');
createSynonym('INV_URL');
createSynonym('INV_XMLDOCS');
createSynonym('INV_XMLDOC_TYPES');
createSynonym('INV_XSLTS');
createSynonym('INV_WELL_PARENT');
createSynonym('INV_PLATE_PARENT');
createSynonym('INV_COUNTRY');
createSynonym('INV_STATES');
createSynonym('INV_ADDRESS');
createSynonym('INV_REQUEST_TYPES');
createSynonym('INV_REQUEST_STATUS');
createSynonym('INV_REQUEST_SAMPLES');
createSynonym('INV_ORDER_STATUS');
createSynonym('INV_ORDERS');
createSynonym('INV_ORDER_CONTAINERS');
createSynonym('INV_PLATE_PARENT');
createSynonym('INV_WELL_PARENT');
createSynonym('INV_WELL_COMPOUNDS');
createSynonym('INV_DATA_MAPS');
createSynonym('INV_DATA_MAPPINGS');
createSynonym('INV_MAP_FIELDS');
createSynonym('INV_GRAPHICS');
createSynonym('INV_GRAPHIC_TYPES');
createSynonym('INV_CONTAINER_BATCHES');
createSynonym('INV_UNIT_CONVERSION_FORMULA');
createSynonym('INV_DOCS');
createSynonym('INV_DOC_TYPES');
createSynonym('INV_ORG_UNIT');
createSynonym('INV_ORG_ROLES');
createSynonym('INV_ORG_USERS');
createSynonym('INV_BATCH_STATUS');
createSynonym('INV_LABEL_PRINTERS');
createSynonym('INV_LPR_DEFINITION');
-- CREATE VIEW SYNONYMS
createSynonym('INV_VW_PHYSICAL_PLATE');
createSynonym('INV_VW_PLATE_FORMAT');
createSynonym('INV_VW_WELL_FORMAT');
createSynonym('INV_VW_WELL_FLAT');
createSynonym('INV_VW_PLATE');
createSynonym('INV_VW_WELL');
createSynonym('INV_VW_GRID_LOCATION');
createSynonym('INV_VW_GRID_LOCATION_PARENT');
createSynonym('INV_VW_ENUMERATED_VALUES');
createSynonym('INV_VW_PLATE_LOCATIONS');
createSynonym('INV_VW_NONGRID_LOCATIONS');
createSynonym('INV_VW_PLATE_GRID_LOCATIONS');
createSynonym('INV_VW_PLATE_HISTORY');
createSynonym('INV_VW_PLATE_LOCATIONS_ALL');
createSynonym('INV_VW_GRID_LOCATION_LITE');
createSynonym('INV_VW_REG_BATCHES');
createSynonym('INV_VW_REG_STRUCTURES');
createSynonym('INV_VW_REG_ALTIDS');
createSynonym('INV_VW_COMPOUNDS');
END;
/
| true
|
710382758f544f722103014418b166735f675e1d
|
SQL
|
sirikon-experiments/metatype-orm
|
/docker/metatype-devenv/sql/initial_schema.sql
|
UTF-8
| 202
| 2.71875
| 3
|
[
"MIT"
] |
permissive
|
CREATE TABLE "events" (
id serial PRIMARY KEY,
name VARCHAR (255) NOT NULL,
active BOOLEAN NOT NULL
);
INSERT INTO "events" (name, active) values ('Txalaparta', true), ('Kalejira', false);
| true
|
b178e74bf80328f552c3d34afd6e701a4e8df95b
|
SQL
|
shuyiz666/covid19-vaccine-availability-tracker
|
/query.sql
|
UTF-8
| 656
| 4.125
| 4
|
[] |
no_license
|
-- number of shaws and starkmarket
SELECT Store, COUNT(*)
FROM BI
GROUP BY Store
-- percentage of store could be scheduled for each store brand
SELECT Availability, COUNT(*)
FROM BI
WHERE Store = 'Star Market'
GROUP BY Availability
SELECT Availability, COUNT(*)
FROM BI
WHERE Store = 'Shaws'
GROUP BY Availability
-- the schedule availability in each city
SELECT *, (x.Available_Count*1.00)/(x.Total_Count*1.00)*100 AS availability_rate
FROM
(SELECT City,
SUM(CASE WHEN Availability LIKE '%Availability%' THEN 1 ELSE 0 END) AS Available_Count,
COUNT(*) AS Total_Count
FROM BI
GROUP BY City) x
ORDER BY x.Available_Count/x.Total_Count DESC
| true
|
48e2f2de18b6cb39d3d720955b5c8bca229ad93b
|
SQL
|
WalkingInTheAir/ELearning
|
/ELearning/resource/e-learning.sql
|
UTF-8
| 19,805
| 3.171875
| 3
|
[] |
no_license
|
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50096
Source Host : localhost:3306
Source Database : e-learning
Target Server Type : MYSQL
Target Server Version : 50096
File Encoding : 65001
Date: 2015-07-06 21:57:37
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for tb_admin
-- ----------------------------
DROP TABLE IF EXISTS `tb_admin`;
CREATE TABLE `tb_admin` (
`admin_id` int(11) NOT NULL auto_increment,
`admin_name` varchar(11) default NULL,
`admin_number` varchar(11) default NULL,
`admin_password` varchar(11) default NULL,
PRIMARY KEY (`admin_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_admin
-- ----------------------------
INSERT INTO `tb_admin` VALUES ('1', 'ADMIN1', 'A10001', '123456');
-- ----------------------------
-- Table structure for tb_class
-- ----------------------------
DROP TABLE IF EXISTS `tb_class`;
CREATE TABLE `tb_class` (
`cls_id` int(11) NOT NULL auto_increment COMMENT '班级编号',
`cls_name` varchar(20) default NULL COMMENT '班级名称',
`f_major_id` int(11) default NULL COMMENT '专业编号',
PRIMARY KEY (`cls_id`),
KEY `f_major_id` (`f_major_id`),
CONSTRAINT `f_major_id` FOREIGN KEY (`f_major_id`) REFERENCES `tb_major` (`major_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_class
-- ----------------------------
INSERT INTO `tb_class` VALUES ('1', '软件1211', '1');
INSERT INTO `tb_class` VALUES ('2', '软件1221', '1');
INSERT INTO `tb_class` VALUES ('3', '软件1231', '1');
INSERT INTO `tb_class` VALUES ('4', '电商1211', '2');
INSERT INTO `tb_class` VALUES ('5', '电商1221', '2');
INSERT INTO `tb_class` VALUES ('6', '电商1231', '2');
INSERT INTO `tb_class` VALUES ('7', '计媒1211', '4');
INSERT INTO `tb_class` VALUES ('8', '土木1211', '37');
INSERT INTO `tb_class` VALUES ('9', '土木1221', '37');
-- ----------------------------
-- Table structure for tb_course
-- ----------------------------
DROP TABLE IF EXISTS `tb_course`;
CREATE TABLE `tb_course` (
`course_id` int(11) NOT NULL auto_increment,
`course_name` varchar(30) default NULL,
`f_ct_id` int(11) default NULL,
`f_relative_id` int(11) default NULL,
`course_desc` text,
`course_outline` text,
PRIMARY KEY (`course_id`),
KEY `course_f_ct_id` (`f_ct_id`),
CONSTRAINT `course_f_ct_id` FOREIGN KEY (`f_ct_id`) REFERENCES `tb_coursetype` (`ct_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_course
-- ----------------------------
INSERT INTO `tb_course` VALUES ('1', '毛泽东思想概论', '1', null, '一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四一二三四', null);
INSERT INTO `tb_course` VALUES ('2', '军事理论', '1', null, null, null);
INSERT INTO `tb_course` VALUES ('3', '计算机网络基础', '2', '1', '<p>计算机网络基础是一门。。。。。</p>', '<h1 label=\"标题居中\" style=\"white-space: normal; font-size: 32px; border-bottom-color: rgb(204, 204, 204); border-bottom-width: 2px; border-bottom-style: solid; padding: 0px 4px 0px 0px; text-align: center; margin: 0px 0px 20px;\">课程大纲</h1><h1 style=\"white-space: normal;\">第一章 xxx<br/></h1><h1 style=\"white-space: normal;\">第二章 xxx<br/></h1><h1 style=\"white-space: normal;\">第三章 xxx</h1><p><br/></p>');
INSERT INTO `tb_course` VALUES ('4', 'JAVA面向对象高级编程', '3', '1', null, null);
INSERT INTO `tb_course` VALUES ('5', 'JSP与SERVLET', '4', '1', null, null);
INSERT INTO `tb_course` VALUES ('7', '操作系统', '2', '1', null, null);
INSERT INTO `tb_course` VALUES ('8', '数据结构', '3', '1', null, null);
-- ----------------------------
-- Table structure for tb_coursetype
-- ----------------------------
DROP TABLE IF EXISTS `tb_coursetype`;
CREATE TABLE `tb_coursetype` (
`ct_id` int(11) NOT NULL auto_increment,
`ct_name` varchar(20) default NULL,
PRIMARY KEY (`ct_id`),
UNIQUE KEY `unique` (`ct_name`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_coursetype
-- ----------------------------
INSERT INTO `tb_coursetype` VALUES ('3', '专业课');
INSERT INTO `tb_coursetype` VALUES ('1', '公共课');
INSERT INTO `tb_coursetype` VALUES ('4', '班级专业课');
INSERT INTO `tb_coursetype` VALUES ('2', '院系公共课');
-- ----------------------------
-- Table structure for tb_coursevideo
-- ----------------------------
DROP TABLE IF EXISTS `tb_coursevideo`;
CREATE TABLE `tb_coursevideo` (
`COURSEVIDEO_ID` int(11) NOT NULL auto_increment,
`COURSEVIDEO_NAME` varchar(20) default NULL,
`COURSEVIDEO_ORIGNAME` varchar(100) default NULL,
`COURSEVIDEO_TIME` date default NULL,
`F_TEACHER_ID` int(11) default NULL,
`F_COURSE_ID` int(11) default NULL,
PRIMARY KEY (`COURSEVIDEO_ID`),
KEY `F_VIDEO_COURSE_ID` (`F_COURSE_ID`),
KEY `F_VIDEO_TEACHER_ID` (`F_TEACHER_ID`),
CONSTRAINT `F_VIDEO_COURSE_ID` FOREIGN KEY (`F_COURSE_ID`) REFERENCES `tb_course` (`course_id`),
CONSTRAINT `F_VIDEO_TEACHER_ID` FOREIGN KEY (`F_TEACHER_ID`) REFERENCES `tb_teacher` (`teacher_id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_coursevideo
-- ----------------------------
INSERT INTO `tb_coursevideo` VALUES ('10', '1431778629437.mp4', '第一章 你好.mp4', '2015-05-16', '1', '3');
INSERT INTO `tb_coursevideo` VALUES ('11', '1431778782802.mp4', 'Solo 中英字幕版 (Fang1169制)--音悦Tai.mp4', '2015-05-16', '1', '3');
-- ----------------------------
-- Table structure for tb_courseware
-- ----------------------------
DROP TABLE IF EXISTS `tb_courseware`;
CREATE TABLE `tb_courseware` (
`COURSEWARE_ID` int(11) NOT NULL auto_increment,
`COURSEWARE_NAME` varchar(20) default NULL,
`COURSEWARE_ORIGNAME` varchar(100) default NULL,
`COURSEWARE_TIME` datetime default NULL,
`F_TEACHER_ID` int(11) default NULL,
`F_COURSE_ID` int(11) default NULL,
PRIMARY KEY (`COURSEWARE_ID`),
KEY `F_COURSEWARE_TEACHER_ID` (`F_TEACHER_ID`),
KEY `F_COURSEWARE_COURSE_ID` (`F_COURSE_ID`),
CONSTRAINT `F_COURSEWARE_COURSE_ID` FOREIGN KEY (`F_COURSE_ID`) REFERENCES `tb_course` (`course_id`),
CONSTRAINT `F_COURSEWARE_TEACHER_ID` FOREIGN KEY (`F_TEACHER_ID`) REFERENCES `tb_teacher` (`teacher_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_courseware
-- ----------------------------
INSERT INTO `tb_courseware` VALUES ('1', '1431775703636.pptx', '1430320228956.pptx', '2015-05-16 19:28:23', '1', '3');
-- ----------------------------
-- Table structure for tb_department
-- ----------------------------
DROP TABLE IF EXISTS `tb_department`;
CREATE TABLE `tb_department` (
`dept_id` int(11) NOT NULL auto_increment,
`dept_name` varchar(30) default NULL COMMENT '院系表',
PRIMARY KEY (`dept_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_department
-- ----------------------------
INSERT INTO `tb_department` VALUES ('1', '计算机与软件学院');
INSERT INTO `tb_department` VALUES ('2', '机械工程学院');
INSERT INTO `tb_department` VALUES ('3', '能源与电气工程学院');
INSERT INTO `tb_department` VALUES ('4', '经济管理学院');
INSERT INTO `tb_department` VALUES ('5', '艺术设计学院');
INSERT INTO `tb_department` VALUES ('6', '文理学院');
INSERT INTO `tb_department` VALUES ('7', '社会科学部');
INSERT INTO `tb_department` VALUES ('8', '体育部');
INSERT INTO `tb_department` VALUES ('9', '国际教育学院');
INSERT INTO `tb_department` VALUES ('10', 'dasfadsf');
-- ----------------------------
-- Table structure for tb_faq
-- ----------------------------
DROP TABLE IF EXISTS `tb_faq`;
CREATE TABLE `tb_faq` (
`FAQ_ID` int(11) NOT NULL auto_increment,
`FAQ_NAME` varchar(50) default NULL,
`FAQ_ANSWER` text,
`F_COURSE_ID` int(11) default NULL,
PRIMARY KEY (`FAQ_ID`),
KEY `FAQ_F_COURSE_ID` (`F_COURSE_ID`),
CONSTRAINT `FAQ_F_COURSE_ID` FOREIGN KEY (`F_COURSE_ID`) REFERENCES `tb_course` (`course_id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_faq
-- ----------------------------
INSERT INTO `tb_faq` VALUES ('12', 'BBB', 'BBBBB', '3');
INSERT INTO `tb_faq` VALUES ('14', 'ASDFAAA', 'ASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDF', '3');
INSERT INTO `tb_faq` VALUES ('15', 'SADFASDF', 'ASDFSDAFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDF', '3');
INSERT INTO `tb_faq` VALUES ('16', 'ASDFDSAF', 'ASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDFASDFDSAFASDF', '3');
-- ----------------------------
-- Table structure for tb_major
-- ----------------------------
DROP TABLE IF EXISTS `tb_major`;
CREATE TABLE `tb_major` (
`major_id` int(11) NOT NULL auto_increment,
`major_name` varchar(20) default NULL,
`f_dept_id` int(11) default NULL,
PRIMARY KEY (`major_id`),
KEY `dept_id` (`f_dept_id`),
CONSTRAINT `dept_id` FOREIGN KEY (`f_dept_id`) REFERENCES `tb_department` (`dept_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_major
-- ----------------------------
INSERT INTO `tb_major` VALUES ('1', '软件技术', '1');
INSERT INTO `tb_major` VALUES ('2', '电子商务', '1');
INSERT INTO `tb_major` VALUES ('3', '网络技术', '1');
INSERT INTO `tb_major` VALUES ('4', '多媒体', '1');
INSERT INTO `tb_major` VALUES ('37', '土木工程', '2');
INSERT INTO `tb_major` VALUES ('38', 'asfdasf', '1');
INSERT INTO `tb_major` VALUES ('39', 'asdfadsfads', '1');
INSERT INTO `tb_major` VALUES ('40', 'affas', '1');
INSERT INTO `tb_major` VALUES ('41', 'fadf', '1');
-- ----------------------------
-- Table structure for tb_student
-- ----------------------------
DROP TABLE IF EXISTS `tb_student`;
CREATE TABLE `tb_student` (
`stu_id` int(11) NOT NULL auto_increment,
`stu_name` varchar(255) default NULL,
`stu_number` varchar(20) default NULL,
`stu_password` varchar(20) default NULL,
`f_cls_id` int(11) default NULL,
PRIMARY KEY (`stu_id`),
UNIQUE KEY `u_stu_num` (`stu_number`),
KEY `stu_f_cls_id` (`f_cls_id`),
CONSTRAINT `stu_f_cls_id` FOREIGN KEY (`f_cls_id`) REFERENCES `tb_class` (`cls_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_student
-- ----------------------------
INSERT INTO `tb_student` VALUES ('1', '张三', 'S10001', '123456', '1');
-- ----------------------------
-- Table structure for tb_teacher
-- ----------------------------
DROP TABLE IF EXISTS `tb_teacher`;
CREATE TABLE `tb_teacher` (
`teacher_id` int(11) NOT NULL auto_increment,
`teacher_number` varchar(20) NOT NULL,
`teacher_name` varchar(20) default NULL,
`teacher_password` varchar(20) default NULL,
`f_dept_id` int(11) default NULL,
PRIMARY KEY (`teacher_id`),
UNIQUE KEY `teacher_number` (`teacher_number`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_teacher
-- ----------------------------
INSERT INTO `tb_teacher` VALUES ('1', 'T10001', '文渊', '1', '1');
INSERT INTO `tb_teacher` VALUES ('2', 'T10002', '文博', 'L10002', '1');
INSERT INTO `tb_teacher` VALUES ('3', 'T10003', '张萍萍', 'T10003', '6');
INSERT INTO `tb_teacher` VALUES ('4', 'T10004', '李小丽', 'T10004', '6');
INSERT INTO `tb_teacher` VALUES ('5', 'T10005', '文昌', 'T10005', '1');
-- ----------------------------
-- Table structure for tb_teacher_course_class
-- ----------------------------
DROP TABLE IF EXISTS `tb_teacher_course_class`;
CREATE TABLE `tb_teacher_course_class` (
`tc_id` int(11) NOT NULL auto_increment,
`f_teacher_id` int(11) default NULL,
`f_course_id` int(11) default NULL,
`f_cls_id` int(11) default NULL,
PRIMARY KEY (`tc_id`),
KEY `f_teacher_id` (`f_teacher_id`),
KEY `f_course_id` (`f_course_id`),
KEY `f_cls_id` (`f_cls_id`),
CONSTRAINT `f_cls_id` FOREIGN KEY (`f_cls_id`) REFERENCES `tb_class` (`cls_id`),
CONSTRAINT `f_course_id` FOREIGN KEY (`f_course_id`) REFERENCES `tb_course` (`course_id`),
CONSTRAINT `f_teacher_id` FOREIGN KEY (`f_teacher_id`) REFERENCES `tb_teacher` (`teacher_id`)
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb_teacher_course_class
-- ----------------------------
INSERT INTO `tb_teacher_course_class` VALUES ('1', '3', '1', '1');
INSERT INTO `tb_teacher_course_class` VALUES ('2', '3', '1', '2');
INSERT INTO `tb_teacher_course_class` VALUES ('3', '3', '1', '3');
INSERT INTO `tb_teacher_course_class` VALUES ('4', '3', '1', '4');
INSERT INTO `tb_teacher_course_class` VALUES ('5', '3', '1', '5');
INSERT INTO `tb_teacher_course_class` VALUES ('6', '3', '1', '6');
INSERT INTO `tb_teacher_course_class` VALUES ('7', '3', '1', '7');
INSERT INTO `tb_teacher_course_class` VALUES ('8', '4', '2', '1');
INSERT INTO `tb_teacher_course_class` VALUES ('9', '4', '2', '2');
INSERT INTO `tb_teacher_course_class` VALUES ('10', '4', '2', '3');
INSERT INTO `tb_teacher_course_class` VALUES ('11', '4', '2', '4');
INSERT INTO `tb_teacher_course_class` VALUES ('12', '4', '2', '5');
INSERT INTO `tb_teacher_course_class` VALUES ('13', '4', '2', '6');
INSERT INTO `tb_teacher_course_class` VALUES ('14', '4', '2', '7');
INSERT INTO `tb_teacher_course_class` VALUES ('15', '1', '3', '1');
INSERT INTO `tb_teacher_course_class` VALUES ('16', '2', '3', '2');
INSERT INTO `tb_teacher_course_class` VALUES ('17', '2', '3', '3');
INSERT INTO `tb_teacher_course_class` VALUES ('18', '2', '3', '4');
INSERT INTO `tb_teacher_course_class` VALUES ('19', '2', '3', '5');
INSERT INTO `tb_teacher_course_class` VALUES ('20', '2', '3', '6');
INSERT INTO `tb_teacher_course_class` VALUES ('21', '2', '3', '7');
INSERT INTO `tb_teacher_course_class` VALUES ('22', null, '4', '1');
INSERT INTO `tb_teacher_course_class` VALUES ('23', null, '4', '2');
INSERT INTO `tb_teacher_course_class` VALUES ('24', null, '4', '3');
INSERT INTO `tb_teacher_course_class` VALUES ('26', '2', '5', '1');
INSERT INTO `tb_teacher_course_class` VALUES ('27', '3', '1', '8');
INSERT INTO `tb_teacher_course_class` VALUES ('28', '4', '2', '8');
INSERT INTO `tb_teacher_course_class` VALUES ('29', '3', '1', '9');
INSERT INTO `tb_teacher_course_class` VALUES ('30', '4', '2', '9');
INSERT INTO `tb_teacher_course_class` VALUES ('31', '5', '7', '1');
INSERT INTO `tb_teacher_course_class` VALUES ('32', '5', '7', '2');
INSERT INTO `tb_teacher_course_class` VALUES ('33', '5', '7', '3');
INSERT INTO `tb_teacher_course_class` VALUES ('34', '5', '7', '4');
INSERT INTO `tb_teacher_course_class` VALUES ('35', '5', '7', '5');
INSERT INTO `tb_teacher_course_class` VALUES ('36', '5', '7', '6');
INSERT INTO `tb_teacher_course_class` VALUES ('37', '5', '7', '7');
INSERT INTO `tb_teacher_course_class` VALUES ('38', null, '8', '1');
INSERT INTO `tb_teacher_course_class` VALUES ('39', null, '8', '2');
INSERT INTO `tb_teacher_course_class` VALUES ('40', null, '8', '3');
-- ----------------------------
-- View structure for view_class
-- ----------------------------
DROP VIEW IF EXISTS `view_class`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_class` AS select `c`.`cls_id` AS `cls_id`,`c`.`cls_name` AS `cls_name`,`m`.`major_id` AS `major_id`,`m`.`major_name` AS `major_name`,`m`.`f_dept_id` AS `dept_id`,`d`.`dept_name` AS `dept_name` from ((`tb_class` `c` join `tb_major` `m` on((`c`.`f_major_id` = `m`.`major_id`))) join `tb_department` `d` on((`m`.`f_dept_id` = `d`.`dept_id`))) ;
-- ----------------------------
-- View structure for view_student
-- ----------------------------
DROP VIEW IF EXISTS `view_student`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_student` AS select `view_class`.`cls_id` AS `cls_id`,`view_class`.`cls_name` AS `cls_name`,`view_class`.`major_id` AS `major_id`,`view_class`.`major_name` AS `major_name`,`view_class`.`dept_id` AS `dept_id`,`view_class`.`dept_name` AS `dept_name`,`tb_student`.`stu_id` AS `stu_id`,`tb_student`.`stu_name` AS `stu_name`,`tb_student`.`stu_number` AS `stu_number` from (`view_class` join `tb_student`) where (`view_class`.`cls_id` = `tb_student`.`f_cls_id`) ;
-- ----------------------------
-- View structure for view_teacher
-- ----------------------------
DROP VIEW IF EXISTS `view_teacher`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_teacher` AS select `tb_teacher`.`teacher_id` AS `teacher_id`,`tb_teacher`.`teacher_number` AS `teacher_number`,`tb_teacher`.`teacher_name` AS `teacher_name`,`tb_department`.`dept_id` AS `dept_id`,`tb_department`.`dept_name` AS `dept_name` from (`tb_teacher` join `tb_department`) where (`tb_teacher`.`f_dept_id` = `tb_department`.`dept_id`) ;
| true
|
a3d7fd78048c97cbf4028c415d6c4b086251161b
|
SQL
|
kylinsystems/idempiere-installation-script
|
/utils/chuboe_bi_init_permissions.sql
|
UTF-8
| 1,019
| 3.59375
| 4
|
[] |
no_license
|
-- The purpose of this script is to help you create views that are easily used inside a BI or analytics tool.
-- Step 1: create dedicated BI access credentials
CREATE ROLE biaccess;
GRANT USAGE ON SCHEMA adempiere TO biaccess;
ALTER USER biaccess WITH PASSWORD 'SOMEPASSWORD897';
ALTER USER biaccess WITH LOGIN;
-- Step 2: execute the view in chuboe_bi_init_views.sql file
-- Step 3: give the BIAccess role read access to BI views
-- The following SQL will generate the SQL needed to give read access to your BI views.
SELECT CONCAT('GRANT SELECT ON adempiere.', TABLE_NAME, ' to biaccess;')
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'adempiere'
AND TABLE_NAME LIKE 'bi_%'
;
---- Example of manually creating new user/role with specific permissions ----
--CREATE ROLE someuser WITH PASSWORD 'somepassword';
--GRANT USAGE ON SCHEMA adempiere TO someuser;
--GRANT SELECT ON adempiere.some_table_or_view to someuser;
--ALTER ROLE someuser SET search_path = adempiere;
--ALTER USER someuser WITH LOGIN;
| true
|
9bdc93fbb8887cb78e3e90556a38f38af52ddc7f
|
SQL
|
Roshan4u/Hadoop
|
/Hive/hivestmts.txt.sql
|
UTF-8
| 11,871
| 3.328125
| 3
|
[] |
no_license
|
CREATE DATABASE NYSE_STOCKS_DATA
WITH DBPROPERTIES('creator' = 'bhuvan','date' = '12/03/1988')
---create table general synatx
CREATE TABLE table_name(column1 datatype,column2 datatype,...........,columnn datatype)
[ROW FORMAT DELIMITED]
FIELDS TERMINATED BY _____
[COLLECTIONS TERMINATED BY ____]
[MAP KEYS TERMINATED BY ____]
[LOCATION '/location']
[WITH SERDEPROPERTIES('schema url'='http://url)']
STORED AS
[TEXTFILE,RCFILE,SEQUENCEFILE] =>default
[INPUTFORMAT 'package name']
[OUTPUTFORMAT 'package name']
[COMMENT "TABLE COMMENT"]
[TBLPROPRTTIES ('prop1' = 'value1','prop2'='value2',.....,'prop3'='value']
ALTER DATABASE NYSE_STOCKS_DATA SET DBPROPERTIES('name'='bhuvansanil','date'='12/03/1988');
--normal table
CREATE TABLE IF NOT EXISTS NYSE_TABLE (
exchange_name STRING COMMENT 'Exchange name',
symbol STRING COMMENT 'Symbol name',
date STRING COMMENT 'date',
open FLOAT COMMENT 'Open price',
high FLOAT COMMENT 'High price from open',
low FLOAT COMMENT 'Low price from open',
close FLOAT COMMENT 'close price',
volume BIGINT COMMENT 'stock volume',
avg_price FLOAT COMMENT 'average stock price')
COMMENT 'Description of table'
TBLPROPERTIES('creator'='bhuvan','creation_date'='2014-07-12');
-- complex data type table
create table collection_table2 (
name string comment 'user name',
age int comment 'user age',
subordinates array<string> comment 'subordinates under user',
salary map<string,float> comment 'salary descriptions',
address struct<dno:int,street:string,city:string> comment 'user address')
comment 'user table description'
row format delimited fields terminated by ','
collection items terminated by '|'
map keys terminated by ':'
tblproperties ('creator'='bhuvan','creation_Date'='12-03-1988');
[location]
/*
--data sample
bhuvan,26,vinu|ramu|choma|yam,pf:2000|total:60000,62|tilaknagar|banglore
panday,26,vinu|tamu|thoma|tam,pf:3000|total:70000,63|hsr|banglore
vinod,26,vids|rasdu|cafdoma|sadam,pf:12000|total:230000,62|tilaknagar|banglore*/
--data output
/*
bhuvan 26 ["vinu","ramu","choma","yam"] {"pf":2000.0,"total":60000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
panday 26 ["vinu","tamu","thoma","tam"] {"pf":3000.0,"total":70000.0} {"dno":63,"street":"hsr","city":"banglore"}
vinod 26 ["vids","rasdu","cafdoma","sadam"] {"pf":12000.0,"total":230000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
bhuvan 26 ["vinu","ramu","choma","yam"] {"pf":2000.0,"total":60000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
panday 26 ["vinu","tamu","thoma","tam"] {"pf":3000.0,"total":70000.0} {"dno":63,"street":"hsr","city":"banglore"}
vinod 26 ["vids","rasdu","cafdoma","sadam"] {"pf":12000.0,"total":230000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
bhuvan 26 ["vinu","ramu","choma","yam"] {"pf":2000.0,"total":60000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
panday 26 ["vinu","tamu","thoma","tam"] {"pf":3000.0,"total":70000.0} {"dno":63,"street":"hsr","city":"banglore"}
vinod 26 ["vids","rasdu","cafdoma","sadam"] {"pf":12000.0,"total":230000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}*/
--load data from local
load data local inpath '/home/bhuvan/collectiondata' into table collection_table2;
--load data from hdfs path
load data inpath '/home/bhuvan/collectiondata' into table collection_table2;
--describe table
describe collection_table2;
name string user name
age int user age
subordinates array<string> subordinates under user
salary map<string,float> salary descriptions
address struct<dno:int,street:string,city:string> user address
Time taken: 0.068 seconds, Fetched: 5 row(s)
--accessing array elements
select * from collection_table2 where subordinates[0] = "vinu";
--output
bhuvan 26 ["vinu","ramu","choma","yam"] {"pf":2000.0,"total":60000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
panday 26 ["vinu","tamu","thoma","tam"] {"pf":3000.0,"total":70000.0} {"dno":63,"street":"hsr","city":"banglore"}
bhuvan 26 ["vinu","ramu","choma","yam"] {"pf":2000.0,"total":60000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
-- accessing map elements
select * from collection_table2 where salary["total"] = 60000.0;
--output
bhuvan 26 ["vinu","ramu","choma","yam"] {"pf":2000.0,"total":60000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
bhuvan 26 ["vinu","ramu","choma","yam"] {"pf":2000.0,"total":60000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
bhuvan 26 ["vinu","ramu","choma","yam"] {"pf":2000.0,"total":60000.0} {"dno":62,"street":"tilaknagar","city":"banglore"}
--accessing struct elements
select * from collection_table2 where address.dno = 63;
--output
panday 26 ["vinu","tamu","thoma","tam"] {"pf":3000.0,"total":70000.0} {"dno":63,"street":"hsr","city":"banglore"}
panday 26 ["vinu","tamu","thoma","tam"] {"pf":3000.0,"total":70000.0} {"dno":63,"street":"hsr","city":"banglore"}
panday 26 ["vinu","tamu","thoma","tam"] {"pf":3000.0,"total":70000.0} {"dno":63,"street":"hsr","city":"banglore"}
--truncate table
truncate table collection_table2;
--drop table
drop table collection_table2;
-------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------
PARTITIONING TABLES
1) STATIC PARTITIONING:(virtual:field)
create table sock_partitioned_table (
exchange_name string,
company_symbol string,
stock_date string,
open_price float,
high_price float,
low_price float,
close_price float,
stock_volume bigint,
avg_price float)
partitioned by (current_date_time string)
row format delimited fields terminated by '\t';
--rename table
alter table sock_partitioned_table rename to stock_partition_table;
--describe table
exchange_name string None
company_symbol string None
stock_date string None
open_price float None
high_price float None
low_price float None
close_price float None
stock_volume bigint None
avg_price float None
current_date_time string None
# Partition Information
# col_name data_type comment
current_date_time string None
--load data into partition table
-- used shell script to get the date and append it to current_date_time
#!/bin/bash
DATE_YEST=`TZ=GMT+48 date +%Y%m%d%H%M%S`
echo $DATE_YEST
hive -S -e "load data local inpath '/home/bhuvan/pig/pigdata/NYSE_daily' into table nyse_stock_data.stock_partition_table partition(current_date_time = '$DATE_YEST');"
--sample query
select * from stock_partition_table where current_date_time = '20140712190212' limit 3;
/*OK
NYSE CLI 2009-12-31 35.39 35.7 34.5 34.57 890100 34.12 20140712190212
NYSE CLI 2009-12-30 35.22 35.46 34.96 35.4 516900 34.94 20140712190212
NYSE CLI 2009-12-29 35.69 35.95 35.21 35.34 556500 34.88 20140712190212
Time taken: 0.114 seconds, Fetched: 3 row(s)
--select company_symbol,sum(open_price) from stock_partition_table group by company_symbol,current_date_time limit 5;
CA 5038.920000076294
CA 5038.920000076294
CA 5038.920000076294
CAB 2957.409996509552
CAB 2957.409996509552
--------------------------------------------------
-- DYNAMIC PARTITIONING*/
create table stock_dynamic_partition(exchange_name string,
stock_date string,
open_price float,
high_price float,
low_price float,
close_price float,
stock_volume bigint,
avg_price float)
partitioned by (company_name string)
row format delimited fields terminated by '/t';
--insert data ;
insert into table stock_dynamic_partition partition(company_name) select exchange_name,date,open,high,low,close,volume,avg_price,symbol from nyse_stock_data2;
alter table stock_dynamic_partition add partition(sys_data string);
------------------------------
alter
--change colums
ALTER TABLE table_name CHANGE COLUMN oldcolumnname newcolumname datatype [COMMENT] [[AFTER column name]=>move column after column namde[FIRST] =>move column to first];
--some sampple quries
select symbol,date,round(low /2) from nyse_stock_data2 where symbol = 'CVA';
select symbol,date,round(low /2) from nyse_stock_data2 where symbol = upper('cva');
select count(*) from nyse_stock_data2;
select count(DISTINCT symbol) from nyse_stock_data2;
-- create table nyse_dividends
create table nyse_stock_dividends (
exchange_name string,
company_symbol string,
stock_date string,
dividend_given float)
row format delimited fields terminated by '\t';
load data local inpath '/home/bhuvan/pig/pigdata/NYSE_dividends' into table nyse_stock_dividends;
--group by and having
select company_symbol,sum(dividend_given) from nyse_stock_dividends group by company_symbol having avg(dividend_given) < 2;
JOINS
--INNER JOIB FULL OUTER join
--MAPSIDE JOINS(USED FOR OPTIMIZATION)
SELECT /*+ MAPJOIN(d) */ s.symbol,s.open,d.dividend_given from nyse_stock_data s join nyse_stock_dividends d on s.symbol = d.company_symbol;
--ORDER BY AND SORT BY
--ORDER BY (TOTAL SORT - all records are passed to single reducer -Perfomance low)
--SORT BY (LOCAL SORT - sorted in different reducers)
select * from nyse_stock_data order by open desc;
select * from nyse_stock_data sort by open desc;
--DISTRIBUTE BY
/*while using sort the redords will go to differer reduces so for example if we sort the stock data on basis of open price using SORT BY, the we may ge output like
AAP 12.0
AAP 13.9
CLI 14.0
CLA 15.0
AAP 16.0 => gone to another reducer
CLI 17.0 => gonr to another reducer
to overcome this we use DISTRIBUTE BY so that we get the stock number in sequence*/
SELECT symbol,open from nyse_stock_data distribute by symbol sort by open;
--CLUSTER BY
select symbol,open from nyse_stock_data cluster by symbol;
--CASTING
select symbol,open from nyse_stock_data where cast(volume as int) < 10000;
---UNIon
select * from nyse_stock_data union all select * from nyse_stock_dividends -> not supported
select log.symbol from (
select symbol from nyse_stock_data UNION ALL select company_symbol from nyse_stock_dividends) ;
alter table stock_bucket_table change column volume volume string;
--VIEWS
create view stock_view as
select nyse_stock_data.open,
nyse_stock_data.close,
nyse_stock_dividends.dividend_given,
nyse_stock_data.symbol from nyse_stock_data join nyse_stock_dividends on
(nyse_stock_data.symbol = nyse_stock_dividends.company_symbol) where nyse_stock_data.open > 2.0;
--INDEX
create index stock_partition_index on table stock_partition_table(company_symbol)
as 'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler'
with deferred rebuild;
--show index
hive> show formatted index on stock_partition_table;
--BUCKETINg
create table stock_bucket_table(exchange_name string,
company_symbol string,
market_date string,
open_price float,
high_price float,
low_price float,
close_price float,
volume bigint,
avg_price float)
clustered by (company_symbol) into 237 buckets;
--insert table
insert into table stock_bucket_table select * from nyse_stock_data;
--alter table change columns
alter table stock_bucket_table change column volume volume string;
create external table testm (
key int,
val int)
row format delimited fields terminated by '\t'
location '/mdk'
| true
|
e4a0531d50a370a6f5728aca4216473b2807a632
|
SQL
|
bellmit/washington-sgge-1-0-0
|
/jquery/Prototipo/source/complexmo-test/setup/complexmo-oracle.sql
|
UTF-8
| 4,254
| 3.875
| 4
|
[] |
no_license
|
DROP SEQUENCE "PERSON_SEQ";
CREATE SEQUENCE "PERSON_SEQ" MINVALUE 1 MAXVALUE 99999 INCREMENT BY 1 START WITH 3 NOCACHE ORDER CYCLE;
commit;
DROP TABLE "PERSON";
CREATE TABLE PERSON
(ID NUMBER(10,0) PRIMARY KEY,
FIRST_NAME VARCHAR2(25),
MIDDLE_NAME VARCHAR2(10),
LAST_NAME VARCHAR2(50),
EMPLOYEE_NUMBER NUMBER(10,0),
VERSN_LOCK_NUM NUMBER(10,0)
);
COMMIT;
CREATE OR REPLACE TRIGGER PERSON_TR1
BEFORE INSERT OR UPDATE
ON PERSON for each row
BEGIN
IF INSERTING THEN
:new.VERSN_LOCK_NUM := 0;
ELSE
:new.VERSN_LOCK_NUM := :old.VERSN_LOCK_NUM + 1;
END IF;
END;
/
ALTER TRIGGER PERSON_TR1 ENABLE;
COMMIT;
DROP TABLE "EFT";
CREATE TABLE EFT
(PARENTKEY NUMBER(10,0) PRIMARY KEY,
BANK VARCHAR2(100),
ACCOUNT_NUMBER VARCHAR2(16),
EFF_START_DATE DATE,
EFF_END_DATE DATE
);
COMMIT;
DROP TABLE "CONTACT";
CREATE TABLE CONTACT
(PARENTKEY NUMBER(10,0),
CONTACT_TYPE NUMBER(10,0),
PRIORITY NUMBER(10,0),
VERIFIED CHAR(1),
EFF_START_DATE DATE,
EFF_END_DATE DATE,
CONSTRAINT contact_pk PRIMARY KEY (PARENTKEY, CONTACT_TYPE)
);
COMMIT;
DROP TABLE "ADDRESS";
CREATE TABLE ADDRESS
(PARENTKEY NUMBER(10,0),
CONTACT_TYPE NUMBER(10,0),
ADDRESSLINE1 VARCHAR2(75),
ADDRESSLINE2 VARCHAR2(75),
CITY VARCHAR2(50),
STATE VARCHAR2(2),
COUNTY CHAR(2),
COUNTRY CHAR(2),
POSTAL_CODE VARCHAR2(9),
NOTE VARCHAR2(100),
CONSTRAINT address_pk PRIMARY KEY (PARENTKEY, CONTACT_TYPE)
);
COMMIT;
DROP TABLE "PHONE";
CREATE TABLE PHONE
(PARENTKEY NUMBER(10,0),
CONTACT_TYPE NUMBER(10,0),
COUNTRY_CODE VARCHAR2(3),
AREA_CODE VARCHAR2(3),
BASE_NUMBER VARCHAR2(16),
EXTENSION VARCHAR2(8),
CONSTRAINT phone_pk PRIMARY KEY (PARENTKEY, CONTACT_TYPE)
);
COMMIT;
DROP TABLE "EMAIL";
CREATE TABLE EMAIL
(PARENTKEY NUMBER(10,0),
CONTACT_TYPE NUMBER(10,0),
EMAILADDRESS VARCHAR2(150),
CONSTRAINT email_pk PRIMARY KEY (PARENTKEY, CONTACT_TYPE)
);
COMMIT;
DROP TABLE "COUNTY_COMPLEXMO";
CREATE TABLE COUNTY_COMPLEXMO
(CODE CHAR(2) PRIMARY KEY,
DESCRIPTION VARCHAR2(100)
);
COMMIT;
DROP TABLE "STATE";
CREATE TABLE STATE
(CODE CHAR(2) PRIMARY KEY,
DESCRIPTION VARCHAR(2100)
);
COMMIT;
DROP TABLE "COUNTRY";
CREATE TABLE COUNTRY
(CODE CHAR(2) PRIMARY KEY,
DESCRIPTION VARCHAR2(100)
);
COMMIT;
DROP TABLE "HELP";
CREATE TABLE HELP
(SEQUENCE NUMBER(10,0) PRIMARY KEY,
TOPIC VARCHAR2(25),
INFORMATION VARCHAR2(100)
);
COMMIT;
insert into country values('US','United States of America');
insert into country values('BR','Brazil');
insert into county_complexmo values('SP','Sarpy');
insert into county_complexmo values('DO','Douglas');
insert into state values('NE','Nebraska');
insert into state values('FL','Florida');
insert into person values(1,'Richard','Allen', 'Barndt',100,0);
insert into person values(2,'Naomi','Sue Lee', 'Barndt',200,0);
insert into eft values(1,'CFCU1',123456,'1-Jan-11','30-Dec-52');
insert into eft values(2,'CFCU2',223456,'1-Jan-11','30-Dec-52');
insert into contact values(1,1,1,'Y','1-Jan-09','30-Dec-52');
insert into contact values(1,2,1,'Y','1-Jan-12','30-Dec-52');
insert into contact values(1,3,3,'N','1-Jan-12','30-Dec-52');
insert into contact values(1,4,2,'Y','1-Jan-12','30-Dec-52');
insert into contact values(1,5,1,'Y','1-Jan-12','30-Dec-52');
insert into contact values(1,6,2,'Y','1-Jan-12','30-Dec-52');
insert into contact values(2,3,2,'N','1-Jan-12','30-Dec-52');
insert into address values(1,3,'1122 Boogie Boogie Ave','','Omaha','NE','SP','US','68136','Test Note Rich');
insert into address values(1,6,'222 South 15th Street','Suite 1404','Omaha','NE','DO','US','68102','14th Floor South Building');
insert into address values(2,3,'1122 Boogie Boogie Ave','','Omaha','NE','SP','US','68136','Test Note Naomi');
insert into phone values(1,1,'001','678','3614388','');
insert into phone values(1,4,'001','402','4919200','');
insert into email values(1,2,'rich_barndt@yahoo.com');
insert into email values(1,5,'rich_barndt@qat.com');
COMMIT;
| true
|
ee47317a2d13666fb709bc41a7fabb9bb472d6e2
|
SQL
|
adminsemy/testTree
|
/sql/test.sql
|
UTF-8
| 3,417
| 2.890625
| 3
|
[] |
no_license
|
-- Valentina Studio --
-- MySQL dump --
-- ---------------------------------------------------------
/*!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 */;
/*!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' */;
-- ---------------------------------------------------------
-- CREATE TABLE "comments" -------------------------------------
CREATE TABLE `comments` (
`id` Int( 255 ) AUTO_INCREMENT NOT NULL,
`parent_id` Int( 255 ) NULL,
`topic_id` Int( 255 ) NULL,
`body` VarChar( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`created_at` DateTime NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ( `id` ),
CONSTRAINT `unique_id` UNIQUE( `id` ) )
CHARACTER SET = utf8
COLLATE = utf8_general_ci
ENGINE = InnoDB
AUTO_INCREMENT = 9;
-- -------------------------------------------------------------
-- CREATE TABLE "posts" ----------------------------------------
CREATE TABLE `posts` (
`id` Int( 255 ) AUTO_INCREMENT NOT NULL,
`text` VarChar( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY ( `id` ),
CONSTRAINT `unique_id` UNIQUE( `id` ) )
CHARACTER SET = utf8
COLLATE = utf8_general_ci
ENGINE = InnoDB
AUTO_INCREMENT = 2;
-- -------------------------------------------------------------
-- Dump data of "comments" ---------------------------------
INSERT INTO `comments`(`id`,`parent_id`,`topic_id`,`body`,`created_at`) VALUES
( '1', '0', '1', 'Answer to first comment', '2020-10-02 10:37:09' ),
( '2', '1', '1', 'Test child comment', '2020-10-02 10:37:34' ),
( '3', '0', '1', 'Проверка вÑтавки ÐºÐ¾Ð¼Ð¼ÐµÐ½Ñ‚Ð°Ñ€Ð¸Ñ Ð½Ð° руÑÑком Ñзыке', '2020-10-02 10:37:59' ),
( '4', '3', '1', 'Ответ на руÑÑком', '2020-10-02 10:48:42' ),
( '5', '4', '1', 'Попытка вÑтавить теги или Ñкрипт <h1>Проверка </h1>', '2020-10-02 10:49:17' );
-- ---------------------------------------------------------
-- Dump data of "posts" ------------------------------------
INSERT INTO `posts`(`id`,`text`) VALUES
( '1', 'My first text' );
-- ---------------------------------------------------------
-- CREATE INDEX "lnk_posts_comments" ---------------------------
CREATE INDEX `lnk_posts_comments` USING BTREE ON `comments`( `topic_id` );
-- -------------------------------------------------------------
-- CREATE LINK "lnk_posts_comments" ----------------------------
ALTER TABLE `comments`
ADD CONSTRAINT `lnk_posts_comments` FOREIGN KEY ( `topic_id` )
REFERENCES `posts`( `id` )
ON DELETE Cascade
ON UPDATE No Action;
-- -------------------------------------------------------------
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_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 */;
-- ---------------------------------------------------------
| true
|
c3914a91547efc501406801062d8b54093049f7d
|
SQL
|
bartschs/sql_admin
|
/xdepcsv.sql
|
UTF-8
| 2,099
| 3.09375
| 3
|
[] |
no_license
|
rem NAME
rem depend.sql
rem FUNCTION
rem search for SQL objects dependencies
rem NOTE
rem start from SQL*Plus as user
rem MODIFIED
rem 27.03.02 SBartsch - made it
rem
set verify off
set linesize 100
set arraysize 4
set long 10000
set maxdata 30000
set pagesize 40;
set heading off
set feedback off
clear columns
clear breaks
clear computes
ttitle off
btitle off
prompt
prompt -----------------------------------------------------------;
prompt SQL Objects Dependencies Report
prompt -----------------------------------------------------------;
prompt
accept objname char prompt 'Object Name........: [] ';
accept objtype char prompt 'Object Type........: [] ';
accept objref char prompt 'Referenced Object..: [] ';
accept filename char prompt 'Spool to <filename>: [] ' default '&TMPDIR.depend.lst';
set arraysize 1;
rem set colsep ',';
set feedback off;
set heading off;
set line 32000;
set pagesize 0;
set termout off;
rem set termout off;
set termout on;
set trimout on;
set trimspool on;
set verify off;
column name new_value varname noprint
column type new_value vartype noprint
column referenced_name new_value varref noprint
spool &&filename
select distinct name, referenced_name, name || ',' || referenced_name outline
from all_dependencies
where type like upper(nvl('%&&objtype.%','%'))
and name like upper(nvl('%&&objname.%','%'))
and (name not like 'RBI$VI_TMP_%')
and (referenced_name != 'STANDARD')
and referenced_name like upper(nvl('%&&objref.%','%'))
order by substr(name, 12), substr(name, 8), referenced_name
/
rem where type like decode(upper('&&objtype'),
rem 'BODY', 'PACKAGE BODY',
rem 'SPEC', 'PACKAGE',
rem upper(nvl('%&&objtype.%','%')))
rem and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
spool off;
set heading on;
undefine objname
undefine objtype
undefine objref
undefine filename
clear columns
clear breaks
clear computes
ttitle off
btitle off
rem pause Press <Return> to continue;
rem exit
| true
|
da743f41f0eb26a9cde3c4bdfb933763ef0db600
|
SQL
|
daydreammsp/grimlund_gas
|
/database.sql
|
UTF-8
| 1,523
| 3.703125
| 4
|
[] |
no_license
|
CREATE TABLE person (
id SERIAL PRIMARY KEY,
username VARCHAR (80) UNIQUE NOT NULL,
password VARCHAR (1000) NOT NULL
);
CREATE TABLE "cars" (
"car_id" serial NOT NULL UNIQUE,
"car_model" varchar,
"car_make" varchar,
"car_year" varchar,
"car_miles" varchar,
CONSTRAINT cars_pk PRIMARY KEY ("car_id")
) WITH (
OIDS=FALSE
);
CREATE TABLE "drivers" (
"id" serial NOT NULL UNIQUE,
"driver_id" integer NOT NULL,
"car_id" integer NOT NULL UNIQUE,
CONSTRAINT drivers_pk PRIMARY KEY ("id")
) WITH (
OIDS=FALSE
);
CREATE TABLE "transactions" (
"transaction_id" serial NOT NULL UNIQUE,
"driver_id" integer NOT NULL,
"date" timestamp with time zone NOT NULL,
"city" varchar,
"state" varchar,
"car_milage" varchar,
"price_gallon" varchar,
"gallons_purchased" varchar,
CONSTRAINT transactions_pk PRIMARY KEY ("transaction_id")
) WITH (
OIDS=FALSE
);
CREATE TABLE "maintenance" (
"maintenance_id" serial NOT NULL,
"driver_id" integer NOT NULL,
"notes" varchar,
CONSTRAINT maintenance_pk PRIMARY KEY ("maintenance_id")
) WITH (
OIDS=FALSE
);
ALTER TABLE "drivers" ADD CONSTRAINT "drivers_fk0" FOREIGN KEY ("driver_id") REFERENCES "person"("id");
ALTER TABLE "drivers" ADD CONSTRAINT "drivers_fk1" FOREIGN KEY ("car_id") REFERENCES "cars"("car_id");
ALTER TABLE "transactions" ADD CONSTRAINT "transactions_fk0" FOREIGN KEY ("driver_id") REFERENCES "drivers"("id");
ALTER TABLE "maintenance" ADD CONSTRAINT "maintenance_fk0" FOREIGN KEY ("driver_id") REFERENCES "drivers"("id");
| true
|
054d6e8b893204f1f034804690ad5ac367111380
|
SQL
|
polarbears-xzf/xzfgit
|
/zoeMonitor/checkup_report/content_init_parameter.sql
|
UTF-8
| 1,248
| 2.9375
| 3
|
[] |
no_license
|
-- Created in 2018.10.11 by polarbears
-- Copyright (c) 20xx, CHINA and/or affiliates.
-- All rights reserved.
-- Name:
-- content_init_parameter.sql
-- Description:
-- 基本说明
-- Relation:
-- 对象关联
-- Notes:
-- 基本注意事项
-- 修改 - (年-月-日) - 描述
---- =======================================
-- Oracle非默认初始化参数设置
-- =======================================
set markup html off
prompt <H3 class='zoecomm'> <center><a name="00006"></a>非默认初始化参数</center> </H3>
set markup html on entmap off
column column1 format A80 heading '参数名'
column column2 format A255 heading '参数值'
column column3 format 99 heading '实例号'
set markup html off
prompt <center>
set markup html on entmap off
set markup html on table "WIDTH=600 BORDER=1"
-- select '<A HREF="http://oracle.com/'||name||'.html">'||name||'</A>' "column1",value "column2"
select * from (
select inst_id as "column3",name as "column1",value as "column2"
from gv$system_parameter
where ISDEFAULT = 'FALSE'
order by inst_id , name)
union all
select to_number(''),'合计',to_char(count(*))
from gv$system_parameter
where ISDEFAULT = 'FALSE';
prompt <a href="#top">Back to Top </a></center>
| true
|
dc500cadf07dcf10823b66972bd143ec68d5ef2c
|
SQL
|
adenurisqo/IYKRA-DF6
|
/Ade Nur Istiqomah - Modul 5 Coding SQL.sql
|
UTF-8
| 1,562
| 4.15625
| 4
|
[] |
no_license
|
--Ade Nur Istiqomah
--Practice Case - Modul 5 Coding SQL
--Data Fellowship Batch 6
--Pre-training Period
--1. How many movies about 'astronauts'
select count(film_id) from film
where description like'%stronaut%';
--2. How many movies with rating R and replacement cost rangin between $5 - $15?
select count(film_id) from film f
where rating = 'R' and replacement_cost between 5 and 15;
--3. How many payment and its total handled by each staff?
select count(payment_id) as count_payment, sum(amount) as total_payment, staff_id from payment p
group by staff_id;
--4. How much is the average replacement cost by its rating?
select avg(replacement_cost), rating from film f
group by rating;
--5. Customer name, email and their spent amount of 5 customers who spent most amount of money.
select concat(c.first_name,' ', c.last_name) as customer_name, c.email, SUM(p.amount) AS total
from customer c join payment p
on c.customer_id = p.customer_id
group by c.customer_id
order by total desc
limit 5;
--6. How many copies of each movies in each store?
select f.title, count(i.inventory_id) as copies, i.store_id
from inventory i join film f
on i.film_id = f.film_id
group by i.store_id, f.title;
--7. Name and email of customers who have at least 40 payments.
select concat(c.first_name,' ', c.last_name) as customer_name, c.email, count(p.payment_id) AS count_payment
from customer c join payment p
on c.customer_id = p.customer_id
group by c.customer_id
having count(p.payment_id) >= 40
order by count_payment desc;
| true
|
62059d452812e8e89f8d2449848f6bc6d948026d
|
SQL
|
NancyRosanda/PhpOnline2018
|
/sbacic/mysql/zadaca_za_ispit.sql
|
UTF-8
| 2,246
| 3.859375
| 4
|
[] |
permissive
|
#3.15. Ime i prezime studenta te naziv i ocjenu za svaki ispit
SELECT imeStud,prezStud,nazPred,ocjena
FROM ispit i
JOIN stud s ON i.mbrStud=s.mbrStud
JOIN pred p ON p.sifPred=i.sifPred;
#3.17. Ispiši nazive predmeta i organizacijske jedinice kojima pripadaju za one kolegije koji imaju više od 20 upisanih studenata
SELECT nazPred,nazOrgjed,upisanoStud
FROM pred
JOIN orgjed ON pred.sifOrgjed=orgjed.sifOrgjed
WHERE UPISANOStud>20;
#3.18.Ispiši sve nazive mjesta u kojima stanuje bar jedan student.Imnena mjesta se smiju pojaviti samo jednom
SELECT DISTINCT nazMjesto
FROM mjesto
JOIN stud ON mjesto.pbr=stud.pbrStan;
#3.19.Ispiši nazive mjesta u kojima je barem jedan student rođen i stanuje.Imena mjesta se smiju pojaviti jednom
SELECT DISTINCT nazMjesto
FROM mjesto
JOIN stud on mjesto.pbr=stud.pbrStan
WHERE pbrStan=pbrRod;
#3.24. Ispiši podatke o studentima i nastavnicima koji imaju ista prezimena
SELECT stud.*, nastavnik.*
FROM stud,nastavnik
WHERE stud.prezStud=nastavnik.prezNastavnik;
#3.23. Ispiši podatke o studentima koji studiraju u mjestu različitom od mjesta rođenja,ali koje se nalazi u istoj županiji u kojoj su i rođeni
SELECT imeStud, prezStud
FROM stud
JOIN mjesto m1 on stud.pbrrod = m1.pbr
JOIN mjesto m2 on stud.pbrstan = m2.pbr
WHERE stud.pbrrod <> stud.pbrstan
AND m1.sifzupanija = m2.sifzupanija;
# 3.13. Ispišite sve podatke o studentima kojima počinje ili završava samoglasnikom
SELECT * From stud
WHERE
LEFT(imeStud,1) IN ('a','e','i','o','u')
OR
RIGHT(imeStud,1) IN ('a','e','i','o','u');
# 3.22. Ispišite podatke o nastavnicima koji su ispitivali studente koi stanuju u istoj županiji u kojoj stanuje i nastavnik.
SELECT DISTINCT imeNastavnik,prezNastavnik
FROM nastavnik
JOIN ispit ON ispit.sifNastavnik=nastavnik.sifNastavnik
JOIN stud ON ispit.mbrStud=stud.mbrStud
JOIN mjesto m1 ON m1.pbr=stud.pbrStan
JOIN mjesto m2 ON m2.pbr=nastavnik.pbrStan
WHERE m1.sifZupanija=m2.sifZupanija;
#3.20. Ispišite nazive kolegija i oznake dvorana u kojima imaju rezerviran termin.Ispišite i naziv organizacijske jedinice kojoj kolegij pripada
SELECT nazPred, oznDvorana, nazOrgjed
FROM pred
JOIN dvorana ON dvorana.oznDvorana=pred.sifOrgjed
JOIN orgjed ON orgjed.sifOrgjed=pred.sifOrgjed;
| true
|
670e6af81a5438a9ab4183b4770a5bf32e37dcba
|
SQL
|
Jaimedgp/Unipuntes
|
/baseDeDatos.sql
|
UTF-8
| 12,584
| 3.09375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.6.4deb1
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 26-05-2017 a las 12:38:38
-- Versión del servidor: 5.7.17-0ubuntu0.16.10.1
-- Versión de PHP: 7.0.15-0ubuntu0.16.10.4
--
-- Base de datos: `Apuntes`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `Anio`
--
CREATE TABLE `Anio` (
`IdAnio` int(11) NOT NULL,
`Anio` char(9) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `Anio`
--
INSERT INTO `Anio` (`IdAnio`, `Anio`) VALUES
(0, '2010/2011'),
(1, '2011/2012'),
(2, '2012/2013'),
(3, '2013/2014'),
(4, '2014/2015'),
(5, '2015/2016'),
(6, '2016/2017'),
(7, '2017/2018');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `Asignatura`
--
CREATE TABLE `Asignatura` (
`IdAsignatura` int(11) NOT NULL,
`Codigo` varchar(6) NOT NULL,
`Nombre` varchar(100) NOT NULL,
`Estudios` int(11) NOT NULL,
`Curso` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `Asignatura`
--
INSERT INTO `Asignatura` (`IdAsignatura`, `Codigo`, `Nombre`, `Estudios`, `Curso`) VALUES
(1, 'G31', 'Física Básica Experimental I: Movimiento, Fuerza, Astronomía', 0, 1),
(2, 'G32', 'Física Básica Experimental II: Ondas: Luz y Sonido', 0, 1),
(3, 'G39', 'Herramientas Computacionales en el Laboratorio', 0, 1),
(4, 'G35', 'Matemáticas I: Álgebra Lineal y Geometría', 0, 1),
(5, 'G36', 'Matemáticas II: Cálculo Diferencial', 0, 1),
(6, 'G33', 'Física Básica Experimental III: La Materia y sus Propiedades', 0, 1),
(7, 'G34', 'Física Básica Experimental IV: Circuitos y Electrónica', 0, 1),
(8, 'G38', 'Laboratorio Multidisciplinar', 0, 1),
(9, 'G37', 'Matemáticas III: Cálculo Integral', 0, 1),
(10, 'G40', 'Programación', 0, 1),
(11, 'G53', 'Termodinámica', 0, 2),
(12, 'G51', 'Electricidad y magnetismo', 0, 2),
(13, 'G55', 'Física Cuántica y Estructura de la Materia I: Fundamentales', 0, 2),
(14, 'G1722', 'Habilidades, Valores y Competencias Transversales', 0, 2),
(15, 'G62', 'Laboratorio de Física I', 0, 2),
(16, 'G63', 'Laboratorio de Física II', 0, 2),
(17, 'G49', 'Mecánica Clásica y Relatividad', 0, 2),
(18, 'G59', 'Ecuaciones Diferenciales Ordinarias', 0, 2),
(19, 'G60', 'Ecuaciones Derivadas Parciales', 0, 2),
(20, 'G261', 'Inglés', 0, 2),
(21, 'G54', 'Física estadística', 0, 3),
(22, 'G56', 'Física Cuántica II: Átomos, Moléculas y Sólidos', 0, 3),
(23, 'G57', 'Cuántica III', 0, 3),
(24, 'G58', 'Cuántica IV', 0, 3),
(25, 'G64', 'Laboratorio de Física III', 0, 3),
(26, 'G65', 'Laboratorio de Física IV', 0, 3),
(27, 'G61', 'Métodos numéricos', 0, 3),
(28, 'G52', 'Óptica y electromagnetismo', 0, 3),
(29, 'G50', 'Astronomía', 0, 3),
(30, 'G66', 'Historia y panorama de la ciencia', 0, 3),
(31, 'G1778', 'Experimental optics', 0, 3),
(32, 'G1776', 'Astronomy', 0, 3),
(33, 'G80', 'Advanced Computation', 0, 4),
(34, 'G79', 'Advanced Experimental Techniques (1C)', 0, 4),
(35, 'G69', 'Astrofísica', 0, 4),
(36, 'G77', 'Electrónica Aplicada', 0, 4),
(37, 'G78', 'Experimentación Didáctica', 0, 4),
(38, 'G76', 'Física de la Tierra', 0, 4),
(39, 'G70', 'Física de Materiales', 0, 4),
(40, 'G71', 'Física de Partículas Elementales', 0, 4),
(41, 'G72', 'Fotónica', 0, 4),
(42, 'G74', 'Fuentes de Energía', 0, 4),
(43, 'G68', 'Mecánica Cuántica', 0, 4),
(44, 'G73', 'Química', 0, 4),
(45, 'G75', 'Radiofísica', 0, 4),
(46, 'G1775', 'Advanced Experimental Techniques (2C)', 0, 4),
(47, 'G1777', 'Particle Physics', 0, 4),
(48, 'G1779', 'Physics of Materials', 0, 4),
(49, 'G67', 'Proyectos: Concepción, Desarrollo y Herramientas', 0, 4),
(50, 'G1682', 'Computación Avanzada', 0, 4),
(51, 'G1681', 'Técnicas Experimentales Avanzadas', 0, 4),
(52, 'G42', 'Álgebra Lineal I', 1, 1),
(53, 'G41', 'Cálculo Diferencial', 1, 1),
(54, 'G46', 'Física Básica Experimental', 1, 1),
(55, 'G1725', 'Habilidades, Valores y Competencias Transversales', 1, 1),
(56, 'G43', 'Introducción al Lenguaje Matemático', 1, 1),
(57, 'G44', 'Cálculo Integral', 1, 1),
(58, 'G48', 'Estadística Básica', 1, 1),
(59, 'G45', 'Geometría, Arte y Naturaleza', 1, 1),
(60, 'G260', 'Inglés', 1, 1),
(61, 'G47', 'Programación', 1, 1),
(62, 'G89', 'Álgebra Lineal II', 1, 2),
(63, 'G84', 'Ampliación de Cálculo Diferencial', 1, 2),
(64, 'G93', 'Cálculo de Probabilidades', 1, 2),
(65, 'G83', 'Ecuaciones Diferenciales Ordinarias', 1, 2),
(66, 'G95', 'Topología', 1, 2),
(67, 'G86', 'Ampliación de Cálculo Integral', 1, 2),
(68, 'G98', 'Cálculo Numérico I', 1, 2),
(69, 'G90', 'Estructuras Algebraicas', 1, 2),
(70, 'G96', 'Geometría de Curvas y Superficies', 1, 2),
(71, 'G85', 'Introducción a las Ecuaciones en Derivadas Parciales', 1, 2),
(72, 'G99', 'Cálculo Numérico II', 1, 3),
(73, 'G1752', 'Hilbert Spaces', 1, 3),
(74, 'G1683', 'Matemática Discreta', 1, 3),
(75, 'G94', 'Statistical Inference', 1, 3),
(76, 'G91', 'Teoría de Galois', 1, 3),
(77, 'G97', 'Teoría Global de Superficies', 1, 3),
(78, 'G92', 'Álgebra Conmutativa', 1, 3),
(79, 'G101', 'Discrete Mathematics', 1, 3),
(80, 'G88', 'Espacios Hilbert', 1, 3),
(81, 'G1684', 'Inferencia Estadística', 1, 3),
(82, 'G100', 'Optimización I', 1, 3),
(83, 'G102', 'Taller de Modelización', 1, 3),
(84, 'G87', 'Variable Compleja', 1, 3),
(85, 'G1894', 'Advanced Probability', 1, 4),
(86, 'G107', 'Ampliación de Análisis', 1, 4),
(87, 'G108', 'Ampliación de Probabilidades', 1, 4),
(88, 'G104', 'Análisis Funcional', 1, 4),
(89, 'G117', 'Análisis y Diseño de Algoritmos', 1, 4),
(90, 'G902', 'Análisis y Evaluación de Inversiones', 1, 4),
(91, 'G114', 'Cálculo Numérico III', 1, 4),
(92, 'G118', 'Economía y Administración de Empresas', 1, 4),
(93, 'G651', 'Estructuras de Datos', 1, 4),
(94, 'G899', 'Herramientas para la Decisión en Operaciones', 1, 4),
(95, 'G655', 'Introducción a los Sistemas Inteligentes', 1, 4),
(96, 'G680', 'Modelos de Cálculo', 1, 4),
(97, 'G115', 'Optimización II', 1, 4),
(98, 'G106', 'Teoría Cualitativa de EDO', 1, 4),
(99, 'G111', 'Topología Algebraica', 1, 4),
(100, 'G110', 'Variedades Diferenciables', 1, 4),
(101, 'G116', 'Álgebra Computacional', 1, 4),
(102, 'G652', 'Algorítmica y Complejidad', 1, 4),
(103, 'G113', 'Ampliación de Álgebra', 1, 4),
(104, 'G109', 'Ampliación de Estadística', 1, 4),
(105, 'G913', 'Análisis de los Mercados de Valores', 1, 4),
(106, 'G112', 'Geometría Proyectiva y Algebraica', 1, 4),
(107, 'G907', 'Investigación de Mercados', 1, 4),
(108, 'G345', 'Macroeconomía', 1, 4),
(109, 'G119', 'Matemáticas para la Educación Secundaria', 1, 4),
(110, 'G271', 'Métodos de Programación', 1, 4),
(111, 'G1753', 'Numerical Analysis III', 1, 4),
(112, 'G105', 'Teoría de la Medida', 1, 4),
(113, 'G120', 'Prácticas Externas I', 1, 4),
(114, 'G218', 'Prácticas Externas II', 1, 4),
(115, 'G103', 'Trabajo Fin de Grado', 1, 4),
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `Comentarios`
--
CREATE TABLE `Comentarios` (
`IdComentario` int(11) NOT NULL,
`IdUsuario` int(11) DEFAULT NULL,
`IdDocumento` int(11) DEFAULT NULL,
`Puntuacion` float DEFAULT NULL,
`Comentario` varchar(300) DEFAULT NULL,
`Fecha` date DEFAULT NULL,
`Pseudonimo` char(12) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `Documentos`
--
CREATE TABLE `Documentos` (
`IdDocumento` int(11) NOT NULL,
`Titulo` varchar(50) NOT NULL,
`Usuario` int(11) NOT NULL,
`FechaSubida` datetime DEFAULT CURRENT_TIMESTAMP,
`Tipo` int(11) NOT NULL,
`Anio` int(11) NOT NULL,
`Documento` varchar(50) NOT NULL,
`Hash` varchar(32) NOT NULL,
`Asignatura` int(11) NOT NULL,
`Comentario` varchar(500) DEFAULT NULL,
`Puntuacion` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `Estudios`
--
CREATE TABLE `Estudios` (
`IdEstudios` int(11) NOT NULL,
`Nombre` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `Estudios`
--
INSERT INTO `Estudios` (`IdEstudios`, `Nombre`) VALUES
(0, 'Fisica'),
(1, 'Matematicas'),
(2, 'Ingenieria Informatica');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `Invitacion`
--
CREATE TABLE `Invitacion` (
`IdCodigo` int(11) NOT NULL,
`Codigo` char(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `Sesion`
--
CREATE TABLE `Sesion` (
`IdSesion` varchar(32) NOT NULL,
`IdUsuario` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `Tipo`
--
CREATE TABLE `Tipo` (
`IdTipo` int(11) NOT NULL,
`Nombre` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `Tipo`
--
INSERT INTO `Tipo` (`IdTipo`, `Nombre`) VALUES
(0, 'Apuntes'),
(1, 'Apuntes Profesor'),
(2, 'Examen');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `Usuario`
--
CREATE TABLE `Usuario` (
`IdUsuario` int(11) NOT NULL,
`Nombre` varchar(30) NOT NULL,
`Apellido1` varchar(30) NOT NULL,
`Apellido2` varchar(30) DEFAULT NULL,
`Password` varchar(32) NOT NULL,
`Nick` varchar(20) NOT NULL,
`Email` varchar(50) NOT NULL,
`Estudios` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indices de la tabla `Anio`
--
ALTER TABLE `Anio`
ADD PRIMARY KEY (`IdAnio`),
ADD UNIQUE KEY `Anio` (`Anio`);
--
-- Indices de la tabla `Asignatura`
--
ALTER TABLE `Asignatura`
ADD PRIMARY KEY (`IdAsignatura`),
ADD UNIQUE KEY `Codigo` (`Codigo`),
ADD KEY `Estudios` (`Estudios`);
--
-- Indices de la tabla `Comentarios`
--
ALTER TABLE `Comentarios`
ADD PRIMARY KEY (`IdComentario`),
ADD UNIQUE KEY `usr_apunt` (`IdUsuario`,`IdDocumento`),
ADD UNIQUE KEY `apunt_pseu` (`IdDocumento`,`Pseudonimo`);
--
-- Indices de la tabla `Documentos`
--
ALTER TABLE `Documentos`
ADD PRIMARY KEY (`IdDocumento`),
ADD UNIQUE KEY `Hash` (`Hash`),
ADD KEY `Usuario` (`Usuario`),
ADD KEY `Tipo` (`Tipo`),
ADD KEY `Anio` (`Anio`),
ADD KEY `Asignatura` (`Asignatura`);
--
-- Indices de la tabla `Estudios`
--
ALTER TABLE `Estudios`
ADD PRIMARY KEY (`IdEstudios`);
--
-- Indices de la tabla `Invitacion`
--
ALTER TABLE `Invitacion`
ADD PRIMARY KEY (`IdCodigo`);
--
-- Indices de la tabla `Sesion`
--
ALTER TABLE `Sesion`
ADD PRIMARY KEY (`IdSesion`),
ADD KEY `IdUsuario` (`IdUsuario`);
--
-- Indices de la tabla `Tipo`
--
ALTER TABLE `Tipo`
ADD PRIMARY KEY (`IdTipo`);
--
-- Indices de la tabla `Usuario`
--
ALTER TABLE `Usuario`
ADD PRIMARY KEY (`IdUsuario`),
ADD UNIQUE KEY `Nick` (`Nick`),
ADD KEY `Estudios` (`Estudios`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `Documentos`
--
ALTER TABLE `Documentos`
MODIFY `IdDocumento` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=89;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `Asignatura`
--
ALTER TABLE `Asignatura`
ADD CONSTRAINT `Asignatura_ibfk_1` FOREIGN KEY (`Estudios`) REFERENCES `Estudios` (`IdEstudios`);
--
-- Filtros para la tabla `Comentarios`
--
ALTER TABLE `Comentarios`
ADD CONSTRAINT `Comentarios_ibfk_1` FOREIGN KEY (`IdUsuario`) REFERENCES `Usuario` (`IdUsuario`),
ADD CONSTRAINT `Comentarios_ibfk_2` FOREIGN KEY (`IdDocumento`) REFERENCES `Documentos` (`IdDocumento`);
--
-- Filtros para la tabla `Documentos`
--
ALTER TABLE `Documentos`
ADD CONSTRAINT `Documentos_ibfk_1` FOREIGN KEY (`Usuario`) REFERENCES `Usuario` (`IdUsuario`),
ADD CONSTRAINT `Documentos_ibfk_2` FOREIGN KEY (`Tipo`) REFERENCES `Tipo` (`IdTipo`),
ADD CONSTRAINT `Documentos_ibfk_3` FOREIGN KEY (`Anio`) REFERENCES `Anio` (`IdAnio`),
ADD CONSTRAINT `Documentos_ibfk_4` FOREIGN KEY (`Asignatura`) REFERENCES `Asignatura` (`IdAsignatura`);
--
-- Filtros para la tabla `Sesion`
--
ALTER TABLE `Sesion`
ADD CONSTRAINT `Sesion_ibfk_1` FOREIGN KEY (`IdUsuario`) REFERENCES `Usuario` (`IdUsuario`);
--
-- Filtros para la tabla `Usuario`
--
ALTER TABLE `Usuario`
ADD CONSTRAINT `Usuario_ibfk_1` FOREIGN KEY (`Estudios`) REFERENCES `Estudios` (`IdEstudios`);
| true
|
88965beee7a8f477e6e55e066c9a22006cb0c923
|
SQL
|
PeregHer/breizhibus
|
/breizhibus.sql
|
UTF-8
| 4,408
| 3.15625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.9.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8081
-- Generation Time: Dec 11, 2020 at 10:58 PM
-- Server version: 5.7.24
-- PHP Version: 7.4.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: `breizhibus`
--
CREATE DATABASE IF NOT EXISTS `breizhibus` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `breizhibus`;
-- --------------------------------------------------------
--
-- Table structure for table `arrets`
--
CREATE TABLE `arrets` (
`id_arret` int(11) NOT NULL,
`nom` varchar(20) NOT NULL,
`adresse` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `arrets`
--
INSERT INTO `arrets` (`id_arret`, `nom`, `adresse`) VALUES
(1, 'Korrigan', '1 impasse du Korrigan'),
(2, 'Morgana', '2 plage Morgana'),
(3, 'L\'Ankou', '3 place de la Morgue'),
(4, 'Ys', '4 rue de l\'ile d\'Ys'),
(5, 'Viviane', '5 avenu de Viviane'),
(6, 'Guénolé', '6 rue Saint Guénolé');
-- --------------------------------------------------------
--
-- Table structure for table `arrets_lignes`
--
CREATE TABLE `arrets_lignes` (
`id_ligne` int(11) NOT NULL,
`id_arret` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `arrets_lignes`
--
INSERT INTO `arrets_lignes` (`id_ligne`, `id_arret`) VALUES
(1, 1),
(1, 2),
(1, 3),
(2, 2),
(2, 4),
(2, 6),
(3, 4),
(3, 5),
(3, 6),
(3, 1),
(4, 5),
(4, 1),
(4, 3),
(5, 4),
(5, 6),
(5, 2);
-- --------------------------------------------------------
--
-- Table structure for table `bus`
--
CREATE TABLE `bus` (
`id_bus` int(11) NOT NULL,
`numero` varchar(7) NOT NULL,
`immatriculation` varchar(11) NOT NULL,
`nombre_places` int(11) NOT NULL,
`id_ligne` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `bus`
--
INSERT INTO `bus` (`id_bus`, `numero`, `immatriculation`, `nombre_places`, `id_ligne`) VALUES
(1, 'BB01', 'FD456QZ', 20, 2),
(2, 'BB02', 'NO123DD', 45, 3),
(3, 'BB03', 'AF483AZ', 18, 4),
(4, 'BB04', 'RT782ZV', 32, 5),
(5, 'BB06', 'GM122FC', 25, 1),
(6, 'BB07', 'ED593ZP', 40, 3),
(7, 'BB08', 'DE159KJ', 20, 5);
-- --------------------------------------------------------
--
-- Table structure for table `lignes`
--
CREATE TABLE `lignes` (
`id_ligne` int(11) NOT NULL,
`nom` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `lignes`
--
INSERT INTO `lignes` (`id_ligne`, `nom`) VALUES
(1, 'Rouge'),
(2, 'Vert'),
(3, 'Bleu'),
(4, 'Rose'),
(5, 'Jaune');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `arrets`
--
ALTER TABLE `arrets`
ADD PRIMARY KEY (`id_arret`);
--
-- Indexes for table `arrets_lignes`
--
ALTER TABLE `arrets_lignes`
ADD KEY `id_arret` (`id_arret`),
ADD KEY `id_ligne` (`id_ligne`);
--
-- Indexes for table `bus`
--
ALTER TABLE `bus`
ADD PRIMARY KEY (`id_bus`),
ADD KEY `id_ligne` (`id_ligne`);
--
-- Indexes for table `lignes`
--
ALTER TABLE `lignes`
ADD PRIMARY KEY (`id_ligne`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `arrets`
--
ALTER TABLE `arrets`
MODIFY `id_arret` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `bus`
--
ALTER TABLE `bus`
MODIFY `id_bus` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `lignes`
--
ALTER TABLE `lignes`
MODIFY `id_ligne` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `arrets_lignes`
--
ALTER TABLE `arrets_lignes`
ADD CONSTRAINT `arrets_lignes_ibfk_1` FOREIGN KEY (`id_arret`) REFERENCES `arrets` (`id_arret`),
ADD CONSTRAINT `arrets_lignes_ibfk_2` FOREIGN KEY (`id_ligne`) REFERENCES `lignes` (`id_ligne`);
--
-- Constraints for table `bus`
--
ALTER TABLE `bus`
ADD CONSTRAINT `bus_ibfk_1` FOREIGN KEY (`id_ligne`) REFERENCES `lignes` (`id_ligne`);
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 */;
| true
|
f39fe057a1972559f166b0b6be37019a9cc9f708
|
SQL
|
jenny241093/DB-Basics-MSSQL
|
/ExamPrep2/ExamPrep2/08. Best Rated Products.sql
|
WINDOWS-1252
| 484
| 4.0625
| 4
|
[] |
no_license
|
--Select top 10 best rated products
-- ordered by average rate (descending)
-- then by amount of feedbacks
-- (descending).
--Required columns:
-- Name
-- Description
-- AverageRate
--average Rate for each product
-- FeedbacksAmount
-- number of feedbacks for each product
SELECT TOP 10 p.Name,
p.Description,
AVG(f.Rate),
COUNT(*)FROM Products AS p
JOIN Feedbacks AS f ON f.ProductId=p.Id
GROUP BY p.Name,p.Description
ORDER BY AVG(f.Rate) DESC,COUNT(*)DESC
| true
|
444c1bb1f3b24847ade9b83b2d6dd0c7eb89990a
|
SQL
|
qyftxp/HR_PROJ
|
/src/main/resources/public.sql
|
UTF-8
| 30,881
| 2.9375
| 3
|
[] |
no_license
|
/* 创建 HR_DB 数据库。 */
create database HR_DB;
use HR_DB;
create table users ( -- 登录用户表
u_id int auto_increment primary key, -- user_id : 主键,自动增长列
u_name varchar(60) not null, -- user_name" : 用户名
u_true_name varchar(60) not null -- user_true_name" : 真实姓名
user_position varchar(20) not null, -- user_position 职位 根据职位名称有不同的权限
u_password varchar(60) not null) -- user_password" : 密码
select * from users;
insert into users(u_name,u_true_name,user_position,u_password) values('better_admin','a','总管理员','a')
--public_char" : 公共字段设置,包括薪酬设置,职称设置,国籍,民族,宗教信仰,政治面貌,教育年限,学历,专业,特长,爱好,培训项目,培训成绩,奖励项目,奖励等级 */ */
create table public_char (
pbc_id int auto_increment primary key, -- pbc_id" : 主键,自动增长列
attribute_kind varchar(60) , -- attribute_kind" : 属性的种类
attribute_name varchar(60) ) -- attribute_name" : 属性的名称
insert into public_char(attribute_kind,attribute_name) values('国籍','中国');
insert into public_char(attribute_kind,attribute_name) values('国籍','美国');
insert into public_char(attribute_kind,attribute_name) values('民族','汉族');
insert into public_char(attribute_kind,attribute_name) values('民族','回族');
insert into public_char(attribute_kind,attribute_name) values('宗教信仰','无');
insert into public_char(attribute_kind,attribute_name) values('宗教信仰','佛教');
insert into public_char(attribute_kind,attribute_name) values('政治面貌','党员');
insert into public_char(attribute_kind,attribute_name) values('政治面貌','群众');
insert into public_char(attribute_kind,attribute_name) values('教育年限','12');
insert into public_char(attribute_kind,attribute_name) values('教育年限','16');
insert into public_char(attribute_kind,attribute_name) values('学历','本科');
insert into public_char(attribute_kind,attribute_name) values('学历','大专');
insert into public_char(attribute_kind,attribute_name) values('专业','生物工程');
insert into public_char(attribute_kind,attribute_name) values('专业','计算机');
insert into public_char(attribute_kind,attribute_name) values('特长','数据库');
insert into public_char(attribute_kind,attribute_name) values('特长','java');
insert into public_char(attribute_kind,attribute_name) values('爱好','篮球');
insert into public_char(attribute_kind,attribute_name) values('爱好','舞蹈');
insert into public_char(attribute_kind,attribute_name) values('培训项目','英语');
insert into public_char(attribute_kind,attribute_name) values('培训项目','管理');
insert into public_char(attribute_kind,attribute_name) values('培训成绩','A');
insert into public_char(attribute_kind,attribute_name) values('培训成绩','B');
insert into public_char(attribute_kind,attribute_name) values('奖励项目','技术攻关');
insert into public_char(attribute_kind,attribute_name) values('奖励项目','销售绩效');
insert into public_char(attribute_kind,attribute_name) values('奖励等级','A');
insert into public_char(attribute_kind,attribute_name) values('奖励等级','B');
insert into public_char(attribute_kind,attribute_name) values('职称','工程师');
insert into public_char(attribute_kind,attribute_name) values('职称','经理');
insert into public_char(attribute_kind,attribute_name) values('职称','助理');
insert into public_char(attribute_kind,attribute_name) values('职称','教授');
insert into public_char(attribute_kind,attribute_name) values('职称','讲师');
insert into public_char(attribute_kind,attribute_name) values('职称','技术支持');
insert into public_char(attribute_kind,attribute_name) values('薪酬设置','出差补助');
insert into public_char(attribute_kind,attribute_name) values('薪酬设置','交通补贴');
insert into public_char(attribute_kind,attribute_name) values('薪酬设置','住房补贴');
insert into public_char(attribute_kind,attribute_name) values('薪酬设置','基本工资');
insert into public_char(attribute_kind,attribute_name) values('薪酬设置','年终奖');
insert into public_char(attribute_kind,attribute_name) values('薪酬设置','误餐补助');
-- 部门表
create table department(
dept_id int auto_increment primary key,-- 主键
department_id int not null, -- 部门编号
department_name varchar(20) not null-- 部门名称
)
select * from department;
delete from department;
insert into department(department_id,department_name) values(1,'财务部');
insert into department(department_id,department_name) values(2,'行政后勤部');
insert into department(department_id,department_name) values(3,'人事部');
insert into department(department_id,department_name) values(4,'企划部');
insert into department(department_id,department_name) values(5,'技术部');
insert into department(department_id,department_name) values(6,'销售部');
insert into department(department_id,department_name) values(7,'项目工程部');
insert into department(department_id,department_name) values(8,'生产研发部');
insert into department(department_id,department_name) values(9,'采购部');
insert into department(department_id,department_name) values(10,'客户服务部');
-- config_major_kind" : 职位分类设置
create table config_major_kind (
mfk_id int auto_increment primary key, -- mfk_id" : 主键,自动增长列
major_kind_id varchar(5) null, -- major_kind_id" : 职位分类编号
major_kind_name varchar(60) null) -- major_kind_name : 职分类位名称 //工程师
insert into config_major_kind(major_kind_id,major_kind_name) values('01','销售');
insert into config_major_kind(major_kind_id,major_kind_name) values('02','软件开发');
insert into config_major_kind(major_kind_id,major_kind_name) values('03','人力资源');
insert into config_major_kind(major_kind_id,major_kind_name) values('04','生产部');
/* 创建新表 "config_major"。 */
/* "config_major" : 职位设置 */
create table config_major (
mak_id int auto_increment primary key, -- config_major" : 职位设置
major_kind_id varchar(5) not null, -- major_kind_id" : 职位分类编号
major_kind_name varchar(60) not null, -- major_kind_name" : 职位分类名称
major_id varchar(5) not null, -- major_id" : 职位编号
major_name varchar(60) not null, -- major_name" : 职位名称
test_amount int not null) -- test_amount" : 题套数量
select * from config_major;
insert into config_major(major_kind_id,major_kind_name,major_id,major_name,test_amount) values('01','销售','01','区域经理',0);
insert into config_major(major_kind_id,major_kind_name,major_id,major_name,test_amount) values('01','销售','02','总经理',0);
insert into config_major(major_kind_id,major_kind_name,major_id,major_name,test_amount) values('02','软件开发','01','项目经理',0);
insert into config_major(major_kind_id,major_kind_name,major_id,major_name,test_amount) values('02','软件开发','02','程序员',0);
insert into config_major(major_kind_id,major_kind_name,major_id,major_name,test_amount) values('03','人力资源','01','人事经理',0);
insert into config_major(major_kind_id,major_kind_name,major_id,major_name,test_amount) values('03','人力资源','02','专员',0);
insert into config_major(major_kind_id,major_kind_name,major_id,major_name,test_amount) values('04','生产部','01','主任',0);
insert into config_major(major_kind_id,major_kind_name,major_id,major_name,test_amount) values('04','生产部','02','技术工人',0);
/* 创建新表 "HumanFile_dig"。 */
/* "human_file_dig" : 记录人力资源档案所做的任何更改 */
create table human_file_dig (
hfd_id int auto_increment primary key, -- hfd_id" : 主键,自动增长列
human_id varchar(30) not null, -- human_id" : 档案编号
department_name int not null, -- department_name 部门名
human_name varchar(60) not null, -- human_name" : 姓名
human_address varchar(200) not null, -- "human_address" : 地址
human_postcode varchar(10) not null, -- human_postcode" : 邮政编码
human_major_kind_name varchar(60) not null, -- human_major_kind_name" : 职位分类名称
hunma_major_name varchar(60) not null, -- hunma_major_name" : 职位名称
human_mobilephone char(11) not null, -- human_mobilephone" : 手机号码
human_bank varchar(50) not null, -- human_bank" : 开户银行
human_account varchar(30) not null, -- human_account" : 银行帐号
human_qq varchar(15) not null, -- human_qq" : QQ号码
human_email varchar(50) not null, -- human_email" : 电子邮件
human_hobby varchar(60) not null, -- human_hobby" : 爱好
human_speciality varchar(60) not null, -- human_speciality" : 特长
human_sex char(2) not null, -- human_sex" : 性别
human_religion varchar(50) not null, -- human_religion" : 宗教信仰
human_party varchar(50) not null, -- human_party" : 政治面貌
human_nationality varchar(50) not null, -- human_nationality" : 国籍
human_race varchar(50) not null, -- human_race" : 民族
human_birthday varchar(20) not null, -- human_birthday" : 出生日期
human_birthplace varchar(50) not null, -- human_birthplace" : 出生地
human_age varchar(50) not null, -- human_age" : 年龄
human_educated_degree varchar(60) not null, -- human_educated_degree" : 学历
human_educated_years varchar(50) not null, -- "human_educated_years" : 教育年限
human_educated_major varchar(60) not null, -- "human_educated_major" : 学历专业
human_id_card varchar(20) not null, -- "human_id_card" : 身份证号
remark text not null, -- "remark" : 备注
salary_standard_name varchar(60) not null, -- "salary_standard_name" : 薪酬标准名称
salary_sum money varchar(50) not null, -- salary_sum" : 基本薪酬总额
demand_salaray_sum money varchar(50) not null, -- "demand_salaray_sum" : 应发薪酬总额
paid_salary_sum money varchar(50) not null, -- paid_salary_sum" : 实发薪酬总额
major_change_amount varchar(50) not null, -- major_change_amount" : 调动次数
file_chang_amount varchar(255) not null, -- file_chang_amount" : 档案变更累计次数
human_histroy_records text not null, -- "human_histroy_records" : 简历id
human_family_membership text not null, -- "human_family_membership" : 家庭关系
human_picture varchar(255) not null, -- human_picture" : 相片
check_status varchar(60) not null, -- "check_status" : 复核状态
register varchar(60) not null, -- "register" : 档案登记人
checker varchar(60) not null, -- checker" : 档案复核人
changer varchar(60) not null, -- changer" : 档案变更人
regist_time varchar(60) not null, -- regist_time" : 档案登记时间
check_time varchar(60) not null, -- check_time" : 档案复核时间
change_time varchar(60) not null, -- change_time" : 档案变更时间
lastly_change_time varchar(60) not null, -- "lastly_change_time" : 档案最近更改时间
delete_time varchar(60), -- "delete_time" : 档案删除时间
recovery_time varchar(60), -- "recovery_time" : 档案恢复时间
human_file_status varchar(60)) -- "human_file_status" : 档案状态
/* 创建新表 "human_file"。 */
/* "human_file" : 人力资源档案 */
*/
create table human_file (
huf_id int auto_increment primary key, -- 主键,自动增长列
human_id varchar(30) not null, -- human_id" : 档案编号
department_name int not null, -- department_name 部门名
human_name varchar(60) not null, -- human_name" : 姓名
human_address varchar(200) not null, -- "human_address" : 地址
human_postcode varchar(10) not null, -- human_postcode" : 邮政编码
human_major_kind_name varchar(60) not null, -- human_major_kind_name" : 职位分类名称
hunma_major_name varchar(60) not null, -- hunma_major_name" : 职位名称
human_mobilephone char(11) not null, -- human_mobilephone" : 手机号码
human_bank varchar(50) not null, -- human_bank" : 开户银行
human_account varchar(30) not null, -- human_account" : 银行帐号
human_qq varchar(15) not null, -- human_qq" : QQ号码
human_email varchar(50) not null, -- human_email" : 电子邮件
human_hobby varchar(60) not null, -- human_hobby" : 爱好
human_speciality varchar(60) not null, -- human_speciality" : 特长
human_sex char(2) not null, -- human_sex" : 性别
human_religion varchar(50) not null, -- human_religion" : 宗教信仰
human_party varchar(50) not null, -- human_party" : 政治面貌
human_nationality varchar(50) not null, -- human_nationality" : 国籍
human_race varchar(50) not null, -- human_race" : 民族
human_birthday datetime not null, -- human_birthday" : 出生日期
human_birthplace varchar(50) not null, -- human_birthplace" : 出生地
human_age varchar(50) not null, -- human_age" : 年龄
human_educated_degree varchar(60) not null, -- human_educated_degree" : 学历
human_educated_years varchar(50) not null, -- "human_educated_years" : 教育年限
human_educated_major varchar(60) not null, -- "human_educated_major" : 学历专业
human_id_card varchar(20) not null, -- "human_id_card" : 身份证号
remark text varchar(50) not null, -- "remark" : 备注
salary_standard_name varchar(60) not null, -- "salary_standard_name" : 薪酬标准名称
salary_sum money varchar(50) not null, -- salary_sum" : 基本薪酬总额
demand_salaray_sum money varchar(50) not null, -- "demand_salaray_sum" : 应发薪酬总额
paid_salary_sum money varchar(50) not null, -- paid_salary_sum" : 实发薪酬总额
major_change_amount varchar(50) not null, -- major_change_amount" : 调动次数
file_chang_amount varchar(255) not null, -- file_chang_amount" : 档案变更累计次数
human_histroy_records text varchar(255) not null, -- "human_histroy_records" : 简历id
human_family_membership text varchar(255) not null, -- "human_family_membership" : 家庭关系
human_picture varchar(255) not null, -- human_picture" : 相片
human_file_status varchar(60)); -- "human_file_status" : 档案状态
/* 创建新表 "salary_standard_details"。 */
/* "salary_standard_details" : 薪酬标准单详细信息 */
create table salary_standard_details (
sdt_id int auto_increment primary key, --sdt_id" : 主键,自动增长列
standard_id varchar(30) not null, --standard_id" : 薪酬标准单编号
standard_name varchar(60) not null, --standard_name" : 薪酬标准单名称
item_id smallint not null, --item_id" : 薪酬项目序号
item_name varchar(60) not null, --item_name" : 薪酬项目名称
salary money not null) --salary" : 薪酬金额
/* 创建新表 "salary_standard"。 */
/* "salary_standard" : 薪酬标准基本信息表 */
create table salary_standard (
ssd_id int auto_increment primary key, -- ssd_id" : 主键,自动增长列
standard_id varchar(30) not null, -- standard_id" : 薪酬标准单编号
standard_name varchar(60) not null, -- standard_name" : 薪酬标准单名称
designer varchar(60) not null, -- designer" : 制定者名字
register varchar(60) not null, -- register" : 登记人
checker varchar(60) not null, -- checker" : 复核人
changer varchar(60) not null, -- changer" : 变更人
regist_time datetime not null, -- regist_time" : 登记时间
check_time datetime , -- check_time" : 复核时间
change_time datetime not null, -- check_time" : 复核时间
salary_sum double(10,2) not null, -- salary_sum" : 薪酬总额
check_status varchar(9) not null, -- check_status" : 是否经过复核
change_status varchar(9) not null, -- change_status" : 更改状态
check_comment text not null, -- check_comment" : 复核意见
remark text not null) -- remark" : 备注
/* 创建新表 "salary_grant"。 */
/* "salary_grant" : 薪酬发放登记表 */
create table salary_grant(
sgr_id int auto_increment primary key, -- sgr_id : 主键,自动增长列
salary_grant_id varchar(30) not null, -- alary_grant_id" : 薪酬发放编号
department_name varchar(20) not null, -- 部门名称
human_amount int not null, -- human_amount" : 总人数
salary_sum double(10,2) not null, -- salary_sum" : 薪酬总额
salary_paid_sum double(10,2) not null, -- salary_paid_sum" : 实发总金额
register varchar(60) not null, -- register" : 登记人
regist_time datetime not null, -- regist_time" : 登记时间
checker varchar(60) not null, -- checker" : 复核人
check_time varchar(20) not null, -- check_time" : 复核时间
check_status varchar(20) not null) -- check_status" : 复核状态
/* 创建新表 "salary_grant_details"。 */
/* "salary_grant_details" : 薪酬发放详细信息 */
create table salary_grant_details (
grd_id int auto_increment primary key, -- grd_id" : 主键,自动增长列
salary_standard_id varchar(30) not null, -- salary_standard_id" : 薪酬标准单编号
salary_grant_id varchar(30) not null, -- salary_grant_id" : 薪酬发放编号
human_id varchar(30) not null, -- human_id" : 档案编号
human_name varchar(60) not null, -- human_name" : 姓名
bouns_sum double(10,2) not null, -- bouns_sum" : 奖励金额
sale_sum double(10,2) not null, -- sale_sum" : 销售绩效金额
deduct_sum double(10,2) not null, -- deduct_sum" : 应扣金额
salary_standard_sum double(10,2) not null, -- salary_standard_sum" : 标准薪酬总额
salary_paid_sum double(10,2) not null) -- salary_paid_sum" : 实发薪酬总额
/* 创建新表 "major_change"。 */
/* "major_change" : 职位调动表 */
create table major_change (
mch_id int auto_increment primary key, -- mch_id" : 主键,自动增长列
department_name varchar(20) not null , -- 部门名称
major_kind_id varchar(5) not null, -- major_kind_id" : 职位分类编号
major_kind_name varchar(60) not null,-- major_kind_name" : 职位分类名称
major_id varchar(5) not null,-- major_id" : 职位编号
major_name varchar(60) not null,-- major_name" : 职位名称
new_department_name varchar(20) not null , -- 新部门名称
new_major_kind_id varchar(5) not null, -- new_major_kind_id" : 新职位分类编号
new_major_kind_name varchar(60) not null,-- new_major_kind_name" : 新职位分类名称
new_major_id varchar(5) not null, -- new_major_id" : 新职位编号
new_major_name varchar(60) not null,-- new_major_name" : 新职位名称
human_id varchar(30) not null, -- human_id" : 人力资源档案编号
human_name varchar(60) not null,-- human_name" : 姓名
salary_standard_id varchar(30) not null,-- salary_standard_id" : 薪酬标准编号
salary_standard_name varchar(60) not null,-- salary_standard_name" : 薪酬标准名称
salary_sum double(9,2) not null,-- salary_sum" : 薪酬总额
new_salary_standard_id varchar(30) not null,-- new_salary_standard_id" : 新薪酬标准编号
new_salary_standard_name varchar(60) not null,-- new_salary_standard_name" : 新薪酬标准名称
new_salary_sum double(9,2) not null,-- new_salary_sum" : 新薪酬总额
change_reason text not null,-- change_reason" : 调动原因
check_reason text not null,-- check_reason" : 审核通过意见
check_status varchar(20) not null,-- check_status" : 复核通过状态
register varchar(60) not null,-- register" : 登记人
checker varchar(60) not null,-- checker" : 复核人
regist_time varchar(20) not null,-- regist_time" : 登记时间
check_time varchar(20) not null) -- check_time" : 复核时间
-- 职位发表登记表
create table engage_major_release (
mre_id int primary key auto_increment, -- 主键,自动增长列
first_kind_id char(2) not null, -- 一级机构编号
first_kind_name varchar(60) not null, -- 一级机构名称
second_kind_id char(2) not null, -- 二级机构编号
second_kind_name varchar(60) not null, -- 二级机构名称
third_kind_id char(2) not null, -- 三级机构编号
third_kind_name varchar(60) not null, -- 三级机构名称
major_kind_id char(2) not null, -- 职位分类编号
major_kind_name varchar(60) not null, -- 职位分类名称
major_id char(2) not null, -- 职位编号
major_name varchar(60) not null, -- 职位名称
human_amount int not null, -- 招聘人数
engage_type varchar(60) not null, -- 招聘类型
deadline date not null, -- 截至日期
register varchar(60) not null, -- 登记人
changer varchar(60) not null, -- 变更人
regist_time date not null, -- 登记时间
change_time date not null, -- 变更时间
major_describe text not null, -- 职位描述
engage_required text not null -- 招聘要求
)
-- 试卷详细信息
create table engage_exam_details (
exd_id int primary key auto_increment, -- 主键,自动增长列
exam_number varchar(30) not null, -- 试卷编号
first_kind_id char(2) not null, -- 试题一级分类编号
first_kind_name varchar(60) not null, -- 试题一级分类名称
second_kind_id char(2) not null, -- 试题二级分类编号
second_kind_name varchar(60) not null, -- 试题二级分类名称
question_amount int not null -- 出题数量
)
-- 试卷登记表
create table engage_exam (
exa_id int primary key auto_increment, -- 主键,自动增长列
exam_number varchar(30) not null, -- 试卷编号
major_kind_id char(2) not null, -- 职位分类编号
major_kind_name varchar(60) not null, -- 职位分类名称
major_id char(2) not null, -- 职位编号
major_name varchar(60) not null, -- 职位名称
register varchar(60) not null, -- 登记人
regist_time date not null, -- 登记时间
limite_time int not null -- 答题限时
)
-- 考试答题登记表
create table engage_answer (
ans_id int primary key auto_increment, -- 主键,自动增长列
answer_number varchar(30) not null, -- 答案编号
exam_number varchar(30) not null, -- 试卷编号
resume_id int not null, -- 简历编号
interview_id int not null, -- 面试编号
human_name varchar(60) not null, -- 姓名
human_idcard varchar(30) not null, -- 身份证号
major_kind_id char(2) not null, -- 职位分类编号
major_kind_name char(10) not null, -- major_kind_name 属于 engage_answer
major_id char(10) not null, -- major_id 属于 engage_answer
major_name char(10) not null, -- major_name 属于 engage_answer
test_time date not null, -- 测试时间
use_time varchar(20) not null, -- use_time 属于 engage_answer
total_point double(5,2) not null --总分
)
--考试答题详细信息
create table engage_answer_details (
and_id int primary key auto_increment, -- 答案详细信息
answer_number varchar(30) not null, -- 答案编号
subject_id int not null, -- 试题编号
answer varchar(10) not null -- 答题者答案
)
--试题题库登记表
create table engage_subjects (
sub_id int primary key auto_increment, -- 主键,自动增长列
first_kind_id char(2) not null, -- 试题I级分类编号
first_kind_name varchar(60) not null, -- 试题I级分类名称
second_kind_id char(2) not null, -- 试题II级分类编号
second_kind_name varchar(60) not null, -- 试题II级分类名称
register varchar(60) not null, -- 登记人
regist_time date not null, -- 登记时间
derivation varchar(60) not null, -- 试题出处
content text not null, -- 题干
key_a text, -- 答案a
key_b text, -- 答案b
key_c text, -- 答案c
key_d text, -- 答案d
key_e text, -- 答案e
correct_key varchar(10) not null, -- 正确答案
changer varchar(60) not null, -- 变更人
change_time date not null -- 变更时间
)
--简历管理表
create table engage_resume (
res_id int primary key auto_increment, -- 主键,自动增长列
human_name varchar(60) not null, -- 姓名
engage_type varchar(30) not null, -- 招聘类型
human_address varchar(200) not null, -- 地址
human_postcode varchar(10) not null, -- 邮编
human_major_kind_id char(2) not null, -- 职位分类编号
human_major_kind_name varchar(60) not null, -- 职位分类名称
human_major_id char(2) not null, -- 职位编号
human_major_name varchar(60) not null, -- 职位名称
human_telephone varchar(60) not null, -- 电话号码
human_homephone"" varchar(60) not null, -- 家庭电话
human_mobilephone varchar(60) not null, -- 手机
human_email varchar(60) not null, -- Email
human_hobby varchar(200) not null, -- 兴趣爱好
human_specility varchar(200) not null, -- 特长
human_sex char(2) not null, -- 性别
human_religion varchar(60) not null, -- 宗教信仰
human_party varchar(60) not null, -- 政治面貌
human_nationality varchar(60) not null, -- 国籍
human_race varchar(60) not null, -- 民族
human_birthday date not null, -- 生日
human_age int not null, -- 年龄
human_educated_degree varchar(60) not null, -- 教育程度
human_educated_years int not null, -- 教育年限
human_educated_major varchar(60) not null, -- 专业
human_college varchar(60) not null, -- 毕业院校
human_idcard varchar(60) not null, -- 身份证号
human_birthplace varchar(200) not null, -- 出生地
demand_salary_standard double(15,2) not null,-- 薪酬标准
human_history_records text not null, -- 个人履历
remark text not null, --备注
recomandation text not null, -- 推荐意见
human_picture varchar(60) not null, -- 照片
attachment_name varchar(60) not null, -- 档案附件
check_status int not null, -- 复核状态
register varchar(60) not null, -- 登记人
regist_time date not null, -- 登记时间
checker varchar(60) not null, -- 复核人姓名
check_time date not null, -- 复核时间
interview_status int not null, -- 面试状态
total_points float not null, -- 总分
test_amount int not null, -- 考试次数
test_checker varchar(60) not null, -- 测试复核人
test_check_time date not null, -- 测试复核时间
pass_register varchar(60) not null, -- 通过登记人姓名
pass_regist_time date not null, -- 通过登记时间
pass_checker varchar(60) not null, -- 通过复核人姓名
pass_check_time date not null, -- 通过复核时间
pass_check_status int not null, -- 通过的复核状态
pass_checkComment varchar(60) not null, -- 录用申请审核意见
pass_passComment varchar(60) not null -- 录用申请审批意见
)
--面试表
create table engage_interview (
ein_id int primary key auto_increment, -- 主键,自动增长列
human_name varchar(60) not null, -- 姓名
interview_amount int not null, -- 面试次数
human_major_kind_id char(2) not null, -- 职位分类编号
human_major_kind_name varchar(30) not null, -- 职位分类名称
human_major_id char(2) not null, -- 职位编号
human_major_name varchar(30) not null, -- 职位名称
image_degree varchar(20) not null, -- 形象等级
native_language_degree varchar(20) not null, -- 口才等级
foreign_language_degree varchar(20) not null, -- 外语水平等级
response_speed_degree varchar(20) not null, -- 应变能力
EQ_degree varchar(20) not null, -- EQ等级
IQ_degree varchar(20) not null, -- IQ_等级
multi_quality_degree varchar(20) not null, -- 综合素质
register varchar(60) not null, -- 面试人
checker varchar(60) not null, -- 筛选人
registe_time date not null, -- 面试时间
check_time date not null, -- 筛选时间
resume_id int not null, -- 简历编号
result varchar(20) not null, -- 面试结果
interview_comment text not null, -- 面试评价
check_comment text not null, -- 筛选评价
interview_status int not null, -- 面试状态
check_status int not null -- 筛选状态
)
| true
|
b0a8d6370f938d44f68c588b570ad6ecd1a6a1ca
|
SQL
|
tuma01/bazar
|
/amachi-model/DATA/DDL/MUNICIPIO.sql
|
UTF-8
| 772
| 3.75
| 4
|
[] |
no_license
|
CREATE TABLE `municipio` (
`MUN_ID` INT(11) NOT NULL AUTO_INCREMENT,
`MUN_NAME` VARCHAR(50) NOT NULL COLLATE 'utf8_unicode_ci',
`FK_DTO_ID` INT(11) NOT NULL,
`CREATED_BY` VARCHAR(50) NOT NULL COLLATE 'utf8_unicode_ci',
`CREATED_DATE` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFIED_BY` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
`MODIFIED_DATE` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`MUN_ID`),
INDEX `FK_MUNICIPIO_DEPARTAMENTO` (`FK_DTO_ID`),
INDEX `FK_MUNICIPIO_USER` (`CREATED_BY`),
CONSTRAINT `FK_MUNICIPIO_DEPARTAMENTO` FOREIGN KEY (`FK_DTO_ID`) REFERENCES `departamento` (`DTO_ID`),
CONSTRAINT `FK_MUNICIPIO_USER` FOREIGN KEY (`CREATED_BY`) REFERENCES `user` (`USERNAME`)
)
COLLATE='utf8_unicode_ci'
ENGINE=InnoDB
;
| true
|
04e96d639ac9db6b083765721c2c7cd079a28b85
|
SQL
|
labanish/ORDS
|
/vacancies.sql
|
UTF-8
| 4,929
| 2.90625
| 3
|
[] |
no_license
|
--------------------------------------------------------
-- File created - Friday-November-08-2019
--------------------------------------------------------
--------------------------------------------------------
-- DDL for Table VACANCIES
--------------------------------------------------------
CREATE TABLE "LABANISH"."VACANCIES"
( "ID" NUMBER,
"VACANCYID" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP",
"TITLE" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP",
"JOBTYPE" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP",
"LOCATION" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP",
"POSTEDDATE" DATE,
"CREATED" DATE,
"CREATED_BY" VARCHAR2(255 BYTE) COLLATE "USING_NLS_COMP",
"UPDATED" DATE,
"UPDATED_BY" VARCHAR2(255 BYTE) COLLATE "USING_NLS_COMP"
) DEFAULT COLLATION "USING_NLS_COMP" SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DATA" ;
REM INSERTING into LABANISH.VACANCIES
SET DEFINE OFF;
Insert into LABANISH.VACANCIES (ID,VACANCYID,TITLE,JOBTYPE,LOCATION,POSTEDDATE,CREATED,CREATED_BY,UPDATED,UPDATED_BY) values (200406437507811799849304496586690798798,'SE100','Solution Engineer -UKIL','TECH','EUROPE',to_date('07-NOV-19','DD-MON-RR'),to_date('07-NOV-19','DD-MON-RR'),'LABANISH',to_date('07-NOV-19','DD-MON-RR'),'LABANISH');
Insert into LABANISH.VACANCIES (ID,VACANCYID,TITLE,JOBTYPE,LOCATION,POSTEDDATE,CREATED,CREATED_BY,UPDATED,UPDATED_BY) values (200406437507813008775124111215865504974,'HR200','HR Manager','HR','AFRICA',to_date('07-NOV-19','DD-MON-RR'),to_date('07-NOV-19','DD-MON-RR'),'LABANISH',to_date('07-NOV-19','DD-MON-RR'),'LABANISH');
Insert into LABANISH.VACANCIES (ID,VACANCYID,TITLE,JOBTYPE,LOCATION,POSTEDDATE,CREATED,CREATED_BY,UPDATED,UPDATED_BY) values (200410544913582774449681818124964000952,'MKT300','Marketing Manager','MARKETING','ASIA',to_date('07-NOV-19','DD-MON-RR'),to_date('07-NOV-19','DD-MON-RR'),'LABANISH',to_date('07-NOV-19','DD-MON-RR'),'LABANISH');
Insert into LABANISH.VACANCIES (ID,VACANCYID,TITLE,JOBTYPE,LOCATION,POSTEDDATE,CREATED,CREATED_BY,UPDATED,UPDATED_BY) values (200423860548078818403752173986663545486,'MKT301','Marketing Manager','MARKETING','EUROPE',to_date('07-NOV-19','DD-MON-RR'),to_date('07-NOV-19','DD-MON-RR'),'LABANISH',to_date('07-NOV-19','DD-MON-RR'),'LABANISH');
Insert into LABANISH.VACANCIES (ID,VACANCYID,TITLE,JOBTYPE,LOCATION,POSTEDDATE,CREATED,CREATED_BY,UPDATED,UPDATED_BY) values (200423860548080027329571788615838251662,'SE101','Solution Engineering','TECH','AFRICA',to_date('07-NOV-19','DD-MON-RR'),to_date('07-NOV-19','DD-MON-RR'),'LABANISH',to_date('07-NOV-19','DD-MON-RR'),'LABANISH');
--------------------------------------------------------
-- DDL for Index VACANCIES_ID_PK
--------------------------------------------------------
CREATE UNIQUE INDEX "LABANISH"."VACANCIES_ID_PK" ON "LABANISH"."VACANCIES" ("ID")
PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DATA" ;
--------------------------------------------------------
-- DDL for Trigger VACANCIES_BIU
--------------------------------------------------------
CREATE OR REPLACE EDITIONABLE TRIGGER "LABANISH"."VACANCIES_BIU"
before insert or update
on vacancies
for each row
begin
if :new.id is null then
:new.id := to_number(sys_guid(), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
end if;
if inserting then
:new.created := sysdate;
:new.created_by := nvl(sys_context('APEX$SESSION','APP_USER'),user);
end if;
:new.updated := sysdate;
:new.updated_by := nvl(sys_context('APEX$SESSION','APP_USER'),user);
end vacancies_biu;
/
ALTER TRIGGER "LABANISH"."VACANCIES_BIU" ENABLE;
--------------------------------------------------------
-- Constraints for Table VACANCIES
--------------------------------------------------------
ALTER TABLE "LABANISH"."VACANCIES" MODIFY ("ID" NOT NULL ENABLE);
ALTER TABLE "LABANISH"."VACANCIES" MODIFY ("CREATED" NOT NULL ENABLE);
ALTER TABLE "LABANISH"."VACANCIES" MODIFY ("CREATED_BY" NOT NULL ENABLE);
ALTER TABLE "LABANISH"."VACANCIES" MODIFY ("UPDATED" NOT NULL ENABLE);
ALTER TABLE "LABANISH"."VACANCIES" MODIFY ("UPDATED_BY" NOT NULL ENABLE);
ALTER TABLE "LABANISH"."VACANCIES" ADD CONSTRAINT "VACANCIES_ID_PK" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DATA" ENABLE;
| true
|
8d99b116d14031cacb58202f4cc81ab9918e1518
|
SQL
|
citusdata/postgresql-hll
|
/sql/disable_hashagg.sql
|
UTF-8
| 4,163
| 3.734375
| 4
|
[
"Apache-2.0"
] |
permissive
|
-- ----------------------------------------------------------------
-- Regression tests for disabling hash aggregation
-- ----------------------------------------------------------------
-- Since we get different results for 3 different PG version sets, add following
-- queries to specify version of the output easier.
SHOW server_version_num \gset
SELECT :'server_version_num' >= 90600 as version_above_nine_five;
SELECT :'server_version_num' >= 90500 AND :'server_version_num' < 90600 as version_nine_five;
SELECT :'server_version_num' >= 90400 AND :'server_version_num' < 90500 as version_nine_four;
SELECT hll_set_output_version(1);
CREATE TABLE tt1(id int, col_1 int, sd hll);
INSERT INTO tt1 values(1,1, hll_empty());
INSERT INTO tt1 values(1,2, hll_empty());
UPDATE tt1 SET sd = hll_add(sd, hll_hash_integer(111)) WHERE id = 1 and col_1 = 1;
UPDATE tt1 SET sd = hll_add(sd, hll_hash_integer(222)) WHERE id = 1 and col_1 = 2;
INSERT INTO tt1 values(2,1, hll_empty());
INSERT INTO tt1 values(2,2, hll_empty());
UPDATE tt1 SET sd = hll_add(sd, hll_hash_integer(333)) WHERE id = 2 and col_1 = 1;
UPDATE tt1 SET sd = hll_add(sd, hll_hash_integer(444)) WHERE id = 2 and col_1 = 2;
-- Test with hll_union_agg
SET hll.force_groupagg to OFF;
EXPLAIN(COSTS OFF)
SELECT
id, hll_union_agg(sd)
FROM
tt1
GROUP BY(id);
SET hll.force_groupagg to ON;
EXPLAIN(COSTS OFF)
SELECT
id, hll_union_agg(sd)
FROM
tt1
GROUP BY(id);
-- Test with operator over aggregate
SET hll.force_groupagg to OFF;
EXPLAIN(COSTS OFF)
SELECT
id, hll_union_agg(sd) || hll_union_agg(sd)
FROM
tt1
GROUP BY(id);
SET hll.force_groupagg to ON;
EXPLAIN(COSTS OFF)
SELECT
id, hll_union_agg(sd) || hll_union_agg(sd)
FROM
tt1
GROUP BY(id);
-- Test with function over aggregate
SET hll.force_groupagg to OFF;
EXPLAIN(COSTS OFF)
SELECT
id, hll_cardinality(hll_union_agg(sd))
FROM
tt1
GROUP BY(id);
SET hll.force_groupagg to ON;
EXPLAIN(COSTS OFF)
SELECT
id, hll_cardinality(hll_union_agg(sd))
FROM
tt1
GROUP BY(id);
-- Test with having clause
SET hll.force_groupagg to OFF;
EXPLAIN(COSTS OFF)
SELECT
id, hll_cardinality(hll_union_agg(sd))
FROM
tt1
GROUP BY(id)
HAVING hll_cardinality(hll_union_agg(sd)) > 1;
SET hll.force_groupagg to ON;
EXPLAIN(COSTS OFF)
SELECT
id, hll_cardinality(hll_union_agg(sd))
FROM
tt1
GROUP BY(id)
HAVING hll_cardinality(hll_union_agg(sd)) > 1;
-- Test hll_add_agg, first set work_mem to 256MB in order to use hash aggregate
-- before forcing group aggregate
SET work_mem TO '256MB';
CREATE TABLE add_test_table(c1 bigint, c2 bigint);
INSERT INTO add_test_table SELECT g, g FROM generate_series(1, 1000) AS g;
-- Test with different hll_add_agg signatures
SET hll.force_groupagg TO OFF;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2))
FROM
add_test_table
GROUP BY 1;
SET hll.force_groupagg TO ON;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2))
FROM
add_test_table
GROUP BY 1;
SET hll.force_groupagg TO OFF;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2), 10)
FROM
add_test_table
GROUP BY 1;
SET hll.force_groupagg TO ON;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2), 10)
FROM
add_test_table
GROUP BY 1;
SET hll.force_groupagg TO OFF;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2), 10, 4)
FROM
add_test_table
GROUP BY 1;
SET hll.force_groupagg TO ON;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2), 10, 4)
FROM
add_test_table
GROUP BY 1;
SET hll.force_groupagg TO OFF;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2), 10, 4, 512)
FROM
add_test_table
GROUP BY 1;
SET hll.force_groupagg TO ON;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2), 10, 4, 512)
FROM
add_test_table
GROUP BY 1;
SET hll.force_groupagg TO OFF;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2), 10, 4, 512, 0)
FROM
add_test_table
GROUP BY 1;
SET hll.force_groupagg TO ON;
EXPLAIN(COSTS OFF)
SELECT
c1, hll_add_agg(hll_hash_bigint(c2), 10, 4, 512, 0)
FROM
add_test_table
GROUP BY 1;
RESET work_mem;
DROP TABLE tt1;
DROP TABLE add_test_table;
| true
|
f8c398af8651b2e350c593bf1273e2ff2686aa5f
|
SQL
|
vutuantrung/ITI.DBPython
|
/sql/20192504.003.Install-tTiradeCreate.sql
|
UTF-8
| 395
| 2.828125
| 3
|
[] |
no_license
|
create table if not exists tirades (
id_tirade integer not null primary key,
id_piece integer not null,
id_personnage integer not null,
acte integer,
scene integer,
constraint tirades_fk1 foreign key ( id_piece ) references pieces ( id_piece ),
constraint tirades_fk2 foreign key ( id_personnage ) references personnages ( id_personnage )
);
| true
|
70a5b983dde786135c4d7e88cadced48e4401841
|
SQL
|
elyeel/bootcampx
|
/4_queries/most_confusing_assignments.sql
|
UTF-8
| 256
| 3.609375
| 4
|
[] |
no_license
|
SELECT
assignments.id as id,
assignments.name as name,
day,
chapter,
count(assistance_requests.id) as total_requests
FROM assignments
JOIN assistance_requests ON assignment_id = assignments.id
GROUP BY assignments.id
ORDER BY total_requests DESC;
| true
|
c1061b00f155f7cb86e0a034f3feaf3f7908cd46
|
SQL
|
koroshiya/SPOTS
|
/sql/SP_ScanUser.sql
|
UTF-8
| 7,170
| 4.0625
| 4
|
[] |
no_license
|
/*ScanUserIO
userID smallint unsigned not null AUTO_INCREMENT,
userName varchar(30) not null unique,
userPassword char(40) not null,
email varchar(100) not null,
title character not null,
status character not null,
PRIMARY KEY (userID)
*/
/*insert_user(userName, userPassword, userRole[, email, title])*/
DELIMITER //
DROP FUNCTION IF EXISTS insert_user //
CREATE FUNCTION insert_user(userName varchar(30), userPassword varchar(20), email varchar(100), title character) RETURNS boolean NOT DETERMINISTIC
BEGIN
DECLARE totalUsers smallint unsigned;
DECLARE sha1Password binary(20);
SELECT COUNT(*) INTO totalUsers FROM ScanUser;
IF totalUsers = 65534 THEN
RETURN false;
END IF;
SET sha1Password = (SHA1(CONCAT(userName, userPassword, 'myEpicSalt', email)));
INSERT INTO ScanUser(userName, userPassword, email, title, status) VALUES(userName, sha1Password, email, title, 'A');
RETURN true;
END //
DELIMITER ;
/*delete_user(userID)
If a user is the founder, webmaster, has tasks still assigned to them,
or is the project manager of at least one series, this function fails and returns false.*/
DELIMITER //
DROP FUNCTION IF EXISTS delete_user //
CREATE FUNCTION delete_user(userID smallint unsigned) RETURNS boolean NOT DETERMINISTIC
BEGIN
IF is_founder(userID) OR is_webmaster(userID) OR get_user_task_count(userID) > 0 OR is_project_manager(userID) THEN
RETURN false;
END IF;
DELETE FROM ScanUser WHERE ScanUser.userID = userID;
RETURN true;
END //
DELIMITER ;
/*delete_user_force(userID)
If a user is the founder or webmaster, fails and returns false.
All associated Tasks are deallocated. Same with Series for which the user is the project manager.*/
DELIMITER //
DROP FUNCTION IF EXISTS delete_user_force //
CREATE FUNCTION delete_user_force(userID smallint unsigned) RETURNS boolean NOT DETERMINISTIC
BEGIN
IF is_founder(userID) OR is_webmaster(userID) THEN
RETURN false;
END IF;
DELETE FROM Task WHERE Task.userID = userID;
DELETE FROM UserRole WHERE UserRole.userID = userID;
UPDATE Series AS s SET s.projectManagerID = NULL WHERE s.projectManagerID = userID;
DELETE FROM ScanUser WHERE ScanUser.userID = userID;
RETURN true;
END //
DELIMITER ;
/*user_set_password*/
DELIMITER //
DROP FUNCTION IF EXISTS user_set_password //
CREATE FUNCTION user_set_password(userID smallint unsigned, newPassword varchar(20)) RETURNS boolean DETERMINISTIC
BEGIN
DECLARE sha1Password char(40);
DECLARE userName varchar(30);
DECLARE userEmail varchar(100);
DECLARE userExists boolean;
SET userExists = EXISTS(SELECT 1 FROM ScanUser WHERE ScanUser.userID = userID);
IF NOT userExists THEN
RETURN false;
END IF;
SELECT su.userName, su.email INTO userName, userEmail FROM ScanUser AS su WHERE su.userID = userID;
SET sha1Password = (SHA1(CONCAT(userName, newPassword, 'myEpicSalt', userEmail)));
Update ScanUser SET ScanUser.userPassword = sha1Password;
RETURN true;
END //
DELIMITER ;
/*user_get_password_valid*/
DELIMITER //
DROP FUNCTION IF EXISTS user_get_password_valid //
CREATE FUNCTION user_get_password_valid(userID smallint unsigned, password varchar(20)) RETURNS smallint unsigned DETERMINISTIC
BEGIN
DECLARE sha1Password char(40);
DECLARE userName varchar(30);
DECLARE userEmail varchar(100);
DECLARE userExists boolean;
DECLARE userPass char(40);
SET userExists = EXISTS(SELECT 1 FROM ScanUser WHERE ScanUser.userID = userID);
IF NOT userExists THEN
RETURN 65535;
END IF;
SELECT su.userName, su.email, su.userPassword INTO userName, userEmail, userPass FROM ScanUser AS su WHERE su.userID = userID;
SET sha1Password = (SHA1(CONCAT(userName, password, 'myEpicSalt', userEmail)));
IF STRCMP(userPass, sha1Password) = 0 THEN
RETURN userID;
END IF;
RETURN 65535;
END //
DELIMITER ;
/*user_get_password_valid*/
DELIMITER //
DROP FUNCTION IF EXISTS user_get_password_valid_by_name //
CREATE FUNCTION user_get_password_valid_by_name(userName varchar(30), password varchar(20)) RETURNS smallint unsigned DETERMINISTIC
BEGIN
DECLARE sha1Password char(40);
DECLARE userEmail varchar(100);
DECLARE userExists boolean;
DECLARE userPass char(40);
DECLARE userID smallint unsigned;
SET userExists = EXISTS(SELECT 1 FROM ScanUser WHERE ScanUser.userName = userName);
IF NOT userExists THEN
RETURN 65535;
END IF;
SELECT su.email, su.userPassword, su.userID INTO userEmail, userPass, userID FROM ScanUser AS su WHERE su.userName = userName;
SET sha1Password = (SHA1(CONCAT(userName, password, 'myEpicSalt', userEmail)));
IF STRCMP(userPass, sha1Password) = 0 THEN
RETURN userID;
END IF;
RETURN 65535;
END //
DELIMITER ;
/*user_set_email*/
DELIMITER //
DROP FUNCTION IF EXISTS user_set_email //
CREATE FUNCTION user_set_email(userID smallint unsigned, newEmail varchar(100)) RETURNS boolean DETERMINISTIC
BEGIN
DECLARE sha1Password char(40);
DECLARE userName varchar(30);
DECLARE userExists boolean;
DECLARE userPass char(40);
SET userExists = EXISTS(SELECT 1 FROM ScanUser WHERE ScanUser.userID = userID);
IF NOT userExists THEN
RETURN false;
END IF;
SELECT su.userName, su.userPass INTO userName, userPass FROM ScanUser AS su WHERE su.userID = userID;
SET sha1Password = (SHA1(CONCAT(userName, newPassword, 'myEpicSalt', newEmail)));
Update ScanUser SET ScanUser.userPassword = sha1Password, ScanUser.email = newEmail;
RETURN true;
END //
DELIMITER ;
/*user_get_email*/
DELIMITER //
DROP FUNCTION IF EXISTS user_get_email //
CREATE FUNCTION user_get_email(userID smallint unsigned) RETURNS varchar(100) DETERMINISTIC
BEGIN
DECLARE email varchar(100);
SELECT s.email INTO email FROM ScanUser AS s WHERE s.userID = userID;
RETURN email;
END //
DELIMITER ;
/*user_set_permission*/
DELIMITER //
DROP FUNCTION IF EXISTS user_set_permission //
CREATE FUNCTION user_set_permission(userID smallint unsigned, newRole character) RETURNS boolean DETERMINISTIC
BEGIN
IF NOT(newRole = 'S' OR newRole = 'A' OR newRole = 'M') THEN /*s = staff, a = admin, m = mod*/
RETURN false;
END IF;
UPDATE ScanUser AS su SET su.title = newRole;
RETURN true;
END //
DELIMITER ;
/*user_get_permission*/
DELIMITER //
DROP FUNCTION IF EXISTS user_get_permission //
CREATE FUNCTION user_get_permission(userID smallint unsigned) RETURNS character DETERMINISTIC
BEGIN
DECLARE title character;
SELECT u.title INTO title FROM ScanUser AS u WHERE u.userID = userID;
RETURN title;
END //
DELIMITER ;
/*is_project_manager
Tests if the user is a project manager for ANY series, not one in particular.*/
DELIMITER //
DROP FUNCTION IF EXISTS is_project_manager //
CREATE FUNCTION is_project_manager(userID smallint unsigned) RETURNS boolean DETERMINISTIC
BEGIN
DECLARE total smallint unsigned;
SELECT COUNT(*) INTO total FROM Series AS s WHERE s.projectManagerID = userID;
RETURN total != 0;
END //
DELIMITER ;
/*is_project_manager_of_series
Tests if the user is a project manager of a particular series*/
DELIMITER //
DROP FUNCTION IF EXISTS is_project_manager_of_series //
CREATE FUNCTION is_project_manager_of_series(userID smallint unsigned, seriesID smallint unsigned) RETURNS boolean DETERMINISTIC
BEGIN
DECLARE pmID smallint unsigned;
SELECT s.projectManagerID INTO pmID FROM Series AS s WHERE s.seriesID = seriesID;
RETURN pmID = userID;
END //
DELIMITER ;
| true
|
5c75c93f1bf16e35d63564ecee058f6c5edbd259
|
SQL
|
mahruskh/simple-crud-codeigniter
|
/db_cidatasiswa.sql
|
UTF-8
| 4,106
| 2.78125
| 3
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 14 Jun 2017 pada 10.33
-- Versi Server: 10.1.16-MariaDB
-- PHP Version: 5.6.24
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `db_cidatasiswa`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_admin`
--
CREATE TABLE `tb_admin` (
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`level` tinyint(4) NOT NULL,
`nama` varchar(255) NOT NULL,
`keterangan` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tb_admin`
--
INSERT INTO `tb_admin` (`username`, `password`, `level`, `nama`, `keterangan`) VALUES
('admin', '$2y$10$F6rClbUZc83yGvooKYLEVemLuRK1/iDrxhUFLVkP/aj3s4lkCzwNu', 1, 'Mahrus Khomaini', 'Web Developer');
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_siswa`
--
CREATE TABLE `tb_siswa` (
`nis` varchar(20) NOT NULL,
`nama` varchar(255) NOT NULL,
`jk` varchar(1) NOT NULL,
`tmpt_lahir` varchar(255) NOT NULL,
`tgl_lahir` date NOT NULL,
`alamat` varchar(255) NOT NULL,
`nama_ayah` varchar(255) NOT NULL,
`nama_ibu` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tb_siswa`
--
INSERT INTO `tb_siswa` (`nis`, `nama`, `jk`, `tmpt_lahir`, `tgl_lahir`, `alamat`, `nama_ayah`, `nama_ibu`) VALUES
('12129987', 'yughi', 'P', 'mm', '2017-05-02', 'jkbv9999', 'jk', 'm'),
('12323245', 'Indri Rahayuningsih', 'P', 'Jakarta', '1997-06-03', 'Jakarta ', 'Sugeng ', 'Inamas'),
('13291722', 'Dedi Hermawan Putra', 'L', 'Malang', '1997-08-06', 'Blitar', 'Hedi', 'Heni'),
('14201021', 'Arista Septiana Dewi', 'P', 'Situbondo', '1995-07-17', 'Malang', 'Dani', 'Heni'),
('14201064', 'Rian Priskanova', 'L', 'Malang', '1996-05-08', 'Malang', 'Sugianto', 'Rina'),
('14201075', 'Mahrus Khomaini', 'L', 'Sungai Durian', '1996-05-03', 'Bandung', 'Muhammad Makky', 'Rusminah'),
('14201076', 'Muhammad Idris', 'L', 'Pasuruan', '1997-10-21', 'Pasuruan', 'Sugeng', 'Dewi Sakinah'),
('14201077', 'Muhammad Yusuf', 'L', 'Malang', '1996-07-16', 'Malang', 'Sigit', 'Donita'),
('14201088', 'Siti Halimah', 'P', 'Malang', '1996-07-22', 'Surabaya', 'Joko', 'Hesni'),
('14201278', 'Yuni Ika Sari', 'P', 'Pasuruan', '1996-04-16', 'Malang', 'Joni', 'Hani'),
('21490782', 'mmmm', 'P', 'vyih', '2017-06-08', 'vhkj', 'hj', 'bhj'),
('23239822', 'Muhammad Musfafa', 'L', 'Banjarmasin', '1998-12-02', 'Banjarmasin', 'Ahmat Tani', 'Tina'),
('32323822', 'Lingga Dewi Ramadhani', 'P', 'Malang', '1995-07-05', 'Malang', 'Ramadhan', 'Dewi'),
('45233245', 'Hasni Ika', 'P', 'Malang', '1996-08-14', 'Jakarta', 'Joko', 'Ina'),
('45493876', 'Devi Rahayu', 'P', 'Surabaya', '1997-02-21', 'Bandung', 'Antoni', 'Sakinah'),
('54355467', 'Ramadhani Eka Putri', 'P', 'Jambi', '1994-06-07', 'Bandung', 'SigitnPurnomo', 'Dewi Satina'),
('75675667', 'Eko Ramadhan', 'L', 'Jakarta', '1997-12-08', 'Surabaya', 'Darji Santo', 'Santi Putirani'),
('75839204', 'jjj', 'P', 'fdgfdgfdgf', '2017-06-07', 'fdfgdfgd', 'fgdgfd', 'fgdfg'),
('76589144', 'Muhammad Nasution Putra', 'L', 'Banjarmasin', '1997-03-09', 'Blitar', 'Sodik', 'Dewilah'),
('76886790', 'Arka Jaya Romadhon', 'L', 'Bandung', '1997-07-22', 'Bandung', 'Sutisna', 'Eni'),
('83019298', 'Dani Prasetyo Ramadhan', 'L', 'Malang', '1998-06-11', 'Madura', 'Darmaji', 'Hardiana'),
('93939393', 'mmmm', 'P', 'vyih', '2017-06-08', 'vhkj', 'hj', 'bhj'),
('94949403', 'Musa', 'P', 'Surabaya', '2017-06-14', 'Muha', '', ''),
('95039481', '<script type="text/javascript"> alert("HAHAHA"); </script>', 'L', 'hjnv', '2017-06-01', 'uiyfuihoj', 'hhvji', '');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tb_admin`
--
ALTER TABLE `tb_admin`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `tb_siswa`
--
ALTER TABLE `tb_siswa`
ADD PRIMARY KEY (`nis`);
/*!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 */;
| true
|
2ef2488e28976ac8f8ab8f44e969c9fc92ae0b59
|
SQL
|
zyra83/docker-image-geonames
|
/import/data/import.sql
|
UTF-8
| 7,269
| 3.640625
| 4
|
[] |
no_license
|
DROP DATABASE IF EXISTS geoname;
CREATE DATABASE geoname;
USE geoname;
--
-- Table structure for table `admin1_codes`
--
CREATE TABLE `admin1_codes` (
`code` varchar(255) NOT NULL,
`label` varchar(255) DEFAULT NULL,
`ascii_label` varchar(255) DEFAULT NULL,
`geoname_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`code`),
KEY `idx_geoname_id` (`geoname_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Level 1 administrations (régions pour la France)';
--
-- Table structure for table `admin2_codes`
--
CREATE TABLE `admin2_codes` (
`code` varchar(255) NOT NULL,
`label` varchar(255) DEFAULT NULL,
`ascii_label` varchar(255) DEFAULT NULL,
`geoname_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`code`),
KEY `idx_geoname_id` (`geoname_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `alternate_names`
--
CREATE TABLE `alternate_names` (
`id` bigint(20) NOT NULL,
`geoname_id` bigint(20) DEFAULT NULL,
`iso_language` varchar(255) DEFAULT NULL,
`alternate_name` varchar(255) DEFAULT NULL,
`is_preferred_name` varchar(255) DEFAULT NULL,
`is_short_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_geoname_id` (`geoname_id`),
KEY `idx_iso_language` (`iso_language`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Table structure for table `continent_codes`
--
CREATE TABLE `continent_codes` (
`code` char(2) NOT NULL,
`name` varchar(20) DEFAULT NULL,
`geoname_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `country_infos`
--
CREATE TABLE `country_infos` (
`iso_alpha2` char(2) NOT NULL,
`iso_alpha3` char(3) DEFAULT NULL,
`iso_numeric` int(11) DEFAULT NULL,
`fips` varchar(3) DEFAULT NULL,
`name` varchar(200) DEFAULT NULL,
`capital` varchar(200) DEFAULT NULL,
`area` varchar(244) DEFAULT NULL,
`population` int(11) DEFAULT NULL,
`continent` char(2) DEFAULT NULL,
`tld` char(3) DEFAULT NULL,
`currency` char(3) DEFAULT NULL,
`currency_name` char(20) DEFAULT NULL,
`phone` varchar(255) DEFAULT NULL,
`postal_code_format` varchar(255) DEFAULT NULL,
`postal_code_regex` varchar(255) DEFAULT NULL,
`languages` varchar(200) DEFAULT NULL,
`geoname_id` bigint(20) DEFAULT NULL,
`neighbours` varchar(255) DEFAULT NULL,
`equivalent_fips_code` char(10) DEFAULT NULL,
PRIMARY KEY (`iso_alpha2`),
KEY `idx_1` (`iso_alpha3`),
KEY `idx_2` (`iso_numeric`),
KEY `idx_3` (`geoname_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `feature_codes`
--
CREATE TABLE `feature_codes` (
`code` varchar(10) NOT NULL,
`name` varchar(200) DEFAULT NULL,
`description` text,
PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `geonames`
--
CREATE TABLE `geonames` (
`id` int(11) NOT NULL,
`name` varchar(200) DEFAULT NULL,
`ascii_name` varchar(200) DEFAULT NULL,
`alternate_names` text,
`latitude` float DEFAULT NULL,
`longitude` float DEFAULT NULL,
`feature_class` varchar(1) DEFAULT NULL,
`feature_code` varchar(10) DEFAULT NULL,
`country_code` varchar(2) DEFAULT NULL,
`cc2` varchar(60) DEFAULT NULL,
`admin1_code` varchar(20) DEFAULT NULL,
`admin2_code` varchar(80) DEFAULT NULL,
`admin3_code` varchar(20) DEFAULT NULL,
`admin4_code` varchar(20) DEFAULT NULL,
`population` bigint(20) DEFAULT NULL,
`elevation` bigint(20) DEFAULT NULL,
`dem` varchar(255) DEFAULT NULL,
`timezone` varchar(40) DEFAULT NULL,
`modification` date DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_elevation` (`elevation`),
KEY `idx_feature_code` (`feature_code`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Table structure for table `iso_language_codes`
--
CREATE TABLE `iso_language_codes` (
`iso_639_3` char(4) DEFAULT NULL,
`iso_639_2` varchar(50) DEFAULT NULL,
`iso_639_1` varchar(50) DEFAULT NULL,
`language_name` varchar(200) DEFAULT NULL,
KEY `idx_1` (`iso_639_3`),
KEY `idx_2` (`iso_639_2`),
KEY `idx_3` (`iso_639_1`),
KEY `idx_4` (`language_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `time_zones`
--
CREATE TABLE `time_zones` (
`id` varchar(255) NOT NULL,
`gmt_offset_20120101` decimal(4,2) DEFAULT NULL,
`dst_offset_20120701` decimal(4,2) DEFAULT NULL,
`raw_offset` decimal(4,2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `user_tags`
--
CREATE TABLE `user_tags` (
`geoname_id` bigint(20) DEFAULT NULL,
`label` varchar(255) DEFAULT NULL,
KEY `idx_1` (`geoname_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOAD DATA INFILE 'L:/www/js-geonames/import/dl/admin1CodesASCII.txt'
INTO TABLE geoname.admin1_codes;
LOAD DATA INFILE 'L:/www/js-geonames/import/dl/admin2Codes.txt'
INTO TABLE geoname.admin2_codes;
LOAD DATA INFILE 'L:/www/js-geonames/import/dl/alternateNames.txt'
INTO TABLE geoname.alternate_names
(
id,
geoname_id,
@iso_language,
@alternate_name,
@is_preferred_name,
@is_short_name
)
SET
iso_language = nullif(@iso_language, ''),
alternate_name = nullif(@alternate_name, ''),
is_preferred_name = if(@is_preferred_name = 1, true, false),
is_short_name = if(@is_short_name = 1, true, false);
LOAD DATA INFILE 'L:/www/js-geonames/import/data/continentCodes.txt'
INTO TABLE geoname.continent_codes FIELDS
TERMINATED BY ',' (code, name, geoname_id);
/*
La colonne area a un tuple avec la valeur 10938E+4 en notation scientifique
*/
LOAD DATA INFILE 'L:/www/js-geonames/import/dl/countryInfo-n.txt'
INTO TABLE geoname.country_infos
(
iso_alpha2,
iso_alpha3,
iso_numeric,
fips,
name,
capital,
area,
population,
continent,
tld,
currency,
currency_name,
phone,
postal_code_format,
postal_code_regex,
languages,
@geoname_id,
neighbours,
equivalent_fips_code
)
SET geoname_id = nullif(@geoname_id,'');
LOAD DATA INFILE 'L:/www/js-geonames/import/dl/featureCodes_en.txt'
INTO TABLE geoname.feature_codes
(
code,
name,
@description
)
SET description = nullif(@description, '');
LOAD DATA INFILE 'L:/www/js-geonames/import/dl/allCountries.txt'
INTO TABLE geoname.geonames
(
id,
name,
ascii_name,
alternate_names,
latitude,
longitude,
feature_class,
feature_code,
country_code,
@cc2,
admin1_code,
@admin2_code,
@admin3_code,
@admin4_code,
population,
@elevation,
dem,
@timezone,
modification
)
SET elevation = nullif(@elevation,''),
cc2 = nullif(@cc2,''),
admin2_code = nullif(@admin2_code,''),
admin3_code = nullif(@admin3_code,''),
admin4_code = nullif(@admin4_code,''),
timezone = nullif(@timezone,'');
LOAD DATA INFILE 'L:/www/js-geonames/import/dl/iso-languagecodes.txt'
INTO TABLE geoname.iso_language_codes
IGNORE 1 LINES
(
@iso_639_3,
@iso_639_2,
@iso_639_1,
@language_name
)
SET iso_639_3 = nullif(@iso_639_3,''),
iso_639_2 = nullif(@iso_639_2,''),
iso_639_1 = nullif(@iso_639_1,''),
language_name = nullif(@language_name,'');
LOAD DATA INFILE 'L:/www/js-geonames/import/dl/timeZones.txt'
INTO TABLE geoname.time_zones
IGNORE 1 LINES;
LOAD DATA INFILE 'L:/www/js-geonames/import/dl/userTags.txt'
INTO TABLE geoname.user_tags;
| true
|
00353bd304a509b9b363f344d769b3430ef862bc
|
SQL
|
Hatooz/jsramverkbackend
|
/db/migrate.sql
|
UTF-8
| 722
| 3.171875
| 3
|
[] |
no_license
|
DROP TABLE IF EXISTS info;
DROP TABLE IF EXISTS texts;
DROP TABLE IF EXISTS users;
CREATE TABLE IF NOT EXISTS users (
email VARCHAR(255) NOT NULL,
password VARCHAR(60) NOT NULL,
UNIQUE(email)
);
CREATE TABLE IF NOT EXISTS info (
aboutme TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS texts (
kmom INTEGER NOT NULL,
redovisning TEXT NOT NULL
);
INSERT INTO info (aboutme)
VALUES ("Lite info om mig. Jag är student här på BTH webbprogrammering och har börjat mitt andra år nu på distans. Denna kursen ser väldigt spännande ut med begrepp som devOps och websockets. Dessa har man hört om men aldrig förstått innebörden av så jag ser fram emot att lära mig om dessa bland allt annat.");
| true
|
27b940c49e6de8a9e36831dd900f4309db50d1f2
|
SQL
|
hgeza06/ref
|
/dolgozó adatok/user.sql
|
UTF-8
| 2,848
| 3.140625
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Gép: 127.0.0.1
-- Létrehozás ideje: 2020. Jan 28. 21:46
-- Kiszolgáló verziója: 10.4.11-MariaDB
-- PHP verzió: 7.4.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 */;
--
-- Adatbázis: `user`
--
-- --------------------------------------------------------
--
-- Tábla szerkezet ehhez a táblához `dolgozo`
--
CREATE TABLE `dolgozo` (
`id` int(8) NOT NULL,
`nev` varchar(256) NOT NULL,
`tel` varchar(64) NOT NULL,
`email` varchar(256) DEFAULT NULL,
`szemigSzam` varchar(256) NOT NULL,
`TAJ` varchar(256) NOT NULL,
`ado` varchar(256) NOT NULL,
`bankszsz` varchar(256) DEFAULT NULL,
`aNeve` varchar(256) NOT NULL,
`szulHely` varchar(256) NOT NULL,
`szulIdo` date NOT NULL,
`lakcim` varchar(256) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Tábla szerkezet ehhez a táblához `dolgozokadmin`
--
CREATE TABLE `dolgozokadmin` (
`id` int(8) NOT NULL,
`nev` varchar(256) NOT NULL,
`szemigSzam` varchar(256) NOT NULL,
`szerzodesKelt` date NOT NULL,
`szerzodesLejart` date NOT NULL,
`fizetes` decimal(42,0) NOT NULL,
`munkaido` varchar(256) NOT NULL,
`megjegyzes` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Tábla szerkezet ehhez a táblához `users`
--
CREATE TABLE `users` (
`id` int(8) NOT NULL,
`email` varchar(256) NOT NULL,
`password` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexek a kiírt táblákhoz
--
--
-- A tábla indexei `dolgozo`
--
ALTER TABLE `dolgozo`
ADD PRIMARY KEY (`id`);
--
-- A tábla indexei `dolgozokadmin`
--
ALTER TABLE `dolgozokadmin`
ADD PRIMARY KEY (`id`);
--
-- A tábla indexei `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- A kiírt táblák AUTO_INCREMENT értéke
--
--
-- AUTO_INCREMENT a táblához `dolgozo`
--
ALTER TABLE `dolgozo`
MODIFY `id` int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=69;
--
-- AUTO_INCREMENT a táblához `dolgozokadmin`
--
ALTER TABLE `dolgozokadmin`
MODIFY `id` int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;
--
-- AUTO_INCREMENT a táblához `users`
--
ALTER TABLE `users`
MODIFY `id` int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=387;
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 */;
| true
|
473c6567c9a165de0ba9f8d440063aa95065c1b4
|
SQL
|
gabrielrussoc/mac0350
|
/ep2/test-function-calls.sql
|
UTF-8
| 2,653
| 2.90625
| 3
|
[] |
no_license
|
select cadastro('a@z.com', '1234', '10000000701', 'nelson', 'M', '2019-01-01');
select insere_professor('10000000701', '9298041', 'IME');
select insere_aluno('10000000701', '9298041', '45');
select insere_administrador('10000000701', '9298041', 'ze ruela');
select insere_curriculo('45x', '9298041', 'bcc 45x', 'IME', 'Reformulado 2020');
select insere_disciplina('MAC0876', 'Introducao a introducao', 'DCC', 'Bla', 4);
select insere_trilha('T34', 'Teoria', 'Bla bla', '45x');
select insere_modulo('M12', 'Algoritmos', 'Descricao', 'T34');
select insere_ministra('9298041', 'MAC0876');
select insere_planeja('9298041', 'MAC0876');
select insere_oferecimento('9298041', 'MAC0876', '2019/1');
select insere_cursa('9298041', (SELECT id from Oferecimento WHERE di_codigo='MAC0876'));
select insere_disciplina_no_modulo('MAC0876', 'M12', TRUE);
select autoriza((select us_id from users where us_email='a@z.com'), 'insere_aluno') = 'true' AS teste_autoriza;
select autoriza((select us_id from users where us_email='a@z.com'), 'banana') = 'false' AS test_unautoriza;
select * from lista_curriculos('9298041');
select * from lista_trilhas('45x');
select * from lista_modulos('T34');
select * from lista_disciplinas_do_modulo('M12');
select * from lista_disciplinas_do_curriculo('45');
select lista_disciplinas_cursadas('9298041');
select lista_disciplinas_planejadas('9298041');
select lista_creditos_cursados('9298041');
select lista_creditos_planejados('9298041');
select lista_alunos_do_oferecimento((SELECT ID FROM Oferecimento WHERE di_codigo = 'MAC0876' AND pr_NUSP = '9298041'));
select lista_disciplinas_ministradas('9298041');
select lista_disciplinas_oferecidas('9298041');
select atualiza_curriculo('45', '9298111', 'BCC Antigo', 'IME', 'Soh as reliquia');
select atualiza_disciplina('MAC0123', 'Introdução a introduções introdutorias', 'IME', 'A', 8);
select atualiza_nota('9298041', 21, 7);
select atualiza_trilha('T01', 'Sistemas de Software', 'Lorem ipsum', '46');
select atualiza_modulo('M01', 'Desenvolvimento de Software', 'Lorem Ipsum', 'T01');
select atualiza_obrigatoria('MAC0123', 'M01', true);
select atualiza_password(1, 'capivara');
select deleta_ministra('9298100', 'MAC0123');
select deleta_planeja('9298123', 'MAC0126');
select deleta_oferecimento((SELECT ID FROM Oferecimento WHERE di_codigo = 'MAC0876' AND pr_NUSP = '9298041'));
select deleta_cursa('9298121', (SELECT ID FROM Oferecimento WHERE di_codigo = 'MAC0124' AND semestre = '2018/2'));
select deleta_rel_dis_mod('MAC0123', 'M01');
select deleta_disciplina('MAC0120');
select deleta_curriculo('45');
select deleta_trilha('T01');
select deleta_modulo('M01');
| true
|
fd3353b40d074fa0377e6b8a1c0ede619dd9763e
|
SQL
|
bluescreen/treeview
|
/data.sql
|
UTF-8
| 6,399
| 3.1875
| 3
|
[] |
no_license
|
DROP TABLE IF EXISTS "announcements";
DROP TABLE IF EXISTS "clubs";
DROP TABLE IF EXISTS "competitions";
DROP TABLE IF EXISTS "competitors";
DROP TABLE IF EXISTS "federations";
DROP TABLE IF EXISTS "matches";
DROP TABLE IF EXISTS "users";
DROP TABLE IF EXISTS "teams";
DROP TABLE IF EXISTS "referees";
DROP TABLE IF EXISTS "groups";
DROP TABLE IF EXISTS "gradings";
DROP TABLE IF EXISTS "participants";
DROP TABLE IF EXISTS "team_groups";
DROP TABLE IF EXISTS "team_matches";
DROP TABLE IF EXISTS "team_participants";
DROP TABLE IF EXISTS "team_participants_competitor_id";
DROP TABLE IF EXISTS "referee_matches_referee_id";
DROP TABLE IF EXISTS "referee_matches";
DROP TABLE IF EXISTS "rounds";
DROP TABLE IF EXISTS "tasks";
CREATE TABLE "clubs" (
"id" integer not null primary key autoincrement,
"name" varchar(100) NOT NULL,
"abbrev" varchar(10) NOT NULL,
"location" varchar(100) NOT NULL,
"federation_id" varchar(100) NOT NULL,
"contact" varchar(100) NOT NULL,
"email" varchar(100) NOT NULL,
"phone" varchar(100) NOT NULL,
"fax" varchar(100) NOT NULL,
"address" varchar(100) NOT NULL,
"competitors_count" int(11) NOT NULL
);
CREATE TABLE "competitions" (
"id" integer not null primary key autoincrement,
"name" varchar(100) NOT NULL,
"date" date NOT NULL,
"location" varchar(100) NOT NULL,
"status" int(11),
"round" int(11),
"logo" varchar(50),
"active" tinyint(4),
"type" varchar(50),
"areas" int(11),
"mode" varchar(50),
"grading_mode" varchar(30),
"participant_count" int(11),
"matches_count" int(11),
"group_size" int(11),
"team_size" int(11),
"options" text
);
CREATE TABLE "competitors" (
"id" integer not null primary key autoincrement,
"name" varchar(100) NOT NULL,
"first_name" varchar(255) DEFAULT NULL,
"alias" varchar(50) NOT NULL,
"club_id" int(11) DEFAULT NULL,
"grading_id" int(30) NOT NULL,
"birth_date" date NOT NULL,
"pass_nr" varchar(10) NOT NULL,
"body_height" floatNULL,
"image" varchar(100)NULL,
"list" varchar(255) NULL,
"gender" varchar(6) NULL,
"blocked" tinyint(1) NULL
);
CREATE TABLE "federations" (
"id" integer not null primary key autoincrement,
"name" text
);
CREATE TABLE "gradings" (
"id" integer not null primary key autoincrement,
"name" varchar(30) NOT NULL
);
CREATE TABLE "groups" (
"id" integer not null primary key autoincrement,
"group_pos" int(11),
"parent_id" int(11) DEFAULT NULL,
"next_pos" int(11),
"winner_id" int(11) DEFAULT NULL,
"name" varchar(255),
"round_id" int(11),
"tournament_id" int(11),
"group_size" int(11),
"bye_count" int(11),
"group_match_count" int(11),
"need_decision" tinyint(1),
"decision_match" int(11),
"ranking" text,
"created" datetime,
"updated" datetime,
"competitor_count" int(11),
"count_finished_matches" int(11)
);
CREATE TABLE "matches" (
"id" integer not null primary key autoincrement,
"order_number" int(11) DEFAULT NULL,
"area_id" int(11),
"title" varchar(255) DEFAULT '',
"white_id" int(11) NOT NULL,
"red_id" int(11) NOT NULL,
"score_white" varchar(255),
"score_red" varchar(255),
"points_white" int(11),
"points_red" int(11),
"time" int(11),
"overtime" int(11),
"starttime" int(11),
"winner_id" int(11),
"status" int(11),
"lft" int(11) DEFAULT NULL,
"rght" int(11) DEFAULT NULL,
"parent_id" int(11) DEFAULT NULL,
"pos" int(11),
"next_pos" int(11),
"depth" int(11),
"tournament_id" int(11),
"round_id" int(11),
"group_id" int(11),
"history" text,
"created" datetime,
"updated" datetime,
"team_matches_id" int(11),
"max_time" int(11) NOT NULL DEFAULT '180',
"max_points" int(11) NOT NULL DEFAULT '2',
"type" varchar(20)
);
CREATE TABLE "participants" (
"id" integer not null primary key autoincrement,
"competitor_id" int(11) NOT NULL,
"tournament_id" int(11) NOT NULL,
"group_id" int(11) DEFAULT NULL,
"alias" varchar(30) DEFAULT NULL,
"pos" int(11) DEFAULT NULL,
"team_id" int(11) DEFAULT NULL
);
CREATE TABLE "referee_matches" (
"referee_id" int(11) NOT NULL,
"match_id" int(11) NOT NULL,
"position" int(11) NOT NULL
);
CREATE TABLE "referees" (
"id" integer not null primary key autoincrement,
"first_name" varchar(100) NOT NULL,
"last_name" varchar(100) NOT NULL,
"alias" varchar(100) NOT NULL,
"grading_id" int(11) NOT NULL
);
CREATE TABLE "rounds" (
"id" integer not null primary key autoincrement,
"title" varchar(100) NOT NULL,
"tournament_id" int(11) DEFAULT NULL,
"matches_count" int(11) DEFAULT NULL,
"seeds_count" int(11) DEFAULT NULL,
"byes_count" int(11) DEFAULT NULL,
"matches_done" int(11) DEFAULT NULL,
"depth" int(11) DEFAULT NULL,
"extra_brackets" int(11) DEFAULT NULL,
"status" int(11) DEFAULT NULL,
"type" varchar(30) DEFAULT NULL,
"next" int(11) DEFAULT NULL,
"current_match" int(11) DEFAULT NULL
);
CREATE TABLE "team_groups" (
"id" integer not null primary key autoincrement,
"team_id" integer,
"tournament_id" int(11),
"group_id" int(11),
"pos" int(11),
"alias" varchar(50)
);
CREATE TABLE "team_matches" (
"id" integer not null primary key autoincrement,
"title" varchar(255),
"team_id1" int(11) DEFAULT NULL,
"team_id2" int(11) DEFAULT NULL,
"points_white" int(11),
"points_red" int(11),
"winner_id" int(11),
"need_decision" tinyint(1),
"created" datetime,
"match_time" int(11),
"status" int(11),
"matches_done" int(11),
"current_match" int(11),
"lft" int(11),
"rght" int(11),
"parent_id" int(11) DEFAULT NULL,
"next_pos" int(11),
"depth" int(11) DEFAULT NULL,
"type" varchar(50),
"round_id" int(11),
"tournament_id" int(11),
"group_id" int(11)
);
CREATE TABLE "team_participants" (
"id" integer not null primary key autoincrement,
"participant_id" int(11) NOT NULL,
"team_id" int(11) DEFAULT NULL,
"tournament_id" int(11) DEFAULT NULL,
"position" int(11) DEFAULT NULL
);
CREATE TABLE "teams" (
"id" integer not null primary key autoincrement,
"name" varchar(100) NOT NULL,
"symbol" varchar(10),
"tournament_id" int(11),
"team_participant_count" int(11),
"level" float,
"size" int(11),
"group_id" int(11)
);
CREATE TABLE "users" (
"id" integer not null primary key autoincrement,
"username" varchar(50) NOT NULL,
"password" varchar(50) NOT NULL,
"role" int(11) NOT NULL
);
INSERT INTO "users" VALUES (1,'mmuschol','a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',0);
| true
|
055f76752d5fd667ab918361c6521334fa35043b
|
SQL
|
bug-here/pern_stack
|
/scripts.sql
|
UTF-8
| 652
| 4
| 4
|
[] |
no_license
|
create table employee(
id integer NOT NULL DEFAULT nextval ('employee_seq'),
name varchar(100)NOT NULL,
age varchar(100)NOT NULL,
constraint emp_cons PRIMARY KEY(id)
);
create table department(
dept_id integer NOT NULL DEFAULT nextval('department_seq'),
dept_name varchar(100)NOT NULL,
constraint dept_cons PRIMARY KEY(id)
);
create table emp_table(
id integer NOT NULL DEFAULT nextval('emp_table_seq'),
name varchar(100)NOT NULL,
dept_name varchar(100)NOT NULL
constraint fk_emp_table FOREIGN KEY(employee_id)REFERENCES employee(id),
constraint fk_department FOREIGN KEY(department_id)REFERENCES department(id)
| true
|
e2ed0826cb67d216c91d918361594e59c6c8217e
|
SQL
|
JainilTrivedi/PHPProject_CE138_CE148
|
/PHPProject_CE138_CE148/final_online_quiz.sql
|
UTF-8
| 9,472
| 3
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 30, 2021 at 03:50 PM
-- 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_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: `online_quiz`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`username` varchar(25) NOT NULL,
`password` varchar(12) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`username`, `password`) VALUES
('superuser', 'superuser');
-- --------------------------------------------------------
--
-- Table structure for table `previousattempts`
--
CREATE TABLE `previousattempts` (
`id` int(11) NOT NULL,
`correct_answers` int(11) NOT NULL,
`student_id` int(11) NOT NULL,
`quiz_id` int(11) NOT NULL,
`your_score` double DEFAULT NULL,
`total_marks` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `previousattempts`
--
INSERT INTO `previousattempts` (`id`, `correct_answers`, `student_id`, `quiz_id`, `your_score`, `total_marks`) VALUES
(2, 2, 1, 74, 33.33, 6),
(3, 0, 1, 75, 0, 10),
(4, 0, 1, 75, 0, 10),
(5, 2, 1, 78, 50, 4),
(6, 2, 1, 78, 50, 4),
(7, 2, 1, 74, 66.67, 6),
(8, 2, 1, 74, 66.67, 6),
(9, 2, 1, 78, 66.67, 4),
(10, 3, 1, 74, 100, 6),
(11, 3, 1, 74, 100, 6),
(12, 3, 1, 74, 100, 6),
(13, 3, 1, 74, 100, 6),
(14, 3, 1, 74, 100, 6),
(15, 3, 1, 74, 100, 6),
(16, 3, 1, 74, 100, 6),
(17, 3, 1, 74, 100, 6),
(18, 1, 1, 74, 33.33, 6),
(19, 1, 1, 74, 33.33, 6),
(20, 1, 1, 74, 33.33, 6),
(21, 1, 1, 74, 33.33, 6),
(22, 1, 1, 74, 33.33, 6),
(23, 1, 1, 74, 33.33, 6),
(24, 1, 1, 74, 33.33, 6),
(25, 2, 1, 74, 66.67, 6),
(26, 2, 1, 74, 66.67, 6),
(27, 2, 1, 74, 66.67, 6),
(28, 2, 1, 74, 66.67, 6),
(29, 2, 1, 74, 66.67, 6),
(30, 2, 1, 74, 66.67, 6),
(31, 2, 1, 74, 66.67, 6),
(32, 2, 1, 74, 66.67, 6),
(33, 2, 1, 74, 66.67, 6),
(34, 2, 1, 74, 66.67, 6),
(35, 2, 1, 74, 66.67, 6),
(36, 2, 1, 74, 66.67, 6),
(37, 2, 1, 74, 66.67, 6),
(38, 2, 1, 74, 66.67, 6),
(39, 2, 1, 74, 66.67, 6),
(40, 2, 1, 74, 66.67, 6),
(41, 2, 1, 74, 66.67, 6),
(42, 2, 1, 74, 66.67, 6),
(43, 2, 1, 74, 66.67, 6),
(44, 2, 1, 74, 66.67, 6),
(45, 2, 1, 74, 66.67, 6),
(46, 2, 1, 74, 66.67, 6),
(47, 2, 1, 74, 66.67, 6),
(48, 2, 1, 74, 66.67, 6),
(49, 2, 1, 74, 66.67, 6),
(50, 2, 1, 74, 66.67, 6);
-- --------------------------------------------------------
--
-- Table structure for table `questions`
--
CREATE TABLE `questions` (
`question_id` int(11) NOT NULL,
`quiz_id` int(11) NOT NULL,
`ques` varchar(2083) NOT NULL,
`optionA` varchar(127) NOT NULL,
`optionB` varchar(127) NOT NULL,
`optionC` varchar(127) NOT NULL,
`optionD` varchar(127) NOT NULL,
`correct_option` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `questions`
--
INSERT INTO `questions` (`question_id`, `quiz_id`, `ques`, `optionA`, `optionB`, `optionC`, `optionD`, `correct_option`) VALUES
(1, 74, 'PHP is used in?', 'android dev', 'ios dev', 'web dev', 'none of the above', 'c'),
(2, 74, 'End tag of PHP is ?', '</php>', '?>', '</?php>', '<?php>', 'b'),
(3, 74, 'Did u like the quiz', 'yes', '-', '-', 'no', 'a'),
(4, 75, 'What is your name?', 'Jainil', 'Dhruval', 'Vrundan', 'Harprit', 'b'),
(5, 75, 'What is your name?', 'Jainil', 'Dhruval', 'Vrundan', 'Harprit', 'c'),
(6, 75, 'What is your name?', 'Telusko', 'harry', 'Durgesh', 'Apoorva Sir', 'd'),
(7, 78, 'The term PHP is an acronym for PHP:_______________?', 'Hypertext Preprocessor', 'Hypertext multiprocessor', 'Hypertext markup Preprocessor', 'Hypertune Preprocessor', 'A'),
(8, 78, 'Who is founder of PHP?', 'Tim Berners-Lee', 'Brendan Eich', 'Guido van Rossum', 'Rasmus Lerdorf', 'D'),
(9, 78, 'In which year PHP was created ?', '1993', '1994', '1995', '1996', 'B'),
(10, 79, 'What is 1+1?', '2', '3', '0', '1', 'a');
-- --------------------------------------------------------
--
-- Table structure for table `quiz`
--
CREATE TABLE `quiz` (
`quiz_id` int(11) NOT NULL,
`quiz_name` varchar(100) NOT NULL,
`total_marks` int(11) NOT NULL,
`total_question` int(11) NOT NULL,
`teacher_id` int(11) NOT NULL,
`subject_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `quiz`
--
INSERT INTO `quiz` (`quiz_id`, `quiz_name`, `total_marks`, `total_question`, `teacher_id`, `subject_id`) VALUES
(74, 'PHP_1', 6, 3, 2, 1),
(75, 'PHP_2', 10, 3, 2, 2),
(78, 'QUIZ_3', 4, 3, 2, 1),
(79, 'Math1', 2, 1, 2, 3);
-- --------------------------------------------------------
--
-- Table structure for table `student`
--
CREATE TABLE `student` (
`id` int(11) NOT NULL,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`contact` varchar(10) NOT NULL,
`email` varchar(255) NOT NULL,
`username` varchar(16) NOT NULL,
`password` varchar(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `student`
--
INSERT INTO `student` (`id`, `firstname`, `lastname`, `contact`, `email`, `username`, `password`) VALUES
(1, 'Harpritsinh', 'Yadav', '12345679', 'hjy@ddu', 'harprit123', 'abcd');
-- --------------------------------------------------------
--
-- Table structure for table `subject`
--
CREATE TABLE `subject` (
`subject_id` int(11) NOT NULL,
`subject_name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `subject`
--
INSERT INTO `subject` (`subject_id`, `subject_name`) VALUES
(1, 'PHP'),
(2, 'CSA'),
(3, 'Maths'),
(10, 'Physics');
-- --------------------------------------------------------
--
-- Table structure for table `teacher`
--
CREATE TABLE `teacher` (
`id` int(11) NOT NULL,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`Email` varchar(255) NOT NULL,
`Phone_no` varchar(10) NOT NULL,
`username` varchar(16) NOT NULL,
`password` varchar(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `teacher`
--
INSERT INTO `teacher` (`id`, `firstname`, `lastname`, `Email`, `Phone_no`, `username`, `password`) VALUES
(2, 'jai', 'tri', 'jt@ddu', '999', 'jnil', 'abc'),
(5, 'harprit', 'yadav2', 'teacher@ddu', '190909', 'harprit2', 'abcd'),
(7, 'abcd', 'abcd', 'abcd@ddu', '12899', 'hjy', 'abcd'),
(8, 'abcd', 'aa', 'abc@ddu', '190', 'hjy678', 'ab'),
(10, 'abcd', 'abcd', 'test@ddu', '1234567890', 'testddu', 'abcdAB1@');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `previousattempts`
--
ALTER TABLE `previousattempts`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_quizid` (`quiz_id`),
ADD KEY `student_id` (`student_id`);
--
-- Indexes for table `questions`
--
ALTER TABLE `questions`
ADD PRIMARY KEY (`question_id`),
ADD KEY `fk_quiz_id` (`quiz_id`);
--
-- Indexes for table `quiz`
--
ALTER TABLE `quiz`
ADD PRIMARY KEY (`quiz_id`),
ADD KEY `teacher_id` (`teacher_id`),
ADD KEY `subject_id` (`subject_id`);
--
-- Indexes for table `student`
--
ALTER TABLE `student`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `subject`
--
ALTER TABLE `subject`
ADD PRIMARY KEY (`subject_id`);
--
-- Indexes for table `teacher`
--
ALTER TABLE `teacher`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `previousattempts`
--
ALTER TABLE `previousattempts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=55;
--
-- AUTO_INCREMENT for table `questions`
--
ALTER TABLE `questions`
MODIFY `question_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=49;
--
-- AUTO_INCREMENT for table `quiz`
--
ALTER TABLE `quiz`
MODIFY `quiz_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=131;
--
-- AUTO_INCREMENT for table `student`
--
ALTER TABLE `student`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `subject`
--
ALTER TABLE `subject`
MODIFY `subject_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `teacher`
--
ALTER TABLE `teacher`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `previousattempts`
--
ALTER TABLE `previousattempts`
ADD CONSTRAINT `fk_quizid` FOREIGN KEY (`quiz_id`) REFERENCES `quiz` (`quiz_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `previousattempts_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `questions`
--
ALTER TABLE `questions`
ADD CONSTRAINT `fk_quiz_id` FOREIGN KEY (`quiz_id`) REFERENCES `quiz` (`quiz_id`) ON DELETE CASCADE ON UPDATE NO ACTION;
--
-- Constraints for table `quiz`
--
ALTER TABLE `quiz`
ADD CONSTRAINT `subject_id` FOREIGN KEY (`subject_id`) REFERENCES `subject` (`subject_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `teacher_id` FOREIGN KEY (`teacher_id`) REFERENCES `teacher` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
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 */;
| true
|
8c6811718fbced3e5557e9bcb155fb2fe9b7b8d6
|
SQL
|
DdarkSaber/CSLR51---DBMS-Lab
|
/Week 1/1-SWCo.sql
|
UTF-8
| 1,606
| 3.6875
| 4
|
[] |
no_license
|
/** */
CREATE DATABASE SWCom;
USE SWCom;
CREATE TABLE Employee (
Empid INT AUTO_INCREMENT PRIMARY KEY,
EmpName VARCHAR(40) NOT NULL,
Addr VARCHAR(50),
DoB DATE,
Salary INTEGER
);
--DESC Employee;
INSERT INTO
Employee (Empname, Addr, DoB, Salary)
VALUES
(
'IAmGroot',
'Somewhere in Space',
'2012-12-12',
1E5
),
(
'Suzaku Kururugi',
'Main Palace, Britannia',
'2000-07-10',
1E4
),
('Amber', 'Mondstadt, Teyvat', '2001-8-10', 1E6),
(
'Btuturuu',
'Dubai st, New York nagar, India',
'1993-02-01',
1E7
);
CREATE TABLE Project (
Projno INTEGER AUTO_INCREMENT PRIMARY KEY,
ProjName VARCHAR(50) NOT NULL,
Duration INT DEFAULT 0,
Descr VARCHAR(255)
);
INSERT INTO
Project (ProjName, Duration, Descr)
VALUES
('Storyboard', 2, 'Duration in days'),
('Sketching', 3, 'Lot of fleshing out work'),
('Final Revisions', 1, 'Consistency check');
CREATE TABLE WorksOn (
Empid INT,
FOREIGN KEY (Empid) REFERENCES Employee(Empid),
Projno INT,
FOREIGN KEY(Projno) REFERENCES Project(Projno)
);
INSERT INTO
WorksOn
VALUES
(2, 1),
(4, 1),
(1, 2),
(3, 2),
(4, 3);
SELECT
*
FROM
Employee
ORDER BY
EmpName DESC;
SELECT
*
FROM
Project
WHERE
Projno = 2;
SELECT
EmpName as Emp_Name
FROM
Employee
WHERE
EmpName LIKE 'B%';
SELECT
Empid
FROM
WorksOn
WHERE
Projno = 2;
-- create table employee(datte int);
-- Drop database db_name;
-- DELETE FROM Employee, Project, WorksOn;
DELETE FROM
WorksOn;
DELETE FROM
Employee;
DELETE FROM
Project;
DROP TABLE Employee, Project, WorksOn;
DROP DATABASE SWCom;
| true
|
ec2f4efd54b3b68089d1216861ede9c053728858
|
SQL
|
mdborhan/book-borrowing-and-returning-
|
/database_sql/boighor.sql
|
UTF-8
| 33,178
| 2.8125
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 10, 2018 at 06:21 AM
-- Server version: 10.1.36-MariaDB
-- PHP Version: 7.2.11
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: `boighor`
--
-- --------------------------------------------------------
--
-- Table structure for table `admins`
--
CREATE TABLE `admins` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Super Admin' COMMENT 'Admin|Super Admin',
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `admins`
--
INSERT INTO `admins` (`id`, `name`, `email`, `password`, `phone_no`, `avatar`, `type`, `remember_token`, `created_at`, `updated_at`) VALUES
(3, 'Nazrul Islam', 'nazrulislam94bd@gmail.com', '$2y$10$kCEXU.JgVugo1mLKRqEo.eY0xRSko4cgKfWI9tatS4JerP2ucpuYe', '01917497927', NULL, 'Super Admin', 'KmHAb8zgUp3OpmXnf7vaCpAMwvyj6d9mReM87ZrmTrj91dnF2zaIzOhcFdxa', '2018-11-07 10:47:44', '2018-11-07 13:56:10');
-- --------------------------------------------------------
--
-- Table structure for table `book_sellings`
--
CREATE TABLE `book_sellings` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`user_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`book_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`author_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`book_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` int(11) NOT NULL,
`quantity` int(11) NOT NULL,
`phone_no` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `book_sellings`
--
INSERT INTO `book_sellings` (`id`, `user_id`, `user_name`, `book_name`, `author_name`, `book_type`, `price`, `quantity`, `phone_no`, `image`, `created_at`, `updated_at`) VALUES
(1, 1, 'borhanuddin', 'Agni Bina', 'kazi nazrul', 'new', 200, 1, '01682180100', '1544330629.PNG', '2018-12-08 22:43:49', '2018-12-08 22:43:49'),
(2, 1, 'borhanuddin', 'Blackholer Bacchal', 'Mohammad Zafar Iqbal', 'old', 100, 1, '01682180100', '1544330795.PNG', '2018-12-08 22:46:35', '2018-12-08 22:46:35');
-- --------------------------------------------------------
--
-- Table structure for table `brands`
--
CREATE TABLE `brands` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci,
`image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `brands`
--
INSERT INTO `brands` (`id`, `name`, `description`, `image`, `created_at`, `updated_at`) VALUES
(1, 'Kazi Najrul Islam', 'Kazi Najrul Islam', '1542015847.jpeg', '2018-11-12 03:44:07', '2018-11-12 03:44:07'),
(2, 'Robindronath Tagor', 'Robindronath Tagor', '1542015890.jpg', '2018-11-12 03:44:50', '2018-11-12 03:44:50'),
(3, 'Saratchandra Chattopadhay', 'Saratchandra Chattopadhay', '1542015977.jpg', '2018-11-12 03:46:17', '2018-11-12 03:46:17'),
(4, 'Humayn Ahmed', 'Humayn Ahmed', '1542016007.jpg', '2018-11-12 03:46:47', '2018-11-12 03:46:47'),
(5, 'Begum Rokeya', 'Begum Rokeya', '1542016039.jpg', '2018-11-12 03:47:19', '2018-11-12 03:47:19'),
(6, 'Muhammed Zafar Iqbal', 'Muhammed Zafar Iqbal', '1542016088.jpg', '2018-11-12 03:48:08', '2018-11-12 03:48:08'),
(7, 'Samaresh Majumdar', 'Samaresh Majumdar', NULL, '2018-12-08 17:29:27', '2018-12-08 17:29:27'),
(8, 'Michael Madhusudan Dutta', 'Michael Madhusudan Dutta', NULL, '2018-12-08 17:54:16', '2018-12-08 17:54:16'),
(9, 'Other', NULL, NULL, '2018-12-08 18:15:18', '2018-12-08 18:15:18');
-- --------------------------------------------------------
--
-- Table structure for table `carts`
--
CREATE TABLE `carts` (
`id` int(10) UNSIGNED NOT NULL,
`product_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED DEFAULT NULL,
`order_id` int(10) UNSIGNED DEFAULT NULL,
`ip_address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`product_quantity` int(11) NOT NULL DEFAULT '1',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `carts`
--
INSERT INTO `carts` (`id`, `product_id`, `user_id`, `order_id`, `ip_address`, `product_quantity`, `created_at`, `updated_at`) VALUES
(1, 1, NULL, 1, '::1', 1, '2018-12-08 07:48:56', '2018-12-08 07:50:00'),
(2, 1, 1, 2, '::1', 2, '2018-12-08 12:43:44', '2018-12-08 22:40:05'),
(3, 14, 1, 2, '::1', 1, '2018-12-08 22:38:11', '2018-12-08 22:40:05'),
(4, 9, NULL, 3, '::1', 1, '2018-12-09 00:56:44', '2018-12-09 00:59:39');
-- --------------------------------------------------------
--
-- Table structure for table `cart_rents`
--
CREATE TABLE `cart_rents` (
`id` int(10) UNSIGNED NOT NULL,
`product_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED DEFAULT NULL,
`order_id` int(10) UNSIGNED DEFAULT NULL,
`ip_address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`product_quantity` int(11) NOT NULL DEFAULT '1',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `cart_rents`
--
INSERT INTO `cart_rents` (`id`, `product_id`, `user_id`, `order_id`, `ip_address`, `product_quantity`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, '::1', 2, '2018-12-08 10:03:33', '2018-12-08 10:06:52'),
(4, 1, 1, 2, '::1', 1, '2018-12-08 13:06:46', '2018-12-08 22:41:24');
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci,
`image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parent_id` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`id`, `name`, `description`, `image`, `parent_id`, `created_at`, `updated_at`) VALUES
(1, 'SCIENCE', 'Science', NULL, NULL, '2018-11-12 03:49:00', '2018-12-07 13:45:07'),
(2, 'STORY', 'Story', NULL, NULL, '2018-11-12 03:49:44', '2018-12-07 13:44:52'),
(3, 'KOBITA', 'kobita', NULL, NULL, '2018-11-12 03:50:12', '2018-12-07 13:44:35'),
(4, 'HISTORY', NULL, NULL, NULL, '2018-12-07 13:49:18', '2018-12-07 13:49:18'),
(8, 'Muhammed Zafar Iqbal', 'Muhammed Zafar IqbalMuhammed Zafar Iqbal', NULL, 1, '2018-12-08 01:35:03', '2018-12-08 01:35:03'),
(9, 'Humayn Ahmed', 'Humayn Ahmed Humayn Ahmed', NULL, 4, '2018-12-08 01:35:34', '2018-12-08 01:35:59'),
(10, 'Kazi Najrul Islam', 'Kazi Najrul Islam Kazi Najrul Islam', NULL, 3, '2018-12-08 01:36:32', '2018-12-08 01:36:32'),
(11, 'Robindronath Tagor', 'Robindronath Tagor Robindronath Tagor', NULL, 2, '2018-12-08 01:37:04', '2018-12-08 01:37:04'),
(12, 'NOVEL', NULL, NULL, NULL, '2018-12-08 17:20:38', '2018-12-08 17:20:38'),
(13, 'Humayun Ahmed', NULL, NULL, 12, '2018-12-08 17:21:24', '2018-12-08 17:21:24'),
(14, 'Robindronath Tagor', 'Robindronath Tagor', NULL, 12, '2018-12-08 17:22:58', '2018-12-08 17:22:58'),
(15, 'Kazi Najrul Islam', NULL, NULL, 12, '2018-12-08 17:23:39', '2018-12-08 17:23:39'),
(16, 'Robindronath Tagor', 'Robindronath Tagor', NULL, 3, '2018-12-08 17:25:01', '2018-12-08 17:25:01'),
(17, 'Samaresh Majumdar', 'Samaresh Majumdar', NULL, 12, '2018-12-08 17:26:18', '2018-12-08 17:26:18'),
(18, 'Muhammed Zafar Iqbal', 'Muhammed Zafar Iqbal', NULL, 12, '2018-12-08 17:35:51', '2018-12-08 17:35:51'),
(19, 'Michael Madhusudan Dutta', 'Michael Madhusudan Dutta', NULL, 12, '2018-12-08 17:54:54', '2018-12-08 17:54:54'),
(20, 'Islamic', NULL, NULL, NULL, '2018-12-08 18:15:03', '2018-12-08 18:15:03'),
(21, 'Islamic', NULL, NULL, 20, '2018-12-08 18:16:33', '2018-12-08 18:16:46');
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
CREATE TABLE `comments` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(11) NOT NULL,
`body` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`product_id` int(11) NOT NULL,
`commentable_id` int(11) DEFAULT NULL,
`commentagle_type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `comments`
--
INSERT INTO `comments` (`id`, `user_id`, `body`, `product_id`, `commentable_id`, `commentagle_type`, `created_at`, `updated_at`) VALUES
(1, 1, 'Good Book.', 17, NULL, NULL, '2018-12-08 19:19:31', '2018-12-08 19:19:31');
-- --------------------------------------------------------
--
-- Table structure for table `dates`
--
CREATE TABLE `dates` (
`id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `districts`
--
CREATE TABLE `districts` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`division_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `districts`
--
INSERT INTO `districts` (`id`, `name`, `division_id`, `created_at`, `updated_at`) VALUES
(9, 'Jatrabari', 2, '2018-12-08 01:11:57', '2018-12-08 01:11:57'),
(10, 'Panthapath', 2, '2018-12-08 01:12:15', '2018-12-08 01:12:15'),
(11, 'Banani', 2, '2018-12-08 01:12:29', '2018-12-08 01:12:29'),
(12, 'Gulistan', 2, '2018-12-08 01:12:44', '2018-12-08 01:12:44'),
(13, 'Dhmondi', 2, '2018-12-08 01:13:05', '2018-12-08 01:13:05'),
(14, 'Gulshan', 2, '2018-12-08 01:13:21', '2018-12-08 01:13:21'),
(16, 'Farmgate', 2, '2018-12-08 01:14:00', '2018-12-08 01:14:00'),
(17, 'Mirpur', 2, '2018-12-08 01:14:15', '2018-12-08 01:14:15'),
(18, 'Badda', 2, '2018-12-08 01:32:26', '2018-12-08 01:32:26');
-- --------------------------------------------------------
--
-- Table structure for table `divisions`
--
CREATE TABLE `divisions` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`priority` tinyint(3) UNSIGNED NOT NULL DEFAULT '1',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `divisions`
--
INSERT INTO `divisions` (`id`, `name`, `priority`, `created_at`, `updated_at`) VALUES
(2, 'DHAKA', 1, '2018-12-08 01:03:38', '2018-12-08 01:03:38');
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(2, '2014_10_12_100000_create_password_resets_table', 1),
(4, '2018_02_23_014906_create_categories_table', 1),
(5, '2018_02_23_015040_create_brands_table', 1),
(8, '2018_07_21_115850_create_divisions_table', 1),
(9, '2018_07_21_115908_create_districts_table', 1),
(12, '2018_11_04_153551_create_settings_table', 2),
(13, '2018_11_04_162311_create_payments_table', 3),
(15, '2018_08_28_033110_create_orders_table', 4),
(16, '2018_02_23_015128_create_admins_table', 5),
(26, '2018_11_12_200639_create_book_sellings_table', 9),
(34, '2018_08_28_034133_create_carts_table', 13),
(35, '2014_10_12_000000_create_users_table', 14),
(36, '2018_11_10_012529_create_order_rents_table', 15),
(37, '2018_11_10_012619_create_cart_rents_table', 15),
(38, '2018_11_12_150017_create_comments_table', 15),
(39, '2018_02_22_165732_create_products_table', 16),
(40, '2018_02_23_020211_create_product_images_table', 16),
(41, '2018_12_08_170101_create_dates_table', 17);
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
CREATE TABLE `orders` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED DEFAULT NULL,
`payment_id` int(10) UNSIGNED DEFAULT NULL,
`ip_address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone_no` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`shipping_address` text COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message` text COLLATE utf8mb4_unicode_ci,
`is_paid` tinyint(1) NOT NULL DEFAULT '0',
`is_completed` tinyint(1) NOT NULL DEFAULT '0',
`is_seen_by_admin` tinyint(1) NOT NULL DEFAULT '0',
`transaction_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `orders`
--
INSERT INTO `orders` (`id`, `user_id`, `payment_id`, `ip_address`, `name`, `phone_no`, `shipping_address`, `email`, `message`, `is_paid`, `is_completed`, `is_seen_by_admin`, `transaction_id`, `created_at`, `updated_at`) VALUES
(1, NULL, 2, '::1', 'nazrul', '01682180100', 'gulshan', 'mdborhan410@gmail.com', 'hello', 1, 1, 1, '145555', '2018-12-08 07:50:00', '2018-12-08 22:49:34'),
(2, 1, 2, '::1', 'borhan uddin', '01682180100', 'cha-53,Gulshan,dhaka-12', 'mdborhan410@gmail.com', NULL, 0, 0, 0, '248966', '2018-12-08 22:40:05', '2018-12-08 22:40:05'),
(3, NULL, 2, '::1', 'Borhan Uddin', '01682180100', 'badda', 'mdborhan410@gmail.com', NULL, 0, 1, 1, '12255', '2018-12-09 00:59:38', '2018-12-09 01:07:56');
-- --------------------------------------------------------
--
-- Table structure for table `order_rents`
--
CREATE TABLE `order_rents` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED DEFAULT NULL,
`payment_id` int(10) UNSIGNED DEFAULT NULL,
`ip_address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone_no` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`shipping_address` text COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message` text COLLATE utf8mb4_unicode_ci,
`is_paid` tinyint(1) NOT NULL DEFAULT '0',
`is_completed` tinyint(1) NOT NULL DEFAULT '0',
`is_seen_by_admin` tinyint(1) NOT NULL DEFAULT '0',
`transaction_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `order_rents`
--
INSERT INTO `order_rents` (`id`, `user_id`, `payment_id`, `ip_address`, `name`, `phone_no`, `shipping_address`, `email`, `message`, `is_paid`, `is_completed`, `is_seen_by_admin`, `transaction_id`, `created_at`, `updated_at`) VALUES
(1, 1, 2, '::1', 'borhan uddin', '01682180100', 'cha-53,gulshan dhaka-1212', 'mdborhan410@gmail.com', NULL, 1, 1, 1, '123456', '2018-12-08 10:06:52', '2018-12-08 10:29:12'),
(2, 1, 2, '::1', 'borhan uddin', '01682180100', 'Gulshan, dhaka1212', 'mdborhan410@gmail.com', NULL, 0, 0, 0, '2546621', '2018-12-08 22:41:24', '2018-12-08 22:41:24');
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `payments`
--
CREATE TABLE `payments` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`priority` tinyint(4) NOT NULL DEFAULT '1',
`short_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Payment NO',
`type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'agent|personal',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `payments`
--
INSERT INTO `payments` (`id`, `name`, `image`, `priority`, `short_name`, `no`, `type`, `created_at`, `updated_at`) VALUES
(1, 'Cash In', 'cash_in.jpg', 1, 'cash_in', NULL, NULL, '2018-11-04 16:32:57', '2018-11-04 16:32:57'),
(2, 'Bkash', 'bkash.jpg', 2, 'bkash', '01917497927', 'personal', '2018-11-04 16:39:14', '2018-11-04 16:39:14'),
(3, 'Rocket', 'rocket.jpg', 3, 'rocket', '01917497927', 'personal', '2018-11-04 16:43:28', '2018-11-04 16:43:28');
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
CREATE TABLE `products` (
`id` int(10) UNSIGNED NOT NULL,
`category_id` int(10) UNSIGNED NOT NULL,
`brand_id` int(10) UNSIGNED NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`book_condition` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`quantity` int(11) NOT NULL DEFAULT '1',
`price` int(11) NOT NULL,
`rent_charge` int(11) NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT '0',
`offer_price` int(11) DEFAULT NULL,
`admin_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`id`, `category_id`, `brand_id`, `title`, `book_condition`, `description`, `slug`, `quantity`, `price`, `rent_charge`, `status`, `offer_price`, `admin_id`, `created_at`, `updated_at`) VALUES
(1, 9, 4, '1971', 'New Book', '1971 written by Humayun Ahmed.', '1971', 3, 200, 80, 0, NULL, 1, '2018-12-08 09:43:48', '2018-12-08 17:11:22'),
(2, 17, 7, 'Aat Kuthori Noy DorojaSamaresh Majumdar', 'New Book', 'Aat Kuthori Noy DorojaSamaresh Majumdar', 'aat-kuthori-noy-dorojasamaresh-majumdar', 3, 320, 180, 0, NULL, 1, '2018-12-08 17:33:24', '2018-12-08 17:33:24'),
(3, 8, 6, 'Adhunik Ishoper Golpo', 'New Book', 'Adhunik Ishoper Golpo Muhammed Zafar Iqbal', 'adhunik-ishoper-golpo', 5, 350, 200, 0, NULL, 1, '2018-12-08 17:35:10', '2018-12-08 17:35:10'),
(4, 10, 1, 'Agni Bina', 'Old Book', 'Agni Bina written by Kazi Najrul Islam', 'agni-bina', 4, 200, 50, 0, NULL, 1, '2018-12-08 17:42:28', '2018-12-08 17:42:28'),
(5, 10, 1, 'Agranthita Gaan', 'Old Book', 'Agranthita Gaan written by Kazi Najrul Islam', 'agranthita-gaan', 10, 150, 50, 0, NULL, 1, '2018-12-08 17:44:44', '2018-12-08 17:44:44'),
(6, 13, 4, 'Aaj Ami Kothao Jabo Naa', 'New Book', 'Aaj Ami Kothao Jabo Naa By Humayun Ahmed', 'aaj-ami-kothao-jabo-naa', 2, 280, 150, 0, NULL, 1, '2018-12-08 17:46:15', '2018-12-08 17:46:15'),
(7, 8, 6, 'Andhokarer Groho', 'New Book', 'Andhokarer Groho By Muhammed Zafar Iqbal', 'andhokarer-groho', 3, 310, 210, 0, NULL, 1, '2018-12-08 17:48:25', '2018-12-08 17:48:25'),
(8, 13, 4, 'Akash Jora Megh', 'Old Book', 'Akash Jora Megh By Humayun Ahmed', 'akash-jora-megh', 2, 220, 80, 0, NULL, 1, '2018-12-08 17:49:45', '2018-12-08 17:49:45'),
(9, 15, 1, 'Badhon Hara', 'New Book', 'Badhon Hara By Kazi Najrul Islam', 'badhon-hara', 3, 380, 250, 0, NULL, 1, '2018-12-08 17:51:28', '2018-12-08 17:51:28'),
(10, 14, 2, 'Bhanu Singher Padabali', 'Old Book', 'Bhanu Singher Padabali By Rabindranath Tagore', 'bhanu-singher-padabali', 2, 360, 200, 0, NULL, 1, '2018-12-08 17:53:04', '2018-12-08 17:53:04'),
(11, 19, 8, 'Buro Shaliker Ghare Ro', 'New Book', 'Buro Shaliker Ghare Ro ByMichael Madhusudan Dutta', 'buro-shaliker-ghare-ro', 5, 320, 150, 0, NULL, 1, '2018-12-08 17:56:48', '2018-12-08 17:56:48'),
(12, 10, 1, 'Bon GeetiKazi', 'New Book', 'Bon GeetiKazi By Najrul Islam', 'bon-geetikazi', 1, 220, 80, 0, NULL, 1, '2018-12-08 17:59:04', '2018-12-08 17:59:04'),
(13, 21, 9, 'Tafsir Ibn Kasir p1,2,3', 'New Book', 'Tafsir Ibn Kasir p1,2,3', 'tafsir-ibn-kasir-p123', 10, 1000, 200, 0, NULL, 1, '2018-12-08 18:18:03', '2018-12-08 18:18:03'),
(14, 21, 9, 'The Hundred', 'New Book', 'The HundredThe Hundred', 'the-hundred', 8, 100, 50, 0, NULL, 1, '2018-12-08 18:19:13', '2018-12-08 18:19:13'),
(15, 21, 9, 'shirat bishokos prothom khondo', 'New Book', 'shirat_bishokos_prothom_khondo', 'shirat-bishokos-prothom-khondo', 7, 300, 100, 0, NULL, 1, '2018-12-08 18:20:54', '2018-12-08 18:20:54'),
(16, 21, 9, 'Forbidden Work in Shariah', 'New Book', 'Forbidden Work in Shariah', 'forbidden-work-in-shariah', 5, 500, 250, 0, NULL, 1, '2018-12-08 18:21:54', '2018-12-08 18:21:54'),
(17, 11, 2, 'Tumi ChroKal Shak', 'Old Book', 'Tumi ChroKal Shak Abdul Hakim', 'tumi-chrokal-shak', 4, 290, 200, 0, NULL, 1, '2018-12-08 18:24:37', '2018-12-08 18:24:37'),
(18, 19, 8, 'Meghnath Vadh', 'Old Book', 'Meghnath Vadh Michael Madhusudan Dutta', 'meghnath-vadh', 6, 120, 50, 0, NULL, 1, '2018-12-08 18:27:28', '2018-12-08 18:27:28');
-- --------------------------------------------------------
--
-- Table structure for table `product_images`
--
CREATE TABLE `product_images` (
`id` int(10) UNSIGNED NOT NULL,
`product_id` int(10) UNSIGNED NOT NULL,
`image` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`pdf` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `product_images`
--
INSERT INTO `product_images` (`id`, `product_id`, `image`, `pdf`, `created_at`, `updated_at`) VALUES
(1, 1, '1544283828.PNG', 'edit1971Humayun Ahmed.pdf', '2018-12-08 09:43:48', '2018-12-08 09:43:48'),
(2, 2, '1544312004.PNG', NULL, '2018-12-08 17:33:24', '2018-12-08 17:33:24'),
(3, 3, '1544312110.PNG', NULL, '2018-12-08 17:35:10', '2018-12-08 17:35:10'),
(4, 4, '1544312548.PNG', 'AGNI BINA (www.amarbooks.com).pdf', '2018-12-08 17:42:28', '2018-12-08 17:42:28'),
(5, 5, '1544312684.PNG', 'Agranthita GaanKazi Najrul Islam.pdf', '2018-12-08 17:44:44', '2018-12-08 17:44:44'),
(6, 6, '1544312775.PNG', 'Aaj Ami Kothao Jabo NaaHumayun Ahmed.pdf', '2018-12-08 17:46:15', '2018-12-08 17:46:15'),
(7, 7, '1544312905.PNG', NULL, '2018-12-08 17:48:25', '2018-12-08 17:48:25'),
(8, 8, '1544312985.PNG', NULL, '2018-12-08 17:49:46', '2018-12-08 17:49:46'),
(9, 9, '1544313088.PNG', 'Badhon Hara Kazi Najrul Islam.pdf', '2018-12-08 17:51:28', '2018-12-08 17:51:28'),
(10, 10, '1544313184.PNG', 'Bhanu Singher Padabali Rabindranath Tagore.pdf', '2018-12-08 17:53:04', '2018-12-08 17:53:04'),
(11, 11, '1544313408.PNG', 'Buro Shaliker Ghare RoMichael Madhusudan Dutta.pdf', '2018-12-08 17:56:48', '2018-12-08 17:56:49'),
(12, 12, '1544313545.PNG', 'Bon GeetiKazi Najrul Islam.pdf', '2018-12-08 17:59:05', '2018-12-08 17:59:05'),
(13, 13, '1544314683.PNG', NULL, '2018-12-08 18:18:03', '2018-12-08 18:18:03'),
(14, 14, '1544314753.PNG', NULL, '2018-12-08 18:19:13', '2018-12-08 18:19:13'),
(15, 15, '1544314854.PNG', NULL, '2018-12-08 18:20:54', '2018-12-08 18:20:54'),
(16, 16, '1544314914.PNG', 'Forbidden-Work-in-Shariah.pdf', '2018-12-08 18:21:54', '2018-12-08 18:21:54'),
(17, 17, '1544315078.PNG', NULL, '2018-12-08 18:24:38', '2018-12-08 18:24:38'),
(18, 18, '1544315248.PNG', 'Meghnath Vadh Michael Madhusudan Dutta.pdf', '2018-12-08 18:27:28', '2018-12-08 18:27:28');
-- --------------------------------------------------------
--
-- Table structure for table `settings`
--
CREATE TABLE `settings` (
`id` int(10) UNSIGNED NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`phone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`shipping_cost` int(10) UNSIGNED NOT NULL DEFAULT '30',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `settings`
--
INSERT INTO `settings` (`id`, `email`, `phone`, `address`, `shipping_cost`, `created_at`, `updated_at`) VALUES
(1, 'nazrulislam94bd@gmail.com', '01917497927', 'Jatrabari', 30, '2018-11-04 15:42:28', '2018-11-04 15:42:28');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`first_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`last_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone_no` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`street_address` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`division_id` int(10) UNSIGNED NOT NULL COMMENT 'Division Table ID',
`district_id` int(10) UNSIGNED NOT NULL COMMENT 'District Table ID',
`status` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0=Inactive|1=Active|2=Ban',
`ip_address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`shipping_address` text COLLATE utf8mb4_unicode_ci,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `first_name`, `last_name`, `username`, `phone_no`, `email`, `password`, `street_address`, `division_id`, `district_id`, `status`, `ip_address`, `avatar`, `shipping_address`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'borhan', 'uddin', 'borhanuddin', '01682180100', 'mdborhan410@gmail.com', '$2y$10$ywlmvoKn10mBqJ38aaf0OOgkX5zVQ9w3WOQ23RxkNZzN5xKL8ENBW', 'badda', 2, 14, 1, '::1', NULL, NULL, 'GF5cxrI0Jh4CeQCu63pczfckdBFeCvfAnTK4KJceZsj8mvk6ZDQt81qZQusb', '2018-12-08 09:46:24', '2018-12-08 10:02:29');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `admins_email_unique` (`email`);
--
-- Indexes for table `book_sellings`
--
ALTER TABLE `book_sellings`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `brands`
--
ALTER TABLE `brands`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `carts`
--
ALTER TABLE `carts`
ADD PRIMARY KEY (`id`),
ADD KEY `carts_user_id_foreign` (`user_id`),
ADD KEY `carts_product_id_foreign` (`product_id`),
ADD KEY `carts_order_id_foreign` (`order_id`);
--
-- Indexes for table `cart_rents`
--
ALTER TABLE `cart_rents`
ADD PRIMARY KEY (`id`),
ADD KEY `cart_rents_user_id_foreign` (`user_id`),
ADD KEY `cart_rents_product_id_foreign` (`product_id`);
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `dates`
--
ALTER TABLE `dates`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `districts`
--
ALTER TABLE `districts`
ADD PRIMARY KEY (`id`),
ADD KEY `districts_division_id_foreign` (`division_id`);
--
-- Indexes for table `divisions`
--
ALTER TABLE `divisions`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`id`),
ADD KEY `orders_user_id_foreign` (`user_id`),
ADD KEY `orders_payment_id_foreign` (`payment_id`);
--
-- Indexes for table `order_rents`
--
ALTER TABLE `order_rents`
ADD PRIMARY KEY (`id`),
ADD KEY `order_rents_user_id_foreign` (`user_id`),
ADD KEY `order_rents_payment_id_foreign` (`payment_id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `payments_short_name_unique` (`short_name`);
--
-- Indexes for table `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `product_images`
--
ALTER TABLE `product_images`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_username_unique` (`username`),
ADD UNIQUE KEY `users_phone_no_unique` (`phone_no`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admins`
--
ALTER TABLE `admins`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `book_sellings`
--
ALTER TABLE `book_sellings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `brands`
--
ALTER TABLE `brands`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `carts`
--
ALTER TABLE `carts`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `cart_rents`
--
ALTER TABLE `cart_rents`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `comments`
--
ALTER TABLE `comments`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `dates`
--
ALTER TABLE `dates`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `districts`
--
ALTER TABLE `districts`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `divisions`
--
ALTER TABLE `divisions`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `order_rents`
--
ALTER TABLE `order_rents`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `product_images`
--
ALTER TABLE `product_images`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `carts`
--
ALTER TABLE `carts`
ADD CONSTRAINT `carts_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `carts_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `carts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `cart_rents`
--
ALTER TABLE `cart_rents`
ADD CONSTRAINT `cart_rents_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `cart_rents_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `order_rents`
--
ALTER TABLE `order_rents`
ADD CONSTRAINT `order_rents_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `order_rents_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
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 */;
| true
|
7243ccfc4e6b98cecf6276584527c386ceaa0ff1
|
SQL
|
bailram/PersewaanBuku
|
/database_persewaan_buku.sql
|
UTF-8
| 2,652
| 3.34375
| 3
|
[] |
no_license
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 09, 2020 at 01:01 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_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: `database_persewaan_buku`
--
-- --------------------------------------------------------
--
-- Table structure for table `buku`
--
CREATE TABLE `buku` (
`kodebuku` char(5) NOT NULL,
`judulbuku` varchar(25) NOT NULL,
`penerbit` varchar(25) NOT NULL,
`pengarang` varchar(25) NOT NULL,
`hargasewa` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `buku`
--
INSERT INTO `buku` (`kodebuku`, `judulbuku`, `penerbit`, `pengarang`, `hargasewa`) VALUES
('AAA', 'Belajar php', 'Bailram.co', 'Dhimas Bayu', 10000),
('AB', 'Belajar HTML', 'Bailram.co', 'Dhimas Bayu', 5000),
('ABC', 'Belajar Membuat Website', 'LSP Komputer', 'Dhimas Bayu', 15000);
-- --------------------------------------------------------
--
-- Table structure for table `sewa`
--
CREATE TABLE `sewa` (
`nomorfaktur` char(5) NOT NULL,
`tanggalfaktur` date NOT NULL,
`namakonsumen` varchar(25) NOT NULL,
`kodebuku` char(5) NOT NULL,
`jumlah` int(4) NOT NULL,
`hargasewa` mediumint(8) UNSIGNED NOT NULL,
`hargatotal` mediumint(8) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `sewa`
--
INSERT INTO `sewa` (`nomorfaktur`, `tanggalfaktur`, `namakonsumen`, `kodebuku`, `jumlah`, `hargasewa`, `hargatotal`) VALUES
('11', '2020-11-09', 'Dhimas', 'AAA', 1, 10000, 10000),
('bb', '2020-11-09', 'Bayu', 'AB', 5, 5000, 25000),
('FAK01', '2020-11-09', 'Bayu', 'AB', 5, 5000, 25000);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `buku`
--
ALTER TABLE `buku`
ADD PRIMARY KEY (`kodebuku`);
--
-- Indexes for table `sewa`
--
ALTER TABLE `sewa`
ADD PRIMARY KEY (`nomorfaktur`),
ADD KEY `fk_kodebuku` (`kodebuku`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `sewa`
--
ALTER TABLE `sewa`
ADD CONSTRAINT `fk_kodebuku` FOREIGN KEY (`kodebuku`) REFERENCES `buku` (`kodebuku`) ON DELETE NO ACTION ON UPDATE NO ACTION;
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 */;
| true
|
64b37427ceae49c15499c450ab1c9dc29a7e81fd
|
SQL
|
M-Dutta/DatabaseProjects
|
/Project4/Query6.sql
|
UTF-8
| 272
| 3.78125
| 4
|
[] |
no_license
|
/*List the names of students who have taken all courses offered by department v8 (deptId)*/
explain analyze select s.name
from Project4.student as s, Project4.transcript as t, Project4.course as c
where c.deptId='deptId626720' and c.crsCode = t.crsCode and s.id = t.studId
| true
|
3a3bc263ac252b554f692c72175255eb11f831bd
|
SQL
|
sucosuco/sucosuco_spring-suco_talk
|
/sucotalk/src/main/resources/schema.sql
|
UTF-8
| 1,143
| 3.328125
| 3
|
[] |
no_license
|
create table if not exists MEMBER
(
id
bigint
auto_increment
not
null,
name
varchar
(
255
) not null unique,
password varchar
(
255
) not null,
primary key
(
id
)
);
create table if not exists ROOM
(
id
bigint
auto_increment
not
null,
name
varchar
(
255
),
primary key
(
id
)
);
create table if not exists PARTICIPANTS
(
id
bigint
auto_increment
not
null,
member_id
bigint
not
null,
room_id
bigint
not
null,
primary
key
(
id
),
foreign key
(
member_id
) references MEMBER
(
id
),
foreign key
(
room_id
) references ROOM
(
id
)
);
create table if not exists MESSAGE
(
id
bigint
auto_increment
not
null,
sender_id
bigint
not
null,
room_id
bigint
not
null,
contents
varchar
(
255
),
send_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
primary key
(
id
),
foreign key
(
sender_id
) references MEMBER
(
id
),
foreign key
(
room_id
) references ROOM
(
id
)
);
| true
|
c95697b92d45729233df6e9d2e73135e62822b24
|
SQL
|
AnaNava1996/BEDU-Banco-Santander-3-caminos-Data-Analytics
|
/Etapa_1/Session_3/Reto_2.sql
|
UTF-8
| 643
| 3.953125
| 4
|
[] |
no_license
|
########### ¿Cuál es el nombre de los empleados que realizaron cada venta?
SELECT
e.nombre,
e.apellido_paterno,
e.apellido_materno,
venta.clave
FROM
empleado AS e
INNER JOIN
venta ON e.id_empleado = venta.id_empleado;
########## ¿Cuál es el nombre de los artículos que se han vendido?
SELECT DISTINCT
articulo.nombre
FROM
articulo
INNER JOIN
venta ON articulo.id_articulo = venta = id_articulo;
########## ¿Cuál es el total de cada venta?
SELECT
clave, SUM(precio) AS total
FROM
venta
JOIN
articulo ON venta.id_articulo = articulo.id_articulo
GROUP BY clave;
| true
|
5a75b73c12e2cf6b6af5f45a4c388c47981eceec
|
SQL
|
allancalderon/checkapp_webserver_login
|
/db_schema/checkapp_login_users.sql
|
UTF-8
| 1,198
| 3.4375
| 3
|
[
"MIT"
] |
permissive
|
drop database checkapp;
create database checkapp;
use checkapp;
create table users(
id int(11) primary key auto_increment,
unique_id varchar(23) not null unique,
name varchar(255) not null,
chatuid varchar(255) not null unique,
email varchar(255) not null unique,
encrypted_password varchar(255) not null,
salt varchar(10) not null,
created_at datetime,
updated_at datetime null
);
create table groups(
id int(11) primary key unique,
groupName varchar(255) not null,
groupDescription varchar(2000) not null,
language varchar(10) not null,
version int(11)
);
create table groupsByUsers(
idUser int(11) NOT NULL,
idGroup int(11) NOT NULL,
isAdmin int(11) DEFAULT 0,
description varchar(255) not null,
CONSTRAINT pk_GroupsByUsers PRIMARY KEY (idUser, idGroup)
);
insert into groupsByUsers (idUser, idGroup) VALUES (1,1);
CREATE USER 'login_user'@'localhost' IDENTIFIED BY 'FSLe6IOCZy5p';
GRANT ALL PRIVILEGES ON checkapp.users TO 'login_user'@'localhost';
GRANT ALL PRIVILEGES ON checkapp.groups TO 'login_user'@'localhost';
GRANT ALL PRIVILEGES ON checkapp.groupsByUsers TO 'login_user'@'localhost';
FLUSH PRIVILEGES;
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.