sql
stringlengths 6
1.05M
|
---|
if exists ( select * from sysobjects where id = object_id('[dbo].[fn_ErrorText]') )
begin
DROP FUNCTION [dbo].[fn_ErrorText]
end
go
CREATE FUNCTION [dbo].[fn_ErrorText]
(
)
RETURNS NVARCHAR(MAX)
AS
/*
Function fn_ErrorText
Description: Return formatted Error Text using the standard SQL ERROR_..() functions
Arguments: None
Called By: any procedure using an ErrorHandler
History: v1.00 - SH 27/07/2008 - Created
*/
BEGIN
DECLARE @RetVal NVARCHAR(MAX)
SET @RetVal=ERROR_MESSAGE() + ' at line ' + CAST(ERROR_LINE() AS VARCHAR(20)) + ' in ' + ERROR_PROCEDURE() +
', State: ' + CAST(ERROR_STATE() AS VARCHAR(20)) + ', Severity: ' + CAST(ERROR_SEVERITY() AS VARCHAR(20)) + ', Error No: '+ CAST(ERROR_NUMBER() AS VARCHAR(20))
RETURN @RetVal
END
GO
|
CREATE DATABASE IF NOT EXISTS `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `test`;
-- MySQL dump 10.13 Distrib 5.5.49, for debian-linux-gnu (x86_64)
--
-- Host: 127.0.0.1 Database: test
-- ------------------------------------------------------
-- Server version 5.5.49-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `timezones`
--
DROP TABLE IF EXISTS `timezones`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `timezones` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`gmtoffset` int(10) unsigned NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `timezones_name_unique` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `timezones`
--
LOCK TABLES `timezones` WRITE;
/*!40000 ALTER TABLE `timezones` DISABLE KEYS */;
INSERT INTO `timezones` VALUES (1,'Pacific',0,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(2,'Eastern',0,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(3,'Atlantic',0,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(4,'Central',0,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(5,'Mountain',0,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(6,'Alaska',0,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(7,'GMT +10',10,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(8,'Hawaii',0,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(9,'Alaksa',0,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(10,'Pacific +7',9,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33'),(11,'Samoa',0,NULL,'2016-04-25 13:10:33','2016-04-25 13:10:33');
/*!40000 ALTER TABLE `timezones` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-04-25 20:49:08
|
<filename>+usados/SendMail/send_mail_html.sql<gh_stars>0
Declare
SendorAddress Varchar2(30) := '<EMAIL>';
/* Address of the person who is sending Email */
ReceiverAddress varchar2(30) := '<EMAIL>';
/* Address of the person who is receiving Email */
EmailServer varchar2(30) := '10.21.25.16';
/* Address of your Email Server Configured for sending emails */
Port number := 25;
/* Port Number responsible for sending email */
conn UTL_SMTP.CONNECTION;
/* UTL_SMTP package establish a connection with the SMTP server */
crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
/* crlf used for carriage return */
mesg VARCHAR2( 4000 );
/* Variable for storing message contents */
mesg_body varchar2(4000)
/* Variable for storing HTML code */
:= ' <html>
<head>
<title>Oracle Techniques By <NAME></title>
</head>
<body bgcolor="#FFFFFF" link="#000080">
<table cellspacing="0" cellpadding="0" width="100%">
<tr align="LEFT" valign="BASELINE">
<td width="100%" valign="middle"><h1><font color="#00008B"><b>Send Mail in HTML Format</b></font></h1>
</td>
</table>
<ul>
<li><b><a href="www.geocities.com/samoracle">Oracle Techniques is for DBAs </li>
<l><b> by <NAME> </b> </l>
</ul>
</body>
</html>';
BEGIN
/* Open Connection */
conn:= utl_smtp.open_connection( EmailServer, Port );
/* Hand Shake */
utl_smtp.helo( conn, EmailServer );
/* Configure Sender and Recipient with UTL_SMTP */
utl_smtp.mail( conn, SendorAddress);
utl_smtp.rcpt( conn, ReceiverAddress );
/* Making Message buffer */
mesg:=
'Date: '||TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' )|| crlf ||
'From:'||SendorAddress|| crlf ||
'Subject: Mail Through ORACLE Database' || crlf ||
'To: '||ReceiverAddress || crlf ||
'' || crlf ||mesg_body||'';
/* Configure Sending Message */
/*You need to put 'MIME-Verion: 1.0' (this is case-sensitive!) */
/*Content-Type-Encoding is actually Content-Transfer-Encoding. */
/*The MIME-Version, Content-Type, Content-Transfer-Encoding should */
/* be the first 3 data items in your message */
utl_smtp.data(conn, 'MIME-Version: 1.0' ||CHR(13)|| CHR(10)||'Content-type: text/html' || CHR(13)||CHR(10)||mesg);
/* Closing Connection */
utl_smtp.quit( conn );
/* End of logic */
END;
/
|
<filename>beerDB.sql
-- MySQL dump 10.17 Distrib 10.3.25-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: beerDB
-- ------------------------------------------------------
-- Server version 10.3.25-MariaDB-0ubuntu0.20.04.1
/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `Biere`
--
DROP TABLE IF EXISTS `Biere`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Biere` (
`Id_Biere` int(11) NOT NULL AUTO_INCREMENT,
`Nom_Biere` varchar(50) DEFAULT NULL,
`Prix_Biere` double DEFAULT NULL,
`Contenance_Biere` int(11) DEFAULT NULL,
`Degre_alccol_Biere` double DEFAULT NULL,
`Description` varchar(300) DEFAULT NULL,
`Id_Producteur` int(11) NOT NULL,
`Id_Style` int(11) NOT NULL,
`Image_Biere` varchar(300) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`Id_Biere`),
KEY `Id_Style` (`Id_Style`),
KEY `Id_Producteur` (`Id_Producteur`),
CONSTRAINT `Biere_ibfk_1` FOREIGN KEY (`Id_Style`) REFERENCES `Style` (`Id_Style`),
CONSTRAINT `Biere_ibfk_2` FOREIGN KEY (`Id_Producteur`) REFERENCES `Producteur` (`Id_Producteur`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Biere`
--
LOCK TABLES `Biere` WRITE;
/*!40000 ALTER TABLE `Biere` DISABLE KEYS */;
INSERT INTO `Biere` VALUES (1,'Heineken',1.69,65,5,'la biere la',1,1,'https://www.heineken.com/media-eu/01pfxdqq/heineken-original-bottle.png?quality=85',NULL,NULL),(4,'Pelforth',0.5,25,5.8,'notre choix de bière entrée de gamme!',1,1,'https://pelforth.fr/sites/default/files/2021-03/blonde%20caroussel_0.png','2021-06-14 21:26:27','2021-06-14 21:26:27'),(7,'Karmeliet',2.1,25,8.4,'Mélange de trois grains différents créé une bière très riche en goût',3,2,'https://ab-inbev.be/storage/app/media//our-beers/tripel-karmeliet/tripel-card.png','2021-06-15 08:20:36','2021-06-15 08:20:36'),(8,'Goose Island',2.3,35,5.9,'Une IPA accompagnée de la célèbre oie de la brasserie américaine Goose Island !',3,3,'https://img.saveur-biere.com/img/p/3561-22078.jpg','2021-06-15 08:45:05','2021-06-15 08:45:05'),(9,'Hoegaarden',1.5,25,4.9,'Goût fruité, douce présence de la coriandre et belle amertume',3,5,'https://ab-inbev.be/storage/app/media//our-beers/hoegaarden/hoegaarden-card.png','2021-06-15 08:49:00','2021-06-15 08:49:00'),(10,'Desperados',1.9,33,5.9,'Née en 1995 dans notre brasserie de Schiltigheim en Alsace, Desperados® est la première bière aromatisée tequila commercialisée en France.',1,4,'https://www.heinekenfrance.fr/heineken-content/uploads/2020/03/desperados-415-330-20205169.png','2021-06-15 08:51:57','2021-06-15 08:51:57'),(11,'Leffe',1.4,33,6.6,'Saveurs de fruits, de malt, d\'épices et de levure.',3,1,'https://ab-inbev.be/storage/app/media//our-beers/leffe/leffe-card.png','2021-06-15 08:53:58','2021-06-15 08:53:58'),(12,'Grimbergen',1.6,33,6.7,'La bière du Phénix est une bière d\'abbaye authentique et savoureuse, réputée pour son contraste unique et équilibré entre les notes épicées et fruitées.',2,6,'https://www.bodecall.com/images/stories/virtuemart/product/grimbergen-blonde-blond.png','2021-06-15 09:12:17','2021-06-15 09:12:17'),(13,'Carlsberg',1.5,33,5,'La bière premium 100 % malt du fournisseur officiel de la cour royale danoise depuis 1904!',2,1,'https://www.gourmetencasa-tcm.com/5163/carlsberg-33cl-caisse-24-unites.jpg','2021-06-15 09:16:06','2021-06-15 09:16:06');
/*!40000 ALTER TABLE `Biere` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Biere_Nominee`
--
DROP TABLE IF EXISTS `Biere_Nominee`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Biere_Nominee` (
`Id_Biere` int(11) NOT NULL,
`Classement` int(11) DEFAULT NULL,
`Id_Concours` int(11) NOT NULL,
`Année` varchar(50) NOT NULL,
PRIMARY KEY (`Id_Biere`),
KEY `Id_Concours` (`Id_Concours`,`Année`),
CONSTRAINT `Biere_Nominee_ibfk_1` FOREIGN KEY (`Id_Biere`) REFERENCES `Biere` (`Id_Biere`),
CONSTRAINT `Biere_Nominee_ibfk_2` FOREIGN KEY (`Id_Concours`, `Année`) REFERENCES `Concours` (`Id_Concours`, `Année`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Biere_Nominee`
--
LOCK TABLES `Biere_Nominee` WRITE;
/*!40000 ALTER TABLE `Biere_Nominee` DISABLE KEYS */;
INSERT INTO `Biere_Nominee` VALUES (1,4,1,'2021'),(4,1,1,'2021'),(7,3,1,'2021'),(11,2,1,'2021');
/*!40000 ALTER TABLE `Biere_Nominee` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Concours`
--
DROP TABLE IF EXISTS `Concours`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Concours` (
`Id_Concours` int(11) NOT NULL,
`Année` varchar(50) NOT NULL,
`Nom_Concours` varchar(50) DEFAULT NULL,
`Pays_Concours` varchar(50) DEFAULT NULL,
PRIMARY KEY (`Id_Concours`,`Année`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Concours`
--
LOCK TABLES `Concours` WRITE;
/*!40000 ALTER TABLE `Concours` DISABLE KEYS */;
INSERT INTO `Concours` VALUES (1,'2021','Dégustation à Polytech','France');
/*!40000 ALTER TABLE `Concours` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Producteur`
--
DROP TABLE IF EXISTS `Producteur`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Producteur` (
`Id_Producteur` int(11) NOT NULL,
`Nom_Producteur` varchar(50) DEFAULT NULL,
PRIMARY KEY (`Id_Producteur`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Producteur`
--
LOCK TABLES `Producteur` WRITE;
/*!40000 ALTER TABLE `Producteur` DISABLE KEYS */;
INSERT INTO `Producteur` VALUES (1,'Heineken'),(2,'Carlsberg'),(3,'AB InBev');
/*!40000 ALTER TABLE `Producteur` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Style`
--
DROP TABLE IF EXISTS `Style`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Style` (
`Id_Style` int(11) NOT NULL,
`Nom_Style` varchar(50) DEFAULT NULL,
`Couleur` varchar(50) DEFAULT NULL,
PRIMARY KEY (`Id_Style`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Style`
--
LOCK TABLES `Style` WRITE;
/*!40000 ALTER TABLE `Style` DISABLE KEYS */;
INSERT INTO `Style` VALUES (1,'Lager','blonde'),(2,'Triple','blonde'),(3,'IPA','blonde'),(4,'Aromatisée','blonde'),(5,'witbier','blanche'),(6,'d\'Abbaye','blonde');
/*!40000 ALTER TABLE `Style` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `failed_jobs`
--
DROP TABLE IF EXISTS `failed_jobs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `failed_jobs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`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(),
PRIMARY KEY (`id`),
UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `failed_jobs`
--
LOCK TABLES `failed_jobs` WRITE;
/*!40000 ALTER TABLE `failed_jobs` DISABLE KEYS */;
/*!40000 ALTER TABLE `failed_jobs` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `migrations`
--
DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `migrations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `migrations`
--
LOCK TABLES `migrations` WRITE;
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
INSERT INTO `migrations` 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),(4,'2021_06_07_202701_create_beer_d_b_s_table',1),(5,'2021_06_08_142116_create_beers_table',1);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `password_resets`
--
DROP TABLE IF EXISTS `password_resets`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
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,
KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `password_resets`
--
LOCK TABLES `password_resets` WRITE;
/*!40000 ALTER TABLE `password_resets` DISABLE KEYS */;
/*!40000 ALTER TABLE `password_resets` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`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,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'gagoulefripou','<EMAIL>',NULL,'$2y$10$KdPjKb93.HLKRjQwKdjbMegsffiML5E/4TAZzVk9cuHlDjo2GkTvm','lsevwHgQZ2ZyAKs04GzU313GDm6IgGo8PJbEPDK1dwxqgA3wmozJspcyjQC7','2021-06-14 12:45:39','2021-06-14 12:45:39'),(2,'user1','<EMAIL>',NULL,'$2y$10$.DLK74IDfLfz9/dT6z7Fs.XK0KwyqfEiiFbhHxDUNM.HyHtALPkxK',NULL,'2021-06-14 14:32:43','2021-06-14 14:32:43');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-06-15 13:25:27
|
<gh_stars>0
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fn_GetQuarterEnd]')
AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[fn_GetQuarterEnd]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fn_GetQuarterEnd](@ReferenceDate datetime, @Quarter int)
returns datetime
AS
BEGIN
RETURN DATEADD(d, -1, DATEADD(q, DATEDIFF(q, 0, @ReferenceDate)+@Quarter, 0))
END
GO |
<filename>db/seeds.sql<gh_stars>0
INSERT INTO employee (first_name,last_name,role_id,manager_id)
VALUES ('Anitha','Venkatesan',1,23);
SELECT * FROM employee;
INSERT INTO department (name) VALUES
('Sales'),
('Engineering'),
('Finance'),
('Legal');
SELECT * FROM department;
INSERT INTO role (title,salary,department_id) VALUES
('Sales Lead',100000,1),
("Sales Person",50000,2),
("Lead Engineer",100000,3),
("Software Engineer",80000,4),
("Accountant",60000,5),
("Legal Team Lead",120000,6),
("Lawyer",75000,7);
SELECT * FROM role;
SELECT first_name, last_name, title
FROM employee, role
WHERE employee.role_id = role.department_id;
select * from employee;
SELECT * FROM role;
select * from department;
SELECT employee.id, employee.first_name,
employee.last_name,
role.title,
department.name,
role.salary
FROM employee,role,department
WHERE employee.role_id = role.id AND role.department_id = department.id;
DELETE FROM employee WHERE first_name='Anitha';
DELETE FROM employee WHERE first_name ='Anand';
DELETE FROM role;
DELETE from employee;
DELETE from department; |
# Host: localhost (Version 5.5.5-10.1.38-MariaDB)
# Date: 2020-01-14 16:56:03
# Generator: MySQL-Front 6.0 (Build 2.20)
#
# Structure for table "mahasiswa"
#
DROP TABLE IF EXISTS `mahasiswa`;
CREATE TABLE `mahasiswa` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nama` varchar(100) NOT NULL,
`nis` varchar(11) NOT NULL,
`email` varchar(100) NOT NULL,
`jurusan` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
#
# Data for table "mahasiswa"
#
INSERT INTO `mahasiswa` VALUES (3,'Adrian','181910006','<EMAIL>','Jaringan'),(4,'<NAME>','181910017','<EMAIL>','Program Aplikasi'),(5,'<NAME>','181910038','<EMAIL>','Program Aplikasi');
|
/*
SQLyog Ultimate v12.5.1 (64 bit)
MySQL - 10.4.14-MariaDB : Database - pariwisata
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
/*Table structure for table `banks` */
DROP TABLE IF EXISTS `banks`;
CREATE TABLE `banks` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nama_bank` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `banks` */
insert into `banks`(`id`,`nama_bank`,`created_at`,`updated_at`) values
(1,'BCA','2021-07-01 21:43:41','2021-07-01 21:43:41'),
(2,'BNI','2021-07-01 21:46:42','2021-07-01 21:46:53');
/*Table structure for table `bus_details` */
DROP TABLE IF EXISTS `bus_details`;
CREATE TABLE `bus_details` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`bus_id` smallint(6) NOT NULL,
`foto` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `bus_details` */
insert into `bus_details`(`id`,`bus_id`,`foto`,`created_at`,`updated_at`) values
(6,6,'\"1625753269916-Alur Seleksi CPNS.png\"','2021-07-08 21:07:49','2021-07-08 21:07:49'),
(7,6,'\"1625753269923-D76d6ee5c83b45ce4197579a5b8909b87.png\"','2021-07-08 21:07:49','2021-07-08 21:07:49'),
(8,7,'\"1625753280521-materai10000.jpg\"','2021-07-08 21:08:00','2021-07-08 21:08:00'),
(9,7,'\"1625753280527-WhatsApp Image 2021-06-16 at 12.28.55.jpeg\"','2021-07-08 21:08:00','2021-07-08 21:08:00');
/*Table structure for table `buses` */
DROP TABLE IF EXISTS `buses`;
CREATE TABLE `buses` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nama_bus` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`jenis_bus_id` smallint(6) NOT NULL,
`minimum_pack` int(11) NOT NULL,
`maksimum_pack` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `buses` */
insert into `buses`(`id`,`nama_bus`,`jenis_bus_id`,`minimum_pack`,`maksimum_pack`,`created_at`,`updated_at`) values
(6,'Bus A',1,30,45,'2021-07-07 14:46:50','2021-07-07 14:46:50'),
(7,'Bus B',2,25,30,'2021-07-07 14:47:03','2021-07-07 14:47:03');
/*Table structure for table `failed_jobs` */
DROP TABLE IF EXISTS `failed_jobs`;
CREATE TABLE `failed_jobs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`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(),
PRIMARY KEY (`id`),
UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `failed_jobs` */
/*Table structure for table `hotel_details` */
DROP TABLE IF EXISTS `hotel_details`;
CREATE TABLE `hotel_details` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`hotel_id` smallint(6) NOT NULL,
`foto` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `hotel_details` */
insert into `hotel_details`(`id`,`hotel_id`,`foto`,`created_at`,`updated_at`) values
(5,3,'1625666947627-icons8-list-64.png','2021-07-07 21:09:07','2021-07-07 21:09:07');
/*Table structure for table `hotels` */
DROP TABLE IF EXISTS `hotels`;
CREATE TABLE `hotels` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nama_hotel` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `hotels` */
insert into `hotels`(`id`,`nama_hotel`,`created_at`,`updated_at`) values
(3,'Hotel A','2021-07-07 13:56:57','2021-07-07 13:56:57'),
(4,'Hotel B','2021-07-07 13:57:02','2021-07-07 13:57:02');
/*Table structure for table `jenis_buses` */
DROP TABLE IF EXISTS `jenis_buses`;
CREATE TABLE `jenis_buses` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nama_jenis` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `jenis_buses` */
insert into `jenis_buses`(`id`,`nama_jenis`,`created_at`,`updated_at`) values
(1,'Big Bus','2021-07-01 22:11:38','2021-07-01 22:11:38'),
(2,'Medium Bus','2021-07-01 22:11:38','2021-07-01 22:11:38');
/*Table structure for table `lokasis` */
DROP TABLE IF EXISTS `lokasis`;
CREATE TABLE `lokasis` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nama_lokasi` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`foto` text COLLATE utf8mb4_unicode_ci NOT NULL,
`hotel_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `lokasis` */
insert into `lokasis`(`id`,`nama_lokasi`,`foto`,`hotel_id`,`created_at`,`updated_at`) values
(2,'Monas','1625639268604-WhatsApp Image 2021-02-23 at 21.32.05 (1).jpeg',3,'2021-07-07 12:27:54','2021-07-07 13:27:48'),
(3,'Istiqlal','1625639310186-20180723_092402.jpg',4,'2021-07-07 13:28:10','2021-07-07 13:28:30'),
(4,'Ancol','1625754549894-D76d6ee5c83b45ce4197579a5b8909b87.png',3,'2021-07-08 21:29:09','2021-07-08 21:29:09'),
(5,'Kota Tua','1625754562362-unnamed.jpg',3,'2021-07-08 21:29:22','2021-07-08 21:29:22'),
(6,'<NAME>','1625754649335-1200px-Android_logo_2019.svg.png',4,'2021-07-08 21:30:49','2021-07-08 21:30:49'),
(7,'Farm House','1625754672457-icons8-list-64.png',4,'2021-07-08 21:31:12','2021-07-08 21:31:12');
/*Table structure for table `migrations` */
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE `migrations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `migrations` */
insert into `migrations`(`id`,`migration`,`batch`) values
(44,'2014_10_12_000000_create_users_table',1),
(45,'2014_10_12_100000_create_password_resets_table',1),
(46,'2019_08_19_000000_create_failed_jobs_table',1),
(47,'2021_06_26_213143_create_buses_table',1),
(48,'2021_06_26_213512_create_hotels_table',1),
(49,'2021_06_26_213617_create_hotel_details_table',1),
(50,'2021_06_26_213818_create_bus_details_table',1),
(52,'2021_06_26_214625_create_pesawats_table',1),
(53,'2021_06_26_214649_create_pesawat_details_table',1),
(55,'2021_06_26_214911_create_pemesanans_table',1),
(56,'2021_06_26_215008_create_pembayarans_table',1),
(58,'2021_06_26_220207_create_jenis_buses_table',1),
(59,'2021_06_26_220327_create_paket_lokasis_table',1),
(60,'2021_06_26_221806_create_banks_table',1),
(61,'2021_06_26_214248_create_lokasis_table',2),
(64,'2021_07_07_134148_create_notes_table',4),
(65,'2021_07_07_133519_create_perusahaans_table',5),
(66,'2021_06_26_214825_create_pakets_table',6),
(67,'2021_06_26_215029_create_pembayaran_details_table',7);
/*Table structure for table `notes` */
DROP TABLE IF EXISTS `notes`;
CREATE TABLE `notes` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`penjelasan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`status_termasuk` smallint(6) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `notes` */
insert into `notes`(`id`,`penjelasan`,`status_termasuk`,`created_at`,`updated_at`) values
(1,'1. <NAME>',1,'2021-07-07 20:56:47','2021-07-07 20:56:47'),
(2,'2. Tour Leader',1,'2021-07-07 21:04:10','2021-07-07 21:04:10'),
(3,'3. Spanduk',1,'2021-07-07 21:04:24','2021-07-07 21:04:24'),
(5,'1. <NAME>',2,'2021-07-07 21:06:06','2021-07-07 21:06:06');
/*Table structure for table `paket_lokasis` */
DROP TABLE IF EXISTS `paket_lokasis`;
CREATE TABLE `paket_lokasis` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`paket_id` smallint(6) NOT NULL,
`lokasi_id` smallint(6) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `paket_lokasis` */
insert into `paket_lokasis`(`id`,`paket_id`,`lokasi_id`,`created_at`,`updated_at`) values
(1,1,2,'2021-07-07 17:10:01','2021-07-07 17:10:01'),
(3,1,3,'2021-07-08 21:10:57','2021-07-08 21:10:57'),
(4,3,2,'2021-07-08 21:25:14','2021-07-08 21:25:14'),
(5,4,4,'2021-07-08 21:29:36','2021-07-08 21:29:36'),
(6,4,5,'2021-07-08 21:29:44','2021-07-08 21:29:44'),
(7,1,4,'2021-07-08 21:29:57','2021-07-08 21:29:57'),
(8,1,5,'2021-07-08 21:30:04','2021-07-08 21:30:04'),
(9,1,6,'2021-07-08 21:31:30','2021-07-08 21:31:30'),
(10,1,7,'2021-07-08 21:31:35','2021-07-08 21:31:35');
/*Table structure for table `pakets` */
DROP TABLE IF EXISTS `pakets`;
CREATE TABLE `pakets` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nama_paket` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`keterangan` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`bus_id` smallint(6) DEFAULT NULL,
`pesawat_id` smallint(6) DEFAULT NULL,
`harga_paket` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `pakets` */
insert into `pakets`(`id`,`nama_paket`,`keterangan`,`bus_id`,`pesawat_id`,`harga_paket`,`created_at`,`updated_at`) values
(1,'Paket A','paket a',6,NULL,1950000,'2021-07-07 14:54:31','2021-07-07 14:54:31'),
(3,'Paket 15','paket 15',NULL,3,2500000,'2021-07-07 16:54:12','2021-07-07 16:54:12'),
(4,'Jakarta - Jogja - Bandung','07 Hari 02 Malam Inap',7,NULL,2700000,'2021-07-08 21:27:02','2021-07-08 21:27:02');
/*Table structure for table `password_resets` */
DROP TABLE IF EXISTS `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,
KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `password_resets` */
/*Table structure for table `pembayaran_details` */
DROP TABLE IF EXISTS `pembayaran_details`;
CREATE TABLE `pembayaran_details` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`pembayaran_id` smallint(6) NOT NULL,
`pembayaran_ke` int(11) NOT NULL,
`dibayar` bigint(20) DEFAULT NULL,
`bank_id` smallint(6) DEFAULT NULL,
`no_rekening` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`bukti_bayar` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status_dibayar` smallint(6) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `pembayaran_details` */
insert into `pembayaran_details`(`id`,`pembayaran_id`,`pembayaran_ke`,`dibayar`,`bank_id`,`no_rekening`,`bukti_bayar`,`status_dibayar`,`created_at`,`updated_at`) values
(1,1,1,26325000,1,'43434343','1625816472964-WhatsApp Image 2021-06-16 at 12.28.55.jpeg',1,'2021-07-09 14:38:43','2021-07-09 15:55:16'),
(2,1,2,43875000,1,'455654','1625828812032-unnamed.jpg',1,'2021-07-09 14:38:43','2021-07-09 18:12:27'),
(3,1,3,17550000,1,'454243244','1625833370161-icons8-stationery-32.png',1,'2021-07-09 14:38:43','2021-07-09 19:23:05');
/*Table structure for table `pembayarans` */
DROP TABLE IF EXISTS `pembayarans`;
CREATE TABLE `pembayarans` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`kode_pembayaran` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`pemesanan_id` smallint(6) NOT NULL,
`status_pembayaran` int(11) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `pembayarans` */
insert into `pembayarans`(`id`,`kode_pembayaran`,`pemesanan_id`,`status_pembayaran`,`created_at`,`updated_at`) values
(1,'PB1625816323074NN',1,1,'2021-07-09 14:38:43','2021-07-09 19:23:51');
/*Table structure for table `pemesanans` */
DROP TABLE IF EXISTS `pemesanans`;
CREATE TABLE `pemesanans` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`kode_pemesanan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` smallint(6) NOT NULL,
`paket_id` smallint(6) NOT NULL,
`pax` int(11) DEFAULT NULL,
`tgl_pemesanan` date NOT NULL,
`status` int(11) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `pemesanans` */
insert into `pemesanans`(`id`,`kode_pemesanan`,`user_id`,`paket_id`,`pax`,`tgl_pemesanan`,`status`,`created_at`,`updated_at`) values
(1,'PM1625815922116NN',2,1,45,'2021-07-09',1,'2021-07-09 14:38:43','2021-07-09 19:24:54');
/*Table structure for table `perusahaans` */
DROP TABLE IF EXISTS `perusahaans`;
CREATE TABLE `perusahaans` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nama_perusahaan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`alamat_perusahaan` text COLLATE utf8mb4_unicode_ci NOT NULL,
`no_telpon` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `perusahaans` */
insert into `perusahaans`(`id`,`nama_perusahaan`,`alamat_perusahaan`,`no_telpon`,`email`,`created_at`,`updated_at`) values
(1,'CV. Pesona Indah Wisata','Jalan Ratna Lorong Atom No. 79 Palembang','0821-7941-2166','<EMAIL>','2021-07-07 18:07:02','2021-07-07 18:07:02');
/*Table structure for table `pesawat_details` */
DROP TABLE IF EXISTS `pesawat_details`;
CREATE TABLE `pesawat_details` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`pesawat_id` smallint(6) NOT NULL,
`foto` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `pesawat_details` */
insert into `pesawat_details`(`id`,`pesawat_id`,`foto`,`created_at`,`updated_at`) values
(3,2,'1625666973836-Microsoft Technology Associate.png','2021-07-07 21:09:33','2021-07-07 21:09:33');
/*Table structure for table `pesawats` */
DROP TABLE IF EXISTS `pesawats`;
CREATE TABLE `pesawats` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nama_pesawat` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `pesawats` */
insert into `pesawats`(`id`,`nama_pesawat`,`created_at`,`updated_at`) values
(2,'Pesawat A','2021-07-07 14:47:20','2021-07-07 14:47:20'),
(3,'Pesawat B','2021-07-07 14:47:28','2021-07-07 14:47:28');
/*Table structure for table `users` */
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`username` 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,
`is_admin` tinyint(1) DEFAULT NULL,
`institusi` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`nama_penanggung_jawab` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`kartu_identitas` 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,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*Data for the table `users` */
insert into `users`(`id`,`name`,`username`,`email`,`email_verified_at`,`password`,`is_admin`,`institusi`,`nama_penanggung_jawab`,`kartu_identitas`,`remember_token`,`created_at`,`updated_at`) values
(1,'Administrator','admin123','<EMAIL>','2021-06-26 22:34:32','$2y$10$1INCxKPSd4juiu7x3prxmuUGBhh7JFYZMVreKp4ptu9SuiTBC1e2.',1,'Admin',NULL,'22223333',NULL,'2021-06-26 22:34:32','2021-06-26 22:34:32'),
(2,'Tes','tes','<EMAIL>','2021-07-01 21:33:27','$2y$10$lbiJta2lqFjzmq1rum42se5lGHi.feARrDPu/VkIiO8TZfkx5P8jO',NULL,'SD Negeri 1 Palembang','Tes','123123123',NULL,'2021-07-01 20:50:44','2021-07-01 21:33:27'),
(3,'Tes2','tes2','<EMAIL>','2021-07-09 19:51:57','$2y$10$C9jHY0dvC7iOXtvEdhQPuOifoLPUbA30SwAw8rbf0PWR8ZMlCyE7y',NULL,'SD Negeri 45 Palembang','Parman','244232244',NULL,'2021-07-09 19:49:00','2021-07-09 19:51:57');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
{{
config(
materialized='table',
schema='dwh',
tags=['dwh', 'dimension']
)
}}
SELECT *
FROM {{ ref('country') }} |
<filename>test/migrations/S001__insert_test_products.sql
INSERT INTO products (id, name)
VALUES
(1, 'Tomato'),
(2, 'Cucumber'),
(3, 'Garlic');
|
<filename>maxClose.sql
select max_date.* from
(select s.id,s.name,max(sp.close) as close from stock_price as sp, stock as s where s.id = sp.stock_id and date = '2020-09-01' group by s.id,s.name) as max_date,
(select s.id,s.name,max(sp.close) as close from stock_price as sp, stock as s where s.id = sp.stock_id group by s.id,s.name) as max_overall
where max_date.id = max_overall.id and max_date.close = max_overall.close |
<filename>2019 notes which may be obsolete/01 UploadingHistoricalData/02 Create MPData Tables/CreateMPDataUploadBookFailureSystemTime.sql<gh_stars>1-10
-- Table: bloomreadertest.mpdata_upload_book_failure_system_time
-- DROP TABLE bloomreadertest.mpdata_upload_book_failure_system_time;
CREATE TABLE bloomreadertest.mpdata_upload_book_failure_system_time
(
id character varying(1024) ,
received_at bigint,
browser text COLLATE pg_catalog."default",
channel text COLLATE pg_catalog."default",
command_line text COLLATE pg_catalog."default",
context_library_name text COLLATE pg_catalog."default",
context_library_version text COLLATE pg_catalog."default",
culture text COLLATE pg_catalog."default",
current_directory text COLLATE pg_catalog."default",
dot_net_version text COLLATE pg_catalog."default",
event text COLLATE pg_catalog."default",
event_text text COLLATE pg_catalog."default",
full_version text COLLATE pg_catalog."default",
--ip text COLLATE pg_catalog."default",
osversion text COLLATE pg_catalog."default",
user_id text COLLATE pg_catalog."default",
user_name text COLLATE pg_catalog."default",
version text COLLATE pg_catalog."default",
working_set text COLLATE pg_catalog."default",
city text COLLATE pg_catalog."default",
region text COLLATE pg_catalog."default",
mp_country text COLLATE pg_catalog."default"
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE bloomreadertest.mpdata_upload_book_failure_system_time
OWNER to segment;
GRANT SELECT ON TABLE bloomreadertest.mpdata_upload_book_failure_system_time TO bloomappuser;
GRANT SELECT ON TABLE bloomreadertest.mpdata_upload_book_failure_system_time TO readbloom;
GRANT ALL ON TABLE bloomreadertest.mpdata_upload_book_failure_system_time TO segment;
-- ALTER TABLE bloomreadertest.mpdata_upgrade DROP COLUMN location_uid;
ALTER TABLE bloomreadertest.mpdata_upload_book_failure_system_time
ADD COLUMN location_uid bigint;
select * from bloomreadertest.mpdata_upload_book_failure_system_time;
SELECT MIN(b.timestamp) FROM bloomreadertest.mpdata_upload_book_failure_system_time AS b; |
<gh_stars>1-10
/*Here we have cards, with that are missing an image.*/
SELECT *
FROM 'MTG-Cards'
WHERE small_img IS NULL; |
<gh_stars>1-10
alter table "public"."cases" alter column "jurisdiction_state" drop not null;
|
<filename>src/test/resources/sql/_unknown/a03f429b.sql<gh_stars>10-100
-- file:aggregates.sql ln:680 expect:false
elsif n is not null then
state.total := state.total + n
|
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jul 05, 2015 at 08:35 PM
-- Server version: 5.6.19
-- PHP Version: 5.5.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: `vote`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE IF NOT EXISTS `admin` (
`email` varchar(50) NOT NULL,
`password` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`email`, `password`) VALUES
('<EMAIL>', '<PASSWORD>');
-- --------------------------------------------------------
--
-- Table structure for table `articles`
--
CREATE TABLE IF NOT EXISTS `articles` (
`email` varchar(50) NOT NULL,
`id` text NOT NULL,
`date` date NOT NULL,
`time` varchar(50) NOT NULL,
`article` text NOT NULL,
`title` varchar(500) NOT NULL,
`star` tinyint(1) NOT NULL DEFAULT '0',
`share` tinyint(1) NOT NULL DEFAULT '0',
`nick` varchar(50) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `articles`
--
INSERT INTO `articles` (`email`, `id`, `date`, `time`, `article`, `title`, `star`, `share`, `nick`) VALUES
('<EMAIL>', '551387566dc1f', '2015-03-26', '05:13:10am', '<p>Have you noticed that when you are really close to what you want or to the next level in your life, things seem to go wrong? You are close to having your car paid off and you total it, you are about to win a <a href="http://www.selfgrowth.com/sports.html">sports</a> competition and you get injured, you are about to take the trip of a life time and you get sick, you decide you purchase a new home and have other unexpected expenses, you are about to get a promotion but loose your nanny and want to stay home with the baby, you finally decide to scale down on the hours at the office and your assistant quits, your business is about to make it big and your partner pulls out, your body starts trimming and looking fit and you stop going to the gym and eating healthy, you get the drift.</p>\r\n\r\n<p>The reason for this is that we scare ourselves off from getting what we want, moving forward with our life, achieving our <a href="http://www.selfgrowth.com/dreams.html">dreams</a>. We are afraid of the unknown. We know what to do and how to be in a mediocre life. We don’t know what to do and how to be in an amazing life. We believe we don’t deserve or we are not good enough for more. We believe we can’t do better. We can’t fathom a better life, never mind how to get there. So whenever we are close to a breakthrough we unconsciously sabotage it. We induce disasters, we shoot ourselves on the foot, we invite drama and chaos, anything to distract us from getting to our intended destination.</p>\r\n\r\n<p>We do the same in our relationship. Have you noticed that whenever you are getting along great, have been on the same page and feeling close, or are ready for the next level of commitment, that you have a major fight or experience a set back? It is too scary for our unconscious mind to be intimate, satisfied and happy. It is afraid that this too shall pass like it did when we were children. It sabotages attempts at closeness and satisfaction to protect itself from additional pain and disappointment. It creates conflict, space and disconnect. Even though these states hurt, they are what we know and hence easier to endure.</p>\r\n\r\n<p>Remember, our unconscious mind is time, place and people stupid. It doesn’t know you are in 2008, that your partner is your partner, and you are in your adult home. It believes your partner is your less-than-perfect-caretaker(s), back when you were young, in the home you grew up in. Imagine operating from that state and trying to create the life and relationship you want!</p>\r\n\r\n<p>What a conundrum this is. We work hard at having a great life and relationship, but are operating at a less than resourceful state and do anything possible to undermine ourselves. Talk about spinning our wheels!</p>\r\n\r\n<p>We can stop this ridiculous cycle and actually start creating and enjoying the life and relationship we want:</p>\r\n\r\n<p>1) Soothe your unconscious mind by tending to its fear and reassuring it. Feel and name the feelings, put them in perspective, understand what triggered them and why. What do they remind you of growing up? Identify what the broken record in your head is saying and where it comes from. Soothe your self with understanding, acknowledgement and acceptance.</p>\r\n\r\n<p>2) Meet your global needs by making sure you get the antidote to your hurts from childhood. Translate the feelings and story you identified above into emotional needs and diligently go about having them met. By believing in yourself, doing for yourself, pampering, nurturing, and cherishing yourself. Ask for what you need from your partner and set them up to be able to give it to you. Once you do get what you asked for receive it, accept it, take it in!</p>\r\n\r\n<p>3) Grow yourself up by becoming whole again. Become mindful of situations, events, and interactions that trigger you and your usual responses to them. Stretch yourself by activating a different more resourceful part of you to use to cope and respond. Try using more parts of you more frequently and consistently. Stretch yourself further by gifting your partner with what is usually difficult for you to give them. Integrate these into a grown up you.</p>\r\n\r\n<p>Bestow your life, your relationship and your self with the care and attention of a grown up you. Don’t sabotage, support yourself instead. Watch your life and relationship flourish! Live the life you want to live!!</p>\r\n', 'Stop Sabotaging Yourself!', 1, 0, '0'),
('<EMAIL>', '5513889eb2b85', '2015-03-26', '05:18:38am', '<p>No woman will ever satisfy me. I know that now, and I would never try to deny it. But this is actually okay, because I will never satisfy a woman, either.</p>\r\n\r\n<p>Should I be writing such thoughts? Perhaps not. Perhaps it's a bad idea. I can definitely foresee a scenario where that first paragraph could come back to haunt me, especially if I somehow became marginally famous. If I become marginally famous, I will undoubtedly be interviewed by someone in the media, and the interviewer will inevitably ask, "Fifteen years ago, you wrote that no woman could ever satisfy you. Now that you've been married for almost five years, are those words still true?" And I will have to say, "Oh, God no. Those were the words of an entirely different person — a person whom I can't even relate to anymore. Honestly, I can't image an existence without _____. She satisfies me in ways that I never even considered. She saved my life, really."</p>\r\n\r\n<p>Now, I will be lying. I won't really feel that way. But I'll certainly <em>say</em> those words, and I'll deliver them with the utmost sincerity, even though those sentiments will not be there. So then the interviewer will undoubtedly quote lines from <em>this</em> particular paragraph, thereby reminding me that I swore I would publicly deny my true feelings, and I'll chuckle and say, "Come on, Mr. Rose. That was a literary device. You know I never really believed that."</p>\r\n\r\n<p>But here's the thing: I <em>do</em> believe that. It's the truth now, and it will be in the future. And while I'm not exactly happy about that truth, it doesn't make me sad, either. I know it's not my fault.</p>\r\n\r\n<p>It's no one's fault, really. Or maybe it's everyone's fault. It should be everyone's fault, because it's everyone's problem. Well, okay...not <em>everyone</em>. Not boring people, and not the profoundly retarded. But whenever I meet dynamic, nonretarded Americans, I notice that they all seem to share a single unifying characteristic: the inability to experience the kind of mind-blowing, transcendent romantic relationship they perceive to be a normal part of living. And someone needs to take the fall for this. So instead of blaming no one for this (which is kind of cowardly) or blaming everyone (which is kind of meaningless), I'm going to blame John Cusack.</p>\r\n\r\n<p>I once loved a girl who almost loved me, but not as much as she loved <NAME>. Under certain circumstances, this would have been fine; Cusack is relatively good-looking, he seems like a pretty cool guy (he likes the Clash and the Who, at least), and he undoubtedly has millions of bones in the bank. If Cusack and I were competing for the same woman, I could easily accept losing. However, I don't really feel like John and I were "competing" for the girl I'm referring to, inasmuch as her relationship to Cusack was confined to watching him as a two-dimensional projection, pretending to be characters who don't actually exist. Now, there was a time when I would have thought that detachment would have given me a huge advantage over <NAME>., inasmuch as <em>my</em> relationship with this woman included things like "talking on the phone" and "nuzzling under umbrellas" and "eating pancakes." However, I have come to realize that I perceived this competition completely backward; it was definitely an unfair battle, but not in my favor. It was unfair in Cusack's favor. I never had a chance.</p>\r\n\r\n<p>It appears that countless women born between the years of 1965 and 1978 are in love with <NAME>. I cannot fathom how he isn't the number-one box-office star in America, because every straight girl I know would sell her soul to share a milkshake with that motherfucker. For upwardly mobile women in their twenties and thirties, <NAME> is the neo-Elvis. But here's what none of these upwardly mobile women seem to realize: They don't love <NAME>. They love <NAME>. When they see <NAME>, they are still seeing the optimistic, charmingly loquacious teenager he played in <em>Say Anything</em>, a movie that came out more than a decade ago. That's the guy they think he is; when Cusack played <NAME> in <em>America's Sweethearts</em> or the sensitive hit man in <em>Grosse Pointe Blank</em>, all his female fans knew he was only acting...but they assume when the camera stopped rolling, he went back to his genuine self...which was someone like <NAME>...which was, in fact, someone who <em>is</em> <NAME>, and someone who continues to have a storybook romance with Diane Court (or with Ione Skye, depending on how you look at it). And these upwardly mobile women are not alone. We all convince ourselves of things like this — not necessarily about <em>Say Anything</em>, but about any fictionalized portrayals of romance that happen to hit us in the right place, at the right time. This is why I will never be completely satisfied by a woman, and this is why the kind of woman I tend to find attractive will never be satisfied by me. We will both measure our relationship against the prospect of fake love.</p>\r\n\r\n<p>Fake love is a very powerful thing. That girl who adored <NAME> once had the opportunity to spend a weekend with me in New York at the Waldorf-Astoria, but she elected to fly to Portland instead to see the first U.S. appearance by Coldplay, a British pop group whose success derives from their ability to write melodramatic alt-rock songs about fake love. It does not matter that Coldplay is absolutely the shittiest fucking band I've ever heard in my entire fucking life, or that they sound like a mediocre photocopy of Travis (who sound like a mediocre photocopy of Radiohead), or that their greatest fucking artistic achievement is a video where their blandly attractive frontman walks on a beach on a cloudy fucking afternoon. None of that matters. What matters is that Coldplay manufactures fake love as frenetically as the Ford fucking Motor Company manufactures Mustangs, and that's all this woman heard. "For you I bleed myself dry," sang their blockhead vocalist, brilliantly informing us that stars in the sky are, in fact, yellow. How am I going to compete with that shit? That sleepy-eyed bozo isn't even making sense. He's just pouring fabricated emotions over four gloomy guitar chords, and it ends up sounding like love. And what does that mean? It means she flies to fucking Portland to hear two hours of amateurish U.K. hyper-slop, and I sleep alone in a $270 hotel in Manhattan, and I hope Coldplay gets fucking dropped by fucking EMI and ends up like the Stone fucking Roses, who were actually a better fucking band, all things considered.</p>\r\n\r\n<p>Not that I'm bitter about this. Oh, I concede that I may be taking this particular example somewhat personally — but I do think it's a perfect illustration of why almost everyone I know is either overtly or covertly unhappy. Coldplay songs deliver an amorphous, irrefutable interpretation of how being in love is supposed to feel, and people find themselves wanting that feeling for real. They want men to adore them like <NAME> would, and they want women to think like <NAME>, and they expect all their arguments to sound like <NAME> and <NAME>. They think everything will work out perfectly in the end (just like it did for <NAME>'s <NAME> and <NAME>'s <NAME>), and they don't stop believing, because Journey's <NAME> insists we should never do that. In the nineteenth century, teenagers merely aspired to have a marriage that would be better than that of their parents; personally, I would never be satisfied unless my marriage was as good as Cliff and <NAME>'s (or at least as enigmatic as Jack and <NAME>'s).</p>\r\n\r\n<p>Pundits are always blaming TV for making people stupid, movies for desensitizing the world to violence, and rock music for making kids take drugs and kill themselves. These things should be the least of our worries. The main problem with mass media is that it makes it impossible to fall in love with any acumen of normalcy. There is no "normal," because everybody is being twisted by the same sources simultaneously. You can't compare your relationship with the playful couple who lives next door, because they're probably modeling themselves after <NAME> and <NAME>. Real people are actively trying to live like fake people, so real people are no less fake. Every comparison becomes impractical. This is why the impractical has become totally acceptable; impracticality almost seems cool. The best relationship I ever had was with a journalist who was as crazy as me, and some of our coworkers liked to compare us to <NAME> and <NAME>. At the time, I used to think, "Yeah, that's completely valid: We fight all the time, our love is self-destructive, and — if she was mysteriously killed — I'm sure I'd be wrongly arrested for second-degree murder before dying from an overdose." We even watched <em>Sid & Nancy</em> in her parents' basement and giggled the whole time. "That's us," we said gleefully. And like I said — this was the <em>best</em> relationship I ever had. And I suspect it was the best one she ever had, too.</p>\r\n\r\n<p>Of course, this media transference is not all bad. It has certainly worked to my advantage, just as it has for all modern men who look and talk and act like me. We all owe our lives to <NAME>. If <NAME> had never been born, I'm sure I would be doomed to a life of celibacy. Remember the aforementioned woman who loved Cusack and Coldplay? There is absolutely no way I could have dated this person if <NAME> didn't exist. In tangible terms, she was light-years out of my league, along with most of the other women I've slept with. But <NAME> changed everything. <NAME> made it acceptable for beautiful women to sleep with nerdy, bespectacled goofballs; all we need to do is fabricate the illusion of intellectual humor, and we somehow have a chance. The irony is that many of the women most susceptible to this scam haven't even <em>seen</em> any of Woody's movies, nor would they want to touch the actual <NAME>en if they ever had the chance (especially since he's proven to be an <em>über</em>-pervy clarinet freak). If asked, most of these foxy ladies wouldn't classify Woody Allen as sexy, or handsome, or even likable. But this is how media devolution works: It creates an archetype that eventually dwarfs its origin. By now, the "Woody Allen Personality Type" has far greater cultural importance than the man himself.</p>\r\n\r\n<p>Now, the argument could be made that all this is good for the sexual bloodstream of Americana, and that all these Women Who Want Woody are being unconsciously conditioned to be less shallow than their sociobiology dictates. Self-deprecating cleverness has become a virtue. At least on the surface, movies and television actively promote dating the nonbeautiful: If we have learned anything from the mass media, it's that the only people who can make us happy are those who don't strike us as being particularly desirable. Whether it's <em><NAME></em> or <em>Sixteen Candles</em> or <em>Who's the Boss</em> or <em>Some Kind of Wonderful</em> or <em>Speed Racer</em>, we are constantly reminded that the unattainable icons of perfection we lust after can never fulfill us like the platonic allies who have been there all along. If we all took media messages at their absolute face value, we'd all be sleeping with our best friends. And that does happen, sometimes. But herein lies the trap: We've also been trained to think this will<em>always</em> work out over the long term, which dooms us to disappointment. Because when push comes to shove, we really <em>don't</em> want to have sex with our friends...unless they're sexy. And sometimes we <em>do</em> want to have sex with our blackhearted, soul-sucking enemies...assuming <em>they're</em> sexy. Because that's all it ever comes down to in real life, regardless of what happened to <NAME> in <em>Teen Wolf</em>.</p>\r\n\r\n<p>The mass media causes sexual misdirection: It prompts us to <em>need</em> something deeper than what we <em>want</em>. This is why <NAME> has made nebbish guys cool; he makes people assume there is something profound about having a relationship based on witty conversation and intellectual discourse. There isn't. It's just another gimmick, and it's no different than wanting to be with someone because they're thin or rich or the former lead singer of Whiskeytown. And it actually might be worse, because an intellectual relationship isn't real <em>at all</em>. My witty banter and cerebral discourse is always completely contrived. Right now, I have three and a half dates worth of material, all of which I pretend to deliver spontaneously. This is my strategy: If I can just coerce women into the last half of that fourth date, it's anyone's ball game. I've beaten the system; I've broken the code; I've slain the Minotaur. If we part ways on that fourth evening without some kind of conversational disaster, she probably digs me. Or at least she <em>thinks</em> she digs me, because who she digs is not really me. Sadly, our relationship will not last ninety-three minutes (like <em>Annie Hall</em>) or ninety-six minutes (like <em>Manhattan</em>). It will go on for days or weeks or months or years, and I've already used everything in my vault. Very soon, I will have nothing more to say, and we will be sitting across from each other at breakfast, completely devoid of banter; she will feel betrayed and foolish, and I will suddenly find myself actively trying to avoid spending time with a woman I didn't deserve to be with in the first place.</p>\r\n\r\n<p>Perhaps this sounds depressing. That is not my intention. This is all normal. There's not a lot to say during breakfast. I mean, you just woke up, you know? Nothing has happened. If neither person had an especially weird dream and nobody burned the toast, breakfast is just the time for chewing Cocoa Puffs and/or wishing you were still asleep. But we've been convinced not to think like that. Silence is only supposed to happen as a manifestation of supreme actualization, where both parties are so at peace with their emotional connection that it cannot be expressed through the rudimentary tools of the lexicon; otherwise, silence is proof that the magic is gone and the relationship is over (hence the phrase "We just don't talk anymore"). For those of us who grew up in the media age, the only good silence is the kind described by the hair metal band Extreme. "More than words is all I ever needed you to show," explained <NAME> on the <em>Pornograffiti</em> album. "Then you wouldn't have to say that you love me, cause I'd already know." This is the difference between art and life: In art, not talking is never an extension of having nothing to say; not talking always means something. And now that art and life have become completely interchangeable, we're forced to live inside the acoustic power chords of Nuno Bettencourt, even if most of us don't necessarily know who the fuck Nuno Bettencourt is.</p>\r\n\r\n<p><em>When <NAME> </em>hit theaters in 1989. I didn't see it until 1997, but it turns out I could have skipped it entirely. The movie itself isn't bad (which is pretty amazing, since it stars <NAME> <em>and</em> Billy Crystal), and there are funny parts and sweet parts and smart dialogue, and — all things considered — it's a well-executed example of a certain kind of entertainment. Yet watching this film in 1997 was like watching the 1978 one-game playoff between the Yankees and the Red Sox on <em>ESPN Classic</em>: Though I've never sat through the pitch sequence that leads to Bucky Dent's three-run homer, I know exactly what happened. I feel like I remember it, even though I don't. And — more important — <em>I know what it all means</em>. Knowing about sports means knowing that <NAME> is the living, breathing, metaphorical incarnation of the Bo Sox's undying futility; I didn't have to see that game to understand the fabric of its existence. I didn't need to see <em>When <NAME></em>, either. Within three years of its initial release, classifying any intense friendship as "totally a <em>Harry-Met-Sally</em> situation" had a recognizable meaning to everyone, regardless of whether or not they'd actually seen the movie. And that meaning remains clear and remarkably consistent: It implies that two platonic acquaintances are refusing to admit that they're deeply in love with each other. <em>When <NAME></em> cemented the plausibility of that notion, and it gave a lot of desperate people hope. It made it realistic to suspect your best friend may be your soul mate, and it made wanting such a scenario comfortably conventional. The problem is that the <em>Harry-Met-Sally</em> situation is almost always tragically unbalanced. Most of the time, the two involved parties are not really "best friends." Inevitably, one of the people has been in love with the other from the first day they met, while the other person is either (a) wracked with guilt and pressure, or (b) completely oblivious to the espoused attraction. Every relationship is fundamentally a power struggle, and the individual in power is whoever likes the other person less. But <em>When <NAME></em> gives the powerless, unrequited lover a reason to live. When this person gets drunk and tells his friends that he's in love with a woman who only sees him as a buddy, they will say, "You're wrong. You're perfect for each other. This is just like <em>When <NAME> Sally</em>! I'm sure she loves you — she just doesn't realize it yet." <NAME> accidentally ruined a lot of lives.</p>\r\n\r\n<p>I remember taking a course in college called "Communication and Society," and my professor was obsessed by the belief that fairy tales like "Hansel and Gretel" and "Little Red Riding Hood" were evil. She said they were part of a latent social code that hoped to suppress women and minorities. At the time, I was mildly outraged that my tuition money was supporting this kind of crap; years later, I have come to recall those pseudo-savvy lectures as what I <em>loved</em> about college. But I still think they were probably wasteful, and here's why: Even if those theories are true, they're barely significant. "The Three Little Pigs" is not the story that is fucking people up. Stories like<em>Say Anything</em> are fucking people up. We don't need to worry about people unconsciously "absorbing" archaic secret messages when they're six years old; we need to worry about all the entertaining messages people are consciously accepting when they're twenty-six. They're the ones that get us, because they're the ones we try to turn into life. I mean, Christ: I wish I could believe that bozo in Coldplay when he tells me that stars are yellow. I miss that girl. I wish I was Lloyd Dobler. I don't want anybody to step on a piece of broken glass. I want fake love. But that's all I want, and that's why I can't have it.</p>\r\n', 'Sex, Drugs, and Cocoa Puffs', 0, 1, '0'),
('<EMAIL>', '551389197da96', '2015-03-26', '05:20:41am', '<p>One beautiful April morning, on a narrow side street in Tokyo’s fashionable Harujuku neighborhood, I walked past the 100% perfect girl.<br />\r\n<br />\r\nTell you the truth, she’s not that good-looking. She doesn’t stand out in any way. Her clothes are nothing special. The back of her hair is still bent out of shape from sleep. She isn’t young, either - must be near thirty, not even close to a “girl,” properly speaking. But still, I know from fifty yards away: She’s the 100% perfect girl for me. The moment I see her, there’s a rumbling in my chest, and my mouth is as dry as a desert.<br />\r\n<br />\r\nMaybe you have your own particular favorite type of girl - one with slim ankles, say, or big eyes, or graceful fingers, or you’re drawn for no good reason to girls who take their time with every meal. I have my own preferences, of course. Sometimes in a restaurant I’ll catch myself staring at the girl at the next table to mine because I like the shape of her nose.<br />\r\n<br />\r\nBut no one can insist that his 100% perfect girl correspond to some preconceived type. Much as I like noses, I can’t recall the shape of hers - or even if she had one. All I can remember for sure is that she was no great beauty. It’s weird.<br />\r\n<br />\r\n“Yesterday on the street I passed the 100% girl,” I tell someone.<br />\r\n<br />\r\n“Yeah?” he says. “Good-looking?”<br />\r\n<br />\r\n“Not really.”<br />\r\n<br />\r\n“Your favorite type, then?”<br />\r\n<br />\r\n“I don’t know. I can’t seem to remember anything about her - the shape of her eyes or the size of her breasts.”<br />\r\n<br />\r\n“Strange.”<br />\r\n<br />\r\n“Yeah. Strange.”<br />\r\n<br />\r\n“So anyhow,” he says, already bored, “what did you do? Talk to her? Follow her?”<br />\r\n<br />\r\n“Nah. Just passed her on the street.”<br />\r\n<br />\r\nShe’s walking east to west, and I west to east. It’s a really nice April morning.<br />\r\n<br />\r\nWish I could talk to her. Half an hour would be plenty: just ask her about herself, tell her about myself, and - what I’d really like to do - explain to her the complexities of fate that have led to our passing each other on a side street in Harajuku on a beautiful April morning in 1981. This was something sure to be crammed full of warm secrets, like an antique clock build when peace filled the world.<br />\r\n<br />\r\nAfter talking, we’d have lunch somewhere, maybe see a Woody Allen movie, stop by a hotel bar for cocktails. With any kind of luck, we might end up in bed.<br />\r\n<br />\r\nPotentiality knocks on the door of my heart.<br />\r\n<br />\r\nNow the distance between us has narrowed to fifteen yards.<br />\r\n<br />\r\nHow can I approach her? What should I say?<br />\r\n<br />\r\n“Good morning, miss. Do you think you could spare half an hour for a little conversation?”<br />\r\n<br />\r\nRidiculous. I’d sound like an insurance salesman.<br />\r\n<br />\r\n“Pardon me, but would you happen to know if there is an all-night cleaners in the neighborhood?”<br />\r\n<br />\r\nNo, this is just as ridiculous. I’m not carrying any laundry, for one thing. Who’s going to buy a line like that?<br />\r\n<br />\r\nMaybe the simple truth would do. “Good morning. You are the 100% perfect girl for me.”<br />\r\n<br />\r\nNo, she wouldn’t believe it. Or even if she did, she might not want to talk to me. Sorry, she could say, I might be the 100% perfect girl for you, but you’re not the 100% boy for me. It could happen. And if I found myself in that situation, I’d probably go to pieces. I’d never recover from the shock. I’m thirty-two, and that’s what growing older is all about.<br />\r\n<br />\r\nWe pass in front of a flower shop. A small, warm air mass touches my skin. The asphalt is damp, and I catch the scent of roses. I can’t bring myself to speak to her. She wears a white sweater, and in her right hand she holds a crisp white envelope lacking only a stamp. So: She’s written somebody a letter, maybe spent the whole night writing, to judge from the sleepy look in her eyes. The envelope could contain every secret she’s ever had.<br />\r\n<br />\r\nI take a few more strides and turn: She’s lost in the crowd.<br />\r\n<br />\r\nNow, of course, I know exactly what I should have said to her. It would have been a long speech, though, far too long for me to have delivered it properly. The ideas I come up with are never very practical.<br />\r\n<br />\r\nOh, well. It would have started “Once upon a time” and ended “A sad story, don’t you think?”<br />\r\n<br />\r\nOnce upon a time, there lived a boy and a girl. The boy was eighteen and the girl sixteen. He was not unusually handsome, and she was not especially beautiful. They were just an ordinary lonely boy and an ordinary lonely girl, like all the others. But they believed with their whole hearts that somewhere in the world there lived the 100% perfect boy and the 100% perfect girl for them. Yes, they believed in a miracle. And that miracle actually happened.<br />\r\n<br />\r\nOne day the two came upon each other on the corner of a street.<br />\r\n<br />\r\n“This is amazing,” he said. “I’ve been looking for you all my life. You may not believe this, but you’re the 100% perfect girl for me.”<br />\r\n<br />\r\n“And you,” she said to him, “are the 100% perfect boy for me, exactly as I’d pictured you in every detail. It’s like a dream.”<br />\r\n<br />\r\nThey sat on a park bench, held hands, and told each other their stories hour after hour. They were not lonely anymore. They had found and been found by their 100% perfect other. What a wonderful thing it is to find and be found by your 100% perfect other. It’s a miracle, a cosmic miracle.<br />\r\n<br />\r\nAs they sat and talked, however, a tiny, tiny sliver of doubt took root in their hearts: Was it really all right for one’s dreams to come true so easily?<br />\r\n<br />\r\nAnd so, when there came a momentary lull in their conversation, the boy said to the girl, “Let’s test ourselves - just once. If we really are each other’s 100% perfect lovers, then sometime, somewhere, we will meet again without fail. And when that happens, and we know that we are the 100% perfect ones, we’ll marry then and there. What do you think?”<br />\r\n<br />\r\n“Yes,” she said, “that is exactly what we should do.”<br />\r\n<br />\r\nAnd so they parted, she to the east, and he to the west.<br />\r\n<br />\r\nThe test they had agreed upon, however, was utterly unnecessary. They should never have undertaken it, because they really and truly were each other’s 100% perfect lovers, and it was a miracle that they had ever met. But it was impossible for them to know this, young as they were. The cold, indifferent waves of fate proceeded to toss them unmercifully.<br />\r\n<br />\r\nOne winter, both the boy and the girl came down with the season’s terrible inluenza, and after drifting for weeks between life and death they lost all memory of their earlier years. When they awoke, their heads were as empty as the young <NAME>’s piggy bank.<br />\r\n<br />\r\nThey were two bright, determined young people, however, and through their unremitting efforts they were able to acquire once again the knowledge and feeling that qualified them to return as full-fledged members of society. Heaven be praised, they became truly upstanding citizens who knew how to transfer from one subway line to another, who were fully capable of sending a special-delivery letter at the post office. Indeed, they even experienced love again, sometimes as much as 75% or even 85% love.<br />\r\n<br />\r\nTime passed with shocking swiftness, and soon the boy was thirty-two, the girl thirty.<br />\r\n<br />\r\nOne beautiful April morning, in search of a cup of coffee to start the day, the boy was walking from west to east, while the girl, intending to send a special-delivery letter, was walking from east to west, but along the same narrow street in the Harajuku neighborhood of Tokyo. They passed each other in the very center of the street. The faintest gleam of their lost memories glimmered for the briefest moment in their hearts. Each felt a rumbling in their chest. And they knew:<br />\r\n<br />\r\nShe is the 100% perfect girl for me.<br />\r\n<br />\r\nHe is the 100% perfect boy for me.<br />\r\n<br />\r\nBut the glow of their memories was far too weak, and their thoughts no longer had the clarity of fouteen years earlier. Without a word, they passed each other, disappearing into the crowd. Forever.<br />\r\n<br />\r\nA sad story, don’t you think?<br />\r\n<br />\r\nYes, that’s it, that is what I should have said to her.</p>\r\n', 'ON SEEING THE 100% PERFECT GIRL ONE BEAUTIFUL APRIL MORNING', 1, 1, '0'),
('<EMAIL>', '551392115c149', '2015-03-26', '05:58:57am', '<p>“Do what you love. Love what you do.”</p>\r\n\r\n<p>The command is framed and perched in a living room that can only be described as “well-curated.” A <a href="http://www.designsponge.com/2013/04/sneak-peek-jessica-walsh.html" target="_blank">picture of this room appeared first on a popular design blog</a> and has been pinned, tumbl’d, and liked thousands of times. Though it introduces exhortations to labor into a space of leisure, the “do what you love” living room is the place all those pinners and likers long to be.</p>\r\n\r\n<p>There’s little doubt that “do what you love” (DWYL) is now the unofficial work mantra for our time. The problem with DWYL, however, is that it leads not to salvation but to the devaluation of actual work—and more importantly, the dehumanization of the vast majority of laborers.</p>\r\n\r\n<p>Superficially, DWYL is an uplifting piece of advice, urging us to ponder what it is we most enjoy doing and then turn that activity into a wage-generating enterprise. But why should our pleasure be for profit? And who is the audience for this dictum?</p>\r\n\r\n<p>DWYL is a secret handshake of the privileged and a worldview that disguises its elitism as noble self-betterment. According to this way of thinking, labor is not something one does for compensation but is an act of love. If profit doesn’t happen to follow, presumably it is because the worker’s passion and determination were insufficient. Its real achievement is making workers believe their labor serves the self and not the marketplace.</p>\r\n\r\n<p>Aphorisms usually have numerous origins and reincarnations, but the nature of DWYL confounds precise attribution. <em>Oxford Reference</em> links the phrase and variants of it to <NAME> and Franço<NAME>, among others. The Internet frequently attributes it to Confucius, locating it in a misty, orientalized past. <NAME> and other peddlers of positivity have included the notion in their repertoires for decades. Even the world of finance has gotten in on DWYL: “If you love what you do, it’s not ‘work,’” as the co-CEO of the private equity firm Carlyle Group <a href="http://dealbook.nytimes.com/2014/01/15/wall-street-work-habits-show-generation-gap/?_php=true&_type=blogs&partner=socialflow&smid=tw-nytimesbusiness&_r=0" target="_blank">put it to CNBC this week</a>.</p>\r\n\r\n<p>The most important recent evangelist of DWYL, however, was the late Apple CEO <NAME>. In his graduation speech to the Stanford University Class of 2005, Jobs recounted the creation of Apple and inserted this reflection:</p>\r\n\r\n<blockquote>You’ve got to find what you love. And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do.</blockquote>\r\n\r\n<p>In these four sentences, the words “you” and “your” appear eight times. This focus on the individual isn’t surprising coming from Jobs, who cultivated a very specific image of himself as a worker: inspired, casual, passionate—all states agreeable with ideal romantic love. Jobs conflated his besotted worker-self with his company so effectively that his black turtleneck and jeans became metonyms for all of Apple and the labor that maintains it.</p>\r\n\r\n<p><img alt="<NAME>" src="http://www.slate.com/content/dam/slate/articles/technology/technology/2014/01/140116_TECH_SteveJobsTurtleneck.jpg.CROP.promo-mediumlarge.jpg" /></p>\r\n\r\n<p>Do what you love. Wear what you love.</p>\r\n\r\n<p>Photo by <NAME>/Getty Images</p>\r\n\r\n<p>But by portraying Apple as a labor of his individual love, Jobs elided the labor of untold thousands in Apple’s factories, hidden from sight on the other side of the planet—the very labor that allowed Jobs to actualize his love.</p>\r\n\r\n<p>This erasure needs to be exposed. While DWYL seems harmless and precious, it is self-focused to the point of narcissism. Jobs’ formulation of DWYL is the depressing antithesis to <NAME>’s utopian vision of labor for all. In “Life Without Principle,” Thoreau wrote:</p>\r\n\r\n<blockquote>… it would be good economy for a town to pay its laborers so well that they would not feel that they were working for low ends, as for a livelihood merely, but for scientific, even moral ends. Do not hire a man who does your work for money, but him who does it for the love of it. </blockquote>\r\n\r\n<p>Admittedly, Thoreau had little feel for the proletariat. (It’s hard to imagine someone washing diapers for “scientific, even moral ends,” no matter how well paid.) But he nonetheless maintains that society has a stake in making work well compensated and meaningful. By contrast, the 21st-century Jobsian view asks us to turn inward. It absolves us of any obligation to, or acknowledgment of, the wider world.</p>\r\n\r\n<p>One consequence of this isolation is the division that DWYL creates among workers, largely along class lines. Work becomes divided into two opposing classes: that which is lovable (creative, intellectual, socially prestigious) and that which is not (repetitive, unintellectual, undistinguished). Those in the lovable-work camp are vastly more privileged in terms of wealth, social status, education, society’s racial biases, and political clout, while comprising a small minority of the workforce.</p>\r\n\r\n<p>In ignoring most work and reclassifying the rest as love, DWYL may be the most elegant anti-worker ideology around.</p>\r\n\r\n<p>Photo by <NAME>/Getty Images</p>\r\n\r\n<p>For those forced into unlovable work, it’s a different story. Under the DWYL credo, labor that is done out of motives or needs other than love—which is, in fact, most labor—is erased. As in Jobs’ Stanford speech, unlovable but socially necessary work is banished from our consciousness.</p>\r\n\r\n<p>Think of the great variety of work that allowed Jobs to spend even one day as CEO. His food harvested from fields, then transported across great distances. His company’s goods assembled, packaged, shipped. Apple advertisements scripted, cast, filmed. Lawsuits processed. Office wastebaskets emptied and ink cartridges filled. Job creation goes both ways. Yet with the vast majority of workers effectively invisible to elites busy in their lovable occupations, how can it be surprising that the heavy strains faced by today’s workers—abysmal wages, massive child care costs, etc.—barely register as political issues even among the liberal faction of the ruling class?</p>\r\n\r\n<p>In ignoring most work and reclassifying the rest as love, DWYL may be the most elegant anti-worker ideology around. Why should workers assemble and assert their class interests if there’s no such thing as work?</p>\r\n\r\n<p>* * *</p>\r\n\r\n<p>“Do what you love” disguises the fact that being able to choose a career primarily for personal reward is a privilege, a sign of socioeconomic class. Even if a self-employed graphic designer had parents who could pay for art school and co-sign a lease for a slick Brooklyn apartment, she can bestow DWYL as career advice upon those covetous of her success.</p>\r\n', 'In the Name of Love', 0, 1, '0');
INSERT INTO `articles` (`email`, `id`, `date`, `time`, `article`, `title`, `star`, `share`, `nick`) VALUES
('<EMAIL>', '5513931101e1e', '2015-03-26', '06:03:13am', '<p>Short men make better husbands, and make up in wisdom what they lack in stature, says self-confessed small man, <NAME>.</p>\r\n\r\n<p>Just a few weeks ago, an interesting and lengthy paper by a pair of sociologists from New York University made a lot of noise in what I suppose would these days be called the community of short men - a community to which, as it happens, I rather inarguably, one might say entirely, belong.</p>\r\n\r\n<p>Its subject was what is called assortative mating - the way people divide themselves up, two by two in that ark-like fashion, for life. It was one of those wonderfully solemn sociological papers in which the utterly self-evident is systematically recast as the cautiously empirical.</p>\r\n\r\n<p>The authors point out early on in their report that "social psychological research suggests that attractive people are favoured in numerous situations" (a thing you would not have guessed without social science) and soon after we learn that attractive and physically fit men report going on more dates and having sex more frequently than others.</p>\r\n\r\n<p>But the conclusion of the paper, once one has weeded through, is striking and well documented. It is simply that short men make stable marriages. They do this in circumstances of difficulty and against the odds and consistently over ages and income groups, and they do it with the shorter women they often marry, but also with the taller women they sometimes land. Short men marry late but, once they do get married, tend to stay married longer and, by social science measures, at least - I assume this means they ask the short men's wives (I hope so anyway) - they stay happily married, too.</p>\r\n\r\n<h2 style="font-style:inherit"> </h2>\r\n\r\n<p> </p>\r\n\r\n<p>Many assertions about the assortative can be put forward to explain why this is so, but trust me, it is not hard to figure it out. There is a simple reason short men make stable marriages. It is because short men are desperate. Short men live in a world of taller men and know that any advantage seized is better kept. Desperation makes short men good husbands. We know the odds instinctively, and knowing that we have lucked out, intend to continue playing a good thing.</p>\r\n\r\n<p>It is not, I should rush to add, that short men are desperate to please. One of the most interesting findings of the study is that short men actually do less housework in a typical marriage than tall men do - though the study points out delicately, this may be because with tall men, "the nature of their housework is different".</p>\r\n\r\n<p>In other words, we are too short to reach the tops of closets where the heavy house cleaning equipment is kept. No, short men do not make stable marriages because they are desperate to please. It is because they are desperate to prevail.</p>\r\n\r\n<p>An instinctive sense of the odds, born in schoolyards and playgrounds, tells the short man to redouble his efforts in every area of life - the office, the motorway, (God forbid) the golf course.</p>\r\n\r\n<p>This is of course called the Napoleonic complex, but in truth it is not so much that short men become Napoleonic as that Napoleon was typically short - in his ambition, his drive, his uxorious devotion to his wife Josephine, whom he left only because he wanted to leave the French with a male heir. Hers was the last name on his lips, in the last sentences that he uttered, dreaming of that old stability.</p>\r\n\r\n<p><img alt="line" src="http://ichef.bbci.co.uk/news/625/media/images/74982000/jpg/_74982321_line976.jpg" style="height:auto; margin:0px; width:616.203125px" /></p>\r\n\r\n<h2>How tall was Napoleon?</h2>\r\n\r\n<p><img alt="Statue of Napoleon, Paris" src="http://ichef.bbci.co.uk/news/625/media/images/77984000/jpg/_77984282_napoleon-statue.jpg" style="height:auto; margin:0px; width:616.203125px" /></p>\r\n\r\n<p>Contemporary accounts state that Bonaparte's height was 5ft 2in, but at that time, the French measured 13 inches to the foot (Napoleon himself oversaw France's conversion to the metric system). Given this discrepancy, Napoleon's height would have been 67 inches, or 5ft 7in in modern measurements - about the same height as the current French president, <NAME>, and taller than his predecessor, <NAME>.</p>\r\n\r\n<p><img alt="line" src="http://ichef.bbci.co.uk/news/625/media/images/74982000/jpg/_74982321_line976.jpg" style="height:auto; margin:0px; width:616.203125px" /></p>\r\n\r\n<p>There is, I think, a broader moral here. In every area of life, we underrate the merits of desperation, and persistently overrate the advantages of free choice. We insist that we ought to all be equal, free to make the choices we want and find the partners we need.</p>\r\n\r\n<p>In fact, people who have this kind of freedom rarely use it well. Fashion models, free to choose, inevitably choose rock stars - and since rock stars, freed by their glamour to choose, invariably choose to take a lot of drugs and go on the road and smash up hotel rooms in preference to being in a stable relationship, the models are always badly disappointed by their choice. You see them crying on the shoulders of the short men - dipping their long swan-like necks way down to do so, perhaps, but there you are, they do. Frequent failure is the true price of free choice.</p>\r\n\r\n<p><img alt="John and <NAME>" src="http://ichef.bbci.co.uk/news/625/media/images/77987000/jpg/_77987374_john-and-sally-bercow.jpg" style="height:auto; margin:0px; width:616.203125px" /></p>\r\n\r\n<p>Speaker of the House of Commons, <NAME>, and his wife Sally</p>\r\n\r\n<p>If we look up - or rather down, even below the knees of the short, to the ground itself, we find this same truth embodied as an economic principle, where it is called the curse of resources. Countries with vast natural resources, such as oil and copper and gold, tend to do less well economically than countries that have none - the short people countries, in other words. This is because resources, easily found, are easily squandered.</p>\r\n\r\n<p>Countries and city-states with few or no resources - the short lands, one might call them - must rely on their ingenuity and effort, as Singapore and Switzerland do. They end up being more productive despite - indeed, because - they have so much less to work with. They have made, so to speak, stable marriages with the planet.</p>\r\n\r\n<p><img alt="<NAME>" src="http://ichef.bbci.co.uk/news/625/media/images/77984000/jpg/_77984280_angus.jpg" style="height:auto; margin:0px; width:616.203125px" /></p>\r\n\r\n<p> </p>\r\n\r\n<p>Well, what of short rock stars? I have been hearing you asking that question for the past two paragraphs. Don't they make unstable supermodel marriages? Isn't it really a question more of status than simple stature?</p>\r\n\r\n<p>Well, first of all - are there short rock stars? An online list of short rock stars turns up people like <NAME> of AC/DC and Flea - but surely these are 2nd or 3rd XI rock stars? A rock star nicknamed Sting is a rock star. A rock star nicknamed Flea is not really a rock star. <NAME>, yes, is certainly a star - but a rock star of a very self-consciously short kind, famous, as we all know, for wearing schoolboy outfits onstage.</p>\r\n\r\n<p>In this way indeed, short men (including short rock stars) in their desperation, shrewdly piggyback on one of the few human predispositions that I think can actually be called hardwired - what we might call the neotenic illusion.</p>\r\n\r\n<p>By this I mean our readiness to think that anything that has the short stature and plump cheeks and rounded body of a human baby must actually be like a human baby. If we did not think babies were hopelessly cute, after all, we would kill them for being so exhausting.</p>\r\n\r\n<p>And so panda bears and chipmunks, and short men too, have smuggled their way into our affections through the same cognitive door that was meant to open only for the infants. A typical penguin is as full of rage, violence and dignity as a tiger but they resemble our young, and so are pinned as adorable. They are classified as cute, as short men are, too.</p>\r\n\r\n<p><img alt="Penguins" src="http://ichef.bbci.co.uk/news/625/media/images/77984000/jpg/_77984281_penguins.jpg" style="height:auto; margin:0px; width:616.203125px" /></p>\r\n\r\n<p>Full of rage, violence and dignity</p>\r\n\r\n<p>But there is another, more easily overlooked truth that short people know that resource-short countries don't. The concept of shortness among men at least is surprisingly elastic. There is a period in the life of a short man - between his early adolescent unhappiness at being short, and his later awakening to the miracle of having achieved so much despite it - when his own shortness becomes invisible to him.</p>\r\n\r\n<p>With our suits hemmed and altered, the waist cinched in by a painfully sympathetic tailor, we give the same appearance, in a mirror at least, with no comparison (I almost wrote "no competition") around, of being about the same as anyone else.</p>\r\n\r\n<p>For the prime of a short man's life - Napoleon is the model here again - his shortness is not thematised at all. On horseback in the paintings by David or the Baron Gros, or enthroned by Ingres, Napoleon may look moon-faced, and the little ringlet that dangles above his eye may seem dandyish, but the last thing he looks is short.</p>\r\n\r\n<p>It is only later on Elba and <NAME> that his diminutive stature becomes part of his self-knowledge. The true Napoleonic moment is when age and circumstances conspire to remind the short man of his stature. It was when the emperor had lost the last battle that the truth returned. I am no longer an emperor. I am merely a short man on a lonely island.</p>\r\n\r\n<p><img alt="<NAME>" src="http://ichef.bbci.co.uk/news/625/media/images/77987000/jpg/_77987375_rod-stewart-and-penny-lanca.jpg" style="height:auto; margin:0px; width:616.203125px" /></p>\r\n\r\n<p><NAME></p>\r\n\r\n<p>So, short men learn early this essential truth - that long odds make for good lives. A man's mate should exceed his height, not to mention his little grasp, or what's a heaven for?</p>\r\n\r\n<p>It is not an accident, I think, that the great periods of civilisation tend to follow on and then appear not in moments of abundance alone, but of renewed relief.</p>\r\n\r\n<p>They come shortly after some disaster that has given an entire community the same sense of having made it by the skin of their teeth that a short man feels, looking gratefully at his wife in the early morning.</p>\r\n\r\n<p>Renaissance Florence appeared in the wake of the black plague that halved its population. The Paris we love most, that of the impressionists and the Belle Epoque, rose with the smouldering ruins of the Franco-Prussian war still visible in its centre.</p>\r\n\r\n<p>They were reduced - shortened, one might even say - but they clung to pleasure. Entitlement and its disappointments make wars. Desperation and gratitude build cities.</p>\r\n\r\n<p> </p>\r\n\r\n<p>Are you taller than your husband or shorter than your wife?</p>\r\n', 'A Point of View: Why short men make better husbands', 0, 1, '0'),
('<EMAIL>', '551395ba2c3bf', '2015-03-26', '06:14:34am', '<h1>True Love</h1>\r\n\r\n<p><img alt="Couple Dancing " src="http://s.ngm.com/2006/02/true-love/img/couple-dancing-615.jpg" /></p>\r\n\r\n<h2>Love</h2>\r\n\r\n<h3>Scientists say that the brain chemistry of infatuation is akin to mental illness—which gives new meaning to ‘madly in love’</h3>\r\n\r\n<p>By <NAME></p>\r\n\r\n<p>Photograph by <NAME></p>\r\n\r\n<p>My husband and I got married at eight in the morning. It was winter, freezing, the trees encased in ice and a few lone blackbirds balancing on telephone wires. We were in our early 30s, considered ourselves hip and cynical, the types who decried the institution of marriage even as we sought its status. During our wedding brunch we put out a big suggestion box and asked people to slip us advice on how to avoid divorce; we thought it was a funny, clear-eyed, grounded sort of thing to do, although the suggestions were mostly foolish: Screw the toothpaste cap on tight. After the guests left, the house got quiet. There were flowers everywhere: puckered red roses and fragile ferns. “What can we do that’s really romantic?” I asked my newly wed one. Benjamin suggested we take a bath. I didn’t want a bath. He suggested a lunch of chilled white wine and salmon. I was sick of salmon.</p>\r\n\r\n<p><em>What can we do that’s really romantic?</em> The wedding was over, the silence seemed suffocating, and I felt the familiar disappointment after a longed-for event has come and gone. We were married. Hip, hip, hooray. I decided to take a walk. I went into the center of town, pressed my nose against a bakery window, watched the man with flour on his hands, the dough as soft as skin, pushed and pulled and shaped at last into stars. I milled about in an antique store. At last I came to our town’s tattoo parlor. Now I am not a tattoo type person, but for some reason, on that cold silent Sunday, I decided to walk in. “Can I help you?” a woman asked.</p>\r\n\r\n<p>“Is there a kind of tattoo I can get that won’t be permanent?” I asked.</p>\r\n\r\n<p>“Henna tattoos,” she said.</p>\r\n\r\n<p>She explained that they lasted for six weeks, were used at Indian weddings, were stark and beautiful and all brown. She showed me pictures of Indian women with jewels in their noses, their arms scrolled and laced with the henna markings. Indeed they were beautiful, sharing none of the gaudy comic strip quality of the tattoos we see in the United States. These henna tattoos spoke of intricacy, of the webwork between two people, of ties that bind and how difficult it is to find their beginnings and their ends. And because I had just gotten married, and because I was feeling a post wedding letdown, and because I wanted something really romantic to sail me through the night, I decided to get one.</p>\r\n\r\n<p>“Where?” she asked.</p>\r\n\r\n<p>“Here,” I said. I laid my hands over my breasts and belly.</p>\r\n\r\n<p>She raised her eyebrows. “Sure,” she said.</p>\r\n\r\n<p>I am a modest person. But I took off my shirt, lay on the table, heard her in the back room mixing powders and paints. She came to me carrying a small black-bellied pot inside of which was a rich red mush, slightly glittering. She adorned me. She gave me vines and flowers. She turned my body into a stake supporting whole new gardens of growth, and then, low around my hips, she painted a delicate chain-linked chastity belt. An hour later, the paint dry, I put my clothes back on, went home to find my newly wed one. This, I knew, was my gift to him, the kind of present you offer only once in your lifetime. I let him undress me.</p>\r\n\r\n<p>“Wow,” he said, standing back.</p>\r\n\r\n<p>I blushed, and we began.</p>\r\n\r\n<p>We are no longer beginning, my husband and I. This does not surprise me. Even back then, wearing the decor of desire, the serpentining tattoos, I knew they would fade, their red-clay color bleaching out until they were gone. On my wedding day I didn’t care.</p>\r\n\r\n<p>I do now. Eight years later, pale as a pillowcase, here I sit, with all the extra pounds and baggage time brings. And the questions have only grown more insistent. Does passion necessarily diminish over time? How reliable is romantic love, really, as a means of choosing one’s mate? Can a marriage be good when Eros is replaced with friendship, or even economic partnership, two people bound by bank accounts?</p>\r\n\r\n<p>Let me be clear: I still love my husband. There is no man I desire more. But it’s hard to sustain romance in the crumb-filled quotidian that has become our lives. The ties that bind have been frayed by money and mortgages and children, those little imps who somehow manage to tighten the knot while weakening its actual fibers. Benjamin and I have no time for chilled white wine and salmon. The baths in our house always include Big Bird.</p>\r\n\r\n<p>If this all sounds miserable, it isn’t. My marriage is like a piece of comfortable clothing; even the arguments have a feel of fuzziness to them, something so familiar it can only be called home. And yet...</p>\r\n\r\n<p>In the Western world we have for centuries concocted poems and stories and plays about the cycles of love, the way it morphs and changes over time, the way passion grabs us by our flung-back throats and then leaves us for something saner. If <em>Dracula</em>—the frail woman, the sensuality of submission—reflects how we understand the passion of early romance, the <em>Flintstones</em> reflects our experiences of long-term love: All is gravel and somewhat silly, the song so familiar you can’t stop singing it, and when you do, the emptiness is almost unbearable.</p>\r\n\r\n<p>We have relied on stories to explain the complexities of love, tales of jealous gods and arrows. Now, however, these stories—so much a part of every civilization—may be changing as science steps in to explain what we have always felt to be myth, to be magic. For the first time, new research has begun to illuminate where love lies in the brain, the particulars of its chemical components.</p>\r\n\r\n<p>Anthropologist <NAME> may be the closest we’ve ever come to having a doyenne of desire. At 60 she exudes a sexy confidence, with corn-colored hair, soft as floss, and a willowy build. A professor at Rutgers University, she lives in New York City, her book-lined apartment near Central Park, with its green trees fluffed out in the summer season, its paths crowded with couples holding hands.</p>\r\n\r\n<p>Fisher has devoted much of her career to studying the biochemical pathways of love in all its manifestations: lust, romance, attachment, the way they wax and wane. One leg casually crossed over the other, ice clinking in her glass, she speaks with appealing frankness, discussing the ups and downs of love the way most people talk about real estate. “A woman unconsciously uses orgasms as a way of deciding whether or not a man is good for her. If he’s impatient and rough, and she doesn’t have the orgasm, she may instinctively feel he’s less likely to be a good husband and father. Scientists think the fickle female orgasm may have evolved to help women distinguish Mr. Right from Mr. Wrong.”</p>\r\n\r\n<p>One of Fisher’s central pursuits in the past decade has been looking at love, quite literally, with the aid of an MRI machine. Fisher and her colleagues <NAME> and <NAME> recruited subjects who had been “madly in love” for an average of seven months. Once inside the MRI machine, subjects were shown two photographs, one neutral, the other of their loved one.</p>\r\n\r\n<p>What Fisher saw fascinated her. When each subject looked at his or her loved one, the parts of the brain linked to reward and pleasure—the ventral tegmental area and the caudate nucleus—lit up. What excited Fisher most was not so much finding a location, an address, for love as tracing its specific chemical pathways. Love lights up the caudate nucleus because it is home to a dense spread of receptors for a neurotransmitter called dopamine, which Fisher came to think of as part of our own endogenous love potion. In the right proportions, dopamine creates intense energy, exhilaration, focused attention, and motivation to win rewards. It is why, when you are newly in love, you can stay up all night, watch the sun rise, run a race, ski fast down a slope ordinarily too steep for your skill. Love makes you bold, makes you bright, makes you run real risks, which you sometimes survive, and sometimes you don’t.</p>\r\n\r\n<p>I first fell in love when I was only 12, with a teacher. His name was Mr. McArthur, and he wore open-toed sandals and sported a beard. I had never had a male teacher before, and I thought it terribly exotic. Mr. McArthur did things no other teacher dared to do. He explained to us the physics of farting. He demonstrated how to make an egg explode. He smoked cigarettes at recess, leaning languidly against the side of the school building, the ash growing longer and longer until he casually tapped it off with his finger.</p>\r\n\r\n<p>What unique constellation of needs led me to love a man who made an egg explode is interesting, perhaps, but not as interesting, for me, as my memory of love’s sheer physical facts. I had never felt anything like it before. I could not get Mr. McArthur out of my mind. I was anxious; I gnawed at the lining of my cheek until I tasted the tang of blood. School became at once terrifying and exhilarating. Would I see him in the hallway? In the cafeteria? I hoped. But when my wishes were granted, and I got a glimpse of my man, it satisfied nothing; it only inflamed me all the more. Had he looked at me? Why had he not looked at me? When would I see him again? At home I looked him up in the phone book; I rang him, this in a time before caller ID. He answered.</p>\r\n\r\n<p>“Hello?” Pain in my heart, ripped down the middle. Hang up.</p>\r\n\r\n<p>Call back. “Hello?” I never said a thing.</p>\r\n\r\n<p> </p>\r\n\r\n<p>Once I called him at night, late, and from the way he answered the phone it was clear, even to a prepubescent like me, that he was with a woman. His voice fuzzy, the tinkle of her laughter in the background. I didn’t get out of bed for a whole day.</p>\r\n\r\n<p>Sound familiar? Maybe you were 30 when it happened to you, or 8 or 80 or 25. Maybe you lived in Kathmandu or Kentucky; age and geography are irrelevant. <NAME> is a professor of psychiatry at the University of Pisa in Italy who has studied the biochemistry of lovesickness. Having been in love twice herself and felt its awful power, Marazziti became interested in exploring the similarities between love and obsessive-compulsive disorder.</p>\r\n\r\n<p>She and her colleagues measured serotonin levels in the blood of 24 subjects who had fallen in love within the past six months and obsessed about this love object for at least four hours every day. Serotonin is, perhaps, our star neurotransmitter, altered by our star psychiatric medications: Prozac and Zoloft and Paxil, among others. Researchers have long hypothesized that people with obsessive-compulsive disorder (OCD) have a serotonin “imbalance.” Drugs like Prozac seem to alleviate OCD by increasing the amount of this neurotransmitter available at the juncture between neurons.</p>\r\n\r\n<p>Marazziti compared the lovers’ serotonin levels with those of a group of people suffering from OCD and another group who were free from both passion and mental illness. Levels of serotonin in both the obsessives’ blood and the lovers’ blood were 40 percent lower than those in her normal subjects. Translation: Love and obsessive-compulsive disorder could have a similar chemical profile. Translation: Love and mental illness may be difficult to tell apart. Translation: Don’t be a fool. Stay away.</p>\r\n\r\n<p>Of course that’s a mandate none of us can follow. We do fall in love, sometimes over and over again, subjecting ourselves, each time, to a very sick state of mind. There is hope, however, for those caught in the grip of runaway passion—Prozac. There’s nothing like that bicolored bullet for damping down the sex drive and making you feel “blah” about the buffet. <NAME> believes that the ingestion of drugs like Prozac jeopardizes one’s ability to fall in love—and stay in love. By dulling the keen edge of love and its associated libido, relationships go stale. Says Fisher, “I know of one couple on the edge of divorce. The wife was on an antidepressant. Then she went off it, started having orgasms once more, felt the renewal of sexual attraction for her husband, and they’re now in love all over again.”</p>\r\n\r\n<p>Psychoanalysts have concocted countless theories about why we fall in love with whom we do. Freud would have said your choice is influenced by the unrequited wish to bed your mother, if you’re a boy, or your father, if you’re a girl. Jung believed that passion is driven by some kind of collective unconscious. Today psychiatrists such as <NAME> from the University of California at San Francisco’s School of Medicine hypothesize that romantic love is rooted in our earliest infantile experiences with intimacy, how we felt at the breast, our mother’s face, these things of pure unconflicted comfort that get engraved in our brain and that we ceaselessly try to recapture as adults. According to this theory we love whom we love not so much because of the future we hope to build but because of the past we hope to reclaim. Love is reactive, not proactive, it arches us backward, which may be why a certain person just “feels right.” Or “feels familiar.” He or she is familiar. He or she has a certain look or smell or sound or touch that activates buried memories.</p>\r\n\r\n<p>When I first met my husband, I believed this psychological theory was more or less correct. My husband has red hair and a soft voice. A chemist, he is whimsical and odd. One day before we married he dunked a rose in liquid nitrogen so it froze, whereupon he flung it against the wall, spectacularly shattering it. That’s when I fell in love with him. My father, too, has red hair, a soft voice, and many eccentricities. He was prone to bursting into song, prompted by something we never saw.</p>\r\n\r\n<p>However, it turns out my theories about why I came to love my husband may be just so much hogwash. Evolutionary psychology has said good riddance to Freud and the Oedipal complex and all that other transcendent stuff and hello to simple survival skills. It hypothesizes that we tend to see as attractive, and thereby choose as mates, people who look healthy. And health, say these evolutionary psychologists, is manifested in a woman with a 70 percent waist-to-hip ratio and men with rugged features that suggest a strong supply of testosterone in their blood. Waist-to-hip ratio is important for the successful birth of a baby, and studies have shown this precise ratio signifies higher fertility. As for the rugged look, well, a man with a good dose of testosterone probably also has a strong immune system and so is more likely to give his partner healthy children.</p>\r\n\r\n<p>Perhaps our choice of mates is a simple matter of following our noses. <NAME> of the University of Lausanne in Switzerland did an interesting experiment with sweaty T-shirts. He asked 49 women to smell T-shirts previously worn by unidentified men with a variety of the genotypes that influence both body odor and immune systems. He then asked the women to rate which T-shirts smelled the best, which the worst. What Wedekind found was that women preferred the scent of a T-shirt worn by a man whose genotype was most different from hers, a genotype that, perhaps, is linked to an immune system that possesses something hers does not. In this way she increases the chance that her offspring will be robust.</p>\r\n\r\n<p>It all seems too good to be true, that we are so hardwired and yet unconscious of the wiring. Because no one to my knowledge has ever said, “I married him because of his B.O.” No. We say, “I married him (or her) because he’s intelligent, she’s beautiful, he’s witty, she’s compassionate.” But we may just be as deluded about love as we are when we’re <em>in</em> love. If it all comes down to a sniff test, then dogs definitely have the edge when it comes to choosing mates.</p>\r\n\r\n<p>Why doesn’t passionate love last? How is it possible to see a person as beautiful on Monday, and 364 days later, on another Monday, to see that beauty as bland? Surely the object of your affection could not have changed that much. She still has the same shaped eyes. Her voice has always had that husky sound, but now it grates on you—she sounds like she needs an antibiotic. Or maybe you’re the one who needs an antibiotic, because the partner you once loved and cherished and saw as though saturated with starlight now feels more like a low-level infection, tiring you, sapping all your strength.</p>\r\n\r\n<p>Studies around the world confirm that, indeed, passion usually ends. Its conclusion is as common as its initial flare. No wonder some cultures think selecting a lifelong mate based on something so fleeting is folly. <NAME> has suggested that relationships frequently break up after four years because that’s about how long it takes to raise a child through infancy. Passion, that wild, prismatic insane feeling, turns out to be practical after all. We not only need to copulate; we also need enough passion to start breeding, and then feelings of attachment take over as the partners bond to raise a helpless human infant. Once a baby is no longer nursing, the child can be left with sister, aunts, friends. Each parent is now free to meet another mate and have more children.</p>\r\n\r\n<p>Biologically speaking, the reasons romantic love fades may be found in the way our brains respond to the surge and pulse of dopamine that accompanies passion and makes us fly. Cocaine users describe the phenomenon of tolerance: The brain adapts to the excessive input of the drug. Perhaps the neurons become desensitized and need more and more to produce the high—to put out pixie dust, metaphorically speaking.</p>\r\n\r\n<p>Maybe it’s a good thing that romance fizzles. Would we have railroads, bridges, planes, faxes, vaccines, and television if we were all always besotted? In place of the ever evolving technology that has marked human culture from its earliest tool use, we would have instead only bonbons, bouquets, and birth control. More seriously, if the chemically altered state induced by romantic love is akin to a mental illness or a drug-induced euphoria, exposing yourself for too long could result in psychological damage. A good sex life can be as strong as Gorilla Glue, but who wants that stuff on your skin?</p>\r\n\r\n<p>Once upon a time, in India, a boy and a girl fell in love without their parents’ permission. They were from different castes, their relationship radical and unsanctioned. Picture it: the sparkling sari, the boy in white linen, the clandestine meetings on tiled terraces with a fat, white moon floating overhead. Who could deny these lovers their pleasure, or condemn the force of their attraction?</p>\r\n\r\n<p>Their parents could. In one recent incident a boy and girl from different castes were hanged at the hands of their parents as hundreds of villagers watched. A couple who eloped were stripped and beaten. Yet another couple committed suicide after their parents forbade them to marry.</p>\r\n\r\n<p>Anthropologists used to think that romance was a Western construct, a bourgeois by-product of the Middle Ages. Romance was for the sophisticated, took place in cafés, with coffees and Cabernets, or on silk sheets, or in rooms with a flickering fire. It was assumed that non-Westerners, with their broad familial and social obligations, were spread too thin for particular passions. How could a collectivist culture celebrate or in any way sanction the obsession with one individual that defines new love? Could a lice-ridden peasant really feel passion?</p>\r\n\r\n<p>Easily, as it turns out. Scientists now believe that romance is panhuman, embedded in our brains since Pleistocene times. In a study of 166 cultures, anthropologists <NAME> and <NAME> observed evidence of passionate love in 147 of them. In another study men and women from Europe, Japan, and the Philippines were asked to fill out a survey to measure their experiences of passionate love. All three groups professed feeling passion with the same searing intensity.</p>\r\n\r\n<p>But though romantic love may be universal, its cultural expression is not. To the Fulbe tribe of northern Cameroon, poise matters more than passion. Men who spend too much time with their wives are taunted, and those who are weak-kneed are thought to have fallen under a dangerous spell. Love may be inevitable, but for the Fulbe its manifestations are shameful, equated with sickness and social impairment.</p>\r\n\r\n<p>In India romantic love has traditionally been seen as dangerous, a threat to a well-crafted caste system in which marriages are arranged as a means of preserving lineage and bloodlines. Thus the gruesome tales, the warnings embedded in fables about what happens when one’s wayward impulses take over.</p>\r\n\r\n<p>Today love marriages appear to be on the rise in India, often in defiance of parents’ wishes. The triumph of romantic love is celebrated in Bollywood films. Yet most Indians still believe arranged marriages are more likely to succeed than love marriages. In one survey of Indian college students, 76 percent said they’d marry someone with all the right qualities even if they weren’t in love with the person (compared with only 14 percent of Americans). Marriage is considered too important a step to leave to chance.</p>\r\n\r\n<p><NAME> is a striking 45-year-old woman who lives in Bangalore, India. When I meet her, she is dressed in Western-style clothes —black leggings and a T-shirt. Renu lives in a well-appointed apartment in this thronging city, where cows sleep on the highways as tiny cars whiz around them, plumes of black smoke rising from their sooty pipes.</p>\r\n\r\n<p>Renu was born into a traditional Indian family where an arranged marriage was expected. She was not an arranged kind of person, though, emerging from her earliest days as a fierce tennis player, too sweaty for saris, and smarter than many of the men around her. Nevertheless at the age of 17 she was married off to a first cousin, a man she barely knew, a man she wanted to learn to love, but couldn’t. Renu considers many arranged marriages to be acts of “state-sanctioned rape.”</p>\r\n\r\n<p>Renu hoped to fall in love with her husband, but the more years that passed, the less love she felt, until, at the end, she was shrunken, bitter, hiding behind the curtains of her in-laws’ bungalow, looking with longing at the couple on the balcony across from theirs. “It was so obvious to me that couple had married for love, and I envied them. I really did. It hurt me so much to see how they stood together, how they went shopping for bread and eggs.”</p>\r\n\r\n<p>Exhausted from being forced into confinement, from being swaddled in saris that made it difficult to move, from resisting the pressure to eat off her husband’s plate, Renu did what traditional Indian culture forbids one to do. She left. By this time she had had two children. She took them with her. In her mind was an old movie she’d seen on TV, a movie so strange and enticing to her, so utterly confounding and comforting at the same time, that she couldn’t get it out of her head. It was 1986. The movie was <em>Love Story</em>.</p>\r\n\r\n<p>“Before I saw movies like <em>Love Story</em>, I didn’t realize the power that love can have,” she says.</p>\r\n\r\n<p>Renu was lucky in the end. In Mumbai she met a man named Anil, and it was then, for the first time, that she felt passion. “When I first met Anil, it was like nothing I’d ever experienced. He was the first man I ever had an orgasm with. I was high, just high, all the time. And I knew it wouldn’t last, couldn’t last, and so that infused it with a sweet sense of longing, almost as though we were watching the end approach while we were also discovering each other.”</p>\r\n\r\n<p>When Renu speaks of the end, she does not, to be sure, mean the end of her relationship with Anil; she means the end of a certain stage. The two are still happily married, companionable, loving if not “in love,” with a playful black dachshund they bought together. Their relationship, once so full of fire, now seems to simmer along at an even temperature, enough to keep them well fed and warm. They are grateful.</p>\r\n\r\n<p>“Would I want all that passion back?” Renu asks. “Sometimes, yes. But to tell you the truth, it was exhausting.”</p>\r\n\r\n<p>From a physiological point of view, this couple has moved from the dopamine-drenched state of romantic love to the relative quiet of an oxytocin-induced attachment. Oxytocin is a hormone that promotes a feeling of connection, bonding. It is released when we hug our long-term spouses, or our children. It is released when a mother nurses her infant. Prairie voles, animals with high levels of oxytocin, mate for life. When scientists block oxytocin receptors in these rodents, the animals don’t form monogamous bonds and tend to roam. Some researchers speculate that autism, a disorder marked by a profound inability to forge and maintain social connections, is linked to an oxytocin deficiency. Scientists have been experimenting by treating autistic people with oxytocin, which in some cases has helped alleviate their symptoms.</p>\r\n\r\n<p>In long-term relationships that work—like Renu and Anil’s—oxytocin is believed to be abundant in both partners. In long-term relationships that never get off the ground, like Renu and her first husband’s, or that crumble once the high is gone, chances are the couple has not found a way to stimulate or sustain oxytocin production.</p>\r\n\r\n<p>“But there are things you can do to help it along,” says <NAME>. “Massage. Make love. These things trigger oxytocin and thus make you feel much closer to your partner.”</p>\r\n\r\n<p>Well, I suppose that’s good advice, but it’s based on the assumption that you still want to have sex with that boring windbag of a husband. Should you fake-it-till-you-make-it?</p>\r\n\r\n<p>“Yes,” says Fisher. “Assuming a fairly healthy relationship, if you have enough orgasms with your partner, you may become attached to him or her. You will stimulate oxytocin.”</p>\r\n\r\n<p>This may be true. But it sounds unpleasant. It’s exactly what your mother always said about vegetables: “Keep eating your peas. They are an acquired taste. Eventually, you will come to like them.”</p>\r\n\r\n<p>But I have never been a peas person.</p>\r\n\r\n<p>It’s 90 degrees on the day my husband and I depart, from Boston for New York City, to attend a kissing school. With two kids, two cats, two dogs, a lopsided house, and a questionable school system, we may know how to kiss, but in the rough and tumble of our harried lives we have indeed forgotten how to kiss.</p>\r\n\r\n<p>The sky is paved with clouds, the air as sticky as jam in our hands and on our necks. The Kissing School, run by <NAME>, a therapist from Seattle, is being held on the 12th floor of a run-down building in Manhattan. Inside, the room is whitewashed; a tiled table holds bottles of banana and apricot nectar, a pot of green tea, breath mints, and Chapstick. The other Kissing School students—sometimes they come from as far away as Vietnam and Nigeria—are sprawled happily on the bare floor, pillows and blankets beneath them. The class will be seven hours long.</p>\r\n\r\n<p>Byrd starts us off with foot rubs. “In order to be a good kisser,” she says, “you need to learn how to do the foreplay before the kissing.” Foreplay involves rubbing my husband’s smelly feet, but that is not as bad as when he has to rub mine. Right before we left the house, I accidentally stepped on a diaper the dog had gotten into, and although I washed, I now wonder how well.</p>\r\n\r\n<p>“Inhale,” Byrd says, and shows us how to draw in air.</p>\r\n\r\n<p>“Exhale,” she says, and then she jabs my husband in the back. “Don’t focus on the toes so much,” she says. “Move on to the calf.”</p>\r\n\r\n<p>Byrd tells us other things about the art of kissing. She describes the movement of energy through various chakras, the manifestation of emotion in the lips; she describes the importance of embracing all your senses, how to make eye contact as a prelude, how to whisper just the right way. Many hours go by. My cell phone rings. It’s our babysitter. Our one-year-old has a high fever. We must cut the long lesson short. We rush out. Later on, at home, I tell my friends what we learned at Kissing School: We don’t have time to kiss.</p>\r\n\r\n<p>A perfectly typical marriage. Love in the Western world.</p>\r\n\r\n<p>Luckily I’ve learned of other options for restarting love. <NAME>, a psychologist at Stony Brook University in New York, conducted an experiment that illuminates some of the mechanisms by which people become and stay attracted. He recruited a group of men and women and put opposite sex pairs in rooms together, instructing each pair to perform a series of tasks, which included telling each other personal details about themselves. He then asked each couple to stare into each other’s eyes for two minutes. After this encounter, Aron found most of the couples, previously strangers to each other, reported feelings of attraction. In fact, one couple went on to marry.</p>\r\n\r\n<p>Fisher says this exercise works wonders for some couples. Aron and Fisher also suggest doing novel things together, because novelty triggers dopamine in the brain, which can stimulate feelings of attraction. In other words, if your heart flutters in his presence, you might decide it’s not because you’re anxious but because you love him. Carrying this a step further, Aron and others have found that even if you just jog in place and then meet someone, you’re more likely to think they’re attractive. So first dates that involve a nerve-racking activity, like riding a roller coaster, are more likely to lead to second and third dates. That’s a strategy worthy of posting on Match.com. Play some squash. And in times of stress—natural disasters, blackouts, predators on the prowl—lock up tight and hold your partner.</p>\r\n\r\n<p>In Somerville, Massachusetts, where I live with my husband, our predators are primarily mosquitoes. That needn’t stop us from trying to enter the windows of each other’s soul.</p>\r\n\r\n<p>When I propose this to Benjamin, he raises an eyebrow.</p>\r\n\r\n<p>“Why don’t we just go out for Cambodian food?” he says.</p>\r\n\r\n<p>“Because that’s not how the experiment happened.”</p>\r\n\r\n<p>As a scientist, my husband is always up for an experiment. But our lives are so busy that, in order to do this, we have to make a plan. We will meet next Wednesday at lunchtime and try the experiment in our car.</p>\r\n\r\n<p>On the Tuesday night before our rendezvous, I have to make an unplanned trip to New York. My husband is more than happy to forget our date. I, however, am not. That night, from my hotel room, I call him.</p>\r\n\r\n<p>“We can do it on the phone,” I say.</p>\r\n\r\n<p>“What am I supposed to stare into?” he asks. “The keypad?”</p>\r\n\r\n<p>“There’s a picture of me hanging in the hall. Look at that for two minutes. I’ll look at a picture I have of you in my wallet.”</p>\r\n\r\n<p>“Come on,” he says.</p>\r\n\r\n<p>“Be a sport,” I say. “It’s better than nothing.”</p>\r\n\r\n<p>Maybe not. Two minutes seems like a long time to stare at someone’s picture with a receiver pressed to your ear. My husband sneezes, and I try to imagine his picture sneezing right along with him, and this makes me laugh.</p>\r\n\r\n<p>Another 15 seconds pass, slowly, each second stretched to its limit so I can almost hear time, feel time, its taffy-like texture, the pop it makes when it’s done. Pop pop pop. I stare and stare at my husband’s picture. It doesn’t produce any sense of startling intimacy, and I feel defeated.</p>\r\n\r\n<p>Still, I keep on. I can hear him breathing on the other end. The photograph before me was taken a year or so ago, cut to fit my wallet, his strawberry blond hair pulled back in a ponytail. I have never really studied it before. And I realize that in this picture my husband is not looking straight back at me, but his pale blue eyes are cast sideways, off to the left, looking at something I can’t see. I touch his eyes. I peer close, and then still closer, at his averted face. Is there something sad in his expression, something sad in the way he gazes off?</p>\r\n\r\n<p>I look toward the side of the photo, to find what it is he’s looking at, and then I see it: a tiny turtle coming toward him. Now I remember how he caught it after the camera snapped, how he held it gently in his hands, showed it to our kids, stroked its shell, his forefinger moving over the scaly dome, how he held the animal out toward me, a love offering. I took it, and together we sent it back to the sea.</p>\r\n', 'True Love', 1, 1, '0');
INSERT INTO `articles` (`email`, `id`, `date`, `time`, `article`, `title`, `star`, `share`, `nick`) VALUES
('<EMAIL>', '551395e3ce21e', '2015-03-26', '06:15:15am', '<p>By <NAME></p>\r\n\r\n<p> </p>\r\n\r\n<p>Why do fools fall in love? And when we do fall, why do our faculties of reason--and decency and self-respect and even right and wrong--sometimes not come along? For that matter, why would anyone reciprocate the love of a partner who has come so romantically unhinged?</p>\r\n\r\n<p>The thought of a loved one can turn our wits upside down, ratchet up our heart rate, impel us to slay dragons and write corny songs. We may become morose, obsessive, even violent. Lovesickness has been blamed on the moon, on the devil, but whatever is behind it, it doesn't look like the behavior of a rational animal trying to survive and reproduce. But might there be a method to this amorous madness?</p>\r\n\r\n<p>During the decades that the concept of human nature was taboo in academia, many scholars claimed that romantic love was a recent social construction. It was an invention of the Hallmark-card poets or Hollywood scriptwriters or, in one theory, medieval troubadours extolling the adulterous love of a knight for a lady.</p>\r\n\r\n<p>For anyone who has been under love's spell, these theories seem preposterous, and so they are. Nothing so primal could have been created out of thin air as a mere custom or product. To the contrary, romantic love is a human universal. In 1896 a Kwakiutl Indian in southern Alaska wrote the lament "Fire runs through my body--the pain of loving you," which could be the title of a bad power ballad today. Similar outpourings of passion can be found all over the world from those with broken hearts.</p>\r\n\r\n<p>Romantic infatuation is different from both raw lust and the enduring commitment that keeps lovers together long after their besottedness has faded. We all know the symptoms: idealized thoughts of the loved one; swings of mood from ecstasy to despair, insomnia and anorexia; and the intense need for signs of reciprocation. Even the brain chemistry is different: lust is fueled (in both sexes) by testosterone, and companionate love by vasopressin and oxytocin. Romantic passion taps the same dopamine system that is engaged by other obsessive drives like drug addiction.</p>\r\n\r\n<p>For all this, there may be a paradoxical logic to romantic love. Imagine a world without it, a world of rational shoppers looking for the best available mate. Unsentimental social scientists and veterans of the singles scene know that this world is not entirely unlike our own. People shop for the most desirable person who will accept them, and that is why most marriages pair a bride and a groom of roughly equal desirability. The 10s marry the 10s, the 9s marry the 9s and so on. That is exactly what should happen in a marketplace where you want the best price you can get (the other person) for the goods you're offering (you).</p>\r\n\r\n<p>But we also know this isn't the whole picture. Most daters find themselves at some point with a match who ought to be perfect but with whom for some reason the chemistry isn't there. Why do the principles of smart shopping give us only the rough statistics of mate choice, not the final pick?</p>\r\n\r\n<p>The reason is that smart shopping isn't enough; both parties have to close the deal. Somewhere in this world lives the best-looking, richest, smartest person who would settle for you. But this ideal match is hard to find, and you may die single if you insist on waiting for such a mate to show up. So you choose to set up house with the best person you have found so far.</p>\r\n\r\n<p>Your mate has gone through the same reasoning, which leaves you both vulnerable. The law of averages says that someday one of you will meet an even more desirable person; maybe a newly single <NAME> or <NAME> will move in next door. If you are always going for the best you can get, at that point you will dump your partner pronto. But your partner would have invested time, child rearing and forgone opportunities in the relationship by that point. Anticipating this, your mate would have been foolish to enter the relationship in the first place, and the same is true for you. In this world of rational actors, neither of you could thus take the chance on the other. What could make you trust the other person enough to make that leap?</p>\r\n\r\n<p>One answer is, Don't accept a partner who wanted you for rational reasons to begin with. Look for someone who is emotionally committed to you because you are you. If the emotion moving that person is not triggered by your objective mate value, that emotion will not be alienated by someone who comes along with greater mate value than yours. And there should be signals that the emotion is not faked, showing that the person's behavior is under the control of the involuntary parts of the brain--the ones in charge of heart rate, breathing, skin flushing and so on. Does this emotion sound familiar?</p>\r\n\r\n<p>This explanation of infatuation was devised by the economist <NAME> on the basis of the work of Nobel laureate Thomas Schelling. Social life is a series of promises, threats and bargains; in those games it sometimes pays to sacrifice your self-interest and control. An eco-protester who handcuffs himself to a tree guarantees that his threat to impede the logger is credible. The prospective home buyer who makes an unrecoverable deposit guarantees that her promise to buy the house is credible. And suitors who are uncontrollably smitten are in effect guaranteeing that their pledge of love is credible.</p>\r\n\r\n<p>And this gets us to the dark side of romance. Threats, no less than promises, must be backed up by signs of commitment. A desperate lover in danger of being abandoned may resort to threatening his wife or girlfriend (yes, his; it's usually a man). The best way to prevent her from calling his bluff is in fact not to bluff--to be the kind of hothead who is crazy enough to do it. Of course, if he does make good on the threat, everyone loses (which is why the judicial system must make good on its threat to punish violent thugs).</p>\r\n\r\n<p>This perverse logic of promises and threats lies behind the observation on romance offered by <NAME>: "When we want to read of the deeds that are done for love, whither do we turn? To the murder column."</p>\r\n\r\n<p>Pinker is the Johnstone Professor of Psychology at Harvard University and the author, most recently, of The Stuff of Thought: Language as a Window into Human Nature</p>\r\n', 'Crazy Love', 1, 1, '0'),
('<EMAIL>', '5513964c67a84', '2015-03-26', '06:17:00am', '<p>HOW ONLINE ROMANCE IS THREATENING MONOGAMY</p>\r\n\r\n<p>By <NAME></p>\r\n\r\n<p>After going to college on the East Coast and spending a few years bouncing around, Jacob moved back to his native Oregon, settling in Portland. Almost immediately, he was surprised by the difficulty he had meeting women. Having lived in New York and the Boston area, he was accustomed to ready-made social scenes. In Portland, by contrast, most of his friends were in long-term relationships with people they’d met in college, and were contemplating marriage.</p>\r\n\r\n<p>Jacob was single for two years and then, at 26, began dating a slightly older woman who soon moved in with him. She seemed independent and low-maintenance, important traits for Jacob. Past girlfriends had complained about his lifestyle, which emphasized watching sports and going to concerts and bars. He’d been called lazy, aimless, and irresponsible with money.</p>\r\n\r\n<p> </p>\r\n\r\n<p>Before long, his new relationship fell into that familiar pattern. “I’ve never been able to make a girl feel like she was the most important thing in my life,” he says. “It’s always ‘I wish I was as important as the basketball game or the concert.’ ” An only child, Jacob tended to make plans by negotiation: if his girlfriend would watch the game with him, he’d go hiking with her. He was passive in their arguments, hoping to avoid confrontation. Whatever the flaws in their relationship, he told himself, being with her was better than being single in Portland again.</p>\r\n\r\n<p>After five years, she left.</p>\r\n\r\n<p>Now in his early 30s, Jacob felt he had no idea how to make a relationship work. Was compatibility something that could be learned? Would permanence simply happen, or would he have to choose it? Around this time, he signed up for two online dating sites: Match.com, a paid site, because he’d seen the TV ads; and Plenty of Fish, a free site he’d heard about around town.</p>\r\n\r\n<p>“It was fairly incredible,” Jacob remembers. “I’m an average-looking guy. All of a sudden I was going out with one or two very pretty, ambitious women a week. At first I just thought it was some kind of weird lucky streak.”</p>\r\n\r\n<p>After six weeks, Jacob met a 22-year-old named Rachel, whose youth and good looks he says reinvigorated him. His friends were jealous. Was this The One? They dated for a few months, and then she moved in. (Both names have been changed for anonymity.)</p>\r\n\r\n<p>Rachel didn’t mind Jacob’s sports addiction, and enjoyed going to concerts with him. But there were other issues. She was from a blue-collar military background; he came from doctors. She placed a high value on things he didn’t think much about: a solid credit score, a 40-hour workweek. Jacob also felt pressure from his parents, who were getting anxious to see him paired off for good. Although a younger girlfriend bought him some time, biologically speaking, it also alienated him from his friends, who could understand the physical attraction but couldn’t really relate to Rachel.</p>\r\n\r\n<p>In the past, Jacob had always been the kind of guy who didn’t break up well. His relationships tended to drag on. His desire to be with someone, to not have to go looking again, had always trumped whatever doubts he’d had about the person he was with. But something was different this time. “I feel like I underwent a fairly radical change thanks to online dating,” Jacob says. “I went from being someone who thought of finding someone as this monumental challenge, to being much more relaxed and confident about it. Rachel was young and beautiful, and I’d found her after signing up on a couple dating sites and dating just a few people.” Having met Rachel so easily online, he felt confident that, if he became single again, he could always meet someone else.</p>\r\n\r\n<p>After two years, when Rachel informed Jacob that she was moving out, he logged on to Match.com the same day. His old profile was still up. Messages had even come in from people who couldn’t tell he was no longer active. The site had improved in the two years he’d been away. It was sleeker, faster, more efficient. And the population of online daters in Portland seemed to have tripled. He’d never imagined that so many single people were out there.</p>\r\n\r\n<p>“I’m about 95 percent certain,” he says, “that if I’d met Rachel offline, and if I’d never done online dating, I would’ve married her. At that point in my life, I would’ve overlooked everything else and done whatever it took to make things work. Did online dating change my perception of permanence? No doubt. When I sensed the breakup coming, I was okay with it. It didn’t seem like there was going to be much of a mourning period, where you stare at your wall thinking you’re destined to be alone and all that. I was eager to see what else was out there.”</p>\r\n\r\n<p>The positive aspects of online dating are clear: the Internet makes it easier for single people to meet other single people with whom they might be compatible, raising the bar for what they consider a good relationship. But what if online dating makes it <em>too</em> easy to meet someone new? What if it raises the bar for a good relationship <em>too</em> high? What if the prospect of finding an ever-more-compatible mate with the click of a mouse means a future of relationship instability, in which we keep chasing the elusive rabbit around the dating track?</p>\r\n\r\n<p>Of course, no one knows exactly how many partnerships are undermined by the allure of the Internet dating pool. But most of the online-dating-company executives I interviewed while writing my new book, <em>Love in the Time of Algorithms</em>, agreed with what research appears to suggest: the rise of online dating will mean an overall decrease in commitment.</p>\r\n\r\n<p>“The future will see better relationships but more divorce,” predicts <NAME>, the founder of a free dating site based in the U.K. “The older you get as a man, the more experienced you get. You know what to do with women, how to treat them and talk to them. Add to that the effect of online dating.” He continued, “I often wonder whether matching you up with great people is getting so efficient, and the process so enjoyable, that marriage will become obsolete.”</p>\r\n\r\n<p>“Historically,” says <NAME>, the CEO of Match.com’s parent company, “relationships have been billed as ‘hard’ because, historically, commitment has been the goal. You could say online dating is simply changing people’s ideas about whether commitment itself is a life value.” Mate scarcity also plays an important role in people’s relationship decisions. “Look, if I lived in Iowa, I’d be married with four children by now,” says Blatt, a 40‑something bachelor in Manhattan. “That’s just how it is.”</p>\r\n\r\n<p>Another online-dating exec hypothesized an inverse correlation between commitment and the efficiency of technology. “I think divorce rates will increase as life in general becomes more real-time,” says Niccolò Formai, the head of social-media marketing at Badoo, a meeting-and-dating app with about 25 million active users worldwide. “Think about the evolution of other kinds of content on the Web—stock quotes, news. The goal has always been to make it faster. The same thing will happen with meeting. It’s exhilarating to connect with new people, not to mention beneficial for reasons having nothing to do with romance. You network for a job. You find a flatmate. Over time you’ll expect that constant flow. People always said that the need for stability would keep commitment alive. But that thinking was based on a world in which you didn’t meet that many people.”</p>\r\n\r\n<p>“Societal values always lose out,” says <NAME>, the founder of <NAME>, which calls itself “the world’s leading married dating service for discreet encounters”—that is, cheating. “Premarital sex used to be taboo,” explains Biderman. “So women would become miserable in marriages, because they wouldn’t know any better. But today, more people have had failed relationships, recovered, moved on, and found happiness. They realize that that happiness, in many ways, depends on having had the failures. As we become more secure and confident in our ability to find someone else, usually someone better, monogamy and the old thinking about commitment will be challenged very harshly.”</p>\r\n\r\n<p>Even at eHarmony—one of the most conservative sites, where marriage and commitment seem to be the only acceptable goals of dating—<NAME>, the site’s relationship psychologist, acknowledges that commitment is at odds with technology. “You could say online dating allows people to get into relationships, learn things, and ultimately make a better selection,” says Gonzaga. “But you could also easily see a world in which online dating leads to people leaving relationships the moment they’re not working—an overall weakening of commitment.”</p>\r\n\r\n<p>Indeed, the profit models of many online-dating sites are at cross-purposes with clients who are trying to develop long-term commitments. A permanently paired-off dater, after all, means a lost revenue stream. Explaining the mentality of a typical dating-site executive, <NAME>, a dating entrepreneur based in San Francisco, puts the matter bluntly: “They’re thinking, <em>Let’s keep this fucker coming back to the site as often as we can</em>.” For instance, long after their accounts become inactive on Match.com and some other sites, lapsed users receive notifications informing them that wonderful people are browsing their profiles and are eager to chat. “Most of our users are return customers,” says Match.com’s Blatt.</p>\r\n\r\n<p>In 2011, <NAME>, a consultant to online-dating companies, published the results of an industry survey titled “How Has Internet Dating Changed Society?” The survey responses, from 39 executives, produced the following conclusions:</p>\r\n\r\n<p>“Internet dating has made people more disposable.”</p>\r\n\r\n<p>“Internet dating may be partly responsible for a rise in the divorce rates.”</p>\r\n\r\n<p>“Low quality, unhappy and unsatisfying marriages are being destroyed as people drift to Internet dating sites.”</p>\r\n\r\n<p>“The market is hugely more efficient … People expect to—and this will be increasingly the case over time—access people anywhere, anytime, based on complex search requests … Such a feeling of access affects our pursuit of love … the whole world (versus, say, the city we live in) will, increasingly, feel like the market for our partner(s). Our pickiness will probably increase.”</p>\r\n\r\n<p>“Above all, Internet dating has helped people of all ages realize that there’s no need to settle for a mediocre relationship.”</p>\r\n\r\n<p><NAME>, a co-founder of the dating site Zoosk, is the only executive I interviewed who disagrees with the prevailing view. “Online dating does nothing more than remove a barrier to meeting,” says Mehr. “Online dating doesn’t change my taste, or how I behave on a first date, or whether I’m going to be a good partner. It only changes the process of discovery. As for whether you’re the type of person who wants to commit to a long-term monogamous relationship or the type of person who wants to play the field, online dating has nothing to do with that. That’s a personality thing.”</p>\r\n\r\n<p>Surely personality will play a role in the way anyone behaves in the realm of online dating, particularly when it comes to commitment and promiscuity. (Gender, too, may play a role. Researchers are divided on the question of whether men pursue more “short-term mates” than women do.) At the same time, however, the reality that having too many options makes us less content with whatever option we choose is a well-documented phenomenon. In his 2004 book, <em>The Paradox of Choice</em>, the psychologist <NAME> indicts a society that “sanctifies freedom of choice so profoundly that the benefits of infinite options seem self-evident.” On the contrary, he argues, “a large array of options may diminish the attractiveness of what people <em>actually</em> choose, the reason being that thinking about the attractions of some of the unchosen options detracts from the pleasure derived from the chosen one.”</p>\r\n\r\n<p>Psychologists who study relationships say that three ingredients generally determine the strength of commitment: overall satisfaction with the relationship; the investment one has put into it (time and effort, shared experiences and emotions, etc.); and the quality of perceived alternatives. Two of the three—satisfaction and quality of alternatives—could be directly affected by the larger mating pool that the Internet offers.</p>\r\n\r\n<p>At the selection stage, researchers have seen that as the range of options grows larger, mate-seekers are liable to become “cognitively overwhelmed,” and deal with the overload by adopting lazy comparison strategies and examining fewer cues. As a result, they are more likely to make careless decisions than they would be if they had fewer options, and this potentially leads to less compatible matches. Moreover, the mere fact of having chosen someone from such a large set of options can lead to doubts about whether the choice was the “right” one. No studies in the romantic sphere have looked at precisely how the range of choices affects overall satisfaction. But research elsewhere has found that people are less satisfied when choosing from a larger group: in one study, for example, subjects who selected a chocolate from an array of six options believed it tasted better than those who selected the same chocolate from an array of 30.</p>\r\n\r\n<p>On that other determinant of commitment, the quality of perceived alternatives, the Internet’s potential effect is clearer still. Online dating is, at its core, a litany of alternatives. And evidence shows that the perception that one has appealing alternatives to a current romantic partner is a strong predictor of low commitment to that partner.</p>\r\n\r\n<p>“You can say three things,” says <NAME>, a professor of social psychology at Northwestern University who studies how online dating affects relationships. “First, the best marriages are probably unaffected. Happy couples won’t be hanging out on dating sites. Second, people who are in marriages that are either bad or average might be at increased risk of divorce, because of increased access to new partners. Third, it’s unknown whether that’s good or bad for society. On one hand, it’s good if fewer people feel like they’re stuck in relationships. On the other, evidence is pretty solid that having a stable romantic partner means all kinds of health and wellness benefits.” And that’s even before one takes into account the ancillary effects of such a decrease in commitment—on children, for example, or even society more broadly.</p>\r\n\r\n<p><NAME>, a divorce attorney and member of the American Academy of Matrimonial Lawyers, argues that the phenomenon extends beyond dating sites to the Internet more generally. “I’ve seen a dramatic increase in cases where something on the computer triggered the breakup,” he says. “People are more likely to leave relationships, because they’re emboldened by the knowledge that it’s no longer as hard as it was to meet new people. But whether it’s dating sites, social media, e‑mail—it’s all related to the fact that the Internet has made it possible for people to communicate and connect, anywhere in the world, in ways that have never before been seen.”</p>\r\n\r\n<p>Since Rachel left him, Jacob has met lots of women online. Some like going to basketball games and concerts with him. Others enjoy barhopping. Jacob’s favorite football team is the Green Bay Packers, and when I last spoke to him, he told me he’d had success using Packers fandom as a search criterion on OkCupid, another (free) dating site he’s been trying out.</p>\r\n\r\n<p>Many of Jacob’s relationships become physical very early. At one point he’s seeing a paralegal and a lawyer who work at the same law firm, a naturopath, a pharmacist, and a chef. He slept with three of them on the first or second date. His relationships with the other two are headed toward physical intimacy.</p>\r\n\r\n<p>He likes the pharmacist most. She’s a girlfriend prospect. The problem is that she wants to take things slow on the physical side. He worries that, with so many alternatives available, he won’t be willing to wait.</p>\r\n\r\n<p>One night the paralegal confides in him: her prior relationships haven’t gone well, but Jacob gives her hope; all she needs in a relationship is honesty. And he thinks, <em>Oh my God</em>. He wants to be a nice guy, but he knows that sooner or later he’s going to start coming across as a serious asshole. While out with one woman, he has to silence text messages coming in from others. He needs to start paring down the number of women he’s seeing.</p>\r\n\r\n<p>People seeking commitment—particularly women—have developed strategies to detect deception and guard against it. A woman might withhold sex so she can assess a man’s intentions. Theoretically, her withholding sends a message: <em>I’m not just going to sleep with any guy that comes along</em>. Theoretically, his willingness to wait sends a message back: <em>I’m interested in more than sex</em>.</p>\r\n\r\n<p>But the pace of technology is upending these rules and assumptions. Relationships that begin online, Jacob finds, move quickly. He chalks this up to a few things. First, familiarity is established during the messaging process, which also often involves a phone call. By the time two people meet face-to-face, they already have a level of intimacy. Second, if the woman is on a dating site, there’s a good chance she’s eager to connect. But for Jacob, the most crucial difference between online dating and meeting people in the “real” world is the sense of urgency. Occasionally, he has an acquaintance in common with a woman he meets online, but by and large she comes from a different social pool. “It’s not like we’re just going to run into each other again,” he says. “So you can’t afford to be too casual. It’s either ‘Let’s explore this’ or ‘See you later.’ ”</p>\r\n\r\n<p>Social scientists say that all sexual strategies carry costs, whether risk to reputation (promiscuity) or foreclosed alternatives (commitment). As online dating becomes increasingly pervasive, the old costs of a short-term mating strategy will give way to new ones. Jacob, for instance, notices he’s seeing his friends less often. Their wives get tired of befriending his latest girlfriend only to see her go when he moves on to someone else. Also, Jacob has noticed that, over time, he feels less excitement before each new date. “Is that about getting older,” he muses, “or about dating online?” How much of the enchantment associated with romantic love has to do with scarcity (<em>this person is exclusively for me</em>), and how will that enchantment hold up in a marketplace of abundance (<em>this person could be exclusively for me, but so could the other two people I’m meeting this week</em>)?</p>\r\n\r\n<p>Using OkCupid’s Locals app, Jacob can now advertise his location and desired activity and meet women on the fly. Out alone for a beer one night, he responds to the broadcast of a woman who’s at the bar across the street, looking for a karaoke partner. He joins her. They spend the evening together, and never speak again.</p>\r\n\r\n<p>“Each relationship is its own little education,” Jacob says. “You learn more about what works and what doesn’t, what you really need and what you can go without. That feels like a useful process. I’m not jumping into something with the wrong person, or committing to something too early, as I’ve done in the past.” But he does wonder: When does it end? At what point does this learning curve become an excuse for not putting in the effort to make a relationship last? “Maybe I have the confidence now to go after the person I really want,” he says. “But I’m worried that I’m making it so I can’t fall in love.”</p>\r\n', 'A Million First Dates', 1, 1, '0'),
('<EMAIL>', '55139796a3511', '2015-03-26', '06:22:30am', '<p>"Love yourself enough to say no to others' demands on your time and energy. Step back & reassess the situation" - Goddess Guidance<br />\r\n<br />\r\nOnce you have your mask on things get really exciting on the path. You are then able to help others, by put their masks on for them. You can guide other to the path; you can become their oxygen line. You can begin to bring them peace. No longer are you seen as selfish, your true nature is seen as a selfless, giving person.<br />\r\n<br />\r\nSo, what are your best interests? How do you base your actions, your goals, your time-management and your life on them - and how will this affect the people around you? We would suggest that acting consistently in your own best interests involves four areas:</p>\r\n\r\n<ul><br />\r\n <li>Meeting your physical needs, such as getting enough sleep and exercise</li>\r\n <br />\r\n <li>Meeting your emotional needs, such as asking for support when you need it</li>\r\n <br />\r\n <li>Meeting your mental needs, such as having a stimulating job</li>\r\n <br />\r\n <li>Meeting your spiritual needs, such as taking time to meditate or pray</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\n<strong>Physical needs</strong><br />\r\n<br />\r\nIf you're regularly exhausted because you never take time to eat a proper meal, get a good night's sleep, or get some exercise, then start making these things an absolute priority.<br />\r\n<br />\r\nDo you stay up late with your spouse, watching TV while slumped on the sofa half-asleep, because you think your partner will be offended if you go to bed alone? Do you have no time for your own breakfast because you're too busy preparing lunchboxes for your children?<br />\r\n<br />\r\nBeing well-rested, and taking care of your health, means that you'll have the energy you need to help those around you. If you feel constantly exhausted, you're likely to snap at your loved ones when you least mean to.<br />\r\n<br />\r\n<strong>Emotional needs</strong><br />\r\n<br />\r\nSome of us end up being the "support system" to whom friends and family come to with problems. It's a great privilege to be known as a good listener, but sometimes it's hard when you feel you need support - but you're worried about burdening people.<br />\r\n<br />\r\nAsk a good friend or a relative if you can have a chat with them. Explain that you're going through a difficult time, and it would help to have someone to talk to. They'll be more than glad to help, especially if it means they can return a favor that you've provided for them in the past.<br />\r\n<br />\r\nIf you don't reach out to other people when you're feeling sad, angry, low or lonely, you can end up turning to unhealthy sources of comfort. Whether it's supersized bars of candy, a bottle of vodka, or drugs, all of these will eventually be damaging to you and to those around you.<br />\r\n<br />\r\n<strong>Mental needs</strong><br />\r\n<br />\r\nWe all need to feel challenged and stimulated by our daily life. If you never learn anything new, never push yourself to think a bit harder, or never do anything that tests your limits - you'll probably end up feeling that life lacks meaning.<br />\r\n<br />\r\nOn the flip side, if you're completely out of your depth with a particular area of studying or work, you're unlikely to be unhappy, stressed and anxious.<br />\r\n<br />\r\n<strong>Spiritual needs</strong><br />\r\n<br />\r\nWhen life is busy, it's hard to take time for things which feel unproductive - like attending a religious service, meditating, taking a long bath, or praying. You might feel guilty about "sitting there doing nothing" if you're engaged in one of these activities.<br />\r\n<br />\r\nBut it's crucially important for us to find space and distance from day-to-day life, in order to take a fresh look at things. Some great thinkers have flashes of inspiration in the bath (Archimedes' Eureka moment comes to mind...). I'm sure that you've had your own experience that sometimes the solution to a tricky problem, or a new insight on life, comes when you're just relaxing.<br />\r\n<br />\r\nLetting yourself take the time you need, without feeling guilty, means that you'll be able to support your family and friends with your perspective on problems or situations that they might be in. You'll be in a better state to not only cope with, but excel in, your own life.<br />\r\n<br />\r\n<strong>Conclusion:</strong><br />\r\n<br />\r\nTo help others, you must help yourself first. If you try to help others initially, you will both remain unconscious and will not be able to guide them to the path. Sometimes what appears to the unskilled eye as a selfish gesture is really the most selfless gesture there is.</p>\r\n', 'Putting Yourself First!', 1, 1, '0'),
('sunnygkp10<EMAIL>', '5<PASSWORD>', '2015-03-26', '06:23:14am', '<p>How often have you been living life, happy and content, and then suddenly life slaps you in the face with something unexpected? We all have problems, and the truth of the matter is that problems will never go away. They will just change form.<br />\r\n<br />\r\nOne time you may be struggling with health, the next with money, and still the next with relationships. That is both the curse and blessing of life.<br />\r\n<br />\r\nHowever, you don't have to suffer because everything isn't perfect in your life.<br />\r\n<br />\r\n<strong>Behind the Scenes of Problems</strong><br />\r\n<br />\r\nNothing becomes a problem until you label it so. You've probably noticed that different people have different opinions of what problems are, and how much attention should be given to any one thing. This means that problems exist in our heads, and that we create them, define them, and fear them.<br />\r\n<br />\r\n<strong>The Most Overlooked Secret</strong><br />\r\n<br />\r\nThe secret to dealing with life's problems is to realize that they are illusions of our imagination. Sure, they feel very real.<br />\r\n<br />\r\nLet's say you're driving your car merrily down the highway, until someone cuts you off. You might fly off the handle, or you might not. It will depend on how you perceive the situation. It's an excellent example of how some people create something to complain about where others are completely fine.<br />\r\n<br />\r\nLife will always have "problems" and the way to deal with them is to let them be. You don't have to try to analyze, fantasize, or figure out your problems. Let them figure themselves out. The more you try, the more you fuel the problem, and the more miserable you become.<br />\r\n<br />\r\nThis doesn't mean you stop solving problems. It means you stop the compulsive worrying and fear-mongering inside your head.<br />\r\n<br />\r\n<strong>How to Stop the Compulsive Worrying</strong><br />\r\n<br />\r\nYou can stop the madness by simply staying present, and letting whatever happens be. This can be extremely hard if you bump into a problem that is important to you, but it is through those big problems that the biggest changes occur.<br />\r\n<br />\r\n<strong>Why is Life so Hard?</strong><br />\r\n<br />\r\nLife can seem tough from time to time, but it is through those tough times that you grow as a human being. It's uncomfortable, but that's life.<br />\r\n<br />\r\nIt's a rollercoaster with both highs and lows, which we all have to live through, so you might as well learn how to deal with the lows. The more comfortable you become with life's problems, the more you'll enjoy life's gifts.<br />\r\n<br />\r\n<strong>Conclusion</strong><br />\r\n<br />\r\nLife is what it is, and most of life's problems are created by us. The problems are events in our life, no one is denying that, but the extrapolation that we do freaks us out, and then we wonder why we feel so bad.<br />\r\n<br />\r\nIt's a life-long habit most of us have cultivated, which means we can change it. But change starts with awareness. Be kind to yourself, and enjoy both the highs and the lows.</p>\r\n', 'Dealing with Lifes Problems', 1, 1, '0'),
('<EMAIL>', '551397e6d9853', '2015-03-26', '06:23:50am', '<p>History abounds with tales of experts who were convinced that the ideas, plans, and projects of others could never be achieved. However, accomplishment came to those who said, "I can make it happen."<br />\r\n<br />\r\nThe Italian sculptor Agostino d'Antonio worked diligently on a large piece of marble. Unable to produce his desired masterpiece, he lamented, "I can do nothing with it." Other sculptors also worked this difficult piece of marble, but to no avail. Michelangelo discovered the stone and visualized the possibilities in it. His "I-can-make-it-happen" attitude resulted in one of the world's masterpieces - David.<br />\r\n<br />\r\nThe experts of Spain concluded that Columbus's plans to discover a new and shorter route to the West Indies was virtually impossible. Queen Isabella and King Ferdinand ignored the report of the experts. "I can make it happen," Columbus persisted. And he did. Everyone knew the world was flat, but not Columbus. The Nina, the Pinta, the Santa Maria, along with Columbus and his small band of followers, sailed to "impossible" new lands and thriving resources.<br />\r\n<br />\r\nEven the great Thomas <NAME> discouraged his friend, <NAME>, from pursuing his fledgling idea of a motorcar. Convinced of the worthlessness of the idea, Edison invited Ford to come and work for him. Ford remained committed and tirelessly pursued his dream. Although his first attempt resulted in a vehicle without reverse gear, <NAME> knew he could make it happen. And, of course, he did.<br />\r\n<br />\r\n"Forget it," the experts advised Mad<NAME>. They agreed radium was a scientifically impossible idea. However, <NAME> insisted, "I can make it happen."<br />\r\n<br />\r\nLet's not forget our friends Orville and <NAME>. Journalists, friends, armed forces specialists, and even their father laughed at the idea of an airplane. "What a silly and insane way to spend money. Leave flying to the birds," they jeered. "Sorry," the Wright brothers responded. "We have a dream, and we can make it happen." As a result, a place called Kitty Hawk, North Carolina, became the setting for the launching of their "ridiculous" idea.<br />\r\n<br />\r\nFinally, as you read these accounts under the magnificent lighting of your environment, consider the plight of <NAME>. He was admonished to stop the foolish experimenting with lighting. What an absurdity and waste of time! Why, nothing could outdo the fabulous oil lamp. Thank goodness Franklin knew he could make it happen. You too can make it happen!<br />\r\n<br />\r\n<strong>It Couldn't Be Done</strong><br />\r\n<br />\r\nSomebody said that it couldn't be done, But he with a chuckle replied That maybe it couldn't, but he would be one Who wouldn't say so "till he tried." So he buckled right in with the trace of a grin On his face. If he worried, he hid it. He started to sing as he tackled the thing That couldn't be done, and he did it. Somebody scoffed: "Oh, you'll never do that; At least no one ever has done it." But he took off his coat and took off his hat And the first thing he knew he'd begun it. With the lift of his chin and a bit of a grin, Without any doubting or quiddit, He started to sing as he tackled the thing That couldn't be done, and he did it. There are thousands to tell you it cannot be done. There are thousands to prophesy failure. There are thousands to point out to you, one by one, the dangers that wait to assail you. But just buckle right in with a bit of a grin, then take off your coat and go to it; just start in to sing as you tackle the thing that cannot be done, and you'll do it.<br />\r\n<br />\r\n<strong>From Candles to Soap</strong><br />\r\n<br />\r\nIn 1879, Procter and Gamble's best seller was candles. But the company was in trouble. <NAME> had invented the light bulb, and it looked as if candles would become obsolete. Their fears became reality when the market for candles plummeted since they were now sold only for special occasions.<br />\r\n<br />\r\nThe outlook appeared to be bleak for Procter and Gamble. However, at this time, it seemed that destiny played a dramatic part in pulling the struggling company from the clutches of bankruptcy. A forgetful employee at a small factory in Cincinnati forgot to turn off his machine when he went to lunch. The result? A frothing mass of lather filled with air bubbles. He almost threw the stuff away but instead decided to make it into soap. The soap floated. Thus, Ivory soap was born and became the mainstay of the Procter and Gamble Company.<br />\r\n<br />\r\nWhy was soap that floats such a hot item at that time? In Cincinnati, during that period, some people bathed in the Ohio River. Floating soap would never sink and consequently never got lost. So, Ivory soap became a best seller in Ohio and eventually across the country also.<br />\r\n<br />\r\nLike Procter and Gamble, never give up when things go wrong or when seemingly insinuations problems arise. Creativity put to work can change a problem and turn it into a gold mine.<br />\r\n<br />\r\n<strong>A Ten-Cent Idea</strong><br />\r\n<br />\r\nWhen young <NAME> was a store clerk, he tried to convince his boss to have a ten-cent sale to reduce inventory. The boss agreed, and the idea was a resounding success. This inspired Woolworth to open his own store and price items at a nickel and a dime. He needed capital for such a venture, so he asked his boss to supply the capital for part interest in the store. His boss turned him down flat. "The idea is too risky," he told Woolworth. "There are not enough items to sell for five and ten cents." Woolworth went ahead without his boss's backing, and he not only was successful in his first store, but eventually he owned a chain of <NAME> stores across the nation. Later, his former boss was heard to remark, "As far as I can figure out, every word I used to turn Woolworth down cost me about a million dollars."<br />\r\n<br />\r\n<strong>Time To Think</strong><br />\r\n<br />\r\n<NAME> hired an efficiency expert to go through his plant. He said, "Find the nonproductive people. Tell me who they are, and I will fire them!"<br />\r\n<br />\r\nThe expert made the rounds with his clipboard in hand and finally returned to Henry Ford's office with his report. "I've found a problem with one of your administrators," he said. "Every time I walked by, he was sitting with his feet propped up on the desk. The man never does a thing. I definitely think you should consider getting rid of him!" When <NAME> learned the name of the man the expert was referring to, Ford shook his head and said, "I can't fire him. I pay that man to do nothing but think - and that's what he's doing.<br />\r\n<br />\r\n<strong>Conclusion</strong><br />\r\n<br />\r\nIf an impulse comes to say some un-thoughtful word today that may drive a friend away, don't say it! If you've heard a word of blame cast upon your neighbor's name. That may injure his fair fame, don't tell it! If malicious gossip's tongue some vile slander may have flung on the head of old or young, don't repeat it! Thoughtful, kind, helpful speech," 'Tis a gift promised to each - this, lesson we would teach"!</p>\r\n', 'I Can Make It Happen', 0, 1, '0');
INSERT INTO `articles` (`email`, `id`, `date`, `time`, `article`, `title`, `star`, `share`, `nick`) VALUES
('<EMAIL>', '5513980deaa37', '2015-03-26', '06:24:29am', '<p>Regardless of whether we live in the US, India or anywhere else, family is the building block of any society, and our greatest fulfillment lies there. Of course, one needs to give due importance to work. But if any society works diligently in every other area but neglects the family, it would be the same as straightening deck chairs on the Titanic.<br />\r\n<br />\r\nWe all seek happiness but what most of us discover is that happiness is a home-made product. If you have strong and effective relationship with family members - whether living together or apart - the resultant good vibes and mental solace tend to overflow into all other aspects of life. When your family is heading in the right direction, you are better able to perform and focus at work. On the other hand, if things aren't going well at home, it is difficult to be deeply happy anywhere else. Thus, it is supremely important that at home, with your family, you concentrate on creating a beautiful family culture.<br />\r\n<br />\r\nMarriage is more than a contractual relationship - it is a promise from each individual to stay true to their love and commitment. While I can't tell you how to choose the right mate, I can advise you to determine what your values and principles are - and who might be a complimentary companion. Write a personal mission statement, outlining what is important to you, how you envision marriage and what family means to you. When the time is right, share this with your companion and encourage him/her to do the same.<br />\r\n<br />\r\nHappy marriages don't just happen - they are created with body, mind, heart and spirit. No one can afford to get lazy in their relationship with their spouse. It must be nurtured and tended to. And when it gets off the track, as all relationships tend to, from time to-time, we must correct our course and come back on track.<br />\r\n<br />\r\nYou will find that going back to your own mission statement can act as the guiding force that brings you back - because you will live according to what matters most to you.<br />\r\n<br />\r\nOne of the best ways of keeping a marriage and family effective and healthy is by living the "Seven Habits". These embody universal, timeless principles - they belong to you, to me and all the people in the world. They are not my creation. You already know these principles because you know them to be true and already exercise them to varying degrees. We have simply put a framework around principles and organized a systematic way of living them. Committing to these principles may help you strengthen your marriage and family ties. Here is a quick overview:<br />\r\n<br />\r\n<strong>Be proactive</strong><br />\r\n<br />\r\nThe power to make a difference in your family lies within you. The place to begin is not with other family members, but with yourself. You have the freedom to choose your actions and you have four unique endowments to guide your responses to people, situations and your environment:</p>\r\n\r\n<ul><br />\r\n <li>Self-awareness: Step outside of yourself and be aware of your motives, thoughts, feelings and you can decide what you need to change.</li>\r\n <br />\r\n <li>Imagination: You can envision what you can be and do.</li>\r\n <br />\r\n <li>Conscience: Listen to the inward voice that prompts you to do certain things. Develop it.</li>\r\n <br />\r\n <li>Independent will: You can choose what you desire to do, and you have the freedom and the power to do it. Begin with the end in mind.</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\nDecide what you desire for yourself and the culture you would like to develop with your family. This vision is more powerful than any problems you may have in the past or present. Write down your vision in a mission statement and clarify your values, and principles.<br />\r\n<br />\r\n<strong>Put first things first</strong><br />\r\n<br />\r\nOrganize your priorities according to what matters most to you - in alignment with what you envisioned in Habit 2.<br />\r\n<br />\r\nMake certain your family has four basic systems in place:</p>\r\n\r\n<ul><br />\r\n <li>Selecting goals and making family plans;</li>\r\n <br />\r\n <li>Teaching and training at home;</li>\r\n <br />\r\n <li>Communicating and solving problems together;</li>\r\n <br />\r\n <li>Completing tasks and disciplining within the family</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\n<br />\r\n<strong>Think win-win</strong><br />\r\n<br />\r\nWin-win is mutual benefit. Win-lose is authoritarian - "I", difficult decisions can be made but they are not implemented in a way that violates the larger context of thinking win-win. Thinking win-win is at the heart of an effective family culture.<br />\r\n<br />\r\n<strong>Understand, then be understood</strong><br />\r\n<br />\r\nSeek to understand what other family members feel or think - from their frame of reference - by listening with your ears, heart and mind. When you truly understand, then you can better explain your position or ideas. Listening and understanding is the catalyst that makes effectiveness possible.<br />\r\n<br />\r\n<strong>Synergize</strong><br />\r\n<br />\r\nCooperate and seek third alternatives that neither single family member could come up with on their own. Through a willingness to communicate, to understand and think win-win, family members can solve most difficult problems or create opportunities that could not have been achieved individually.<br />\r\n<br />\r\n<strong>Sharpen the saw</strong><br />\r\n<br />\r\nRenew yourself and your family by taking care of your physical, mental, social and spiritual needs. Do not neglect these important human needs, or you will eventually pay the price. A beautiful family culture can deteriorate unless the batteries that give it its power are continually re-charged.<br />\r\n<br />\r\nWhichever part of the Globe you live, always remember it is a beautiful nation with rich histories, traditions and legacy. Your families are at the heart of your nation - do not neglect your most precious resource. We know with great surety that living principle-centered lives promises to strengthen us individually, in our marriage, in our families, in our communities and places of work. Stay true to your path and remember what matters most to you.</p>\r\n', 'Happiness Is Homemade', 0, 1, '0'),
('<EMAIL>', '55139865abaa3', '2015-03-26', '06:25:57am', '<p>It seems the world is moving faster and faster these days. You constantly have information streaming to you from people in the office, meetings, email, voice messages, texts. You're trying to keep on top of it all and it can sometimes feel practically impossible.<br />\r\n<br />\r\nSo what do you do? Begin by determining what's really important to get done. Separate what's important from what's just urgent.<br />\r\n<br />\r\nDon't Get Caught in the "Urgency Trap"<br />\r\n<br />\r\nThe problem with all the technological resources we have for communication is that they are making everything seem urgent. It can be very tempting to get caught up in it and spend most of your day responding to email instead of focusing on what's really important.<br />\r\n<br />\r\nEvery activity has some degree of both importance and urgency. Generally items will fall into four categories:</p>\r\n\r\n<ul><br />\r\n <li>Crisis: Important and Urgent</li>\r\n <br />\r\n <li>Planning, Preparation and Prevention: Important but Not Urgent</li>\r\n <br />\r\n <li>Trivial Work: Urgent but Not Important</li>\r\n <br />\r\n <li>Time Wasters: Not Urgent and Not Important</li>\r\n <br />\r\n <li>Plan to Prevent Crisis from Occurring</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\n<br />\r\nIt's easy to believe everything is important. But, in reality, some things just are more important than others. If you tend to think everything is important, it will be very difficult to prioritize. If you find yourself living in the Crisis category most of the time, your productivity will weaken and you will quite simply just burn out. It's unsustainable. The only way out is to focus on what you can do to plan for, prepare and prevent the kinds of things that force you to operate in a crisis. When the crisis does occur, you'll be equipped to handle it and move on much more easily.<br />\r\n<br />\r\nThe next time you find yourself working late to meet a deadline, responding to an angry customer or co-worker, or rushing to solve a problem, really push yourself to come up with answers to some of these questions:</p>\r\n\r\n<ul><br />\r\n <li>"What could be done to prevent this from happening in the future?"</li>\r\n <br />\r\n <li>"What can I learn to make this easier next time?"</li>\r\n <br />\r\n <li>"Whose support or assistance needs to be involved?"</li>\r\n <br />\r\n <li>"What could occur in the future, and how can I anticipate it and plan to respond?"</li>\r\n <br />\r\n <li>Plan to Prevent Crisis from Occurring</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\n<br />\r\nWhen you answer those questions and take the necessary actions, you will be taking the actions that will help keep you out of the Crisis category for very long.<br />\r\n<br />\r\n<strong>Focus on What's Important</strong><br />\r\n<br />\r\nIt's important that you get in the habit of consistently identifying your most important activities and then implementing them as a priority. Other examples of things that are important but not Urgent include:</p>\r\n\r\n<ul><br />\r\n <li>Preparing for a meeting</li>\r\n <br />\r\n <li>Planning a presentation</li>\r\n <br />\r\n <li>Coaching and mentoring your staff</li>\r\n <br />\r\n <li>Anticipating customer needs or requests</li>\r\n <br />\r\n <li>Brainstorming ways to streamline internal processes</li>\r\n <br />\r\n <li>Identifying your most important activities to accomplish each year, month</li>\r\n <br />\r\n <li>Create a plan to identify your most important activities each week</li>\r\n <br />\r\n <li>Discussing your team's most important priorities to focus on</li>\r\n <br />\r\n <li>Prioritizing your daily to do list to focus on what's most important</li>\r\n <br />\r\n <li>Enhancing your own professional development</li>\r\n <br />\r\n <li>Become A Time Master</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\n<br />\r\nLook for all the resources at your disposal that will help you develop the habits to consistently focus on your key priorities. Talk with your manager and team members to identify your top priorities and most important activities. Look for books, e-learning courses and live online time management training classes that can help you. In the end, you'll find that you will develop the habits and skills to focus on your key priorities, accomplish greater results, reduce your stress and master the use of your time.</p>\r\n', 'Focus On Whats Most Important', 0, 1, '0'),
('<EMAIL>', '5513987d8f316', '2015-03-26', '06:26:21am', '<p>Do you reward yourself for your accomplishments?<br />\r\n<br />\r\nIt is important that we take the time to celebrate even our small victories.<br />\r\n<br />\r\nIt's time to take a step back and realize that instead of focusing on all that we're not getting done, we should be focusing on all that we are getting done. I call this the Celebrate the Small Victories approach. The intent is to give a little love to yourself for all of the hard work you put into each day. This will make for a much happier existence, boost your self-esteem by placing focus on the positive and likely make you even more productive and energetic as time goes on. You can't lose!<br />\r\n<br />\r\nBy marking these successes, we make them stick out in our minds. It forces us to acknowledge our progress and increases the likelihood we�ll repeat the positive behavior in the future.<br />\r\n<br />\r\nDid you have a good day at work today? Did you finish a noteworthy project or deliver a good presentation? Did you close a sale?<br />\r\n<br />\r\nFor stay-at-home moms, did you survive another day with a toddler? Did the kids get to and from school on time? Did you finish a household chore?<br />\r\n<br />\r\nWhatever your goals, be sure to recognize your victories. So, go ahead and treat yourself for all your victories, even the small ones!</p>\r\n\r\n<ul><br />\r\n <li>Buy yourself a banana split from your favorite ice cream store.</li>\r\n <br />\r\n <li>Give yourself permission to take a day off and relax.</li>\r\n <br />\r\n <li>Get a latte at a coffee shop.</li>\r\n <br />\r\n <li>Take an hour and listen to some of your favorite music.</li>\r\n <br />\r\n <li>Go to lunch with your best friend.</li>\r\n <br />\r\n <li>Buy yourself a new shirt.</li>\r\n <br />\r\n <li>Throw an impromptu dinner party.</li>\r\n <br />\r\n <li>Perform a random act of kindness.</li>\r\n <br />\r\n <li>Grill yourself a steak out on the barbeque.</li>\r\n <br />\r\n <li>Go for a walk in the woods.</li>\r\n <br />\r\n <li>Bake a pan of brownies and share them with friends.</li>\r\n <br />\r\n <li>Go on a date to that new restaurant you've been wanting to try.</li>\r\n <br />\r\n <li>Have a tall frozen margarita.</li>\r\n <br />\r\n <li>Eat a chocolate bar, preferably with almonds.</li>\r\n <br />\r\n <li>Call your parents and brag a little.</li>\r\n <br />\r\n <li>Race a go-kart for the thrill of it.</li>\r\n <br />\r\n <li>Spend a couple of hours alone in a beautiful place.</li>\r\n <br />\r\n <li>Meet someone new at a social gathering.</li>\r\n <br />\r\n <li>Take a weekend road trip.</li>\r\n <br />\r\n <li>Drink a large cherry limeade.</li>\r\n <br />\r\n <li>Get yourself an iPod.</li>\r\n <br />\r\n <li>Take a long nap.</li>\r\n <br />\r\n <li>Go see an inspiring movie.</li>\r\n <br />\r\n <li>Share a bottle of champagne with your spouse.</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\n<br />\r\nSmall victories are worth celebrating too!<br />\r\n<br />\r\nObviously, this is not an exhaustive list of ways to celebrate, but it should give you plenty of ideas for how to treat yourself. Making your victories special will make them memorable so, go ahead and pat yourself on the back once in awhile. You deserve it!</p>\r\n', 'Learn To Celebrate The Small Victories', 0, 1, '0'),
('<EMAIL>', '5<PASSWORD>e', '2015-03-26', '06:27:11am', '<p>What makes someone a successful entrepreneur?<br />\r\n<br />\r\nIt certainly helps to have strong technology skills or expertise in a key area, but these are not defining characteristics of entrepreneurship.<br />\r\n<br />\r\nInstead, the key qualities are traits such as creativity, the ability to keep going in the face of hardship, and the social skills needed to build great teams. If you want to start a business, it's essential to learn the specific skills that underpin these qualities. It's also important to develop entrepreneurial skills if you're in a job role where you're expected to develop a business, or "take things forward" more generally.<br />\r\n<br />\r\nIt's very easy to get lost trying to rate ourselves against our peers or even rate ourselves around society when it comes to success. Its actually depressing at times and inconclusive as you often get side tracked comparing apples to oranges. In our quest for success, we often look for some sort of ranking system to gauge how well we are doing and unfortunately decide to use others as the measure.<br />\r\n<br />\r\nIt is often an inaccurate scale as so many factors come into play, so many that it makes it unfair to compare yourself to others on any level. There are so many circumstances that dictate success it makes it impossible to find multiple people with identical circumstances to compare us to. Since we cannot compare ourselves to others, we must become our own competition and strive for perfection daily in order to move forward. We ultimately set the velocity at which we move. The results however are none that can be compared to others as every situation is as unique as the next.<br />\r\n<br />\r\nThe real point here is why do we worry about what others are doing if we ultimately shouldn't compare ourselves to them. The answer is jealousy and should end immediately. If you are someone that often finds yourself worrying about what others are doing, how they are doing it and where their wealth comes from, then start minding your own business and instead focus your energy on yourself and your work which is what will get you there, not finding out if your neighbor is in the Mafia or indeed a real estate guru. The best way to check if you are yourself is to ask yourself if you often form conclusions when faced with an individual who has attained a higher level of monetary success. Do you often find yourself guessing that perhaps this person was given wealth from past generations or that they are involved in negative activities that have led to financial success?<br />\r\n<br />\r\nOne should rather focus our energy and efforts on our own growth and not criticize others whose level of success is above ours. If you find yourself in such a negative position where a friend or relative seems to feel that way, then identify them as one whose lack of effort and lack of motivation is ultimately going to be the reason they fail, and separate yourself from that energy instantly.<br />\r\n<br />\r\n<br />\r\n<strong>Defining Entrepreneurship</strong><br />\r\n<br />\r\nSome experts think of entrepreneurs as people who are willing to take risks that other people are not. Others define them as people who start and build successful businesses.<br />\r\n<br />\r\nThinking about the first of these definitions, entrepreneurship doesn't necessarily involve starting your own business. Many people who don't work for themselves are recognized as entrepreneurs within their organizations.<br />\r\n<br />\r\nRegardless of how you define an "entrepreneur," one thing is certain: becoming a successful entrepreneur isn't easy.<br />\r\n<br />\r\nSo, how does one person successfully take advantage of an opportunity, while another, equally knowledgeable person does not? Do entrepreneurs have a different genetic makeup? Or do they operate from a different vantage point, that somehow directs their decisions for them?<br />\r\n<br />\r\nThough many researchers have studied the subject, there are no definitive answers. What we do know is that successful entrepreneurs seem to have certain traits in common.<br />\r\n<br />\r\nCheck for yourself if you have these traits:</p>\r\n\r\n<ul><br />\r\n <li>Interpersonal skills.</li>\r\n <br />\r\n <li>Critical and creative thinking skills.</li>\r\n <br />\r\n <li>Practical skills.</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\n<strong>Optimism:</strong> Are you an optimistic thinker? Optimism is truly an asset, and it will help get you through the tough times that many entrepreneurs experience as they find a business model that works for them.<br />\r\n<br />\r\n<strong>Vision:</strong> Can you easily see where things can be improved? Can you quickly grasp the "big picture," and explain this to others? And can you create a compelling vision of the future, and then inspire other people to engage with that vision?<br />\r\n<br />\r\n<strong>Initiative:</strong> Do you have initiative, and instinctively start problem-solving or business improvement projects?<br />\r\n<br />\r\n<strong>Desire for Control:</strong> Do you enjoy being in charge and making decisions? Are you motivated to lead others?<br />\r\n<br />\r\n<strong>Drive and Persistence:</strong> Are you self-motivated and energetic? And are you prepared to work hard, for a very long time, to realize your goals?<br />\r\n<br />\r\n<strong>Risk Tolerance:</strong> Are you able to take risks, and make decisions when facts are uncertain?<br />\r\n<br />\r\n<strong>Resilience:</strong> Are you resilient, so that you can pick yourself up when things don't go as planned? And do you learn and grow from your mistakes and failures? <br />\r\n<br />\r\n<br />\r\n<strong>Interpersonal Skills</strong><br />\r\n<br />\r\nAs a successful entrepreneur, you'll have to work closely with people - this is where it is critical to be able to build great relationships with your team, customers, suppliers, shareholders, investors, and more.<br />\r\n<br />\r\nSome people are more gifted in this area than others, but, fortunately, you can learn and improve these skills. The types of interpersonal skills you'll need include:<br />\r\n<br />\r\n<strong>Leadership and Motivation:</strong> Can you lead and motivate others to follow you and deliver your vision? And are you able to delegate work to others? As a successful entrepreneur, you'll have to depend on others to get beyond a very early stage in your business - there's just too much to do all on your own!<br />\r\n<br />\r\n<strong>Communication Skills:</strong> Are you competent with all types of communication? You need to be able to communicate well to sell your vision of the future to investors, potential clients, team members, and more.<br />\r\n<br />\r\n<strong>Listening:</strong> Do you hear what others are telling you? Your ability to listen can make or break you as an entrepreneur. Make sure that you're skilled at active listening and empathetic listening.<br />\r\n<br />\r\n<strong>Personal Relations:</strong> Are you emotionally intelligent? The higher your EI, the easier it will be for you to work with others. The good news is that you can improve your emotional intelligence!<br />\r\n<br />\r\n<strong>Negotiation:</strong> Are you a good negotiator? Not only do you need to negotiate keen prices, you also need to be able to resolve differences between people in a positive, mutually beneficial way.<br />\r\n<br />\r\n<strong>Ethics:</strong> Do you deal with people based on respect, integrity, fairness, and truthfulness? Can you lead ethically? You'll find it hard to build a happy, committed team if you deal with people - staff, customers or suppliers - in a shabby way.<br />\r\n<br />\r\n<br />\r\n<strong>Critical and Creative Thinking Skills</strong><br />\r\n<br />\r\nAs an entrepreneur, you also need to come up with fresh ideas, and make good decisions about opportunities and potential projects. Many people think that you're either born creative or you're not. However, creativity is a skill that you can develop if you invest the time and effort.<br />\r\n<br />\r\n<strong>Creative Thinking:</strong> Are you able to see situations from a variety of perspectives and come up with original ideas? (There are many creativity tools that will help you do this.)<br />\r\n<br />\r\n<strong>Problem Solving:</strong> How good are you at coming up with sound solutions to the problems you're facing? Tools such as Cause & Effect Analysis, the 5 Whys Technique, and CATWOE are just some of the problem-solving tools that you'll need to be familiar with.<br />\r\n<br />\r\n<strong>Recognizing Opportunities:</strong> Do you recognize opportunities when they present themselves? Can you spot a trend? And are you able to create a plan to take advantage of the opportunities you identify?<br />\r\n<br />\r\n<br />\r\n<strong>Practical Skills</strong><br />\r\n<br />\r\nYou also need the practical skills and knowledge needed to produce goods or services effectively, and run a company.<br />\r\n<br />\r\n<strong>Goal Setting:</strong> Do you regularly set goals, create a plan to achieve them, and then carry out that plan?<br />\r\n<br />\r\n<strong>Planning and Organizing:</strong> Do you have the talents, skills, and abilities necessary to achieve your goals? Can you coordinate people to achieve these efficiently and effectively. And do you know how to develop a coherent, well thought-through business plan, including developing and learning from appropriate financial forecasts?<br />\r\n<br />\r\n<strong>Decision Making:</strong> How good are you at making decisions? Do you make them based on relevant information and by weighing the potential consequences? And are you confident in the decisions that you make? Core decision-making tools include Decision Tree Analysis, Grid Analysis, and Six Thinking Hats.<br />\r\n<br />\r\nYou need knowledge in several areas when starting or running a business. For instance:<br />\r\n<br />\r\n<strong>Business knowledge:</strong> Do you have a good general knowledge of the main functional areas of a business (sales, marketing, finance, and operations), and are you able to operate or manage others in these areas with a reasonable degree of competence?<br />\r\n<br />\r\n<strong>Entrepreneurial knowledge:</strong> Do you understand how entrepreneurs raise capital? And do you understand the sheer amount of experimentation and hard work that may be needed to find a business model that works for you?<br />\r\n<br />\r\n<strong>Opportunity-specific knowledge:</strong> Do you understand the market you're attempting to enter, and do you know what you need to do to bring your product or service to market?<br />\r\n<br />\r\n<strong>Venture-specific knowledge:</strong> Do you know what you need to do to make this type of business successful? And do you understand the specifics of the business that you want to start?<br />\r\n<br />\r\n<br />\r\n<strong>Conclusion:</strong><br />\r\n<br />\r\nAs a dreamer, you need to understand its significance and mind your own business. Never lose track of your vision for your life. Do not ever get so busy making a living that you forget to live your life.</p>\r\n', 'Mind Your Own Business', 0, 1, '0'),
('<EMAIL>', '551398f4894ea', '2015-03-26', '06:28:20am', '<p>Positive thinking is a mental attitude that admits into the mind thoughts, words and images that are conductive to growth, expansion and success. It is a mental attitude that expects good and favorable results. A positive mind anticipates happiness, joy, health and a successful outcome of every situation and action. Whatever the mind expects, it finds.<br />\r\n<br />\r\nMany have heard it said that another person cannot make you happy. The happiness will come from within you. Being confident is a choice and it will produce positive emotions. There has been much research done on being in a positive state. It will produce a sense of well-being and has even proven to have multiple health benefits. Successful living today being positive will change your life.<br />\r\n<br />\r\nThe way that someone feels about themselves shows in the way they act. They always find funny things in everyday life that makes them and others happy. There is joy and cheerfulness that just rubs off on the people who are around them. The way they feel shows in their life because they are more relaxed and sleep better at night. They are not only physically assured but mentally as well. Most people have a spiritual connection that gives them the confident mindset in life.<br />\r\n<br />\r\nPeople who have a confident mindset take full advantage of their work force. They go in everyday with a smile on their face and the confidence that they have the ability to handle anything that comes their way. Their ability to take responsibility and not to blame others when something goes wrong shows that they have a handle on life. Negative emotions have no place with them on their way to success.<br />\r\n<br />\r\nConfidence is so much better than looking back and thinking of what could have been. Confident people are ones that you want to be around because they make the most of the present and look forward to the future. They are in awe of the beauty of nature and good things around them.<br />\r\n<br />\r\nThis behavior comes from choosing the atmosphere that one is around. It is best to surround yourself with assured people that are upbeat and thinking good thoughts. Try to avoid negative news and thinking on unpleasant things. This will be to your advantage in building the blocks in your life of thinking of good wholesome thoughts.<br />\r\n<br />\r\n<strong>Positive and negative thinking are both contagious.</strong><br />\r\n<br />\r\nAll of us affect, in one way or another, the people we meet. This happens instinctively and on a subconscious level, through thoughts and feelings transference, and through body language. People sense our aura and are affected by our thoughts, and vice versa. Is it any wonder that we want to be around positive people and avoid negative ones? People are more disposed to help us if we are positive, and they dislike and avoid anyone broadcasting negativity.<br />\r\n<br />\r\nNegative thoughts, words and attitude bring up negative and unhappy moods and actions. When the mind is negative, poisons are released into the blood, which cause more unhappiness and negativity. This is the way to failure, frustration and disappointment.<br />\r\n<br />\r\n<strong>Becoming a Positive Example to All</strong><br />\r\n<br />\r\nBeing positive, doing the right things and thinking the right things will produce the kind of behavior that is an example to all. It will be an encouragement to those around you and an example that they can follow. Watching your confident living will help those with negative tendencies to change the way they think. If it changes the course of their lives you have done a great thing. Being careful of the things we say also will manifest how we act. Our conversation should be complimentary and uplifting.<br />\r\n<br />\r\nBeing tolerant of others is another advantage of being confident. We will not always be treated in the manner that is right. We are not responsible for the negative way that people treat us, but we are responsible for how we react to it. A positive person will realize that sometimes people are a product of their environment. Maybe they didn't have all of the advantages that you did. The right thing to do is to act in a positive way.<br />\r\n<br />\r\nIt is always positive to think of others. Contributing in positive ways leads to an eternal happiness.</p>\r\n', 'The Power of Positive Thinking', 0, 1, '0'),
('<EMAIL>', '551399199247a', '2015-03-26', '06:28:57am', '<p>"Simplicity is the ultimate sophistication." - <NAME>. The goal of reducing clutter is to eliminate the non-essentials and keep only what is needed. If you are cleaning out your closet, this means deciding which pile each thing belongs in. But when it comes to the contents of your mind, the choice is where you place your attention. What do you want to feed with your most precious resource - your attention? We must however be aware that the beginning of any change and any new direction starts within. More accurately it starts with a thought. No matter what that new journey will be, no matter how far it will take us, that first step will quietly, occur within the realms of our own mind.<br />\r\n<br />\r\nAn uncluttered mind is still and pristine like a mountain lake on a windless day. Even if a ripple appears, the tranquility remains, undisturbed. Your actions are clean and efficient. In the spaciousness, you notice creative impulses, novel ideas, and boundless peace. You feel light, calm, and alive.<br />\r\n<br />\r\n<strong>Mental Noise</strong><br />\r\n<br />\r\nTo a great extend, much of this can be classified as mental noise. We are forced to deal with it, blocking it out when we can, doing our best to filter out small pieces that are actually useful to us. We as humans were simply not designed to deal with this much information all at once. This noise keeps us at a disadvantage. It prevents us from focusing on our goals, focusing on what truly matters. It keeps us disconnected from the big picture and from each other.<br />\r\n<br />\r\nWithout the much needed mental clarity, no matter how many courses we may take, we are not prepared to recognize that which truly makes the difference in our lives, what brings us the lasting happiness that we seek.<br />\r\n<br />\r\n<strong>Inquiry for Thoughts and Feelings</strong><br />\r\n<br />\r\nAre you ready to de-clutter your mind? Experts suggest asking a series of questions to decide what to keep and what to let go of. Take each thought pattern, each emotion, and any internal experience that holds you back and pose these questions:</p>\r\n\r\n<ul><br />\r\n <li>Do I need this? Is it essential or necessary?</li>\r\n <br />\r\n <li>Does it serve me? Is it helpful or useful?</li>\r\n <br />\r\n <li>Am I attached to it? Can I let it go?</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\n<br />\r\n<strong>The Process of Letting Go</strong><br />\r\n<br />\r\nLet's be clear about what "letting go" means. It's not exactly like throwing away those clothes you haven't worn for five years - or is it?<br />\r\n<br />\r\nLetting go might mean choosing to move your attention away from a non-essential thought or feeling every time it arises. Or, the process of asking these questions might automatically dispel a long-treasured, old, boring story.<br />\r\n<br />\r\nAnd sometimes the letting go is more of a process that happens over time.<br />\r\n<br />\r\nStart by asking yourself the three questions, and see what you discover. Maybe you will be ready to let go of a mindset that doesn't serve you. Or simply asking the questions may help the patterns loosen their grip.<br />\r\n<br />\r\nDe-cluttering is not an order, or even a goal. With great wisdom and love, simply notice, inquire, receive, then watch what happens...effortlessly.<br />\r\n<br />\r\n<strong>Simple Breathing Meditation Technique</strong><br />\r\n<br />\r\nHere is a step by step guide to a simple breathing meditation technique that can be helpful for de-cluttering your minds.<br />\r\n<br />\r\nFind a quiet dark area where you will not be disturbed for a duration of your session. Assume a comfortable position sitting down, without leaning back.</p>\r\n\r\n<ul><br />\r\n <li>With your eyes closed, take a couple of deep breaths to help you relax. Now, breath normally. Gently bring your attention to the air moving in and out of your nose. Feel the cool air entering your nostrils, rising up through the nose passages on inhale. Don't hold your breath. Feel the warmer air moving through and out of your nose at exhale. You can keep your eyes focused at the point between your eyebrows if you like.</li>\r\n <br />\r\n <li>Continue with your attention on the breath. Never force your breathing but allow it to naturally flow in and out of your nose. Thoughts will come up in your mind. One by one acknowledge them and gently return your mind to the breath. Watch your breath, never forcing it, simply observing. The thoughts will come and go, but the breath will continue, calmly and peacefully. It may be helpful to mentally repeat "in" while breathing in and "out" when breathing out.</li>\r\n <br />\r\n <li>You may find that after a while, your breath will become shallower. This is normal and you should just go along with it. Don't force your breath. The key is simply to observe the air, become the air itself if you will. Let go of everything else, allow yourself to deeply merge with it. If your time is limited, you may want to set a gentle alarm in advance letting you know when the time is up. Slowly get out of the state of meditation but try to retain the calmness that you are experiencing. Bring this feeling of calmness with you when you're done.</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\nThis simple practice will train your mind to focus on just one thing - in this case, your breathing. The effectiveness of this method comes from having a permanent point of attention. You may practice it as long as you'd like. It is recommend to start for just 5 to 10 minutes per day and growing your practice from there. Eventually, this meditation practice may be performed sitting at your office during a break, on the bus, whenever you have some down time or need to focus yourself.<br />\r\n<br />\r\nThe benefits of de-cluttering your mind are felt almost immediately. You will become more focused and prone to less distraction in general. All of your ideas will evolve more naturally. Your decisions will become more intuitive. Any task that you approach will be more manageable and easier to achieve. You will be ready to handle the new journeys or to improve your current ones. The answers will naturally come to you, just listen. This practice may also make you feel more peaceful and attuned to everything and everyone around you. You will realize that we all have the same desire for love, peace and appreciation that connects us all.<br />\r\n<br />\r\n<strong>Conclusion</strong><br />\r\n<br />\r\nTo be in a position to create a brand new program we have to change the programming of the past. Clear the slate if you like. So let's get into how we can de-clutter our minds. It takes work, sacrifice and persistence.<br />\r\n<br />\r\nHowever this is the price you must pay to prepare the fertile garden in your mind. There is no such thing as something for nothing. The universe will only align with you when you are prepared to pay a price for what you will receive. I hope you can commit to the price being asked here. The rewards will far outweigh the asking price.<br />\r\n<br />\r\n<br />\r\nThe process is working when you begin to feel a difference in your energy level. Soon after that you will begin to be aware of the thoughts buzzing around in your head.</p>\r\n', 'A Simple Guide to De-clutter Your Mind', 0, 1, '0'),
('<EMAIL>', '55139937a29b7', '2015-03-26', '06:29:27am', '<p>"When it comes to creating wealth, wealth is a mindset. It's all about how you think." - <NAME><br />\r\n<br />\r\nMoney is energy and energy is always moving, always changing, moving in waves and cycles. Money will flow in and out of your life, like the ebb and flow of the ocean tides. At times you will find that money flows in easily, at other times, it flows out, and sometimes the tide of the flow of money will seem not to change at all, but you should know, that moment is called the turning of the tide, and the cycle will inevitably start over again.<br />\r\n<br />\r\nHow you attract money is your responsibility; it is connected directly to your magnetic ability, that is to say, your energy vibration in relation to money. This varies from person to person and depends, to start with, on how much money you think you want or need to support you in the lifestyle of your choice.<br />\r\n<br />\r\nIn this article you will find out what may be stopping you from letting the abundance flow and how to be open to receiving increasingly larger amounts of money.<br />\r\n </p>\r\n\r\n<ul><br />\r\n <li><strong>Remain Conscious Of The Law Of Attraction</strong></li>\r\n <br />\r\n <li>In simple words, if you focus on abundance, you get abundance, but if you focus on lack of money, you will create more of a lack of money. What you radiate and vibrate in your life with your thoughts, emotions, words and beliefs, you will attract to you. You start by asking with your desire, you receive, and then you allow 'it' to come into your life.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Say 'Yes' To Wealth</strong></li>\r\n <br />\r\n <li>When you say 'yes' to money, you include that in your vibration and you will attract money, and if you say 'no' to money with your feelings, thoughts or emotions, you will also include that in your vibration. So, do not settle for what life throws your way, instead create your life just as you want it to be.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Think Positive Thoughts About Your Money</strong></li>\r\n <br />\r\n <li>Focus on what you have, versus what you do not have, and allow what you do not have only to serve as a light in helping you to see what you want to create. Think positively about the money that you have, visualize it growing, and flowing in and out of your bank account with ease. Feel good and get excited about creating money.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Create more money evidence in your environment</strong></li>\r\n <br />\r\n <li>Get rid of all the cheap things that you have and leave only good quality products. You should not go shopping often because you will end up buying many cheap things that emanate the energy of lack. Buy less often but more quality products that symbolize wealth.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Get into the vibration of abundance</strong></li>\r\n <br />\r\n <li>Raise your vibration so that you would become a vibrational match to the abundance. Focus only on positive things and symbols of abundance, speak positively and never get involved in the thoughts of hatred, envy or powerlessness, because such thoughts will materialize into negative manifestations.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Feel good about the subject of money</strong></li>\r\n <br />\r\n <li>If someone brings up the subject of money, how does that make you feel? Do you feel interested to hear about it, eager for it, excited about it? Or do you feel fear, doubt, confusion and disempowerment? These are very different vibrations that tell what your financial point of attraction is.<br />\r\n <br />\r\n Try to approach money from a respectable and positive attitude, and soon you will experience money flow into your life. If you feel that it is hard for you to express such attitude towards money, then it means you still hold some limiting beliefs about this subject. </li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Treat money with respect</strong></li>\r\n <br />\r\n <li>Pick up coins if you see them in the street, sort money neatly in your wallet, don't keep the money scattered in your bag or pocket. Have respect for money and money will flow to you.<br />\r\n <br />\r\n Pay your bills on time. If you don't return money you owe, you will not get any money in return. If you hoard money, that's all the money you will have.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Donate money</strong></li>\r\n <br />\r\n <li>Give money away to charities, people that need help and for other good causes. Such money will be returned to you tenfold. This is a universal law.<br />\r\n <br />\r\n <br />\r\n Be grateful for the money and other good things you have in your life because the more grateful you are, the more things of the same nature will start flowing into your experience.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Be patient</strong></li>\r\n <br />\r\n <li>Enjoy the process of becoming abundant because then you will become wealthy sooner. However if you keep looking at the evidence that you still do not have money, be sure that the money will flow into your experience very slowly.<br />\r\n <br />\r\n You should have complete faith that the money will start flowing into your life, even if there is no evidence of it as yet. Try to ignore the absence of money and put all your energy into having faith that the money is coming - and it has to come.</li>\r\n <br />\r\n <br />\r\n \r\n</ul>\r\n\r\n<p><br />\r\n<br />\r\n<strong>Conclusion</strong><br />\r\n<br />\r\nKeep money in perspective in your life. It is simply a tool you can use to create the kind of lifestyle you desire. The hippie surfer is happy with minimum money inflow. His happiness does not depend on how much money he has. Don't make money the measure of your happiness either; life is far too grand for that. Open to the abundance vibration, expect money to flow in and out, to ebb and flow in a natural cycle in your life, and build your feelings of prosperity and happiness hand in hand but never from a place of need.</p>\r\n', 'Ways To Let The Money Flow Into Your Life', 0, 1, '0');
INSERT INTO `articles` (`email`, `id`, `date`, `time`, `article`, `title`, `star`, `share`, `nick`) VALUES
('<EMAIL>', '551399605fab2', '2015-03-26', '06:30:08am', '<p>What have you done today to move you closer to your dreams? Are you expecting to wake up one morning and suddenly do everything to achieve your dream in just that one day? Aristotle said, "We are what we repeatedly do." Success is a daily habit. It's the little things you do every day that will get you to your destination.<br />\r\n<br />\r\nDeveloping time management skills is a journey that may begin with this Guide, but needs practice and other guidance along the way. One goal is to help yourself become aware of how you use your time as one resource in organizing, prioritizing, and succeeding in your studies in the context of competing activities of friends, work, family, etc.<br />\r\n<br />\r\n<strong>Put first things first</strong><br />\r\n<br />\r\nIt does not have to be a huge thing. Neither does it have to be something that requires a huge investment of time, energy or resources on your part. It just has to be something that you can do consistently. You will discover that you will eventually be doing more of that one thing than you could have thought possible when you started. Over time, it will make a huge difference. <NAME>, the leadership guru further adds that "it's usually not the dramatic, the visible, the once-in-a-lifetime, up-by-the-bootstraps effort that brings enduring success. Empowerment comes from learning how to use this great endowment in the decisions we make every day."<br />\r\n<br />\r\n<br />\r\nWe subordinate our dreams for our jobs, our bosses, our friends, our parents and a whole lot of other people and activities. We should instead place our hopes and dreams as the most important thing every day.<br />\r\n<br />\r\n<strong>The time management matrix</strong><br />\r\n<br />\r\nMost people spend their time doing things that are neither urgent nor important. One thing that immediately comes to mind is the person that spends every bit of his free time at the bar hanging out with the guys and just having a good time. I would not be very mistaken to say that such a person is not only drinking their income away, but also their dreams.<br />\r\n<br />\r\nTelevision is another not urgent and not important activity which, unfortunately, most of us spend a lot of our most productive time on. It is amazing how television sets in most homes are perpetually on and people are fixed on them like zombies, watching everything that is dished out to them! TVs have invaded our lives and crippled our dreams.<br />\r\n<br />\r\n<strong>Do the important things</strong><br />\r\n<br />\r\nWhat we need to do is concentrate on the things that are most important. The hard part is that these are usually the things that are not urgent. Yet they are things that will make the biggest difference to our lives.<br />\r\n<br />\r\nWhy not turn off the television set tonight and read an inspiring book? Why not take a quiet moment to sit down and write down what you want to do with the rest of your life? Why not spend some time with your kids rather than with the guys at the bar? <br />\r\n<br />\r\n<strong>It is not always fun</strong><br />\r\n<br />\r\nAs you can see, the important things are usually not the most fun or exciting things to do always. However, they must be done. There is a price to be paid for attaining greatness and at times that means doing things we don't necessarily enjoy or want to do.<br />\r\n<br />\r\nBut you must do those things because you realize that your future depends on it. Think about this: if you only had to do the things that are fun and exciting at work would you get anything done? No. But you do it anyway, for the sake of that paycheck at the month-end. Why then, won't you do the things that matter most for your own life?<br />\r\n<br />\r\nGiven are some quick tips that will help you to learn the art of Time Management better.<br />\r\n<br />\r\n<strong>Schedule Your Day.</strong><br />\r\n<br />\r\nIf you want to learn how to improve your time management skills, then you need to have a concrete schedule for the day. Don't get out of bed thinking that you'll just wing it, because it often leads to a lot of time wastage.<br />\r\n<br />\r\nIt would be best to schedule and plan your tasks the night before, because your subconscious mind will help process their fulfillment while you're sleeping.<br />\r\n<br />\r\n<strong>Create A Check List.</strong><br />\r\n<br />\r\nIf you have deadlines coming up, then you need to create a list arranged according to priority. This helps keep you on track and even encourages you to do more as fast as possible. There's nothing like a list to keep you motivated and pressured to do your job.<br />\r\n<br />\r\n<strong>Stop Wasting Time.</strong><br />\r\n<br />\r\nSpacing out for even just five minutes is a waste of time. Not taking a shortcut is also a waste of time. If you want to learn how to improve your time management skills, then you need to cut down on the activities that aren't related to work.<br />\r\n<br />\r\n<br />\r\nChatting with your co-workers is fine; but perhaps you need to cut down on that too, especially if you have a deadline to meet.<br />\r\n<br />\r\n<strong>Learn To Multi-task.</strong><br />\r\n<br />\r\nMulti-tasking is not always advisable, especially if the tasks you're doing need your full concentration. In smaller tasks, however, I'm sure you can do more than one thing at a time. Want some examples?<br />\r\n<br />\r\nHow about reading a book while waiting for the food you're cooking to boil? Perhaps one of the best multi-tasking activities you can do is listening to motivational CDs while on the go.<br />\r\n<br />\r\n<strong>Conclusion</strong><br />\r\n<br />\r\nIf you have not done anything today to get you closer to your dreams you are not a dreamer, you are a wisher. Wake up and do something about it or watch the dreamers take hold of their dreams, one little step each day.<br />\r\n<br />\r\nIn the words of <NAME>, "Motivation is what gets you started. Habit is what keeps you going," Develop the habit of putting first things first today. Work on your dreams each and every day. You are all you can be. Go on and be it!</p>\r\n', 'Time Management Skill', 1, 1, '0'),
('<EMAIL>', '5513998c06339', '2015-03-26', '06:30:52am', '<p>Manifesting is the metaphysical art and science of how we can easily bring our desires into the physical world. It is natural process that involves a specific vibration of energy which you experience that will attract any heartfelt desire to you quickly and effortlessly! To start this process, you should think of something that you would like to have. Start from small things first because this will give you more faith as to that they will manifest.<br />\r\n<br />\r\nWhen you manifest small things, you will be able to gradually progress to bigger and bigger ones. Some fail to manifest because they want to get large amounts of money, houses or cars with their first intention. But that does not work this way because you cannot possibly completely believe that such big things will manifest when you are just a beginner.<br />\r\n<br />\r\n<strong>How to manifest your desires</strong></p>\r\n\r\n<ul><br />\r\n <li><strong>Slow Down, Relax and Fully Be Here Now.</strong></li>\r\n <br />\r\n <li>Being ever-present to this eternal moment is one of the most essential and basic key to manifesting. The mind will jump from past to the future and back again to the past, distracting you from the Infinite Source of power that is only here now. The entire Universe is happening only in this moment. If you are thinking about anything but this moment you are missing out on the Source that is connected to everyone and everything in it. The mind/ego is an extraordinary tool and is what we use to manifest our desires with. If the mind is free from the distracting thoughts about the past and future, then the amazing core of your magical manifesting power has room to come through! By slowing down you are able to shut off the mind chatter and tap directly into the infinite Source of manifesting power that is available ONLY in the Now. As you learn how to slow down your thoughts, your breathing and the movement of your body, eventually the mind comes to a halt and creates space of timelessness. Here we tap into the Infinite Source and you make contact with a super-natural power inside. When we live throughout our day at an enjoyable relaxed and peace filled pace, we can truly resource the intelligence and power in this eternal moment.<br />\r\n <br />\r\n Remember, every idea begins with an intuitive hunch. We know we need certain things at certain times in our lives. There is an inner voice which tells us. We encounter omens or coincidences which point to it. Conversations trigger ideas through synchronicity. There are times when you know you want something.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Practice Stillness Everyday.</strong></li>\r\n <br />\r\n <li>In order to stop the constant chattering of the mind, we need a conscious daily Meditation practice of training the mind. Manifesting happens instantly when you have made the mind to act according to your way. The longer you can maintain focus on your breath, the faster your goals will manifest for you. The actual time it takes to manifest is directly proportional to the number of minutes you can concentrate on what you want without distraction. Become the master of your thoughts, get to know this seat of consciousness inside.<br />\r\n <br />\r\n Be clear on what it is you wish to create in your life. The more specific - the better. We teach making lists as a way to clarify what you want. The world is a reflection of our mind. We attract into our lives a reflection of the thoughts we project. If you really want anything, you can have it. Creating a crystal clear vision is an important step.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Make Conscious Contact With The Universe</strong></li>\r\n <br />\r\n <li>The first step here is to acknowledge that there is a higher power inside you right now, and its very easily available to you. The next step is to be open to this extremely ever-present intelligent Source that is always happening everywhere you are. Believe and get to know your personal conscious connection with this sacred Omni-present Source of power. As you progress in your relationship with this very real divine intelligence, center your mind closer to your heart. You will come to know that God is closer to you than your heart, your mind or your next breath of air.<br />\r\n <br />\r\n By spending time getting clear on what you desire, you will recognize it when it turns up! That will provide you with certainty that you have found what you are looking for and give you the courage to complete the plan to manifestation.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Trust in Life's Magical Unfolding Process.</strong></li>\r\n <br />\r\n <li>Be infinitely patient! Discover a deeper "knowingness" inside you that can help you let go of anxiety, disbelief and doubt. Decide and believe that your goal is on its way. The Universe is always supporting what you want and if you affirm what you want it will always help you to achieve it. The more you can surrender to this deeply wise and powerful feeling of trust and letting go, the more the Universe can help you. It's about getting in touch with that infinite patience that ignites and engages this manifesting process. The experience of Trust is really the greatest and deepest surrender to the Universe from the tiny ego trip we're on.<br />\r\n <br />\r\n Thus, be crystal clear on your outcome; daily visualize what you desire, but release the need to have it. When we project neediness, we block manifestation. When we don't care, miracles happen. Be confident. Release any negative thoughts. Affirm that what you desire is on the way with everyone you meet. Brush off any thoughts or comments that you can't achieve what you wish.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Focus on your Desired Outcome without Attachment to it.</strong></li>\r\n <br />\r\n <li>When you allow your mind to ONLY have positive thoughts towards your desired outcome you are saying to the Universe that you are devoted to manifesting your dream. Being in a deep, positive, open connection with your desired outcome without being overly attached to it, is one of the greatest hidden keys to manifesting it. Positive thinking is a way of sending direct messages to the Universe saying what you want is important and sacred to you. Visualize, feel and imagine that your greatest dream is happening to you without clinging to it. Assume that your imagination is real! Honor and respect your goals in life as if they were given to you from the highest and most powerful being you can imagine.<br />\r\n <br />\r\n By now you need to put in place all that is necessary to make your dreams come true. Completely let go and it is a matter of time. We live in an infinite universe of absolute abundance. It is only our limiting beliefs which restrict our experience.</li>\r\n <br />\r\n <br />\r\n <br />\r\n \r\n <li><strong>Love Yourself Always and In All Ways.</strong></li>\r\n <br />\r\n <li>By simply and profoundly giving Love to yourself everyday in every way you are saying to the Universe you are worthy of attaining any dream, vision or goal. Immediately drop any neediness for love, acceptance and approval from others and replace it with self-love. Step aside from everyone's judgments of you and use that crucial time and energy to send yourself loving and appreciative thoughts. You will increase your manifesting ability and power with every loving feeling you have about yourself that is usually negative and skeptical. The greatest manifesting energy comes from within this Infinite Source of Thought of your being which is in essence Absolute Love.<br />\r\n <br />\r\n In simple words, anchor in your belief in your own power to manifest by celebrating your success. The more you do this, the easier it becomes to find exactly what you want in life. Have a glass of champagne. Go out for dinner. Splash out. It is important to honor your victories. Angels tread lightly. You are an angel. Lighten up, have fun with life, and watch your desires come to pass with ever increasing rapidity. Make it so! </li>\r\n</ul>\r\n', 'How To Manifest Everything That You Want', 1, 1, '0'),
('<EMAIL>', '<PASSWORD>', '2015-03-26', '06:31:40am', '<p>At a personal level, we must also allow ourselves to have a moment of self-review. Productivity as a concept does not only mean being "productive at work" but also being productive in other areas of our life. On a wider scale, it means "being productive as a person".<br />\r\n<br />\r\nWhatever we've accomplished in the past are just that - part of our past. But they should serve us as a starting point for another milestone. The past is as important as the future. We can only move forward to the future if we let the past gauge what we've accomplished against what should have been accomplished. There is always a room for improvement.<br />\r\n<br />\r\n<strong>Family</strong><br />\r\n<br />\r\nThis is one of the reasons why we aspire for greater productivity. We want to become efficient in all areas of our job so we can have more free time to spend with our family. We want to minimize our stress level at work so that, we still have the zest for anything waiting for us at home. Looking back, have you spent enough time with your loved ones? Have you taken good care of your relationships with friends, relatives, spouse, kids, partner, and someone special? <br />\r\n<br />\r\n<strong>Faith</strong><br />\r\n<br />\r\nWhat motivates you aside from family and personal goals? It is important that we believe in some higher form of principles. Some people believe in higher entities that are beyond us. Our morals and values are oftentimes tied with what we believe in. People have their sense of responsibility aligned with universal principles.<br />\r\n<br />\r\n<strong>Career</strong><br />\r\n<br />\r\nIn the bigger picture, career is only a small portion of what we all are here for. For some, career is the most important part of their lives. Then there are some people for whom, career is important only because they consider it as a channel through which they achieve certain needs. If it is a channel for the attainment of the things that matter to us, then we need to improve it.<br />\r\n<br />\r\n<strong>Finance</strong><br />\r\n<br />\r\nOur daily subsistence is not only determined by our ability to adapt ourselves to our environment but also by the amount of money we're capable to spend. We should set some goals to improve our financial standing. Cost-cutting and money-saving are the most obvious things that we can do right away.<br />\r\n<br />\r\n<strong>Conclusion</strong><br />\r\n<br />\r\nThese are only some of the areas that we need to consider in order for us to have a crystal clear view of what we need to improve on to achieve a higher level of productivity. Some of us have already completed the goals - things that they want to have or to be in the next few years. At some point, we need to have the goals that are necessary for us to improve ourselves and the people around us. These goals should be put to realization.<br />\r\n<br />\r\nWe need to have plans on how to achieve the goals. And we should put on top of our list the things that really matter. These goals can only have their meaning if we use them to build the blueprint upon which our actual plans are drawn. And these plans are only figment of our imagination until they are put into action. As said by the wise men, "All of life is a journey which paths we take, what we look back on, and what we look forward to is up to us. We determine our destination, what kind of road we will take to get there, and how happy we are when we get there." So, before making a plunge to the future, look back to see what you've achieved and how far you have to achieve.</p>\r\n', 'Look Back to Look Forward', 0, 1, '0'),
('<EMAIL>', '55997191c776d', '2015-07-05', '08:04:01pm', '<p>गीता में लिखा है की ........ <br />\r\nअगर कोई इन्सान बहुत हंसता है , तो अंदर से वो बहुत अकेला है अगर कोई इन्सान बहुत सोता है , तो अंदर से वो बहुत उदास है अगर कोई इन्सान खुद को बहुत मजबूत दिखाता है और रोता नही , तो वो अंदर से बहुत कमजोर है अगर कोई जरा जरा सी बात पर रो देता है तो वो बहुत मासूम और नाजुक दिल का है अगर कोई हर बात पर नाराज़ हो जाता है तो वो अंदर से बहुत अकेला और जिन्दगी में प्यार की कमी महसूस करता है लोगों को समझने की कोशिश कीजिये ,जिन्दगी किसी का इंतज़ार नही करती , लोगों को एहसास कराइए की वो आप के लिए कितने खास हैे!!! <br />\r\n1. अगर जींदगी मे कुछ पाना हो तो,,, तरीके बदलो....., ईरादे नही.. <br />\r\n2. जब सड़क पर बारात नाच रही हो तो हॉर्न मार-मार के परेशान ना हो...... गाडी से उतरकर थोड़ा नाच लें..., मन शान्त होगा। टाइम तो उतना लगना ही है..! <br />\r\n3. इस कलयुग में रूपया चाहे कितना भी गिर जाए, इतना कभी नहीं गिर पायेगा, जितना रूपये के लिए इंसान गिर चूका है... सत्य वचन.... <br />\r\n4. रास्ते में अगर मंदिर देखो तो,,, प्रार्थना नहीं करो तो चलेगा . . पर रास्ते में एम्बुलेंस मिले तब प्रार्थना जरूर करना,,, शायद कोई जिन्दगी बच जाये <br />\r\n5. जिसके पास उम्मीद हैं, वो लाख बार हार के भी, नही हार सकता..! <br />\r\n6. बादाम खाने से उतनी अक्ल नहीं आती... जितनी धोखा खाने से आती है.....! <br />\r\n7. एक बहुत अच्छी बात जो जिन्दगी भर याद रखिये,,, आप का खुश रहना ही आप का बुरा चाहने वालों के लिए सबसे बड़ी सजा है....! <br />\r\n8. खुबसूरत लोग हमेशा अच्छे नहीं होते, अच्छे लोग हमेशा खूबसूरत नहीं होते...! <br />\r\n9. रिश्ते और रास्ते एक ही सिक्के के दो पहलु हैं... कभी रिश्ते निभाते निभाते रास्ते खो जाते हैं,,, और कभी रास्तो पर चलते चलते रिश्ते बन जाते हैं...! <br />\r\n10. बेहतरीन इंसान अपनी मीठी जुबान से ही जाना जाता है,,,, वरना अच्छी बातें तो दीवारों पर भी लिखी होती है...! <br />\r\n11. दुनिया में कोई काम "impossible" नहीं,,, बस होसला और मेहनत की जरूरत है...l पहले मैं होशियार थl, इसलिए दुनिया बदलने चला था,,, आज मैं समझदार हूँ, इसलिए खुद को बदल रहा हूँ...।।</p>\r\n', 'kuch achhi baatein...', 0, 0, '0');
-- --------------------------------------------------------
--
-- Table structure for table `feedback`
--
CREATE TABLE IF NOT EXISTS `feedback` (
`id` text NOT NULL,
`name` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`subject` varchar(500) NOT NULL,
`feedback` varchar(500) NOT NULL,
`date` date NOT NULL,
`time` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `feedback`
--
INSERT INTO `feedback` (`id`, `name`, `email`, `subject`, `feedback`, `date`, `time`) VALUES
('5515629e089d0', 'lucky', '<EMAIL>', 'feedback', 'my diary..soft copy of feeling ....hmmm.. nice title..', '2015-03-27', '03:01:02pm');
-- --------------------------------------------------------
--
-- Table structure for table `log`
--
CREATE TABLE IF NOT EXISTS `log` (
`email` varchar(50) NOT NULL,
`date` date NOT NULL,
`time` varchar(25) NOT NULL,
`ip` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `log`
--
INSERT INTO `log` (`email`, `date`, `time`, `ip`) VALUES
('<EMAIL>', '2015-07-05', '08:31:48pm', '::1');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`name` varchar(25) NOT NULL,
`age` int(11) NOT NULL,
`gender` varchar(10) NOT NULL,
`email` varchar(40) NOT NULL,
`password` varchar(500) NOT NULL,
PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`name`, `age`, `gender`, `email`, `password`) VALUES
('Sunny', 19, 'M', '<EMAIL>', '<PASSWORD>');
/*!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 */;
|
drop table users if exists;
create table users (
id int primary key,
name varchar(20)
);
insert into users (id, name) values
(3, 'User3');
|
<gh_stars>0
SELECT
created,
source_id,
jdata
FROM solarnode.sn_general_node_datum
WHERE created = ? AND source_id = ?
|
-- based on https://github.com/Trivadis/plsql-and-sql-coding-guidelines/blob/main/docs/3-coding-style/coding-style.md#example
CREATE OR REPLACE PROCEDURE set_salary(in_employee_id IN employees.employee_id%TYPE) IS
CURSOR c_employees(p_employee_id IN employees.employee_id%TYPE) IS
SELECT last_name, first_name, salary
FROM employees
WHERE employee_id = p_employee_id
ORDER BY last_name, first_name;
r_employee c_employees%ROWTYPE;
l_new_salary employees.salary%TYPE;
BEGIN
OPEN c_employees(p_employee_id => in_employee_id);
FETCH c_employees
INTO r_employee;
CLOSE c_employees;
new_salary(in_employee_id => in_employee_id, out_salary => l_new_salary);
-- Check whether salary has changed
IF r_employee.salary <> l_new_salary THEN
UPDATE employees
SET salary = l_new_salary
WHERE employee_id = in_employee_id;
END IF;
END set_salary;
/
|
source 1.sql
call project.upgrade_1 ();
drop PROCEDURE if exists project.upgrade_1;
source 2.sql
call project.upgrade_2 ();
drop PROCEDURE if exists project.upgrade_2;
source 3.sql
call project.upgrade_3 ();
drop PROCEDURE if exists project.upgrade_3;
source 4.sql
call project.upgrade_4 ();
drop PROCEDURE if exists project.upgrade_4;
source 5.sql
call project.upgrade_5 ();
drop PROCEDURE if exists project.upgrade_5;
source 6.sql
call project.upgrade_6 ();
drop PROCEDURE if exists project.upgrade_6;
source 7.sql
call project.upgrade_7 ();
drop PROCEDURE if exists project.upgrade_7;
source 8.sql
call project.upgrade_8 ();
drop PROCEDURE if exists project.upgrade_8;
source 9.sql
call project.upgrade_9 ();
drop PROCEDURE if exists project.upgrade_9;
source 10.sql
call project.upgrade_10 ();
drop PROCEDURE if exists project.upgrade_10;
source 11.sql
call project.upgrade_11 ();
drop PROCEDURE if exists project.upgrade_11;
source 12.sql
call project.upgrade_12 ();
drop PROCEDURE if exists project.upgrade_12;
source 13.sql
call project.upgrade_13 ();
drop PROCEDURE if exists project.upgrade_13;
|
use mysql;
select host, user from user;
-- 因为mysql版本是5.7,因此新建用户为如下命令:
create user teamcat identified by '123456';
-- 将doraemon_nirvana数据库的权限授权给创建的docker用户,密码为<PASSWORD>:
grant all on doraemon_nirvana.* to teamcat@'%' identified by '123456' with grant option;
-- 这一条命令一定要有:
flush privileges;
|
CREATE TABLE deployments (
id text primary key,
account_id text,
created_at timestamptz DEFAULT current_timestamp,
updated_at timestamptz DEFAULT NULL,
name text DEFAULT NULL,
description text DEFAULT NULL,
artifact_id text REFERENCES artifacts(id) ON DELETE SET NULL,
application_instance_id text REFERENCES application_instances(id) ON DELETE SET NULL,
kube_cluster_id text REFERENCES kube_clusters(id) ON DELETE CASCADE
);
CREATE TRIGGER deployments_updated_at
BEFORE UPDATE OR INSERT ON deployments
FOR EACH ROW
EXECUTE PROCEDURE set_updated_at();
|
<filename>install-dev/UT.sql
DROP TABLE IF EXISTS `cms_admin`;
CREATE TABLE `cms_admin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`roleid` int(11) NOT NULL DEFAULT '1',
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`salts` varchar(20) NOT NULL,
`avatar` varchar(250) DEFAULT NULL,
`addtime` timestamp NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `cms_admin_log`;
CREATE TABLE `cms_admin_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`ip` varchar(50) NOT NULL,
`logintime` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `cms_admin_role`;
CREATE TABLE `cms_admin_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role` varchar(50) NOT NULL,
`module` varchar(250) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `cms_module`;
CREATE TABLE `cms_module` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bid` int(11) DEFAULT '0',
`mid` varchar(50) DEFAULT NULL,
`modname` varchar(100) DEFAULT NULL,
`modurl` varchar(200) DEFAULT NULL,
`isopen` int(11) DEFAULT '0',
`ordernum` int(11) DEFAULT '0',
`look` int(11) DEFAULT '0',
`othername` varchar(100) DEFAULT NULL,
`befoitem` varchar(250) DEFAULT NULL,
`backitem` varchar(250) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `cms_plugin`;
CREATE TABLE `cms_plugin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` varchar(50) DEFAULT NULL,
`type` varchar(50) DEFAULT NULL,
`auther` varchar(50) DEFAULT NULL,
`title` varchar(50) DEFAULT NULL,
`ver` varchar(10) DEFAULT NULL,
`description` text,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `cms_search`;
CREATE TABLE IF NOT EXISTS `cms_search` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hit` int(11) DEFAULT '1',
`keyword` varchar(100) DEFAULT NULL,
`lang` varchar(20) DEFAULT 'zh',
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `cms_search_set`;
CREATE TABLE IF NOT EXISTS `cms_search_set` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dbs` varchar(50) DEFAULT NULL,
`fields` varchar(100) DEFAULT NULL,
`wheres` varchar(200) DEFAULT NULL,
`pages` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `cms_update`;
CREATE TABLE `cms_update` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`updateid` int(11) DEFAULT NULL,
`updatetime` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
INSERT INTO `cms_admin` VALUES (1, 1, 'admin', 'd9c51907cc016f4ad6164423c3ddd04f025aa037', 'qHCgJ', '/app/assets/images/noimage.png', '2021-08-08 00:00:00');
INSERT INTO `cms_admin_role` VALUES (1, '超级管理', 'ut-frame,ut-module,ut-plugin,ut-template,ut-cac,ut-system,ut-data,ut-api,ut-power');
INSERT INTO `cms_module` VALUES (1, 3, 'ut-frame', 'UT公共模块', 'index.php', 1, 91, 0, '', NULL, NULL);
INSERT INTO `cms_module` VALUES (2, 3, 'ut-module', '模块', 'index.php', 1, 92, 0, '', '', '模块市场:module.php,管理模块:index.php');
INSERT INTO `cms_module` VALUES (3, 3, 'ut-plugin', '插件', 'index.php', 1, 93, 0, '', '', '插件市场:plugin.php,管理插件:index.php');
INSERT INTO `cms_module` VALUES (4, 3, 'ut-template', '模板', 'index.php', 1, 94, 0, '', '', '创建模板:template_creat.php,管理模板:index.php');
INSERT INTO `cms_module` VALUES (5, 3, 'ut-cac', 'CAC', 'index.php', 1, 95, 0, '', '', '');
INSERT INTO `cms_module` VALUES (6, 3, 'ut-system', '配置', 'index.php', 1, 96, 1, '', '', '系统:index.php,语言:lang.php,搜索:search.php');
INSERT INTO `cms_module` VALUES (7, 3, 'ut-data', '数据', 'index.php', 1, 97, 1, '', '', '表管理:index.php,SQL查询:sql.php,备份还原:backup.php');
INSERT INTO `cms_module` VALUES (8, 3, 'ut-api', '接口', 'index.php', 1, 98, 1, '', '', '接口列表:index.php,在线调试:test.php');
INSERT INTO `cms_module` VALUES (9, 3, 'ut-power', '权限', 'admin.php', 1, 99, 1, '', '', '角色:role.php,管理员:admin.php,登陆日志:log.php'); |
<filename>security-admin-db/src/main/resources/access/db/changelog/sql/V3_add_user_status.sql
ALTER TABLE sec.user
ADD status character varying;
UPDATE sec.user set status = 'REGISTERED' |
<gh_stars>10-100
ALTER TABLE ${ohdsiSchema}.sec_user DROP CONSTRAINT sec_user_login_unique;
ALTER TABLE ${ohdsiSchema}.sec_user ALTER COLUMN login SET DATA TYPE VARCHAR(1024);
ALTER TABLE ${ohdsiSchema}.sec_user ADD CONSTRAINT sec_user_login_unique UNIQUE (login);
|
<filename>src/test/tinc/tincrepo/mpp/gpdb/tests/storage/uao/uao_faultinjection/sql/uao_crash_compaction_vacuum1.sql
-- start_ignore
SET gp_create_table_random_default_distribution=off;
-- end_ignore
vacuum foo;
|
CREATE TABLE Channels (
tunerid TEXT,
channel INTEGER,
program INTEGER,
channelname TEXT
);
CREATE TABLE Schedules (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
tuner TEXT,
channel INTEGER,
program INTEGER,
day TEXT,
start TEXT,
end TEXT,
last TEXT
);
|
CREATE OR REPLACE VIEW line_experiment_vw AS
SELECT e.id AS id
,e.name AS name
,l.name AS line
,cv.name AS cv
,cv_term.name AS type
,e.experimenter AS experimenter
,cvt1.name AS lab
,e.create_date AS create_date
FROM experiment e
JOIN cv_term cvt1 ON (e.lab_id = cvt1.id)
JOIN cv cv1 ON (cvt1.cv_id = cv1.id)
JOIN cv_term ON (e.type_id = cv_term.id)
JOIN cv ON (cv_term.cv_id = cv.id)
JOIN session s on (s.experiment_id = e.id)
JOIN line l on (s.line_id = l.id)
;
|
-- @testpoint:openGauss关键字path(非保留),同时作为表名和列名带引号,并进行dml操作,path列的值最终显示为1000
drop table if exists "path";
create table "path"(
c_id int, c_int int, c_integer integer, c_bool int, c_boolean int, c_bigint integer,
c_real real, c_double real,
c_decimal decimal(38), c_number number(38), c_numeric numeric(38),
c_char char(50) default null, c_varchar varchar(20), c_varchar2 varchar2(4000),
c_date date, c_datetime date, c_timestamp timestamp,
"path" varchar(100) default 'path'
)
PARTITION BY RANGE (c_integer)
(
partition P_20180121 values less than (0),
partition P_20190122 values less than (50000),
partition P_20200123 values less than (100000),
partition P_max values less than (maxvalue)
);
insert into "path"(c_id,"path") values(1,'hello');
insert into "path"(c_id,"path") values(2,'china');
update "path" set "path"=1000 where "path"='hello';
delete from "path" where "path"='china';
select "path" from "path" where "path"!='hello' order by "path";
drop table "path";
|
-- Drop all the tables in reverse order of their creation
DROP TABLE Enrolled;
DROP TABLE Class;
DROP TABLE Faculty;
DROP TABLE Student;
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Aug 27, 2021 at 04:27 PM
-- Server version: 5.6.16
-- 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: `uhas_mida`
--
-- --------------------------------------------------------
--
-- Table structure for table `baseline_blood`
--
CREATE TABLE `baseline_blood` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`base1msdata52` double NOT NULL,
`base1msdata50` double NOT NULL,
`base1msdata53` double NOT NULL,
`base2msdata52` double NOT NULL,
`base2msdata50` double NOT NULL,
`base2msdata53` double NOT NULL,
`base3msdata52` double NOT NULL,
`base3msdata50` double NOT NULL,
`base3msdata53` double NOT NULL,
`base50CrSpike` double NOT NULL,
`basewtblood` double NOT NULL,
`basehct` double NOT NULL,
`dorc` double NOT NULL,
`dop` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `baseline_preview`
--
CREATE TABLE `baseline_preview` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`cor_base1msdata52` double NOT NULL,
`cor_base1msdata50` double NOT NULL,
`cor_base1msdata53` double NOT NULL,
`cor_base2msdata52` double NOT NULL,
`cor_base2msdata50` double NOT NULL,
`cor_base2msdata53` double NOT NULL,
`cor_base3msdata52` double NOT NULL,
`cor_base3msdata50` double NOT NULL,
`cor_base3msdata53` double NOT NULL,
`amt_base1msdata52` double NOT NULL,
`amt_base1msdata50` double NOT NULL,
`amt_base1msdata53` double NOT NULL,
`amt_base2msdata52` double NOT NULL,
`amt_base2msdata50` double NOT NULL,
`amt_base2msdata53` double NOT NULL,
`amt_base3msdata52` double NOT NULL,
`amt_base3msdata50` double NOT NULL,
`amt_base3msdata53` double NOT NULL,
`bcor_base1msdata53` double NOT NULL,
`bcor_base2msdata53` double NOT NULL,
`bcor_base3msdata53` double NOT NULL,
`vol_base` double NOT NULL,
`base1RBC53Cr` double NOT NULL,
`base2RBC53Cr` double NOT NULL,
`base3RBC53Cr` double NOT NULL,
`basemeanRBC53Cr` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `details`
--
CREATE TABLE `details` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`gender` varchar(10) NOT NULL,
`weight` double NOT NULL,
`hct_blood` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `final_preview`
--
CREATE TABLE `final_preview` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`review_infusateVol` double NOT NULL,
`review_injhct_inf` double NOT NULL,
`review_vol_redInfusate` double NOT NULL,
`review_vwb` double NOT NULL,
`review_hct_blood` double NOT NULL,
`review_blood_volume` double NOT NULL,
`review_cor_blood_volume` double NOT NULL,
`review_vwb_over_wt` double NOT NULL,
`review_vol_over_wt` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `injected`
--
CREATE TABLE `injected` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`inj1msdata52` double NOT NULL,
`inj1msdata50` double NOT NULL,
`inj1msdata53` double NOT NULL,
`inj2msdata52` double NOT NULL,
`inj2msdata50` double NOT NULL,
`inj2msdata53` double NOT NULL,
`inj3msdata52` double NOT NULL,
`inj3msdata50` double NOT NULL,
`inj3msdata53` double NOT NULL,
`inj50CrSpike` double NOT NULL,
`injwtblood` double NOT NULL,
`infusateVol` double NOT NULL,
`injhct_inf` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `injected_preview`
--
CREATE TABLE `injected_preview` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`cor_inj1msdata52` double NOT NULL,
`cor_inj1msdata50` double NOT NULL,
`cor_inj1msdata53` double NOT NULL,
`cor_inj2msdata52` double NOT NULL,
`cor_inj2msdata50` double NOT NULL,
`cor_inj2msdata53` double NOT NULL,
`cor_inj3msdata52` double NOT NULL,
`cor_inj3msdata50` double NOT NULL,
`cor_inj3msdata53` double NOT NULL,
`amt_inj1msdata52` double NOT NULL,
`amt_inj1msdata50` double NOT NULL,
`amt_inj1msdata53` double NOT NULL,
`amt_inj2msdata52` double NOT NULL,
`amt_inj2msdata50` double NOT NULL,
`amt_inj2msdata53` double NOT NULL,
`amt_inj3msdata52` double NOT NULL,
`amt_inj3msdata50` double NOT NULL,
`amt_inj3msdata53` double NOT NULL,
`bcor_inj1msdata53` double NOT NULL,
`bcor_inj2msdata53` double NOT NULL,
`bcor_inj3msdata53` double NOT NULL,
`vol_inj` double NOT NULL,
`inj1RBC53Cr` double NOT NULL,
`inj2RBC53Cr` double NOT NULL,
`inj3RBC53Cr` double NOT NULL,
`injmeanRBC53Cr` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `inverse_matrix`
--
CREATE TABLE `inverse_matrix` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`r1c1` double NOT NULL,
`r1c2` double NOT NULL,
`r1c3` double NOT NULL,
`r2c1` double NOT NULL,
`r2c2` double NOT NULL,
`r2c3` double NOT NULL,
`r3c1` double NOT NULL,
`r3c2` double NOT NULL,
`r3c3` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `matrix`
--
CREATE TABLE `matrix` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`m1r1` double NOT NULL,
`m1r2` double NOT NULL,
`m1r3` double NOT NULL,
`m2r1` double NOT NULL,
`m2r2` double NOT NULL,
`m2r3` double NOT NULL,
`m3r1` double NOT NULL,
`m3r2` double NOT NULL,
`m3r3` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `post_label`
--
CREATE TABLE `post_label` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`post1msdata52` double NOT NULL,
`post1msdata50` double NOT NULL,
`post1msdata53` double NOT NULL,
`post2msdata52` double NOT NULL,
`post2msdata50` double NOT NULL,
`post2msdata53` double NOT NULL,
`post3msdata52` double NOT NULL,
`post3msdata50` double NOT NULL,
`post3msdata53` double NOT NULL,
`postCrSpike` double NOT NULL,
`postwtblood` double NOT NULL,
`posthct` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `post_preview`
--
CREATE TABLE `post_preview` (
`id` int(11) NOT NULL,
`PID` varchar(10) NOT NULL,
`cor_post1msdata52` double NOT NULL,
`cor_post1msdata50` double NOT NULL,
`cor_post1msdata53` double NOT NULL,
`cor_post2msdata52` double NOT NULL,
`cor_post2msdata50` double NOT NULL,
`cor_post2msdata53` double NOT NULL,
`cor_post3msdata52` double NOT NULL,
`cor_post3msdata50` double NOT NULL,
`cor_post3msdata53` double NOT NULL,
`amt_post1msdata52` double NOT NULL,
`amt_post1msdata50` double NOT NULL,
`amt_post1msdata53` double NOT NULL,
`amt_post2msdata52` double NOT NULL,
`amt_post2msdata50` double NOT NULL,
`amt_post2msdata53` double NOT NULL,
`amt_post3msdata52` double NOT NULL,
`amt_post3msdata50` double NOT NULL,
`amt_post3msdata53` double NOT NULL,
`bcor_post1msdata53` double NOT NULL,
`bcor_post2msdata53` double NOT NULL,
`bcor_post3msdata53` double NOT NULL,
`vol_post` double NOT NULL,
`post1RBC53Cr` double NOT NULL,
`post2RBC53Cr` double NOT NULL,
`post3RBC53Cr` double NOT NULL,
`postmeanRBC53Cr` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `baseline_blood`
--
ALTER TABLE `baseline_blood`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`);
--
-- Indexes for table `baseline_preview`
--
ALTER TABLE `baseline_preview`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`);
--
-- Indexes for table `details`
--
ALTER TABLE `details`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`);
--
-- Indexes for table `final_preview`
--
ALTER TABLE `final_preview`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`);
--
-- Indexes for table `injected`
--
ALTER TABLE `injected`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`) USING BTREE;
--
-- Indexes for table `injected_preview`
--
ALTER TABLE `injected_preview`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`) USING BTREE;
--
-- Indexes for table `inverse_matrix`
--
ALTER TABLE `inverse_matrix`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`);
--
-- Indexes for table `matrix`
--
ALTER TABLE `matrix`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`) USING BTREE;
--
-- Indexes for table `post_label`
--
ALTER TABLE `post_label`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`) USING BTREE;
--
-- Indexes for table `post_preview`
--
ALTER TABLE `post_preview`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `PID` (`PID`) USING BTREE;
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `baseline_blood`
--
ALTER TABLE `baseline_blood`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `baseline_preview`
--
ALTER TABLE `baseline_preview`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `details`
--
ALTER TABLE `details`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `final_preview`
--
ALTER TABLE `final_preview`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `injected`
--
ALTER TABLE `injected`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `injected_preview`
--
ALTER TABLE `injected_preview`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `inverse_matrix`
--
ALTER TABLE `inverse_matrix`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `matrix`
--
ALTER TABLE `matrix`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `post_label`
--
ALTER TABLE `post_label`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `post_preview`
--
ALTER TABLE `post_preview`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
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 */;
|
-- CreateTable
CREATE TABLE "usuarios" (
"id" SERIAL NOT NULL,
"nombre" TEXT NOT NULL,
"correo" TEXT NOT NULL,
"password" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "posts" (
"id" SERIAL NOT NULL,
"titulo" TEXT NOT NULL,
"descripcion" TEXT NOT NULL,
"disponible" BOOLEAN NOT NULL DEFAULT true,
"usuario_id" INTEGER NOT NULL,
"creado" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "autores" (
"id" SERIAL NOT NULL,
"nombre" TEXT NOT NULL,
"apellido" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "usuarios.correo_unique" ON "usuarios"("correo");
-- AddForeignKey
ALTER TABLE "posts" ADD FOREIGN KEY ("usuario_id") REFERENCES "autores"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
<reponame>Fiqri-R-J/SPK-FC-Dana-Bansos<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 24, 2021 at 02:05 PM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.10
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: `db_skripsi`
--
-- --------------------------------------------------------
--
-- Table structure for table `keputusans`
--
CREATE TABLE `keputusans` (
`id` int(11) NOT NULL,
`syarat` varchar(100) NOT NULL,
`nama` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `keputusans`
--
INSERT INTO `keputusans` (`id`, `syarat`, `nama`, `created_at`, `updated_at`) VALUES
(1, '9 atau lebih', 'Dapat', '2021-01-05 00:00:00', '2021-01-05 00:00:00'),
(2, 'kurang dari 9', 'Tidak Dapat', '2021-01-27 00:00:00', '2021-01-27 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `kriterias`
--
CREATE TABLE `kriterias` (
`id` int(11) NOT NULL,
`kode` varchar(10) NOT NULL,
`nama` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `kriterias`
--
INSERT INTO `kriterias` (`id`, `kode`, `nama`, `created_at`, `updated_at`) VALUES
(1, 'Q001', 'Luas lantai <8m2/orang', '2021-07-24 00:00:00', '2021-07-24 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `masyarakats`
--
CREATE TABLE `masyarakats` (
`id` int(11) NOT NULL,
`nama_kk` varchar(100) NOT NULL,
`rt` varchar(3) NOT NULL,
`status` varchar(15) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `masyarakats`
--
INSERT INTO `masyarakats` (`id`, `nama_kk`, `rt`, `status`, `created_at`, `updated_at`) VALUES
(1, '<NAME>', '01', 'Dapat', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(2, 'Jaelani', '04', 'Tidak Dapat', '2021-07-21 00:00:00', '2021-07-21 00:00:00');
-- --------------------------------------------------------
--
-- 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
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1);
-- --------------------------------------------------------
--
-- 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 `petugas`
--
CREATE TABLE `petugas` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`nama` varchar(30) NOT NULL,
`rt` varchar(3) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`role` enum('Admin','Petugas') 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;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `keputusans`
--
ALTER TABLE `keputusans`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `kriterias`
--
ALTER TABLE `kriterias`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `masyarakats`
--
ALTER TABLE `masyarakats`
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 `petugas`
--
ALTER TABLE `petugas`
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 `keputusans`
--
ALTER TABLE `keputusans`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `kriterias`
--
ALTER TABLE `kriterias`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `masyarakats`
--
ALTER TABLE `masyarakats`
MODIFY `id` int(11) 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=3;
--
-- AUTO_INCREMENT for table `petugas`
--
ALTER TABLE `petugas`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
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 */;
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 08, 2019 at 02:20 AM
-- Server version: 10.1.36-MariaDB
-- PHP Version: 7.2.10
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: `mirabellabatik`
--
-- --------------------------------------------------------
--
-- Table structure for table `admins`
--
CREATE TABLE `admins` (
`id` int(11) NOT NULL,
`username` varchar(30) NOT NULL,
`password` varchar(255) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admins`
--
INSERT INTO `admins` (`id`, `username`, `password`, `created_at`, `updated_at`) VALUES
(1, 'admin', <PASSWORD>', '2019-01-03 22:23:49', '2019-01-03 22:23:49');
-- --------------------------------------------------------
--
-- Table structure for table `banks`
--
CREATE TABLE `banks` (
`id` int(11) NOT NULL,
`no_rek` varchar(20) NOT NULL,
`nama_bank` varchar(50) NOT NULL,
`atas_nama` varchar(50) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `banks`
--
INSERT INTO `banks` (`id`, `no_rek`, `nama_bank`, `atas_nama`, `created_at`, `updated_at`) VALUES
(1, '563201026697355', 'BRI', 'Ramdan Riawan', '2019-01-05 08:30:50', '2019-01-05 08:30:50');
-- --------------------------------------------------------
--
-- Table structure for table `jenis_bahans`
--
CREATE TABLE `jenis_bahans` (
`id` int(11) NOT NULL,
`nama_bahan` varchar(50) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `jenis_bahans`
--
INSERT INTO `jenis_bahans` (`id`, `nama_bahan`, `created_at`, `updated_at`) VALUES
(1, 'Kain Mori (Cambrics)', '2019-01-04 20:02:21', '2019-01-04 20:02:21'),
(2, 'Kain Katun', '2019-01-04 20:02:21', '2019-01-04 20:35:37');
-- --------------------------------------------------------
--
-- Table structure for table `kategoris`
--
CREATE TABLE `kategoris` (
`id` int(11) NOT NULL,
`jenis_kategori` varchar(50) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `kategoris`
--
INSERT INTO `kategoris` (`id`, `jenis_kategori`, `created_at`, `updated_at`) VALUES
(1, 'Wearpack Batik', '2019-01-04 19:28:49', '2019-01-04 20:08:56'),
(2, 'Muslim Set Batik', '2019-01-04 19:28:49', '2019-01-04 19:28:49');
-- --------------------------------------------------------
--
-- Table structure for table `konfirmasis`
--
CREATE TABLE `konfirmasis` (
`id` int(11) NOT NULL,
`order_id` int(11) NOT NULL,
`pelanggan_id` int(11) NOT NULL,
`bank_id` int(11) NOT NULL,
`nama_pengirim` varchar(50) NOT NULL,
`rek_pengirim` varchar(50) NOT NULL,
`tggl_konfirmasi` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`bukti_transfer` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `kotas`
--
CREATE TABLE `kotas` (
`id` int(6) NOT NULL,
`nama_kota` varchar(30) NOT NULL,
`ongkir` int(11) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `kotas`
--
INSERT INTO `kotas` (`id`, `nama_kota`, `ongkir`, `created_at`, `updated_at`) VALUES
(1, 'jambi', 22000, '2019-01-03 07:55:18', '2019-01-04 12:05:32'),
(2, 'aceh', 44000, '2019-01-04 13:52:06', '2019-01-04 13:52:06'),
(3, 'Denpasar', 29000, '2019-01-04 13:52:06', '2019-01-04 13:52:06'),
(4, 'Pangkalpinang', 31000, '2019-01-04 13:52:06', '2019-01-04 13:52:06'),
(5, 'cilegon', 22000, '2019-01-04 13:52:06', '2019-01-04 13:52:06'),
(6, 'serang', 27000, '2019-01-04 13:52:06', '2019-01-04 13:52:06'),
(7, 'tanggerang selatan', 21000, '2019-01-04 13:52:06', '2019-01-04 13:52:06'),
(8, 'tanggerang', 21000, '2019-01-04 13:52:06', '2019-01-04 13:52:06'),
(9, 'bengkulu', 29000, '2019-01-04 13:52:06', '2019-01-04 13:52:06'),
(10, 'gorontalo', 44000, '2019-01-04 13:52:06', '2019-01-04 13:52:06'),
(11, 'jakarta barat', 19000, '2019-01-04 13:52:06', '2019-01-04 13:52:06');
-- --------------------------------------------------------
--
-- Table structure for table `laporans`
--
CREATE TABLE `laporans` (
`judul` varchar(20) NOT NULL,
`isi_laporan` varchar(100) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- 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;
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
CREATE TABLE `orders` (
`id` int(11) NOT NULL,
`pelanggan_id` int(11) NOT NULL,
`tgl_order` datetime NOT NULL,
`alamat_pengiriman` varchar(50) NOT NULL,
`kota_id` int(11) NOT NULL,
`status_order` varchar(20) NOT NULL,
`status_konfirmasi` varchar(20) NOT NULL,
`status_diterima` varchar(20) NOT NULL,
`creted_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `orders`
--
INSERT INTO `orders` (`id`, `pelanggan_id`, `tgl_order`, `alamat_pengiriman`, `kota_id`, `status_order`, `status_konfirmasi`, `status_diterima`, `creted_at`, `updated_at`) VALUES
(1, 2, '2019-01-01 00:00:00', 'jl. h. ibrahim rt 19 no 94. kel. rawasari kec. kot', 1, 'pending', 'pending', 'pending', '2019-01-05 20:24:54', '2019-01-05 20:24:54'),
(2, 3, '2019-01-01 00:00:00', 'jl. h. ibrahim rt 19 no 94. kel. rawasari kec. kot', 1, 'pending', 'pending', 'pending', '2019-01-05 20:24:54', '2019-01-05 20:24:54');
-- --------------------------------------------------------
--
-- Table structure for table `order_details`
--
CREATE TABLE `order_details` (
`id` int(11) NOT NULL,
`order_id` int(11) NOT NULL,
`produk_id` int(11) NOT NULL,
`jumlah` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `order_temps`
--
CREATE TABLE `order_temps` (
`id` int(11) NOT NULL,
`produk_id` int(11) NOT NULL,
`session_id` int(11) NOT NULL,
`jumlah` int(11) NOT NULL,
`tggl_order` datetime NOT NULL,
`stok` int(11) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `pelanggans`
--
CREATE TABLE `pelanggans` (
`id` int(11) NOT NULL,
`name` varchar(50) NOT NULL,
`telpon` varchar(15) NOT NULL,
`alamat` varchar(255) NOT NULL,
`kota_id` int(6) NOT NULL,
`email` varchar(25) NOT NULL,
`gambar` varchar(255) DEFAULT NULL,
`password` varchar(255) NOT NULL,
`remember_token` varchar(255) DEFAULT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pelanggans`
--
INSERT INTO `pelanggans` (`id`, `name`, `telpon`, `alamat`, `kota_id`, `email`, `gambar`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(2, 'ramdan', '082282692489', 'jl. h. ibrahim rt 19 no 94. kel. rawasari kec. kota baru jambi', 1, '<EMAIL>', 'img005.jpg', '$2y$<PASSWORD>ec<PASSWORD>', 'OypDDfPhETPYRl1wtHL6Lf8pZdEnWlYiAHbqoNqXZabJLklhXoP0I5Wy7nqN', '2019-01-03 10:12:00', '2019-01-07 17:29:54'),
(3, 'riawan', '082282692481', 'jl. <NAME> rt 19 no 94 kel. rawasari kec. kota baru kota jambi', 1, '<EMAIL>', '', '$2y$10$LYe37z/QxfgqatjF/6kSzulXo3.E4Qovy9PLMcrbdUd6zZSM9BnL2', NULL, '2019-01-05 07:20:52', '2019-01-05 07:20:52'),
(4, '<NAME>', '082282692482', 'dimana mana hatiku senang', 1, '<EMAIL>', '', '$2y$10$/yC50bfqF1SZMdbSUYoc1OAcnEJ8vJjsmrp8Af4HyeNDk80f1YlEm', NULL, '2019-01-05 07:21:50', '2019-01-05 07:21:50');
-- --------------------------------------------------------
--
-- Table structure for table `produks`
--
CREATE TABLE `produks` (
`id` int(11) NOT NULL,
`kategori_id` int(11) NOT NULL,
`jenis_bahan_id` int(11) NOT NULL,
`nama_produk` varchar(50) NOT NULL,
`deskripsi` varchar(255) NOT NULL,
`harga` int(11) NOT NULL,
`stok` int(11) NOT NULL,
`berat` int(11) NOT NULL,
`gambar` varchar(255) NOT NULL,
`gambar_belakang` varchar(255) NOT NULL,
`dibeli` int(11) NOT NULL DEFAULT '0',
`diskon` int(3) DEFAULT '0',
`tggl_masuk` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `produks`
--
INSERT INTO `produks` (`id`, `kategori_id`, `jenis_bahan_id`, `nama_produk`, `deskripsi`, `harga`, `stok`, `berat`, `gambar`, `gambar_belakang`, `dibeli`, `diskon`, `tggl_masuk`, `created_at`, `updated_at`) VALUES
(11, 2, 1, 'abaju batik 1', 'ini baju batik terkeren sepanjang sejarah', 10000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 20, '2019-02-01 00:00:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(13, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 11000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-03-08 00:00:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(15, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 12000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-02-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(17, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 13000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(19, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 14000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(21, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 15000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(23, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 16000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(25, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 17000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(27, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 18000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(28, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 19000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(29, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 20000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(30, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 21000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(31, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 22000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(32, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 23000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(33, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 24000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04'),
(34, 1, 1, 'baju batik 1', 'ini baju batik terkeren sepanjang sejarah', 25000, 100, 1, 'bajubatik1.jpg', 'bajubatik2.jpg', 0, 10, '2019-01-06 10:45:00', '2019-01-06 10:47:04', '2019-01-06 10:47:04');
-- --------------------------------------------------------
--
-- Table structure for table `ulasans`
--
CREATE TABLE `ulasans` (
`id` int(11) NOT NULL,
`pelanggan_id` int(11) NOT NULL,
`produk_id` int(11) NOT NULL,
`isi_ulasan` varchar(255) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `ulasans`
--
INSERT INTO `ulasans` (`id`, `pelanggan_id`, `produk_id`, `isi_ulasan`, `created_at`, `updated_at`) VALUES
(1, 2, 9, 'ini barangnya jelek banget smpah dah mending gak usah beli disini', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) 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, '<NAME>', '<EMAIL>', NULL, '$2y$10$ejq78EmoedhUVxPajSXUA.vuIswm.TwO/UftM1EQsH8zHIFPlS0Ym', NULL, '2019-01-03 01:32:51', '2019-01-03 01:32:51');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `banks`
--
ALTER TABLE `banks`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `jenis_bahans`
--
ALTER TABLE `jenis_bahans`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `kategoris`
--
ALTER TABLE `kategoris`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `konfirmasis`
--
ALTER TABLE `konfirmasis`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `kotas`
--
ALTER TABLE `kotas`
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`);
--
-- Indexes for table `order_details`
--
ALTER TABLE `order_details`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `order_temps`
--
ALTER TABLE `order_temps`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `pelanggans`
--
ALTER TABLE `pelanggans`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `produks`
--
ALTER TABLE `produks`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `ulasans`
--
ALTER TABLE `ulasans`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admins`
--
ALTER TABLE `admins`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `banks`
--
ALTER TABLE `banks`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `jenis_bahans`
--
ALTER TABLE `jenis_bahans`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `kategoris`
--
ALTER TABLE `kategoris`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `konfirmasis`
--
ALTER TABLE `konfirmasis`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `kotas`
--
ALTER TABLE `kotas`
MODIFY `id` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `order_details`
--
ALTER TABLE `order_details`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `order_temps`
--
ALTER TABLE `order_temps`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pelanggans`
--
ALTER TABLE `pelanggans`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `produks`
--
ALTER TABLE `produks`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;
--
-- AUTO_INCREMENT for table `ulasans`
--
ALTER TABLE `ulasans`
MODIFY `id` int(11) 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;
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 */;
|
create or replace package body "DBTOOLS"."OS_DIR"
as
--*=============================================================================
function gen_ls_file_name
(
p_in_dir in varchar2
,p_in_owner in varchar2
) return varchar2
as
lv_retval clob;
begin
lv_retval := lower(p_in_owner)||'-'||lower(os_tools.get_pdb_name)||'-'||lower(p_in_dir)||'.sh';
return lv_retval;
end gen_ls_file_name;
--*=============================================================================
function gen_ext_tab_name
(
p_in_dir in varchar2
) return varchar2
as
lv_retval varchar2(100);
begin
lv_retval := p_in_dir||'_EXT_TAB';
return lv_retval;
end gen_ext_tab_name;
--*=============================================================================
procedure gen_ls_file
(
p_in_dir in varchar2
,p_in_owner in varchar2
)
as
lv_script clob := '#!/bin/bash'||chr(10)||
q'[/bin/ls -ltrh --time-style="+%Y-%m-%d %H:%M:%S" {$0} | /bin/awk '{if(NR>1)print $1 "|" $2 "|" $3 "|" $4 "|" $5 "|" $6 " " $7 "|" $8;}']';
lv_path clob;
lv_file_name clob;
FileAttr os_tools.fgetattr_t;
begin
-- build shell script with help of template and path taken from Oracle dictionary
begin
select t_path into lv_path
from table(os_tools.get_directory_names(upper(p_in_owner)))
where t_directory_name = upper(p_in_dir);
exception
when no_data_found then
lv_path := 'MISSINGDIR';
end;
if lv_path = 'MISSINGDIR' then
dbms_output.put_line(p_in_owner||':'||p_in_dir||' No such O/S directory skipping.');
else
lv_script := replace(lv_script,'{$0}',lv_path);
dbms_output.put_line(lv_script);
lv_file_name := gen_ls_file_name
(
p_in_dir => p_in_dir
,p_in_owner => p_in_owner
);
dbms_output.put_line(lv_file_name);
-- check that file not already exist on disk
-- if not then write the script to disk
FileAttr := os_tools.get_file_attributes('DBTOOLS_SCRIPT_DIR',lv_file_name);
if (FileAttr.fexists) then
null; -- Not do anything.
else
os_tools.write_clob_to_file
(
p_dir=>'DBTOOLS_SCRIPT_DIR'
,p_filename=>lv_file_name
,p_clob=>lv_script
);
end if;
end if;
end gen_ls_file;
--*=============================================================================
procedure gen_files_file
(
p_in_dir in varchar2
,p_in_owner in varchar2
)
as
lv_script clob := '';
lv_path clob;
lv_file_name clob := 'files.txt';
FileAttr os_tools.fgetattr_t;
begin
-- nvl() not working against pipe function
begin
select t_path into lv_path
from table(os_tools.get_directory_names(upper(p_in_owner)))
where t_directory_name = upper(p_in_dir);
exception
when no_data_found then
lv_path := 'MISSINGDIR';
end;
-- create files.txt in p_in_dir if it does not exist
if lv_path = 'MISSINGDIR' then
dbms_output.put_line(p_in_owner||':'||p_in_dir||' has no O/S path skipping.');
else
FileAttr := os_tools.get_file_attributes(p_in_dir,lv_file_name);
if (FileAttr.fexists) then
null; -- Not do anything.
else
-- check that os directory does exist
dbms_output.put_line(p_in_owner||':'||p_in_dir||':'||lv_path);
if os_tools.check_if_os_directory_exists
(
p_indir => p_in_dir
) then
-- if directory exist then write files.txt
os_tools.write_clob_to_file
(
p_dir=> p_in_dir
,p_filename=>lv_file_name
,p_clob=>lv_script
);
end if;
end if;
end if;
end gen_files_file;
--*=============================================================================
procedure check_ls_l_dir
as
lv_dir clob := os_tools.get_ora_base||'/dbtoolsorascript';
begin
if not os_tools.check_if_directory_exist
(
p_in_owner=>'DBTOOLS'
,p_indir=>'DBTOOLS_SCRIPT_DIR'
) then
raise_application_error(-20000,'Directory DBTOOLS_SCRIPT_DIR must existand point to '||lv_dir);
end if; -- check_if_directory_exist
end check_ls_l_dir;
--*=============================================================================
procedure check_files_file
as
cursor cur_get_directory_names is
select owner
,table_name
,default_directory_name
from dba_external_tables
where table_name like '%EXT_TAB';
begin
for rec in cur_get_directory_names loop
gen_files_file
(
p_in_dir => rec.default_directory_name
,p_in_owner => rec.owner
);
end loop;
end check_files_file;
--*=============================================================================
procedure check_ls_file
as
cursor cur_get_directory_names is
select owner
,table_name
,default_directory_name
from dba_external_tables
where table_name like '%EXT_TAB';
begin
for rec in cur_get_directory_names loop
gen_ls_file
(
p_in_dir => rec.default_directory_name
,p_in_owner => rec.owner
);
end loop;
end check_ls_file;
--*=============================================================================
procedure gen_ext_table
(
p_in_dir in varchar2
,p_in_owner in varchar2
)
as
lv_script clob := q'[create table {$4}.{$0}]'||chr(10)||
q'[(]'||chr(10)||
q'[ f_permission varchar2(11 char),]'||chr(10)||
q'[ f_flag char(1 char),]'||chr(10)||
q'[ f_user varchar2(32 char),]'||chr(10)||
q'[ f_group varchar2(32 char),]'||chr(10)||
q'[ f_size varchar2(30 char),]'||chr(10)||
q'[ f_date varchar2(30 char),]'||chr(10)||
q'[ f_file varchar2(4000 char)]'||chr(10)||
q'[) ORGANIZATION EXTERNAL]'||chr(10)||
q'[(]'||chr(10)||
q'[ TYPE ORACLE_LOADER]'||chr(10)||
q'[ DEFAULT DIRECTORY {$1}]'||chr(10)||
q'[ ACCESS PARAMETERS ]'||chr(10)||
q'[ (]'||chr(10)||
q'[ RECORDS DELIMITED BY NEWLINE]'||chr(10)||
q'[ NOLOGFILE]'||chr(10)||
q'[ PREPROCESSOR {$2}:'{$3}']'||chr(10)||
q'[ fields terminated by '|']'||chr(10)||
q'[ missing field values are null]'||chr(10)||
q'[ )]'||chr(10)||
q'[ LOCATION ('files.txt')]'||chr(10)||
q'[)]'||chr(10)||
q'[ REJECT LIMIT UNLIMITED]'||chr(10)||
q'[ PARALLEL 2]';
lv_table_name varchar2(30);
lv_default_dir clob;
lv_script_dir clob;
lv_proc_file clob;
lv_owner varchar2(30) := p_in_owner;
lv_files varchar2(20) := 'files.txt';
lv_drop_tbl clob;
lv_antal number;
begin
-- {$0}
lv_table_name := gen_ext_tab_name
(
p_in_dir => p_in_dir
);
-- {$1}
lv_default_dir := upper(p_in_dir);
-- {$2}
lv_script_dir := 'DBTOOLS_SCRIPT_DIR';
-- {3}
lv_proc_file := gen_ls_file_name
(
p_in_dir => p_in_dir
,p_in_owner => p_in_owner
);
lv_script := replace(lv_script,'{$0}',lv_table_name);
lv_script := replace(lv_script,'{$1}',lv_default_dir);
lv_script := replace(lv_script,'{$2}',lv_script_dir);
lv_script := replace(lv_script,'{$3}',lv_proc_file);
lv_script := replace(lv_script,'{$4}',lv_owner);
select count(*) into lv_antal
from dba_tables
where owner = upper(p_in_owner)
and table_name = lv_table_name;
if lv_antal > 0 then
lv_drop_tbl := 'drop table '||p_in_owner||'.'||lv_table_name;
dbms_output.put_line(lv_drop_tbl);
execute immediate lv_drop_tbl;
dbms_output.put_line(lv_script);
execute immediate lv_script;
else
dbms_output.put_line(lv_script);
execute immediate lv_script;
end if;
end gen_ext_table;
--*=============================================================================
procedure setup_dir
(
p_in_dir in varchar2
,p_in_owner in varchar2
)
as
-- Public
begin
check_ls_l_dir;
gen_ls_file
(
p_in_dir => p_in_dir
,p_in_owner => p_in_owner
);
gen_files_file
(
p_in_dir => p_in_dir
,p_in_owner => p_in_owner
);
gen_ext_table
(
p_in_dir => p_in_dir
,p_in_owner => p_in_owner
);
end setup_dir;
--*=============================================================================
procedure clean_os_file_log
is
cursor cur_get_old_files is
select file_sequence
from os_file_log
where date_loaded < trunc(sysdate-1);
begin
for rec in cur_get_old_files loop
delete from os_file_log where file_sequence = rec.file_sequence;
delete from os_file_log_details where file_sequence = rec.file_sequence;
end loop;
commit;
end clean_os_file_log;
--*=============================================================================
procedure setup_credentials
(
p_in_ora_pwd in varchar2
)
is
lv_dir_exists boolean;
lv_job_exists number := 0;
lv_path clob;
lv_template clob := q'[#!/bin/bash]'||chr(10)||
q'[export PATH=$PATH:/bin]'||chr(10)||
q'[chmod 755 {$1}]'||chr(10);
begin
lv_dir_exists := dbtools.os_tools.check_if_os_directory_exists('DBTOOLS_SCRIPT_DIR');
if lv_dir_exists then
select t_path into lv_path
from table(dbtools.os_tools.get_directory_names('DBTOOLS'))
where t_directory_name = 'DBTOOLS_SCRIPT_DIR';
dbms_output.put_line(lv_path);
lv_template := replace(lv_template,'{$1}',lv_path||'/*.sh');
dbms_output.put_line(lv_template);
dbms_credential.create_credential
(
credential_name => 'oracle_shell_executable_perm',
username => 'oracle',
password => <PASSWORD>
);
DBMS_SCHEDULER.create_job
(
job_name => 'DBTOOLS.SET_EXECFLAG_DBTOOLS_SCRIPT_DIR',
job_type => 'EXTERNAL_SCRIPT',
job_action => '/bin/ksh '||lv_template,
credential_name => 'oracle_shell_executable_perm',
start_date => NULL,
repeat_interval => 'FREQ=MINUTELY;BYHOUR=8,9,10,11,12,13,14,15,16,17,18,19,20,21;BYDAY=MON,TUE,WED,THU,FRI,SAT,SUN',
end_date => NULL,
enabled => TRUE,
auto_drop => FALSE,
comments => 'Set executable permissions on scripts in DBTOOLS_SCRIPT_DIR'
);
end if;
end setup_credentials;
--*=============================================================================
procedure maintain_dirs
as
begin
check_files_file;
check_ls_file;
clean_os_file_log;
end maintain_dirs;
end os_dir;
/
|
-------------------------------------------------------------------------------------------
--Procedure Name: GENERATE_REVENUE_REPORT
--This stored procedure calculates and generates the monthly revenue report.
-------------------------------------------------------------------------------------------
CREATE OR REPLACE PROCEDURE GENERATE_REVENUE_REPORT AS
--local declarations
thisLocationID LOCATION_DETAILS.LOCATION_ID%TYPE;
currentLocationID LOCATION_DETAILS.LOCATION_ID%TYPE;
locationName LOCATION_DETAILS.LOCATION_NAME%TYPE;
thisCategoryName CAR_CATEGORY.CATEGORY_NAME%TYPE;
thisNoOfCars integer; thisRevenue DECIMAL(15,2);
--Cursor declaration
CURSOR CURSOR_REPORT IS SELECT TABLE1.LOCATIONID, TABLE1.CATNAME ,TABLE1.NOOFCARS,
SUM(NVL((TABLE2.AMOUNT),0)) AS REVENUE FROM (SELECT LC.LID AS LOCATIONID, LC.CNAME AS CATNAME ,
COUNT(C.REGISTRATION_NUMBER) AS NOOFCARS FROM (SELECT L.LOCATION_ID AS LID, CC.CATEGORY_NAME AS CNAME FROM
CAR_CATEGORY CC CROSS JOIN LOCATION_DETAILS L) LC LEFT OUTER JOIN CAR C ON LC.CNAME = C.CAR_CATEGORY_NAME AND LC.LID = C.LOC_ID
GROUP BY LC.LID, LC.CNAME ORDER BY LC.LID) TABLE1 LEFT OUTER JOIN (SELECT BC.PLOC AS PICKLOC,BC.CNAME AS CNAMES,
SUM(BL.TOTAL_AMOUNT) AS AMOUNT FROM (SELECT B.PICKUP_LOC AS PLOC, C1.CAR_CATEGORY_NAME AS CNAME, B.BOOKING_ID AS BID
FROM BOOKING_DETAILS B INNER JOIN CAR C1 ON B.REG_NUM = C1.REGISTRATION_NUMBER) BC INNER JOIN BILLING_DETAILS BL ON BC.BID = BL.BOOKING_ID WHERE
(to_date (SYSDATE,'dd-MM-yyyy') - to_date(BL.BILL_DATE,'dd-MM-yyyy')) <=30 GROUP BY BC.PLOC,BC.CNAME ORDER BY BC.PLOC) TABLE2
ON TABLE1.LOCATIONID=TABLE2.PICKLOC AND TABLE1.CATNAME = TABLE2.CNAMES GROUP BY TABLE1.LOCATIONID, TABLE1.CATNAME, TABLE1.NOOFCARS
ORDER BY TABLE1.LOCATIONID;
BEGIN
dbms_output.put_line(' ');
dbms_output.put_line('Revenue Report');
dbms_output.put_line('**************');
dbms_output.put_line(' ');
OPEN CURSOR_REPORT;
FETCH CURSOR_REPORT INTO thisLocationID, thisCategoryName, thisNoOfCars, thisRevenue;
IF CURSOR_REPORT%NOTFOUND THEN
dbms_output.put_line('No Report to be Generated');
ELSE
currentLocationID := thisLocationID;
<<LABEL_NEXTLOC>>
SELECT LOCATION_NAME INTO locationName from LOCATION_DETAILS WHERE LOCATION_ID = currentLocationID;
dbms_output.put_line('Location Name: '|| locationName);
dbms_output.put_line(' ');
dbms_output.put_line('Car Category' || ' '||'Number of Cars' ||' '|| 'Revenue');
dbms_output.put_line('------------' || ' '||'--------------' ||' '|| '-------');
dbms_output.put_line(thisCategoryName || RPAD(' ', (16 - LENGTH(thisCategoryName)))||thisNoOfCars
||RPAD(' ', (18 - LENGTH(thisNoOfCars)))|| thisRevenue);
LOOP
FETCH CURSOR_REPORT INTO thisLocationID, thisCategoryName, thisNoOfCars, thisRevenue;
EXIT WHEN (CURSOR_REPORT%NOTFOUND);
IF thisLocationID = currentLocationID THEN
dbms_output.put_line(thisCategoryName || RPAD(' ', (16 - LENGTH(thisCategoryName)))||thisNoOfCars
||RPAD(' ', (18 - LENGTH(thisNoOfCars)))|| thisRevenue);
ELSE
currentLocationID := thisLocationID;
dbms_output.put_line(' ');
dbms_output.put_line('*********************************************************************************************************');
dbms_output.put_line(' ');
GOTO LABEL_NEXTLOC;
END IF;
END LOOP;
END IF;
END;
/
|
-- $$id$$ /^[0-9]+$/
SELECT * FROM mc_jobs WITH(nolock)
WHERE JobId = $$id$$
|
<filename>HW1&2.sql
## Course: Data Managment for Data Science
## DMDS HW1
## Group members: <NAME>, 1880156, <NAME>, 1852433
## Dataset info: https://relational.fit.cvut.cz/dataset/Pubs
use pubs;
##-------------------------------------------------------------------------------------------------------------------
## Q1&2-1: List of publishers that don't have business book
## Using “not exists”:
select *
from publishers
where not exists
(select *
from titles
where titles.pub_id = publishers.pub_id and type = 'business');
## There 4 publishers located in the USA and two in Germany and France
## Optimizing (Using View and index):
drop index i_type on titles;
create index i_type on titles(type);
create view business_pub_ids as
select pub_id
from titles
where type = 'business';
## Using “not in”:
select *
from publishers
where pub_id not in
(select *
from business_pub_ids
);
##-------------------------------------------------------------------------------------------------------------------
## Q1-2: List of publishers that have published books that have mod in their type
## Using “exists”, “Like”:
select *
from publishers
where exists
(select *
from titles
where type like '%mod%');
## Mostly the publishers have books of type %mod% are located in the USA
##-------------------------------------------------------------------------------------------------------------------
## Q1-3: Rasing the price by 10% for those books have total sale more than 500 Else decreasing by 5%
## Using “case when”, “group by”, “having” :
select * ,
case when title_id in (select titles.title_id
from titles inner join
sales on sales.title_id = titles.title_id
group by titles.title_id
having sum(qty*price) > 500) then price * 1.1
else price * .95
end as newPrice
from titles ;
## Comparing the columns price and newPrice we can see that mostly the new calculated price is less than previous price.
##-------------------------------------------------------------------------------------------------------------------
## Q1-4: TAX calculation for each book based on total sale
## If total sale is less than 200 then TAX = 0
## If total sale is less than 500 then TAX = (Total sale - 200)*5%
## If total sale is less than 800 then TAX = 15 + (Total sale - 500)*10%
## If total sale is less than 1000 then TAX = 45 + (Total sale - 800)*15%
## else TAX = 75 + (Total sale - 1000)*20%
## Using “case when”, “drived query”, “group by”
select * ,
case when SaleAmount < 200 then 0
when SaleAmount < 500 then 0 + (SaleAmount - 200) * .05
when SaleAmount < 800 then 0 + 15 + (SaleAmount - 500) * .10
when SaleAmount < 1000 then 0 + 15 + 30 + (SaleAmount - 800) * .15
else 0 + 15 + 30 + 30 + (SaleAmount - 1000) * .20
end as Tax
from
(select titles.title_id , title , sum(qty*price) as SaleAmount
from sales inner join titles on titles.title_id = sales.title_id
group by titles.title_id , title) as d ;
## Rarely we can find publishers that have to pay TAX more than 100$ based on TAX scenario defined above.
## And there exist publishers have not to pay TAX.
##-------------------------------------------------------------------------------------------------------------------
## Q1-5: Total Sale of publishers in diffrent years and in overall.
## Using “group by”, “rollup”, “YEAR”, “sum”:
select pub_name , YEAR(ord_date) as Year , sum(qty * price ) as TotalSale
from sales inner join
titles on titles.title_id = sales.title_id inner join
publishers on publishers.pub_id = titles.pub_id
group by pub_name , YEAR(ord_date)
with rollup;
## The ROLLUP generates the subtotal row every time the product line changes and the grand total at the end of the result.
## There are only 3 publishers that have sold books listed in titles table
## The results shows that each publishers almost sold same amount of books
## And the total sold per year is decreasing
##-------------------------------------------------------------------------------------------------------------------
## Q1&2-6: List of authors that don't have books
## Using “is null” :
select *
from authors
left join titleauthor on titleauthor.au_id = authors.au_id
where title_id is null; ##join
## Optimizing (Subquery instead of join):
select *
from authors
where au_id not in
(select au_id
from titleauthor); ##subquery
## There are 4 autors that haven't published any book yet
##-------------------------------------------------------------------------------------------------------------------
## Q1-7: List of books that have at least 2 authors in ascend order
## Using “Count”, “group by”, “having”, “order by”:
select titles.title_id , title , Count(au_id) as CountAu
from titles
inner join titleauthor on titleauthor.title_id = titles.title_id
group by titles.title_id , title
having Count(au_id) > 1
order by 3;
## Among those books have at least two co-authors, there is only one book with 3 authors and the remain books have only two co-authors
##-------------------------------------------------------------------------------------------------------------------
## Q1&2-8: Total sale of business books
## Using “where”, “group by”, “sum”:
select titles.title_id , title , sum(qty*price) as TotalSale
from titles inner join
sales on sales.title_id = titles.title_id
where type = 'business'
group by titles.title_id , title;
## Optimizing (Using View):
create view title_sale_view as
select titles.title_id , title, type , sum(qty*price) as TotalSale
from titles inner join
sales on sales.title_id = titles.title_id
group by titles.title_id , title , type
having type = 'business';
## Using “where”, “view”:
select title_id , title , TotalSale
from title_sale_view
where type = 'business';
## There are only 4 books of type business that 3 of them have been sold about 300$ and the book titled "You Cna Combat Comuter Stress!" has been sold just above 100$
##-------------------------------------------------------------------------------------------------------------------
## Q1&2-9: Pricing book based of various conditions:
## if publisher located in California then increase price by 10%
## if the book has more than 1 authors then increase price by 5%
## if the book is sold more than 200$ then increase price by 2%
## else decrease price by 1%
## Using “where”, “group by”, “sum”, "ELSE case when":
select title_id , title ,
case when pub_id in (select pub_id from publishers where state = 'CA') then price * 1.1
else case when title_id in (select title_id from titleauthor group by title_id having count(*) > 1) then price * 1.05
else case when title_id in (select titles.title_id
from titles inner join
sales on sales.title_id = titles.title_id
group by titles.title_id
having sum(qty*price) > 200) then price * 1.02
else price * .99
end end end as newPrice
from titles ;
## Optimizing (Using view):
create view titleauthor_view as
select title_id from titleauthor group by title_id having count(*) > 1;
create view title_view as
select titles.title_id
from titles inner join
sales on sales.title_id = titles.title_id
group by titles.title_id
having sum(qty*price) > 200;
## Using “where”, "view":
select title_id , title ,
case when pub_id in (select pub_id from publishers where state = 'CA') then price * 1.1
else case when title_id in (select * from titleauthor_view) then price * 1.05
else case when title_id in (select * from title_view) then price * 1.02
else price * .99
end end end as newPrice
from titles ;
##-------------------------------------------------------------------------------------------------------------------
## Q2-10: searching the information of the authors based on first and last name
## Optimizing (indexing):
create index i_composite ON authors(au_fname, au_lname);
drop index i_composite ON authors;
select * from authors where au_lname like "%t%" and au_fname like "%n%";
##-------------------------------------------------------------------------------------------------------------------
## Q2-11: Modifying employee table in order to have boss of each employee
## Optimizing (Using View and index and check constraint):
create view boss_view as
select emp_id, fname, minit, lname,
case when job_lvl > 150 then '<NAME>'
else '<NAME>'
end as boss, job_id, job_lvl, pub_id, hire_date
from employee;
select * from boss_view;
## Modifying table employee:
SET SQL_SAFE_UPDATES = 0;
alter table employee ADD
boss varchar(50) check (boss in ('<NAME>','<NAME>'))
AFTER lname;
alter table employee drop boss;
alter table employee modify hire_date date;
update employee
SET boss = '<NAME>'
WHERE job_lvl > 150;
update employee
SET boss = '<NAME>'
WHERE job_lvl <= 150;
select * from employee;
##--------------------------------------------------------------------------------------------------------------------
## Q2-12: Migrating the jobs data into JobR which has integrity constraints and hope to make query faster from JobR
## Lets suppose that jobs table is not well-disgned. We migrate the data in jobs table into JobR table and add constrain on values on creation of the table.
## Optimizing (Using Integrity Constrains):
create table JobR (jobID int Primary Key, JobDesc varchar(50) unique, MinLvl tinyint not null, MaxLvl tinyint not null);
insert into JobR select * from jobs where max_lvl > 100;
select * from JobR; |
CREATE TABLE `mountains` (
`id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50)
);
CREATE TABLE `peaks` (
`id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50),
`mountain_id` INT,
CONSTRAINT `fk_peaks+mountains` FOREIGN KEY (`mountain_id`)
REFERENCES `mountains` (`id`)
); |
<filename>sql_scripts/sd_service_schema.sql
CREATE TABLE `option` (
`key` varchar(128) NOT NULL,
`value` varchar(128) DEFAULT NULL,
`set_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`set_by` varchar(128) DEFAULT NULL,
PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
INSERT INTO `option` (`key`, `value`) VALUES ('token', ''); |
<reponame>na0fu3y/bqfunc<gh_stars>1-10
CREATE OR REPLACE FUNCTION zerobyte.ARRAY_FLOAT64_TO_ZEROBYTE(a ARRAY< FLOAT64 >)
AS (
ARRAY(
SELECT AS STRUCT
zerobyte.FLOAT64_TO_ZEROBYTE(f) AS _
FROM
UNNEST(a) AS f WITH OFFSET AS o
ORDER BY o)
);
|
-- file:strings.sql ln:62 expect:true
SELECT E'\\xDe00BeEf'::bytea
|
<reponame>bbchristians/SATDMiner
DROP TABLE IF EXISTS satd.Commits, satd.SATD, satd.SATDInFile, satd.Projects;
CREATE TABLE IF NOT EXISTS satd.Projects (
p_id INT AUTO_INCREMENT NOT NULL,
p_name VARCHAR(255) NOT NULL UNIQUE,
p_url VARCHAR(255) NOT NULL UNIQUE,
PRIMARY KEY (p_id)
);
CREATE TABLE IF NOT EXISTS satd.SATDInFile (
f_id INT AUTO_INCREMENT,
f_comment VARCHAR(4096),
f_comment_type VARCHAR(32),
f_path VARCHAR(512),
start_line INT,
end_line INT,
containing_class VARCHAR(512),
containing_method VARCHAR(512),
PRIMARY KEY (f_id)
);
CREATE TABLE IF NOT EXISTS satd.Commits(
commit_hash varchar(256),
p_id INT,
author_name varchar(256),
author_email varchar(256),
author_date DATETIME,
committer_name varchar(256),
committer_email varchar(256),
commit_date DATETIME,
PRIMARY KEY (p_id, commit_hash),
FOREIGN KEY (p_id) REFERENCES Projects(p_id)
);
CREATE TABLE IF NOT EXISTS satd.SATD (
satd_id INT AUTO_INCREMENT,
satd_instance_id INT, -- Not a key value, used only to associate SATD Instances
parent_instance_id INT,
p_id INT,
first_commit varchar(256),
second_commit varchar(256),
first_file INT,
second_file INT,
resolution VARCHAR(64),
PRIMARY KEY (satd_id),
FOREIGN KEY (p_id) REFERENCES satd.Projects(p_id),
FOREIGN KEY (p_id, first_commit) REFERENCES satd.Commits(p_id, commit_hash),
FOREIGN KEY (p_id, second_commit) REFERENCES satd.Commits(p_id, commit_hash),
FOREIGN KEY (first_file) REFERENCES satd.SATDInFile(f_id),
FOREIGN KEY (second_file) REFERENCES satd.SATDInFile(f_id)
);
|
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
DROP SCHEMA IF EXISTS `high` ;
CREATE SCHEMA IF NOT EXISTS `high` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `high` ;
-- -----------------------------------------------------
-- Table `high`.`technicians`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`technicians` ;
CREATE TABLE IF NOT EXISTS `high`.`technicians` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(100) NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`prep_methods`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`prep_methods` ;
CREATE TABLE IF NOT EXISTS `high`.`prep_methods` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`description` VARCHAR(100) NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`qc_types`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`qc_types` ;
CREATE TABLE IF NOT EXISTS `high`.`qc_types` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`matrices`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`matrices` ;
CREATE TABLE IF NOT EXISTS `high`.`matrices` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`clients`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`clients` ;
CREATE TABLE IF NOT EXISTS `high`.`clients` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`billing_address` VARCHAR(100) NULL ,
`shipping_address` VARCHAR(100) NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`sdgs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`sdgs` ;
CREATE TABLE IF NOT EXISTS `high`.`sdgs` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`client_id` INT UNSIGNED NOT NULL ,
`technician_id` INT UNSIGNED NULL ,
`datetime_received` DATETIME NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_sdgs_clients1` (`client_id` ASC) ,
INDEX `fk_sdgs_technicians1` (`technician_id` ASC) ,
CONSTRAINT `fk_sdgs_clients1`
FOREIGN KEY (`client_id` )
REFERENCES `high`.`clients` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_sdgs_technicians1`
FOREIGN KEY (`technician_id` )
REFERENCES `high`.`technicians` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`samples`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`samples` ;
CREATE TABLE IF NOT EXISTS `high`.`samples` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`datetime_collected` DATETIME NULL ,
`client_sample_name` VARCHAR(45) NULL ,
`qc_type_id` INT UNSIGNED NOT NULL ,
`matrix_id` INT UNSIGNED NOT NULL ,
`sdg_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_samples_qc_types1` (`qc_type_id` ASC) ,
INDEX `fk_samples_matrices1` (`matrix_id` ASC) ,
INDEX `fk_samples_sdgs1` (`sdg_id` ASC) ,
CONSTRAINT `fk_samples_qc_types1`
FOREIGN KEY (`qc_type_id` )
REFERENCES `high`.`qc_types` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_samples_matrices1`
FOREIGN KEY (`matrix_id` )
REFERENCES `high`.`matrices` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_samples_sdgs1`
FOREIGN KEY (`sdg_id` )
REFERENCES `high`.`sdgs` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`units`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`units` ;
CREATE TABLE IF NOT EXISTS `high`.`units` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(10) NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`preps`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`preps` ;
CREATE TABLE IF NOT EXISTS `high`.`preps` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`quantity` VARCHAR(45) NULL ,
`datetime` DATETIME NULL ,
`initial_volume_ml` DECIMAL(7,4) NULL ,
`initial_mass_g` DECIMAL(9,5) NULL ,
`prep_method_id` INT UNSIGNED NOT NULL ,
`sample_id` INT UNSIGNED NOT NULL ,
`technician_id` INT UNSIGNED NOT NULL ,
`unit_id` INT UNSIGNED NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_preps_prep_methods1` (`prep_method_id` ASC) ,
INDEX `fk_preps_samples1` (`sample_id` ASC) ,
INDEX `fk_preps_technicians1` (`technician_id` ASC) ,
INDEX `fk_preps_units1` (`unit_id` ASC) ,
CONSTRAINT `fk_preps_prep_methods1`
FOREIGN KEY (`prep_method_id` )
REFERENCES `high`.`prep_methods` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_preps_samples1`
FOREIGN KEY (`sample_id` )
REFERENCES `high`.`samples` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_preps_technicians1`
FOREIGN KEY (`technician_id` )
REFERENCES `high`.`technicians` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_preps_units1`
FOREIGN KEY (`unit_id` )
REFERENCES `high`.`units` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`test_methods`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`test_methods` ;
CREATE TABLE IF NOT EXISTS `high`.`test_methods` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`description` VARCHAR(100) NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`tests`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`tests` ;
CREATE TABLE IF NOT EXISTS `high`.`tests` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`datetime` DATETIME NOT NULL ,
`dilution` DECIMAL(10,3) NOT NULL DEFAULT 1.000 ,
`prep_id` INT UNSIGNED NOT NULL ,
`test_method_id` INT UNSIGNED NOT NULL ,
`technician_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_tests_preps1` (`prep_id` ASC) ,
INDEX `fk_tests_test_methods1` (`test_method_id` ASC) ,
INDEX `fk_tests_technicians1` (`technician_id` ASC) ,
CONSTRAINT `fk_tests_preps1`
FOREIGN KEY (`prep_id` )
REFERENCES `high`.`preps` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tests_test_methods1`
FOREIGN KEY (`test_method_id` )
REFERENCES `high`.`test_methods` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tests_technicians1`
FOREIGN KEY (`technician_id` )
REFERENCES `high`.`technicians` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`analytes`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`analytes` ;
CREATE TABLE IF NOT EXISTS `high`.`analytes` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`cas_number` VARCHAR(45) NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`parm_types`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`parm_types` ;
CREATE TABLE IF NOT EXISTS `high`.`parm_types` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`test_results`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`test_results` ;
CREATE TABLE IF NOT EXISTS `high`.`test_results` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`value` DECIMAL(12,7) NULL ,
`flag` VARCHAR(8) NULL ,
`unit_id` INT UNSIGNED NOT NULL ,
`analyte_id` INT UNSIGNED NOT NULL ,
`test_id` INT UNSIGNED NOT NULL ,
`parm_type_id` INT UNSIGNED NOT NULL ,
`mdl` DECIMAL(12,7) NULL ,
`rl` DECIMAL(12,7) NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_test_results_units1` (`unit_id` ASC) ,
INDEX `fk_test_results_analytes1` (`analyte_id` ASC) ,
INDEX `fk_test_results_tests1` (`test_id` ASC) ,
INDEX `fk_test_results_parm_types1` (`parm_type_id` ASC) ,
CONSTRAINT `fk_test_results_units1`
FOREIGN KEY (`unit_id` )
REFERENCES `high`.`units` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_test_results_analytes1`
FOREIGN KEY (`analyte_id` )
REFERENCES `high`.`analytes` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_test_results_tests1`
FOREIGN KEY (`test_id` )
REFERENCES `high`.`tests` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_test_results_parm_types1`
FOREIGN KEY (`parm_type_id` )
REFERENCES `high`.`parm_types` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `high`.`bucket`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `high`.`bucket` ;
CREATE TABLE IF NOT EXISTS `high`.`bucket` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`clientname` VARCHAR(45) NULL ,
`labsampid` VARCHAR(45) NULL ,
`core_id` VARCHAR(45) NULL ,
`clientsampid` VARCHAR(45) NULL ,
`collection_date` DATETIME NULL ,
`qctype` VARCHAR(45) NULL ,
`parm_type` VARCHAR(45) NULL ,
`parm_syn` VARCHAR(45) NULL ,
`numvalue` DECIMAL(12,7) NULL ,
`units` VARCHAR(10) NULL ,
`qual` VARCHAR(8) NULL ,
`rdlvalue` DECIMAL(12,7) NULL ,
`dilution` DECIMAL(10,3) NULL ,
`cas_no` VARCHAR(45) NULL ,
`methodref` VARCHAR(45) NULL ,
`prepmethodref` VARCHAR(45) NULL ,
`matrix` VARCHAR(45) NULL ,
`extract_date` DATE NULL ,
`run_date` DATETIME NULL ,
`prepbatch` VARCHAR(45) NULL ,
`analyst` VARCHAR(45) NULL ,
`receivedate` DATE NULL ,
`mdlvalue` DECIMAL(12,7) NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
CREATE OR REPLACE PROCEDURE DW_GET_SPONSOR_TYPE
( cur_sponsor_type IN OUT result_sets.cur_generic) is
begin
open cur_sponsor_type for
select *
from osp$sponsor_type
order by sponsor_type_code asc;
end;
/
|
BEGIN;
\i Base.sql
-- This function is vulnerable to SQL injection but it is transient for the
-- purposes of these test cases. In particular it is intended only to ensure
-- that basic permissions are tested.
--
-- IT IS THE RESPONSIBILITY OF TEST CASE AUTHORS TO ENSURE THAT THE USAGE OF
-- THIS FUNCTION IS SAFE.
CREATE OR REPLACE FUNCTION test__has_select_permission
(rolname name, relspec text)
returns bool language plpgsql as
$$
BEGIN
EXECUTE 'SET SESSION AUTHORIZATION ' || lsmb__role(rolname);
EXECUTE 'SELECT * FROM ' || relspec || ' LIMIT 1';
RESET SESSION AUTHORIZATION;
RETURN TRUE;
EXCEPTION
WHEN insufficient_privilege THEN
RESET SESSION AUTHORIZATION;
RETURN FALSE;
END;
$$;
-- READ PERMISSIONS
INSERT INTO test_result (test_name, success)
SELECT 'budget_view can read budget_info',
test__has_select_permission('budget_view', 'budget_info');
INSERT INTO test_result (test_name, success)
SELECT 'budget_view can read budget_info',
test__has_select_permission('budget_view', 'budget_line');
INSERT INTO test_result (test_name, success)
SELECT 'file_read can read file_base',
test__has_select_permission('file_read', 'file_base');
INSERT INTO test_result (test_name, success)
SELECT 'file_read can read file_links',
test__has_select_permission('file_read', 'file_links');
INSERT INTO test_result (test_name, success)
SELECT 'file_read can read file_secondary_transaction',
test__has_select_permission('file_read', 'file_secondary_attachment');
INSERT INTO test_result (test_name, success)
SELECT 'file_read can read file_order',
test__has_select_permission('file_read', 'file_order');
INSERT INTO test_result (test_name, success)
SELECT 'file_read can read file_part',
test__has_select_permission('file_read', 'file_part');
INSERT INTO test_result(test_name, success)
SELECT 'contact_read can read ' || t,
test__has_select_permission('contact_read', t)
FROM unnest(ARRAY['partsvendor'::text, 'partscustomer', 'taxcategory',
'entity', 'company', 'location', 'entity_to_location',
'entity_to_contact', 'person', 'entity_credit_account',
'contact_class', 'eca_tax', 'entity_class', 'entity_note',
'entity_bank_account', 'entity_other_name', 'location_class',
'person_to_company', 'eca_to_contact', 'eca_to_location', 'eca_note',
'pricegroup'
]) t;
INSERT INTO test_result(test_name, success)
SELECT 'ar_transaction_list can read ' || t,
test__has_select_permission('ar_transaction_list', t)
FROM unnest(ARRAY['partsvendor'::text, 'partscustomer', 'taxcategory',
'entity', 'company', 'location', 'entity_to_location',
'entity_to_contact', 'person', 'entity_credit_account',
'contact_class', 'eca_tax', 'entity_class', 'entity_note',
'entity_bank_account', 'entity_other_name', 'location_class',
'person_to_company', 'eca_to_contact', 'eca_to_location', 'eca_note',
'ar', 'acc_trans', 'invoice', 'ac_tax_form', 'invoice_tax_form'
]) t;
INSERT INTO test_result(test_name, success)
SELECT 'ap_transaction_list can read ' || t,
test__has_select_permission('ap_transaction_list', t)
FROM unnest(ARRAY['partsvendor'::text, 'partscustomer', 'taxcategory',
'entity', 'company', 'location', 'entity_to_location',
'entity_to_contact', 'person', 'entity_credit_account',
'contact_class', 'eca_tax', 'entity_class', 'entity_note',
'entity_bank_account', 'entity_other_name', 'location_class',
'person_to_company', 'eca_to_contact', 'eca_to_location', 'eca_note',
'ap', 'acc_trans', 'invoice', 'ac_tax_form', 'invoice_tax_form'
]) t;
INSERT INTO test_result(test_name, success)
SELECT 'sales_order_list can read ' || t,
test__has_select_permission('sales_order_list', t)
FROM unnest(ARRAY['partsvendor'::text, 'partscustomer', 'taxcategory',
'entity', 'company', 'location', 'entity_to_location',
'entity_to_contact', 'person', 'entity_credit_account',
'contact_class', 'eca_tax', 'entity_class', 'entity_note',
'entity_bank_account', 'entity_other_name', 'location_class',
'person_to_company', 'eca_to_contact', 'eca_to_location', 'eca_note',
'oe', 'orderitems'
]) t;
INSERT INTO test_result(test_name, success)
SELECT 'purchase_order_list can read ' || t,
test__has_select_permission('purchase_order_list', t)
FROM unnest(ARRAY['partsvendor'::text, 'partscustomer', 'taxcategory',
'entity', 'company', 'location', 'entity_to_location',
'entity_to_contact', 'person', 'entity_credit_account',
'contact_class', 'eca_tax', 'entity_class', 'entity_note',
'entity_bank_account', 'entity_other_name', 'location_class',
'person_to_company', 'eca_to_contact', 'eca_to_location', 'eca_note',
'oe', 'orderitems'
]) t;
INSERT INTO test_result(test_name, success)
SELECT 'inventory_reports can read ' || t,
test__has_select_permission('inventory_reports', t)
FROM unnest(array['ar'::text, 'ap', 'warehouse_inventory', 'invoice', 'acc_trans']) t;
INSERT INTO test_result(test_name, success)
SELECT 'gl_reports can read ' || t,
test__has_select_permission('gl_reports', t)
FROM unnest(array['gl'::text, 'acc_trans', 'account_checkpoint', 'ar', 'ap',
'entity', 'entity_credit_account'])t;
INSERT INTO test_result(test_name, success)
SELECT 'financial_reports can read ' || t,
test__has_select_permission('financial_reports', t)
FROM unnest(array['gl'::text, 'acc_trans', 'account_checkpoint', 'ar', 'ap',
'entity', 'entity_credit_account', 'cash_impact'])t;
-- TEST RESULTS
SELECT test_name, success FROM test_result;
SELECT (select count(*) from test_result where success is true)
|| ' tests passed and '
|| (select count(*) from test_result where success is not true)
|| ' failed' as message;
ROLLBACK;
|
CREATE ROLE ROLE_JDE_WS_RO;
create user JDE_WS_RO identified by "U2Band" ACCOUNT UNLOCK;
alter user JDE_WS_RO profile "APP_NO_EXPIRE_PW";
grant connect to JDE_WS_RO;
GRANT ROLE_JDE_WS_RO TO JDE_WS_RO;
-- jdeprod
--GRANT SELECT ON PRODDTA.F06146 TO ROLE_JDE_WS_RO;
--jdedev
--GRANT SELECT ON TESTDTA.F06146 TO ROLE_JDE_WS_RO;
--jdetest
--GRANT SELECT ON CRPDTA.F06146 TO ROLE_JDE_WS_RO;
|
-------------------------------------------------------------------------------
-- notification queue
-------------------------------------------------------------------------------
CREATE TABLE NOTIFICATION_QUEUE(
ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL,
CODE VARCHAR(50),
NAME VARCHAR(50),
CONTENT VARCHAR(65535),
PRIORITY INT,
CREATE_TIME TIMESTAMP,
CREATOR VARCHAR(64),
UPDATE_TIME TIMESTAMP,
UPDATER VARCHAR(64),
STATUS VARCHAR(50),
APP VARCHAR(50),
WEIGHT INT,
CONFIG_ID BIGINT,
CONSTRAINT PK_NOTIFICATION_QUEUE PRIMARY KEY(ID),
CONSTRAINT FK_NOTIFICATION_QUEUE_CONFIG FOREIGN KEY (CONFIG_ID) REFERENCES NOTIFICATION_CONFIG(ID)
);
COMMENT ON TABLE NOTIFICATION_QUEUE IS '通知队列';
COMMENT ON COLUMN NOTIFICATION_QUEUE.ID IS 'id';
COMMENT ON COLUMN NOTIFICATION_QUEUE.CODE IS '编码';
COMMENT ON COLUMN NOTIFICATION_QUEUE.NAME IS '名称';
COMMENT ON COLUMN NOTIFICATION_QUEUE.CONTENT IS '内容';
COMMENT ON COLUMN NOTIFICATION_CONFIG.PRIORITY IS '优先级';
COMMENT ON COLUMN NOTIFICATION_QUEUE.CREATE_TIME IS '创建时间';
COMMENT ON COLUMN NOTIFICATION_QUEUE.CREATOR IS '创建人';
COMMENT ON COLUMN NOTIFICATION_QUEUE.UPDATE_TIME IS '更新时间';
COMMENT ON COLUMN NOTIFICATION_QUEUE.UPDATER IS '更新人';
COMMENT ON COLUMN NOTIFICATION_QUEUE.STATUS IS '状态';
COMMENT ON COLUMN NOTIFICATION_QUEUE.APP IS 'APP';
COMMENT ON COLUMN NOTIFICATION_QUEUE.WEIGHT IS '权重';
COMMENT ON COLUMN NOTIFICATION_QUEUE.CONFIG_ID IS '配置id';
|
<filename>sql_tables.sql
-- id, version and all of the info fields, will need to find all the fields
CREATE TABLE IF NOT EXISTS info (
gameid VARCHAR(12) NOT NULL,
version_number INT NOT NULL,
attendance TEXT,
date TEXT,
daynight TEXT,
fieldcond TEXT,
hometeam TEXT,
howscored TEXT,
lp TEXT,
number TEXT,
oscorer TEXT,
pitches TEXT,
precip TEXT,
save TEXT,
site TEXT,
sky TEXT,
starttime TEXT,
temp TEXT,
timeofgame TEXT,
ump1b TEXT,
ump2b TEXT,
ump3b TEXT,
umphome TEXT,
usedh TEXT,
visteam TEXT,
winddir TEXT,
windspeed TEXT,
wp TEXT,
PRIMARY KEY (gameid)
);
-- All of the starts
CREATE TABLE IF NOT EXISTS start (
gameid VARCHAR(12) NOT NULL,
player_code VARCHAR(10) NOT NULL,
player_name TEXT NOT NULL,
home_field_indicator INT(1) NOT NULL,
batting_order INT(2) NOT NULL,
field_position INT(2) NOT NULL,
PRIMARY KEY (gameid, player_code)
);
-- All of the subs in the game
CREATE TABLE IF NOT EXISTS subs (
event_count INT(3) NOT NULL,
gameid VARCHAR(12) NOT NULL,
player_code VARCHAR(10) NOT NULL,
player_name TEXT NOT NULL,
home_field_indicator INT(1) NOT NULL,
batting_order INT(2) NOT NULL,
field_position INT(2) NOT NULL,
PRIMARY KEY (gameid, event_count)
);
-- All of the data fields
CREATE TABLE IF NOT EXISTS data (
gameid VARCHAR(12) NOT NULL,
type TEXT NOT NULL,
player_code VARCHAR(10) NOT NULL,
earned_runs INT(3) NOT NULL,
PRIMARY KEY (gameid, player_code)
);
-- All of the play fields
CREATE TABLE IF NOT EXISTS plays (
gameid VARCHAR(12) NOT NULL,
event_count INT(3) NOT NULL,
inning_number INT(2) NOT NULL,
home_field_indicator INT(1) NOT NULL,
player_code VARCHAR(10) NOT NULL,
count_at_action VARCHAR(2) NOT NULL,
all_pitches TEXT,
play_events TEXT NOT NULL,
PRIMARY KEY (gameid, event_count)
);
|
alter table budget alter column budget_goal_percent type numeric(5,2);
alter table budget alter column scenario_percent type numeric(5,2);
|
UPDATE sp_app
SET
app_name = 'My Account',
is_saas_app = 1,
description = 'This is the my account application.'
WHERE
ID = (SELECT APP_ID FROM SP_INBOUND_AUTH WHERE INBOUND_AUTH_KEY = 'USER_PORTAL' AND TENANT_ID = -1234);
ALTER TABLE idn_oidc_property
ADD CONSTRAINT idn_oidc_property_consumer_key_fk_cascade
FOREIGN KEY (CONSUMER_KEY) REFERENCES IDN_OAUTH_CONSUMER_APPS(CONSUMER_KEY) ON DELETE CASCADE ON UPDATE CASCADE;
UPDATE idn_oauth_consumer_apps
SET
consumer_key= 'MY_ACCOUNT',
callback_url = REPLACE(callback_url, 'user-portal/login', 'myaccount/login'),
app_name = 'My Account'
WHERE
consumer_key = 'USER_PORTAL' AND tenant_id = -1234;
ALTER TABLE idn_oidc_property
DROP CONSTRAINT idn_oidc_property_consumer_key_fk_cascade;
DELETE FROM IDN_OIDC_PROPERTY WHERE TENANT_ID = -1234 AND CONSUMER_KEY = 'MY_ACCOUNT' AND PROPERTY_KEY = 'tokenRevocationWithIDPSessionTermination';
DELETE FROM IDN_OIDC_PROPERTY WHERE TENANT_ID = -1234 AND CONSUMER_KEY = 'MY_ACCOUNT' AND PROPERTY_KEY = 'tokenBindingValidation';
DELETE FROM IDN_OIDC_PROPERTY WHERE TENANT_ID = -1234 AND CONSUMER_KEY = 'MY_ACCOUNT' AND PROPERTY_KEY = 'tokenBindingType';
INSERT INTO IDN_OIDC_PROPERTY (TENANT_ID, CONSUMER_KEY, PROPERTY_KEY, PROPERTY_VALUE)
SELECT -1234, 'MY_ACCOUNT', 'tokenRevocationWithIDPSessionTermination', 'true'
WHERE EXISTS (SELECT * FROM idn_oauth_consumer_apps WHERE idn_oauth_consumer_apps.consumer_key = 'MY_ACCOUNT');
INSERT INTO IDN_OIDC_PROPERTY (TENANT_ID, CONSUMER_KEY, PROPERTY_KEY, PROPERTY_VALUE)
SELECT -1234, 'MY_ACCOUNT', 'tokenBindingValidation', 'true'
WHERE EXISTS (SELECT * FROM idn_oauth_consumer_apps WHERE idn_oauth_consumer_apps.consumer_key = 'MY_ACCOUNT');
INSERT INTO IDN_OIDC_PROPERTY (TENANT_ID, CONSUMER_KEY, PROPERTY_KEY, PROPERTY_VALUE)
SELECT -1234, 'MY_ACCOUNT', 'tokenBindingType', 'sso-session'
WHERE EXISTS (SELECT * FROM idn_oauth_consumer_apps WHERE idn_oauth_consumer_apps.consumer_key = 'MY_ACCOUNT');
UPDATE sp_inbound_auth
SET
inbound_auth_key = 'MY_ACCOUNT'
WHERE
inbound_auth_key = 'USER_PORTAL' AND tenant_id=-1234;
DELETE FROM sp_app WHERE app_name = 'User Portal'AND tenant_id <> -1234;
DELETE FROM sp_inbound_auth WHERE inbound_auth_key = 'User Portal' AND tenant_id = -1234;
DELETE FROM idn_oauth_consumer_apps WHERE consumer_key LIKE 'USER_PORTAL%.com' AND tenant_id <> -1234;
|
<gh_stars>1-10
\set VERBOSITY terse
set client_min_messages to WARNING;
SELECT topology.CreateTopology('2d') > 0;
SELECT topology.CreateTopology('2dAgain', -1, 0, false) > 0;
SELECT topology.CreateTopology('3d', -1, 0, true) > 0;
SELECT topology.CreateTopology('3d'); -- already exists
SELECT name,srid,precision,hasz from topology.topology
WHERE name in ('2d', '2dAgain', '3d' )
ORDER by name;
-- Only 3dZ accepted in 3d topo
SELECT topology.AddNode('3d', 'POINT(0 0)');
SELECT topology.AddNode('3d', 'POINTM(1 1 1)');
SELECT topology.AddNode('3d', 'POINT(2 2 2)');
-- Only 2d accepted in 2d topo
SELECT topology.AddNode('2d', 'POINTM(0 0 0)');
SELECT topology.AddNode('2d', 'POINT(1 1 1)');
SELECT topology.AddNode('2d', 'POINT(2 2)');
SELECT topology.DropTopology('2d');
SELECT topology.DropTopology('2dAgain');
SELECT topology.DropTopology('3d');
|
<reponame>opengauss-mirror/Yat
-- @testpoint: 创建存储过程时使用authid current_user
--创建存储过程
create or replace procedure pro(p1 integer) authid current_user
is
c1 varchar(10);
begin
c1 := 'gauss';
raise info '-%',c1;
raise info ':%',p1;
end;
/
--调用存储过程
call pro(10);
--清理环境
drop procedure pro;
--创建存储过程时使用 security invoker
create or replace procedure pro(p1 integer) called on null input security invoker
is
c1 varchar(10);
begin
c1 := 'gauss';
raise info '-%',c1;
raise info ':%',p1;
end;
/
--调用存储过程
call pro(10);
--清理环境
drop procedure pro; |
<gh_stars>0
Select b.name,count(*) as num
From artist a,area as b
Where a.begin_date_year<1850 and a.area=b.id
Group by a.area
Order by num desc
limit 10; |
insert into city values
(6358505,"Linares","ES",-3.64455,38.09734),
(2515045,"Linares","ES",-3.63602,38.095188),
(6359636,"Noáin (Valle de Elorz)/Noain (Elortzibar)","ES",-1.59375,42.739079),
(3108398,"Tajonar","ES",-1.6081,42.76878),
(6357912,"Guadalajara","ES",-3.17188,40.64362),
(3121070,"Guadalajara","ES",-3.16667,40.633331),
(3124132,"Cuenca","ES",-2.13333,40.066669),
(6356919,"Algeciras","ES",-5.45284,36.105492),
(2522013,"Algeciras","ES",-5.45051,36.133259),
(6356935,"<NAME>","ES",-6.13277,36.696869),
(2516326,"<NAME>","ES",-6.13606,36.686451),
(6362988,"Melilla","ES",-2.94434,35.292149),
(7577101,"Melilla","ES",-2.9409,35.29187),
(2513947,"Melilla","ES",-2.93833,35.29369),
(2519582,"Ceuta","ES",-5.3075,35.890282),
(3120954,"Guillén","ES",-7.15658,42.820621),
(6355322,"<NAME>","ES",-2.09755,38.44268),
(2517404,"Gallego","ES",-2.01042,38.412842),
(3111825,"<NAME>","ES",2.16757,42.304169),
(6359931,"Grado","ES",-6.09978,43.3134),
(3105576,"Villagarcía","ES",-6.10296,43.333038),
(6359834,"<NAME>","ES",-7.85583,41.936272),
(3105965,"Vilá","ES",-7.86743,41.990162),
(6360665,"Cartes","ES",-4.09372,43.316299),
(3111684,"Ríocorvo","ES",-4.07169,43.310589),
(6355725,"Martínez","ES",-5.35497,40.63092),
(3117340,"Martinez","ES",-5.34801,40.630459),
(6360237,"Pontevedra","ES",-8.61925,42.422409),
(3116000,"Mourente","ES",-8.61667,42.433331),
(3118547,"Lena","ES",-5.73333,43.099998),
(3123388,"El Palacio","ES",-5.8035,43.127682),
(6359291,"Getafe","ES",-3.65978,40.294628),
(6544483,"El Bercial","ES",-3.73587,40.323639),
(6359203,"Pastoriza (A)","ES",-7.33442,43.29007),
(3128649,"Barral","ES",-7.28798,43.267281),
(6360973,"Brenes","ES",-5.88182,37.55394),
(2520798,"Brenes","ES",-5.87139,37.549438),
(3117580,"Manán","ES",-7.47204,42.926418),
(3115063,"Onate","ES",-2.40997,43.032619),
(6325233,"<NAME>","ES",-2.40289,43.033272),
(6357202,"Baena","ES",-4.33456,37.656368),
(2521415,"Baena","ES",-4.32245,37.616699),
(6362069,"Puig","ES",-0.31541,39.593029),
(2512162,"Puig","ES",-0.30333,39.588692),
(6358125,"Hondarribia","ES",-1.82397,43.374889),
(3120304,"Irun","ES",-1.78938,43.339039),
(6325088,"Kostorbe","ES",-1.78974,43.346088),
(3115193,"<NAME>","ES",-1.58333,42.816669),
(2513115,"Onda","ES",-0.25,39.966671),
(2515989,"La Esperanza","ES",-16.369221,28.450729),
(3129697,"Areas","ES",-8.65,42.033329),
(6359954,"Pravia","ES",-6.1508,43.490631),
(3124513,"Corralinos","ES",-6.11667,43.48333),
(6358122,"Elgoibar","ES",-2.4069,43.211391),
(3123478,"Elgoibar","ES",-2.41334,43.216011),
(6359933,"Ibias","ES",-6.85419,43.013111),
(3107219,"Uría","ES",-6.85221,43.077782),
(6356705,"Alcántara","ES",-6.8622,39.72319),
(2522155,"Alcantara","ES",-6.88376,39.718948),
(6356143,"Martorell","ES",1.91986,41.478802),
(3117331,"Martorell","ES",1.93062,41.474018),
(3106974,"Valdecilla","ES",-3.73158,43.383469),
(6355300,"Alcaraz","ES",-2.52205,38.685242),
(2515519,"<NAME>","ES",-2.28417,38.510342),
(3129133,"<NAME>","ES",-5.93333,43.566669),
(3129135,"Aviles","ES",-5.92483,43.554729),
(6533954,"Manacor","ES",3.20857,39.56881),
(2514216,"Manacor","ES",3.20955,39.569641),
(6355457,"Jalón/Xaló","ES",-0.0366,38.721588),
(2522051,"Alfarería","ES",-0.01667,38.73333),
(6357764,"<NAME>","ES",-3.81138,37.23106),
(2521715,"Ánsola","ES",-3.78144,37.250488),
(6360718,"<NAME>","ES",-3.89898,43.46064),
(3110792,"Sancibrián","ES",-3.88703,43.460789),
(6358201,"Cortegana","ES",-6.89718,37.861698),
(2511089,"San Telmo","ES",-6.96756,37.79554),
(3113209,"Pontevedra","ES",-8.64435,42.431),
(3117216,"<NAME>","ES",-0.65081,40.18919),
(6358406,"<NAME>","ES",-0.33832,42.786152),
(3111001,"<NAME>","ES",-0.33448,42.771271),
(6358106,"Ataun","ES",-2.15437,42.979641),
(3129203,"Ataun","ES",-2.17663,43.006119),
(6324904,"Basterola","ES",-2.16019,43.01754),
(6355469,"La Nucia","ES",-0.12772,38.613522),
(2515701,"la Nucia","ES",-0.1269,38.61372),
(6357099,"<NAME> San Juan","ES",-3.26386,39.27877),
(2522131,"Alca<NAME>","ES",-3.20827,39.39011),
(6361878,"Alboraya","ES",-0.33802,39.504532),
(2522203,"Alboraya","ES",-0.35,39.5),
(6356205,"Ripollet","ES",2.1557,41.501209),
(3111605,"Ripollet","ES",2.15739,41.496861),
(2522437,"Adeje","ES",-16.726,28.122709),
(2521088,"Benidorm","ES",-0.13098,38.538158),
(2511150,"<NAME>","ES",-15.54071,27.911739),
(6361290,"Constantí","ES",1.21056,41.15358),
(6359063,"Herramélluri","ES",-3.01304,42.502941),
(3120803,"Herramelluri","ES",-3.01954,42.502949),
(6355282,"Valdegovía","ES",-3.10121,42.851101),
(3128610,"Barrio","ES",-3.089,42.808449),
(3105790,"Bildosola","ES",-2.78333,43.133331),
(3112769,"Puente","ES",-7.56667,43),
(6357104,"Alhambra","ES",-3.03357,38.942429),
(2514537,"Los Peralejos","ES",-3.05,38.900002),
(6358144,"Arrasate/Mondragón","ES",-2.48415,43.07452),
(3107337,"Udala","ES",-2.51249,43.077782),
(6358109,"Azpeitia","ES",-2.25179,43.162411),
(3129059,"Azpeitia","ES",-2.26693,43.182461),
(6359547,"Yecla","ES",-1.1296,38.65514),
(2509402,"Yecla","ES",-1.11468,38.613651),
(6361381,"<NAME>","ES",1.39142,41.5466),
(3130811,"Aguiló","ES",1.41838,41.55278),
(6361014,"<NAME>","ES",-6.07384,37.335758),
(2514287,"<NAME>","ES",-6.06391,37.344608),
(3122357,"Folgueras","ES",-5.8,43.383331),
(3114227,"<NAME>","ES",-1.93016,43.324421),
(6325325,"Zamatete","ES",-1.92956,43.325359),
(6357301,"Culleredo","ES",-8.37739,43.276711),
(3109052,"Sésamo","ES",-8.38333,43.283329),
(6357278,"Bergondo","ES",-8.23376,43.323109),
(3128190,"Bergondo","ES",-8.23333,43.316669),
(6356943,"<NAME>","ES",-6.14715,36.532211),
(2512169,"<NAME>","ES",-6.19011,36.528191),
(6357314,"Mazaricos","ES",-8.98567,42.942829),
(3126759,"Campolongo","ES",-8.90453,42.917728),
(6359174,"Cervantes","ES",-6.98393,42.84066),
(3110092,"<NAME>","ES",-7.06261,42.86932),
(6356036,"<NAME>","ES",1.29364,38.920551),
(2511352,"<NAME>","ES",1.28333,38.916672),
(6360663,"Camargo","ES",-3.85983,43.42054),
(3115855,"Muriedas","ES",-3.8593,43.429642),
(6361051,"Valencina de la Concepción","ES",-6.06969,37.419338),
(2509946,"Valencina de la Concepcion","ES",-6.07422,37.41618),
(6357749,"Motril","ES",-3.47028,36.736431),
(2513477,"Motril","ES",-3.5179,36.75066),
(6358808,"<NAME>","ES",1.75848,42.377071),
(3128333,"<NAME>","ES",1.78333,42.366669),
(3130760,"Aizoáin","ES",-1.63333,42.849998),
(6360292,"Armenteros","ES",-5.48272,40.612061),
(3129504,"Armenteros","ES",-5.44806,40.593201),
(6355292,"Lantarón","ES",-3.03037,42.758911),
(3111072,"Salcedo","ES",-2.96368,42.734291),
(6360637,"<NAME>","ES",-16.617849,28.09712),
(2515876,"La Hoya","ES",-16.6161,28.081261),
(6359526,"<NAME>","ES",-1.17411,37.749039),
(2520230,"Cánovas","ES",-1.27948,37.7356),
(6358508,"<NAME>","ES",-3.60115,37.863522),
(2509434,"Vista Alegre","ES",-3.61667,37.783329),
(3121312,"Góngora","ES",-1.53053,42.76157),
(6361405,"el Vendrell","ES",1.52882,41.20657),
(3106180,"El Vendrell","ES",1.53333,41.216671),
(6362419,"Portugalete","ES",-3.02364,43.316959),
(6359741,"Olza","ES",-1.74843,42.818909),
(3129820,"Aratzuri","ES",-1.72073,42.816872),
(3120403,"Imárcoain","ES",-1.61516,42.737492),
(6356031,"Calvià","ES",2.50299,39.563351),
(2520493,"Calvia","ES",2.50621,39.565701),
(6359516,"Blanca","ES",-1.338,38.19981),
(2520940,"Blanca","ES",-1.37473,38.1791),
(2520058,"Cartagena","ES",-0.98623,37.605122),
(6359367,"<NAME>","ES",-3.45805,40.467461),
(3107784,"<NAME>","ES",-3.46973,40.455349),
(6356227,"<NAME>","ES",2.06962,41.45649),
(3110718,"<NAME>","ES",2.08333,41.466671),
(3115739,"Naron","ES",-8.15278,43.51667),
(3124765,"<NAME>","ES",-3.76762,40.659088),
(6359842,"Celanova","ES",-7.97007,42.166012),
(3127948,"Bobadela","ES",-7.93333,42.166672),
(2512950,"<NAME>","ES",-6.89471,37.23457),
(2510271,"Torre-Pacheco","ES",-0.95396,37.742931),
(6533953,"Maó","ES",4.2633,39.888111),
(6544430,"<NAME>","ES",4.2593,39.891499),
(6360622,"Arona","ES",-16.690451,28.037661),
(2514741,"<NAME>ianos","ES",-16.720079,28.05011),
(6357616,"Olot","ES",2.48671,42.183319),
(3115093,"Olot","ES",2.49012,42.180962),
(3125924,"Castellana","ES",-8.02596,43.191151),
(3116562,"<NAME>","ES",2.01667,41.416672),
(6355468,"Novelda","ES",-0.78442,38.377571),
(2513195,"Novelda","ES",-0.76773,38.384789),
(3121437,"Getafe","ES",-3.73295,40.30571),
(2511161,"<NAME>","ES",-0.44293,38.389542),
(3115446,"Noáin","ES",-1.63448,42.76239),
(6360086,"<NAME>","ES",-4.18468,42.784351),
(3121675,"Gama","ES",-4.20675,42.747959),
(6360223,"Gondomar","ES",-8.76228,42.107441),
(3125247,"Chaín","ES",-8.73333,42.116669),
(6357359,"Vimianzo","ES",-9.02354,43.113819),
(3114222,"Pasarela","ES",-9.04778,43.14566),
(6361397,"Tortosa","ES",0.47756,40.83485),
(3107677,"Tortosa","ES",0.5216,40.812489),
(6358170,"Mendaro","ES",-2.37858,43.245781),
(6325368,"Garagartza","ES",-2.38527,43.252529),
(6357283,"Brión","ES",-8.71734,42.851791),
(3130155,"Ames","ES",-8.63333,42.900002),
(2518395,"<NAME>","ES",-1.998,38.512699),
(6534109,"Quart","ES",2.88184,41.95182),
(3112615,"<NAME>","ES",2.84079,41.940472),
(6359936,"Langreo","ES",-5.69938,43.291599),
(3119739,"<NAME>","ES",-5.69092,43.307499),
(6359683,"Javier","ES",-1.26179,42.539791),
(3110589,"Sanguesa","ES",-1.28283,42.574829),
(6533999,"Tordera","ES",2.67582,41.68325),
(3107955,"Tordera","ES",2.71888,41.699139),
(6360242,"<NAME>","ES",-8.50578,42.376709),
(6359598,"Basaburua","ES",-1.80724,43.029968),
(3120434,"Igoa","ES",-1.78588,43.031818),
(6359930,"Gozón","ES",-5.83855,43.622009),
(3122500,"Ferrero","ES",-5.85304,43.636471),
(6355909,"<NAME>","ES",-5.86439,38.984581),
(2518820,"<NAME>","ES",-5.86162,38.956268),
(6534125,"<NAME>","ES",2.72946,42.00042),
(3123861,"Domeny","ES",2.79006,41.991989),
(6357288,"Capela (A)","ES",-8.0443,43.436138),
(3108232,"Teixido","ES",-8.02699,43.414742),
(6355432,"Cocentaina","ES",-0.43853,38.733742),
(2522092,"Alcudia","ES",-0.42943,38.759071),
(6359975,"Vegadeo","ES",-7.02773,43.424789),
(3129749,"Arco","ES",-6.95307,43.411499),
(6357237,"Montilla","ES",-4.64083,37.566078),
(2513601,"Montilla","ES",-4.63805,37.586269),
(2509463,"Villena","ES",-0.86568,38.637299),
(2513917,"Merida","ES",-6.34366,38.916111),
(2522165,"<NAME>","ES",-5.83951,37.33791),
(6360710,"<NAME> (Las)","ES",-4.02006,42.96553),
(3118850,"<NAME>","ES",-4.03289,42.974018),
(6360662,"Camaleño","ES",-4.74539,43.162121),
(3107491,"Treviño","ES",-4.72682,43.121658),
(6357310,"Laracha (A)","ES",-8.57353,43.259609),
(3121346,"Golmar","ES",-8.56865,43.226109),
(6357306,"Ferrol","ES",-8.22773,43.503368),
(3105116,"Vilar","ES",-8.23333,43.48333),
(6359275,"Coslada","ES",-3.55159,40.42902),
(6359181,"Friol","ES",-7.80793,43.024342),
(3123903,"Devesa","ES",-7.75,43.033329),
(2511330,"<NAME>","ES",-0.43623,38.401482),
(6360994,"Écija","ES",-5.0979,37.566971),
(2518770,"Ecija","ES",-5.0826,37.542198),
(6359849,"Esgos","ES",-7.70641,42.334641),
(3111479,"Rocas","ES",-7.7,42.333328),
(6356242,"<NAME>","ES",2.32224,41.920292),
(3109549,"<NAME>","ES",2.32447,41.92189),
(6359948,"Parres","ES",-5.17564,43.37431),
(3127073,"Calabrez","ES",-5.13697,43.435349),
(6361825,"<NAME>","ES",-4.83319,39.960541),
(2510693,"<NAME>","ES",-4.83076,39.963482),
(6357331,"Outes","ES",-8.9131,42.836922),
(3128286,"Bendimón","ES",-8.91667,42.816669),
(6360678,"<NAME>","ES",-3.58296,43.409401),
(3130162,"Ambrosero","ES",-3.54925,43.415459),
(3115360,"Noriega","ES",-4.57357,43.364311),
(6359545,"Unión (La)","ES",-0.87329,37.60355),
(2515151,"La Union","ES",-0.87799,37.619148),
(2521139,"Benalmadena","ES",-4.56937,36.595482),
(6358124,"Eskoriatza","ES",-2.5376,42.997059),
(3129690,"Areitio","ES",-2.51667,43.01667),
(6533963,"Pollença","ES",3.01536,39.876122),
(2512432,"Pollenca","ES",3.01626,39.876781),
(6356963,"<NAME>","ES",0.26891,40.25798),
(3130619,"<NAME>","ES",0.23333,40.299999),
(3120154,"Javier","ES",-1.20884,42.59119),
(6362410,"Muxika","ES",-2.67836,43.248718),
(3129884,"Arana","ES",-2.68486,43.30304),
(3110194,"<NAME>","ES",-5.51667,43.450001),
(3119595,"Lahoz","ES",-3.24234,42.88345),
(6356930,"<NAME>","ES",-6.12788,36.401489),
(2519513,"<NAME>","ES",-6.14941,36.419151),
(6357279,"Betanzos","ES",-8.22956,43.27478),
(3128071,"Betanzos","ES",-8.21467,43.280418),
(2513188,"<NAME>","ES",-16.33333,28.41667),
(2509892,"<NAME>","ES",-16.65856,28.087919),
(6356526,"<NAME>","ES",-3.99425,41.73613),
(3120889,"Guzmán","ES",-3.99623,41.756451),
(3115471,"Nieva","ES",-5.92954,43.595409),
(6356948,"<NAME>","ES",-5.32916,36.253189),
(2511239,"<NAME>","ES",-5.38415,36.21067),
(6355275,"<NAME>","ES",-2.93462,42.799839),
(3108524,"Subijana","ES",-2.9,42.816669),
(3104341,"<NAME>","ES",-6,41.75),
(6362695,"Zamora","ES",-5.80054,41.522591),
(3104342,"Zamora","ES",-5.75,41.5),
(6357296,"Cesuras","ES",-8.21127,43.166088),
(3112768,"Puente","ES",-8.16667,43.183331),
(3107797,"Torrefarrera","ES",0.60671,41.67318),
(6360719,"<NAME>","ES",-3.87555,43.307911),
(3118219,"Lloreda","ES",-3.82102,43.294338),
(2509983,"Valdepeñas","ES",-3.38333,38.76667),
(2509982,"Valdepenas","ES",-3.38483,38.762112),
(6358226,"Moguer","ES",-6.8168,37.246189),
(2513791,"Moguer","ES",-6.83851,37.275589),
(3109082,"Serramo","ES",-8.98819,43.065472),
(6357287,"Cambre","ES",-8.34137,43.29285),
(3125502,"Cela","ES",-8.33333,43.283329),
(6358334,"Chimillas","ES",-0.4775,42.160919),
(3124216,"Cuarte","ES",-0.47079,42.117661),
(6355381,"Albatera","ES",-0.89699,38.218472),
(2522228,"Albatera","ES",-0.87059,38.17902),
(6359534,"Mula","ES",-1.53661,37.992962),
(2513436,"Mula","ES",-1.49014,38.040939),
(3114270,"Pareja","ES",-2.64882,40.555779),
(3112767,"Puente","ES",-7.06667,43.450001),
(6362600,"<NAME>","ES",-6.58536,42.030972),
(3125922,"Castellanos","ES",-6.61681,42.073818),
(2515999,"La Era de la Casa","ES",-16.41136,28.30242),
(6360188,"<NAME>","ES",-13.61536,28.983459),
(2511447,"<NAME>","ES",-13.613,29.000931),
(6359518,"Calasparra","ES",-1.67381,38.27095),
(2509945,"Valentín","ES",-1.72383,38.182838),
(6359533,"Moratalla","ES",-1.91331,38.231789),
(2520171,"Caravaca","ES",-1.86342,38.105579),
(3119431,"Lamela","ES",-8.31667,42.73333),
(2510542,"Telde","ES",-15.41915,27.99242),
(6361294,"Cunit","ES",1.63319,41.19751),
(3124026,"Cunit","ES",1.63645,41.198292),
(6359910,"Aller","ES",-5.58393,43.118729),
(3122574,"Felechosa","ES",-5.50831,43.103901),
(6355722,"Manjabálago","ES",-5.06487,40.679192),
(3121665,"Gamonal","ES",-5.08333,40.683331),
(6355435,"Crevillent","ES",-0.81508,38.230309),
(2519110,"Crevillente","ES",-0.80975,38.249939),
(6359235,"Algete","ES",-3.53328,40.614979),
(3130383,"Algete","ES",-3.49743,40.597111),
(6355474,"Orihuela","ES",-0.87438,38.065418),
(2513076,"Orihuela","ES",-0.94401,38.084831),
(3112153,"Partido Judicial de Redondela","ES",-8.56667,42.26667),
(3107575,"Trasmañó","ES",-8.65,42.26667),
(6359969,"Somiedo","ES",-6.24748,43.089008),
(3107061,"Valcárcel","ES",-6.2289,43.169979),
(6355426,"Campello (el)","ES",-0.36398,38.465462),
(2520447,"el Campello","ES",-0.39774,38.428848),
(3114256,"Parla","ES",-3.76752,40.236038),
(3123872,"Dodro","ES",-8.68683,42.718552),
(6360685,"Luena","ES",-3.89056,43.107948),
(3108433,"Tablado","ES",-3.90668,43.11887),
(2521909,"Almassora","ES",-0.05,39.950001),
(6357711,"Guadix","ES",-3.09781,37.3955),
(2513141,"Olivar","ES",-2.96302,37.5406),
(6358181,"Almonte","ES",-6.46971,36.995399),
(2521857,"Almonte","ES",-6.51667,37.264702),
(6355960,"Olivenza","ES",-7.103,38.683159),
(2511360,"<NAME>","ES",-7.05798,38.64497),
(6358765,"<NAME>","ES",1.52186,42.336609),
(3130720,"<NAME>","ES",1.51667,42.349998),
(6359541,"Torre-Pacheco","ES",-0.95593,37.793961),
(2521365,"Balsicas","ES",-0.95637,37.81818),
(2512254,"<NAME>","ES",-0.76569,38.118591),
(6359531,"Mazarrón","ES",-1.31652,37.586411),
(2513983,"Mazarron","ES",-1.31493,37.599201),
(6359959,"Ribadesella","ES",-5.07079,43.453369),
(3111855,"Ribadesella","ES",-5.05955,43.461449),
(2518285,"El Palomar","ES",-2.97138,37.957539),
(6360972,"Bormujos","ES",-6.08618,37.36459),
(2520833,"Bormujos","ES",-6.07232,37.373581),
(6359505,"Torremolinos","ES",-4.50458,36.623871),
(2510281,"Torremolinos","ES",-4.49976,36.62035),
(6359543,"Totana","ES",-1.56479,37.778889),
(2510224,"Totana","ES",-1.50229,37.768799),
(6356186,"Parets del Vallès","ES",2.23525,41.564171),
(6357303,"Dodro","ES",-8.70354,42.724979),
(6544457,"Lestrobe","ES",-8.673,42.730301),
(6362085,"Sagunto/Sagunt","ES",-0.27102,39.709721),
(2511619,"Sagunto","ES",-0.26667,39.683331),
(6360979,"Carmona","ES",-5.63152,37.46553),
(2520118,"Carmona","ES",-5.64608,37.471249),
(2512581,"<NAME>","ES",-0.79256,37.86591),
(2514873,"Los Álamos","ES",-2.3305,37.541691),
(6359240,"<NAME>","ES",-3.44945,40.296371),
(3126500,"<NAME>","ES",-3.43333,40.299999),
(6360227,"Marín","ES",-8.71759,42.37674),
(3117409,"Marin","ES",-8.7,42.383331),
(6356088,"Castelldefels","ES",1.96791,41.276409),
(3125897,"Castelldefels","ES",1.97033,41.277939),
(6360238,"Porriño (O)","ES",-8.63894,42.131069),
(3113157,"Porrino","ES",-8.6198,42.16156),
(6356497,"<NAME>","ES",-2.97034,42.672501),
(3116689,"<NAME>","ES",-2.94695,42.686501),
(6356639,"<NAME>","ES",-3.80688,42.965752),
(3104528,"Virtus","ES",-3.83277,42.981522),
(6359558,"Aibar/Oibar","ES",-1.35363,42.593319),
(3129109,"Ayesa","ES",-1.42204,42.571541),
(6360738,"Valderredible","ES",-3.95874,42.856449),
(3106819,"<NAME>","ES",-4.08836,42.871361),
(6358308,"Bisaurri","ES",0.53869,42.49213),
(3109474,"<NAME>","ES",0.56658,42.476261),
(6359420,"Antequera","ES",-4.59283,37.05489),
(2521710,"Antequera","ES",-4.56123,37.019379),
(2518068,"El Toscal","ES",-16.281349,28.482401),
(3111475,"Rocha","ES",-7.85,43.049999),
(6357282,"Boqueixón","ES",-8.40662,42.81459),
(3117924,"Loureda","ES",-8.41151,42.873039),
(6358211,"Gibraleón","ES",-7.00326,37.389858),
(2518222,"<NAME>","ES",-6.96667,37.383331),
(2511880,"Ribarroja","ES",-0.56667,39.549999),
(6357657,"Atarfe","ES",-3.70023,37.25169),
(2521485,"Atarfe","ES",-3.68686,37.224789),
(6361030,"Pilas","ES",-6.31623,37.312309),
(2512578,"Pilas","ES",-6.30097,37.303371),
(6359380,"Valdemoro","ES",-3.64978,40.180759),
(3106868,"Valdemoro","ES",-3.67887,40.190811),
(2520283,"Candelaria","ES",-16.372681,28.354799),
(6355420,"Bigastro","ES",-0.894,38.061459),
(2520955,"Bigastro","ES",-0.89841,38.06237),
(6359973,"Teverga","ES",-6.11552,43.150051),
(3114316,"Páramo","ES",-6.04226,43.100689),
(7290706,"<NAME>","ES",1.3457,41.12949),
(6356764,"Coria","ES",-6.50396,39.978359),
(2519234,"Coria","ES",-6.53772,39.987881),
(6361439,"Alcañiz","ES",-0.19124,41.050171),
(3130606,"Alcaniz","ES",-0.13333,41.049999),
(3118075,"Loro","ES",-6.20304,43.479012),
(3127807,"Bores","ES",-4.66615,43.094601),
(6359914,"Boal","ES",-6.82458,43.419609),
(3108777,"Solares","ES",-6.75703,43.390411),
(6533970,"<NAME>","ES",4.25575,39.8297),
(2511302,"<NAME>","ES",4.25939,39.852631),
(2520944,"Biniparrell","ES",4.25,39.849998),
(3128633,"Barredo","ES",-5.98586,43.385101),
(6360977,"Campana (La)","ES",-5.39797,37.571079),
(2516118,"<NAME>","ES",-5.4267,37.568909),
(6359897,"Toén","ES",-7.96745,42.311298),
(3130269,"Alongos","ES",-7.95,42.316669),
(6360522,"Sando","ES",-6.09809,40.948959),
(3110702,"Sando","ES",-6.11136,40.967739),
(6355262,"Iruraiz-Gauna","ES",-2.49002,42.820011),
(3121783,"Gáceta","ES",-2.53857,42.843819),
(6361946,"Canals","ES",-0.58539,38.969391),
(2520320,"Canals","ES",-0.58443,38.962509),
(6360281,"Aldeatejada","ES",-5.71325,40.90918),
(3104508,"Vistahermosa","ES",-5.69978,40.939121),
(6360703,"Rasines","ES",-3.41672,43.297539),
(3120860,"Helguera","ES",-3.43335,43.29678),
(6362104,"<NAME>","ES",-0.96943,39.112331),
(2521451,"Ayora","ES",-1.05635,39.058521),
(6534062,"<NAME>","ES",2.81718,41.930962),
(3122205,"<NAME>","ES",2.80907,41.931591),
(6360912,"<NAME>","ES",-3.57782,41.187222),
(3108959,"Siguero","ES",-3.61635,41.181728),
(6361880,"Alcàsser","ES",-0.4471,39.377979),
(2522179,"Alcasser","ES",-0.43333,39.366669),
(6359344,"Rivas-Vaciamadrid","ES",-3.51701,40.351089),
(3107112,"Vaciamadrid","ES",-3.51088,40.32605),
(6359986,"Ampudia","ES",-4.7699,41.898521),
(3130130,"Ampudia","ES",-4.78033,41.91608),
(6362532,"Hermisende","ES",-6.91311,41.983101),
(3120818,"Hermisende","ES",-6.89616,41.968979),
(6357736,"Loja","ES",-4.16939,37.212589),
(2514946,"Loja","ES",-4.15129,37.168869),
(3105729,"Villacadima","ES",-3.21596,41.281391),
(3105142,"Villar","ES",-4.71301,41.583031),
(6359940,"Mieres","ES",-5.75071,43.23428),
(3116789,"Mieres","ES",-5.76667,43.25),
(2519270,"Cope","ES",-1.48453,37.43663),
(6357765,"Píñar","ES",-3.4398,37.430691),
(2512558,"Pinar","ES",-3.43861,37.444569),
(3108986,"Sierrapando","ES",-4.03661,43.343521),
(6357031,"Morella","ES",-0.07762,40.581871),
(3116121,"Morella","ES",-0.09892,40.619659),
(2519672,"Cazorla","ES",-3.00342,37.914951),
(6360695,"Peñarrubia","ES",-4.58308,43.258949),
(3113458,"Piñeres","ES",-4.56159,43.2439),
(6357321,"Muxía","ES",-9.22221,43.067532),
(3126257,"Carnés","ES",-9.11246,43.114639),
(6359313,"<NAME>","ES",-3.89423,40.260132),
(3116191,"<NAME>","ES",-3.85963,40.26125),
(6359510,"Alcantarilla","ES",-1.22963,37.977268),
(2522152,"Alcantarilla","ES",-1.21714,37.969391),
(2521052,"Benirredra","ES",-0.18333,38.966671),
(2510803,"<NAME>","ES",2.65708,39.62035),
(6359711,"Marcilla","ES",-1.72079,42.348518),
(3117442,"Marcilla","ES",-1.73714,42.327942),
(6359045,"Corporales","ES",-3.00629,42.4217),
(3124531,"Corporales","ES",-2.99535,42.432079),
(6355512,"Villajoyosa","ES",-0.23209,38.511238),
(2509588,"Villajoyosa","ES",-0.23346,38.507542),
(2514158,"Marchena","ES",-5.41682,37.328999),
(6355425,"Callosa de Segura","ES",-0.87839,38.12429),
(2520502,"Callosa de Segura","ES",-0.87822,38.124969),
(6358457,"Alcalá la Real","ES",-3.94738,37.46587),
(2522160,"<NAME>","ES",-3.92301,37.461399),
(6359498,"Vélez-Málaga","ES",-4.12321,36.760712),
(2509769,"Velez-Malaga","ES",-4.10045,36.772621),
(6359351,"<NAME>","ES",-3.48909,40.437759),
(3110627,"<NAME>","ES",-3.53261,40.423859),
(6357233,"Lucena","ES",-4.55109,37.347229),
(2514392,"Lucena","ES",-4.48522,37.40881),
(6360903,"<NAME>","ES",-4.03385,40.85611),
(3110581,"<NAME>","ES",-4.00685,40.901821),
(3120019,"<NAME>","ES",-3.5936,40.29924),
(3113803,"<NAME>","ES",-3.64077,40.319981),
(6358110,"Beasain","ES",-2.21791,43.073261),
(3105599,"<NAME>","ES",-2.17632,43.0541),
(6325110,"Lazkaibar","ES",-2.18751,43.050991),
(2521961,"Aljau","ES",-0.76667,38.349998),
(6361078,"Almazán","ES",-2.53581,41.502838),
(3130313,"Almazan","ES",-2.53088,41.486481),
(6356890,"Trujillo","ES",-5.98803,39.517521),
(2510145,"Trujillo","ES",-5.88203,39.457859),
(3120933,"Guísamo","ES",-8.26667,43.299999),
(3108950,"Silleda","ES",-8.24653,42.696049),
(6359514,"Archena","ES",-1.29539,38.11668),
(2521676,"Archena","ES",-1.30043,38.11631),
(6355614,"Vícar","ES",-2.67696,36.819248),
(2509650,"Vicar","ES",-2.64273,36.831551),
(3115752,"Narciandi","ES",-5.09903,43.348339),
(6359177,"Chantada","ES",-7.79753,42.608742),
(3125212,"Chantada","ES",-7.77115,42.608761),
(6360984,"<NAME>","ES",-6.05461,37.387009),
(2519738,"<NAME>","ES",-6.05258,37.385941),
(2512282,"<NAME>","ES",-4.19523,37.438068),
(6360176,"Arucas","ES",-15.5173,28.135019),
(2521519,"Arucas","ES",-15.52325,28.119829),
(2519651,"Cehegin","ES",-1.7985,38.092419),
(2521992,"<NAME>","ES",-1.42507,37.851028),
(3106050,"Vic","ES",2.25486,41.930119),
(2521986,"<NAME>","ES",-4.56139,36.664009),
(6360682,"Laredo","ES",-3.42035,43.41663),
(3119145,"Laredo","ES",-3.41613,43.409801),
(6362079,"<NAME>","ES",-0.55797,39.50713),
(2515627,"La Presa","ES",-0.51667,39.51667),
(3112848,"Prezanes","ES",-3.90995,43.453732),
(6360666,"Castañeda","ES",-3.92198,43.314072),
(3110086,"<NAME>","ES",-3.9122,43.30497),
(3108866,"Soba","ES",-3.58333,43.200001),
(3129259,"Asón","ES",-3.60341,43.228531),
(3117979,"<NAME>os","ES",-3.81667,43.400002),
(3109644,"<NAME>","ES",-4.06603,43.336121),
(6355455,"Ibi","ES",-0.55926,38.625561),
(2516480,"Ibi","ES",-0.57225,38.625332),
(2519425,"Cieza","ES",-1.41987,38.239979),
(6356289,"Sitges","ES",1.80828,41.235611),
(3110143,"<NAME>","ES",1.76667,41.26667),
(8063149,"<NAME>","ES",2.12603,41.364632),
(6356165,"<NAME>","ES",2.26978,41.55011),
(3116262,"<NAME>","ES",2.26667,41.533329),
(3105247,"Villanueva de la Canada","ES",-4.00428,40.446899),
(6357611,"les Llosses","ES",2.07639,42.161839),
(3111607,"Ripoll","ES",2.19033,42.200642),
(2509596,"Villafranqueza","ES",-0.49064,38.387699),
(6359218,"Taboada","ES",-7.7481,42.709911),
(3125403,"Cerdeda","ES",-7.83333,42.700001),
(6359859,"Lobeira","ES",-8.03444,41.979301),
(3126955,"Calvos","ES",-8,42.049999),
(6533988,"Calella","ES",2.64436,41.6227),
(3127007,"Calella","ES",2.66781,41.618019),
(6362435,"Zaratamo","ES",-2.86955,43.209919),
(3127484,"Burbustu-Altamira","ES",-2.87552,43.202141),
(2516932,"Guadiaro","ES",-5.30309,36.30027),
(6359287,"Galapagar","ES",-3.97669,40.559471),
(3121766,"Galapagar","ES",-4.00426,40.5783),
(3110458,"San Lorenzo de El Escorial","ES",-4.14738,40.591438),
(3109498,"<NAME>","ES",1.79629,41.38419),
(6356937,"Línea de la Concepción (La)","ES",-5.3467,36.182991),
(2515812,"La Linea de la Concepcion","ES",-5.34777,36.168091),
(6534119,"<NAME>","ES",2.82285,41.871632),
(3110872,"<NAME>","ES",2.83333,41.866669),
(6358538,"Úbeda","ES",-3.36868,38.013569),
(2510116,"Ubeda","ES",-3.3705,38.013279),
(6358464,"Baeza","ES",-3.49804,37.947311),
(2521413,"Baeza","ES",-3.47103,37.993839),
(6360191,"Santa Brígida","ES",-15.49173,28.031321),
(2511202,"Santa Brigida","ES",-15.50425,28.031969),
(2520121,"Carlet","ES",-0.51667,39.23333),
(2518494,"El Ejido","ES",-2.81456,36.776291),
(6359353,"<NAME> la Vega","ES",-3.55314,40.247131),
(3110360,"<NAME>","ES",-3.57063,40.207352),
(3104703,"<NAME>","ES",-3.90011,40.356918),
(6361395,"Torredembarra","ES",1.40506,41.14888),
(3107807,"Torredembarra","ES",1.39861,41.14505),
(6358458,"Alcaudete","ES",-4.10775,37.59692),
(2522137,"Alcaudete","ES",-4.08237,37.590912),
(6355565,"Huércal-Overa","ES",-1.96127,37.410099),
(2514469,"<NAME>","ES",-1.95,37.383331),
(6360179,"Gáldar","ES",-15.65088,28.15132),
(2517436,"Galdar","ES",-15.6502,28.147011),
(6358541,"Villacarrillo","ES",-3.02669,38.090561),
(6359646,"Esteribar","ES",-1.53284,42.95472),
(3107163,"Urtasun","ES",-1.51523,42.962742),
(6355578,"Níjar","ES",-2.20036,36.96114),
(2513222,"Nijar","ES",-2.20595,36.966549),
(6355494,"<NAME>","ES",-0.79052,37.997719),
(2511277,"<NAME>","ES",-0.78904,37.979721),
(6360194,"Teguise","ES",-13.52157,29.182529),
(2510573,"Teguise","ES",-13.56398,29.06049),
(6357350,"Teo","ES",-8.55973,42.793369),
(3108165,"Teo","ES",-8.5,42.75),
(3124499,"Corro","ES",-3.17123,42.880058),
(6357231,"Hornachuelos","ES",-5.32992,37.939091),
(2512990,"<NAME>","ES",-5.28121,37.700241),
(6360645,"Tegueste","ES",-16.33782,28.515369),
(2510574,"Tegueste","ES",-16.316669,28.51667),
(6533978,"Sóller","ES",2.71388,39.76543),
(2510821,"Soller","ES",2.71521,39.766232),
(6359548,"Santomera","ES",-1.06892,38.089062),
(2511050,"Santomera","ES",-1.04877,38.06147),
(6357649,"Alhama de Granada","ES",-3.96003,37.01796),
(2521993,"Alhama de Granada","ES",-3.98963,37.006889),
(6355371,"Villarrobledo","ES",-2.60463,39.196571),
(2509491,"Villarrobledo","ES",-2.60118,39.26992),
(6355544,"Berja","ES",-2.96874,36.839512),
(2521016,"Berja","ES",-2.94966,36.846931),
(6360632,"<NAME>","ES",-16.449739,28.44512),
(2522381,"Agua-García","ES",-16.40765,28.46386),
(6356018,"<NAME>","ES",-5.73039,39.009312),
(2509553,"<NAME>","ES",-5.7974,38.976551),
(3107987,"Toques","ES",-7.96667,42.98333),
(3114990,"Ordes","ES",-7.98333,42.950001),
(3111861,"Ribadelouro","ES",-8.63333,42.099998),
(6533972,"Santa Margalida","ES",3.10432,39.703819),
(2511143,"Santa Margalida","ES",3.10215,39.701431),
(6361833,"Torrijos","ES",-4.28108,39.983768),
(2510249,"Torrijos","ES",-4.28349,39.981941),
(6355360,"Roda (La)","ES",-2.19224,39.180408),
(2515555,"La Roda","ES",-2.15,39.216671),
(3108819,"Sobrón","ES",-3.11451,42.773682),
(3104707,"Villaviciosa","ES",-5.43574,43.481258),
(6360235,"Nigrán","ES",-8.82104,42.145981),
(3104684,"Villaza","ES",-8.75,42.116669),
(6358220,"Lepe","ES",-7.19039,37.278912),
(2515072,"Lepe","ES",-7.20433,37.254822),
(6357653,"Almuñécar","ES",-3.72581,36.757149),
(2515896,"La Herradura","ES",-3.7376,36.734909),
(6356560,"<NAME>","ES",-4.22327,42.692501),
(3112780,"<NAME>","ES",-4.29199,42.714809),
(6362277,"<NAME>","ES",-4.67113,41.701569),
(3109501,"<NAME>","ES",-4.69028,41.694569),
(6358809,"Bellvís","ES",0.82769,41.691002),
(3128331,"Bellvis","ES",0.81768,41.672691),
(6358489,"Guarromán","ES",-3.74956,38.147129),
(2521351,"<NAME>","ES",-3.77477,38.17379),
(3119535,"<NAME>","ES",-8.11667,42.716671),
(3123830,"Donramiro","ES",-8.11667,42.650002),
(6356251,"<NAME>","ES",1.693,41.834129),
(3108487,"Suria","ES",1.75,41.833328),
(6358230,"Palma del Condado (La)","ES",-6.55666,37.4035),
(2515679,"La Palma del Condado","ES",-6.55231,37.386051),
(6358374,"Monzón","ES",0.17021,41.902309),
(3116224,"Monzon","ES",0.19406,41.910839),
(6356085,"<NAME>","ES",1.8609,41.628849),
(3116466,"<NAME>","ES",1.85,41.616669),
(6359443,"Cártama","ES",-4.66796,36.743999),
(2520055,"Cartama","ES",-4.63297,36.710678),
(6359298,"<NAME>","ES",-3.90873,40.622292),
(6615320,"La Nava","ES",-3.87869,40.63089),
(6361257,"Amposta","ES",0.57781,40.708881),
(3130131,"Amposta","ES",0.58103,40.713081),
(6533944,"Esporles","ES",2.57728,39.669079),
(2517880,"Esporles","ES",2.57853,39.669701),
(3117200,"Matadepera","ES",2.02648,41.598862),
(3109073,"Serrapio","ES",-5.63138,43.165871),
(6357927,"Humanes","ES",-3.15103,40.85844),
(3120502,"Humanes","ES",-3.15257,40.825981),
(6359762,"<NAME>","ES",-1.87876,42.777809),
(3121002,"Guembe","ES",-1.90767,42.782299),
(6359417,"Álora","ES",-4.70378,36.836681),
(2521840,"Alora","ES",-4.70575,36.823582),
(3109409,"Saravillo","ES",0.25866,42.55463),
(6358453,"Aínsa-Sobrarbe","ES",0.07127,42.326881),
(3109373,"Sarratillo","ES",0.09068,42.35611),
(3129685,"Arenal","ES",-3.81776,43.332199),
(2521298,"Barranco","ES",-0.48787,38.522362),
(6360228,"Meaño","ES",-8.79586,42.46286),
(3112423,"Quintáns","ES",-8.81061,42.48962),
(6355610,"Vélez-Blanco","ES",-2.09012,37.770081),
(2509772,"<NAME>","ES",-2.09587,37.69178),
(6358984,"<NAME>","ES",1.26601,41.807571),
(3113231,"Ponts","ES",1.18515,41.916069),
(6355422,"Busot","ES",-0.42664,38.50243),
(8063770,"<NAME>","ES",-0.41748,38.483799),
(6360198,"Tías","ES",-13.66192,28.937731),
(2510485,"Tias","ES",-13.64502,28.961081),
(6360735,"Valdáliga","ES",-4.33457,43.337631),
(3125588,"Caviedes","ES",-4.32642,43.338161),
(6534030,"<NAME>","ES",2.81272,41.835659),
(3127036,"<NAME>","ES",2.81667,41.833328),
(6356130,"Gurb","ES",2.22271,41.961361),
(3123462,"Gurb","ES",2.23537,41.954189),
(6356929,"Conil de la Frontera","ES",-6.08545,36.299469),
(2519289,"Conil de la Frontera","ES",-6.0885,36.277191),
(6358159,"Tolosa","ES",-2.08005,43.10775),
(3120485,"Ibarra","ES",-2.06487,43.131271),
(6324859,"Argindegi","ES",-2.06542,43.133091),
(3107384,"Turiellos","ES",-5.68333,43.299999),
(6359549,"Alcázares (Los)","ES",-0.85073,37.752102),
(2514868,"<NAME>","ES",-0.85041,37.744251),
(6533939,"<NAME>","ES",3.83504,39.99968),
(3110068,"<NAME>","ES",-4.9087,41.300251),
(2516925,"Guadix","ES",-3.13922,37.29932),
(2512378,"<NAME>","ES",3.33302,39.539532),
(6360229,"Meis","ES",-8.71538,42.520538),
(3118143,"Lois","ES",-8.71667,42.533329),
(6361398,"Ulldecona","ES",0.44726,40.59724),
(3130608,"Alcanar","ES",0.48082,40.543159),
(6362051,"Paiporta","ES",-0.41186,39.427109),
(2513029,"Paiporta","ES",-0.41667,39.433331),
(3109512,"<NAME>","ES",-6.57819,42.558769),
(6355242,"Cervo","ES",-7.42532,43.674229),
(3125287,"Cervo","ES",-7.41013,43.670189),
(6358295,"Barbastro","ES",0.12556,42.04348),
(3128795,"Barbastro","ES",0.12686,42.035648),
(2513893,"Miajadas","ES",-5.90841,39.151272),
(2511250,"<NAME>","ES",-4.99123,36.488392),
(3117862,"Luanco","ES",-5.79344,43.61517),
(6359542,"<NAME>","ES",-1.26274,38.02478),
(2515219,"<NAME>","ES",-1.24188,38.028221),
(6361967,"Quart de Poblet","ES",-0.44246,39.481651),
(2519068,"Quart de Poblet","ES",-0.43937,39.481392),
(6358460,"Andújar","ES",-4.10369,38.176949),
(2521738,"Andujar","ES",-4.05078,38.039219),
(2518207,"El Puerto de Santa Maria","ES",-6.23298,36.593891),
(2510508,"Teror","ES",-15.54909,28.060619),
(6360187,"Puerto del Rosario","ES",-13.95599,28.51045),
(2512186,"Puerto del Rosario","ES",-13.86272,28.50038),
(6355523,"Albox","ES",-2.13959,37.384338),
(2522200,"Albox","ES",-2.1495,37.388561),
(6357033,"Nules","ES",-0.16891,39.858181),
(2513180,"Nules","ES",-0.15642,39.853619),
(6360173,"Antigua","ES",-13.91724,28.354361),
(2521706,"Antigua","ES",-14.01379,28.423071),
(6357854,"<NAME>","ES",-3.24802,40.63744),
(3127267,"<NAME>","ES",-3.22937,40.633759),
(6362000,"Godella","ES",-0.41874,39.53492),
(2517200,"Godella","ES",-0.41667,39.533329),
(6356038,"Santa Eulària des Riu","ES",1.53195,38.984531),
(2511162,"Santa Eularia des Riu","ES",1.53409,38.98457),
(6361859,"Yébenes (Los)","ES",-3.91658,39.472149),
(2514406,"Los Yebenes","ES",-3.87058,39.581581),
(6360302,"Béjar","ES",-5.77199,40.38884),
(3128382,"Bejar","ES",-5.76341,40.38641),
(6358559,"Astorga","ES",-6.09461,42.45927),
(3129231,"Astorga","ES",-6.05601,42.45879),
(6360181,"Ingenio","ES",-15.45768,27.934441),
(2516443,"Ingenio","ES",-15.4406,27.92086),
(6359416,"Almogía","ES",-4.53326,36.836288),
(2521866,"Almogia","ES",-4.5407,36.8255),
(3130249,"Alpicat","ES",0.55564,41.665699),
(6534012,"Begur","ES",3.21453,41.955311),
(3129007,"Begur","ES",3.21667,41.950001),
(6360976,"Camas","ES",-6.03644,37.399368),
(2520477,"Camas","ES",-6.03314,37.40202),
(6360185,"Pájara","ES",-14.279,28.19581),
(2519375,"Cofete","ES",-14.38966,28.099131),
(6533938,"Capdepera","ES",3.43233,39.701771),
(2520200,"Capdepera","ES",3.43357,39.702629),
(6361766,"Mora","ES",-3.73734,39.685478),
(2513588,"Mora","ES",-3.77394,39.684921),
(6359895,"Taboadela","ES",-7.82769,42.247971),
(3107974,"Torán","ES",-7.83026,42.231201),
(6360041,"Grijota","ES",-4.58844,42.0481),
(3121108,"Grijota","ES",-4.58309,42.052891),
(6534019,"Beuda","ES",2.70794,42.236752),
(3111144,"Sagaró","ES",2.747,42.240971),
(2514554,"Los Palacios","ES",-1.11667,38.033329),
(6355893,"Campanario","ES",-5.6391,38.86956),
(2520456,"Campanario","ES",-5.61744,38.864399),
(6358024,"Sigüenza","ES",-2.66445,41.095261),
(3108961,"Siguenza","ES",-2.64308,41.06892),
(6357225,"<NAME>","ES",-5.08316,37.703331),
(2517512,"<NAME>","ES",-5.09965,37.704941),
(6358248,"Valverde del Camino","ES",-6.74951,37.545811),
(2509835,"Valverde del Camino","ES",-6.75432,37.575111),
(6357461,"Iniesta","ES",-1.61821,39.440849),
(2516440,"Iniesta","ES",-1.75,39.433331),
(6360211,"Cangas","ES",-8.83035,42.272629),
(3126577,"Cangas","ES",-8.78462,42.26413),
(2521665,"Arcos de la Frontera","ES",-5.81056,36.750751),
(2512509,"<NAME>","ES",-3.74967,37.251099),
(6357121,"Cal<NAME>","ES",-3.78039,38.606731),
(2516122,"La Calzada de Calatrava","ES",-3.77561,38.703388),
(6355263,"Labastida","ES",-2.81351,42.60614),
(3119965,"Labastida","ES",-2.79568,42.589741),
(6356325,"Viver i Serrateix","ES",1.79864,41.950199),
(3104480,"Viver","ES",1.81502,41.957569),
(6534037,"Cassà de la Selva","ES",2.87232,41.87915),
(3125991,"Cassa de la Selva","ES",2.87524,41.88784),
(2512379,"Portocolom","ES",3.265,39.425522),
(6534048,"Corçà","ES",3.01292,41.999821),
(3126041,"Casavells","ES",3.03333,42),
(6360184,"Oliva (La)","ES",-13.92263,28.688181),
(2519217,"Corralejo","ES",-13.86839,28.74243),
(6355817,"San Pascual","ES",-4.72977,40.897839),
(3110217,"San Pascual","ES",-4.75612,40.881409),
(2509515,"<NAME>","ES",-2.06667,39.950001),
(6357122,"Campo de Criptana","ES",-3.12355,39.414452),
(2520413,"Campo de Criptana","ES",-3.12492,39.404629),
(6356938,"Medina-Sidonia","ES",-5.8037,36.35667),
(2513961,"Medina Sidonia","ES",-5.92717,36.456951),
(6358870,"Llimiana","ES",0.94458,42.06736),
(3118241,"Llimiana","ES",0.91621,42.07476),
(6358771,"Alcarràs","ES",0.46822,41.60067),
(3130598,"Alcarras","ES",0.51667,41.566669),
(6359668,"Guesálaz","ES",-1.91428,42.76392),
(3121567,"Garísoain","ES",-1.91093,42.719898),
(6359862,"Manzaneda","ES",-7.20298,42.296902),
(3125344,"Cernado","ES",-7.22296,42.23978),
(6358510,"Martos","ES",-4.00201,37.670879),
(2514073,"Martos","ES",-3.97264,37.721069),
(6356148,"Masquefa","ES",1.80702,41.504711),
(3119959,"La Beguda Alta","ES",1.83769,41.498932),
(6360962,"Algaba (La)","ES",-6.01916,37.476391),
(2516217,"<NAME>aba","ES",-6.01294,37.463669),
(6355953,"Montijo","ES",-6.57392,38.94519),
(2513604,"Montijo","ES",-6.61785,38.90839),
(6358799,"la Baronia de Rialb","ES",1.18712,41.934399),
(3128665,"Gualter","ES",1.19489,41.93182),
(3116280,"Montmagastre","ES",1.13333,41.98333),
(3107519,"Tremp","ES",0.89487,42.16703),
(6362036,"Moncada","ES",-0.39124,39.556789),
(2513703,"Moncada","ES",-0.39551,39.545551),
(6359447,"Coín","ES",-4.76611,36.6745),
(2519367,"Coin","ES",-4.75639,36.65947),
(6357730,"Láchar","ES",-3.84406,37.1917),
(2516071,"Lachar","ES",-3.83277,37.19519),
(6358678,"<NAME>","ES",-5.67547,42.62471),
(3107455,"<NAME>","ES",-5.60798,42.59642),
(6360533,"<NAME>","ES",-5.62398,40.946659),
(3109721,"<NAME>","ES",-5.62723,40.950649),
(6362642,"Toro","ES",-5.44277,41.475578),
(3107886,"Toro","ES",-5.39534,41.524181),
(6534144,"<NAME>","ES",2.95936,42.12376),
(3109315,"Saus","ES",2.97742,42.132401),
(6356987,"Borriol","ES",-0.08452,40.041679),
(3117264,"<NAME>","ES",-0.1549,40.067371),
(6361870,"Alaquàs","ES",-0.46091,39.456341),
(2522297,"Alaquas","ES",-0.461,39.455681),
(6356964,"Alcora (l')","ES",-0.216,40.062019),
(3130567,"lAlcora","ES",-0.2,40.066669),
(6361872,"Albal","ES",-0.40736,39.391731),
(2522250,"Albal","ES",-0.41667,39.400002),
(6361900,"Almussafes","ES",-0.40947,39.29734),
(2521845,"Almussafes","ES",-0.41667,39.283329),
(6358551,"<NAME>","ES",-2.88874,38.314339),
(2521550,"<NAME>","ES",-2.89486,38.320648),
(3109425,"Sapeira","ES",0.78862,42.2542),
(6358736,"Villadecanes","ES",-6.78703,42.548809),
(3107979,"Toral de los Vados","ES",-6.7771,42.54311),
(6358357,"Jaca","ES",-0.54094,42.57605),
(3120211,"Jaca","ES",-0.54987,42.568981),
(6359192,"<NAME>","ES",-7.49423,42.512009),
(3116478,"<NAME>","ES",-7.51422,42.521648),
(3115177,"Oleiros","ES",-8.31667,43.333328),
(6358540,"Vilches","ES",-3.47746,38.22776),
(2509615,"Vilches","ES",-3.51025,38.206951),
(6355452,"<NAME>","ES",-0.65357,38.078609),
(2516902,"<NAME>","ES",-0.65556,38.090309),
(6362937,"Tarazona","ES",-1.74145,41.894169),
(3108308,"Tarazona","ES",-1.73333,41.900002),
(6357117,"<NAME>","ES",-3.62266,38.909592),
(2520875,"<NAME>","ES",-3.66346,38.906898),
(2513680,"Monovar","ES",-0.84062,38.438091),
(6360172,"Agüimes","ES",-15.44071,27.891451),
(2522325,"Aguimes","ES",-15.44609,27.90539),
(3128115,"Berrón","ES",-5.70462,43.385609),
(3105803,"Vila-seca","ES",1.15,41.116669),
(3107700,"<NAME>","ES",3.12703,42.042542),
(6356554,"Quintanillas (Las)","ES",-3.84131,42.37109),
(3118854,"Las Quintanillas","ES",-3.84307,42.372238),
(2516744,"Higares","ES",-3.92973,39.913219),
(6361013,"<NAME>","ES",-5.74201,37.345322),
(2514288,"<NAME>","ES",-5.74952,37.373009),
(2512510,"Pinoso","ES",-1.04196,38.401642),
(3116274,"Montnegre","ES",2.93233,41.955421),
(6361511,"Escucha","ES",-0.84671,40.77599),
(3122959,"Escucha","ES",-0.81012,40.79467),
(6359166,"Baleira","ES",-7.19547,43.041561),
(3109839,"Santalla","ES",-7.2,43.150002),
(6359974,"Tineo","ES",-6.47303,43.341068),
(3108087,"Tineo","ES",-6.41452,43.33765),
(6362760,"Calatayud","ES",-1.6239,41.387569),
(3127047,"Calatayud","ES",-1.64318,41.353531),
(2510550,"Tejina","ES",-16.35873,28.534781),
(2516798,"Hellín","ES",-1.75,38.450001),
(2516797,"Hellin","ES",-1.70096,38.510601),
(6357335,"<NAME>","ES",-8.93875,42.602951),
(3112787,"<NAME>","ES",-8.93824,42.602951),
(6357345,"Santa Comba","ES",-8.82493,43.019798),
(3109966,"Santa Comba","ES",-8.80925,43.033058),
(6360706,"<NAME>","ES",-3.7074,43.465012),
(3108731,"Somo","ES",-3.73468,43.45126),
(6357208,"Cabra","ES",-4.45586,37.49292),
(2520645,"Cabra","ES",-4.44206,37.472488),
(3113576,"Piera","ES",1.75076,41.52232),
(6359209,"Quiroga","ES",-7.20928,42.48468),
(3107459,"Trives","ES",-7.26667,42.333328),
(2516169,"<NAME>","ES",-0.69531,37.632229),
(3118685,"Laviana","ES",-5.53333,43.23333),
(3126167,"Carrio","ES",-5.57183,43.25135),
(6357721,"Illora","ES",-3.90395,37.275532),
(2516455,"Illora","ES",-3.88109,37.287708),
(6360352,"<NAME>","ES",-6.52245,40.60014),
(3106986,"Valdecarpinteros","ES",-6.44243,40.65934),
(6355245,"Aramaio","ES",-2.60173,43.039001),
(3120487,"Ibarra","ES",-2.56591,43.049809),
(6359199,"<NAME>","ES",-7.60506,43.116428),
(2515917,"<NAME>","ES",-1.93336,39.11758),
(6359473,"Manilva","ES",-5.25213,36.348782),
(2514199,"Manilva","ES",-5.25026,36.37645),
(6534064,"Garrigàs","ES",2.95333,42.193062),
(6459155,"el Barri de l'Església","ES",2.94942,42.196999),
(6534015,"Bàscara","ES",2.91146,42.158569),
(3114890,"Orriols","ES",2.90689,42.124611),
(3112154,"Redondela","ES",-8.6096,42.283371),
(2515507,"<NAME>","ES",-1.25,38.049999),
(6355852,"<NAME>","ES",-4.71502,40.881721),
(3105256,"<NAME>","ES",-4.7165,40.88269),
(6361767,"Nambroca","ES",-3.91661,39.802841),
(2513384,"Nambroca","ES",-3.94434,39.79771),
(6357253,"Rute","ES",-4.35506,37.333279),
(2511649,"Rute","ES",-4.36827,37.3269),
(6355572,"<NAME>","ES",-2.14245,37.04937),
(2515869,"<NAME>","ES",-2.01264,37.114868),
(2518347,"<NAME>","ES",-2.12111,37.120258),
(6362998,"Allariz","ES",-7.81693,42.197899),
(3130878,"Augasantas","ES",-7.78613,42.238941),
(6357274,"Ares","ES",-8.25708,43.433601),
(3129655,"Ares","ES",-8.24254,43.429951),
(6325237,"<NAME>","ES",-1.98575,43.316158),
(6359886,"Ribadavia","ES",-8.13796,42.289539),
(3111863,"Ribadavia","ES",-8.14362,42.28804),
(2515698,"<NAME>","ES",-13.92912,28.610519),
(6357305,"Fene","ES",-8.15758,43.465611),
(3122564,"Fene","ES",-8.15,43.450001),
(6357147,"Manzanares","ES",-3.36794,39.01722),
(2514190,"Manzanares","ES",-3.36991,38.999149),
(6360667,"Castro-Urdiales","ES",-3.24397,43.380539),
(3117786,"Lusa","ES",-3.20562,43.35265),
(3109143,"la Seu dUrgell","ES",1.46144,42.358768),
(6362297,"<NAME>","ES",-4.60046,41.586498),
(3107415,"<NAME>","ES",-4.58093,41.584499),
(3113716,"Perlunes","ES",-6.28302,43.08968),
(6534074,"Llagostera","ES",2.91487,41.82515),
(3118340,"Llagostera","ES",2.89365,41.826881),
(3117398,"Marlofa","ES",-1.06846,41.739689),
(6362891,"Pedrola","ES",-1.23197,41.765598),
(3123615,"El Cabezo","ES",-1.21836,41.786129),
(6356184,"Pallejà","ES",1.9792,41.421841),
(3114516,"Palleja","ES",1.99505,41.423939),
(6358186,"Ayamonte","ES",-7.36322,37.27034),
(2521456,"Ayamonte","ES",-7.40266,37.209942),
(6357232,"Iznájar","ES",-4.31612,37.279411),
(2516415,"Iznajar","ES",-4.30836,37.25766),
(6355380,"Aigües","ES",-0.36232,38.509178),
(2522366,"Aiguees","ES",-0.35,38.5),
(6358561,"Bañeza (La)","ES",-5.90267,42.295341),
(3119979,"La Baneza","ES",-5.89772,42.300259),
(3115762,"Naón","ES",-5.79444,43.399231),
(2514455,"Los Segados","ES",-1,37.799999),
(6362896,"Pinseque","ES",-1.083,41.732121),
(3113420,"Pinseque","ES",-1.10041,41.736568),
(6359001,"Alfaro","ES",-1.82434,42.159618),
(3130399,"Alfaro","ES",-1.75016,42.180321),
(6359074,"Lardero","ES",-2.47206,42.414089),
(3119153,"Lardero","ES",-2.46153,42.426861),
(6362702,"Alagón","ES",-1.1242,41.76865),
(3130739,"Alagon","ES",-1.11906,41.769642),
(6357343,"Sada","ES",-8.27061,43.36647),
(3232554,"<NAME>","ES",-8.25833,43.35556),
(3125421,"Cequelinos","ES",-8.25,42.133331),
(6359843,"Cenlle","ES",-8.0732,42.342461),
(3111152,"Sadurnín","ES",-8.08536,42.327801),
(6357341,"Ribeira","ES",-9.01773,42.542122),
(3126185,"Carreira","ES",-9.00613,42.549),
(6357281,"Boiro","ES",-8.87826,42.651951),
(3127889,"Boiro","ES",-8.9,42.650002),
(6356494,"<NAME>","ES",-3.75509,43.013538),
(3123128,"Entrambosríos","ES",-3.71667,43.066669),
(6362706,"Alborge","ES",-0.35351,41.339512),
(3130629,"Alborge","ES",-0.35675,41.333672),
(6356056,"Begues","ES",1.89649,41.3269),
(3128398,"Begues","ES",1.93333,41.333328),
(6360248,"Sanxenxo","ES",-8.83274,42.419022),
(3110610,"Sanxenxo","ES",-8.80698,42.39996),
(6362315,"<NAME>","ES",-4.76551,41.525391),
(3106067,"<NAME>","ES",-4.75245,41.52927),
(6361866,"Ademuz","ES",-1.22341,40.075062),
(3109047,"Sesga","ES",-1.18333,40.033329),
(6358939,"Sort","ES",1.07684,42.45261),
(3108485,"Surp","ES",1.12665,42.453339),
(6359566,"Anue","ES",-1.58368,42.978951),
(3129990,"Anocíbar","ES",-1.63951,42.920059),
(6358595,"Castrocontrigo","ES",-6.18339,42.207581),
(3115405,"Nogarejas","ES",-6.13916,42.187439),
(6362213,"<NAME>","ES",-5,41.86475),
(3117008,"<NAME>","ES",-5.04405,41.88327),
(6357668,"Cádiar","ES",-3.15564,36.93322),
(2509407,"Yátor","ES",-3.13677,36.957779),
(6361248,"Alcover","ES",1.16649,41.269249),
(3130557,"Alcover","ES",1.1701,41.262669),
(3123229,"El Valle","ES",-5.81755,43.159389),
(6359861,"Maceda","ES",-7.59617,42.25449),
(3129287,"Asadur","ES",-7.6,42.283329),
(3108353,"Tameiga","ES",-8.65,42.200001),
(6357212,"Carlota (La)","ES",-4.92924,37.676819),
(2516089,"La Carlota","ES",-4.93122,37.673592),
(6361855,"Villaseca de la Sagra","ES",-3.85727,39.967251),
(2522461,"Aceca","ES",-3.85,39.950001),
(6359865,"Merca (A)","ES",-7.89204,42.208511),
(3107176,"Urriós","ES",-7.86667,42.216671),
(6358862,"Juneda","ES",0.82853,41.54002),
(3107790,"Torregrosa","ES",0.82864,41.580341),
(6357873,"Cifuentes","ES",-2.58915,40.744942); |
<gh_stars>0
ALTER TABLE sprint
ADD COLUMN velocity REAL NOT NULL DEFAULT 0.0,
ADD COLUMN story_velocity REAL NOT NULL DEFAULT 0.0,
ADD COLUMN velocity_mean REAL NOT NULL DEFAULT 0.0,
ADD COLUMN story_velocity_mean REAL NOT NULL DEFAULT 0.0;
UPDATE sprint
SET velocity = CASE
WHEN worked_hours != 0 THEN
8 * achieved_points / worked_hours
ELSE
0
END;
UPDATE sprint
SET story_velocity = CASE
WHEN bugs_worked_hours != 0 THEN
8 * achieved_points / bugs_worked_hours
ELSE
0
END;
UPDATE sprint as this_sprint SET velocity_mean = (
SELECT avg(velocity) from sprint
WHERE project_id = this_sprint.project_id
);
UPDATE sprint as this_sprint SET story_velocity_mean = (
SELECT avg(story_velocity) from sprint
WHERE project_id = this_sprint.project_id
);
----------------------------------------------------------------------
ALTER TABLE "user" ALTER COLUMN location TYPE VARCHAR;
ALTER TABLE "user" ALTER COLUMN location SET DEFAULT 'poznan';
|
\echo creating bus_all_stops table
SET timezone = 'PST8PDT';
DROP TABLE IF EXISTS bus_all_stops CASCADE;
CREATE TABLE bus_all_stops (
vehicle_id integer,
opd_date date not null,
day_of_week integer,
year integer,
month integer,
day integer,
act_arr_time timestamp with time zone,
act_dep_time timestamp with time zone,
nom_arr_time timestamp with time zone,
nom_dep_time timestamp with time zone,
event_no_trip integer,
line_id integer,
pattern_direction character,
meters integer,
stop_id integer,
stop_pos integer,
distance_to_next integer,
distance_to_trip integer,
doors_opening integer,
stop_type integer,
door_open_time integer,
gps_longitude double precision,
gps_latitude double precision,
geom_point_4326 geometry(POINT, 4326),
id serial
) PARTITION BY RANGE(opd_date) ;
CREATE TABLE bus_all_stops_y2017m09
PARTITION OF bus_all_stops
FOR VALUES FROM ('2017-09-01') TO ('2017-10-01');
CREATE TABLE bus_all_stops_y2017m10
PARTITION OF bus_all_stops
FOR VALUES FROM ('2017-10-01') TO ('2017-11-01');
CREATE TABLE bus_all_stops_y2017m11
PARTITION OF bus_all_stops
FOR VALUES FROM ('2017-11-01') TO ('2017-12-01');
CREATE TABLE bus_all_stops_y2018m04
PARTITION OF bus_all_stops
FOR VALUES FROM ('2018-04-01') TO ('2018-05-01');
CREATE TABLE bus_all_stops_y2018m05
PARTITION OF bus_all_stops
FOR VALUES FROM ('2018-05-01') TO ('2018-06-01');
CREATE TABLE bus_all_stops_y2018m07
PARTITION OF bus_all_stops
FOR VALUES FROM ('2018-07-01') TO ('2018-08-01');
CREATE TABLE bus_all_stops_y2018m08
PARTITION OF bus_all_stops
FOR VALUES FROM ('2018-08-01') TO ('2018-09-01');
CREATE TABLE bus_all_stops_y2018m09
PARTITION OF bus_all_stops
FOR VALUES FROM ('2018-09-01') TO ('2018-10-01');
CREATE TABLE bus_all_stops_y2018m10
PARTITION OF bus_all_stops
FOR VALUES FROM ('2018-10-01') TO ('2018-11-01');
CREATE TABLE bus_all_stops_y2018m11
PARTITION OF bus_all_stops
FOR VALUES FROM ('2018-11-01') TO ('2018-12-01');
CREATE TABLE bus_all_stops_y2019m04
PARTITION OF bus_all_stops
FOR VALUES FROM ('2019-04-01') TO ('2019-05-01');
CREATE TABLE bus_all_stops_y2019m05
PARTITION OF bus_all_stops
FOR VALUES FROM ('2019-05-01') TO ('2019-06-01');
CREATE TABLE bus_all_stops_y2019m06
PARTITION OF bus_all_stops
FOR VALUES FROM ('2019-06-01') TO ('2019-07-01');
CREATE TABLE bus_all_stops_y2019m07
PARTITION OF bus_all_stops
FOR VALUES FROM ('2019-07-01') TO ('2019-08-01');
CREATE TABLE bus_all_stops_y2019m08
PARTITION OF bus_all_stops
FOR VALUES FROM ('2019-08-01') TO ('2019-09-01');
CREATE INDEX ON bus_all_stops (opd_date);
\echo loading
INSERT INTO bus_all_stops
SELECT raw.raw_veh_stoph.vehicle_id, raw.raw_veh_stoph.date_stamp::date AS opd_date,
date_part('dow', raw.raw_veh_stoph.date_stamp) AS day_of_week,
date_part('year', raw.raw_veh_stoph.date_stamp) AS year,
date_part('month', raw.raw_veh_stoph.date_stamp) AS month,
date_part('day', raw.raw_veh_stoph.date_stamp) AS day,
raw.raw_veh_stoph.date_stamp + raw.raw_veh_stoph.act_arr_time * interval '1 sec' AS act_arr_time,
raw.raw_veh_stoph.date_stamp + raw.raw_veh_stoph.act_dep_time * interval '1 sec' AS act_dep_time,
raw.raw_veh_stoph.date_stamp + raw.raw_veh_stoph.nom_arr_time * interval '1 sec' AS nom_arr_time,
raw.raw_veh_stoph.date_stamp + raw.raw_veh_stoph.nom_dep_time * interval '1 sec' AS nom_dep_time,
raw.raw_veh_stoph.event_no_trip, bus_trips.line_id, bus_trips.pattern_direction,
raw.raw_veh_stoph.meters, stop_id, stop_pos, distance_to_next, distance_to_trip,
doors_opening, stop_type, door_open_time,
gps_longitude, gps_latitude,
ST_SetSRID(ST_MakePoint(gps_longitude, gps_latitude), 4326) AS geom_point_4326
FROM raw.raw_veh_stoph
INNER JOIN bus_trips ON bus_trips.event_no_trip = raw.raw_veh_stoph.event_no_trip
WHERE stop_type = 3
AND gps_longitude IS NOT NULL
AND gps_latitude IS NOT NULL
;
\echo primary key
ALTER TABLE bus_all_stops ADD PRIMARY KEY (event_no_trip, opd_date, id);
|
DROP TABLE IF EXISTS osmaxx.transport_l;
CREATE TABLE osmaxx.transport_l (
osm_id BIGINT,
lastchange TIMESTAMP WITHOUT TIME ZONE,
geomtype CHAR(1),
geom GEOMETRY(MULTILINESTRING, 4326),
aggtype TEXT,
type TEXT,
name TEXT,
name_en TEXT,
name_fr TEXT,
name_es TEXT,
name_de TEXT,
int_name TEXT,
label TEXT,
tags TEXT
);
|
-- file:insert.sql ln:86 expect:true
drop type insert_test_type
|
<reponame>obi-two/GameServer
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET FOREIGN_KEY_CHECKS=0 */;
DROP PROCEDURE IF EXISTS `sp_PersistPlayer`;
DELIMITER //
CREATE PROCEDURE `sp_PersistPlayer`(IN `in_object_id` BIGINT, IN `in_profession_tag` VARCHAR(255), IN `in_total_playtime` BIGINT, IN `in_csr_tag` SMALLINT, IN `in_max_force` INT,
IN `in_experimentation_enabled` TINYINT, IN `in_crafting_stage` INT, IN `in_nearest_crafting_station` BIGINT, IN `in_experimentation_points` INT, IN `in_accomplishment_counter` INT,
IN `in_current_language` INT, IN `in_current_stomach` INT, IN `in_max_stomach` INT, IN `in_current_drink` INT, IN `in_max_drink` INT, IN `in_jedi_state` INT)
BEGIN
DECLARE does_exist INT;
select count(*) from player p where p.id = in_object_id into does_exist;
if does_exist > 0 then
update player set profession_tag = in_profession_tag, total_playtime = in_total_playtime, csr_tag = in_csr_tag, max_force = in_max_force,
experimentation_enabled = in_experimentation_enabled, crafting_stage = in_crafting_stage, nearest_crafting_station = in_nearest_crafting_station,
accomplishment_counter = in_accomplishment_counter, current_language = in_current_language, current_stomach = in_current_stomach, max_stomach = in_max_stomach,
current_drink = in_current_drink, max_drink = in_max_drink, jedi_state = in_jedi_state
where player.id = in_object_id;
else
insert into player set id = in_object_id, profession_tag = in_profession_tag, born_date = NOW(), total_playtime = in_total_playtime, csr_tag = in_csr_tag, max_force = in_max_force,
experimentation_enabled = in_experimentation_enabled, crafting_stage = in_crafting_stage, nearest_crafting_station = in_nearest_crafting_station,
accomplishment_counter = in_accomplishment_counter, current_language = in_current_language, current_stomach = in_current_stomach, max_stomach = in_max_stomach,
current_drink = in_current_drink, max_drink = in_max_drink, jedi_state = in_jedi_state;
end if;
END//
DELIMITER ;
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
INSERT INTO CotionUser(UserID, Username, Email, Password, Avatar)
VALUES ('<KEY>', 'Test account', '<EMAIL>', '<PASSWORD>', ''),
('b<PASSWORD>', 'Nikita account', '<EMAIL>', '<PASSWORD>', '');
INSERT INTO Note(NoteID, Name, Body)
VALUES ('1', '1st psql note', 'Body of 1st psql note.'),
('3', '3st psql note', 'Body of 3st psql note.');
INSERT INTO UsersNotes(UserID, NoteID)
VALUES ('<KEY>', '1'),
('<KEY>', '3'); |
-- V002__AddEmployeeTitles.sql
CREATE TABLE Titles
(
Id INT NOT NULL PRIMARY KEY IDENTITY(1,1),
Title VARCHAR(100) NOT NULL
)
GO
INSERT INTO Titles (Title) VALUES ('Underling');
INSERT INTO Titles (Title) VALUES ('Evil Overlord');
INSERT INTO Titles (Title) VALUES ('Benevolent Dictator');
GO |
# --- !Ups
CREATE TABLE Friend (
id bigint(20) NOT NULL AUTO_INCREMENT,
name varchar(255),
surname varchar(255),
PRIMARY KEY (id)
);
# --- !Downs
DROP TABLE Friend; |
子查询
子查询是一条查询语句,其嵌套在其他sql语句中,作用是为外层的sql语句提供数据
和james相同部门的员工?
SELECT ename,deptno FROM emp_xwbing WHERE deptno=(SELECT deptno FROM emp_xwbing WHERE ename='JAMES');
子查询除了常用dql之外,也可以子啊ddl与dml中使用
在ddl中应用:
使用子查询的结果快速创建一张表,若子查询中查询的内容是函数或表达式,那么该字段必须给别名.
CREATE TABLE myemployee
AS
SELECT
e.empno,e.ename,e.job,e.sal*12 sal,
e.deptno,d.dname,d.loc
FROM
emp e,dept d
WHERE
e.deptno=d.deptno
dml中使用子查询:
删除和james相同部门的所有员工?
DELETE FROM emp_xwbing WHERE deptno=(SELECT deptno FROM emp_xwbing WHERE ename='JAMES');
UPDATE emp_xwbing SET SAL=SAL*1.1 WHERE deptno=(SELECT deptno FROM emp_xwbing WHERE ename='JAMES');
SELECT * FROM EMP_XWBING;
子查询根据查询结果集不同通常分为:
单行单列:常用在WHERE中(配合 =,>,< 等)
多行单列:常用在WHERE中(配合 IN,ANY,ALL)
多行多列:常用在WHERE中作为表看待
查看比clerk和salesman部门工资都高的员工?
SELECT ename,sal FROM emp_xwbing WHERE sal>ALL(SELECT sal FROM emp_xwbing WHERE job='SALESMAN' OR job='CLERK');
查看和clerk相同部门的其他职位员工?
SELECT ename FROM emp_xwbing WHERE deptno in (SELECT deptno FROM emp_xwbing WHERE JOB='CLERK');
EXISTS 关键字
指定一个子查询,检测行的存在.遍历循环外表,然后看外表中的记录有没有和内表的数据一样的.匹配上就将结果放入结果集中.
用在WHERE中,其后要根一个子查询,作用是若子查询至少可以查询出一条记录,那么exisets表达式返回真,NOT EXISTS 则起到相反的作用,查不到数据则返回真
产看有员工的部门?
SELECT d.deptno,d.dname,d.loc FROM dept_xwbing d WHERE EXISTS(SELECT * FROM EMP_XWBING e WHERE e.deptno=d.deptno);
没有下属的员工?
SELECT n.ENAME FROM EMP_XWBING n WHERE NOT EXISTS(SELECT * FROM EMP_XWBING m WHERE N.EMPNO=M.MGR);
查询列出最低薪水高于部门30的最低薪水的部门的最低薪水?
SELECT min(sal),deptno FROM emp_xwbing GROUP BY deptno having min(sal)>(SELECT min(sal) FROM emp_xwbing WHERE deptno=30);
子查询在FROM部分:
查看高于自己所在部门平均工资的员工信息?
SELECT e.ename ,e.sal,e.deptno FROM emp_xwbing e,(SELECT avg(sal) avg_sal,deptno FROM emp_xwbing GROUP BY deptno) t WHERE e.deptno=t.deptno AND E.SAL>T.AVG_SAL;
子查询在SELECT部分:可以认为是外连接的另一种表现
SELECT e.ename,e.sal,(SELECT d.dname FROM dept_xwbing d WHERE e.deptno=d.deptno ) dname FROM emp_xwbing e;
分页查询:oracle
通常一个查询语句查询的数据来量过大时,都会使用分页机制.分页就是将数据分批查询出来.一次只查询部分内容,这样的好处可以减少系统响应时间,减少系统资源开销
分页由于在标准sql语句中没有定义,所以不同的数据库语法不相同(方言)
ORACLE 中使用 ROWNUM 这个伪列来实现分页.
ROWNUM,该列不存在于数据库任何表中,但是任何表都可以查询该列,该列在结果集中的值是每条记录的行号,行号从1开始.
编号是在查询的过程中进行的,只要可以从表中查询出一条数据,ROWNUM
SELECT rownum, ename,job FROM EMP_XWBING WHERE ROWNUM BETWEEN 2 AND 10 ;
在使用rownum对结果集编号的查询过程中不要使用rownum做>1以上数字的判断,否则查询不到任何数据.先编号再查询.
SELECT * FROM(SELECT rownum rn, ename,job FROM EMP_XWBING) WHERE rn BETWEEN 6 AND 10;
若对查询内容有排序需求时,要先进行排序操作.
取公司工资排名的6-10?
SELECT *
FROM(SELECT rownum rn,t.*
FROM(SELECT ename,sal,job
FROM emp_xwbing
ORDER BY sal DESC)t
WHERE rownum<=10)
WHERE rn >5;
换算范围值:
PageSize:每页显示的条数
Page:页数
start=(page-1)*pagesize+1
end=pagesize*page
DECODE(expr,search1,result1,[search2,result2.......][,default]) 无 default 返回 NULL
可以实现分支效果
SELECT ename,job,sal,DECODE(job,'MANAGER',sal*1.2,'ANALYST',sal*1.1,'SALESMAN',sal*1.05,sal) bonus FROM emp_xwbing;
统计人数,将职位是'analyst'和'manager'看作一组,其他职位看作另一组 分别统计两组人数?
SELECT count(*) ,decode(job,'ANALYST','VIP','MANAGER','VIP','HTHER') FROM emp_xwbing GROUP BY decode(job,'ANALYST','VIP','MANAGER','VIP','HTHER');
自定义排序
SELECT deptno,dname,loc FROM dept_xwbing ORDER BY decode(dname,'OPERATIONS',1,'ACCOUNTING',2,'SALES',3);
排序函数
ROW_NUMBER() OVER(PARTITION BY col1 ORDER BY col2)
排序函数可以将结果集按照指定的分段分组,然后在组内按照指定的分段排序,并为组内每条记录生成一个编号
ROW_NUMBER:组内连续且唯一的数字
公司每个部门的工资排名?
SELECT ename,sal,deptno,row_number() over(partition BY deptno ORDER BY sal DESC) rank FROM emp_xwbing;
RANK:组内不连续不唯一数字
RANK() OVER(PARTITION BY col1 ORDER BY col2)
SELECT ename,sal,deptno,rank() over(partition BY deptno ORDER BY sal DESC) rank FROM emp_xwbing;
DENSE_RANK:组内连续但不唯一数字
SELECT ename,sal,deptno,dense_rank() over(partition BY deptno ORDER BY sal DESC) rank FROM emp_xwbing;
create table sales_xwbing(year_id number NOT NULL,month_id number NOT NULL,day_id number NOT NULL,sales_value number(10,2) NOT NULL);
insert into sales_xwbing
SELECT trunc(dbms_rANDom.value(2010,2012))as year_id,
trunc(dbms_rANDom.value(1,13))as month_id,
trunc(dbms_rANDom.value(1,32))as day_id,
round(dbms_rANDom.value(1,100),2)as sales_value
FROM dual
connect BY level <=1000;
集合操作
union,union all,intersect,minus
union:并集
SELECT ename ,job,sal FROM emp_xwbing WHERE job='MANAGER'
UNION
SELECT ename,job,sal FROM emp_xwbing WHERE sal>2500;
intersect:交集
SELECT ename ,job,sal FROM emp_xwbing WHERE job='MANAGER'
intersect
SELECT ename,job,sal FROM emp_xwbing WHERE sal>2500;
minus:差集
SELECT ename ,job,sal FROM emp_xwbing WHERE job='MANAGER'
minus
SELECT ename,job,sal FROM emp_xwbing WHERE sal>2500;
查看每天的营业额?
SELECT year_id,month_id,day_id,sum(sales_value) FROM sales_xwbing GROUP BY year_id,month_id,day_id ORDER BY year_id,month_id,day_id;
高级分组函数
ROLLUP函数
rollup分组次数有指定的参数据决定,次数为参加个数+1次,而且分组原则是每个参数递减的形式,然后将这些分组的结果并在一个结果集中显示
GROUP BY ROLLUP(a,b,c...)
GROUP BY ROLLUP(a,b,c)
等同于
GROUP BY a,b,c
union all
GROUP BY a,b
union all
GROUP BY a
查看每天,每月,每年,和总营业额?
SELECT year_id,month_id,day_id,sum(sales_value) FROM sales_xwbing GROUP BY rollup(year_id,month_id,day_id);
CUBE 函数
CUBE 分组次数是n个参数的2的n次方,会将每种组合进行一次分组并将所有结果并在一个结果集中显示
SELECT year_id,month_id,day_id,sum(sales_value) FROM sales_xwbing GROUP BY cube(year_id,month_id,day_id) ORDER BY year_id,month_id,day_id;
GROUPING SETS()
该分组函数允许按照指定的分组方式进行分组,然后将这些分组统计的结果并在一个结果集中显示函数的每一个参数,就是一种分组方式.
SELECT year_id,month_id,day_id,sum(sales_value) FROM sales_xwbing GROUP BY GROUPing sets((year_id,month_id,day_id),(year_id,month_id)) ORDER BY year_id,month_id,day_id;
|
<reponame>GBishop-PHSA/mdm-core
ALTER TABLE security.securable_resource_group_role
ADD can_finalise_model BOOLEAN;
-- Finalised models cant be finalised so we can set that
UPDATE security.securable_resource_group_role
SET can_finalise_model = FALSE
WHERE finalised_model IS NOT NULL AND
finalised_model = TRUE |
<gh_stars>100-1000
-- Deploy actor_has_permission_on
-- requires: base
-- requires: id_resolution_functions
BEGIN;
-- Generic check for actors having permission on authz entities of arbitrary
-- type. Don't think that we need similar functions for groups having a permission,
-- since I don't think that's ever queried for directly from outside.
-- auth_any_permission includes all the regular permissions plus 'any' for testing
-- if query_actor has any permission
CREATE OR REPLACE FUNCTION actor_has_permission_on(
query_actor auth_actor.authz_id%TYPE,
query_target char(32),
target_type auth_type,
perm auth_any_permission)
RETURNS BOOLEAN
LANGUAGE plpgsql
STABLE -- <- this function doesn't alter the database; just queries it
STRICT -- <- returns NULL immediately if any arguments are NULL
AS $$
DECLARE
-- Convert Authz IDs into internal database IDs
--
-- If the Authz IDs don't refer to an existing item, an error will
-- be thrown.
actor_id auth_actor.id%TYPE NOT NULL := actor_id(query_actor);
target_id bigint NOT NULL := authz_id_for_type(query_target, target_type);
actor_table char(32) := quote_ident(target_type || '_acl_actor');
group_table char(32) := quote_ident(target_type || '_acl_group');
has_result bigint;
BEGIN
-- Check to see if the actor has the permission directly
EXECUTE 'SELECT a.target FROM ' || actor_table || ' AS a
WHERE a.target = $1
AND a.authorizee = $2
AND ($3 = ''any'' OR a.permission::text = $3::text)'
USING target_id, actor_id, perm
INTO has_result;
-- If that returned anything, we're done
IF has_result IS NOT NULL THEN
RETURN TRUE;
END IF;
-- The permission wasn't granted directly to the actor, we need
-- to check the groups the actor is in
EXECUTE 'SELECT a.target FROM ' || group_table || ' AS a
JOIN groups_for_actor($1)
AS gs(id) ON gs.id = a.authorizee
WHERE a.target = $2
AND ($3 = ''any'' OR a.permission::text = $3::text)'
USING actor_id, target_id, perm
INTO has_result;
-- If anything was found, we're done
IF has_result IS NOT NULL THEN
RETURN TRUE;
END IF;
-- The actor doesn't have the permission
RETURN FALSE;
END;
$$;
COMMIT;
|
<filename>src/com/clima/SQL/02 - Controle Clima - INSERTS login.sql<gh_stars>0
-- Table TB_login
---------------------------------------------id_login, login, senha, email, Perfil
INSERT INTO TB_login VALUES(01, 'adilson', 1, '<EMAIL>','admin');
--INSERT INTO TB_login (login, senha, email, perfil) VALUES ('encrypted', MD5('1'), '<EMAIL>','admin');
|
<filename>insert_kelompokmapel.sql<gh_stars>0
TRUNCATE TABLE kelompokmapel;
INSERT INTO `iq`.`kelompokmapel`(`kelompokmapel`, `kelas_id`, `semester_id`) VALUES ('Kelompok A (Wajib)', 3, 2);
INSERT INTO `iq`.`kelompokmapel`(`kelompokmapel`, `kelas_id`, `semester_id`) VALUES ('Kelompok B (Wajib)', 3, 2);
INSERT INTO `iq`.`kelompokmapel`(`kelompokmapel`, `kelas_id`, `semester_id`) VALUES ('Kelompok C (Peminatan) - Peminatan Matematika dan Ilmu Alam', 3, 2);
INSERT INTO `iq`.`kelompokmapel`(`kelompokmapel`, `kelas_id`, `semester_id`) VALUES ('Kelompok D (Lintas Minat)', 3, 2);
|
-- phpMyAdmin SQL Dump
-- version 4.9.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Nov 17, 2021 at 08:59 PM
-- Server version: 5.7.26
-- PHP Version: 7.4.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `api_rest_redclh`
--
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` int(11) NOT NULL,
`category_name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`id`, `category_name`) VALUES
(1, 'Technology'),
(2, 'Design'),
(3, 'Culture'),
(4, 'Business'),
(5, 'Politics'),
(6, 'Opinion'),
(7, 'Science'),
(8, 'Health'),
(9, 'Style'),
(10, 'Travel');
-- --------------------------------------------------------
--
-- Table structure for table `countries`
--
CREATE TABLE `countries` (
`id` bigint(20) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`informacion` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`ciudades` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`isActive` 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 `countries`
--
INSERT INTO `countries` (`id`, `user_id`, `code`, `informacion`, `ciudades`, `title`, `isActive`, `created_at`, `updated_at`) VALUES
(1, 1, 'NO', '<p>ads</p>\n', '<p>ads</p>\n', 'Norway', 'isVisible', '2021-10-08 00:50:58', NULL),
(2, 1, 'US', '<p>dasdasda</p>\n', '<p>dsadas</p>\n', 'Estados Unidos', 'isVisible', '2021-10-08 01:11:51', NULL),
(3, 1, 'CA', '<p>das</p>\n', '<p>das</p>\n', 'Canadá', 'isVisible', '2021-10-08 01:13:31', NULL),
(4, 1, 'VE', '<p>informmacion acerca de venezuela</p>\n', '<p>informmacion acerca de venezuela</p>\n', 'Venezuela', 'isVisible', '2021-11-18 00:28:05', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `crimeneslhs`
--
CREATE TABLE `crimeneslhs` (
`id` bigint(20) UNSIGNED NOT NULL,
`pais_code` varchar(11) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`crimeneslh` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`clasificacionColectiva` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`clasificacionIndividual` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`lugar` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`breveDescripcion` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`numCasosCPIAprobados` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`numCasosCPIPendientes` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`numCasosNoCpiAprobado` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`numCasosNoCpiPendiente` 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 `crimeneslhs`
--
INSERT INTO `crimeneslhs` (`id`, `pais_code`, `user_id`, `crimeneslh`, `clasificacionColectiva`, `clasificacionIndividual`, `lugar`, `breveDescripcion`, `numCasosCPIAprobados`, `numCasosCPIPendientes`, `numCasosNoCpiAprobado`, `numCasosNoCpiPendiente`, `created_at`, `updated_at`) VALUES
(1, 'NO', 1, 'das', 'da', 'da', 'das', '<p>dsa</p>\n', 'dsa', 'dsa', 'dsa', 'dsa', '2021-10-08 00:58:01', NULL),
(2, 'US', 1, 'das', 'da', 'das', 'dsa', '<p>dsa</p>\n', 'das', 'dsa', 'dsa', 'dsa', '2021-10-08 01:12:41', NULL),
(3, 'CA', 1, 'das', 'das', 'dsa', 'das', '<p>dsa</p>\n', 'dsa', 'dsa', 'adss', 'ads', '2021-10-08 01:14:29', '2021-10-08 01:15:20'),
(4, 'VE', 1, 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', '<p>informmacion acerca de venezuela</p>\n', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', '2021-11-18 00:29:02', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `datosvictimas`
--
CREATE TABLE `datosvictimas` (
`id` bigint(20) UNSIGNED NOT NULL,
`pais_code` varchar(11) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`numDatosvictimas` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`generoVictimasHombre` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`generoVictimasMujer` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`edadVictimaNino` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`edadVictimaJoven` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`edadVictimaAdulto` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`edadVictimaOld` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`estatusMigratorioRegular` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`estatusMigratorioIrregular` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`estatusConsulado` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`estadoIntegridad` 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 `datosvictimas`
--
INSERT INTO `datosvictimas` (`id`, `pais_code`, `user_id`, `numDatosvictimas`, `generoVictimasHombre`, `generoVictimasMujer`, `edadVictimaNino`, `edadVictimaJoven`, `edadVictimaAdulto`, `edadVictimaOld`, `estatusMigratorioRegular`, `estatusMigratorioIrregular`, `estatusConsulado`, `estadoIntegridad`, `created_at`, `updated_at`) VALUES
(1, 'NO', 1, 'dsa', 'das', 'ads', 'das', 'das', 'dads', 'dsa', 'dsa', 'das', '<p>dsa</p>\n', 'das', '2021-10-08 00:57:42', NULL),
(2, 'US', 1, 'asdas', 'das', 'das', 'das', 'das', 'das', 'dasd', 'a', 'ads', '<p>da</p>\n', 'da', '2021-10-08 01:12:22', NULL),
(3, 'CA', 1, 'da', 'ads', 'dsa', 'das', 'das', 'das', 'dsa', 'das', 'das', '<p>das</p>\n', 'dass', '2021-10-08 01:14:01', '2021-10-08 01:15:13'),
(4, 'VE', 1, 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', '<p>informmacion acerca de venezuela</p>\n', 'informmacion acerca de venezuela', '2021-11-18 00:28:41', NULL);
-- --------------------------------------------------------
--
-- 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, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(3, '2021_07_03_232958_create_datosvictimas_table', 1),
(4, '2021_07_03_233033_create_pais_table', 1),
(5, '2021_07_03_233047_create_crimeneslhs_table', 1),
(6, '2021_07_03_233113_create_violacionesddhhs_table', 1);
-- --------------------------------------------------------
--
-- Table structure for table `pais`
--
CREATE TABLE `pais` (
`id` bigint(20) UNSIGNED NOT NULL,
`code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `pais`
--
INSERT INTO `pais` (`id`, `code`, `title`) VALUES
(1, 'AD', 'Andorra'),
(2, 'AE', 'United Arab Emirates'),
(3, 'AF', 'Afghanistan'),
(4, 'AG', 'Antigua and Barbuda'),
(5, 'AI', 'Anguilla'),
(6, 'AL', 'Albania'),
(7, 'AM', 'Armenia'),
(8, 'AO', 'Angola'),
(9, 'AR', 'Argentina'),
(10, 'AS', 'American Samoa'),
(11, 'AT', 'Austria'),
(12, 'AU', 'Australia'),
(13, 'AW', 'Aruba'),
(14, 'AX', 'Aland Islands'),
(15, 'AZ', 'Azerbaijan'),
(16, 'BA', 'Bosnia and Herzegovina'),
(17, 'BB', 'Barbados'),
(18, 'BD', 'Bangladesh'),
(19, 'BE', 'Belgium'),
(20, 'BF', 'Burkina Faso'),
(21, 'BG', 'Bulgaria'),
(22, 'BH', 'Bahrain'),
(23, 'BI', 'Burundi'),
(24, 'BJ', 'Benin'),
(25, 'BL', 'Saint Barthelemy'),
(26, 'BN', 'Brunei Darussalam'),
(27, 'BO', 'Bolivia'),
(28, 'BM', 'Bermuda'),
(29, 'BQ', 'Bonaire, Sint Eustatius and Saba'),
(30, 'BR', 'Brazil'),
(31, 'BS', 'Bahamas'),
(32, 'BT', 'Bhutan'),
(33, 'BV', 'Bouvet Island'),
(34, 'BW', 'Botswana'),
(35, 'BY', 'Belarus'),
(36, 'BZ', 'Belize'),
(37, 'CA', 'Canada'),
(38, 'CC', 'Cocos (Keeling) Islands'),
(39, 'CD', 'Democratic Republic of Congo'),
(40, 'CF', 'Central African Republic'),
(41, 'CG', 'Republic of Congo'),
(42, 'CH', 'Switzerland'),
(43, 'CI', 'Côte d\'Ivoire'),
(44, 'CK', 'Cook Islands'),
(45, 'CL', 'Chile'),
(46, 'CM', 'Cameroon'),
(47, 'CN', 'China'),
(48, 'CO', 'Colombia'),
(49, 'CR', 'Costa Rica'),
(50, 'CU', 'Cuba'),
(51, 'CV', 'Cape Verde'),
(52, 'CW', 'Curaçao'),
(53, 'CX', 'Christmas Island'),
(54, 'CY', 'Cyprus'),
(55, 'CZ', 'Czech Republic'),
(56, 'DE', 'Germany'),
(57, 'DJ', 'Djibouti'),
(58, 'DK', 'Denmark'),
(59, 'DM', 'Dominica'),
(60, 'DO', 'Dominican Republic'),
(61, 'DZ', 'Algeria'),
(62, 'EC', 'Ecuador'),
(63, 'EG', 'Egypt'),
(64, 'EE', 'Estonia'),
(65, 'EH', 'Western Sahara'),
(66, 'ER', 'Eritrea'),
(67, 'ES', 'Spain'),
(68, 'ET', 'Ethiopia'),
(69, 'FI', 'Finland'),
(70, 'ET', 'Ethiopia'),
(71, 'FJ', 'Fiji'),
(72, 'FK', 'Falkland Islands'),
(73, 'FM', 'Federated States of Micronesia'),
(74, 'FO', 'Faroe Islands'),
(75, 'FR', 'France'),
(76, 'GA', 'Gabon'),
(77, 'GB', 'United Kingdom'),
(78, 'GE', 'Georgia'),
(79, 'GD', 'Grenada'),
(80, 'GG', 'Guernsey'),
(81, 'GH', 'Ghana'),
(82, 'GI', 'Gibraltar'),
(83, 'GL', 'Greenland'),
(84, 'GM', 'Gambia'),
(85, 'GN', 'Guinea'),
(86, 'GO', 'Glorioso Islands'),
(87, 'GP', 'Guadeloupe'),
(88, 'GQ', 'Equatorial Guinea'),
(89, 'GR', 'Greece'),
(90, 'GS', 'South Georgia and South Sandwich Islands'),
(91, 'GT', 'Guatemala'),
(92, 'GU', 'Guam'),
(93, 'GW', 'Guinea-Bissau'),
(94, 'GY', 'Guyana'),
(95, 'HK', 'Hong Kong'),
(96, 'HM', 'Heard Island and McDonald Islands'),
(97, 'HN', 'Honduras'),
(98, 'HR', 'Croatia'),
(99, 'HT', 'Haiti'),
(100, 'HU', 'Hungary'),
(101, 'ID', 'Indonesia'),
(102, 'IE', 'Ireland'),
(103, 'IL', 'Israel'),
(104, 'IM', 'Isle of Man'),
(105, 'IN', 'India'),
(106, 'IO', 'British Indian Ocean Territory'),
(107, 'IQ', 'Iraq'),
(108, 'IR', 'Iran'),
(109, 'IS', 'Iceland'),
(110, 'IT', 'Italy'),
(111, 'JE', 'Jersey'),
(112, 'JM', 'Jamaica'),
(113, 'JO', 'Jordan'),
(114, 'JP', 'Japan'),
(115, 'JU', 'Juan De Nova Island'),
(116, 'KE', 'Kenya'),
(117, 'KG', 'Kyrgyzstan'),
(118, 'KH', 'Cambodia'),
(119, 'KI', 'Kiribati'),
(120, 'KM', 'Comoros'),
(121, 'KN', 'Saint Kitts and Nevis'),
(122, 'KP', 'North Korea'),
(123, 'KR', 'South Korea'),
(124, 'KR', 'South Korea'),
(125, 'XK', 'Kosovo'),
(126, 'KW', 'Kuwait'),
(127, 'KY', 'Cayman Islands'),
(128, 'KZ', 'Kazakhstan'),
(129, 'LA', 'Lao People\'s Democratic Republic'),
(130, 'LB', 'Lebanon'),
(131, 'LC', 'Saint Lucia'),
(132, 'LI', 'Liechtenstein'),
(133, 'LK', 'Sri Lanka'),
(134, 'LR', 'Liberia'),
(135, 'LS', 'Lesotho'),
(136, 'LT', 'Lithuania'),
(137, 'LU', 'Luxembourg'),
(138, 'LV', 'Latvia'),
(139, 'LY', 'Libya'),
(140, 'MA', 'Morocco'),
(141, 'MC', 'Monaco'),
(142, 'MD', 'Moldova'),
(143, 'MG', 'Madagascar'),
(144, 'ME', 'Montenegro'),
(145, 'MF', 'Saint Martin'),
(146, 'MH', 'Marshall Islands'),
(147, 'MK', 'Macedonia'),
(148, 'ML', 'Mali'),
(149, 'MO', 'Macau'),
(150, 'MM', 'Myanmar'),
(151, 'MN', 'Mongolia'),
(152, 'MP', 'Northern Mariana Islands'),
(153, 'MQ', 'Martinique'),
(154, 'MR', 'Mauritania'),
(155, 'MS', 'Montserrat'),
(156, 'MT', 'Malta'),
(157, 'MU', 'Mauritius'),
(158, 'MV', 'Maldives'),
(159, 'MW', 'Malawi'),
(160, 'MX', 'Mexico'),
(161, 'MY', 'Malaysia'),
(162, 'MZ', 'Mozambique'),
(163, 'NA', 'Namibia'),
(164, 'NC', 'New Caledonia'),
(165, 'NE', 'Niger'),
(166, 'NF', 'Norfolk Island'),
(167, 'NG', 'Nigeria'),
(168, 'NI', 'Nicaragua'),
(169, 'NL', 'Netherlands'),
(170, 'NO', 'Norway'),
(171, 'NP', 'Nepal'),
(172, 'NR', 'Nauru'),
(173, 'NU', 'Niue'),
(174, 'NZ', 'New Zealand'),
(175, 'OM', 'Oman'),
(176, 'PA', 'Panama'),
(177, 'OM', 'Oman'),
(178, 'PE', 'Peru'),
(179, 'PF', 'French Polynesia'),
(180, 'PG', 'Papua New Guinea'),
(181, 'PH', 'Philippines'),
(182, 'PK', 'Pakistan'),
(183, 'PL', 'Poland'),
(184, 'PM', 'Saint Pierre and Miquelon'),
(185, 'PN', 'Pitcairn Islands'),
(186, 'PR', 'Puerto Rico'),
(187, 'PS', 'Palestinian Territories'),
(188, 'PT', 'Portugal'),
(189, 'PW', 'Palau'),
(190, 'PY', 'Paraguay'),
(191, 'QA', 'Qatar'),
(192, 'RE', 'Reunion'),
(193, 'RO', 'Romania'),
(194, 'RS', 'Serbia'),
(195, 'RU', 'Russia'),
(196, 'RW', 'Rwanda'),
(197, 'SA', 'Saudi Arabia'),
(198, 'SB', 'Solomon Islands'),
(199, 'SC', 'Seychelles'),
(200, 'SD', 'Sudan'),
(201, 'SE', 'Sweden'),
(202, 'SG', 'Singapore'),
(203, 'SH', 'Saint Helena'),
(204, 'SI', 'Slovenia'),
(205, 'SJ', 'Svalbard and <NAME>'),
(206, 'SK', 'Slovakia'),
(207, 'SL', 'Sierra Leone'),
(208, 'SM', 'San Marino'),
(209, 'SN', 'Senegal'),
(210, 'SO', 'Somalia'),
(211, 'SR', 'Suriname'),
(212, 'SS', 'South Sudan'),
(213, 'ST', 'Sao Tome and Principe'),
(214, 'SV', 'El Salvador'),
(215, 'SX', 'Sint Maarten'),
(216, 'SY', 'Syria'),
(217, 'SZ', 'Swaziland'),
(218, 'TC', 'Turks and Caicos Islands'),
(219, 'TD', 'Chad'),
(220, 'TF', 'French Southern and Antarctic Lands'),
(221, 'TG', 'Togo'),
(222, 'TH', 'Thailand'),
(223, 'TJ', 'Tajikistan'),
(224, 'TK', 'Tokelau'),
(225, 'TL', 'Timor-Leste'),
(226, 'TM', 'Turkmenistan'),
(227, 'TN', 'Tunisia'),
(228, 'TO', 'Tonga'),
(229, 'TR', 'Turkey'),
(230, 'TT', 'Trinidad and Tobago'),
(231, 'TV', 'Tuvalu'),
(232, 'TW', 'Taiwan'),
(233, 'TZ', 'Tanzania'),
(234, 'UA', 'Ukraine'),
(235, 'UG', 'Uganda'),
(236, 'UM-DQ', 'Jarvis Island'),
(237, 'UM-FQ', 'Baker Island'),
(238, 'UM-HQ', 'Howland Island'),
(239, 'UM-JQ', '<NAME>'),
(240, 'UM-MQ', 'Midway Islands'),
(241, 'UM-WQ', 'Wake Island'),
(242, 'US', 'United States'),
(243, 'UY', 'Uruguay'),
(244, 'UZ', 'Uzbekistan'),
(245, 'VA', 'Vatican City'),
(246, 'VC', 'Saint Vincent and the Grenadines'),
(247, 'VE', 'Venezuela'),
(248, 'VG', 'British Virgin Islands'),
(249, 'VI', 'US Virgin Islands'),
(250, 'VN', 'Vietnam'),
(251, 'VU', 'Vanuatu'),
(252, 'WF', 'Wallis and Futuna'),
(253, 'WS', 'Samoa'),
(254, 'YE', 'Yemen'),
(255, 'YT', 'Mayotte'),
(256, 'ZA', 'South Africa'),
(257, 'ZM', 'Zambia'),
(258, 'ZW', 'Zimbabwe');
-- --------------------------------------------------------
--
-- Table structure for table `personal_access_tokens`
--
CREATE TABLE `personal_access_tokens` (
`id` bigint(20) UNSIGNED NOT NULL,
`tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`tokenable_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`abilities` text COLLATE utf8mb4_unicode_ci,
`last_used_at` timestamp NULL DEFAULT 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 `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`username` varchar(50) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`first_name` varchar(30) DEFAULT NULL,
`last_name` varchar(30) DEFAULT NULL,
`token` varchar(255) DEFAULT NULL,
`is_active` tinyint(1) NOT NULL,
`created_at` datetime NOT NULL,
`image` varchar(255) NOT NULL,
`role` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `first_name`, `last_name`, `token`, `is_active`, `created_at`, `image`, `role`) VALUES
(1, 'admin', '<PASSWORD>', 'Admin', 'redCLH', '<PASSWORD>', 1, '2018-10-27 05:25:13', 'logo.jpg', 'admin');
-- --------------------------------------------------------
--
-- Table structure for table `violacionesddhhs`
--
CREATE TABLE `violacionesddhhs` (
`id` bigint(20) UNSIGNED NOT NULL,
`pais_code` varchar(11) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`violacionesDdhhTotal` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`clasificacionDCP` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`clasificacionDESCA` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`calsificacionPueblos` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`lugar` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`breveDescripcion` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`numCasosCorteInterDDHH` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`numCasosComDHNU` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`casosNoAccionar` 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 `violacionesddhhs`
--
INSERT INTO `violacionesddhhs` (`id`, `pais_code`, `user_id`, `violacionesDdhhTotal`, `clasificacionDCP`, `clasificacionDESCA`, `calsificacionPueblos`, `lugar`, `breveDescripcion`, `numCasosCorteInterDDHH`, `numCasosComDHNU`, `casosNoAccionar`, `created_at`, `updated_at`) VALUES
(1, 'NO', 1, 'das', 'dsa', 'ads', 'das', 'dsa', '<p>ddsa</p>\n', 'ads', 'das', 'ads', '2021-10-08 01:06:29', NULL),
(2, 'US', 1, 'dasads', 'das', 'das', 'das', 'das', '<p>da</p>\n', 'das', 'das', 'da', '2021-10-08 01:13:00', NULL),
(3, 'CA', 1, 'das', 'das', 'dsa', 'das', 'dsa', '<p>dsa</p>\n', 'dsa', 'das', 'dsa', '2021-10-08 01:14:50', NULL),
(4, 'VE', 1, 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', '<p>informmacion acerca de venezuela</p>\n', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', 'informmacion acerca de venezuela', '2021-11-18 00:29:26', NULL);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `countries`
--
ALTER TABLE `countries`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `crimeneslhs`
--
ALTER TABLE `crimeneslhs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `datosvictimas`
--
ALTER TABLE `datosvictimas`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `pais`
--
ALTER TABLE `pais`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);
--
-- Indexes for table `violacionesddhhs`
--
ALTER TABLE `violacionesddhhs`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `countries`
--
ALTER TABLE `countries`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `crimeneslhs`
--
ALTER TABLE `crimeneslhs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `datosvictimas`
--
ALTER TABLE `datosvictimas`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `pais`
--
ALTER TABLE `pais`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=259;
--
-- AUTO_INCREMENT for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `violacionesddhhs`
--
ALTER TABLE `violacionesddhhs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
|
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `revista` DEFAULT CHARACTER SET utf8 ;
USE `revista` ;
-- -----------------------------------------------------
-- Table `mydb`.`categorias`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `revista`.`categorias` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NULL,
`descripcion` VARCHAR(45) NULL,
`status` INT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`ediciones`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `revista`.`ediciones` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NULL,
`descripcion` VARCHAR(2000) NULL,
`status` INT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`abstract`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `revista`.`abstract` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NULL,
`descripcion` text NULL,
`img_abstract` VARCHAR(45) NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`capsula`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `revista`.`capsula` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NULL,
`descripcion` text NULL,
`status` INT NOT NULL,
`img_capsula` varchar(200),
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`posts`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `revista`.`posts` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user_id` BIGINT UNSIGNED NOT NULL,
`cuerpo` text NULL,
`titulo` VARCHAR(45) NULL,
`slug` VARCHAR(45) NOT NULL UNIQUE,
`visitas` INT NULL,
-- `scope` INT NOT NULL,
`img_portada` VARCHAR(45) NULL,
`status` INT NOT NULL,
-- `nombre_imagen` VARCHAR(45) NULL,
`categorias_id` INT NOT NULL,
`ediciones_id` INT NOT NULL,
`abstract_id` INT NOT NULL,
`tipo_post` INT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NULL,
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (`categorias_id`) REFERENCES `categorias` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (`ediciones_id`) REFERENCES `ediciones` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
FOREIGN KEY (`abstract_id`) REFERENCES `abstract` (`id`)ON DELETE NO ACTION ON UPDATE NO ACTION)
ENGINE = InnoDB DEFAULT CHARSET=latin1;
-- -----------------------------------------------------
-- Table `mydb`.`capsula`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `revista`.`lectores` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`nombre` varchar(200) NOT NULL,
`nombre_empresa` varchar(200) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(30) NOT NULL DEFAULT '<PASSWORD>',
`status` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |
<filename>inventory.sql
-- phpMyAdmin SQL Dump
-- version 4.2.11
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 03, 2015 at 04:54 AM
-- Server version: 5.6.21
-- PHP Version: 5.6.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: `inventory`
--
-- --------------------------------------------------------
--
-- Table structure for table `msarea`
--
CREATE TABLE IF NOT EXISTS `msarea` (
`areaID` varchar(20) NOT NULL DEFAULT '',
`areaName` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `msarea`
--
INSERT INTO `msarea` (`areaID`, `areaName`) VALUES
('area001', 'Jakarta Barat'),
('area002', 'Jakarta Timur');
-- --------------------------------------------------------
--
-- Table structure for table `mscustomer`
--
CREATE TABLE IF NOT EXISTS `mscustomer` (
`customerID` varchar(5) NOT NULL,
`customerAddress1` varchar(40) NOT NULL,
`customerAddress2` varchar(40) NOT NULL,
`customerAddress3` varchar(40) NOT NULL,
`customerAddress4` varchar(40) NOT NULL,
`areaID` varchar(20) NOT NULL,
`regionID` varchar(20) NOT NULL,
`customerPhone` varchar(20) NOT NULL,
`customerFax` varchar(20) NOT NULL,
`customerEmail` varchar(30) NOT NULL,
`customerContact` varchar(30) NOT NULL,
`POBirth` varchar(30) NOT NULL,
`DOBirth` date NOT NULL,
`customerReligion` varchar(12) NOT NULL,
`customerPosition` varchar(20) NOT NULL,
`customerStatus` varchar(12) NOT NULL,
`customerChildren` int(11) NOT NULL,
`customerPhoneHome` varchar(20) NOT NULL,
`customerMobile` varchar(20) NOT NULL,
`customerPinBB` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mscustomer`
--
INSERT INTO `mscustomer` (`customerID`, `customerAddress1`, `customerAddress2`, `customerAddress3`, `customerAddress4`, `areaID`, `regionID`, `customerPhone`, `customerFax`, `customerEmail`, `customerContact`, `POBirth`, `DOBirth`, `customerReligion`, `customerPosition`, `customerStatus`, `customerChildren`, `customerPhoneHome`, `customerMobile`, `customerPinBB`) VALUES
('CS001', 'Mediterania', 'Bangun Reksa', 'Cileduk', 'Tangerang', 'area001', 'reg001', '08123123123', '021393939', '<EMAIL>', 'nathan.febrianto', '20 juni 2012', '1994-02-03', 'Kristen', 'CEO', 'onDuty', 3, '08132123123', '08123123132', 'A96CEF');
-- --------------------------------------------------------
--
-- Table structure for table `msitem`
--
CREATE TABLE IF NOT EXISTS `msitem` (
`itemID` varchar(12) NOT NULL,
`itemBrand` varchar(20) NOT NULL,
`itemType` varchar(20) NOT NULL,
`itemDesc` varchar(40) NOT NULL,
`itemUnit` varchar(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `msitem`
--
INSERT INTO `msitem` (`itemID`, `itemBrand`, `itemType`, `itemDesc`, `itemUnit`) VALUES
('item001', 'Indofood', 'Food', 'Mie goreng', '20'),
('item002', 'Indofood', 'Food', 'Soto Mie', '100');
-- --------------------------------------------------------
--
-- Table structure for table `msitemset`
--
CREATE TABLE IF NOT EXISTS `msitemset` (
`itemSetID` varchar(12) NOT NULL,
`itemID` varchar(12) NOT NULL,
`itemQty` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `msitemset`
--
INSERT INTO `msitemset` (`itemSetID`, `itemID`, `itemQty`) VALUES
('set001', 'item001', 30);
-- --------------------------------------------------------
--
-- Table structure for table `msregion`
--
CREATE TABLE IF NOT EXISTS `msregion` (
`regionID` varchar(20) NOT NULL,
`regionName` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `msregion`
--
INSERT INTO `msregion` (`regionID`, `regionName`) VALUES
('reg001', 'Jakarta'),
('reg002', 'Bekasi'),
('reg003', 'Bogor');
-- --------------------------------------------------------
--
-- Table structure for table `mssalesman`
--
CREATE TABLE IF NOT EXISTS `mssalesman` (
`salesID` varchar(5) NOT NULL,
`salesName` varchar(30) NOT NULL,
`salesAddress1` varchar(40) NOT NULL,
`salesAddress2` varchar(40) NOT NULL,
`areaID` varchar(20) NOT NULL,
`regionID` varchar(20) NOT NULL,
`salesPhone` varchar(20) NOT NULL,
`salesMobile1` varchar(20) NOT NULL,
`salesMobile2` varchar(20) NOT NULL,
`salesPinBB` varchar(10) NOT NULL,
`salesEmail` varchar(30) NOT NULL,
`POBirth` varchar(20) NOT NULL,
`DOBirth` date NOT NULL,
`salesReligion` varchar(12) NOT NULL,
`salesPosition` varchar(20) NOT NULL,
`salesStatus` varchar(12) NOT NULL,
`salesChildren` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mssalesman`
--
INSERT INTO `mssalesman` (`salesID`, `salesName`, `salesAddress1`, `salesAddress2`, `areaID`, `regionID`, `salesPhone`, `salesMobile1`, `salesMobile2`, `salesPinBB`, `salesEmail`, `POBirth`, `DOBirth`, `salesReligion`, `salesPosition`, `salesStatus`, `salesChildren`) VALUES
('SA001', '<NAME>', 'Bojong', 'Citra 6', 'area001', 'reg001', '08123123', '081231313', '0812331212', 'BCG001', '<EMAIL>', '12 juli 2012', '1994-06-10', 'Kristen', 'MarketingSales', 'onDuty', 4);
-- --------------------------------------------------------
--
-- Table structure for table `mssupplier`
--
CREATE TABLE IF NOT EXISTS `mssupplier` (
`supplierID` varchar(5) NOT NULL,
`supplierName` varchar(30) NOT NULL,
`supplierAddress1` varchar(40) NOT NULL,
`supplierAddress2` varchar(40) NOT NULL,
`areaID` varchar(20) NOT NULL,
`regionID` varchar(20) NOT NULL,
`supplierPhone` varchar(20) NOT NULL,
`supplierFax` varchar(20) NOT NULL,
`supplierEmail` varchar(30) NOT NULL,
`supplierContact` varchar(30) NOT NULL,
`supplierMobile` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mssupplier`
--
INSERT INTO `mssupplier` (`supplierID`, `supplierName`, `supplierAddress1`, `supplierAddress2`, `areaID`, `regionID`, `supplierPhone`, `supplierFax`, `supplierEmail`, `supplierContact`, `supplierMobile`) VALUES
('SU001', '<NAME>', 'Binus', 'Kemanggisan', 'area001', 'reg001', '0812312123', '02131131', '<EMAIL>', 'irwan,pras', '08121313121');
-- --------------------------------------------------------
--
-- Table structure for table `msuser`
--
CREATE TABLE IF NOT EXISTS `msuser` (
`userID` varchar(12) NOT NULL,
`userPassword` varchar(250) NOT NULL,
`userName` varchar(20) NOT NULL,
`userRole` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `msuser`
--
INSERT INTO `msuser` (`userID`, `userPassword`, `userName`, `userRole`) VALUES
('user001', 'admin', '<NAME>', 'admin'),
('user002', '$2y$10$xGByaknEZfMriT3NOmhv8ej6uTCVkAdIkrymcp/ImYHEig1Qs6E.m', '<NAME>', 'Member'),
('user003', '$2y$10$./d8/fuNJw9PFSGbdKUCO.cBXO.urgDl6hDXIA7gzx5VdcWcK2.Oi', 'Admin', 'Member');
-- --------------------------------------------------------
--
-- Table structure for table `mswarehouse`
--
CREATE TABLE IF NOT EXISTS `mswarehouse` (
`warehouseID` varchar(3) NOT NULL,
`warehouseName` varchar(30) NOT NULL,
`warehouseAddress1` varchar(40) NOT NULL,
`warehouseAddress2` varchar(40) NOT NULL,
`areaID` varchar(20) NOT NULL,
`regionID` varchar(20) NOT NULL,
`warehousePhone` varchar(20) NOT NULL,
`warehouseFax` varchar(20) NOT NULL,
`warehouseEmail` varchar(30) NOT NULL,
`warehousePIC` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `mswarehouse`
--
INSERT INTO `mswarehouse` (`warehouseID`, `warehouseName`, `warehouseAddress1`, `warehouseAddress2`, `areaID`, `regionID`, `warehousePhone`, `warehouseFax`, `warehouseEmail`, `warehousePIC`) VALUES
('wa1', 'Maju Terus', 'Kemang', 'Jakarta', 'area001', 'reg001', '08123133', '02112313', '<EMAIL>', 'Irwan Prasetia');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `msarea`
--
ALTER TABLE `msarea`
ADD PRIMARY KEY (`areaID`);
--
-- Indexes for table `mscustomer`
--
ALTER TABLE `mscustomer`
ADD PRIMARY KEY (`customerID`);
--
-- Indexes for table `msitem`
--
ALTER TABLE `msitem`
ADD PRIMARY KEY (`itemID`);
--
-- Indexes for table `msitemset`
--
ALTER TABLE `msitemset`
ADD PRIMARY KEY (`itemSetID`);
--
-- Indexes for table `msregion`
--
ALTER TABLE `msregion`
ADD PRIMARY KEY (`regionID`);
--
-- Indexes for table `mssalesman`
--
ALTER TABLE `mssalesman`
ADD PRIMARY KEY (`salesID`);
--
-- Indexes for table `mssupplier`
--
ALTER TABLE `mssupplier`
ADD PRIMARY KEY (`supplierID`);
--
-- Indexes for table `msuser`
--
ALTER TABLE `msuser`
ADD PRIMARY KEY (`userID`);
--
-- Indexes for table `mswarehouse`
--
ALTER TABLE `mswarehouse`
ADD PRIMARY KEY (`warehouseID`);
/*!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 */;
|
BULK INSERT Organisation FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\Organisation.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT Contact FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\Contact.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT Solution FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\Solution.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT TechnicalContact FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\TechnicalContact.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT Capability FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\Capability.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT Framework FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\Framework.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT Standard FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\Standard.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT ClaimedCapability FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\ClaimedCapability.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT ClaimedStandard FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\ClaimedStandard.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT AssessmentMessage FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\AssessmentMessage.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT CapabilityFramework FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\CapabilityFramework.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT FrameworkSolution FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\FrameworkSolution.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT FrameworkStandard FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\FrameworkStandard.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT CapabilityStandard FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\CapabilityStandard.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT ClaimedCapabilityStandard FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\ClaimedCapabilityStandard.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
BULK INSERT AssessmentMessageContact FROM 'C:\Dev\BuyWOLF\NHSD.GPITF.BuyingCatalog\Data\AssessmentMessageContact.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n', TABLOCK)
|
<reponame>smdsbz/database-experiment
use DBEXP
-- create test env
declare @_cnt integer = 0
--- create users
while @_cnt < 15 begin
insert into USERS (UID, NAME) values (@_cnt+1, cast(@_cnt as varchar(8)))
set @_cnt = @_cnt + 1
end
--- create blogs
insert into MBLOG values
(1, 'AAA', 1, 1970, 1, 1, 'fdjaskl'),
(2, 'BBB', 2, 1970, 1, 1, 'fhdjklsa')
--- create thumbs
set @_cnt = 0
while @_cnt < 12 begin
insert into THUMB values (@_cnt+2, 1)
set @_cnt = @_cnt + 1
end
set @_cnt = 0
while @_cnt < 5 begin
insert into THUMB values (@_cnt+3, 2)
set @_cnt = @_cnt + 1
end
go
--------------------- Experiment Code ----------------------
select MBLOG.BID, MBLOG.TITLE
from MBLOG
where MBLOG.BID in (
select THUMB.BID
from THUMB
group by THUMB.BID
having count(*) > 10
)
-- expecting: #1 'AAA'
--------------------- Experiment Code ----------------------
go
-- tear down test env
delete from THUMB
delete from MBLOG
delete from USERS |
<reponame>q1e123/Network-resource-monitor<filename>SQL/insert-system.sql<gh_stars>0
INSERT INTO Systems(machine_id, system_status)
VALUES (:machine_id, 0); |
<reponame>vasu1234118/teamments
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 30, 2019 at 02:35 PM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.1.33
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: `aaraofwj_tm`
--
-- --------------------------------------------------------
--
-- Table structure for table `tm_requirements`
--
CREATE TABLE `tm_requirements` (
`id` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`description` text NOT NULL,
`type` varchar(255) NOT NULL,
`requirement_goal` text DEFAULT NULL,
`scope_of_work` int(11) DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`project_id` int(11) DEFAULT NULL,
`created_by` int(11) NOT NULL,
`flag` int(11) NOT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime NOT NULL DEFAULT current_timestamp(),
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`deleted_at` datetime DEFAULT NULL,
`complexity` int(11) DEFAULT NULL,
`priority` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tm_requirements`
--
INSERT INTO `tm_requirements` (`id`, `name`, `description`, `type`, `requirement_goal`, `scope_of_work`, `status`, `project_id`, `created_by`, `flag`, `created_at`, `updated_at`, `start_date`, `end_date`, `deleted_at`, `complexity`, `priority`) VALUES
(1, '0', '', 'sdfasdf', '<p>fdsdfsadf</p>\r\n', 1, 1, 1, 20, 0, '2019-12-30 17:51:19', '2019-12-30 15:23:33', '2019-12-30', '2020-01-01', NULL, NULL, NULL),
(2, 'asdf', '', 'sdfasdf', '<p>w</p>\r\n', 1, 1, 1, 20, 0, '2019-12-30 17:51:05', '2019-12-30 15:24:26', '2019-12-30', '2019-12-30', NULL, NULL, NULL),
(3, '111', '', '1', '<p><a id=\"sa\" name=\"sa\"></a>requirement_goal</p>\r\n', 0, 0, 4, 20, 0, '2019-12-30 15:37:53', '2019-12-30 15:37:53', '2019-12-30', '2019-12-30', NULL, NULL, NULL),
(4, 'asdf', '', 'sdfasdf', '<p>xzczxc fdsadf sadf sd</p>\r\n', 1, 0, 2, 20, 1, '2019-12-30 17:50:38', '2019-12-30 15:40:47', '2019-12-31', '2019-12-31', '2019-12-30 17:52:03', NULL, NULL),
(5, 'asdf', '', 'sdfasdf', '<p>FGGFGGSF</p>\r\n', 0, 1, 2, 20, 0, '2019-12-30 18:43:58', '2019-12-30 18:43:58', '2020-01-01', '2020-01-01', NULL, 3, 2);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tm_requirements`
--
ALTER TABLE `tm_requirements`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tm_requirements`
--
ALTER TABLE `tm_requirements`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
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 */;
|
-- phpMyAdmin SQL Dump
-- version 4.4.15.9
-- https://www.phpmyadmin.net
--
-- Host: localhost
-- Gegenereerd op: 17 feb 2019 om 20:52
-- Serverversie: 5.6.37
-- PHP-versie: 7.1.8
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: `ToDo`
--
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `items`
--
CREATE TABLE IF NOT EXISTS `items` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`list_id` int(11) NOT NULL,
`duration` int(11) NOT NULL DEFAULT '0',
`done` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `lists`
--
CREATE TABLE IF NOT EXISTS `lists` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `roles`
--
CREATE TABLE IF NOT EXISTS `roles` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Gegevens worden geëxporteerd voor tabel `roles`
--
INSERT INTO `roles` (`id`, `name`) VALUES
(1, 'Admin'),
(2, 'User');
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`salt_key` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`role_id` int(1) NOT NULL DEFAULT '2'
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Gegevens worden geëxporteerd voor tabel `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `salt_key`, `role_id`) VALUES
(1, '<EMAIL>', '<PASSWORD>', '2019-02-16 11:24:29', 1);
--
-- Indexen voor geëxporteerde tabellen
--
--
-- Indexen voor tabel `items`
--
ALTER TABLE `items`
ADD PRIMARY KEY (`id`);
--
-- Indexen voor tabel `lists`
--
ALTER TABLE `lists`
ADD PRIMARY KEY (`id`);
--
-- Indexen voor tabel `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`);
--
-- Indexen voor tabel `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT voor geëxporteerde tabellen
--
--
-- AUTO_INCREMENT voor een tabel `items`
--
ALTER TABLE `items`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=36;
--
-- AUTO_INCREMENT voor een tabel `lists`
--
ALTER TABLE `lists`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=33;
--
-- AUTO_INCREMENT voor een tabel `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT voor een tabel `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
/*!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 */;
|
<filename>app/panx-worker/auth-resource/recaptcha_fails.sql
CREATE TABLE `recaptcha_fails` (
`ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`IP` VARCHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_bin',
PRIMARY KEY (`ID`),
INDEX `IP` (`IP`)
)
COLLATE='utf8mb4_bin'
ENGINE=InnoDB
AUTO_INCREMENT=1
;
|
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.5.1
-- Dumped by pg_dump version 9.5.1
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: test; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE test (
test character(5) NOT NULL,
title character varying(40) NOT NULL,
did integer NOT NULL
);
ALTER TABLE test OWNER TO postgres;
--
-- Data for Name: test; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY test (test, title, did) FROM stdin;
\.
--
-- Name: firstkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY test
ADD CONSTRAINT firstkey PRIMARY KEY (test);
--
-- Name: public; Type: ACL; Schema: -; Owner: arkel
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM arkel;
GRANT ALL ON SCHEMA public TO arkel;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
|
/* Queries to be executed on the Primary Server */
ALTER EVENT SESSION [Redo_Progress] ON SERVER STATE = START;
GO
ALTER EVENT SESSION [redo_wait_info] ON SERVER STATE = START;
GO
USE db
GO
--- Perform a Single Insert to ensure that the Secondary Redo Threads are online.
Insert into TestRedoBlocker values (1,getdate(), 'C')
GO
-- Perform a DLL command on the Primary (To be executed after the select query on the secondary)
Alter Table TestRedoBlocker Rebuild
Go
--- Perform another DDL command
truncate table TestRedoBlocker
Go
ALTER EVENT SESSION [Redo_Progress] ON SERVER STATE = STOP;
GO
ALTER EVENT SESSION [redo_wait_info] ON SERVER STATE = STOP;
GO |
--------------------------------------------------------
-- DDL for Table UT_LOOKUP_CATEGORIES
--------------------------------------------------------
CREATE TABLE "HUNDISILM"."UT_LOOKUP_CATEGORIES"
( "ID" VARCHAR2(40 BYTE),
"NAME" VARCHAR2(120 BYTE),
"CREATED_ON" TIMESTAMP (6),
"CREATED_BY" VARCHAR2(120 BYTE),
"UPDATED_ON" TIMESTAMP (6),
"UPDATED_BY" VARCHAR2(120 BYTE)
) 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 "USERS" ;
|
WITH source as (
SELECT *
FROM {{ source('greenhouse', 'job_custom_fields') }}
), renamed as (
SELECT
--key
job_id::NUMBER AS job_id,
user_id::NUMBER AS user_id,
--info
custom_field::varchar AS job_custom_field,
float_value::float AS job_custom_field_float_value,
date_value::date AS job_custom_field_date_value,
display_value::varchar AS job_custom_field_display_value,
unit::varchar AS job_custom_field_unit,
min_value::NUMBER AS job_custom_field_min_value,
max_value::NUMBER AS job_custom_field_max_value,
created_at::timestamp AS job_custom_field_created_at,
updated_at::timestamp AS job_custom_field_updated_at
FROM source
)
SELECT *
FROM renamed
|
CREATE TABLE `filter_area` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID, 帖子的评论和回复ID',
`area` varchar(50) NOT NULL COMMENT '业务方',
`typeid` smallint(6) NOT NULL COMMENT '分区id',
`filterid` int(11) NOT NULL COMMENT '过滤内容id',
`level` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '业务过滤等级',
`is_delete` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除:0:未删除 1:已删除',
`ctime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
`mtime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_area_filterid_typeid` (`area`,`filterid`,`typeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='敏感词对应业务表';
CREATE TABLE `filter_content` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID, 过滤id',
`mode` tinyint(4) NOT NULL COMMENT '过滤模式 0-正则 ,1-string',
`filter` varchar(255) NOT NULL COMMENT '过滤内容',
`level` tinyint(4) NOT NULL COMMENT '过滤等级',
`comment` varchar(128) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '过滤备注',
`ctime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
`mtime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '修改时间',
`stime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '生效时间',
`etime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '失效时间',
`key` varchar(30) NOT NULL DEFAULT '' COMMENT '业务方指定key',
`state` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除,0:未删除 1:已删除',
`type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类型:0 其他违禁类;1 政治宗教;2 色情;3 低俗;4 血腥暴力;5 赌博诈骗;6 运营规避',
`source` tinyint(4) NOT NULL DEFAULT '0' COMMENT '来源:0 上级部门;2 审核规避;4 运营规避;8 审核提示',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_filter_key` (`filter`,`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='过滤内容';
CREATE TABLE `filter_key` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`key` varchar(30) NOT NULL COMMENT '业务方指定key',
`area` varchar(10) NOT NULL COMMENT '过滤区域',
`filterid` int(11) NOT NULL COMMENT '过滤内容id',
`state` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除,0:未删除 1:已删除',
`ctime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
`mtime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `ux_key_area_filterid` (`key`,`area`,`filterid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='key过滤表';
CREATE TABLE `filter_key_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
`key` varchar(20) NOT NULL DEFAULT '' COMMENT '业务方指定key',
`adid` int(11) NOT NULL COMMENT '管理员id',
`name` varchar(16) NOT NULL COMMENT 'name',
`comment` varchar(50) NOT NULL COMMENT '操作原因',
`state` tinyint(4) NOT NULL COMMENT '操作类型 0-添加,1-编辑, 2-删除',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`id`),
KEY `ix_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='key操作日志表';
CREATE TABLE `filter_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID, 过滤id',
`adid` int(11) NOT NULL COMMENT '管理员id',
`comment` varchar(50) NOT NULL COMMENT '操作原因',
`state` tinyint(4) NOT NULL COMMENT '操作类型 0-添加,1-编辑, 2-删除',
`ctime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
`mtime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '修改时间',
`filterid` int(11) NOT NULL DEFAULT '0' COMMENT '敏感词id',
`name` varchar(16) NOT NULL COMMENT '名字',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='操作日志';
CREATE TABLE `filter_white_area` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`area` varchar(20) NOT NULL COMMENT '业务方',
`tpid` int(11) NOT NULL COMMENT '分区id',
`content_id` int(11) NOT NULL COMMENT '内容id',
`state` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态,0:正常,1:删除',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_area_tyid_contentid` (`content_id`,`tpid`,`area`),
KEY `ix_mtime` (`mtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='过滤白名单业务关系表';
CREATE TABLE `filter_white_content` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`content` varchar(64) NOT NULL COMMENT '过滤规则',
`mode` tinyint(4) NOT NULL COMMENT '模式,0:正则,1:字符串',
`comment` varchar(50) NOT NULL COMMENT '说明',
`state` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态,0:正常,1:删除',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_content` (`content`),
KEY `ix_mtime` (`mtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='过滤白名单内容表';
CREATE TABLE `filter_white_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID, 过滤id',
`content_id` int(11) NOT NULL COMMENT '内容id',
`adid` int(11) NOT NULL COMMENT '管理员id',
`name` varchar(20) NOT NULL COMMENT '用户昵称',
`comment` varchar(50) NOT NULL COMMENT '操作原因',
`state` tinyint(4) NOT NULL COMMENT '操作类型 0-添加,1-编辑, 2-删除',
`ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
KEY `ix_mtime` (`mtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='过滤日志操作记录表';
CREATE TABLE `filter_area_type` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id',
`name` VARCHAR(50) NOT NULL COMMENT '业务名称',
`showname` VARCHAR(16) NOT NULL COMMENT '业务显示名称',
`groupid` INT(11) NOT NULL COMMENT '业务分组id',
`common_flag` TINYINT(4) NOT NULL COMMENT '是否过滤基础库',
`is_delete` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '是否删除:0:未删除 1:已删除',
`ctime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`mtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_area` (`name`),
INDEX `ix_groupid` (`groupid`),
KEY `ix_mtime` (`mtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='敏感词业务类型表';
CREATE TABLE `filter_area_group` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id',
`name` VARCHAR(16) NOT NULL COMMENT '业务分组名称',
`is_delete` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '是否删除:0:未删除 1:已删除',
`ctime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`mtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_name` (`name`),
KEY `ix_mtime` (`mtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='敏感词业务分组表';
CREATE TABLE `filter_area_type_log` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id',
`areaid` INT(11) NOT NULL COMMENT '业务id',
`state` TINYINT(4) NOT NULL COMMENT '操作',
`adid` INT(11) NOT NULL COMMENT '管理员id',
`ad_name` VARCHAR(16) NOT NULL COMMENT '管理员名称',
`comment` VARCHAR(50) NOT NULL COMMENT '变动理由',
`ctime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`mtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
INDEX `ix_areaid` (`areaid`),
KEY `ix_mtime` (`mtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='敏感词业务日志';
CREATE TABLE `filter_area_group_log` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增id',
`groupid` INT(11) NOT NULL COMMENT '业务组id',
`state` TINYINT(4) NOT NULL COMMENT '操作',
`adid` INT(11) NOT NULL COMMENT '管理员id',
`ad_name` VARCHAR(16) NOT NULL COMMENT '管理员名称',
`comment` VARCHAR(50) NOT NULL COMMENT '变动理由',
`ctime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`mtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
INDEX `ix_groupid` (`groupid`),
KEY `ix_mtime` (`mtime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='敏感词业务组日志'; |
select analyze_statistics('schema.tableName');
select session_id, statement_id, user_name, current_statement, last_statement, transaction_description, * from sessions;
create schema if not exists test;
create table test.tmp_column_cardinality (
table_name varchar(255) NOT NULL DEFAULT 'Unknown',
column_name varchar(255) NOT NULL DEFAULT 'Unknown',
column_cardinality_count INT NOT NULL DEFAULT 0,
created_at timestamp NOT NULL DEFAULT now() );
select export_objects('','test.tmp_column_cardinality');
ALTER TABLE test.agg_event_by_client_geo_day ADD CONSTRAINT PK_agg_event_by_client_geo_day PRIMARY KEY (date_id, client_id, country_id);
DELETE FROM test.tmp_column_cardinality where table_name = 'test.agg_event_by_client_geo_day';
select node_name, projection_name, row_count from projection_storage where projection_name ilike 'testHashNodes%' and anchor_table_schema ilike 'jackg' and row_count > 0 order by 1; |
-- file:arrays.sql ln:571 expect:true
select array_agg(unique1) from (select unique1 from tenk1 where unique1 < 15 order by unique1) ss
|
<filename>plugins/nachweisverwaltung/db/mysql/schema/2018-03-23_16-42-15_change_table_type_for_rollen_fk.sql
BEGIN;
ALTER TABLE rolle_nachweise ENGINE=INNODB;
ALTER TABLE rolle_nachweise_dokumentauswahl ENGINE=INNODB;
DELETE rolle_nachweise, rolle FROM rolle_nachweise LEFT JOIN rolle ON rolle_nachweise.user_id = rolle.user_id AND rolle_nachweise.stelle_id = rolle.stelle_id WHERE rolle.user_id IS NULL AND rolle.stelle_id IS NULL;
ALTER TABLE rolle_nachweise ADD FOREIGN KEY (user_id, stelle_id) REFERENCES rolle (user_id, stelle_id) ON DELETE CASCADE;
DELETE rolle_nachweise_dokumentauswahl, rolle FROM rolle_nachweise_dokumentauswahl LEFT JOIN rolle ON rolle_nachweise_dokumentauswahl.user_id = rolle.user_id AND rolle_nachweise_dokumentauswahl.stelle_id = rolle.stelle_id WHERE rolle.user_id IS NULL AND rolle.stelle_id IS NULL;
ALTER TABLE rolle_nachweise_dokumentauswahl ADD FOREIGN KEY (user_id, stelle_id) REFERENCES rolle (user_id, stelle_id) ON DELETE CASCADE;
COMMIT;
|
<filename>prisma/migrations/20220119053225_create_product_category/migration.sql
-- CreateTable
CREATE TABLE "products_categories" (
"id" TEXT NOT NULL,
"id_product" TEXT NOT NULL,
"id_category" TEXT NOT NULL,
CONSTRAINT "products_categories_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "products_categories" ADD CONSTRAINT "products_categories_id_product_fkey" FOREIGN KEY ("id_product") REFERENCES "products"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "products_categories" ADD CONSTRAINT "products_categories_id_category_fkey" FOREIGN KEY ("id_category") REFERENCES "categories"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
<reponame>ytyaru/Hatena.PhotLife.API.Database.Create.201703012021
.mode tabs
.import ./Contents_Images.tsv Contents
UPDATE Contents SET Content = NULL WHERE Content = '\N';
|
CREATE TABLE IF NOT EXISTS "cfdi_claves_unidades"(
"id" text not null,
"texto" text not null,
"descripcion" text not null,
"notas" text not null,
"vigencia_desde" text not null,
"vigencia_hasta" text not null,
"simbolo" text not null,
PRIMARY KEY("id")
);
|
DELETE FROM studyaccess.end_users WHERE end_user_id = ? |
CREATE TABLE api_keys (
api_key_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
server_id INTEGER UNSIGNED NOT NULL,
api_key_hash VARCHAR(44) NOT NULL,
api_key_owner_dbid INTEGER UNSIGNED NOT NULL,
api_key_scope INTEGER UNSIGNED NOT NULL,
api_key_created_at INTEGER UNSIGNED NOT NULL,
api_key_expires_at INTEGER UNSIGNED NOT NULL
);
|
-- MySQL dump 10.13 Distrib 5.7.27, for Linux (x86_64)
--
-- Host: localhost Database: blog
-- ------------------------------------------------------
-- Server version 5.7.27
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `t_blog`
--
DROP TABLE IF EXISTS `t_blog`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_blog` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`content` text,
`first_picture` varchar(255) DEFAULT NULL,
`flag` varchar(255) DEFAULT NULL,
`views` int(11) DEFAULT NULL,
`appreciation` int(11) NOT NULL DEFAULT '0',
`share_statement` int(11) NOT NULL DEFAULT '0',
`commentabled` int(11) NOT NULL DEFAULT '0',
`published` int(11) NOT NULL DEFAULT '0',
`recommend` int(11) NOT NULL DEFAULT '0',
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`type_id` bigint(20) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`description` text,
`tag_ids` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1589726426262 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t_blog`
--
LOCK TABLES `t_blog` WRITE;
/*!40000 ALTER TABLE `t_blog` DISABLE KEYS */;
INSERT INTO `t_blog` VALUES (1577792888747,'hexo(一)','**参考b站的codesheep的视频**\r\n*win10版*\r\n\r\n<!-- more -->\r\n## 1.安装Node.js\r\n安装官网: [点这里](https://nodejs.org)\r\n安装步骤根据默认即可\r\n\r\n\r\n## 2.安装git\r\n安装官网: [node.js](https://git-scm.com/downloads)\r\n如果安装的很缓慢的话可以进入淘宝镜像网站:[点这里](https://npm.taobao.org/mirrors/git-for-windows/)\r\n安装步骤也是默认\r\n我下载的版本:Git-2.21.0.rc0.windows.1-64-bit.exe\r\n安装完成后可以在开始菜单看到\r\n\r\n\r\n## 3.安装Hexo\r\n### (一).创建文件夹\r\n在你的电脑的任意一个盘下创建一个文件夹,这个文件夹是用来储存博客的本地文件的,比如我就在f盘建立了一个blog文件夹,如下:\r\n\r\n\r\n### (二)使用Git Bash\r\n在这个空文件夹中右键打开**Git Bash Here**进入如下的界面\r\n\r\n输入node -v 和 npm -v 看是否出现版本,检测是否安装顺利\r\n\r\n\r\n\r\n### (三)安装cnpm\r\n输入如下的代码:\r\n`npm install -g cnpm --registry=https://registry.npm.taobao.org`\r\n\r\n这玩意主要下载东西快\r\n\r\n安装完输入**cnpm**检测是否安装成功,出现以下内容即为成功\r\n\r\n\r\n### (四)安装hexo\r\n\r\n输入代码如下:\r\n`cnpm install -g hexo-cli`\r\n然后再输入`hexo -v`检测是否安装成功\r\n安装成功界面:\r\n\r\n\r\n接下来输入`hexo init`初始化这个项目\r\n\r\n\r\n\r\n### (五)运行测试\r\n这里有三个代码是进行运行测试的关键\r\n```\r\nhexo g\r\nhexo s\r\nhexo d\r\n```\r\n输入`hexo g`\r\n\r\n\r\n\r\n输入`hexo s`\r\n\r\n\r\n\r\n这时可以进入`http://localhost:4000`查看博客本地化了\r\n\r\n预览图(这是我修改过主题的,官方初始预览和我这不一样)\r\n\r\n\r\n\r\n## 本地内容搭建完成\r\n## 接下来的步骤在下一篇','https://i.picsum.photos/id/1005/5760/3840.jpg','原创',0,1,0,1,1,1,'2019-12-31 11:48:09','2020-01-03 13:52:16',4,1,'搭建hexo博客步骤一','3,2'),(1577793147252,'hexo(二)','\r\n**这一章的内容就是将博客部署到github上**\r\n\r\n## 一.部署github\r\n有github的直接登陆即可,没有的注册一下也很简单\r\n<!-- more -->\r\n### 1.新建厂库\r\n例图:\r\n\r\n**注意**:仓库命名时一定要是`\"你的用户名\".github.io`\r\n\r\n例图:(我这里已经注册这个厂库了,所以会出现红色的标记)\r\n\r\n\r\n### 2.部署插件\r\n代码:`cnpm install --save hexo-deployer-git`\r\n\r\n例图:\r\n\r\n\r\n## 二.设置-config.yml文件\r\n\r\n### 1.用记事本打开文件\r\n找到如下的代码区域:\r\n\r\n\r\n按照我的修改内容进行添加修改(repo要改成自己的github仓库的地址,冒号后记得要加上空格)\r\n\r\n\r\n\r\n## 三.部署到远端(简单)\r\n\r\n### 1.输入`hexo d`的命令即可\r\n例图:\r\n\r\n\r\n### 2.设置github的账号和密码\r\n按照下图操作即可:\r\n\r\n\r\n\r\n\r\n\r\n\r\n## 四.查看自己的博客\r\n注意:用`hexo d`命令进行远端部署,直到部署成功就可以浏览自己的个人博客\r\n\r\n浏览地址:就是自己之前在-config.yml文件里配置的repo地址\r\n\r\n参考页面:[我的个人博客,点进去逛逛](https://gaohan666.github.io/)\r\n\r\n','https://i.picsum.photos/id/1005/5760/3840.jpg','原创',0,1,0,1,1,1,'2019-12-31 11:52:27','2020-01-03 13:53:50',4,1,'hexo博客教程第二篇','3,2'),(1577870084710,'springMVC执行原理','官方springMVC执行原理图:\r\n\r\n\r\n\r\n>1.前端控制器就是DispatcherServlet\r\n>\r\n>2.页面控制器就是Controller\r\n>\r\n>3.模型就是业务层(service)以及下面的Dao层\r\n>\r\n>4.Model就是视图解析器,解析到具体的.jsp或者.html等文件\r\n>\r\n>5.视图就是根据视图解析器获得的具体视图\r\n\r\n<!-- more -->\r\n\r\n具体细节:\r\n\r\n\r\n\r\n1. DispatcherServlet表示前置控制器,是整个SpringMVC的控制中心。用户发出请求,DispatcherServlet接收请求并拦截请求。 \r\n\r\n * 我们假设请求的url为 : [http://localhost](http://localhost/):8080/SpringMVC/hello \r\n\r\n * **如上url拆分成三部分:** \r\n\r\n * [http://localhost](http://localhost/):8080服务器域名 \r\n\r\n * SpringMVC部署在服务器上的web站点 \r\n\r\n * hello表示控制器 (Controller)\r\n\r\n * 通过分析,如上url表示为:请求位于服务器localhost:8080上的SpringMVC站点的hello控制器。 \r\n\r\n2. HandlerMapping为处理器映射。DispatcherServlet调用HandlerMapping,HandlerMapping根据请求url查找Handler。\r\n\r\n3. HandlerExecution表示具体的Handler,其主要作用是根据url查找控制器,如上url被查找控制器为:hello。 \r\n\r\n4. HandlerExecution将解析后的信息传递给DispatcherServlet,比如在哪找到了hello控制器等。 \r\n\r\n5. HandlerAdapter表示处理器适配器,其按照特定的规则去执行Handler。 \r\n\r\n6. Handler让具体的Controller执行。\r\n\r\n7. Controller将具体的执行信息返回给HandlerAdapter,如ModelAndView。 \r\n\r\n >在Controller进行业务模块流程的控制。\r\n >Controller的方法调用Service业务层的指定方法完成业务逻辑,业务层的方法又会调用DAO层指定方法做数据持久化操作,\r\n >并最终将结果返回到action层,action层的方法 会返回一个ModelAndView \r\n\r\n8. HandlerAdapter将视图逻辑名或模型传递给DispatcherServlet。 \r\n\r\n9. DispatcherServlet调用视图解析器(ViewResolver)来解析HandlerAdapter传递的逻辑视图名。 \r\n\r\n > Dispathcher查询一个或多个ViewResolver视图解析器,找到ModelAndView对象指定的视图对象\r\n \r\n10. 视图解析器将解析的逻辑视图名传给DispatcherServlet。 \r\n\r\n11. DispatcherServlet根据视图解析器解析的视图结果,调用具体的视图。 \r\n\r\n12. 最终视图呈现给用户。 \r\n\r\n \r\n\r\n>说明:\r\n>\r\n>①:Action对象 业务层的对象 dao层的对象 sqlSessionFactory对象,都由spring容器来创建和销毁,\r\n>spring对对象进行统一管理,根据配置文件对其进行注入实现,\r\n>\r\n>②:业务层的处理方法, 使用spring的aop的声明式事务管理\r\n\r\n\r\n\r\n\r\n','https://i.picsum.photos/id/0/5616/3744.jpg','原创',0,1,0,1,1,1,'2020-01-01 09:14:45','2020-05-09 18:12:48',5,1,'1.前端控制器就是DispatcherServlet\r\n\r\n2.页面控制器就是Controller\r\n\r\n3.模型就是业务层(service)以及下面的Dao层\r\n\r\n4.Model就是视图解析器,解析到具体的.jsp或者.html等文件\r\n\r\n5.视图就是根据视图解析器获得的具体视图','2,3'),(1577879724073,'异常','>转自黑马程序员\r\n## 主要内容\r\n\r\n- 异常、线程\r\n\r\n## 教学目标\r\n<!-- more -->\r\n- [ ] 能够辨别程序中异常和错误的区别\r\n- [ ] 说出异常的分类\r\n- [ ] 说出虚拟机处理异常的方式\r\n- [ ] 列举出常见的三个运行期异常\r\n- [ ] 能够使用try...catch关键字处理异常\r\n- [ ] 能够使用throws关键字处理异常\r\n- [ ] 能够自定义异常类\r\n- [ ] 能够处理自定义异常类\r\n- [ ] 说出进程的概念\r\n- [ ] 说出线程的概念\r\n- [ ] 能够理解并发与并行的区别\r\n- [ ] 能够开启新线程\r\n\r\n# 第一章 异常\r\n\r\n## 1.1 异常概念\r\n\r\n异常,就是不正常的意思。在生活中:医生说,你的身体某个部位有异常,该部位和正常相比有点不同,该部位的功能将受影响.在程序中的意思就是:\r\n\r\n* **异常** :指的是程序在执行过程中,出现的非正常的情况,最终会导致JVM的非正常停止。\r\n\r\n在Java等面向对象的编程语言中,异常本身是一个类,产生异常就是创建异常对象并抛出了一个异常对象。Java处理异常的方式是中断处理。\r\n\r\n> 异常指的并不是语法错误,语法错了,编译不通过,不会产生字节码文件,根本不能运行.\r\n\r\n## 1.2 异常体系\r\n\r\n异常机制其实是帮助我们**找到**程序中的问题,异常的根类是`java.lang.Throwable`,其下有两个子类:`java.lang.Error`与`java.lang.Exception`,平常所说的异常指`java.lang.Exception`。\r\n\r\n\r\n\r\n**Throwable体系:**\r\n\r\n* **Error**:严重错误Error,无法通过处理的错误,只能事先避免,好比绝症。\r\n* **Exception**:表示异常,异常产生后程序员可以通过代码的方式纠正,使程序继续运行,是必须要处理的。好比感冒、阑尾炎。\r\n\r\n**Throwable中的常用方法:**\r\n\r\n* `public void printStackTrace()`:打印异常的详细信息。\r\n\r\n *包含了异常的类型,异常的原因,还包括异常出现的位置,在开发和调试阶段,都得使用printStackTrace。*\r\n\r\n* `public String getMessage()`:获取发生异常的原因。\r\n\r\n *提示给用户的时候,就提示错误原因。*\r\n\r\n* `public String toString()`:获取异常的类型和异常描述信息(不用)。\r\n\r\n***出现异常,不要紧张,把异常的简单类名,拷贝到API中去查。***\r\n\r\n\r\n\r\n## 1.3 异常分类\r\n\r\n我们平常说的异常就是指Exception,因为这类异常一旦出现,我们就要对代码进行更正,修复程序。\r\n\r\n**异常(Exception)的分类**:根据在编译时期还是运行时期去检查异常?\r\n\r\n* **编译时期异常**:checked异常。在编译时期,就会检查,如果没有处理异常,则编译失败。(如日期格式化异常)\r\n* **运行时期异常**:runtime异常。在运行时期,检查异常.在编译时期,运行异常不会编译器检测(不报错)。(如数学异常)\r\n\r\n \r\n\r\n## 1.4 异常的产生过程解析\r\n\r\n先运行下面的程序,程序会产生一个数组索引越界异常ArrayIndexOfBoundsException。我们通过图解来解析下异常产生的过程。\r\n\r\n 工具类\r\n\r\n~~~java\r\npublic class ArrayTools {\r\n // 对给定的数组通过给定的角标获取元素。\r\n public static int getElement(int[] arr, int index) {\r\n int element = arr[index];\r\n return element;\r\n }\r\n}\r\n~~~\r\n\r\n 测试类\r\n\r\n~~~java\r\npublic class ExceptionDemo {\r\n public static void main(String[] args) {\r\n int[] arr = { 34, 12, 67 };\r\n intnum = ArrayTools.getElement(arr, 4)\r\n System.out.println(\"num=\" + num);\r\n System.out.println(\"over\");\r\n }\r\n}\r\n~~~\r\n\r\n上述程序执行过程图解:\r\n\r\n \r\n\r\n# 第二章 异常的处理\r\n\r\nJava异常处理的五个关键字:**try、catch、finally、throw、throws**\r\n\r\n## 2.1 抛出异常throw\r\n\r\n在编写程序时,我们必须要考虑程序出现问题的情况。比如,在定义方法时,方法需要接受参数。那么,当调用方法使用接受到的参数时,首先需要先对参数数据进行合法的判断,数据若不合法,就应该告诉调用者,传递合法的数据进来。这时需要使用抛出异常的方式来告诉调用者。\r\n\r\n在java中,提供了一个**throw**关键字,它用来抛出一个指定的异常对象。那么,抛出一个异常具体如何操作呢?\r\n\r\n1. 创建一个异常对象。封装一些提示信息(信息可以自己编写)。\r\n\r\n2. 需要将这个异常对象告知给调用者。怎么告知呢?怎么将这个异常对象传递到调用者处呢?通过关键字throw就可以完成。throw 异常对象。\r\n\r\n throw**用在方法内**,用来抛出一个异常对象,将这个异常对象传递到调用者处,并结束当前方法的执行。\r\n\r\n**使用格式:**\r\n\r\n~~~\r\nthrow new 异常类名(参数);\r\n~~~\r\n\r\n 例如:\r\n\r\n~~~java\r\nthrow new NullPointerException(\"要访问的arr数组不存在\");\r\n\r\nthrow new ArrayIndexOutOfBoundsException(\"该索引在数组中不存在,已超出范围\");\r\n~~~\r\n\r\n学习完抛出异常的格式后,我们通过下面程序演示下throw的使用。\r\n\r\n~~~java\r\npublic class ThrowDemo {\r\n public static void main(String[] args) {\r\n //创建一个数组 \r\n int[] arr = {2,4,52,2};\r\n //根据索引找对应的元素 \r\n int index = 4;\r\n int element = getElement(arr, index);\r\n\r\n System.out.println(element);\r\n System.out.println(\"over\");\r\n }\r\n /*\r\n * 根据 索引找到数组中对应的元素\r\n */\r\n public static int getElement(int[] arr,int index){ \r\n //判断 索引是否越界\r\n if(index<0 || index>arr.length-1){\r\n /*\r\n 判断条件如果满足,当执行完throw抛出异常对象后,方法已经无法继续运算。\r\n 这时就会结束当前方法的执行,并将异常告知给调用者。这时就需要通过异常来解决。 \r\n */\r\n throw new ArrayIndexOutOfBoundsException(\"哥们,角标越界了~~~\");\r\n }\r\n int element = arr[index];\r\n return element;\r\n }\r\n}\r\n~~~\r\n\r\n> 注意:如果产生了问题,我们就会throw将问题描述类即异常进行抛出,也就是将问题返回给该方法的调用者。\r\n>\r\n> 那么对于调用者来说,该怎么处理呢?一种是进行捕获处理,另一种就是继续讲问题声明出去,使用throws声明处理。\r\n\r\n## 2.2 Objects非空判断\r\n\r\n还记得我们学习过一个类Objects吗,曾经提到过它由一些静态的实用方法组成,这些方法是null-save(空指针安全的)或null-tolerant(容忍空指针的),那么在它的源码中,对对象为null的值进行了抛出异常操作。\r\n\r\n* `public static <T> T requireNonNull(T obj)`:查看指定引用对象不是null。\r\n\r\n查看源码发现这里对为null的进行了抛出异常操作:\r\n\r\n~~~java\r\npublic static <T> T requireNonNull(T obj) {\r\n if (obj == null)\r\n throw new NullPointerException();\r\n return obj;\r\n}\r\n~~~\r\n\r\n## 2.3 声明异常throws\r\n\r\n**声明异常**:将问题标识出来,报告给调用者。如果方法内通过throw抛出了编译时异常,而没有捕获处理(稍后讲解该方式),那么必须通过throws进行声明,让调用者去处理。\r\n\r\n关键字**throws**运用于方法声明之上,用于表示当前方法不处理异常,而是提醒该方法的调用者来处理异常(抛出异常).\r\n\r\n**声明异常格式:**\r\n\r\n~~~\r\n修饰符 返回值类型 方法名(参数) throws 异常类名1,异常类名2…{ } \r\n~~~\r\n\r\n声明异常的代码演示:\r\n\r\n~~~java\r\npublic class ThrowsDemo {\r\n public static void main(String[] args) throws FileNotFoundException {\r\n read(\"a.txt\");\r\n }\r\n\r\n // 如果定义功能时有问题发生需要报告给调用者。可以通过在方法上使用throws关键字进行声明\r\n public static void read(String path) throws FileNotFoundException {\r\n if (!path.equals(\"a.txt\")) {//如果不是 a.txt这个文件 \r\n // 我假设 如果不是 a.txt 认为 该文件不存在 是一个错误 也就是异常 throw\r\n throw new FileNotFoundException(\"文件不存在\");\r\n }\r\n }\r\n}\r\n~~~\r\n\r\nthrows用于进行异常类的声明,若该方法可能有多种异常情况产生,那么在throws后面可以写多个异常类,用逗号隔开。\r\n\r\n~~~java\r\npublic class ThrowsDemo2 {\r\n public static void main(String[] args) throws IOException {\r\n read(\"a.txt\");\r\n }\r\n\r\n public static void read(String path)throws FileNotFoundException, IOException {\r\n if (!path.equals(\"a.txt\")) {//如果不是 a.txt这个文件 \r\n // 我假设 如果不是 a.txt 认为 该文件不存在 是一个错误 也就是异常 throw\r\n throw new FileNotFoundException(\"文件不存在\");\r\n }\r\n if (!path.equals(\"b.txt\")) {\r\n throw new IOException();\r\n }\r\n }\r\n}\r\n~~~\r\n\r\n## 2.4 捕获异常try…catch\r\n\r\n如果异常出现的话,会立刻终止程序,所以我们得处理异常:\r\n\r\n1. 该方法不处理,而是声明抛出,由该方法的调用者来处理(throws)。\r\n2. 在方法中使用try-catch的语句块来处理异常。\r\n\r\n**try-catch**的方式就是捕获异常。\r\n\r\n* **捕获异常**:Java中对异常有针对性的语句进行捕获,可以对出现的异常进行指定方式的处理。\r\n\r\n捕获异常语法如下:\r\n\r\n~~~java\r\ntry{\r\n 编写可能会出现异常的代码\r\n}catch(异常类型 e){\r\n 处理异常的代码\r\n //记录日志/打印异常信息/继续抛出异常\r\n}\r\n~~~\r\n\r\n**try:**该代码块中编写可能产生异常的代码。\r\n\r\n**catch:**用来进行某种异常的捕获,实现对捕获到的异常进行处理。\r\n\r\n> 注意:try和catch都不能单独使用,必须连用。\r\n\r\n演示如下:\r\n\r\n~~~java\r\npublic class TryCatchDemo {\r\n public static void main(String[] args) {\r\n try {// 当产生异常时,必须有处理方式。要么捕获,要么声明。\r\n read(\"b.txt\");\r\n } catch (FileNotFoundException e) {// 括号中需要定义什么呢?\r\n //try中抛出的是什么异常,在括号中就定义什么异常类型\r\n System.out.println(e);\r\n }\r\n System.out.println(\"over\");\r\n }\r\n /*\r\n *\r\n * 我们 当前的这个方法中 有异常 有编译期异常\r\n */\r\n public static void read(String path) throws FileNotFoundException {\r\n if (!path.equals(\"a.txt\")) {//如果不是 a.txt这个文件 \r\n // 我假设 如果不是 a.txt 认为 该文件不存在 是一个错误 也就是异常 throw\r\n throw new FileNotFoundException(\"文件不存在\");\r\n }\r\n }\r\n}\r\n~~~\r\n\r\n如何获取异常信息:\r\n\r\nThrowable类中定义了一些查看方法:\r\n\r\n* `public String getMessage()`:获取异常的描述信息,原因(提示给用户的时候,就提示错误原因。\r\n\r\n\r\n* `public String toString()`:获取异常的类型和异常描述信息(不用)。\r\n* `public void printStackTrace()`:打印异常的跟踪栈信息并输出到控制台。\r\n\r\n *包含了异常的类型,异常的原因,还包括异常出现的位置,在开发和调试阶段,都得使用printStackTrace。*\r\n\r\n## 2.4 finally 代码块\r\n\r\n**finally**:有一些特定的代码无论异常是否发生,都需要执行。另外,因为异常会引发程序跳转,导致有些语句执行不到。而finally就是解决这个问题的,在finally代码块中存放的代码都是一定会被执行的。\r\n\r\n什么时候的代码必须最终执行?\r\n\r\n当我们在try语句块中打开了一些物理资源(磁盘文件/网络连接/数据库连接等),我们都得在使用完之后,最终关闭打开的资源。\r\n\r\nfinally的语法:\r\n\r\n try...catch....finally:自身需要处理异常,最终还得关闭资源。\r\n\r\n> 注意:finally不能单独使用。\r\n\r\n比如在我们之后学习的IO流中,当打开了一个关联文件的资源,最后程序不管结果如何,都需要把这个资源关闭掉。\r\n\r\nfinally代码参考如下:\r\n\r\n~~~java\r\npublic class TryCatchDemo4 {\r\n public static void main(String[] args) {\r\n try {\r\n read(\"a.txt\");\r\n } catch (FileNotFoundException e) {\r\n //抓取到的是编译期异常 抛出去的是运行期 \r\n throw new RuntimeException(e);\r\n } finally {\r\n System.out.println(\"不管程序怎样,这里都将会被执行。\");\r\n }\r\n System.out.println(\"over\");\r\n }\r\n /*\r\n *\r\n * 我们 当前的这个方法中 有异常 有编译期异常\r\n */\r\n public static void read(String path) throws FileNotFoundException {\r\n if (!path.equals(\"a.txt\")) {//如果不是 a.txt这个文件 \r\n // 我假设 如果不是 a.txt 认为 该文件不存在 是一个错误 也就是异常 throw\r\n throw new FileNotFoundException(\"文件不存在\");\r\n }\r\n }\r\n}\r\n~~~\r\n\r\n> 当只有在try或者catch中调用退出JVM的相关方法,此时finally才不会执行,否则finally永远会执行。\r\n\r\n\r\n\r\n## 2.5 异常注意事项\r\n\r\n* 多个异常使用捕获又该如何处理呢?\r\n\r\n 1. 多个异常分别处理。\r\n 2. 多个异常一次捕获,多次处理。\r\n 3. 多个异常一次捕获一次处理。\r\n\r\n 一般我们是使用一次捕获多次处理方式,格式如下:\r\n\r\n ```java\r\n try{\r\n 编写可能会出现异常的代码\r\n }catch(异常类型A e){ 当try中出现A类型异常,就用该catch来捕获.\r\n 处理异常的代码\r\n //记录日志/打印异常信息/继续抛出异常\r\n }catch(异常类型B e){ 当try中出现B类型异常,就用该catch来捕获.\r\n 处理异常的代码\r\n //记录日志/打印异常信息/继续抛出异常\r\n }\r\n ```\r\n\r\n > 注意:这种异常处理方式,要求多个catch中的异常不能相同,并且若catch中的多个异常之间有子父类异常的关系,那么子类异常要求在上面的catch处理,父类异常在下面的catch处理。\r\n\r\n* 运行时异常被抛出可以不处理。即不捕获也不声明抛出。\r\n\r\n* 如果finally有return语句,永远返回finally中的结果,避免该情况. \r\n\r\n* 如果父类抛出了多个异常,子类重写父类方法时,抛出和父类相同的异常或者是父类异常的子类或者不抛出异常。\r\n\r\n* 父类方法没有抛出异常,子类重写父类该方法时也不可抛出异常。此时子类产生该异常,只能捕获处理,不能声明抛出\r\n\r\n\r\n# 第三章 自定义异常\r\n\r\n## 3.1 概述\r\n\r\n**为什么需要自定义异常类:**\r\n\r\n我们说了Java中不同的异常类,分别表示着某一种具体的异常情况,那么在开发中总是有些异常情况是SUN没有定义好的,此时我们根据自己业务的异常情况来定义异常类。例如年龄负数问题,考试成绩负数问题等等。\r\n\r\n在上述代码中,发现这些异常都是JDK内部定义好的,但是实际开发中也会出现很多异常,这些异常很可能在JDK中没有定义过,例如年龄负数问题,考试成绩负数问题.那么能不能自己定义异常呢?\r\n\r\n**什么是自定义异常类:**\r\n\r\n在开发中根据自己业务的异常情况来定义异常类.\r\n\r\n自定义一个业务逻辑异常: **RegisterException**。一个注册异常类。\r\n\r\n**异常类如何定义:**\r\n\r\n1. 自定义一个编译期异常: 自定义类 并继承于`java.lang.Exception`。\r\n2. 自定义一个运行时期的异常类:自定义类 并继承于`java.lang.RuntimeException`。\r\n\r\n## 3.2 自定义异常的练习\r\n\r\n要求:我们模拟注册操作,如果用户名已存在,则抛出异常并提示:亲,该用户名已经被注册。\r\n\r\n首先定义一个登陆异常类RegisterException:\r\n\r\n~~~java\r\n// 业务逻辑异常\r\npublic class RegisterException extends Exception {\r\n /**\r\n * 空参构造\r\n */\r\n public RegisterException() {\r\n }\r\n\r\n /**\r\n *\r\n * @param message 表示异常提示\r\n */\r\n public RegisterException(String message) {\r\n super(message);\r\n }\r\n}\r\n~~~\r\n\r\n模拟登陆操作,使用数组模拟数据库中存储的数据,并提供当前注册账号是否存在方法用于判断。\r\n\r\n~~~java\r\npublic class Demo {\r\n // 模拟数据库中已存在账号\r\n private static String[] names = {\"bill\",\"hill\",\"jill\"};\r\n \r\n public static void main(String[] args) { \r\n //调用方法\r\n try{\r\n // 可能出现异常的代码\r\n checkUsername(\"nill\");\r\n System.out.println(\"注册成功\");//如果没有异常就是注册成功\r\n }catch(RegisterException e){\r\n //处理异常\r\n e.printStackTrace();\r\n }\r\n }\r\n\r\n //判断当前注册账号是否存在\r\n //因为是编译期异常,又想调用者去处理 所以声明该异常\r\n public static boolean checkUsername(String uname) throws LoginException{\r\n for (String name : names) {\r\n if(name.equals(uname)){//如果名字在这里面 就抛出登陆异常\r\n throw new RegisterException(\"亲\"+name+\"已经被注册了!\");\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\n~~~\r\n\r\n# 第四章 多线程\r\n\r\n我们在之前,学习的程序在没有跳转语句的前提下,都是由上至下依次执行,那现在想要设计一个程序,边打游戏边听歌,怎么设计?\r\n\r\n要解决上述问题,咱们得使用多进程或者多线程来解决.\r\n\r\n## 4.1 并发与并行\r\n\r\n* **并发**:指两个或多个事件在**同一个时间段内**发生。\r\n* **并行**:指两个或多个事件在**同一时刻**发生(同时发生)。\r\n\r\n\r\n\r\n在操作系统中,安装了多个程序,并发指的是在一段时间内宏观上有多个程序同时运行,这在单 CPU 系统中,每一时刻只能有一道程序执行,即微观上这些程序是分时的交替运行,只不过是给人的感觉是同时运行,那是因为分时交替运行的时间是非常短的。\r\n\r\n而在多个 CPU 系统中,则这些可以并发执行的程序便可以分配到多个处理器上(CPU),实现多任务并行执行,即利用每个处理器来处理一个可以并发执行的程序,这样多个程序便可以同时执行。目前电脑市场上说的多核 CPU,便是多核处理器,核 越多,并行处理的程序越多,能大大的提高电脑运行的效率。\r\n\r\n> 注意:单核处理器的计算机肯定是不能并行的处理多个任务的,只能是多个任务在单个CPU上并发运行。同理,线程也是一样的,从宏观角度上理解线程是并行运行的,但是从微观角度上分析却是串行运行的,即一个线程一个线程的去运行,当系统只有一个CPU时,线程会以某种顺序执行多个线程,我们把这种情况称之为线程调度。\r\n\r\n## 4.2 线程与进程\r\n\r\n* **进程**:是指一个内存中运行的应用程序,每个进程都有一个独立的内存空间,一个应用程序可以同时运行多个进程;进程也是程序的一次执行过程,是系统运行程序的基本单位;系统运行一个程序即是一个进程从创建、运行到消亡的过程。\r\n\r\n* **线程**:线程是进程中的一个执行单元,负责当前进程中程序的执行,一个进程中至少有一个线程。一个进程中是可以有多个线程的,这个应用程序也可以称之为多线程程序。 \r\n\r\n 简而言之:一个程序运行后至少有一个进程,一个进程中可以包含多个线程 \r\n\r\n我们可以再电脑底部任务栏,右键----->打开任务管理器,可以查看当前任务的进程:\r\n\r\n**进程**\r\n\r\n\r\n\r\n**线程**\r\n\r\n\r\n\r\n**线程调度:**\r\n\r\n- 分时调度\r\n\r\n 所有线程轮流使用 CPU 的使用权,平均分配每个线程占用 CPU 的时间。\r\n\r\n- 抢占式调度\r\n\r\n 优先让优先级高的线程使用 CPU,如果线程的优先级相同,那么会随机选择一个(线程随机性),Java使用的为抢占式调度。\r\n\r\n - 设置线程的优先级\r\n\r\n \r\n - 抢占式调度详解\r\n\r\n 大部分操作系统都支持多进程并发运行,现在的操作系统几乎都支持同时运行多个程序。比如:现在我们上课一边使用编辑器,一边使用录屏软件,同时还开着画图板,dos窗口等软件。此时,这些程序是在同时运行,”感觉这些软件好像在同一时刻运行着“。\r\n\r\n 实际上,CPU(中央处理器)使用抢占式调度模式在多个线程间进行着高速的切换。对于CPU的一个核而言,某个时刻,只能执行一个线程,而 CPU的在多个线程间切换速度相对我们的感觉要快,看上去就是在同一时刻运行。\r\n 其实,多线程程序并不能提高程序的运行速度,但能够提高程序运行效率,让CPU的使用率更高。\r\n\r\n \r\n\r\n## 4.3 创建线程类\r\n\r\nJava使用`java.lang.Thread`类代表**线程**,所有的线程对象都必须是Thread类或其子类的实例。每个线程的作用是完成一定的任务,实际上就是执行一段程序流即一段顺序执行的代码。Java使用线程执行体来代表这段程序流。Java中通过继承Thread类来**创建**并**启动多线程**的步骤如下:\r\n\r\n1. 定义Thread类的子类,并重写该类的run()方法,该run()方法的方法体就代表了线程需要完成的任务,因此把run()方法称为线程执行体。\r\n2. 创建Thread子类的实例,即创建了线程对象\r\n3. 调用线程对象的start()方法来启动该线程\r\n\r\n代码如下:\r\n\r\n测试类:\r\n\r\n~~~java\r\npublic class Demo01 {\r\n public static void main(String[] args) {\r\n //创建自定义线程对象\r\n MyThread mt = new MyThread(\"新的线程!\");\r\n //开启新线程\r\n mt.start();\r\n //在主方法中执行for循环\r\n for (int i = 0; i < 10; i++) {\r\n System.out.println(\"main线程!\"+i);\r\n }\r\n }\r\n}\r\n~~~\r\n\r\n自定义线程类:\r\n\r\n~~~java\r\npublic class MyThread extends Thread {\r\n //定义指定线程名称的构造方法\r\n public MyThread(String name) {\r\n //调用父类的String参数的构造方法,指定线程的名称\r\n super(name);\r\n }\r\n /**\r\n * 重写run方法,完成该线程执行的逻辑\r\n */\r\n @Override\r\n public void run() {\r\n for (int i = 0; i < 10; i++) {\r\n System.out.println(getName()+\":正在执行!\"+i);\r\n }\r\n }\r\n}\r\n~~~\r\n','https://i.picsum.photos/id/0/5616/3744.jpg','原创',0,0,0,0,1,1,'2020-01-01 11:55:24','2020-01-02 03:05:56',3,1,'异常详解','2,3,5'),(1589068467806,'[test]测试文章1',' [TOC]\r\n\r\n# 标题测试\r\n\r\n- TeX (Based on KaTeX);\r\n- Emoji;\r\n- Task lists;\r\n- HTML tags decode;\r\n- Flowchart and Sequence Diagram;\r\n\r\n尝试测试一下','https://i.loli.net/2020/05/10/UbP2ipDMOxsfuyW.jpg','原创',0,0,0,0,1,1,'2020-05-09 23:54:35','2020-05-09 23:54:35',7,1,'尝试测试一下','6'),(1589068643094,'可以评论',' [TOC]\r\n\r\n#### Disabled options\r\n\r\n- TeX (Based on KaTeX);\r\n- Emoji;\r\n- Task lists;\r\n- HTML tags decode;\r\n- Flowchart and Sequence Diagram;\r\n 可以评论','https://i.loli.net/2020/05/10/UbP2ipDMOxsfuyW.jpg','原创',0,0,0,1,1,1,'2020-05-09 23:57:23','2020-05-09 23:57:23',3,1,'可以评论','1,2'),(1589726426261,'新文章出炉',' [TOC]\r\n\r\n#### Disabled options\r\n\r\n- TeX (Based on KaTeX);\r\n- Emoji;\r\n- Task lists;\r\n- HTML tags decode;\r\n- Flowchart and Sequence Diagram;\r\n ','https://i.loli.net/2020/05/10/UbP2ipDMOxsfuyW.jpg','原创',0,0,0,1,1,0,'2020-05-17 14:40:28','2020-05-17 14:40:28',4,1,'hexo其实不怎么好用,稳定性差','6,5');
/*!40000 ALTER TABLE `t_blog` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `t_blog_tags`
--
DROP TABLE IF EXISTS `t_blog_tags`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_blog_tags` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tag_id` bigint(20) DEFAULT NULL,
`blog_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t_blog_tags`
--
LOCK TABLES `t_blog_tags` WRITE;
/*!40000 ALTER TABLE `t_blog_tags` DISABLE KEYS */;
INSERT INTO `t_blog_tags` VALUES (36,2,'1577792888747'),(37,3,'1577792888747'),(38,5,'1577792888747'),(39,2,'1577793147252'),(40,3,'1577793147252'),(41,3,'1577869935491'),(42,2,'1577869935491'),(43,5,'1577869935491'),(44,1,'1577870084710'),(45,2,'1577870084710'),(46,3,'1577870084710'),(47,2,'1577879724073'),(48,3,'1577879724073'),(49,5,'1577879724073'),(50,6,'1589068467806'),(51,1,'1589068643094'),(52,2,'1589068643094'),(53,6,'1589726426261'),(54,5,'1589726426261');
/*!40000 ALTER TABLE `t_blog_tags` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `t_comment`
--
DROP TABLE IF EXISTS `t_comment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_comment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`nickname` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
`avatar` varchar(255) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
`blog_id` bigint(20) DEFAULT NULL,
`parent_comment_id` bigint(20) DEFAULT NULL,
`check_status` tinyint(1) DEFAULT '0' COMMENT '是否审核通过',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t_comment`
--
LOCK TABLES `t_comment` WRITE;
/*!40000 ALTER TABLE `t_comment` DISABLE KEYS */;
INSERT INTO `t_comment` VALUES (19,'小明','<EMAIL>','测试','/image/1.jpg','2020-05-09 14:19:27',1577870084710,-1,1),(21,'sod','<EMAIL>','test','https://unsplash.it/100/100?image=1005','2020-05-17 14:32:45',1589068643094,-1,1),(23,'sod','<EMAIL>','工 地','https://unsplash.it/100/100?image=1005','2020-05-17 14:42:51',1589068643094,-1,1),(24,'sod','<EMAIL>','checkcheckcheckcheck','/image/1.jpg','2020-05-17 14:56:21',1589726426261,-1,1);
/*!40000 ALTER TABLE `t_comment` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `t_log`
--
DROP TABLE IF EXISTS `t_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` datetime DEFAULT NULL COMMENT '操作时间',
`type` varchar(50) DEFAULT NULL COMMENT '操作类型',
`detail` varchar(1000) DEFAULT NULL COMMENT '详情',
`ip` varchar(128) DEFAULT NULL COMMENT 'ip',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=71 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t_log`
--
LOCK TABLES `t_log` WRITE;
/*!40000 ALTER TABLE `t_log` DISABLE KEYS */;
INSERT INTO `t_log` VALUES (2,'2020-05-09 23:30:34','test','test,','127.0.0.1'),(3,'2020-05-09 16:43:13','登录','HFF 登录','172.16.17.32'),(4,'2020-05-09 16:49:03','登录','HFF 登录','172.16.17.32'),(5,'2020-05-09 16:49:42','登录','HFF 登录',NULL),(6,'2020-05-09 16:49:55','登录','HFF 登录',NULL),(7,'2020-05-09 16:51:36','登录','HFF 登录',NULL),(8,'2020-05-09 16:51:48','登录','HFF 登录',NULL),(9,'2020-05-09 16:53:07','登录','HFF 登录',NULL),(10,'2020-05-09 16:53:32','登录','HFF 登录',NULL),(14,'2020-05-09 17:44:20','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(15,'2020-05-09 17:44:46','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(16,'2020-05-09 17:45:49','登录','HFF 登录',NULL),(17,'2020-05-09 17:46:12','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(18,'2020-05-09 17:46:18','登录','HFF 登录',NULL),(19,'2020-05-09 17:47:32','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(20,'2020-05-09 17:48:14','登录','HFF 登录',''),(21,'2020-05-09 17:51:08','登录','HFF 登录',NULL),(29,'2020-05-09 18:01:45','登录','HFF 登录','0:0:0:0:0:0:0:1'),(30,'2020-05-09 18:05:11','登录','HFF 登录','0:0:0:0:0:0:0:1'),(31,'2020-05-09 18:08:28','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(32,'2020-05-09 18:08:35','登录','HFF 登录','0:0:0:0:0:0:0:1'),(33,'2020-05-09 18:08:37','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(34,'2020-05-09 18:08:45','登录','HFF 登录','0:0:0:0:0:0:0:1'),(35,'2020-05-09 18:08:47','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(36,'2020-05-09 18:08:56','登录','HFF 登录','0:0:0:0:0:0:0:1'),(37,'2020-05-09 18:09:15','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(38,'2020-05-09 18:09:18','登录','HFF 登录','0:0:0:0:0:0:0:1'),(39,'2020-05-09 18:09:20','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(40,'2020-05-09 18:09:22','登录','HFF 登录','0:0:0:0:0:0:0:1'),(41,'2020-05-09 18:09:24','退出登录','HFF 退出登录','0:0:0:0:0:0:0:1'),(42,'2020-05-09 18:09:26','登录','HFF 登录','0:0:0:0:0:0:0:1'),(43,'2020-05-09 18:12:41','登录','HFF 登录','0:0:0:0:0:0:0:1'),(44,'2020-05-09 18:12:48','编辑博客','springMVC执行原理','0:0:0:0:0:0:0:1'),(45,'2020-05-09 18:13:01','添加标签','test','0:0:0:0:0:0:0:1'),(46,'2020-05-09 18:13:10','添加分类','tttest','0:0:0:0:0:0:0:1'),(47,'2020-05-09 18:15:00','登录','HFF 登录','0:0:0:0:0:0:0:1'),(48,'2020-05-09 23:49:44','登录','HFF 登录','0:0:0:0:0:0:0:1'),(49,'2020-05-09 23:51:59','登录','HFF 登录','0:0:0:0:0:0:0:1'),(50,'2020-05-09 23:54:39','添加博客','[test]测试文章1','0:0:0:0:0:0:0:1'),(51,'2020-05-09 23:57:23','添加博客','可以评论','0:0:0:0:0:0:0:1'),(52,'2020-05-11 05:49:15','登录','HFF 登录','0:0:0:0:0:0:0:1'),(53,'2020-05-11 06:04:33','登录','HFF 登录','0:0:0:0:0:0:0:1'),(54,'2020-05-14 15:28:57','登录','HFF 登录','0:0:0:0:0:0:0:1'),(55,'2020-05-14 15:34:08','登录','HFF 登录','0:0:0:0:0:0:0:1'),(56,'2020-05-14 15:43:13','登录','HFF 登录','0:0:0:0:0:0:0:1'),(57,'2020-05-14 16:03:56','登录','HFF 登录','0:0:0:0:0:0:0:1'),(58,'2020-05-14 16:04:43','登录','HFF 登录','0:0:0:0:0:0:0:1'),(59,'2020-05-14 16:07:36','登录','HFF 登录','0:0:0:0:0:0:0:1'),(60,'2020-05-14 16:12:32','添加评论/回复','匿名用户','0:0:0:0:0:0:0:1'),(61,'2020-05-14 16:12:51','登录','HFF 登录','127.0.0.1'),(62,'2020-05-17 14:25:19','登录','HFF 登录','0:0:0:0:0:0:0:1'),(63,'2020-05-17 14:29:28','登录','HFF 登录','0:0:0:0:0:0:0:1'),(64,'2020-05-17 14:32:45','添加评论/回复','HFF 评论 可以评论','0:0:0:0:0:0:0:1'),(65,'2020-05-17 14:40:28','添加博客','新文章出炉','0:0:0:0:0:0:0:1'),(66,'2020-05-17 14:40:44','添加评论/回复','HFF 评论 新文章出炉','0:0:0:0:0:0:0:1'),(67,'2020-05-17 14:42:51','添加评论/回复','HFF 评论 可以评论','0:0:0:0:0:0:0:1'),(68,'2020-05-17 14:56:21','添加评论/回复','匿名用户','0:0:0:0:0:0:0:1'),(69,'2020-05-17 14:56:27','登录','HFF 登录','0:0:0:0:0:0:0:1'),(70,'2020-05-17 14:56:45','添加评论/回复','HFF 评论 新文章出炉','0:0:0:0:0:0:0:1');
/*!40000 ALTER TABLE `t_log` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `t_tag`
--
DROP TABLE IF EXISTS `t_tag`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_tag` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t_tag`
--
LOCK TABLES `t_tag` WRITE;
/*!40000 ALTER TABLE `t_tag` DISABLE KEYS */;
INSERT INTO `t_tag` VALUES (1,'生活'),(2,'学习'),(3,'知识'),(5,'java基础'),(6,'test');
/*!40000 ALTER TABLE `t_tag` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `t_type`
--
DROP TABLE IF EXISTS `t_type`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_type` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t_type`
--
LOCK TABLES `t_type` WRITE;
/*!40000 ALTER TABLE `t_type` DISABLE KEYS */;
INSERT INTO `t_type` VALUES (3,'java基础'),(4,'hexo'),(5,'ssm框架'),(6,'算法'),(7,'tttest');
/*!40000 ALTER TABLE `t_type` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `t_user`
--
DROP TABLE IF EXISTS `t_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`nickname` varchar(255) DEFAULT NULL,
`username` varchar(255) NOT NULL DEFAULT '',
`password` varchar(255) NOT NULL DEFAULT '',
`email` varchar(255) DEFAULT NULL,
`avatar` varchar(255) DEFAULT NULL,
`type` int(10) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t_user`
--
LOCK TABLES `t_user` WRITE;
/*!40000 ALTER TABLE `t_user` DISABLE KEYS */;
INSERT INTO `t_user` VALUES (1,'HFF','hff','e10adc3949ba59abbe56e057f20f883e','<EMAIL>','https://unsplash.it/100/100?image=1005',1,'2020-05-09 22:39:21','2020-05-09 22:39:21');
/*!40000 ALTER TABLE `t_user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-05-17 22:59:29
|
CREATE TABLE SMS_OUT (
ID INTEGER GENERATED ALWAYS AS IDENTITY,
TYPE VARCHAR(1) DEFAULT 'O' NOT NULL,
RECIPIENT VARCHAR(16) NOT NULL,
TEXT VARCHAR(1000) NOT NULL,
WAP_URL VARCHAR(100) DEFAULT NULL,
WAP_EXPIRY_DATE TIMESTAMP DEFAULT NULL,
WAP_SIGNAL VARCHAR(1) DEFAULT NULL,
CREATE_DATE TIMESTAMP NOT NULL,
ORIGINATOR VARCHAR(16) DEFAULT ' ' NOT NULL,
ENCODING VARCHAR(1) DEFAULT '7' NOT NULL,
STATUS_REPORT INTEGER DEFAULT 0 NOT NULL,
FLASH_SMS INTEGER DEFAULT 0 NOT NULL,
SRC_PORT INTEGER DEFAULT -1 NOT NULL,
DST_PORT INTEGER DEFAULT -1 NOT NULL,
SENT_DATE TIMESTAMP DEFAULT NULL,
REF_NO VARCHAR(64) DEFAULT NULL,
PRIORITY INTEGER DEFAULT 0 NOT NULL,
STATUS VARCHAR(1) DEFAULT 'U' NOT NULL,
ERRORS INTEGER DEFAULT 0 NOT NULL,
GATEWAY_ID VARCHAR(64) DEFAULT '*' NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE SMS_IN (
ID INTEGER GENERATED ALWAYS AS IDENTITY,
PROCESS INTEGER NOT NULL,
ORIGINATOR VARCHAR(16) NOT NULL,
TYPE VARCHAR(1) NOT NULL,
ENCODING CHAR(1) NOT NULL,
MESSAGE_DATE TIMESTAMP NOT NULL,
RECEIVE_DATE TIMESTAMP NOT NULL,
TEXT VARCHAR(1000) NOT NULL,
ORIGINAL_REF_NO VARCHAR(64) DEFAULT NULL,
ORIGINAL_RECEIVE_DATE TIMESTAMP DEFAULT NULL,
GATEWAY_ID VARCHAR(64) DEFAULT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE SMS_CALLS (
ID INTEGER GENERATED ALWAYS AS IDENTITY,
CALL_DATE TIMESTAMP NOT NULL,
GATEWAY_ID VARCHAR(64) NOT NULL,
CALLER_ID VARCHAR(16) NOT NULL,
PRIMARY KEY (ID)
);
|
CREATE PROCEDURE SP464(OUT MYCOUNT INTEGER) SPECIFIC SP464_126612 LANGUAGE SQL NOT DETERMINISTIC READS SQL DATA NEW SAVEPOINT LEVEL BEGIN ATOMIC DECLARE MYVAR INT;SELECT COUNT(*)INTO MYCOUNT FROM TABLE206;SELECT COUNT(*)INTO MYCOUNT FROM TABLE301;SELECT COUNT(*)INTO MYCOUNT FROM TABLE420;SELECT COUNT(*)INTO MYCOUNT FROM VIEW95;SELECT COUNT(*)INTO MYCOUNT FROM VIEW78;SELECT COUNT(*)INTO MYCOUNT FROM VIEW32;CALL SP810(MYVAR);CALL SP202(MYVAR);CALL SP105(MYVAR);CALL SP88(MYVAR);END
GO |
SET FOREIGN_KEY_CHECKS = 0;
ALTER TABLE `plugin_package_attributes`
ADD COLUMN `ref_package` VARCHAR(45) COLLATE utf8_bin NULL,
ADD COLUMN `ref_entity` VARCHAR(45) COLLATE utf8_bin NULL,
ADD COLUMN `ref_attr` VARCHAR(45) COLLATE utf8_bin NULL;
ALTER TABLE `core_ru_proc_exec_binding`
ADD COLUMN `bind_flag` char(1) COLLATE utf8_bin DEFAULT 'Y';
ALTER TABLE `plugin_package_attributes`
ADD COLUMN `mandatory` BIT(1) NULL DEFAULT 0;
ALTER TABLE `core_re_task_node_def_info`
ADD COLUMN `dynamic_bind` VARCHAR(45) COLLATE utf8_bin NULL DEFAULT 'N';
ALTER TABLE `core_re_proc_def_info`
ADD COLUMN `exclude_mode` VARCHAR(10) COLLATE utf8_bin NULL DEFAULT 'N';
ALTER TABLE `core_re_task_node_def_info`
ADD COLUMN `pre_check` VARCHAR(45) COLLATE utf8_bin NULL DEFAULT 'N';
ALTER TABLE `core_operation_event`
ADD COLUMN `rev` INT(11) DEFAULT 0;
ALTER TABLE `core_operation_event`
ADD COLUMN `oper_mode` VARCHAR(45) COLLATE utf8_bin NULL DEFAULT 'defer';
CREATE TABLE IF NOT EXISTS `core_object_meta` (
`id` varchar(20) COLLATE utf8_bin NOT NULL,
`name` varchar(45) COLLATE utf8_bin NOT NULL,
`package_name` varchar(45) COLLATE utf8_bin NOT NULL,
`source` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`latest_source` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`created_by` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`created_time` datetime NOT NULL,
`updated_by` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`updated_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE IF NOT EXISTS `core_object_property_meta` (
`id` varchar(45) COLLATE utf8_bin NOT NULL,
`name` varchar(45) COLLATE utf8_bin NOT NULL,
`data_type` varchar(45) COLLATE utf8_bin NOT NULL,
`ref_type` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`map_type` varchar(45) COLLATE utf8_bin NOT NULL,
`map_expr` varchar(500) COLLATE utf8_bin DEFAULT NULL,
`object_meta_id` varchar(45) COLLATE utf8_bin NOT NULL,
`object_name` varchar(45) COLLATE utf8_bin NOT NULL,
`package_name` varchar(45) COLLATE utf8_bin NOT NULL,
`source` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`created_by` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`created_time` datetime NOT NULL,
`updated_by` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`updated_time` datetime DEFAULT NULL,
`is_sensitive` bit(1) DEFAULT NULL,
`ref_name` varchar(45) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE IF NOT EXISTS `core_object_var` (
`id` varchar(45) COLLATE utf8_bin NOT NULL,
`object_meta_id` varchar(45) COLLATE utf8_bin NOT NULL,
`name` varchar(45) COLLATE utf8_bin NOT NULL,
`package_name` varchar(45) COLLATE utf8_bin NOT NULL,
`created_by` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`created_time` datetime NOT NULL,
`updated_by` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`updated_time` datetime DEFAULT NULL,
`parent_object_var_id` VARCHAR(45) COLLATE utf8_bin NULL,
`parent_object_name` VARCHAR(45) COLLATE utf8_bin NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE IF NOT EXISTS `core_object_property_var` (
`id` varchar(45) COLLATE utf8_bin NOT NULL,
`name` varchar(45) COLLATE utf8_bin NOT NULL,
`data_type` varchar(45) COLLATE utf8_bin NOT NULL,
`object_property_meta_id` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`object_meta_id` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`object_var_id` varchar(45) COLLATE utf8_bin NOT NULL,
`data_value` varchar(500) COLLATE utf8_bin DEFAULT NULL,
`data_type_id` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`data_id` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`data_name` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`created_by` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`created_time` datetime NOT NULL,
`updated_by` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`updated_time` datetime DEFAULT NULL,
`is_sensitive` bit(1) DEFAULT NULL,
`object_name` VARCHAR(45) COLLATE utf8_bin NULL,
`package_name` VARCHAR(45) COLLATE utf8_bin NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE IF NOT EXISTS `core_object_list_var` (
`id` varchar(20) COLLATE utf8_bin NOT NULL,
`data_type` varchar(45) COLLATE utf8_bin NOT NULL,
`data_value` varchar(1000) COLLATE utf8_bin NOT NULL,
`created_by` varchar(45) COLLATE utf8_bin DEFAULT NULL,
`created_time` datetime NOT NULL,
`is_sensitive` bit(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ALTER TABLE `core_ru_task_node_inst_info`
ADD COLUMN `pre_check_ret` VARCHAR(45) COLLATE utf8_bin NULL;
ALTER TABLE `core_ru_task_node_exec_req`
CHANGE COLUMN `err_msg` `err_msg` MEDIUMTEXT COLLATE utf8_bin NULL DEFAULT NULL ;
alter table plugin_packages convert to character set utf8 collate utf8_bin;
alter table plugin_package_dependencies convert to character set utf8 collate utf8_bin;
alter table plugin_package_menus convert to character set utf8 collate utf8_bin;
alter table plugin_package_data_model convert to character set utf8 collate utf8_bin;
alter table plugin_package_entities convert to character set utf8 collate utf8_bin;
alter table plugin_package_attributes convert to character set utf8 collate utf8_bin;
alter table system_variables convert to character set utf8 collate utf8_bin;
alter table plugin_package_authorities convert to character set utf8 collate utf8_bin;
alter table plugin_package_runtime_resources_docker convert to character set utf8 collate utf8_bin;
alter table plugin_package_runtime_resources_mysql convert to character set utf8 collate utf8_bin;
alter table plugin_package_runtime_resources_s3 convert to character set utf8 collate utf8_bin;
alter table plugin_configs convert to character set utf8 collate utf8_bin;
alter table plugin_config_interfaces convert to character set utf8 collate utf8_bin;
alter table plugin_config_interface_parameters convert to character set utf8 collate utf8_bin;
alter table menu_items convert to character set utf8 collate utf8_bin;
alter table plugin_package_resource_files convert to character set utf8 collate utf8_bin;
alter table resource_server convert to character set utf8 collate utf8_bin;
alter table resource_item convert to character set utf8 collate utf8_bin;
alter table plugin_instances convert to character set utf8 collate utf8_bin;
alter table plugin_mysql_instances convert to character set utf8 collate utf8_bin;
alter table role_menu convert to character set utf8 collate utf8_bin;
alter table batch_execution_jobs convert to character set utf8 collate utf8_bin;
alter table execution_jobs convert to character set utf8 collate utf8_bin;
alter table execution_job_parameters convert to character set utf8 collate utf8_bin;
alter table favorites convert to character set utf8 collate utf8_bin;
alter table favorites_role convert to character set utf8 collate utf8_bin;
alter table plugin_artifact_pull_req convert to character set utf8 collate utf8_bin;
alter table act_ru_procinst_status convert to character set utf8 collate utf8_bin;
alter table act_ru_srvnode_status convert to character set utf8 collate utf8_bin;
alter table core_operation_event convert to character set utf8 collate utf8_bin;
alter table core_re_proc_def_info convert to character set utf8 collate utf8_bin;
alter table core_re_task_node_def_info convert to character set utf8 collate utf8_bin;
alter table core_re_task_node_param convert to character set utf8 collate utf8_bin;
alter table core_ru_graph_node convert to character set utf8 collate utf8_bin;
alter table core_ru_proc_exec_binding convert to character set utf8 collate utf8_bin;
alter table core_ru_proc_exec_binding_tmp convert to character set utf8 collate utf8_bin;
alter table core_ru_proc_inst_info convert to character set utf8 collate utf8_bin;
alter table core_ru_proc_role_binding convert to character set utf8 collate utf8_bin;
alter table core_ru_task_node_exec_param convert to character set utf8 collate utf8_bin;
alter table core_ru_task_node_exec_req convert to character set utf8 collate utf8_bin;
alter table core_ru_task_node_inst_info convert to character set utf8 collate utf8_bin;
alter table plugin_config_roles convert to character set utf8 collate utf8_bin;
alter table core_object_meta convert to character set utf8 collate utf8_bin;
alter table core_object_property_meta convert to character set utf8 collate utf8_bin;
alter table core_object_var convert to character set utf8 collate utf8_bin;
alter table core_object_property_var convert to character set utf8 collate utf8_bin;
alter table core_object_list_var convert to character set utf8 collate utf8_bin;
CREATE TABLE IF NOT EXISTS `core_extra_task` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`task_seq_no` VARCHAR(60) COLLATE utf8_bin NOT NULL,
`task_type` VARCHAR(45) COLLATE utf8_bin NOT NULL,
`rev` int(11) NOT NULL,
`status` VARCHAR(45) COLLATE utf8_bin DEFAULT NULL,
`start_time` DATETIME DEFAULT NULL,
`end_time` DATETIME DEFAULT NULL,
`created_by` VARCHAR(45) COLLATE utf8_bin DEFAULT NULL,
`created_time` DATETIME DEFAULT NULL,
`updated_by` VARCHAR(45) COLLATE utf8_bin DEFAULT NULL,
`updated_time` DATETIME DEFAULT NULL,
`task_def` VARCHAR(2000) COLLATE utf8_bin DEFAULT NULL,
`priority` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ALTER TABLE core_ru_task_node_inst_info
ADD COLUMN bind_status VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL;
ALTER TABLE core_ru_task_node_exec_param
ADD INDEX idx_core_t_n_e_param_comp (req_id, param_type, param_name);
ALTER TABLE core_ru_task_node_exec_req
ADD INDEX idx_core_t_n_e_req_n_inst (node_inst_id);
ALTER TABLE act_ru_srvnode_status
ADD INDEX idx_act_snode_status_insti_n (proc_inst_id,node_id);
ALTER TABLE act_ru_srvnode_status
ADD INDEX idx_act_snode_status_instk_n (proc_inst_key,node_id);
ALTER TABLE act_ru_procinst_status
ADD INDEX idx_act_procinst_status_inst_id (proc_inst_id);
ALTER TABLE core_ru_task_node_inst_info
ADD INDEX idx_core_t_n_i_inst_node (proc_inst_id, node_id);
ALTER TABLE core_ru_proc_exec_binding
ADD INDEX idx_core_p_e_binding_p_bt_n (proc_inst_id, bind_type, task_node_inst_id);
ALTER TABLE core_ru_proc_exec_binding
ADD INDEX idx_core_p_e_binding_e_d_id (entity_data_id);
ALTER TABLE core_ru_proc_exec_binding_tmp
ADD INDEX idx_core_p_e_binding_tmp_p_s_id (proc_session_id);
ALTER TABLE core_ru_graph_node
ADD INDEX idx_core_g_node_p_s_id (proc_sess_id);
ALTER TABLE core_ru_graph_node
ADD INDEX idx_core_g_node_p_i_id (proc_inst_id);
ALTER TABLE core_ru_proc_inst_info
ADD INDEX idx_core_p_inst_p_kernel_id (proc_inst_kernel_id);
ALTER TABLE core_operation_event
ADD INDEX idx_core_o_event_p_i_key (proc_inst_key);
ALTER TABLE plugin_config_interfaces
ADD INDEX idx_core_plugin_c_intf_c_id (plugin_config_id);
ALTER TABLE plugin_config_interface_parameters
ADD INDEX idx_core_plugin_c_intf_param_intf_id (plugin_config_interface_id);
ALTER TABLE plugin_package_attributes
ADD INDEX idx_core_plugin_p_attr_e_id (entity_id);
SET FOREIGN_KEY_CHECKS = 1;
|
<reponame>abnerfilipe/AdministracaoOrganizacaoDeBancoDeDados
/*
Aluno: <NAME>
Disciplina: 20202:CIN20187:GO1301 - ADMINISTRAÇÃO E ORGANIZAÇÃO DE BANCO DE DADOS
*/
create database if not exists agencia_financiamento;
use agencia_financiamento;
create database if not exists dados_cadastrais;
use dados_cadastrais;
create table if not exists Pessoa(
id integer not null auto_increment primary key,
nome varchar(100) not null,
rg varchar(8),
data_nascimento date not null,
nacionalidade varchar(100),
sexo varchar(25),
telefone varchar(100),
estado_civil varchar(100)
);
create table if not exists Funcionario(
id integer not null auto_increment primary key,
matricula varchar(100) not null,
data_admissao date not null,
cic varchar(100) not null,
pessoa_id integer not null,
endereco_id integer not null,
constraint fk_funcionario_pessoa foreign key (pessoa_id) references Pessoa(id),
constraint fk_funcionario_endereco foreign key (endereco_id) references Endereco(id)
);
create table if not exists Dependente(
id integer not null auto_increment primary key,
pessoa_id integer not null,
funcionario_id integer not null,
constraint fk_dependente_pessoa foreign key (pessoa_id) references Pessoa(id),
constraint fk_dependente_funcionario foreign key (funcionario_id) references Funcionario(id)
);
create table if not exists Endereco(
id integer not null auto_increment primary key,
logradouro varchar(255) not null,
cep varchar(10) not null,
complemento varchar(255) not null
);
-- tables
create table if not exists AreaPesquisa(
id integer not null auto_increment primary key,
codigo integer not null,
nome varchar(200) not null,
descricao text,
relevancia integer not null
);
create table if not exists Usuario(
id integer not null auto_increment primary key,
nome varchar(100) not null,
rg varchar(8) not null,
cpf varchar(14) not null,
data_nascimento date not null,
grau_cientifico varchar(200) not null,
instuicao varchar(200) not null
);
create table if not exists Pesquisador(
id integer not null auto_increment primary key,
usuario_id integer not null,
constraint fk_usuario_pesquisador foreign key (usuario_id) references Usuario(id)
);
create table if not exists Avaliador(
id integer not null auto_increment primary key,
area_de_pesquisa integer not null,
usuario_id integer not null,
constraint fk_usuario_avaliador foreign key (usuario_id) references Usuario(id)
);
create table if not exists Projeto(
id integer not null auto_increment primary key,
codigo integer not null,
titulo varchar(100) not null,
duracao date not null,
instituicao varchar(200),
pesquisador_id integer not null,
area_pesquisa_id integer not null,
constraint fk_pesquisar_projeto foreign key(pesquisador_id) references Pesquisador(id),
constraint fk_area_pesquisa_projeto foreign key(area_pesquisa_id) references AreaPesquisa(id)
);
create table if not exists Analise(
id integer not null auto_increment primary key,
data_cadastro date not null,
data_avaliacao date not null,
data_resultado date not null,
status varchar(100) not null,
resultado varchar(100) not null,
projeto_id integer not null,
constraint fk_projeto_analise foreign key(projeto_id) references Projeto(id)
);
-- pivots
create table if not exists AvaliadorAreaPesquisa(
avaliador_id integer not null,
area_pesquisa_id integer not null,
constraint fk_avaliador_area_pesquisa foreign key (avaliador_id) references Avaliador(id),
constraint fk_area_pesquisa_avaliador foreign key (area_pesquisa_id) references AreaPesquisa(id),
constraint composta_id primary key(avaliador_id, area_pesquisa_id)
);
create table if not exists AvaliadorAnalise(
avaliador_id integer not null,
analise_id integer not null,
constraint fk_avaliador_analise foreign key (avaliador_id) references Avaliador(id),
constraint fk_analise_avaliador foreign key (analise_id) references Analise(id),
constraint composta_id primary key(avaliador_id, analise_id)
);
-- inner joins
SELECT *
FROM Usuario
INNER JOIN Avaliador
ON Usuario.id = Avaliador.usuario_id;
SELECT Usuario.nome, Usuario.grau_cientifico
FROM Usuario
INNER JOIN Pesquisador
ON Usuario.id = Pesquisador.usuario_id;
-- views
-- CREATE VIEW [nomedaview]
-- AS SELECT [colunas]
-- from [tabela]
-- where [condicoes];
CREATE VIEW vw_AnaliseProjeto
AS SELECT p.titulo, p.instituicao, a.status FROM agencia_financiamento.Analise AS a
INNER JOIN agencia_financiamento.Projeto AS p
ON a.projeto_id = p.id;
SELECT * FROM vw_AnaliseProjeto;
-- ALTER VIEW vw_AnaliseProjeto;
-- triggers
-- create table if not exists Log_Analise(
-- id integer not null auto_increment primary key,
-- data_cadastro date not null,
-- data_cadastro_old date not null,
-- data_avaliacao date not null,
-- data_avaliacao_old date not null,
-- data_resultado date not null,
-- data_resultado_old date not null,
-- status varchar(100) not null,
-- status_old varchar(100) not null,
-- resultado varchar(100) not null,
-- resultado_old varchar(100) not null,
-- projeto_id integer not null,
-- constraint fk_projeto_analise foreign key(projeto_id) references Projeto(id)
-- );
-- create table logAutor(
-- idlog int(11) not null auto_increment primary key,
-- nomeOld varchar(100),
-- nome varchar(100) ,
-- pseudonimoOld varchar(100),
-- pseudonimo varchar(100),
-- anoOld date ,
-- ano date ,
-- paisOrigemOld varchar(100),
-- paisOrigem varchar(100),
-- notaBibliograficaOld text,
-- notaBibliografica text,
-- dataModificacao timestamp
-- );
DELIMITER $$
create trigger valida_status_analise
before insert on projeto
for each row
begin
declare msg varchar(128);
if(new.codigo <= 0) then
set msg = concat('TriggerError: não é permitido inserir codigo menor ou igual a zero: ',
cast(new.codigo as char));
signal sqlstate '95000' set message_text = msg;
end if;
end;
$$
SELECT * FROM agencia_financiamento.Projeto;
-- inserts
INSERT INTO `AreaPesquisa` VALUES
('1','3','fuchsia','Non reprehenderit nemo porro recusandae. Necessitatibus aut eius nulla nisi voluptatem. Rerum nemo reprehenderit quia. Et similique temporibus qui nesciunt qui assumenda omnis.','5'),
('2','1','purple','Porro rerum tempore explicabo quidem debitis incidunt ratione. Officiis nihil eum eius occaecati ipsa hic rerum. Eos sequi fuga rerum sunt odit accusamus sit.','3'),
('3','8','black','Aperiam omnis reiciendis ex eaque aliquid facilis quos voluptatibus. Ea nam occaecati ut ut sunt provident commodi. Accusantium porro labore odit.','8'),
('4','6','gray','Facilis necessitatibus corrupti molestiae dolorum nostrum eligendi. Dolor atque blanditiis et. Quos rerum totam blanditiis praesentium illo qui alias. Enim nihil autem labore maxime a soluta modi.','1'),
('5','1','gray','Eius non nostrum vel consequuntur. Delectus aperiam animi laborum aut vitae saepe odit. Iusto odit molestiae praesentium commodi.','0'),
('6','3','navy','Voluptates animi sit et placeat quod alias magni. Accusantium dolores mollitia libero est nihil consequuntur. Porro earum aut adipisci saepe. Soluta veritatis aliquid et quibusdam debitis.','10'),
('7','3','silver','Et iste dolores alias aliquam aut. Temporibus esse est consequatur ea officia. Vel totam voluptates iusto aut eaque tempora.','5'),
('8','6','yellow','Possimus aut laboriosam aut. Minima qui non iure perspiciatis. Harum ab fugit est sit provident odit quidem. Natus optio voluptas nemo et.','8'),
('9','1','white','Mollitia quam velit repellat excepturi. Praesentium vero provident vel molestiae sunt non nihil. Ipsa provident error voluptatem eaque nihil ut.','7'),
('10','9','aqua','Dicta vitae recusandae quaerat et eius ipsum in. Harum nostrum quasi dolorum esse pariatur.','6');
INSERT INTO `Usuario` VALUES
('1','Naomi','287962','27884148992','2015-06-24','Pos-Doutorado','Odit ut sit aut laboriosam aut soluta et.'),
('2','Garry','103887','91301656514','2015-12-21','Pos-Graduado','Laboriosam quia nemo tenetur sed.'),
('3','Terrence','858678','16078218398','2018-07-13','Doutorado','Quasi et dolorem sed molestiae.'),
('4','Laury','447029','71597468946','2001-07-12','Doutorado','Numquam fuga aut eum omnis eaque.'),
('5','Jaylan','895578','88945418596','2003-06-30','Doutorado','Sunt cumque accusamus beatae et cumque quod sunt.'),
('6','Susie','765263','87180820340','1978-02-17','Doutorado','Velit tenetur eos reiciendis cupiditate aut quia fugiat qui.'),
('7','Merlin','643370','83477553399','1999-11-28','Pos-Graduado','Qui placeat natus ut consequuntur.'),
('8','Kailey','409744','22094156965','1980-03-22','Pos-Graduado','Eius esse ea quis et inventore necessitatibus ut vitae.'),
('9','Hilbert','336772','16489621391','2018-12-03','Pos-Graduado','Autem et voluptas rerum voluptas.'),
('10','Louvenia','423236','14177996106','1977-07-20','Doutorado','Quam ea sed commodi officiis illum consequatur quas.');
INSERT INTO `Pesquisador` VALUES
('1','1'),
('2','2'),
('3','3'),
('4','4'),
('5','5');
INSERT INTO `Avaliador` VALUES
('1','10','6'),
('2','8','7'),
('3','9','8'),
('4','6','9'),
('5','8','10');
INSERT INTO `Projeto` VALUES
('1','1','titulo 1','2020-10-09','Lorem Ipsum is therefore al','1','1'),
('2','2','titulo 2','2020-10-09','simply random text','1','2'),
('3','3','titulo 3','2020-10-09','Lorem Ipsum is therefore al','2','3'),
('4','4','titulo 4','2020-10-09','Lorem Ipsum is therefore al','3','4'),
('5','5','titulo 5','2020-10-09','psum dolor sit amet.','4','5'),
('6','6','titulo 6','2020-10-09','Lorem Ipsum is therefore al','5','6'),
('7','7','titulo 7','2020-10-09','Lorem Ipsum is therefore al','5','7'),
('8','8','titulo 8','2020-10-09','Lorem Ipsum is therefore al','4','8'),
('9','9','titulo 9','2020-10-09','Lorem Ipsum is therefore al','3','9'),
('10','10','titulo 10','2020-10-09','reproduced in their exact original','2','10');
INSERT INTO `Analise` VALUES
('1','1977-07-20','1977-07-20','1977-07-20','concluido','deferido','1'),
('2','1977-07-20','1977-07-20','1977-07-20','em analise','deferido','2'),
('3','1977-07-20','1977-07-20','1977-07-20','aguardando analise','indeferido','3'),
('4','1977-07-20','1977-07-20','1977-07-20','em analise','deferido','4'),
('5','1977-07-20','1977-07-20','1977-07-20','concluido','deferido','5'),
('6','1977-07-20','1977-07-20','1977-07-20','concluido','indeferido','6'),
('7','1977-07-20','1977-07-20','1977-07-20','concluido','deferido','7'),
('8','1977-07-20','1977-07-20','1977-07-20','aguardando analise','deferido','8'),
('9','1977-07-20','1977-07-20','1977-07-20','em analise','indeferido','9'),
('10','1977-07-20','1977-07-20','1977-07-20','aguardando analise','indeferido','10');
INSERT INTO `AvaliadorAnalise` VALUES
('1','5'),
('2','6'),
('3','7'),
('4','8'),
('5','9');
INSERT INTO `AvaliadorAreaPesquisa` VALUES
('1','1'),
('2','2'),
('3','3'),
('4','4'),
('5','5');
|
<filename>paprika-db/mysql/alter/1.0.3/paprika/ddl/trg/pipelines_bu.sql
delimiter |
CREATE TRIGGER pipelines_bu
BEFORE UPDATE ON pipelines
FOR EACH ROW BEGIN
SET NEW.updated_at=NOW();
SET NEW.updated_by=CURRENT_USER();
END;
|
delimiter ;
|
<gh_stars>0
begin;
select 'sql 1', * from t_currency where id = 1 for update;
select 'sql 1: sleep 5 seconds ...';
select 'sql1', pg_sleep(5);
select 'sql 1: commit';
commit;
|
CREATE DATABASE EDUCANDOSA
GO
USE EDUCANDOSA
GO
CREATE TABLE USUARIOS(
ID INT IDENTITY PRIMARY KEY NOT NULL,
NOMBRE VARCHAR(60) NOT NULL,
ROL VARCHAR(20) NULL,
CEDULA CHAR(10) NOT NULL
)
GO
CREATE TABLE SOLICITUDES(
ID INT IDENTITY PRIMARY KEY NOT NULL,
IDRESPONSBLE INT NOT NULL,
FECHA DATETIME DEFAULT GETDATE() NOT NULL,
CENTRO_COSTOS VARCHAR(30) NOT NULL,
RUBRO_PRESUPUESTAL VARCHAR(30) NOT NULL
)
GO
CREATE TABLE ITEMS(
ID INT IDENTITY PRIMARY KEY NOT NULL,
NOMBREBIEN VARCHAR(60) NOT NULL,
CANTIDAD FLOAT NOT NULL,
VALOR_UNIDAD FLOAT NOT NULL,
VALORTOTAL FLOAT NOT NULL,
UNIDAD_MEDIDA VARCHAR(30) NOT NULL,
IDSOLICITUD INT NOT NULL,
IDFACTURA INT NOT NULL
)
GO
CREATE TABLE ORDER_CONTRACTUAL(
ID INT IDENTITY PRIMARY KEY NOT NULL,
NOM_PROVEEDOR VARCHAR(60) NOT NULL,
FECHA_ORDEN DATETIME DEFAULT GETDATE() NOT NULL,
MONTO_TOTAL FLOAT NOT NULL,
FECHA_ENTREGA DATETIME NOT NULL,
RUC VARCHAR(30) NOT NULL
)
GO
CREATE TABLE INVENTARIO(
ID INT IDENTITY PRIMARY KEY NOT NULL,
IDRESPOSABLE INT NOT NULL,
FECHAENTREGA DATETIME NOT NULL,
DIRECCION VARCHAR(100) NOT NULL,
IDCOMPRA INT NOT NULL
)
GO
CREATE TABLE SALIDA_ALMACEN(
ID INT IDENTITY PRIMARY KEY NOT NULL,
EMPLEADO VARCHAR(60) NOT NULL,
FECHASALIDA DATETIME NOT NULL,
FECHAENTREGA DATETIME NOT NULL,
IDFACTURA INT NOT NULL
)
GO
CREATE TABLE COMPRA(
ID INT IDENTITY PRIMARY KEY NOT NULL,
IDSOLICITUD INT NOT NULL,
IDORDENCONTRACTUAL INT NOT NULL,
IDINVENTARIO INT NOT NULL
)
GO
CREATE TABLE FACTURA(
ID INT IDENTITY PRIMARY KEY NOT NULL,
IDITEM INT NOT NULL,
IDORDENCONTRACTUAL INT NOT NULL,
TOTAL_BIENES INT NOT NULL,
FECHA DATETIME NOT NULL,
PROVEEDOR VARCHAR(60) NOT NULL,
VALORTOTAL FLOAT NOT NULL
)
GO
ALTER TABLE FACTURA ADD FOREIGN KEY (IDITEM) REFERENCES ITEMS
ALTER TABLE FACTURA ADD FOREIGN KEY (IDORDENCONTRACTUAL) REFERENCES ORDER_CONTRACTUAL
ALTER TABLE SALIDA_ALMACEN ADD FOREIGN KEY (IDFACTURA) REFERENCES FACTURA
ALTER TABLE COMPRA ADD FOREIGN KEY (IDINVENTARIO) REFERENCES INVENTARIO
ALTER TABLE COMPRA ADD FOREIGN KEY (IDORDENCONTRACTUAL) REFERENCES ORDER_CONTRACTUAL
ALTER TABLE COMPRA ADD FOREIGN KEY (IDSOLICITUD) REFERENCES SOLICITUDES
ALTER TABLE SOLICITUDES ADD FOREIGN KEY (IDRESPONSBLE) REFERENCES USUARIOS
ALTER TABLE ITEMS ADD FOREIGN KEY (IDSOLICITUD) REFERENCES SOLICITUDES
go
/* USUARIOS*/
SELECT * FROM USUARIOS
GO
INSERT INTO USUARIOS VALUES ('<NAME>, <NAME>','Administrador','72450897')
INSERT INTO USUARIOS VALUES ('<NAME>','Administrador','75698236')
INSERT INTO USUARIOS VALUES ('<NAME>, <NAME> ','Administrador','74589632')
INSERT INTO USUARIOS VALUES ('<NAME>, <NAME>','Administrador','79863254')
INSERT INTO USUARIOS VALUES ('<NAME>, <NAME>','Administrador','72460589')
GO
--PROCEDURES--
CREATE PROC PROC_INSERT_USERS(
@NOMBRE VARCHAR(60) ,
@ROL VARCHAR(20) ,
@CEDULA CHAR(10))
AS
INSERT INTO USUARIOS(NOMBRE,ROL,CEDULA) VALUES (@NOMBRE,@ROL,@CEDULA)
GO
EXEC PROC_INSERT_USERS 'Ana','ADMIN','72450897'
GO
CREATE PROC COUNT_USERS
AS
SELECT COUNT(*) as NUMERO FROM USUARIOS
GO
CREATE PROC LIST_USERS
AS
SELECT * FROM USUARIOS
GO
EXEC LIST_USERS
GO
/*SOLICITUDES*/
select * from SOLICITUDES
INSERT INTO SOLICITUDES VALUES (3,GETDATE()-579,'Planeamiento','Operacionales')
INSERT INTO SOLICITUDES VALUES (2,GETDATE()-598,'Ventas','Capital')
INSERT INTO SOLICITUDES VALUES (2,GETDATE()-432,'Ventas','Capital')
INSERT INTO SOLICITUDES VALUES (2,GETDATE()-932,'Ventas','Capital')
INSERT INTO SOLICITUDES VALUES (2,GETDATE()-502,'Gerencia de RRHH','Operacionales')
INSERT INTO SOLICITUDES VALUES (1,GETDATE()-1156,'Planeamiento','Operacionales')
INSERT INTO SOLICITUDES VALUES (3,GETDATE()-540,'Marketing','Capital')
INSERT INTO SOLICITUDES VALUES (3,GETDATE()-1725,'Direcci�n General','Operacionales')
INSERT INTO SOLICITUDES VALUES (2,GETDATE()-1267,'Direcci�n General','Operacionales')
INSERT INTO SOLICITUDES VALUES (4,GETDATE()-1873,'Operaciones','Trasnferencias')
INSERT INTO SOLICITUDES VALUES (3,GETDATE()-1834,'Direcci�n General','Operacionales')
INSERT INTO SOLICITUDES VALUES (5,GETDATE()-1258,'Marketing','Capital')
INSERT INTO SOLICITUDES VALUES (5,GETDATE()-1713,'Operaciones','Trasnferencias')
INSERT INTO SOLICITUDES VALUES (1,GETDATE()-1235,'Gerencia de RRHH','Operacionales')
INSERT INTO SOLICITUDES VALUES (4,GETDATE()-1734,'Marketing','Capital')
INSERT INTO SOLICITUDES VALUES (1,GETDATE()-1985,'Planeamiento','Operacionales')
INSERT INTO SOLICITUDES VALUES (5,GETDATE()-570,'Marketing','Capital')
INSERT INTO SOLICITUDES VALUES (3,GETDATE()-1929,'Gerencia de RRHH','Operacionales')
INSERT INTO SOLICITUDES VALUES (4,GETDATE()-539,'Gerencia de RRHH','Operacionales')
INSERT INTO SOLICITUDES VALUES (5,GETDATE()-1097,'Marketing','Capital')
INSERT INTO SOLICITUDES VALUES (5,GETDATE()-1651,'Ventas','Capital')
INSERT INTO SOLICITUDES VALUES (2,GETDATE()-632,'Planeamiento','Operacionales')
INSERT INTO SOLICITUDES VALUES (1,GETDATE()-871,'Marketing','Capital')
INSERT INTO SOLICITUDES VALUES (1,GETDATE()-1774,'Gerencia de RRHH','Operacionales')
INSERT INTO SOLICITUDES VALUES (4,GETDATE()-810,'Ventas','Capital')
INSERT INTO SOLICITUDES VALUES (4,GETDATE()-970,'Planeamiento','Operacionales')
INSERT INTO SOLICITUDES VALUES (3,GETDATE()-1156,'Operaciones','Trasnferencias')
GO
ALTER TABLE SOLICITUDES ADD COL_STATUS BIT NULL;
GO
UPDATE SOLICITUDES SET COL_STATUS=1 WHERE ID=2
GO
--PROC SOLICITUDES--
CREATE PROC COUNT_SOLICITUDES
AS
SELECT COUNT(*) AS NUMERO FROM SOLICITUDES
GO
/*INVENTARIO*/
INSERT INTO SALIDA_ALMACEN VALUES (1,GETDATE(),GETDATE(),2)
INSERT INTO SALIDA_ALMACEN VALUES (2,GETDATE(),GETDATE(),2)
INSERT INTO SALIDA_ALMACEN VALUES (1,GETDATE(),GETDATE(),3)
INSERT INTO SALIDA_ALMACEN VALUES (1,GETDATE(),GETDATE(),4)
GO
--PROC INVENTARIO--
CREATE PROC COUNT_INVENTARIO
AS
SELECT COUNT(*) AS NUMERO FROM SOLICITUDES
GO
select COUNT(CENTRO_COSTOS)/COUNT(*) as RESULTADO
from SOLICITUDES where IDRESPONSBLE = 3
exec COUNT_INVENTARIO
GO
/**/
SELECT * FROM SOLICITUDES
SELECT S.CENTRO_COSTOS, COUNT(S.CENTRO_COSTOS) AS NUMERO FROM SOLICITUDES AS S GROUP BY CENTRO_COSTOS
GO
/*FACTURAS*/
--PROC FACTURAS--
CREATE PROC COUNT_FACT
AS
SELECT COUNT(*) AS NUMERO FROM FACTURA
GO
/*ITEMS*/
SELECT * FROM ITEMS
INSERT INTO ITEMS VALUES ('Computadoras',15,1400.5,21007.5,'Unidades',1,1)
INSERT INTO ITEMS VALUES ('Mouse',15,30,450,'Unidades',3,3)
INSERT INTO ITEMS VALUES ('Teclado',15,25,375,'Unidades',5,2)
INSERT INTO ITEMS VALUES ('Escritorios',5,150,750,'Unidades',27,2)
INSERT INTO ITEMS VALUES ('Tel�fonos',2,600,1200,'Unidades',20,4)
INSERT INTO ITEMS VALUES ('Sillas',15,300,4500,'Unidades',5,3)
INSERT INTO ITEMS VALUES ('Impresoras',2,200,400,'Unidades',6,1)
INSERT INTO ITEMS VALUES ('Archivadores',25,1,25,'Unidades',18,1)
INSERT INTO ITEMS VALUES ('Plumones',30,5,150,'Unidades',15,2)
INSERT INTO ITEMS VALUES ('Hojas A4',1000,40,40000,'Paquetes',8,4)
INSERT INTO ITEMS VALUES ('Clips',1000,1,1000,'Unidades',6,3)
INSERT INTO ITEMS VALUES ('Perforadores',2,25,50,'Unidades',5,3)
INSERT INTO ITEMS VALUES ('Dispensadores',1,150,150,'Unidades',15,2)
INSERT INTO ITEMS VALUES ('Folders',300,2,600,'Unidades',8,2)
GO
--PROC ITEMS--
/*FACTURAS*/
SELECT * FROM FACTURA
--PROC FACTURAS--
GO
/*salida almacen*/
select * from SALIDA_ALMACEN
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-740,GETDATE()+745,1)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-961,GETDATE()+966,2)
INSERT INTO SALIDA_ALMACEN VALUES('Escobar Zavaleta, Gruber Omar ',GETDATE()-671,GETDATE()+676,1)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-198,GETDATE()+203,1)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-653,GETDATE()+658,2)
INSERT INTO SALIDA_ALMACEN VALUES('Escobar Zavaleta, Gruber Omar ',GETDATE()-634,GETDATE()+639,1)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>',GETDATE()-661,GETDATE()+666,2)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-256,GETDATE()+261,3)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-373,GETDATE()+378,1)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-869,GETDATE()+874,2)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-166,GETDATE()+171,3)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>',GETDATE()-124,GETDATE()+129,5)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-440,GETDATE()+445,3)
INSERT INTO SALIDA_ALMACEN VALUES('Escobar Zavaleta, <NAME> ',GETDATE()-234,GETDATE()+239,6)
INSERT INTO SALIDA_ALMACEN VALUES('Escobar Zavaleta, <NAME> ',GETDATE()-688,GETDATE()+693,6)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-117,GETDATE()+122,7)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-913,GETDATE()+918,7)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>',GETDATE()-751,GETDATE()+756,5)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-753,GETDATE()+758,5)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME> ',GETDATE()-478,GETDATE()+483,6)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME> ',GETDATE()-135,GETDATE()+140,7)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-212,GETDATE()+217,10)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-511,GETDATE()+516,8)
INSERT INTO SALIDA_ALMACEN VALUES('<NAME>, <NAME>',GETDATE()-774,GETDATE()+779,8)
GO
select * from ORDER_CONTRACTUAL
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 1',GETDATE()-262,84099,GETDATE()+267,'32385965')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 2',GETDATE()-844,98916,GETDATE()+849,'22224545456')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 3',GETDATE()-540,68555,GETDATE()+545,'54654654545')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 4',GETDATE()-445,43132,GETDATE()+450,'2455454')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 5',GETDATE()-462,39832,GETDATE()+467,'65656556656')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 6',GETDATE()-162,5623,GETDATE()+167,'21313132323')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 7',GETDATE()-251,13351,GETDATE()+256,'1213213132')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 8',GETDATE()-901,7383,GETDATE()+906,'132132323')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 9',GETDATE()-413,18417,GETDATE()+418,'549565656')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 10',GETDATE()-406,56303,GETDATE()+411,'2165341345')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 11',GETDATE()-687,35060,GETDATE()+692,'24165459686')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 12',GETDATE()-505,92099,GETDATE()+510,'12698963')
INSERT INTO ORDER_CONTRACTUAL VALUES ('Provedor 13',GETDATE()-468,99422,GETDATE()+473,'4165456456')
GO
SELECT * FROM INVENTARIO
INSERT INTO INVENTARIO VALUES (1,GETDATE()+116,'',1)
INSERT INTO INVENTARIO VALUES (3,GETDATE()+186,'',2)
INSERT INTO INVENTARIO VALUES (2,GETDATE()+135,'',1)
INSERT INTO INVENTARIO VALUES (5,GETDATE()+183,'',2)
INSERT INTO INVENTARIO VALUES (4,GETDATE()+119,'',3)
INSERT INTO INVENTARIO VALUES (3,GETDATE()+138,'',4)
INSERT INTO INVENTARIO VALUES (2,GETDATE()+199,'',5)
INSERT INTO INVENTARIO VALUES (2,GETDATE()+119,'',4)
INSERT INTO INVENTARIO VALUES (1,GETDATE()+118,'',4)
INSERT INTO INVENTARIO VALUES (2,GETDATE()+188,'',4)
INSERT INTO INVENTARIO VALUES (3,GETDATE()+199,'',1)
INSERT INTO INVENTARIO VALUES (2,GETDATE()+195,'',2)
INSERT INTO INVENTARIO VALUES (4,GETDATE()+175,'',2)
INSERT INTO INVENTARIO VALUES (4,GETDATE()+168,'',3)
select * from COMPRA
SELECT * FROM ORDER_CONTRACTUAL
SELECT * FROM INVENTARIO
INSERT INTO COMPRA VALUES (2,3,16);
INSERT INTO COMPRA VALUES (5,1,17);
INSERT INTO COMPRA VALUES (3,5,29);
INSERT INTO COMPRA VALUES (4,4,22);
INSERT INTO COMPRA VALUES (7,2,23);
INSERT INTO COMPRA VALUES (9,9,20);
GO
SELECT * FROM FACTURA
INSERT INTO FACTURA VALUES(1,1,20,GETDATE(),'Proveddor 2',2000)
INSERT INTO FACTURA VALUES(2,2,21,GETDATE(),'Proveddor 1',2500)
INSERT INTO FACTURA VALUES(3,3,22,GETDATE(),'Proveddor 3',3000)
INSERT INTO FACTURA VALUES(4,4,16,GETDATE(),'Proveddor 4',400)
INSERT INTO FACTURA VALUES(5,5,17,GETDATE(),'Proveddor 5',4500)
GO
CREATE VIEW PROVEDOR_DETALLE
AS
SELECT O.NOM_PROVEEDOR,O.MONTO_TOTAL,O.FECHA_ORDEN,O.RUC FROM INVENTARIO AS I FULL JOIN COMPRA AS C
ON C.ID=I.IDCOMPRA FULL JOIN ORDER_CONTRACTUAL AS O ON O.ID=I.IDCOMPRA
GO
CREATE PROC DETALLE_VIEW
AS
SELECT * FROM PROVEDOR_DETALLE
GO
EXEC DETALLE_VIEW
CREATE NONCLUSTERED INDEX FACTURA_ORDEN
ON FACTURA (VALORTOTAL ASC )
GO
CREATE PROC MONTO_DEC
AS
SELECT VALORTOTAL FROM FACTURA
GO
EXEC MONTO_DEC
CREATE INDEX IDX_CUSTOMER_LAST_NAME
ON SOLICITUDES (CENTRO_COSTOS);
GO
SELECT * FROM SOLICITUDES
CREATE INDEX IDX_USER_NAME
ON USUARIOS (NOMBRE);
GO
SELECT * FROM USUARIOS
CREATE INDEX IDX_USUARIO
ON SOLICITUDES (CENTRO_COSTOS);
GO
SELECT * FROM ITEMS
GO
CREATE PROC DETALLE_FACTURA
AS
SELECT I.NOMBREBIEN,I.CANTIDAD,I.VALORTOTAL,F.FECHA FROM FACTURA AS F INNER JOIN ITEMS AS I ON I.ID=F.IDITEM
GO
EXEC DETALLE_FACTURA
/**/
Create table historial
(fecha date,
descripcion varchar(100),
usuario varchar(20))
GO
CREATE trigger TR_AuditoriaP_Eliminar
ON SOLICITUDES
FOR DELETE
AS
BEGIN
INSERT historial SELECT getdate(),'registro Eliminado',SYSTEM_USER from deleted
END;
GO
CREATE PROC LISTA_AUD
AS
SELECT * FROM historial
GO
EXEC LISTA_AUD
GO
--LA IMPLEMENTACION DEL CURSOR SIRVE PARA RETORNAR UNA SELECION DE DATOS ESPECIFICOS CON DECLARACIÓN DE VARIABLES
CREATE PROCEDURE MICURSORNEW AS
BEGIN
DECLARE @codigo int,
@fecha datetime,
@direc varchar(100)
DECLARE cursor_1 CURSOR
for select IDRESPOSABLE,FECHAENTREGA,DIRECCION from INVENTARIO
OPEN cursor_1
fetch cursor_1 INTO @codigo,@fecha,@direc
WHILE (@@FETCH_STATUS=0)
BEGIN
PRINT cast(@codigo as varchar(20))+''+cast(@fecha as varchar(50))+''+cast(@direc as varchar(20))
FETCH cursor_1 INTO @codigo,@fecha,@direc
END
CLOSE cursor_1
DEALLOCATE cursor_1
END
EXEC MICURSORNEW |
<gh_stars>0
col spare4 format a40 head 'VALUE'
select sname,spare4
from sys.optstat_hist_control$
order by 1
/
|
drop table pages;
drop table apps; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.