text
stringlengths
6
9.38M
CREATE DATABASE IF NOT EXISTS `todo_app` CHARACTER SET utf8mb4 COLLATE utf8mb4 \ _unicode \ _ci; USE `todo_app`; CREATE TABLE IF NOT EXISTS `test` ( `id` int PRIMARY KEY AUTO \ _INCREMENT, `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4 \ _thai \ _520 \ _w2, `owner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4 \ _thai \ _520 \ _w2, `created_at` TIMESTAMP DEFAULT CURRENT \ _TIMESTAMP, `updated_at` TIMESTAMP ON UPDATE CURRENT \ _TIMESTAMP, INDEX (name) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4 \ _unicode \ _ci;
/* UTL_FILE PACKAGE Security Model ---------------- The set of files and directories that are accessible to the user through UTL_FILE is controlled by a number of factors and database parameters. Foremost of these is the set of directory objects that have been granted to the user. Assuming the user has both READ and WRITE access to the directory object USER_DIR, the user can open a file located in the operating system directory described by USER_DIR, but not in subdirectories or parent directories of this directory. Lastly, the client (text I/O) and server implementations are subject to operating system file permission checking. UTL_FILE provides file access both on the "client side" and on the "server side". When run on the "server", UTL_FILE provides access to all operating system files that are accessible from the server. On the "client side", as in the case for Forms applications, UTL_FILE provides access to operating system files that are accessible from the client. In the past, accessible directories for the UTL_FILE functions were specified in the initialization file using the UTL_FILE_DIR parameter. However, UTL_FILE_DIR access is no longer recommended. Oracle recommends that you instead use the directory object feature, which replaces UTL_FILE_DIR. Directory objects offer more flexibility and granular control to the UTL_FILE application administrator, can be maintained dynamically (that is, without shutting down the database), and are consistent with other Oracle tools. CREATE ANY DIRECTORY privilege is granted only to SYS and SYSTEM by default. Usage of UTL_FILE_DIR: alter system set utl_file_dir='/appl/mydir, /appl/mydir2, /appl/mydir3' scope = spfile; bu the way, use the CREATE DIRECTORY feature instead of UTL_FILE_DIR for directory access verification. ================================================================================ FCLOSE Procedure Closes a file FCLOSE_ALL Procedure This procedure closes all open file handles for the session. This should be used as an emergency cleanup procedure, for example, when a PL/SQL program exits on an exception. FCOPY Procedure Copies a contiguous portion of a file to a newly created file UTL_FILE.FCOPY ( src_location IN VARCHAR2, src_filename IN VARCHAR2, dest_location IN VARCHAR2, dest_filename IN VARCHAR2, start_line IN BINARY_INTEGER DEFAULT 1, end_line IN BINARY_INTEGER DEFAULT NULL); -- Line number at which to stop copying. The default is NULL, signifying end of file FFLUSH Procedure Physically writes all pending output to a file FGETATTR Procedure Reads and returns the attributes of a disk file UTL_FILE.FGETATTR( location IN VARCHAR2, filename IN VARCHAR2, fexists OUT BOOLEAN, file_length OUT NUMBER, block_size OUT BINARY_INTEGER); FGETPOS Function Returns the current relative offset position within a file, in bytes UTL_FILE.FGETPOS ( file IN FILE_TYPE) RETURN PLS_INTEGER; FOPEN Function This function opens a file. You can specify the maximum line size and have a maximum of 50 files open simultaneously UTL_FILE.FOPEN ( location IN VARCHAR2, filename IN VARCHAR2, open_mode IN VARCHAR2, max_linesize IN BINARY_INTEGER DEFAULT 1024) RETURN FILE_TYPE; open_mode: r -- read text w -- write text a -- append text rb -- read byte mode wb -- write byte mode ab -- append byte mode FOPEN_NCHAR Function Opens a file in Unicode for input or output. You can specify the maximum line size and have a maximum of 50 files open simultaneously UTL_FILE.FOPEN_NCHAR ( location IN VARCHAR2, filename IN VARCHAR2, open_mode IN VARCHAR2, max_linesize IN BINARY_INTEGER DEFAULT 1024) RETURN FILE_TYPE; open_mode: r -- read text w -- write text a -- append text rb -- read byte mode wb -- write byte mode ab -- append byte mode FREMOVE Procedure Deletes a disk file, assuming that you have sufficient privileges FRENAME Procedure Renames an existing file to a new name, similar to the UNIX mv function FSEEK Procedure This procedure adjusts the file pointer forward or backward within the file by the number of bytes specified. UTL_FILE.FSEEK ( file IN OUT UTL_FILE.FILE_TYPE, absolute_offset IN PL_INTEGER DEFAULT NULL, relative_offset IN PLS_INTEGER DEFAULT NULL); file: File handle absolute_offset: Absolute location to which to seek; default = NULL relative_offset: Number of bytes to seek forward or backward; positive = forward, negative integer = backward, zero = current position, default = NULL GET_LINE Procedure This procedure reads text from the open file identified by the file handle and places the text in the output buffer parameter. Text is read up to, but not including, the line terminator, or up to the end of the file, or up to the end of the len parameter. It cannot exceed the max_linesize specified in FOPEN. UTL_FILE.GET_LINE ( file IN FILE_TYPE, buffer OUT VARCHAR2, len IN PLS_INTEGER DEFAULT NULL); -- It cannot exceed the max_linesize specified in FOPEN. GET_LINE_NCHAR Procedure Reads text in Unicode from an open file If the file is opened by FOPEN instead of FOPEN_NCHAR, a CHARSETMISMATCH exception is raised. GET_RAW Procedure Reads a RAW string value from a file and adjusts the file pointer ahead by the number of bytes read IS_OPEN Function Determines if a file handle refers to an open file NEW_LINE Procedure Writes one or more operating system-specific line terminators to a file PUT Procedure PUT writes the text string stored in the buffer parameter to the open file identified by the file handle. The file must be open for write operations. No line terminator is appended by PUT; use NEW_LINE to terminate the line or use PUT_LINE to write a complete line with a line terminator. See also "PUT_NCHAR Procedure". UTL_FILE.PUT ( file IN FILE_TYPE, buffer IN VARCHAR2); PUT_LINE Procedure This procedure writes the text string stored in the buffer parameter to the open file identified by the file handle. The file must be open for write operations. PUT_LINE terminates the line with the platform-specific line terminator character or characters. UTL_FILE.PUT_LINE ( file IN FILE_TYPE, buffer IN VARCHAR2, autoflush IN BOOLEAN DEFAULT FALSE); PUT_LINE_NCHAR Procedure Writes a Unicode line to a file PUT_NCHAR Procedure Writes a Unicode string to a file PUTF Procedure This procedure is a formatted PUT procedure. It works like a limited printf(). UTL_FILE.PUTF ( file IN FILE_TYPE, format IN VARCHAR2, [arg1 IN VARCHAR2 DEFAULT NULL, . . . arg5 IN VARCHAR2 DEFAULT NULL]); file: Active file handle returned by an FOPEN call format: Format string that can contain text as well as the formatting characters \n and %s arg1..arg5 From one to five operational argument strings. Argument strings are substituted, in order, for the %s formatters in the format string. If there are more formatters in the format parameter string than there are arguments, then an empty string is substituted for each %s for which there is no argument. PUTF_NCHAR Procedure A PUT_NCHAR procedure with formatting, and writes a Unicode string to a file, with formatting PUT_RAW Procedure Accepts as input a RAW data value and writes the value to the output buffer */
■問題 アクセス記録テーブル(access_log)からリンク元URLを重複のない形式で取り出してみましょう。以下の空欄を埋めてSQL命令を完成させてください。 [①空欄] referer [②空欄] access_log ; ■実行文 # 重複がない形でリンク元URLを取り出す SELECT DISTINCT referer # アクセス記録テーブルから取得 FROM access_log ; ■返却値 mysql> SELECT DISTINCT -> referer -> FROM -> access_log -> ; +---------------------------+ | referer | +---------------------------+ | http://wings.msn.to/hamu/ | | http://wings.msn.to/neko/ | | http://wings.msn.to/inu/ | | http://wings.msn.to/saru/ | | http://wings.msn.to/tori/ | | http://wings.msn.to/kame/ | | NULL | +---------------------------+ 7 rows in set (0.01 sec)
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50505 Source Host : localhost:3306 Source Database : qhgame Target Server Type : MYSQL Target Server Version : 50505 File Encoding : 65001 Date: 2017-02-23 18:27:17 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `qhgame_login` -- ---------------------------- DROP TABLE IF EXISTS `qhgame_login`; CREATE TABLE `qhgame_login` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_name` varchar(100) DEFAULT NULL, `user_pwd` varchar(100) DEFAULT NULL, `user_money` int(200) DEFAULT NULL, `user_v` varchar(20) DEFAULT NULL, `user_title` varchar(100) DEFAULT NULL, `user_power` int(100) DEFAULT NULL, `user_combat` int(200) DEFAULT NULL, `user_chapter` int(200) DEFAULT NULL, `carid` varchar(100) DEFAULT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of qhgame_login -- ---------------------------- INSERT INTO `qhgame_login` VALUES ('98', 'tang', '123456', '37440', null, null, '70', '3060', '1', ',2,6,10,1'); INSERT INTO `qhgame_login` VALUES ('99', '德玛西亚', '123456', '18', null, null, '100', '720', null, ',3'); INSERT INTO `qhgame_login` VALUES ('100', 'tang12', '123456', '12404', null, null, '40', '4133', '1', ',1,2,3,4,5'); INSERT INTO `qhgame_login` VALUES ('101', '你们都是菜鸡', '123456', '40200', null, null, '100', '2121', null, ',4,2,9');
CREATE TABLE SHOP ( SHOPID INT NOT NULL, SHOPNAME VARCHAR(100), CITYNAME VARCHAR(50), REGIONNAME VARCHAR(50), COUNTRYNAME VARCHAR(50), PRIMARY KEY (SHOPID) ); CREATE TABLE ARTICLE ( ArticleID INT NOT NULL, ArticleName VARCHAR(100), ProductGroupName VARCHAR(50), ProductFamilyName VARCHAR(50), ProductCategoryName VARCHAR(50), PRIMARY KEY (ArticleID) ); CREATE TABLE SALE_DATE ( DATEID INT NOT NULL, DAY INT, MONTH INT, QUARTER INT, YEAR INT, PRIMARY KEY (DATEID) ); CREATE TABLE SALE ( DATEID INT NOT NULL, -- renamed because 'date' is reserved SHOPID INT NOT NULL, ARTICLEID INT NOT NULL, SALES INT, REVENUE REAL, PRIMARY KEY (DATEID, SHOPID, ARTICLEID), -- try it like this ;) FOREIGN KEY (DATEID) REFERENCES SALE_DATE (DATEID), FOREIGN KEY (SHOPID) REFERENCES SHOP (SHOPID), FOREIGN KEY (ARTICLEID) REFERENCES ARTICLE (ARTICLEID) ); SELECT SUM(sa.SALES), SUM(sa.REVENUE), d.DATEID FROM SALE sa INNER JOIN SHOP sh ON sa.SHOPID = sh.SHOPID INNER JOIN ARTICLE a ON sa.ARTICLEID = a.ARTICLEID INNER JOIN SALE_DATE d ON sa.DATEID = d.DATEID WHERE 1 = 1 -- TODO GROUP BY d.DATEID; MERGE INTO SALE_DATE d (DATEID, DAY, MONTH, QUARTER, YEAR) USING (VALUES (13, 1,1,1,1)) AS m (DATEID, DAY, MONTH, QUARTER, YEAR) ON d.DATEID = m.DATEID WHEN NOT MATCHED THEN INSERT (DATEID, DAY, MONTH, QUARTER, YEAR) VALUES (m.DATEID, m.DAY, m.MONTH, m.QUARTER, m.YEAR) ELSE IGNORE
CREATE DATABASE IF NOT EXISTS university; USE university; CREATE TABLE IF NOT EXISTS major( id INT auto_increment PRIMARY KEY, name VARCHAR(100) ); CREATE TABLE IF NOT EXISTS person( id INT auto_increment PRIMARY KEY, name VARCHAR(100), age INT, is_professor BOOLEAN DEFAULT FALSE, major_id INT ); ALTER TABLE person ADD CONSTRAINT fk_person_major FOREIGN KEY (major_id) REFERENCES major(id) ON DELETE CASCADE;
-- phpMyAdmin SQL Dump -- version 4.5.5.1 -- http://www.phpmyadmin.net -- -- Client : 127.0.0.1 -- Généré le : Lun 06 Février 2017 à 05:04 -- Version du serveur : 5.7.11 -- Version de PHP : 5.6.19 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 */; -- -- Base de données : `reseau` -- -- -------------------------------------------------------- -- -- Structure de la table `affecter` -- CREATE TABLE `affecter` ( `username` varchar(255) NOT NULL, `nom_competence` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `affecter` -- INSERT INTO `affecter` (`username`, `nom_competence`) VALUES ('janati', 'JAVA'), ('janati', 'JAVA EE'), ('janati', 'SPRING MVC'), ('kadani', 'JAVA EE'), ('kadani', 'PHP'); -- -------------------------------------------------------- -- -- Structure de la table `attribuer` -- CREATE TABLE `attribuer` ( `date_attribution` datetime DEFAULT NULL, `id_etudiant` varchar(255) NOT NULL, `id_classe` bigint(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `attribuer` -- INSERT INTO `attribuer` (`date_attribution`, `id_etudiant`, `id_classe`) VALUES ('2017-02-01 00:00:00', 'bachir', 1), ('2017-02-01 00:00:00', 'janati', 1), ('2017-02-01 00:00:00', 'kadani', 1), ('2017-02-01 00:00:00', 'khatiri', 1), ('2017-02-01 00:00:00', 'sabrine', 1), ('2017-02-01 00:00:00', 'janati', 2); -- -------------------------------------------------------- -- -- Structure de la table `classe` -- CREATE TABLE `classe` ( `id_classe` bigint(20) NOT NULL, `nom` varchar(255) DEFAULT NULL, `photo` varchar(255) DEFAULT NULL, `date_creation` datetime DEFAULT NULL, `description` varchar(255) DEFAULT NULL, `professeur` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `classe` -- INSERT INTO `classe` (`id_classe`, `nom`, `photo`, `date_creation`, `description`, `professeur`) VALUES (1, '5 ILDW', '/dist/img/groupe.png', '2017-01-30 00:00:00', 'Groupe 5 éme année génie logiciel et developpement web', 'habib'), (2, 'M2 Miage', '/dist/img/groupe.png', '2017-01-30 00:00:00', '2 éme année master de méthode informatique appliquer à la gestion des entreprises', 'habib'); -- -------------------------------------------------------- -- -- Structure de la table `commenter` -- CREATE TABLE `commenter` ( `id_commentaire` bigint(20) NOT NULL, `message` varchar(255) DEFAULT NULL, `date` datetime DEFAULT NULL, `id_poste` bigint(20) DEFAULT NULL, `username` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `commenter` -- INSERT INTO `commenter` (`id_commentaire`, `message`, `date`, `id_poste`, `username`) VALUES (1, 'test commentaire 1', '2017-02-07 00:00:00', 49, 'janati'), (2, 'test com 2', '2017-02-06 00:00:00', 37, 'kadani'), (3, 'test comment 2', '2017-02-05 00:34:09', 49, 'janati'), (4, 'test hhhhhhhhhhhhhhhhh', '2017-02-05 00:59:54', 41, 'janati'), (5, 'yes mister kadani', '2017-02-05 01:02:03', 37, 'janati'), (6, 'test prof comment', '2017-02-05 02:38:24', 36, 'habib'), (7, 'bon image', '2017-02-05 02:39:08', 48, 'habib'), (8, 'comment', '2017-02-05 22:51:31', 49, 'kadani'), (9, 'test', '2017-02-05 22:54:46', 49, 'kadani'), (10, 'test notif', '2017-02-06 04:17:56', 49, 'janati'), (11, 'test notif 2', '2017-02-06 04:24:37', 49, 'janati'), (12, 'test notif 3', '2017-02-06 04:29:22', 49, 'janati'), (13, 'test notif 4', '2017-02-06 04:33:52', 49, 'janati'), (14, 'test notif ', '2017-02-06 04:47:06', 49, 'janati'); -- -------------------------------------------------------- -- -- Structure de la table `competence` -- CREATE TABLE `competence` ( `nom` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `competence` -- INSERT INTO `competence` (`nom`) VALUES ('JAVA'), ('JAVA EE'), ('PHP'), ('SPRING MVC'), ('SQL'); -- -------------------------------------------------------- -- -- Structure de la table `etat_amis` -- CREATE TABLE `etat_amis` ( `etat` varchar(255) DEFAULT NULL, `username_utilisateur_inviteur` varchar(255) NOT NULL, `username_utilisateur_inviter` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `etat_amis` -- INSERT INTO `etat_amis` (`etat`, `username_utilisateur_inviteur`, `username_utilisateur_inviter`) VALUES ('refuser', 'janati', 'bachir'), ('accepter', 'habib', 'janati'), ('accepter', 'khatiri', 'janati'), ('accepter', 'janati', 'kadani'), ('accepter', 'sabrine', 'kadani'); -- -------------------------------------------------------- -- -- Structure de la table `evenement` -- CREATE TABLE `evenement` ( `id_evenement` bigint(20) NOT NULL, `mois` varchar(255) DEFAULT NULL, `nom` varchar(255) DEFAULT NULL, `jour` varchar(255) DEFAULT NULL, `message` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Structure de la table `messagerie` -- CREATE TABLE `messagerie` ( `id_mesagerie` bigint(20) NOT NULL, `date` datetime DEFAULT NULL, `username_utilisateur_envoie` varchar(255) DEFAULT NULL, `username_utilisateur_recoie` varchar(255) DEFAULT NULL, `objet` varchar(255) DEFAULT NULL, `vu` tinyint(1) DEFAULT '0', `message` longtext ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `messagerie` -- INSERT INTO `messagerie` (`id_mesagerie`, `date`, `username_utilisateur_envoie`, `username_utilisateur_recoie`, `objet`, `vu`, `message`) VALUES (1, '2017-02-04 00:16:00', 'janati', 'kadani', 'Test Message 1', 0, '<h1><u>Heading Of Message</u></h1>\n<h4>Subheading</h4>\n<p>But I must explain to you how all this </p>\n<ul>\n<li>List item one</li>\n<li>List item two</li>\n<li>List item three</li>\n<li>List item four</li>\n</ul>\n<p>Thank you,</p>\n<p>John Doe</p>'), (2, '2017-02-05 00:28:00', 'habib', 'kadani', 'test message 2', 1, '<h1><u>Heading Of Message</u></h1>\r\n<h4>Subheading</h4>\r\n<p>But I must explain to you how all this </p>\r\n<ul>\r\n<li>List item one</li>\r\n<li>List item two</li>\r\n<li>List item three</li>\r\n<li>List item four</li>\r\n</ul>\r\n<p>Thank you,</p>\r\n<p>John Doe</p>'), (4, '2017-02-04 00:00:00', 'bachir', 'kadani', 'test message 4', 1, '<h1><u>Heading Of Message</u></h1> <h4>Subheading</h4> <p>But I must explain to you how all this </p> <ul> <li>List item one</li> <li>List item two</li> <li>List item three</li> <li>List item four</li> </ul> <p>Thank you,</p> <p>John Doe</p>'), (5, '2017-02-01 00:00:00', 'janati', 'kadani', 'test 5', 1, '<h1><u>Heading Of Message</u></h1> <h4>Subheading</h4> <p>But I must explain to you how all this </p> <ul> <li>List item one</li> <li>List item two</li> <li>List item three</li> <li>List item four</li> </ul> <p>Thank you,</p> <p>John Doe</p>'), (6, '2017-02-03 00:00:00', 'sabrine', 'kadani', 'test 6', 1, '<h1><u>Heading Of Message</u></h1> <h4>Subheading</h4> <p>But I must explain to you how all this </p> <ul> <li>List item one</li> <li>List item two</li> <li>List item three</li> <li>List item four</li> </ul> <p>Thank you,</p> <p>John Doe</p>'), (7, '2017-02-05 23:51:59', 'janati', 'sabrine', 'test envoi message', 0, '<h3><code><b></b><i></i>SimpleDateFormat</code>&nbsp;allows you to start by choosing any user-defined patterns for date-time formatting. However, you are encouraged to create a date-time formatter with either <code>getTimeInstance</code>, <code>getDateInstance</code>, or <code>getDateTimeInstance</code>&nbsp;in <code>DateFormat<i></i></code>.<b></b><b></b></h3><p></p><ul><li>Each of these class methods can return a date/time formatter initialized with a default format pattern.<br></li><li>You may modify the format pattern using the <code>applyPattern</code>&nbsp;methods as desired.&nbsp;<br></li><li>For more information on using these methods.<br></li><li><a target="_blank" rel="nofollow" href="http://www.google.com">http://www.google.com/</a> <br></li></ul><p></p>'), (8, '2017-02-05 23:57:35', 'janati', 'kadani', 'objet message avec img', 1, '<h1>test image :</h1><p><i><b>test</b></i><br><i><b><a target="_blank" rel="nofollow" href="http://www.facebook.com">http://www.facebook.com/</a><br></b></i><i><b><img alt="" src="http://akphoto4.ask.fm/828/603/393/1650003027-1qr2fs1-iirs680lcq7sqk0/original/hif.jpg"><br></b></i>'); -- -------------------------------------------------------- -- -- Structure de la table `notification` -- CREATE TABLE `notification` ( `id_notification` bigint(20) NOT NULL, `date` datetime DEFAULT NULL, `message` varchar(255) DEFAULT NULL, `type` varchar(255) DEFAULT NULL, `vu` bit(1) NOT NULL, `username` varchar(255) DEFAULT NULL, `username_notifier` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `notification` -- INSERT INTO `notification` (`id_notification`, `date`, `message`, `type`, `vu`, `username`, `username_notifier`) VALUES (1, '2017-02-06 04:47:06', 'test notif ', 'normale', b'1', 'kadani', 'janati'); -- -------------------------------------------------------- -- -- Structure de la table `poste` -- CREATE TABLE `poste` ( `id_poste` bigint(20) NOT NULL, `date` datetime DEFAULT NULL, `statut` varchar(255) DEFAULT NULL, `id_type` bigint(20) DEFAULT NULL, `username` varchar(255) DEFAULT NULL, `lien` varchar(255) DEFAULT NULL, `nom_lien` varchar(255) DEFAULT NULL, `username_tage` varchar(255) DEFAULT NULL, `groupe` tinyint(1) DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `poste` -- INSERT INTO `poste` (`id_poste`, `date`, `statut`, `id_type`, `username`, `lien`, `nom_lien`, `username_tage`, `groupe`) VALUES (1, '2017-01-31 00:00:00', 'ana bachir hhhhhhh :)', 1, 'bachir', NULL, NULL, NULL, 0), (2, '2017-01-31 00:05:00', 'ana kadani lmola9ab b gipsy king ljil ljadid ', 1, 'kadani', NULL, NULL, NULL, 0), (3, '2017-01-31 00:11:00', 're kandhak m3akom ', 1, 'bachir', NULL, NULL, NULL, 0), (4, '2017-01-31 00:17:00', 'ana re 7ma9 madiwch 3lya', 1, 'khatiri', NULL, NULL, NULL, 0), (5, '2017-01-31 00:24:00', ' kijak statuts hhhhhhhhh', 1, 'janati', NULL, NULL, NULL, 0), (6, '2017-01-31 00:13:00', 'statut sabrine', 1, 'sabrine', NULL, NULL, NULL, 0), (7, '2017-01-31 05:41:10', 'test ajouter statut', 1, 'janati', NULL, NULL, NULL, 0), (8, '2017-01-31 07:04:13', 'wawawawawawa', 1, 'kadani', NULL, NULL, 'janati', 0), (9, '2017-01-31 16:23:36', 'kadani', 1, 'janati', NULL, NULL, NULL, 0), (10, '2017-01-31 16:43:13', 'HHHHHHHHH\r\n', 1, 'kadani', NULL, NULL, NULL, 0), (11, '2017-01-31 17:23:42', 'hh', 1, 'kadani', NULL, NULL, NULL, 0), (14, '2017-02-01 05:59:34', 'test cv pdf', 3, 'janati', '/dist/tmpFiles/CV.pdf', 'CV.pdf', NULL, 0), (16, '2017-02-01 06:26:50', 'oussama hhhh', 2, 'janati', '/dist/imagesPoste/tompo_oussama.png', 'tompo_oussama.png', NULL, 0), (17, '2017-02-01 06:30:03', 'nabil proget', 2, 'janati', '/dist/imagesPoste/1.PNG', '1.PNG', NULL, 0), (18, '2017-02-01 15:05:31', 'badiaa', 3, 'janati', '/dist/tmpFiles/110305_164254.jpg', '110305_164254.jpg', NULL, 0), (19, '2017-02-01 16:05:06', '300 DH', 1, 'kadani', NULL, NULL, NULL, 0), (22, '2017-02-02 23:24:30', 'test final fichier', 3, 'janati', '/dist/tmpFiles/branche de droit.docx', 'branche de droit.docx', NULL, 0), (23, '2017-02-03 00:29:11', 'test text', 1, 'janati', NULL, NULL, NULL, 0), (24, '2017-02-03 00:29:26', 'test text 2', 1, 'janati', NULL, NULL, NULL, 0), (25, '2017-02-03 00:29:41', 'test img', 2, 'janati', '/dist/imagesPoste/3dfa81df00.jpg', '3dfa81df00.jpg', NULL, 0), (26, '2017-02-03 00:36:23', 'test', 2, 'janati', '/dist/imagesPoste/3.jpg', '3.jpg', NULL, 0), (27, '2017-02-03 00:43:48', '', 3, 'janati', '/dist/tmpFiles/Les élèves qui réussissent vont en cours.docx', 'Les élèves qui réussissent vont en cours.docx', NULL, 0), (28, '2017-02-03 01:00:30', 'test ico', 2, 'janati', '/dist/imagesPoste/icon.ico', 'icon.ico', NULL, 0), (29, '2017-02-03 02:46:18', 'test image', 2, 'janati', '/dist/imagesPoste/~OBOB700.JPG', '~OBOB700.JPG', NULL, 0), (30, '2017-02-03 02:47:12', '', 2, 'janati', '/dist/imagesPoste/100marocain.jpg', '100% marocain.jpg', NULL, 0), (34, '2017-02-03 03:23:32', '', 2, 'janati', '/dist/imagesPoste/18_kids_16957J.jpg', '18_kids_16957J.jpg', NULL, 0), (35, '2017-02-03 03:33:00', '', 3, 'janati', '/dist/tmpFiles/Logo-Pdf(1).pdf', 'Logo-Pdf(1).pdf', NULL, 0), (36, '2017-02-03 18:17:08', 'test tag 1', 1, 'janati', NULL, NULL, 'kadani', 0), (37, '2017-02-22 00:00:00', 'test statut groupe', 1, 'janati', NULL, NULL, NULL, 1), (39, '2017-02-04 03:01:03', 'test kadani statut group', 1, 'kadani', NULL, NULL, NULL, 1), (40, '2017-02-04 03:11:40', '', 3, 'kadani', '/dist/tmpFiles/kadani_test.txt', 'kadani_test.txt', NULL, 1), (41, '2017-02-04 10:52:03', '', 2, 'sabrine', '/dist/imagesPoste/sabrine_1.jpg', 'sabrine_1.jpg', NULL, 0), (48, '2017-02-04 15:40:02', '', 2, 'janati', '/dist/imagesPoste/janati_12000.jpg', 'janati_12000.jpg', NULL, 0), (49, '2017-02-04 16:10:08', 'test tag hhhhhh', 1, 'kadani', NULL, NULL, 'janati', 0), (51, '2017-02-05 19:02:52', 'test', 2, 'janati', '/dist/imagesPoste/janati_404.png', 'janati_404.png', 'kadani', 0); -- -------------------------------------------------------- -- -- Structure de la table `relation` -- CREATE TABLE `relation` ( `id_poste` bigint(20) NOT NULL, `id_classe` bigint(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `relation` -- INSERT INTO `relation` (`id_poste`, `id_classe`) VALUES (37, 1), (39, 1), (40, 1); -- -------------------------------------------------------- -- -- Structure de la table `roles` -- CREATE TABLE `roles` ( `role` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `roles` -- INSERT INTO `roles` (`role`) VALUES ('ADMIN'), ('ETUDIANT'), ('PROFESSEUR'); -- -------------------------------------------------------- -- -- Structure de la table `type` -- CREATE TABLE `type` ( `id_type` bigint(20) NOT NULL, `message` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `type` -- INSERT INTO `type` (`id_type`, `message`) VALUES (1, 'Text'), (2, 'Image'), (3, 'Fichier'); -- -------------------------------------------------------- -- -- Structure de la table `utilisateur` -- CREATE TABLE `utilisateur` ( `type_utilisateur` varchar(20) NOT NULL, `username` varchar(255) NOT NULL, `active` bit(1) NOT NULL, `adresse` varchar(255) DEFAULT NULL, `branche` varchar(255) DEFAULT NULL, `date_naissance` datetime DEFAULT NULL, `nom` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, `pays` varchar(255) DEFAULT NULL, `photo` varchar(255) DEFAULT NULL, `prenom` varchar(255) DEFAULT NULL, `tel` varchar(255) DEFAULT NULL, `ville` varchar(255) DEFAULT NULL, `ecoles` varchar(255) DEFAULT NULL, `ecole` varchar(255) DEFAULT NULL, `fonction` varchar(255) DEFAULT NULL, `date_creation` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `utilisateur` -- INSERT INTO `utilisateur` (`type_utilisateur`, `username`, `active`, `adresse`, `branche`, `date_naissance`, `nom`, `password`, `pays`, `photo`, `prenom`, `tel`, `ville`, `ecoles`, `ecole`, `fonction`, `date_creation`) VALUES ('Etudiant', 'bachir', b'1', 'agdal', '5 ILWD', '1992-01-01 00:00:00', 'Elyacoubi', 'a452f8e8f18cd553499e9a3aa077f62d', 'Maroc', '/dist/img/avatar6.png', 'Bachir', '0688000088', 'Tifelt', NULL, 'ISGA', 'Futur développeur web', '2017-01-31'), ('Professeur', 'habib', b'1', 'agdal', 'branche', '1975-04-02 00:00:00', 'belahmar', '1391921ec73a2f5dff54e075bbda7487', 'Maroc', '/dist/img/avatar6.png', 'habib', '0655889933', 'Rabat', 'ISGA, EMSI, Unicérsite Mohamed 5', NULL, 'Professeur', '2017-02-05'), ('Etudiant', 'janati', b'1', 'kouass cym', 'M2 Miage', '1992-11-17 00:00:00', 'janati', '0a23278227221a805eeb6549e072acb1', 'Maroc', '/dist/img/janati.jpg', 'simo', '0611445522', 'Rabat', NULL, 'université de lorraine', 'Futur développeur web', '2017-01-02'), ('Etudiant', 'kadani', b'1', 'sid elabd harhoura', '5 ILDW', '1993-01-01 00:00:00', 'kadani', '869c6b3f2a30dc83d767820a63894a6c', 'Maroc', '/dist/img/kadani.jpg', 'anas', '0655996633', 'Temara', NULL, 'ISGA', 'Futur développeur web', '2017-01-16'), ('Etudiant', 'khatiri', b'1', 'diour jamaa', '5 ILWD', '1990-01-01 00:00:00', 'Khatiri', '10a6b4bb4a3d253f254a9a19253fe774', 'Maroc', '/dist/img/khatiri.jpg', 'Ismail', '0688997788', 'Nador', NULL, 'ISGA', 'Futur développeur web', '2017-01-31'), ('Etudiant', 'sabrine', b'1', 'gich lwdaya', '5 ILWD', '1994-01-01 00:00:00', 'Talamcamani', '09017c56d784333dee9f6d735efef96a', 'Maroc', '/dist/img/sabrine.jpg', 'Sabrine', '0688944488', 'Temara', NULL, 'ISGA', 'Futur développeur web', '2017-01-31'); -- -------------------------------------------------------- -- -- Structure de la table `utilisateur_roles` -- CREATE TABLE `utilisateur_roles` ( `role` varchar(255) NOT NULL, `username` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `utilisateur_roles` -- INSERT INTO `utilisateur_roles` (`role`, `username`) VALUES ('ETUDIANT', 'bachir'), ('PROFESSEUR', 'habib'), ('ETUDIANT', 'janati'), ('ETUDIANT', 'kadani'), ('ETUDIANT', 'khatiri'), ('ETUDIANT', 'sabrine'); -- -- Index pour les tables exportées -- -- -- Index pour la table `affecter` -- ALTER TABLE `affecter` ADD PRIMARY KEY (`nom_competence`,`username`), ADD KEY `FKdb5kcin501batu4efb80ryvnx` (`username`); -- -- Index pour la table `attribuer` -- ALTER TABLE `attribuer` ADD PRIMARY KEY (`id_classe`,`id_etudiant`), ADD KEY `FK5o62g87b1e5gcm9tuxbe2a6d7` (`id_etudiant`); -- -- Index pour la table `classe` -- ALTER TABLE `classe` ADD PRIMARY KEY (`id_classe`), ADD KEY `FK35nymr0ov4i2sd5x3lahqkidl` (`professeur`); -- -- Index pour la table `commenter` -- ALTER TABLE `commenter` ADD PRIMARY KEY (`id_commentaire`), ADD KEY `FKh2rt1ck7si25l0makdy9k1ggk` (`id_poste`), ADD KEY `FKpy7j23tgqddq3ooyk6wi203gd` (`username`); -- -- Index pour la table `competence` -- ALTER TABLE `competence` ADD PRIMARY KEY (`nom`); -- -- Index pour la table `etat_amis` -- ALTER TABLE `etat_amis` ADD PRIMARY KEY (`username_utilisateur_inviter`,`username_utilisateur_inviteur`), ADD KEY `FK4e06r7xylarjaej0iysi7655k` (`username_utilisateur_inviteur`); -- -- Index pour la table `evenement` -- ALTER TABLE `evenement` ADD PRIMARY KEY (`id_evenement`); -- -- Index pour la table `messagerie` -- ALTER TABLE `messagerie` ADD PRIMARY KEY (`id_mesagerie`), ADD KEY `FK7xtan5oxvaoqdie43w0plqm50` (`username_utilisateur_envoie`), ADD KEY `FKgs3n91qtskgbhqfgkcuqko5qo` (`username_utilisateur_recoie`); -- -- Index pour la table `notification` -- ALTER TABLE `notification` ADD PRIMARY KEY (`id_notification`), ADD KEY `FKie5kw6lvphsq78cmbh33xfy7w` (`username`), ADD KEY `FK6jie6v7m3qtf06p77pf3614sx` (`username_notifier`); -- -- Index pour la table `poste` -- ALTER TABLE `poste` ADD PRIMARY KEY (`id_poste`), ADD KEY `FKrv0g7v72lnkf48cxivrxpqsh7` (`id_type`), ADD KEY `FKpvymdh46j2mtr2tge2u4cs69r` (`username`), ADD KEY `FKqxx41fnoob4lp73h4rdekkuyn` (`username_tage`); -- -- Index pour la table `relation` -- ALTER TABLE `relation` ADD PRIMARY KEY (`id_classe`,`id_poste`), ADD KEY `FKiy4g5os9f6en3s0qr2vky79pp` (`id_poste`); -- -- Index pour la table `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`role`); -- -- Index pour la table `type` -- ALTER TABLE `type` ADD PRIMARY KEY (`id_type`); -- -- Index pour la table `utilisateur` -- ALTER TABLE `utilisateur` ADD PRIMARY KEY (`username`); -- -- Index pour la table `utilisateur_roles` -- ALTER TABLE `utilisateur_roles` ADD PRIMARY KEY (`role`,`username`), ADD KEY `FK22b9btn517470yd77mkumivg8` (`username`); -- -- AUTO_INCREMENT pour les tables exportées -- -- -- AUTO_INCREMENT pour la table `classe` -- ALTER TABLE `classe` MODIFY `id_classe` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT pour la table `commenter` -- ALTER TABLE `commenter` MODIFY `id_commentaire` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT pour la table `evenement` -- ALTER TABLE `evenement` MODIFY `id_evenement` bigint(20) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT pour la table `messagerie` -- ALTER TABLE `messagerie` MODIFY `id_mesagerie` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT pour la table `notification` -- ALTER TABLE `notification` MODIFY `id_notification` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT pour la table `poste` -- ALTER TABLE `poste` MODIFY `id_poste` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52; -- -- AUTO_INCREMENT pour la table `type` -- ALTER TABLE `type` MODIFY `id_type` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- Contraintes pour les tables exportées -- -- -- Contraintes pour la table `affecter` -- ALTER TABLE `affecter` ADD CONSTRAINT `FKdb5kcin501batu4efb80ryvnx` FOREIGN KEY (`username`) REFERENCES `utilisateur` (`username`), ADD CONSTRAINT `FKr3el5n8s9x7gv6vdgx9wbwb9j` FOREIGN KEY (`nom_competence`) REFERENCES `competence` (`nom`); -- -- Contraintes pour la table `attribuer` -- ALTER TABLE `attribuer` ADD CONSTRAINT `FK5o62g87b1e5gcm9tuxbe2a6d7` FOREIGN KEY (`id_etudiant`) REFERENCES `utilisateur` (`username`), ADD CONSTRAINT `FKmiwmgd274l6gy67ee3pr9fhgx` FOREIGN KEY (`id_classe`) REFERENCES `classe` (`id_classe`); -- -- Contraintes pour la table `classe` -- ALTER TABLE `classe` ADD CONSTRAINT `FK35nymr0ov4i2sd5x3lahqkidl` FOREIGN KEY (`professeur`) REFERENCES `utilisateur` (`username`); -- -- Contraintes pour la table `commenter` -- ALTER TABLE `commenter` ADD CONSTRAINT `FKh2rt1ck7si25l0makdy9k1ggk` FOREIGN KEY (`id_poste`) REFERENCES `poste` (`id_poste`), ADD CONSTRAINT `FKpy7j23tgqddq3ooyk6wi203gd` FOREIGN KEY (`username`) REFERENCES `utilisateur` (`username`); -- -- Contraintes pour la table `etat_amis` -- ALTER TABLE `etat_amis` ADD CONSTRAINT `FK4e06r7xylarjaej0iysi7655k` FOREIGN KEY (`username_utilisateur_inviteur`) REFERENCES `utilisateur` (`username`), ADD CONSTRAINT `FKok4a5kudu2yibl8hw5mvf2mmx` FOREIGN KEY (`username_utilisateur_inviter`) REFERENCES `utilisateur` (`username`); -- -- Contraintes pour la table `messagerie` -- ALTER TABLE `messagerie` ADD CONSTRAINT `FK7xtan5oxvaoqdie43w0plqm50` FOREIGN KEY (`username_utilisateur_envoie`) REFERENCES `utilisateur` (`username`), ADD CONSTRAINT `FKgs3n91qtskgbhqfgkcuqko5qo` FOREIGN KEY (`username_utilisateur_recoie`) REFERENCES `utilisateur` (`username`); -- -- Contraintes pour la table `notification` -- ALTER TABLE `notification` ADD CONSTRAINT `FK6jie6v7m3qtf06p77pf3614sx` FOREIGN KEY (`username_notifier`) REFERENCES `utilisateur` (`username`), ADD CONSTRAINT `FKie5kw6lvphsq78cmbh33xfy7w` FOREIGN KEY (`username`) REFERENCES `utilisateur` (`username`); -- -- Contraintes pour la table `poste` -- ALTER TABLE `poste` ADD CONSTRAINT `FKpvymdh46j2mtr2tge2u4cs69r` FOREIGN KEY (`username`) REFERENCES `utilisateur` (`username`), ADD CONSTRAINT `FKqxx41fnoob4lp73h4rdekkuyn` FOREIGN KEY (`username_tage`) REFERENCES `utilisateur` (`username`), ADD CONSTRAINT `FKrv0g7v72lnkf48cxivrxpqsh7` FOREIGN KEY (`id_type`) REFERENCES `type` (`id_type`); -- -- Contraintes pour la table `relation` -- ALTER TABLE `relation` ADD CONSTRAINT `FKihuwh7xfupr4xx4u45j84umex` FOREIGN KEY (`id_classe`) REFERENCES `classe` (`id_classe`), ADD CONSTRAINT `FKiy4g5os9f6en3s0qr2vky79pp` FOREIGN KEY (`id_poste`) REFERENCES `poste` (`id_poste`); -- -- Contraintes pour la table `utilisateur_roles` -- ALTER TABLE `utilisateur_roles` ADD CONSTRAINT `FK22b9btn517470yd77mkumivg8` FOREIGN KEY (`username`) REFERENCES `utilisateur` (`username`), ADD CONSTRAINT `FKlwufqm54pnnvxdn1t8u6k5ppm` FOREIGN KEY (`role`) REFERENCES `roles` (`role`); /*!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 TABLE "public"."User"("email" text NOT NULL, "name" text NOT NULL, "picture" text NOT NULL, PRIMARY KEY ("email") ); CREATE EXTENSION IF NOT EXISTS pgcrypto; CREATE TABLE "public"."Skill"("id" uuid NOT NULL DEFAULT gen_random_uuid(), "name" text NOT NULL UNIQUE, "categoryId" uuid NOT NULL, PRIMARY KEY ("id") ); CREATE EXTENSION IF NOT EXISTS pgcrypto; CREATE TABLE "public"."Topic"("id" uuid NOT NULL DEFAULT gen_random_uuid(), "name" text NOT NULL UNIQUE, PRIMARY KEY ("id") ); CREATE TABLE "public"."UserSkill"("userEmail" text NOT NULL, "skillId" UUID NOT NULL, "level" integer NOT NULL DEFAULT 1, "created_at" date NOT NULL DEFAULT now(), PRIMARY KEY ("userEmail","skillId","created_at") , FOREIGN KEY ("userEmail") REFERENCES "public"."User"("email") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("skillId") REFERENCES "public"."Skill"("id") ON UPDATE restrict ON DELETE restrict); alter table "public"."UserSkill" add constraint "UserSkill_level_between_1_and_5" check (level >= 1 AND level <= 5); CREATE TABLE "public"."TechnicalAppetite"("userEmail" text NOT NULL, "skillId" uuid NOT NULL, "created_at" date NOT NULL DEFAULT now(), "level" integer NOT NULL DEFAULT 1, PRIMARY KEY ("userEmail","skillId","created_at") , FOREIGN KEY ("userEmail") REFERENCES "public"."User"("email") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("skillId") REFERENCES "public"."Skill"("id") ON UPDATE restrict ON DELETE restrict, CONSTRAINT "TechnicalAppetite_level_between_1_and_5" CHECK (level >= 1 AND level <= 5)); CREATE EXTENSION IF NOT EXISTS pgcrypto; CREATE TABLE "public"."Agency"("name" text NOT NULL, PRIMARY KEY ("name") ); CREATE TABLE "public"."UserAgency"("userEmail" Text NOT NULL, "agency" text NOT NULL, "created_at" date NOT NULL DEFAULT now(), PRIMARY KEY ("userEmail", "created_at") , FOREIGN KEY ("userEmail") REFERENCES "public"."User"("email") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("agency") REFERENCES "public"."Agency"("name") ON UPDATE restrict ON DELETE restrict); CREATE TABLE "public"."UserTopic"("userEmail" text NOT NULL, "topicId" uuid NOT NULL, "created_at" date NOT NULL DEFAULT now(), PRIMARY KEY ("userEmail","topicId","created_at") , FOREIGN KEY ("userEmail") REFERENCES "public"."User"("email") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("topicId") REFERENCES "public"."Topic"("id") ON UPDATE restrict ON DELETE restrict); CREATE EXTENSION IF NOT EXISTS pgcrypto; CREATE TABLE "public"."Category"("id" uuid NOT NULL DEFAULT gen_random_uuid(), "label" text NOT NULL, "x" text NOT NULL, "y" text NOT NULL, "color" text NOT NULL, "index" integer NOT NULL UNIQUE, PRIMARY KEY ("id") ); alter table "public"."Skill" add constraint "Skill_categoryId_fkey" foreign key ("categoryId") references "public"."Category" ("id") on update restrict on delete restrict;
-- Feb 17, 2009 5:20:59 PM ECT -- Libero UPDATE PP_Product_BOMLine SET ComponentType='CO',Updated=TO_TIMESTAMP('2009-02-17 17:20:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE PP_Product_BOMLine_ID=102 ;
ALTER TABLE "user" ADD COLUMN "password" VARCHAR(25) NOT NULL DEFAULT 'pass'; ALTER TABLE "user" ALTER COLUMN "password" DROP DEFAULT;
-- these are queries we can use for sandboxing/testing with ease use jobs_db; -- ========[ Debugging ]================= show exable_table; desc exable_table; desc exable_table; desc exable_table; desc exable_table; select * from exable_table; select * from exable_table; select * from exable_table; select * from exable_table; -- ____________________ CAREFUL BELOW _______________________ -- SET FOREIGN_KEY_CHECKS = 0; -- truncate table exable_table; -- truncate table exable_table; -- truncate table exable_table; -- truncate table exable_table; -- SET FOREIGN_KEY_CHECKS = 1; -- drop table if exists exable_table; -- drop table if exists exable_table; -- drop table if exists exable_table; -- drop table if exists exable_table; -- drop database if exists jobs_db; -- create database if not exists jobs_db;
--------------------------그룹함수 --1. 사원테이블에서 부서별 인원수가 6명 이상인 부서코드 검색 SELECT DEPTNO,COUNT(*) FROM EMP GROUP BY DEPTNO HAVING COUNT(*) >= 6; --2. 사원테이블로부터 부서번호, 업무별 급여합계 계산 SELECT DEPTNO, SUM(DECODE(JOB,'CLERK',SAL,0)) "CLERK", SUM(DECODE(JOB,'MANAGER',SAL,0)) "MANAGER", SUM(DECODE(JOB,'PRESIDENT',SAL,0)) "PRESIDENT", SUM(DECODE(JOB,'ANALYST',SAL,0))"ANALYST", SUM(DECODE(JOB,'SALESMAN',SAL,0))"SALESMAN" FROM EMP GROUP BY DEPTNO ORDER BY DEPTNO; --3. 사원테이블로부터 년도별, 월별 급여합계를 출력할 수 있는 SQL문장 작성 SELECT TO_CHAR(HIREDATE,'YYYY')"년",TO_CHAR(HIREDATE,'MM') "월",SUM(SAL) FROM EMP GROUP BY TO_CHAR(HIREDATE,'YYYY'), TO_CHAR(HIREDATE,'MM') ORDER BY "년"; --4. 사원테이블에서 부서별 COMM을 포함하지않은 연봉의 합과 포함한 연봉의 합을 구하는 SQL을 작성 --포함X SELECT DEPTNO, SUM(SAL*12) "연봉" FROM EMP GROUP BY DEPTNO ORDER BY DEPTNO; --포함O SELECT DEPTNO,SUM(NVL2(COMM,(SAL+COMM)*12, SAL*12)) FROM EMP GROUP BY DEPTNO ORDER BY DEPTNO; --5. 사원테이블에서 SALESMAN을 제외한 JOB별 급여합계 SELECT JOB, SUM(SAL) FROM EMP GROUP BY JOB HAVING JOB != 'SALESMAN';
-- Copyright 2004-2018 H2 Group. Multiple-Licensed under the MPL 2.0, -- and the EPL 1.0 (http://h2database.com/html/license.html). -- Initial Developer: H2 Group -- select DATE_TRUNC('day', time '00:00:00'); >> 1970-01-01 00:00:00 select DATE_TRUNC('DAY', time '00:00:00'); >> 1970-01-01 00:00:00 select DATE_TRUNC('day', time '15:14:13'); >> 1970-01-01 00:00:00 select DATE_TRUNC('DAY', time '15:14:13'); >> 1970-01-01 00:00:00 select DATE_TRUNC('day', date '2015-05-29'); >> 2015-05-29 00:00:00 select DATE_TRUNC('DAY', date '2015-05-29'); >> 2015-05-29 00:00:00 select DATE_TRUNC('day', timestamp '2015-05-29 15:14:13'); >> 2015-05-29 00:00:00 select DATE_TRUNC('DAY', timestamp '2015-05-29 15:14:13'); >> 2015-05-29 00:00:00 select DATE_TRUNC('day', timestamp with time zone '2015-05-29 15:14:13'); >> 2015-05-29 00:00:00+00 select DATE_TRUNC('DAY', timestamp with time zone '2015-05-29 15:14:13'); >> 2015-05-29 00:00:00+00 select DATE_TRUNC('day', timestamp with time zone '2015-05-29 05:14:13-06'); >> 2015-05-29 00:00:00-06 select DATE_TRUNC('DAY', timestamp with time zone '2015-05-29 05:14:13-06'); >> 2015-05-29 00:00:00-06 select DATE_TRUNC('day', timestamp with time zone '2015-05-29 15:14:13+10'); >> 2015-05-29 00:00:00+10 select DATE_TRUNC('DAY', timestamp with time zone '2015-05-29 15:14:13+10'); >> 2015-05-29 00:00:00+10 select DATE_TRUNC('day', '2015-05-29 15:14:13'); >> 2015-05-29 00:00:00 select DATE_TRUNC('DAY', '2015-05-29 15:14:13'); >> 2015-05-29 00:00:00 SELECT DATE_TRUNC('---', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('microseconds', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('MICROSECONDS', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('milliseconds', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('MILLISECONDS', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('second', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('SECOND', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('minute', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('MINUTE', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('hour', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('HOUR', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('week', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('WEEK', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('month', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('MONTH', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('quarter', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('QUARTER', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('year', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('YEAR', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('decade', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('DECADE', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('century', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('CENTURY', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('millennium', '2015-05-29 15:14:13'); > exception SELECT DATE_TRUNC('MILLENNIUM', '2015-05-29 15:14:13'); > exception
-- :name read-employees :? :* -- reads the list of employees select * from employee
/** * * @procedure * @author Alexey * @name group_counter_end_values_4calc * @manual */ Select t3.end_val AS fm_value, 'END_' || t1.cnt_type AS fm_name, t2.group_id , t2.services_id, t2.grp_services_id From grp_services t2 Inner Join grp_service_counters t4 on t2.grp_services_id = t4.grp_service_id inner join cnt_con2flats t on t4.grp_service_counters_id = t.group_counter Inner Join cnt_counters t1 on t1.cnt_counters_id = t.counter_id Inner Join per_counter_values t3 on t.counter_id = t3.counter_id Where :dateid = t3.date_id and :groupid = t2.group_id
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Feb 01, 2016 at 11:31 PM -- Server version: 10.1.8-MariaDB -- PHP Version: 5.6.14 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: `museo` -- CREATE DATABASE IF NOT EXISTS `museo` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `museo`; -- -------------------------------------------------------- -- -- Table structure for table `t000_login` -- DROP TABLE IF EXISTS `t000_login`; CREATE TABLE `t000_login` ( `C000_LOGIN_ID` int(11) NOT NULL, `C000_USERNAME` varchar(50) NOT NULL, `C000_PASSWORD` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `t000_login` -- INSERT INTO `t000_login` (`C000_LOGIN_ID`, `C000_USERNAME`, `C000_PASSWORD`) VALUES (1, 'ADMIN', 'ADMIN'); -- -------------------------------------------------------- -- -- Table structure for table `t001_user` -- DROP TABLE IF EXISTS `t001_user`; CREATE TABLE `t001_user` ( `C001_USER_ID` int(11) NOT NULL, `C001_FNAME` varchar(50) NOT NULL, `C001_LNAME` varchar(50) NOT NULL, `C000_LOGIN_ID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `t001_user` -- INSERT INTO `t001_user` (`C001_USER_ID`, `C001_FNAME`, `C001_LNAME`, `C000_LOGIN_ID`) VALUES (1, 'ADMIN', 'ADMIN', 1); -- -------------------------------------------------------- -- -- Table structure for table `t002_item` -- DROP TABLE IF EXISTS `t002_item`; CREATE TABLE `t002_item` ( `C002_ITEM_ID` int(11) NOT NULL, `C002_ITEM_TITLE` varchar(100) NOT NULL, `C002_ITEM_DESCRIPTION` text, `C003_CREATOR_ID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `t003_creator` -- DROP TABLE IF EXISTS `t003_creator`; CREATE TABLE `t003_creator` ( `C003_CREATOR_ID` int(11) NOT NULL, `C003_CREATOR_FNAME` varchar(50) NOT NULL, `C003_CREATOR_LNAME` varchar(50) NOT NULL, `C003_CREATOR_PROFILE` text NOT NULL, `C004_` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `t004_image` -- DROP TABLE IF EXISTS `t004_image`; CREATE TABLE `t004_image` ( `C004_IMAGE_ID` int(11) NOT NULL, `C004_IMAGE_FILENAME` varchar(100) NOT NULL, `C004_IMAGE_PATH` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `t005_item_image_link` -- DROP TABLE IF EXISTS `t005_item_image_link`; CREATE TABLE `t005_item_image_link` ( `C005_IIL_ID` int(11) NOT NULL, `C002_ITEM_ID` int(11) NOT NULL, `C004_IMAGE_ID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `t006_exhibit` -- DROP TABLE IF EXISTS `t006_exhibit`; CREATE TABLE `t006_exhibit` ( `C006_EXHIBIT_ID` int(11) NOT NULL, `C006_EXHIBIT_SDATE` date NOT NULL, `C006_EXHIBIT_EDATE` date NOT NULL, `C006_EXHIBIT_TITLE` varchar(255) NOT NULL, `C006_EXHIBIT_DESCRIPTION` text NOT NULL, `C004_IMAGE_ID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `t007_exhibit_image_link` -- DROP TABLE IF EXISTS `t007_exhibit_image_link`; CREATE TABLE `t007_exhibit_image_link` ( `C007_EIL_ID` int(11) NOT NULL, `C006_EXHIBIT_ID` int(11) NOT NULL, `C002_ITEM_ID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `t000_login` -- ALTER TABLE `t000_login` ADD PRIMARY KEY (`C000_LOGIN_ID`); -- -- Indexes for table `t001_user` -- ALTER TABLE `t001_user` ADD PRIMARY KEY (`C001_USER_ID`), ADD KEY `C000_LOGIN_ID` (`C000_LOGIN_ID`); -- -- Indexes for table `t002_item` -- ALTER TABLE `t002_item` ADD PRIMARY KEY (`C002_ITEM_ID`); -- -- Indexes for table `t003_creator` -- ALTER TABLE `t003_creator` ADD PRIMARY KEY (`C003_CREATOR_ID`); -- -- Indexes for table `t004_image` -- ALTER TABLE `t004_image` ADD PRIMARY KEY (`C004_IMAGE_ID`); -- -- Indexes for table `t005_item_image_link` -- ALTER TABLE `t005_item_image_link` ADD PRIMARY KEY (`C005_IIL_ID`), ADD KEY `C002_ITEM_ID` (`C002_ITEM_ID`), ADD KEY `C004_IMAGE_ID` (`C004_IMAGE_ID`); -- -- Indexes for table `t006_exhibit` -- ALTER TABLE `t006_exhibit` ADD PRIMARY KEY (`C006_EXHIBIT_ID`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `t000_login` -- ALTER TABLE `t000_login` MODIFY `C000_LOGIN_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `t001_user` -- ALTER TABLE `t001_user` MODIFY `C001_USER_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `t002_item` -- ALTER TABLE `t002_item` MODIFY `C002_ITEM_ID` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `t003_creator` -- ALTER TABLE `t003_creator` MODIFY `C003_CREATOR_ID` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `t004_image` -- ALTER TABLE `t004_image` MODIFY `C004_IMAGE_ID` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `t005_item_image_link` -- ALTER TABLE `t005_item_image_link` MODIFY `C005_IIL_ID` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `t006_exhibit` -- ALTER TABLE `t006_exhibit` MODIFY `C006_EXHIBIT_ID` int(11) NOT NULL AUTO_INCREMENT; -- -- Constraints for dumped tables -- -- -- Constraints for table `t001_user` -- ALTER TABLE `t001_user` ADD CONSTRAINT `t001_user_ibfk_1` FOREIGN KEY (`C000_LOGIN_ID`) REFERENCES `t000_login` (`C000_LOGIN_ID`); -- -- Constraints for table `t005_item_image_link` -- ALTER TABLE `t005_item_image_link` ADD CONSTRAINT `t005_item_image_link_ibfk_1` FOREIGN KEY (`C002_ITEM_ID`) REFERENCES `t002_item` (`C002_ITEM_ID`), ADD CONSTRAINT `t005_item_image_link_ibfk_2` FOREIGN KEY (`C004_IMAGE_ID`) REFERENCES `t004_image` (`C004_IMAGE_ID`); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
INSERT INTO bpk_stock_movement_summary(bpk_id,movement_date,id,movement_type,summary_cost) SELECT 9 bpk_id, movement_date, movement_type, ABS(SUM(cost)) AS summary_cost FROM ( SELECT movement_date, movement_type, item_id, stock_id, SUM(quantity*unit_avg_cost) AS cost FROM bpk_stock_card_his WHERE movement_date BETWEEN '$P{dBeginDate}' AND '$P{dBeginDate}' GROUP BY movement_date, movement_type, item_id, stock_id ) tmp GROUP BY movement_type, movement_date ORDER BY movement_date, movement_type;
-- Faça uma consulta que selecione o nome, o salário dos funcionário e a descrição do departamento, -- mesmo que eles não tenham departamentos associados. SELECT nome, salario, d.descricao FROM funcionario f, departamento d WHERE f.coddepto = d.codigo;
use employees; SELECT emp_no, CONCAT(e.first_name, ' ', e.last_name) AS full_name FROM employees AS e WHERE hire_date IN ( SELECT hire_date FROM employees WHERE emp_no = 101010); SELECT title, COUNT(title) FROM titles WHERE emp_no IN (SELECT emp_no FROM employees WHERE first_name = 'Aamod') group by title; SELECT dept_name FROM employees as e JOIN dept_manager as dm ON dm.emp_no = e.emp_no JOIN departments as d ON d.dept_no = dm.dept_no WHERE dm.to_date = '9999-01-01' AND e.gender = 'F' ORDER BY dept_name; SELECT first_name, last_name FROM employees as e JOIN salaries s ON e.emp_no = s.emp_no WHERE s.to_date = '9999-01-01' ORDER BY salary DESC LIMIT 1;
-- phpMyAdmin SQL Dump -- version 4.1.14 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Oct 15, 2015 at 09:46 AM -- Server version: 5.6.17 -- 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: `gdi` -- -- -------------------------------------------------------- -- -- Table structure for table `h_product` -- CREATE TABLE IF NOT EXISTS `h_product` ( `jurisdiction_product_id` int(11) NOT NULL, `history` int(11) NOT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `m_branch` -- CREATE TABLE IF NOT EXISTS `m_branch` ( `branch_id` int(11) NOT NULL AUTO_INCREMENT, `branch_name` varchar(30) NOT NULL, `branch_abbr` varchar(30) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`branch_id`), UNIQUE KEY `branch_name` (`branch_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; -- -- Dumping data for table `m_branch` -- INSERT INTO `m_branch` (`branch_id`, `branch_name`, `branch_abbr`, `is_deleted`, `create_user_id`, `create_time`, `update_user_id`, `update_time`) VALUES (1, 'Aruze Gaming Philippines', 'AGA - PB', 0, 0, '2015-10-14 13:24:29', 0, '2015-10-13 16:59:15'); -- -------------------------------------------------------- -- -- Table structure for table `m_game_category` -- CREATE TABLE IF NOT EXISTS `m_game_category` ( `game_category_id` int(11) NOT NULL AUTO_INCREMENT, `game_category_name` varchar(30) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`game_category_id`), UNIQUE KEY `game_category_name` (`game_category_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `m_game_group` -- CREATE TABLE IF NOT EXISTS `m_game_group` ( `game_group_id` int(11) NOT NULL AUTO_INCREMENT, `game_group_name` varchar(50) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`game_group_id`), UNIQUE KEY `game_group_name` (`game_group_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `m_jurisdiction` -- CREATE TABLE IF NOT EXISTS `m_jurisdiction` ( `jurisdiction_id` int(11) NOT NULL AUTO_INCREMENT, `jurisdiction_name` varchar(30) NOT NULL, `jurisdiction_abbr` varchar(4) NOT NULL, `is_regulator` tinyint(1) NOT NULL DEFAULT '0', `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`jurisdiction_id`), UNIQUE KEY `jurisdiction_name` (`jurisdiction_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `m_language` -- CREATE TABLE IF NOT EXISTS `m_language` ( `language_id` int(11) NOT NULL AUTO_INCREMENT, `name_en` varchar(30) NOT NULL, `name_native` varchar(30) NOT NULL, `code` varchar(5) NOT NULL, `resource` varchar(5) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`language_id`), UNIQUE KEY `name_en` (`name_en`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; -- -- Dumping data for table `m_language` -- INSERT INTO `m_language` (`language_id`, `name_en`, `name_native`, `code`, `resource`, `is_deleted`, `create_user_id`, `create_time`, `update_user_id`, `update_time`) VALUES (1, 'English', 'en_US', 'en_US', 'en', 0, 0, '2015-10-14 00:00:00', 0, '2015-10-13 17:04:06'), (2, 'Japanese', '日本語', 'ja_JP', 'ja', 0, 0, '2015-10-14 00:00:00', 0, '2015-10-13 17:05:01'); -- -------------------------------------------------------- -- -- Table structure for table `m_market` -- CREATE TABLE IF NOT EXISTS `m_market` ( `market_id` int(11) NOT NULL AUTO_INCREMENT, `market_name` varchar(30) NOT NULL, `market_abbr` varchar(30) NOT NULL, `criterion_jurisdiction_id` varchar(11) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`market_id`), UNIQUE KEY `market_name` (`market_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `m_page` -- CREATE TABLE IF NOT EXISTS `m_page` ( `page_id` int(11) NOT NULL AUTO_INCREMENT, `page_name` varchar(100) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`page_id`), UNIQUE KEY `page_name` (`page_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `m_platform` -- CREATE TABLE IF NOT EXISTS `m_platform` ( `platform_id` int(11) NOT NULL AUTO_INCREMENT, `platform_name` varchar(30) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`platform_id`), UNIQUE KEY `platform_name` (`platform_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `m_role` -- CREATE TABLE IF NOT EXISTS `m_role` ( `role_id` int(11) NOT NULL AUTO_INCREMENT, `role_name` varchar(100) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`role_id`), UNIQUE KEY `role_name` (`role_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `m_session` -- CREATE TABLE IF NOT EXISTS `m_session` ( `id` varchar(32) NOT NULL DEFAULT '', `name` varchar(32) NOT NULL DEFAULT '', `modified` int(11) DEFAULT NULL, `lifetime` int(11) DEFAULT NULL, `data` text NOT NULL, PRIMARY KEY (`id`,`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `m_session` -- INSERT INTO `m_session` (`id`, `name`, `modified`, `lifetime`, `data`) VALUES ('r0h73avcqcd2rm6tghisif0rv0', 'gdi_aruze', 1444895023, 1800, '{"id":"2","ip_address":"192.168.4.200","user_agent":"Mozilla\\/5.0 (Windows NT 6.1; WOW64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/45.0.2454.101 Safari\\/537.36"}'); -- -------------------------------------------------------- -- -- Table structure for table `m_status` -- CREATE TABLE IF NOT EXISTS `m_status` ( `status_id` int(11) NOT NULL AUTO_INCREMENT, `status_name` varchar(30) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`status_id`), UNIQUE KEY `status_name` (`status_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `m_user` -- CREATE TABLE IF NOT EXISTS `m_user` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(50) NOT NULL, `last_name` varchar(50) NOT NULL, `email_address` varchar(100) NOT NULL, `password` varchar(50) NOT NULL, `branch_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `pw_error_count` tinyint(4) NOT NULL DEFAULT '0', `is_active` tinyint(1) NOT NULL DEFAULT '0', `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`), UNIQUE KEY `email_address` (`email_address`), KEY `m_user_fi1` (`branch_id`), KEY `m_user_fi2` (`language_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; -- -- Dumping data for table `m_user` -- INSERT INTO `m_user` (`user_id`, `first_name`, `last_name`, `email_address`, `password`, `branch_id`, `language_id`, `pw_error_count`, `is_active`, `is_deleted`, `create_user_id`, `create_time`, `update_user_id`, `update_time`) VALUES (2, 'marvin', 'manguait', 'marvin.manguiat@aruzegaming.com', '5d7845ac6ee7cfffafc5fe5f35cf666d', 1, 1, 2, 0, 0, 0, '2015-10-14 00:00:00', 0, '2015-10-14 05:34:44'), (3, 'Jen', 'Lovendino', 'lovely.jen.lovendino@aruzegaming.com', '5d7845ac6ee7cfffafc5fe5f35cf666d', 1, 1, 2, 0, 0, 0, '2015-10-14 00:00:00', 0, '2015-10-14 05:34:44'), (4, 'jonathan', 'antivo', 'jonathan.antivo@aruzegaming.com', '5d7845ac6ee7cfffafc5fe5f35cf666d', 1, 1, 2, 0, 0, 0, '2015-10-14 00:00:00', 0, '2015-10-14 05:34:44'); -- -------------------------------------------------------- -- -- Table structure for table `r_market_jurisdiction` -- CREATE TABLE IF NOT EXISTS `r_market_jurisdiction` ( `market_id` int(11) NOT NULL, `jurisdiction_id` int(11) NOT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `r_market_jurisdiction_fi1` (`market_id`), KEY `r_market_jurisdiction_fi2` (`jurisdiction_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `r_role_page` -- CREATE TABLE IF NOT EXISTS `r_role_page` ( `role_id` int(11) NOT NULL, `page_id` int(11) NOT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `r_role_pagefi1` (`role_id`), KEY `r_role_pagefi2` (`page_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `r_user_role` -- CREATE TABLE IF NOT EXISTS `r_user_role` ( `user_id` int(11) NOT NULL, `role_id` int(11) NOT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `r_user_role_fi1` (`user_id`), KEY `r_user_role_fi2` (`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `t_jurisdiction_product` -- CREATE TABLE IF NOT EXISTS `t_jurisdiction_product` ( `jurisdiction_product_id` int(11) NOT NULL AUTO_INCREMENT, `market_product_id` int(11) NOT NULL COMMENT 'Parent Market Product ID', `jurisdiction_id` int(11) NOT NULL, `status_id` int(11) NOT NULL, `e_submission_date` date DEFAULT NULL COMMENT 'Estimated Submission Date', `r_submission_date` date DEFAULT NULL COMMENT 'Result Submission Date', `e_regulator_date` date DEFAULT NULL COMMENT 'Estimated Regulator Date', `r_regulator_date` date DEFAULT NULL COMMENT 'Result Regulator Date', `e_approval_date` date DEFAULT NULL, `r_approval_date` date DEFAULT NULL, `e_release_date` date DEFAULT NULL COMMENT 'Estimated Master Release Date', `r_release_date` date DEFAULT NULL COMMENT 'Result Master Release Date', `e_launch_date` date DEFAULT NULL, `r_launch_date` date DEFAULT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`jurisdiction_product_id`), KEY `t_jurisdiction_product_fi1` (`market_product_id`), KEY `t_jurisdiction_product_fi2` (`jurisdiction_id`), KEY `t_jurisdiction_product_fi3` (`status_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `t_market_product` -- CREATE TABLE IF NOT EXISTS `t_market_product` ( `market_product_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL, `gvn` varchar(30) DEFAULT NULL COMMENT 'Game Version No.', `title` varchar(100) DEFAULT NULL COMMENT 'Game Title', `platform_id` int(11) DEFAULT NULL COMMENT 'Game Platform ID', `branch_id` int(11) DEFAULT NULL COMMENT 'Developed Branch ID', `market_id` int(11) NOT NULL, `game_category_id` int(11) DEFAULT NULL, `game_group_id` int(11) DEFAULT NULL, `type` varchar(100) DEFAULT NULL, `target` varchar(100) DEFAULT NULL, `overview` varchar(200) DEFAULT NULL COMMENT 'Game Overview', `character` varchar(200) DEFAULT NULL COMMENT 'Game Characteristics', `remarks` text, `e_dev_start_date` date DEFAULT NULL COMMENT 'Estimated Development Start Date', `r_dev_start_date` date DEFAULT NULL COMMENT 'Result Development Start Date', `e_dev_finish_date` date DEFAULT NULL COMMENT 'Estimated Development Finish Date', `r_dev_finish_date` date DEFAULT NULL COMMENT 'Result Development Finish Date', `is_active` tinyint(1) NOT NULL DEFAULT '0', `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`market_product_id`), KEY `t_market_product_fi1` (`product_id`), KEY `t_market_product_fi2` (`platform_id`), KEY `t_market_product_fi3` (`branch_id`), KEY `t_market_product_fi4` (`market_id`), KEY `t_market_product_fi5` (`game_category_id`), KEY `t_market_product_fi6` (`game_group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `t_product` -- CREATE TABLE IF NOT EXISTS `t_product` ( `product_id` int(11) NOT NULL AUTO_INCREMENT, `control_id` varchar(20) NOT NULL, `e_artwork_sp_date` date DEFAULT NULL COMMENT 'Estimated Artwork (Sales Promotion) Upload Date', `r_artwork_sp_date` date DEFAULT NULL COMMENT 'Result Artwork (Sales Promotion) Upload Date', `e_gslick_date` date DEFAULT NULL COMMENT 'Estimated G-Slick Upload Date', `r_gslick_date` date DEFAULT NULL COMMENT 'Result G-Slick Upload Date', `e_demo_date` date DEFAULT NULL COMMENT 'Estimated Demo Software Upload Date', `r_demo_date` date DEFAULT NULL COMMENT 'Result Demo Software Upload Date', `e_movie_date` date DEFAULT NULL COMMENT 'Estimated Movie Upload Date', `r_movie_date` date DEFAULT NULL COMMENT 'Result Movie Upload Date', `e_artwork_tr_date` date DEFAULT NULL COMMENT 'Estimated Artwork (Training) Upload Date', `r_artwork_tr_date` date DEFAULT NULL COMMENT 'Result Artwork (Training) Upload Date', `e_website_date` date DEFAULT NULL COMMENT 'Estimated Website Upload Date', `r_website_date` date DEFAULT NULL COMMENT 'Result Website Upload Date', `is_return_demo` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Return Demo Software', `game_image_pass` varchar(100) DEFAULT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`product_id`), UNIQUE KEY `control_id` (`control_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `w_jurisdiction_product` -- CREATE TABLE IF NOT EXISTS `w_jurisdiction_product` ( `jurisdiction_product_id` int(11) NOT NULL AUTO_INCREMENT, `market_product_id` int(11) NOT NULL COMMENT 'Parent Market Product ID', `jurisdiction_id` int(11) NOT NULL, `status_id` int(11) NOT NULL, `e_submission_date` date DEFAULT NULL COMMENT 'Estimated Submission Date', `r_submission_date` date DEFAULT NULL COMMENT 'Result Submission Date', `e_regulator_date` date DEFAULT NULL COMMENT 'Estimated Regulator Date', `r_regulator_date` date DEFAULT NULL COMMENT 'Result Regulator Date', `e_approval_date` date DEFAULT NULL, `r_approval_date` date DEFAULT NULL, `e_release_date` date DEFAULT NULL COMMENT 'Estimated Master Release Date', `r_release_date` date DEFAULT NULL COMMENT 'Result Master Release Date', `e_launch_date` date DEFAULT NULL, `r_launch_date` date DEFAULT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`jurisdiction_product_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `w_market_product` -- CREATE TABLE IF NOT EXISTS `w_market_product` ( `market_product_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL, `gvn` varchar(30) DEFAULT NULL COMMENT 'Game Version No.', `title` varchar(100) DEFAULT NULL COMMENT 'Game Title', `platform_id` int(11) DEFAULT NULL COMMENT 'Game Platform ID', `branch_id` int(11) DEFAULT NULL COMMENT 'Developed Branch ID', `market_id` int(11) NOT NULL, `game_category_id` int(11) DEFAULT NULL, `game_group_id` int(11) DEFAULT NULL, `type` varchar(100) DEFAULT NULL, `target` varchar(100) DEFAULT NULL, `overview` varchar(200) DEFAULT NULL COMMENT 'Game Overview', `character` varchar(200) DEFAULT NULL COMMENT 'Game Characteristics', `remarks` text, `e_dev_start_date` date DEFAULT NULL COMMENT 'Estimated Development Start Date', `r_dev_start_date` date DEFAULT NULL COMMENT 'Result Development Start Date', `e_dev_finish_date` date DEFAULT NULL COMMENT 'Estimated Development Finish Date', `r_dev_finish_date` date DEFAULT NULL COMMENT 'Result Development Finish Date', `is_active` tinyint(1) NOT NULL DEFAULT '0', `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`market_product_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `w_product` -- CREATE TABLE IF NOT EXISTS `w_product` ( `product_id` int(11) NOT NULL AUTO_INCREMENT, `control_id` varchar(20) NOT NULL, `e_artwork_sp_date` date DEFAULT NULL COMMENT 'Estimated Artwork (Sales Promotion) Upload Date', `r_artwork_sp_date` date DEFAULT NULL COMMENT 'Result Artwork (Sales Promotion) Upload Date', `e_gslick_date` date DEFAULT NULL COMMENT 'Estimated G-Slick Upload Date', `r_gslick_date` date DEFAULT NULL COMMENT 'Result G-Slick Upload Date', `e_demo_date` date DEFAULT NULL COMMENT 'Estimated Demo Software Upload Date', `r_demo_date` date DEFAULT NULL COMMENT 'Result Demo Software Upload Date', `e_movie_date` date DEFAULT NULL COMMENT 'Estimated Movie Upload Date', `r_movie_date` date DEFAULT NULL COMMENT 'Result Movie Upload Date', `e_artwork_tr_date` date DEFAULT NULL COMMENT 'Estimated Artwork (Training) Upload Date', `r_artwork_tr_date` date DEFAULT NULL COMMENT 'Result Artwork (Training) Upload Date', `e_website_date` date DEFAULT NULL COMMENT 'Estimated Website Upload Date', `r_website_date` date DEFAULT NULL COMMENT 'Result Website Upload Date', `is_return_demo` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Return Demo Software', `game_image_pass` varchar(100) DEFAULT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `create_user_id` int(11) NOT NULL, `create_time` datetime NOT NULL, `update_user_id` int(11) NOT NULL, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`product_id`), UNIQUE KEY `control_id` (`control_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Constraints for dumped tables -- -- -- Constraints for table `m_user` -- ALTER TABLE `m_user` ADD CONSTRAINT `FK_m_branch_m_user_branch_id` FOREIGN KEY (`branch_id`) REFERENCES `m_branch` (`branch_id`), ADD CONSTRAINT `FK_m_language_m_user_language_id` FOREIGN KEY (`language_id`) REFERENCES `m_language` (`language_id`); -- -- Constraints for table `r_market_jurisdiction` -- ALTER TABLE `r_market_jurisdiction` ADD CONSTRAINT `FK_m_jurisdiction_r_market_jurisdiction_jurisdiction_id` FOREIGN KEY (`jurisdiction_id`) REFERENCES `m_jurisdiction` (`jurisdiction_id`), ADD CONSTRAINT `FK_m_market_r_market_jurisdiction_market_id` FOREIGN KEY (`market_id`) REFERENCES `m_market` (`market_id`); -- -- Constraints for table `r_role_page` -- ALTER TABLE `r_role_page` ADD CONSTRAINT `FK_m_page_r_role_page_page_id` FOREIGN KEY (`page_id`) REFERENCES `m_page` (`page_id`), ADD CONSTRAINT `FK_m_role_r_role_page_role_id` FOREIGN KEY (`role_id`) REFERENCES `m_role` (`role_id`); -- -- Constraints for table `r_user_role` -- ALTER TABLE `r_user_role` ADD CONSTRAINT `FK_m_role_r_user_role_role_id` FOREIGN KEY (`role_id`) REFERENCES `m_role` (`role_id`), ADD CONSTRAINT `FK_m_user_r_user_role_user_id` FOREIGN KEY (`user_id`) REFERENCES `m_user` (`user_id`); -- -- Constraints for table `t_jurisdiction_product` -- ALTER TABLE `t_jurisdiction_product` ADD CONSTRAINT `FK_m_jurisdiction_t_jurisdiction_product_jurisdiction_id` FOREIGN KEY (`jurisdiction_id`) REFERENCES `m_jurisdiction` (`jurisdiction_id`), ADD CONSTRAINT `FK_m_status_t_jurisdiction_product_status_id` FOREIGN KEY (`status_id`) REFERENCES `m_status` (`status_id`), ADD CONSTRAINT `FK_t_market_product_t_jurisdiction_product_market_product_id` FOREIGN KEY (`market_product_id`) REFERENCES `t_market_product` (`market_product_id`); -- -- Constraints for table `t_market_product` -- ALTER TABLE `t_market_product` ADD CONSTRAINT `FK_m_branch_t_product_market_branch_id` FOREIGN KEY (`branch_id`) REFERENCES `m_branch` (`branch_id`), ADD CONSTRAINT `FK_m_game_category_t_product_market_game_category_id` FOREIGN KEY (`game_category_id`) REFERENCES `m_game_category` (`game_category_id`), ADD CONSTRAINT `FK_m_game_group_t_product_market_game_group_id` FOREIGN KEY (`game_group_id`) REFERENCES `m_game_group` (`game_group_id`), ADD CONSTRAINT `FK_m_market_t_product_market_market_id` FOREIGN KEY (`market_id`) REFERENCES `m_market` (`market_id`), ADD CONSTRAINT `FK_m_platform_t_product_market_platform_id` FOREIGN KEY (`platform_id`) REFERENCES `m_platform` (`platform_id`), ADD CONSTRAINT `FK_m_product_t_product_market_product_id` FOREIGN KEY (`product_id`) REFERENCES `t_product` (`product_id`); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/* SQLyog Ultimate v12.09 (64 bit) MySQL - 5.7.28-log : Database - idoctor ********************************************************************* */ /*!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 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/`idoctor` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `idoctor`; /*Table structure for table `idt_area` */ DROP TABLE IF EXISTS `idt_area`; CREATE TABLE `idt_area` ( `id` int(11) NOT NULL COMMENT '主键', `zhou` varchar(50) NOT NULL COMMENT '大洲', `guo` varchar(50) NOT NULL COMMENT '国家', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC; /*Table structure for table `idt_city` */ DROP TABLE IF EXISTS `idt_city`; CREATE TABLE `idt_city` ( `id` int(11) NOT NULL DEFAULT '0', `pid` int(11) DEFAULT NULL, `cityname` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `type` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*Table structure for table `idt_disease` */ DROP TABLE IF EXISTS `idt_disease`; CREATE TABLE `idt_disease` ( `id` varchar(30) NOT NULL COMMENT '疾病id', `name` varchar(30) DEFAULT NULL COMMENT '疾病名称', `classify` varchar(30) DEFAULT NULL COMMENT '分类', `severity` varchar(30) DEFAULT NULL COMMENT '严重程度', `standty` varchar(30) DEFAULT NULL COMMENT '备用', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Table structure for table `idt_hospital` */ DROP TABLE IF EXISTS `idt_hospital`; CREATE TABLE `idt_hospital` ( `id` varchar(30) NOT NULL COMMENT '医院id', `name` varchar(40) DEFAULT NULL COMMENT '医院名称', `level` varchar(30) DEFAULT NULL COMMENT '等级', `type` varchar(30) DEFAULT NULL COMMENT '类型', `health_point` int(4) DEFAULT NULL COMMENT '是否是医保点0不是1是', `beds` varchar(20) DEFAULT NULL COMMENT '病床数', `visits` varchar(20) DEFAULT NULL COMMENT '门诊量', `address` varchar(50) DEFAULT NULL COMMENT '地址', `email` varchar(20) DEFAULT NULL COMMENT '邮箱', `tel` varchar(20) DEFAULT NULL COMMENT '电话', `web` varchar(255) DEFAULT NULL COMMENT '网址', `postcode` varchar(10) DEFAULT NULL COMMENT '邮编', `path` varchar(255) DEFAULT NULL COMMENT '乘车路线', `equipment` varchar(255) DEFAULT NULL COMMENT '主要设备', `subject` varchar(255) DEFAULT NULL COMMENT '特色专科', `introduction` varchar(510) DEFAULT NULL COMMENT '主要介绍', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC; /*Table structure for table `idt_medicine` */ DROP TABLE IF EXISTS `idt_medicine`; CREATE TABLE `idt_medicine` ( `id` varchar(30) NOT NULL COMMENT '药品id', `name` varchar(30) DEFAULT NULL COMMENT '药品名称', `manufacturer` varchar(30) DEFAULT NULL COMMENT '出产商', `classification` varchar(30) DEFAULT NULL COMMENT '分类', `evaluation` int(30) DEFAULT NULL COMMENT '评价', `standby` varchar(20) DEFAULT NULL COMMENT '备用', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Table structure for table `idt_medicinedetail` */ DROP TABLE IF EXISTS `idt_medicinedetail`; CREATE TABLE `idt_medicinedetail` ( `id` bigint(20) NOT NULL COMMENT '药品对应疾病记录id', `medicineid` varchar(30) DEFAULT NULL COMMENT '药品id', `diseaseid` varchar(30) DEFAULT NULL COMMENT '疾病id', PRIMARY KEY (`id`), KEY `FK_medicinedetail` (`medicineid`), KEY `FK_medicinedetail1` (`diseaseid`), CONSTRAINT `FK_medicinedetail` FOREIGN KEY (`medicineid`) REFERENCES `idt_medicine` (`id`), CONSTRAINT `FK_medicinedetail1` FOREIGN KEY (`diseaseid`) REFERENCES `idt_disease` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Table structure for table `idt_pharmacy` */ DROP TABLE IF EXISTS `idt_pharmacy`; CREATE TABLE `idt_pharmacy` ( `id` varchar(30) NOT NULL COMMENT '药店id', `name` varchar(50) DEFAULT NULL COMMENT '药店名称', `address` varchar(255) DEFAULT NULL COMMENT '药店地址', `continents` varchar(50) DEFAULT NULL COMMENT '大洲', `country` varchar(50) DEFAULT NULL COMMENT '国家', `province` varchar(30) DEFAULT NULL COMMENT '省', `city` varchar(30) DEFAULT NULL COMMENT '市', `tel` int(30) DEFAULT NULL COMMENT '电话', `evaluation` int(10) DEFAULT NULL COMMENT '评分', `standby` varchar(20) DEFAULT NULL COMMENT '备用', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Table structure for table `idt_post` */ DROP TABLE IF EXISTS `idt_post`; CREATE TABLE `idt_post` ( `id` bigint(20) NOT NULL COMMENT '帖子id', `posterid` varchar(30) DEFAULT NULL COMMENT '发帖人', `time` datetime DEFAULT NULL COMMENT '时间', `title` varchar(30) DEFAULT NULL COMMENT '标题', `subtitle` varchar(30) DEFAULT NULL COMMENT '副标题', `content` varchar(255) DEFAULT NULL COMMENT '正文', `pic` varchar(255) DEFAULT NULL COMMENT '图片url', `standby` varchar(30) DEFAULT NULL COMMENT '备用', PRIMARY KEY (`id`), KEY `FK_post` (`posterid`), CONSTRAINT `FK_post` FOREIGN KEY (`posterid`) REFERENCES `idt_user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Table structure for table `idt_record` */ DROP TABLE IF EXISTS `idt_record`; CREATE TABLE `idt_record` ( `id` varchar(30) NOT NULL COMMENT '档案id', `userid` varchar(30) DEFAULT NULL COMMENT '用户id', `time` datetime DEFAULT NULL COMMENT '时间', `content` varchar(255) DEFAULT NULL COMMENT '内容', `pic` varchar(255) DEFAULT NULL COMMENT '图片url', `standby` varchar(20) DEFAULT NULL COMMENT '备用', PRIMARY KEY (`id`), KEY `FK_record` (`userid`), CONSTRAINT `FK_record` FOREIGN KEY (`userid`) REFERENCES `idt_user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Table structure for table `idt_reply` */ DROP TABLE IF EXISTS `idt_reply`; CREATE TABLE `idt_reply` ( `id` bigint(20) NOT NULL COMMENT '回复id', `postid` bigint(20) DEFAULT NULL COMMENT '主贴id', `time` datetime DEFAULT NULL COMMENT '时间', `replier` varchar(30) DEFAULT NULL COMMENT '回复人id', `content` varchar(255) DEFAULT NULL COMMENT '回复内容', `pic` varchar(255) DEFAULT NULL COMMENT '回复图片url', `standby` varchar(20) DEFAULT NULL COMMENT '备用', PRIMARY KEY (`id`), KEY `FK_reply` (`postid`), KEY `FK_reply1` (`replier`), CONSTRAINT `FK_reply` FOREIGN KEY (`postid`) REFERENCES `idt_post` (`id`), CONSTRAINT `FK_reply1` FOREIGN KEY (`replier`) REFERENCES `idt_user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Table structure for table `idt_tweets` */ DROP TABLE IF EXISTS `idt_tweets`; CREATE TABLE `idt_tweets` ( `id` varchar(30) NOT NULL COMMENT '推文id', `title` varchar(50) DEFAULT NULL COMMENT '主标题', `subtitle` varchar(50) DEFAULT NULL COMMENT '副标题', `content` varchar(1020) DEFAULT NULL COMMENT '内容', `pic` varchar(255) DEFAULT NULL COMMENT '图片url', `authorid` varchar(30) DEFAULT NULL COMMENT '作者id', `time` datetime DEFAULT NULL COMMENT '时间', `standby` varchar(30) DEFAULT NULL COMMENT '备用', PRIMARY KEY (`id`), KEY `FK_tweets` (`authorid`), CONSTRAINT `FK_tweets` FOREIGN KEY (`authorid`) REFERENCES `idt_user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*Table structure for table `idt_user` */ DROP TABLE IF EXISTS `idt_user`; CREATE TABLE `idt_user` ( `id` varchar(30) NOT NULL COMMENT '用户id', `identity` varchar(255) DEFAULT NULL COMMENT '身份认证', `credibility` int(50) DEFAULT NULL COMMENT '信誉值', `pic` varchar(255) DEFAULT NULL COMMENT '用户头像', `name` varchar(50) DEFAULT NULL COMMENT '用户名', `password` varchar(50) DEFAULT NULL COMMENT '密码md5加密', `standby` varchar(20) DEFAULT NULL COMMENT '备用', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!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 */;
START TRANSACTION ; ALTER SEQUENCE marc_id_seq RESTART WITH 1; ALTER SEQUENCE model_car_id_seq RESTART WITH 1; ALTER SEQUENCE body_id_seq RESTART WITH 1; ALTER SEQUENCE characteristic_id_seq RESTART WITH 1; insert into marc(marc) values('honda'); insert into marc(marc) values('volkswagen'); insert into marc(marc) values('kia'); insert into marc(marc) values('chevrolet'); insert into model_car(model) values( 'cr-v'); insert into model_car(model) values('touareg'); insert into model_car(model) values('rio'); insert into model_car(model) values('camaro'); insert into body(name_body) values ('crossover'); insert into body(name_body) values ('sedan'); insert into body(name_body) values ('coupe'); insert into characteristic(id_marc, id_model, id_body, year_issue, color, volume, price) values (1, 1, 1, 2019, 'grey',2.0, 2000000); insert into characteristic(id_marc, id_model, id_body, year_issue, color, volume, price) values (2, 2, 1, 2017, 'red',2.8, 5000000); insert into characteristic(id_marc, id_model, id_body, year_issue, color, volume, price) values (3, 3, 2, 2018, 'brown',1.8, 1200000); insert into characteristic(id_marc, id_model, id_body, year_issue, color, volume, price) values (4, 4, 3, 2013, 'grey',2.3, 2000000); COMMIT;
CREATE Procedure sp_acc_rpt_loadreportheader(@parentid INT) As Select * from FAReportData where [ParentID]=@parentid and [Display]=1 and ReportID Not In (112,114,116) order by ReportOrder,ReportID
#select * from bugs; select count(open_date) from bugs WHERE close_date IS NULL AND open_date >= STR_TO_DATE('01-01-2012', '%d-%m-%Y') AND open_date <= STR_TO_DATE('25-02-2012', '%d-%m-%Y');
CREATE TABLE cars (id INT NOT NULL Primary key AUTO_INCREMENT, make VARCHAR(20), model VARCHAR(20), colour VARCHAR(20), price DOUBLE, vin INT, dealership VARCHAR(30)); INSERT INTO cars VALUES (1, 'Ferrari', 'F8 Tributo', 'Red', 450000, 123, 'Dealership One'), (2, 'Ferrari', 'SP90 Stradale', 'Red', 500000, 122, 'Dealership Two'), (3, 'Ferrari', '812 GTS', 'Red', 700000, 124, 'Dealership Three'), (4, 'Lamborghini', 'Aventador', 'Green', 200000, 12354, 'Dealership One'), (5, 'Lamborghini', 'Huracan', 'Red', 350000, 1227, 'Dealership Three'), (6, 'Lamborghini', 'Sián FKP 37', 'Red', 1200000, 1239, 'Dealership Three'), (7, 'McLaren', '540C', 'Orange', 500000, 12309, 'Dealership Three'), (8, 'McLaren', '570S Coupe', 'Red', 400000, 12378, 'Dealership Three'), (9, 'Pagani', 'Huayra', 'Grey', 900000, 12973, 'Dealership Three'), (10, 'Pagani', 'Zonda', 'Grey', 800000, 123789, 'Dealership Three'); Create TABLE dealerships (id INT NOT NULL Primary key AUTO_INCREMENT, dealershipName VARCHAR(30)); INSERT INTO dealerships VALUES (1, 'Dealership One'), (2, 'Dealership Two'), (3, 'Dealership Three');
-- Creates new rows containing data in all named columns -- INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Echo","Electronics", 79.99, 107); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Crock Pot","Home and Kitchen", 99.95, 43); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Patio Heater","Lawn and Garden", 69.99, 58); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Fire Stick","Electronics", 29.99, 166); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Camping Lantern","Lawn and Garden", 19.95, 141); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Fit Bit","Electronics", 99.95, 82); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Bluetooth Headphones","Sports and Outdoors", 23.99, 115); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Coconut Oil","Beauty and Personal Care", 12.95, 189); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("Massage Oil","Beauty and Personal Care", 13.95, 77); INSERT INTO products (product_name, department_name, price, stock_quantity) VALUES ("GPS","Electronics", 179.99, 30); -- Shows the created products table SELECT * FROM products;
CREATE TABLE `user` ( `id` INT(10) NOT NULL AUTO_INCREMENT, `business_unit_id` INT(10) NOT NULL, `role_id` INT(10) NOT NULL, `first_name` VARCHAR(35) NOT NULL, `last_name` VARCHAR(35) NOT NULL, `username` VARCHAR(35) NOT NULL, `email` VARCHAR(255) NOT NULL, `password` VARCHAR(255) NOT NULL, `salt` VARCHAR(255) NULL DEFAULT NULL, `last_login` DATETIME NULL DEFAULT NULL, `status` ENUM('active','inactive') NULL DEFAULT 'active', `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL, PRIMARY KEY (`id`), INDEX `business_unit_id` (`business_unit_id`), INDEX `role_id_version` (`role_id`), CONSTRAINT `user_ibfk_1` FOREIGN KEY (`business_unit_id`) REFERENCES `business_unit` (`id`) ON UPDATE CASCADE ON DELETE CASCADE, CONSTRAINT `user_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON UPDATE CASCADE ON DELETE CASCADE ) COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=4 ;
/* Name : vwPersonProfilePlan Object Type: VIEW Dependency : vwPersonProfile(VIEW), TRAINING_PLAN(TABLE) */ use BIGGYM; create or replace view vwPersonProfilePlan as select plan.ID PLANid, vwPP.*, plan.NAME PLAN_NAME, plan.private, plan.C_CREATE PLAN_REGISTRATION, round(datediff(curdate(), plan.C_LASTMOD), 1) PLAN_AGE from vwPersonProfile vwPP, TRAINING_PLAN plan where vwPP.PERSONPROFILEid = plan.PROFILEid ; select * from vwPersonProfilePlan limit 10;
DELETE FROM user_roles; DELETE FROM dishes; DELETE FROM users; DELETE FROM votes; DELETE FROM restaurants; ALTER SEQUENCE global_seq RESTART WITH 100011; INSERT INTO users (id, name, email, password) VALUES (100000, 'User0', 'user0@yandex.ru', 'password'), (100001, 'User1', 'user1@yandex.ru', 'password'), (100002, 'User2', 'user2@yandex.ru', 'password'), (100003, 'User3', 'user3@yandex.ru', 'password'), (100004, 'User4', 'user4@yandex.ru', 'password'), (100005, 'User5', 'user5@yandex.ru', 'password'), (100006, 'User6', 'user6@yandex.ru', 'password'), (100007, 'User7', 'user7@yandex.ru', 'password'), (100008, 'User8', 'user8@yandex.ru', 'password'), (100009, 'User9', 'user9@yandex.ru', 'password'), (100010, 'Admin', 'admin@gmail.ru', 'admin'); INSERT INTO user_roles (role, user_id) VALUES ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User0')), ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User1')), ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User2')), ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User3')), ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User4')), ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User5')), ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User6')), ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User7')), ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User8')), ('ROLE_USER', (SELECT users.id FROM users WHERE users.name = 'User9')), ('ROLE_ADMIN', (SELECT users.id FROM users WHERE users.name = 'Admin')); INSERT INTO restaurants (name, address) VALUES ('Stolovka', 'Lenina st.'), ('Restoran', 'Kalinina sq.'), ('Vilka lozhka', 'Kirova st.'), ('Cinnabon', 'Dimirova st.'), ('TomYum', 'Krasny prosp.'), ('Kopeika', 'Bogatkova st.'); INSERT INTO dishes (restaurant_id, date, name, price) VALUES ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Stolovka'), '2017-05-01', 'Завтрак в столовке', 100), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Stolovka'), '2017-05-01', 'Обед в столовке', 100), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Stolovka'), '2017-05-01', 'Ужин в столовке', 100), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Restoran'), '2017-05-01', 'Завтрак в ресторане', 500), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Restoran'), '2017-05-01', 'Обед в ресторане', 500), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Restoran'), '2017-05-01', 'Ужин в ресторане', 500), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Vilka lozhka'), '2017-05-01', 'Завтрак в вилке-ложке', 110), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Vilka lozhka'), '2017-05-01', 'Обед в вилке-ложке', 110), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Vilka lozhka'), '2017-05-02', 'Ужин в вилке-ложке', 110), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Cinnabon'), '2017-05-02', 'Завтрак в синнабоне', 150), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Cinnabon'), '2017-05-02', 'Обед в синнабоне', 150), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Cinnabon'), '2017-05-02', 'Ужин в синнабоне', 150), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'TomYum'), '2017-05-02', 'Завтрак в Том-Ям', 300), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'TomYum'), '2017-05-02', 'Обед в Том-Ям', 300), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'TomYum'), '2017-05-02', 'Ужин в Том-Ям', 300), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Kopeika'), '2017-05-02', 'Завтрак в копейке', 50), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Kopeika'), '2017-05-02', 'Обед в копейке', 50), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Kopeika'), '2017-05-02', 'Ужин в копейке', 50); INSERT INTO votes (restaurant_id, user_id) VALUES ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Vilka lozhka'), (SELECT users.id FROM users WHERE users.name = 'User0')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Vilka lozhka'), (SELECT users.id FROM users WHERE users.name = 'User1')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Restoran'), (SELECT users.id FROM users WHERE users.name = 'User2')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Restoran'), (SELECT users.id FROM users WHERE users.name = 'User3')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Restoran'), (SELECT users.id FROM users WHERE users.name = 'User4')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Cinnabon'), (SELECT users.id FROM users WHERE users.name = 'User5')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Kopeika'), (SELECT users.id FROM users WHERE users.name = 'User6')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Kopeika'), (SELECT users.id FROM users WHERE users.name = 'User7')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Kopeika'), (SELECT users.id FROM users WHERE users.name = 'User8')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'Kopeika'), (SELECT users.id FROM users WHERE users.name = 'User9')), ((SELECT restaurants.id FROM restaurants WHERE restaurants.name = 'TomYum'), (SELECT users.id FROM users WHERE users.name = 'Admin'));
ALTER TABLE customers ADD COLUMN postal_code CHAR(8) NOT NULL;
 sp_rename 'Table', 'UserData'
-- MySQL Script generated by MySQL Workbench -- Wed Nov 2 15:18:20 2016 -- Model: New Model Version: 1.0 -- 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='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema seng2050a3_java -- ----------------------------------------------------- DROP SCHEMA IF EXISTS `seng2050a3_java` ; -- ----------------------------------------------------- -- Schema seng2050a3_java -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `seng2050a3_java` DEFAULT CHARACTER SET utf8 ; USE `seng2050a3_java` ; -- ----------------------------------------------------- -- Table `seng2050a3_java`.`roles` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `seng2050a3_java`.`roles` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `title_UNIQUE` (`title` ASC)) ENGINE = InnoDB AUTO_INCREMENT = 3 DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `seng2050a3_java`.`users` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `seng2050a3_java`.`users` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `firstName` VARCHAR(255) NOT NULL, `lastName` VARCHAR(255) NOT NULL, `phoneNumber` VARCHAR(255) NULL DEFAULT NULL, `email` VARCHAR(255) NOT NULL, `password` VARCHAR(255) NOT NULL, `role` INT(11) NULL DEFAULT NULL, `notification` TINYINT(1) NOT NULL, `notification_text` VARCHAR(255) NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `email_UNIQUE` (`email` ASC), INDEX `role_idx` (`role` ASC), CONSTRAINT `role` FOREIGN KEY (`role`) REFERENCES `seng2050a3_java`.`roles` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 9 DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `seng2050a3_java`.`issueCategories` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `seng2050a3_java`.`issueCategories` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `title_UNIQUE` (`title` ASC)) ENGINE = InnoDB AUTO_INCREMENT = 6 DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `seng2050a3_java`.`issueStatuses` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `seng2050a3_java`.`issueStatuses` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `title_UNIQUE` (`title` ASC)) ENGINE = InnoDB AUTO_INCREMENT = 10 DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `seng2050a3_java`.`issues` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `seng2050a3_java`.`issues` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(255) NOT NULL, `description` LONGTEXT NULL DEFAULT NULL, `resolution` LONGTEXT NULL DEFAULT NULL, `category` INT(11) NOT NULL, `userId` INT(11) NOT NULL, `status` INT(11) NOT NULL, `created` DATETIME NOT NULL, `resolved` DATETIME NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `userId_idx` (`userId` ASC), INDEX `status_idx` (`status` ASC), INDEX `category_idx` (`category` ASC), CONSTRAINT `category` FOREIGN KEY (`category`) REFERENCES `seng2050a3_java`.`issueCategories` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `status` FOREIGN KEY (`status`) REFERENCES `seng2050a3_java`.`issueStatuses` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `userId` FOREIGN KEY (`userId`) REFERENCES `seng2050a3_java`.`users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 134 DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `seng2050a3_java`.`comments` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `seng2050a3_java`.`comments` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `issueId` INT(11) NOT NULL, `user` INT(11) NULL DEFAULT NULL, `comment` LONGTEXT NOT NULL, `public` TINYINT(1) NOT NULL DEFAULT '1', `created` DATETIME NOT NULL, PRIMARY KEY (`id`), INDEX `issueId_idx` (`issueId` ASC), INDEX `comment_userId` (`user` ASC), CONSTRAINT `comment_userId` FOREIGN KEY (`user`) REFERENCES `seng2050a3_java`.`users` (`id`), CONSTRAINT `issueId` FOREIGN KEY (`issueId`) REFERENCES `seng2050a3_java`.`issues` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB AUTO_INCREMENT = 59 DEFAULT CHARACTER SET = utf8; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
INSERT INTO `addon_account` (`name`, `label`, `shared`) VALUES ('society_miner','Mineur',1) ; INSERT INTO `addon_inventory` (`name`, `label`, `shared`) VALUES ('society_miner','Mineur', 1) ; INSERT INTO `datastore` (`name`, `label`, `shared`) VALUES ('society_miner', 'Mineur', 1) ; INSERT INTO `jobs`(`name`, `label`, `whitelisted`) VALUES ('miner', 'Mineur', 1) ; INSERT INTO `job_grades` (id, job_name, grade, name, label, salary, skin_male, skin_female) VALUES (37,'miner',0,'recrue','Intérimaire', 250, '{"tshirt_1":59,"tshirt_2":0,"torso_1":56,"torso_2":0,"shoes_1":7,"shoes_2":2,"pants_1":9, "pants_2":7, "arms":0, "helmet_1":0, "helmet_2":3,"bags_1":0,"bags_2":0,"ears_1":0,"glasses_1":0,"ears_2":0,"glasses_2":0}','{}'), (38,'miner',1,'novice','Employer', 500, '{"tshirt_1":59,"tshirt_2":0,"torso_1":56,"torso_2":0,"shoes_1":7,"shoes_2":2,"pants_1":9, "pants_2":7, "arms":0, "helmet_1":0, "helmet_2":3,"bags_1":0,"bags_2":0,"ears_1":0,"glasses_1":0,"ears_2":0,"glasses_2":0}','{}'), (39,'miner',2,'cdisenior','Adjoint', 750, '{"tshirt_1":59,"tshirt_2":0,"torso_1":56,"torso_2":0,"shoes_1":7,"shoes_2":2,"pants_1":9, "pants_2":7, "arms":0, "helmet_1":0, "helmet_2":3,"bags_1":0,"bags_2":0,"ears_1":0,"glasses_1":0,"ears_2":0,"glasses_2":0}','{}'), (40,'miner',3,'boss','Patron', 1000,'{"tshirt_1":59,"tshirt_2":0,"torso_1":56,"torso_2":0,"shoes_1":7,"shoes_2":2,"pants_1":9, "pants_2":7, "arms":0, "helmet_1":0, "helmet_2":3,"bags_1":0,"bags_2":0,"ears_1":0,"glasses_1":0,"ears_2":0,"glasses_2":0}','{}') ; INSERT INTO `items` (`name`, `label`) VALUES ('stone', 'Pierre'), ('washed_stone', 'Pierre Lavée'), ('copper', 'Cuivre'), ('iron', 'Fer', ('gold', 'Or'), ('diamond', 'Diamant') ;
DROP TABLE RENTALINFO CASCADE CONSTRAINTS; DROP TABLE payment CASCADE CONSTRAINTS; DROP TABLE CUSTOMERLOCATION CASCADE CONSTRAINTS; DROP TABLE artworkPurchased CASCADE CONSTRAINTS; DROP TABLE art_order CASCADE CONSTRAINTS; DROP TABLE artwork CASCADE CONSTRAINTS; DROP TABLE exhibition CASCADE CONSTRAINTS; DROP TABLE SPECIFIC_ADDRESS CASCADE CONSTRAINTS; DROP TABLE BROAD_ADDRESS CASCADE CONSTRAINTS; DROP TABLE customer CASCADE CONSTRAINTS; DROP TABLE artist CASCADE CONSTRAINTS; CREATE TABLE artist ( ArtistID NUMBER PRIMARY KEY, Firstname VARCHAR2(25) NOT NULL, Lastname VARCHAR2(25) NOT NULL, Email VARCHAR(40), PhoneNumber VARCHAR2(12), LocationID NUMBER UNIQUE NOT NULL); CREATE TABLE customer ( CustomerID NUMBER PRIMARY KEY, FirstName VARCHAR2(25) NOT NULL, LastName VARCHAR2(25) NOT NULL, Email VARCHAR(40) NOT NULL, PhoneNumber VARCHAR2(12)); SELECT COUNT(CustomerID) AS Number_of_Customers from customer; SELECT COUNT(ArtworkID) AS Number_of_Sculptures from artwork WHERE typeArt='Sculpture'; CREATE TABLE "SPECIFIC_ADDRESS" ( LocationID NUMBER PRIMARY KEY, StreetAddress VARCHAR2(25), PostalCode VARCHAR2(25) ); SELECT LocationID, StreetAddress, PostalCode from SPECIFIC_ADDRESS WHERE NOT StreetAddress like '%Sesame%'; CREATE TABLE "BROAD_ADDRESS"( PostalCode VARCHAR2(25) PRIMARY KEY, CITY VARCHAR2(25), COUNTRY VARCHAR2(25)); CREATE TABLE exhibition ( ExhibitionID NUMBER PRIMARY KEY, Gallery_Title VARCHAR(50), StartDate DATE, EndDate DATE); CREATE TABLE artwork ( ArtworkID NUMBER PRIMARY KEY, ArtistID NUMBER REFERENCES artist(ArtistID), NameArt VARCHAR2(100), ExhibitionID NUMBER REFERENCES exhibition(ExhibitionID), DateAdded DATE NOT NULL, SizeArt VARCHAR2(20) NOT NULL, Price NUMBER, TypeArt VARCHAR(40), MediumArt VARCHAR(50), TimePeriod VARCHAR(15), YearCreated NUMBER ); SELECT ArtworkID, NameArt, Price from artwork where price < 3000; CREATE TABLE art_order ( OrderID NUMBER PRIMARY KEY, CustomerID NUMBER REFERENCES customer(CustomerID), DELIVERY_DATE DATE NOT NULL, RentalID NUMBER UNIQUE ); CREATE TABLE artworkPurchased( OrderID NUMBER REFERENCES art_order(OrderID), ArtworkID NUMBER REFERENCES artwork(ArtworkID)); CREATE TABLE "CUSTOMERLOCATION"( "CustomerID" NUMBER REFERENCES customer(CustomerID), "LocationID" NUMBER REFERENCES SPECIFIC_ADDRESS(LocationID)); CREATE TABLE payment ( PaymentID NUMBER PRIMARY KEY, OrderID NUMBER REFERENCES art_order(OrderID) NOT NULL, CustomerID NUMBER REFERENCES customer(CustomerID) NOT NULL, PaymentAmount NUMBER NOT NULL, DatePayment DATE NOT NULL); CREATE TABLE "RENTALINFO"( "RentalID" NUMBER PRIMARY KEY REFERENCES art_order(RentalID), "RentalStartDate" DATE NOT NULL, "RentalLength" NUMBER ); INSERT INTO artist VALUES (123, 'Dawn', 'Lol', 'lol@gmail.com', '6471234567', 00001); INSERT INTO artist VALUES (456, 'Smith', 'Jones', 'sje@gmail.com', '4167898907', 00002); INSERT INTO artist VALUES (789, 'Lee', 'Li', 'leelol@gmail.com', '4136547890', 00003); INSERT INTO artist VALUES (367, 'Sally', 'Hong', 'bluesky@yahoo.ca', '6475781265', 00004); INSERT INTO artist VALUES (148, 'James', 'Lone', 'jleartist@gmail.com', '4134563421', 00005); INSERT INTO artist VALUES (001,'Leo','Da Vinci', '', '', 00006); INSERT INTO artist VALUES (007,'Leonardo','Capablanca','leoartsales@gmail.com', '441342634990', 00007); INSERT INTO artist VALUES (333,'Kyle','Denise', 'slmyartkyle@gmail.com', '8896342111', 00008); INSERT INTO artist VALUES (432,'Taylor','Octavian','taywrkmadd@gmail.com', '99345234428', 00009); INSERT INTO artist VALUES (578,'Sophia','Charlemagne', '', '', 00010); INSERT INTO artist VALUES (912,'Anthony','Constantinous', 'anyforsalem@gmail.com', '90421563421', 00011); INSERT INTO artist VALUES (754,'Kendrick','Van Gogh', '', '', 00012); INSERT INTO artist VALUES (332,'Louis','Picasso','', '', 00013); INSERT INTO artist VALUES (719,'Seagle','Aivazovsky', '', '', 00014); INSERT INTO artist VALUES (900,'Tyler','Willendorf','germartistmai@gmail.com', '8914574423', 00015); INSERT INTO artist VALUES (891,'Pablo','Southerland', 'jennysellsart@gmail.com', '6784543234', 00016); INSERT INTO artist VALUES (783,'Jean-Antoine','Watteau','', '', 00017); INSERT INTO artist VALUES (549,'Paul','Dillet','randomgall@gmail.com', '8893455678', 00018); INSERT INTO artist VALUES (130,'Albert','Neuhuys','albertsales34@gmail.com', '1134373422', 00019); INSERT INTO exhibition VALUES (1,'Oldendel', '2020-1-08','2020-1-15'); INSERT INTO exhibition VALUES (2,'Tulipshaw', '2019-2-08','2019-2-15'); INSERT INTO exhibition VALUES (3,'Relicmilie', '2019-2-08','2019-2-20'); INSERT INTO exhibition VALUES (4,'Skipleaf', '2019-3-18','2019-3-25'); INSERT INTO exhibition VALUES (5,'Leafmill', '2019-3-18','2019-3-25'); INSERT INTO artwork VALUES (4560, 123, 'uhm', 1, '2019-12-17', 'Medium', 2345,'Painting', 'Oil on Canvas','1900s', 2016); INSERT INTO artwork VALUES (7891, 456, 'Bleu', 2, '2019-2-08', 'Large', 1356,'Painting', 'Acrylic on Canvas','1950-Present', 2019); INSERT INTO artwork VALUES (2345, 789, 'Oythus', 3, '2019-2-08', 'Large', 1098,'Painting', 'Watercolor on Hot Pressed Paper','1950-Present', 2003); INSERT INTO artwork VALUES (6778, 367, 'Rackaro', 4, '2019-3-18', 'Large', 5000,'Statue', 'Copper','1950-Present', 2006); INSERT INTO artwork VALUES (8674, 148, 'Lenveyas', 5, '2019-3-18', 'Large', 5670,'Statue', 'Copper','1950-Present', 2019); INSERT INTO artwork VALUES (1049, 1,'Amour', 5, '2019-7-20', 'Small', 9670,'Painting', 'Oil on Canvas','Renaissance', 1490); INSERT INTO artwork VALUES (7369, 7,'Belle Nuit', 1, '2019-2-25', 'Medium', 5010,'Painting', 'Tempera','1950-Present', 2000); INSERT INTO artwork VALUES (9730, 333,'La Ciel', 1, '2019-10-01', 'Large', 9080,'Statue', 'Marble','1950-Present', 1990); INSERT INTO artwork VALUES (4999, 432,'War and Peace', 2, '2019-12-19', 'Medium', 7000,'Sculpture', 'Marble','1900s', 1940); INSERT INTO artwork VALUES (9764, 578,'Lords', 2, '2019-12-19', 'Large', 2323,'Painting', 'Pastel','Neoclassical', 1803); INSERT INTO artwork VALUES (6892, 912,'Prince Augusto', 2, '2019-12-19', 'Large', 1089,'Painting', 'Acrylic on Canvas','1900s', 1949); INSERT INTO artwork VALUES (3436, 754,'Silent Night', 3, '2019-2-25', 'Small', 7171,'Sculpture', 'Ivory','Medieval', 1343); INSERT INTO artwork VALUES (5313, 332,'Outers', 3, '2019-2-25', 'Small', 8899,'Sculpture', 'Marble','Romantic', 1842); INSERT INTO artwork VALUES (6604, 900,'Glory', 1, '2019-2-25', 'Small', 6899,'Sculpture', 'Marble','1950-Present', 1954); INSERT INTO artwork VALUES (1340, 891,'Dimension', 1, '2019-2-25', 'Small', 9999,'Sculpture', 'Marble','1950-Present', 2007); INSERT INTO artwork VALUES (4949, 783,'Calm', 4, '2019-4-12', 'Large', 4591,'Painting', 'Oil on Canvas','Baroque', 1940); INSERT INTO artwork VALUES (9814, 549,'Calamity', 4, '2019-4-13', 'Large', 6735,'Painting', 'Acrylic on Canvas','1950-Present', 1967); INSERT INTO artwork VALUES (6645, 130,'Reflection', 4, '2019-2-25', 'Small', 8899,'Sculpture', 'Gypsum','Realistic', 1895); INSERT INTO customer VALUES (00982,'Tom','Nook', 'randomemail@yahoo.com','212-234-3344'); INSERT INTO customer VALUES (00983,'Timmy','Nook', 'randomemail1@yahoo.com','212-456-3646'); INSERT INTO customer VALUES (00984,'Tommy','Nook', 'randomemail2@yahoo.com','212-789-3567'); INSERT INTO customer VALUES (00985,'Thomas','Nook', 'email@gmail.com','312-264-2354'); INSERT INTO customer VALUES (00986,'Tome','Nook', 'email@gmail.com','312-316-6666'); INSERT INTO customer VALUES (00987,'Timothy','Nook', 'email@gmail.com','312-387-3264'); INSERT INTO specific_address VALUES(00001, '123 Cherry Lane', 'A1AB1B'); INSERT INTO specific_address VALUES(00002, '456 Cherry Lane', 'A1AB1B'); INSERT INTO specific_address VALUES(00004, '123 Main', 'N1N8C8'); INSERT INTO specific_address VALUES(00005, '7 Elgin', 'LOL123'); INSERT INTO specific_address VALUES(00006, '10 Champs Elysees', 'UM4D67'); INSERT INTO specific_address VALUES(00007, '10 Downing Street', 'H1K8G0'); INSERT INTO specific_address VALUES(000020, '123 Sesame Street', '09303'); INSERT INTO specific_address VALUES(000021, '124 Sesame Street', '09303'); INSERT INTO specific_address VALUES(000022, '125 Sesame Street', '09303'); INSERT INTO specific_address VALUES(000023, '126 Sesame Street', '09303'); INSERT INTO specific_address VALUES(000024, '127 Sesame Street', '09303'); INSERT INTO specific_address VALUES(000025, '128 Sesame Street', '09303'); INSERT INTO broad_address VALUES('A1AB1B', 'Toronto', 'CA'); INSERT INTO broad_address VALUES('N1N8C8','Scarborough', 'CA'); INSERT INTO broad_address VALUES('LOL123', 'Brampton', 'CA'); INSERT INTO broad_address VALUES('UM4D67','Markham', 'CA'); INSERT INTO broad_address VALUES('H1K8G0', 'Toronto', 'CA'); INSERT INTO broad_address VALUES('09303', 'New York', 'USA'); INSERT INTO art_order VALUES (100987,982,'2021-4-25',00001); INSERT INTO art_order VALUES (100988,983,'2019-4-30',00002); INSERT INTO art_order VALUES (100989,984,'2019-5-05',00003); INSERT INTO art_order VALUES (100990,985,'2019-2-20',00004); INSERT INTO art_order VALUES (100991,986,'2019-3-18',00005); INSERT INTO art_order VALUES (100992,987,'2021-4-20',00006); INSERT INTO rentalinfo VALUES (00002,'2019-4-30',31); INSERT INTO rentalinfo VALUES (00003,'2019-5-05',60); INSERT INTO rentalinfo VALUES (00004,'2019-2-20',78); INSERT INTO rentalinfo VALUES (00005,'2019-3-18',6); INSERT INTO artworkpurchased VALUES (100987,6645); INSERT INTO artworkpurchased VALUES (100992,9814); INSERT INTO payment VALUES (200987,100987,982,250,'2019-5-01'); INSERT INTO payment VALUES (200988,100988,983,450,'2019-4-29'); INSERT INTO payment VALUES (200989,100989,984,450,'2019-4-30'); INSERT INTO payment VALUES (200990,100990,985,150,'2019-5-01'); INSERT INTO payment VALUES (200991,100991,986,1000,'2019-4-29'); INSERT INTO payment VALUES (200992,100992,987,1249,'2019-4-30'); INSERT INTO customerlocation VALUES (982, 20); INSERT INTO customerlocation VALUES (983, 21); INSERT INTO customerlocation VALUES (984, 22); INSERT INTO customerlocation VALUES (985, 23); INSERT INTO customerlocation VALUES (986, 24); INSERT INTO customerlocation VALUES (987, 25); SELECT 'Average Price of Sculptures', AVG(Price) FROM artwork WHERE TypeArt = 'Sculpture';
(SELECT datname AS banco, pg_database_size(datname) AS tamanho, pg_size_pretty(pg_database_size(datname)) AS tamanho_pretty FROM pg_database WHERE datname NOT IN ('template0', 'template1', 'postgres') ORDER BY tamanho DESC, banco ASC) UNION ALL (SELECT 'TOTAL' AS banco, sum(pg_database_size(datname)) AS tamanho, pg_size_pretty(sum(pg_database_size(datname))) AS tamanho_pretty FROM pg_database WHERE datname NOT IN ('template0', 'template1', 'postgres'));
-- phpMyAdmin SQL Dump -- version 4.3.11 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Apr 22, 2017 at 09:59 PM -- Server version: 5.6.24 -- PHP Version: 5.6.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 utf8 */; -- -- Database: `ardiansyah` -- -- -------------------------------------------------------- -- -- Table structure for table `gurus` -- CREATE TABLE IF NOT EXISTS `gurus` ( `id` int(10) unsigned NOT NULL, `NIP` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `nama_lengkap` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `alamat` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `telpon_guru` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `status_email` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `gurus` -- INSERT INTO `gurus` (`id`, `NIP`, `nama_lengkap`, `alamat`, `telpon_guru`, `status_email`, `created_at`, `updated_at`) VALUES (1, '', 'Ardiansyah', 'Perum. Villa Gading Baru Blok E3 no.12a, Kelurahan Kebalan, Kecamatan Babelan, Kabupaten Bekasi', '', 'ardiansyahpratama95@gmail.com', '2016-12-04 10:16:32', '2016-12-04 10:16:32'), (2, '195105081977031002', 'M. Sutoyo Sukadi, S.Pd', 'Perum Kejaksaan Blok 1 No. 6 Jati Mulya', '0218220116', 'sutoyo123@yahoo.com', '2016-12-05 07:54:16', '2016-12-05 07:54:16'), (3, '196404021984112001', 'Husniah, S.Pd', 'Vila Indah Permai Blok H 27 No.28 Kel. Teluk Pucung Bekasi Utara', '02188970641', 'Husniah23@gmail.com', '2016-12-05 11:17:46', '2017-01-31 08:21:34'), (4, '15262278272262', 'test123', 'situ aja', '02188970641', 'test1234@oke.com', '2017-01-29 15:55:25', '2017-01-29 15:55:25'), (6, '02592682822', 'nanda', 'bekassiiiiiiiii', '262626262', 'bodo@amat.com', '2017-03-20 06:18:15', '2017-03-20 06:18:15'); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE IF NOT EXISTS `migrations` ( `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`migration`, `batch`) VALUES ('2014_10_12_000000_create_users_table', 1), ('2014_10_12_100000_create_password_resets_table', 1), ('2016_08_02_170800_create_pelajars_table', 1), ('2016_08_03_184846_create_nilais_table', 1), ('2016_09_26_194132_create_gurus_table', 2); -- -------------------------------------------------------- -- -- Table structure for table `nilais` -- CREATE TABLE IF NOT EXISTS `nilais` ( `id` int(10) unsigned NOT NULL, `pelajar_id` int(11) NOT NULL, `pelajaran` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `tipe_ujian` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `nilai_ujian` int(11) NOT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `nilais` -- INSERT INTO `nilais` (`id`, `pelajar_id`, `pelajaran`, `tipe_ujian`, `nilai_ujian`, `created_at`, `updated_at`) VALUES (1, 1, 'Matematika', 'UTS', 98, '2016-12-05 11:25:11', '2017-01-26 07:30:12'), (2, 1, 'IPA', 'UAS', 87, '2016-12-05 11:25:41', '2016-12-05 11:25:41'), (3, 1, 'Matematika', 'UAS', 89, '2016-12-05 11:26:29', '2016-12-05 11:26:29'), (4, 1, 'IPA', 'UAS', 85, '2016-12-07 00:09:08', '2016-12-07 00:09:08'), (5, 2, 'IPA', 'UTS', 76, '2016-12-07 00:13:11', '2016-12-07 00:13:11'), (6, 1, 'Matematika', 'UTS', 23, '2017-03-20 06:20:27', '2017-03-20 06:20:42'); -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE IF NOT EXISTS `password_resets` ( `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `pelajars` -- CREATE TABLE IF NOT EXISTS `pelajars` ( `id` int(10) unsigned NOT NULL, `NIS` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `nama_lengkap` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `kelas` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `alamat` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `telpon_pelajar` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `status_email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `pelajars` -- INSERT INTO `pelajars` (`id`, `NIS`, `nama_lengkap`, `kelas`, `alamat`, `telpon_pelajar`, `status_email`, `created_at`, `updated_at`) VALUES (1, '9957050277', 'Anisa Nurfitriasari', '9_5', 'Perum. Taman Wisma Asri 2 Blok H No.27, Bekasi Utara', '08993620345', 'anisanurfitriasari@ymail.com', '2016-12-05 11:23:55', '2016-12-05 11:23:55'), (2, '1234567899999', 'Amry Fajari', '9_1', 'Taman wisma asri blok CC 31 No. 9, Bekasi Utara', '089674256264', 'Amryfajar19@gmail.com', '2016-12-07 00:12:05', '2016-12-07 00:12:05'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) unsigned NOT NULL, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(60) COLLATE utf8_unicode_ci NOT NULL, `nilai_pelajaran` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `ajar_kelas` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `level` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `pelajar_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `guru_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `name`, `email`, `password`, `nilai_pelajaran`, `ajar_kelas`, `level`, `pelajar_id`, `guru_id`, `remember_token`, `created_at`, `updated_at`) VALUES (1, 'Ardiansyah', 'ardiansyahpratama95@gmail.com', '$2y$10$M0wpILckbw.uLD7IRxzsueCsRRK89RubAMvZNCrBrhvatRAhVuuqC', 'Admin', 'semua_kelas', '', '', '1', 'XJqnaRIMiO4Taeexa5o0Yk85TUjxjXP53MBqsBrkzeWcXlRh92KM6CY9runV', '2016-12-04 10:16:32', '2017-04-16 08:01:01'), (2, 'M. Sutoyo Sukadi, S.Pd', 'sutoyoipa', '$2y$10$sqwlzV.KuCuXegAyvx47OesnqrHzBr0O5lY52KMHGSaIJMzRk4WuW', 'IPA', '9', '', '', '2', 'CHB3ZOODBGixf8esYS5ECVHmfkqSuuHRVtKKfL6jludX6YYvkKrEFbcBNagg', '2016-12-05 07:54:17', '2017-01-11 02:46:31'), (3, 'Husniah, S.Pd', 'Husniah23', '$2y$10$PhbaDZnqMmGWvZ8af4jtSeaG9pxjiGTScDFFEU8iWseK1vLvZpWPa', 'Matematika', '9', 'guru', '', '3', 'MdDoRrsh2x46z2kXpP8elP0I1jdp76mSAh6SPYmoo0Npk0hRh7bW7hv48WJM', '2016-12-05 11:17:46', '2017-03-25 21:15:41'), (4, 'Anisa Nurfitriasari', 'anisa96', '$2y$10$927rVjyORuAjtZcGoinjsuAVljkzTcT27q0n5DhEkHdGl8AAphIoO', 'user', '', 'pelajar', '1', '', 'iMveIb2ui3XnKNn6JrBBlNApgyL5J9QspWJ87Zhcvqr6EvWxA4iVVlraiHbw', '2016-12-05 11:23:55', '2017-02-06 16:04:17'), (5, 'Amry Fajari', 'amry123', '$2y$10$3oV/eCTNhh9naFYNqfqKK.qpup0T4/Q70rmBlOX62G8NpdpksC0Ty', 'user', '', '', '2', '', NULL, '2016-12-07 00:12:06', '2016-12-07 00:12:06'), (6, 'test123', 'cuman tes', '$2y$10$pby5e6FT5ayuJ7txoA105edvckADXuIV8EJnHKFHAuvVDEIvfyr5W', 'Matematika', '9', 'guru', '', '4', NULL, '2017-01-29 15:55:25', '2017-01-29 15:55:25'), (8, 'nanda', 'trinanda', '$2y$10$tMcmK1Kldetbz3tTPIWc2uQLszK0qO0Bjffn7hoxssv9iHmqYI3Q6', 'Bahasa Inggris', '9', 'guru', '', '6', '8aPk33syaZ4j55Ob0fGC47OrfIZu2FuH8m1BKL8oSpVelzixo9rLuadH5L5U', '2017-03-20 06:18:15', '2017-03-20 06:21:09'); -- -- Indexes for dumped tables -- -- -- Indexes for table `gurus` -- ALTER TABLE `gurus` ADD PRIMARY KEY (`id`); -- -- Indexes for table `nilais` -- ALTER TABLE `nilais` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`), ADD KEY `password_resets_token_index` (`token`); -- -- Indexes for table `pelajars` -- ALTER TABLE `pelajars` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `NIS` (`NIS`); -- -- 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 `gurus` -- ALTER TABLE `gurus` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `nilais` -- ALTER TABLE `nilais` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `pelajars` -- ALTER TABLE `pelajars` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=9; /*!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 */;
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50712 Source Host : localhost:3306 Source Database : BoJu Target Server Type : MYSQL Target Server Version : 50712 File Encoding : 65001 Date: 2016-10-12 23:29:30 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `tc_report_type` -- ---------------------------- DROP TABLE IF EXISTS `tc_report_type`; CREATE TABLE `tc_report_type` ( `ID` bigint(20) NOT NULL AUTO_INCREMENT, `Name` varchar(225) NOT NULL, `CreateTime` datetime NOT NULL, `CreateBy` bigint(20) NOT NULL, `Description` varchar(2000) NOT NULL, `IsValid` bit(1) NOT NULL, `Type` tinyint(4) NOT NULL COMMENT '报表类型', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of tc_report_type -- ----------------------------
CREATE OR REPLACE PUBLIC SYNONYM work_endorsements_pkg FOR orient.work_endorsements_pkg;
create table supplier ( s_id number(10) primary key, sname varchar(10) ); create table parts ( pid number(10) primary key, pname varchar(20), colour varchar(10) ); create table supply( s_id number(10) references supplier(s_id) on delete cascade, pid number(10) references parts(pid) on delete cascade, quantity number(10), primary key (s_id,pid) ); insert into supplier values(1,'mi'); insert into supplier values(2,'oppo'); insert into supplier values(3,'redmi'); insert into supplier values(4,'realme'); insert into parts values(1,'cord','red'); insert into parts values(2,'nut','blue'); insert into parts values(3,'wire','yellow'); insert into supply values(1,2,10); insert into supply values(2,1,20); insert into supply values(3,1,40); insert into supply values(4,2,20); insert into supply values(1,3,20); insert into supply values(2,3,20); select pid from supply join supplier on supplier.s_id = supply.s_id where sname = 'oppo'; select sname from supplier where s_id in ( select s_id from supply join parts on parts.pid = supply.pid where pname = 'wire' ); delete from parts where colour = 'blue'; begin dbms_output.put_line('Total Supply : '); dbms_output.put_line('s_id pid quantity '); for i in (select * from supply) loop dbms_output.put_line(i.s_id || ' ' || i.pid || ' ' || i.quantity); end loop; update supply set quantity = quantity + (0.05 * quantity); end; /
INSERT INTO burgers (name) VALUES ('cheese'); INSERT INTO burgers (name) VALUES ('italian'); INSERT INTO burgers (name, devoured) VALUES ('avocado', true); INSERT INTO burgers (name, devoured) VALUES ('sushi', true);
DROP DATABASE jarfi; CREATE DATABASE jarfi
.load binary_to_int.dylib select binary_to_int("01010"), binary_to_int("11010"), binary_to_int("0"), binary_to_int("111111111");
INSERT INTO `Matieres`(`Matieres`)VALUES('Maths'); INSERT INTO `Matieres`(`Matieres`)VALUES('Sport'); INSERT INTO `Matieres`(`Matieres`)VALUES('Français'); INSERT INTO `Matieres`(`Matieres`)VALUES('Anglais'); INSERT INTO `Matieres`(`Matieres`)VALUES('Histoire'); INSERT INTO `Matieres`(`Matieres`)VALUES('Géographie');
SELECT * FROM voice WHERE head = ? AND user = ?
INSERT INTO `user` VALUES (1, '', 'Diamondszz', '男', '中国河南', '1997', '我最牛逼!', '123', '123'); INSERT INTO `user` VALUES (2, ' ', 'Diamondszz2号', '女', '河南', '1998', '哈哈哈哈哈', '321', '321');
--set search_path=phalconphpschema; delete from core_crm_customer where mykatastima=:mykatastima; INSERT INTO core_crm_customer( myid, mykatastima, blpublished,fkusercreated,jobremarks, fkgender, fksalutation, fname, lname, email,telland,telmobile) (SELECT contactid,:mykatastima,1,1, contact_no, CASE WHEN salutation='Mrs.' THEN 3 WHEN salutation='Mr' THEN 2 ELSE 1 END, CASE WHEN salutation='Mrs.' THEN 3 WHEN salutation='Mr' THEN 2 ELSE 1 END, firstname, lastname, email, phone, mobile FROM vt2b2bkinaesthesis.vtiger_contactdetails where contactid in ( select crmid from vt2b2bkinaesthesis.vtiger_crmentity where deleted=0 ) order by lastname asc); update core_crm_customer set fkparentlng=id where fkparentlng is null; UPDATE core_crm_customer SET birthday = vt2b2bkinaesthesis.vtiger_contactsubdetails.birthday, telland=homephone FROM vt2b2bkinaesthesis.vtiger_contactsubdetails WHERE core_crm_customer.myid = vt2b2bkinaesthesis.vtiger_contactsubdetails.contactsubscriptionid and mykatastima=:mykatastima; UPDATE core_crm_customer SET countryname1=mailingcountry, prefecture1=mailingstate, townname1=mailingcity, pocname1=mailingpobox, addressname1=mailingstreet from vt2b2bkinaesthesis.vtiger_contactaddress where vtiger_contactaddress.contactaddressid=core_crm_customer.myid and mykatastima=:mykatastima; UPDATE core_crm_customer SET fkcountry1=1 where core_crm_customer.mykatastima=:mykatastima; UPDATE core_crm_customer SET fkprefecture1=core_prefecture.id from core_prefecture where replace(core_crm_customer.prefecture1,' ','')=replace(core_prefecture.title,' ','') and core_crm_customer.mykatastima=:mykatastima; UPDATE core_crm_customer SET fktown1=core_town.id from core_town where replace(core_crm_customer.townname1,' ','')=replace(core_town.title,' ','') and core_crm_customer.mykatastima=:mykatastima; delete from core_crm_addresstype where mykatastima=:mykatastima; INSERT INTO core_crm_addresstype(myid,mykatastima,title) values (1,:mykatastima,'Δνση Αλληλογραφίας'), (2,:mykatastima,'Δνση Κατοικίας'), (3,:mykatastima,'Δνση Τιμολόγησης'); update core_crm_addresstype set fkparentlng=id where fkparentlng is null; delete from core_crm_customer_address where mykatastima=:mykatastima; INSERT INTO core_crm_customer_address( fkcustomer,mykatastima,blpublished, fkaddresstype,addressname, countryname, prefecturename, townname,pocname) ( SELECT id, :mykatastima,1,2,mailingstreet,mailingcountry,mailingstate,mailingcity,mailingpobox FROM vt2b2bkinaesthesis.vtiger_contactaddress,core_crm_customer where myid=contactaddressid); update core_crm_customer_address set fkparentlng=id where fkparentlng is null; update core_crm_customer_address set myid=id where myid is null; delete from core_crm_available_service where mykatastima=:mykatastima; INSERT INTO core_crm_available_service( myid, mykatastima, title, aliasname) (SELECT lblcustomcategoryid,:mykatastima, lblcustomcategory_tks_lblcateg,lblcustomcategory_tks_lblcateg FROM vt2b2bkinaesthesis.vtiger_lblcustomcategory); update core_crm_available_service set fkparentlng=id where fkparentlng is null; delete from core_crm_available_packet_category where mykatastima=:mykatastima; INSERT INTO core_crm_available_packet_category( myid, mykatastima, title) (SELECT servicecategoryid, :mykatastima,servicecategory FROM vt2b2bkinaesthesis.vtiger_servicecategory); delete from core_crm_available_packet where mykatastima=:mykatastima; INSERT INTO core_crm_available_packet( myid, mykatastima, title,remarks, recprice) (SELECT serviceid, :mykatastima, servicename, servicecategory, unit_price FROM vt2b2bkinaesthesis.vtiger_service); UPDATE core_crm_available_packet SET fkavailablepacketcategory=core_crm_available_packet_category.id FROM core_crm_available_packet_category WHERE core_crm_available_packet_category.title = core_crm_available_packet.remarks and core_crm_available_packet_category.mykatastima=core_crm_available_packet.mykatastima; UPDATE core_crm_available_packet SET fkavailableservice=core_crm_available_service.id FROM core_crm_available_service WHERE core_crm_available_packet.title like '%' || core_crm_available_service.title || '%' and core_crm_available_packet.mykatastima=core_crm_available_packet.mykatastima; UPDATE core_crm_available_packet SET fkavailableduration=core_crm_available_duration.id FROM core_crm_available_duration WHERE core_crm_available_duration.totaldays=1 and replace(core_crm_available_packet.title,' ','') in ('PILATESGROUPD/IN','PILATESPRS-M','PILATESPRS-T') and core_crm_available_packet.mykatastima=core_crm_available_duration.mykatastima; UPDATE core_crm_available_packet SET fkavailableduration=core_crm_available_duration.id FROM core_crm_available_duration WHERE core_crm_available_duration.totalmonths=2 and replace(core_crm_available_packet.title,' ','') in ('PILATESGROUP16/2','PILATESGROUP24/2') and core_crm_available_packet.mykatastima=core_crm_available_duration.mykatastima; UPDATE core_crm_available_packet SET fkavailableduration=core_crm_available_duration.id FROM core_crm_available_duration WHERE core_crm_available_duration.totalmonths=1 and replace(core_crm_available_packet.title,' ','') in ('PILATESGROUP4/1','PILATESGROUP8/1','PILATESGROUP12/1','PILATESGROUP16/2','YOGA1/1','YOGA2/1') and core_crm_available_packet.mykatastima=core_crm_available_duration.mykatastima; UPDATE core_crm_available_packet SET fkavailableduration=core_crm_available_duration.id FROM core_crm_available_duration WHERE core_crm_available_duration.totalweeks=1 and replace(core_crm_available_packet.title,' ','') in ('PILATESMAT1/1','PILATESMAT2/1') and core_crm_available_packet.mykatastima=core_crm_available_duration.mykatastima; UPDATE core_crm_available_packet SET fkavailableduration=core_crm_available_duration.id FROM core_crm_available_duration WHERE core_crm_available_duration.totalminutes=30 and replace(core_crm_available_packet.title,' ','') in ('MASSAGE5/30','MASSAGE1/2H') and core_crm_available_packet.mykatastima=core_crm_available_duration.mykatastima; UPDATE core_crm_available_packet SET fkavailableduration=core_crm_available_duration.id FROM core_crm_available_duration WHERE core_crm_available_duration.totalminutes=55 and replace(core_crm_available_packet.title,' ','') in ('MASSAGE5/55''') and core_crm_available_packet.mykatastima=core_crm_available_duration.mykatastima; UPDATE core_crm_available_packet SET fkavailableduration=core_crm_available_duration.id FROM core_crm_available_duration WHERE core_crm_available_duration.totalminutes=60 and replace(core_crm_available_packet.title,' ','') in ('MASSAGE1H') and core_crm_available_packet.mykatastima=core_crm_available_duration.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=5 and replace(core_crm_available_packet.title,' ','') in ('MASSAGE5/30') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=1 and replace(core_crm_available_packet.title,' ','') in ('MASSAGE1/2H') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=5 and replace(core_crm_available_packet.title,' ','') in ('MASSAGE5/55''') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=1 and replace(core_crm_available_packet.title,' ','') in ('MASSAGE1H') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=4 and replace(core_crm_available_packet.title,' ','') in ('PILATESGROUP4/1') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=8 and replace(core_crm_available_packet.title,' ','') in ('PILATESGROUP8/1') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=12 and replace(core_crm_available_packet.title,' ','') in ('PILATESGROUP12/1') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=16 and replace(core_crm_available_packet.title,' ','') in ('PILATESGROUP16/1') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=24 and replace(core_crm_available_packet.title,' ','') in ('PILATESGROUP24/1') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=1 and replace(core_crm_available_packet.title,' ','') in ('PILATESGROUPD/IN') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=1 and replace(core_crm_available_packet.title,' ','') in ('PILATESMAT1/1') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=2 and replace(core_crm_available_packet.title,' ','') in ('PILATESMAT2/1') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=1 and replace(core_crm_available_packet.title,' ','') in ('PILATESPRS-M') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=1 and replace(core_crm_available_packet.title,' ','') in ('PILATESPRS-T') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=1 and replace(core_crm_available_packet.title,' ','') in ('YOGA1/1') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=core_crm_available_total_times.id FROM core_crm_available_total_times WHERE core_crm_available_total_times.totaltimes=2 and replace(core_crm_available_packet.title,' ','') in ('YOGA2/1') and core_crm_available_packet.mykatastima=core_crm_available_total_times.mykatastima; UPDATE core_crm_available_packet SET fktotaltimes=(select id FROM core_crm_available_total_times where mykatastima=:mykatastima and core_crm_available_total_times.totaltimes=0) WHERE fktotaltimes is null and mykatastima=:mykatastima; delete from core_crm_customer_contract where mykatastima=:mykatastima; INSERT INTO core_crm_customer_contract( myid, mykatastima, fkcustomer, dtstart, dtend, totaldays,remarks,fkavailablepacket,fkavailabletaxes,price,totaltimes,donetimes,prevtimes) (SELECT crmid, mykatastima, core_crm_customer.id, start_date, due_date, case when planned_duration='' then 0 else planned_duration::numeric end, contract_no, yphresies, (select id from core_available_taxes where myid=1 and mykatastima=:mykatastima), cf_761, cf_921, cf_923, cf_925 FROM vt2b2bkinaesthesis.vtiger_crmentity, vt2b2bkinaesthesis.vtiger_servicecontracts, core_crm_customer, vt2b2bkinaesthesis.vtiger_servicecontractscf where vtiger_crmentity.crmid=vtiger_servicecontracts.servicecontractsid and vtiger_servicecontractscf.servicecontractsid=crmid and deleted=0 and mykatastima=:mykatastima and myid=sc_related_to); UPDATE core_crm_customer_contract SET fkavailablepacket=core_crm_available_packet.id FROM core_crm_available_packet WHERE core_crm_available_packet.myid=core_crm_customer_contract.fkavailablepacket and core_crm_customer_contract.mykatastima=:mykatastima and core_crm_available_packet.mykatastima=:mykatastima; UPDATE core_crm_customer_contract SET fkavailableservice=core_crm_available_packet.fkavailableservice, title=core_crm_available_packet.title FROM core_crm_available_packet WHERE core_crm_available_packet.id=core_crm_customer_contract.fkavailablepacket and core_crm_customer_contract.mykatastima=:mykatastima; INSERT INTO core_crm_customer_contract_payment( mykatastima, fkcustomercontract, actualpaymenttotal, fkavailabletaxes, fkpaymentreason,fkpaymenttype) (SELECT mykatastima, id, cf_883, fkavailabletaxes, (select id from core_available_payment_reason where myid=1 and mykatastima=:mykatastima), (select id from core_available_payment_type where myid=1 and mykatastima=:mykatastima) FROM core_crm_customer_contract,vt2b2bkinaesthesis.vtiger_servicecontractscf where myid=servicecontractsid and mykatastima=:mykatastima); INSERT INTO core_crm_customer_contract_payment( myid, mykatastima, fkcustomercontract, actualpaymenttotal, actualpaymentwithouttaxis, actualpaymenttaxis, actualdtpayment, fkavailabletaxes, fkpaymentreason, fkpaymenttype, remarks) (SELECT its4you_cashflow4you.cashflow4youid, core_crm_customer.mykatastima, b.fkcustomercontract, cf_969::numeric, cf_973::numeric, cf_971::numeric, paymentdate, (select id from core_available_taxes where myid=1 and mykatastima=:mykatastima), (select id from core_available_payment_reason where myid=2 and mykatastima=:mykatastima), (select id from core_available_payment_type where myid=1 and mykatastima=:mykatastima), cashflow4youname ||' '|| cashflow4you_no||' '||cashflow4you_paymethod FROM vt2b2bkinaesthesis.its4you_cashflow4you , vt2b2bkinaesthesis.its4you_cashflow4youcf, (select min(id) fkcustomercontract,fkcustomer from core_crm_customer_contract group by fkcustomer) b, core_crm_customer where its4you_cashflow4you.cashflow4youid in (select crmid from vt2b2bkinaesthesis.vtiger_crmentity where deleted=0) and cashflow4you_paytype='Incoming' and its4you_cashflow4you.cashflow4youid=its4you_cashflow4youcf.cashflow4youid and contactid =core_crm_customer.myid and core_crm_customer.mykatastima=:mykatastima and b.fkcustomer=core_crm_customer.id); update core_crm_customer_contract_payment set fkavailabletaxes=(select id from core_available_taxes where myid=0 and mykatastima=(select mykatastimadefault from aab2badmin_basesettings)), blppdlbw=1 where id=id and actualpaymenttaxis=0 and mykatastima=:mykatastima;
INSERT INTO behaviours (behaviour) VALUES ('Walking'); INSERT INTO behaviours (behaviour) VALUES ('Resting'); INSERT INTO behaviours (behaviour) VALUES ('Mobbing'); INSERT INTO behaviours (behaviour) VALUES ('Preening'); INSERT INTO behaviours (behaviour) VALUES ('Bathing'); INSERT INTO behaviours (behaviour) VALUES ('Climbing Tree'); INSERT INTO behaviours (behaviour) VALUES ('Pecking'); INSERT INTO behaviours (behaviour) VALUES ('Attacking'); INSERT INTO behaviours (behaviour) VALUES ('Nesting'); INSERT INTO behaviours (behaviour) VALUES ('Pooping'); INSERT INTO behaviours (behaviour) VALUES ('Hovering'); INSERT INTO behaviours (behaviour) VALUES ('Gliding');
create table users( id int, name varchar(50), primary key(id) ); create table questions( id int, name varchar(40), primary key(id) ); create table answers( user_id int, question_id int, `condition` int, created_at datetime default current_timestamp, FOREIGN KEY (user_id) references users(id), FOREIGN KEY (question_id) references questions(id) );
CREATE DEFINER=`root`@`localhost` PROCEDURE `registerCustomer`( IN customername VARCHAR(150), IN customertypeid INT(11), IN dateofbirth DATE, IN lastlogindate DATETIME, IN userid VARCHAR(150), IN password VARCHAR(150), IN secretquestion VARCHAR(400), IN secretanswer VARCHAR(400), IN mobileno VARCHAR(13), IN emailaddress VARCHAR(100), IN customeraddresstype VARCHAR(100), IN houseno INT(6), IN addressline1 VARCHAR(200), IN addressline2 VARCHAR(200), IN city VARCHAR(200), IN state VARCHAR(200), IN country VARCHAR(200), IN zipcode VARCHAR(6), IN createdby VARCHAR(100) ) BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN ROLLBACK; END; START TRANSACTION; INSERT INTO customer (customername, customertypeid, dateofbirth, lastlogindate, userid, password, secretquestion, secretanswer, mobileno, emailaddress, createdby) VALUES (customername, customertypeid, dateofbirth, lastlogindate, userid, password, secretquestion, secretanswer, mobileno, emailaddress, createdby); INSERT INTO customeraddress (customerid, customeraddresstype, houseno, addressline1, addressline2, city, state, country, zipcode, createdby) VALUES (LAST_INSERT_ID(), customeraddresstype, houseno, addressline1, addressline2, city, state, country, zipcode, createdby); SELECT customeraddressid, customerid, customeraddresstype, houseno, addressline1, addressline2, city, state, country, zipcode FROM customeraddress WHERE customerid = LAST_INSERT_ID(); COMMIT; END
Create Procedure mERP_sp_Save_SOImportFlag(@Node nvarchar(25),@FlagValue int) As Begin If not exists(select 'x' from SOimportFlag where Node=@Node) Insert into SOimportFlag(Node,Flag) Select @Node,@FlagValue Else Update SOimportFlag set Flag=@FlagValue where Node=@Node End
--muestra la relacion de orden de desembolso con ls aprobaciones de las diferentes --áreas --******************************************************** --creacion de vista intermedias --******************************************************** -- obteniendo las Id de las ordenes de desembolso pendientes create view vDesembolsoFirmaSolicitante as select codPers,idOP,tipoA from TPersDesem where tipoa =1 -- obteniendo las Id de las ordenes de desembolso aprobadas por gerencia create view vDesembolsosFirmaGerencia as select codPers,idOP,tipoA,estDesem from TPersDesem where tipoA =2 -- obteniendo las Id de las ordenes de desembolso pagadas por Tesoreria create view vDesembolsosFirmaTesoreria as select codPers,idOP,tipoA,estDesem from TPersDesem where tipoa =3 --order by idOP asc -- obteniendo las Id de las ordenes de desembolso entregadas a contabilidad create view vDesembolsosFirmaContabilidad as select codPers,idOP,tipoA,estDesem from TPersDesem where tipoa =4 -- vista para ver las firmas de cada área create view vDesembolsosFirma as select VFS.idOP, VFS.tipoA firmaSolicitante,VFG.estDesem estado_Gere,VFG.tipoA firmaGerencia ,VFT.estDesem estado_Teso, VFT.tipoA firmaTesoreria,VFC.estDesem estado_Conta, VFC.tipoA firmaContabilidad from vDesembolsoFirmaSolicitante VFS left join vDesembolsosFirmaGerencia VFG on VFS.idOP=VFG.idOP left join vDesembolsosFirmaTesoreria VFT on VFS.idOP=VFT.idOP left join vDesembolsosFirmaContabilidad VFC on VFS.idOP=VFC.idOP --obteniendo la suma de pagos para las ordenes de desembolso create view vPagosDesembolso as select idOP ,sum(montoPago) montoPago from TPagoDesembolso where codMon=30 group by idOP --obteniendo la suma de pagos detracciones para las ordenes de desembolso create view vPagoDetraccionDesembolso as select idOp, sum (montoD) montoD from TPagoDesembolso group by idOP --select idOP,montoPago from TPagoDesembolso order by idOP --consulta que muestra create view vSeguimientoDesembolsoPagos as select VOD.fecDes, VOD.idOP, VOD.serie, VOD.nroDes,VOD.monto,isnull(VPD.montoPago,0.0)montoPagado,(VOD.monto - isnull(VPD.montoPago,0.0) ) diferencia ,VOD.montoDet,isnull(VPDE.montoD,0.0) pagoDetraccion,(VOD.montoDet - isnull(VPDE.montoD,0.0)) diferenciaDetra,VOD.simbolo, VOD.obra,VOD.datoReq,Vod.solicitante,vof.estado_gere,vof.firmaSolicitante ,VOF.firmaGerencia,VOF.firmaTesoreria,VOF.firmaContabilidad ,VOD.proveedor,VOD.codIde, VOD.codObra from Vordendesembolsoseguimiento VOD inner join vDesembolsosFirma VOF on VOF.idOP = VOD.idOP left join vPagosDesembolso VPD on VPD.idOP = VOD.idOP left join vPagoDetraccionDesembolso VPDE on VPDE.idOP = VOD.idOP --Condicional para pagos pendientes --where firmaTesoreria is null and firmaGerencia =2 -- condicional para facturas pendientes --where firmaContabilidad is null --verifica si contabilidad --and VOF.estado_Gere=1 select fecDes,idOP,serie,nroDes,simbolo,monto,montoPagado,diferencia,montoDet,pagoDetraccion,diferenciaDetra,proveedor,datoReq,obra,solicitante,codIde from vseguimientoDesembolsoPagos where firmaTesoreria is null and firmaGerencia =2 and estado_gere=1 select fecDes,idOP,serie,nroDes,monto,montoPagado,diferencia,montoDet,pagoDetraccion,diferenciaDetra,simbolo,obra,datoReq,solicitante from vseguimientoDesembolsoPagos where select * from Vordendesembolsoseguimiento select * from vDesembolsosFirma where firmaTesoreria is null and firmaGerencia =2 select * from Vordendesembolsoseguimiento select * from VOrdenDesembolso select vod.IdOP,isnull(SUM(tpa.montoPago),0.00) as pago from VOrdenDesembolsoSeguimiento VOD LEFT join TPagoDesembolso TPA on tpa.idOP =vod.idOP group by vod.IdOP --consulta para mostrar los aprobadores, solicitante, gerencia, tesoreria, etc select idOp,nombre,apellido,Area,Estado,ObserDesem,fecFir from VAprobacionesSeguimiento
--PROBLEM 14 --Select all passengers who have trips. -- Select their full name (first name – last name), plane name, -- trip (in format {origin} - {destination}) and luggage type. -- Order the results by full name (ascending), name (ascending), -- origin (ascending), destination (ascending) and luggage type (ascending). SELECT p.FirstName+' '+LastName AS [Full Name] , plane.Name ,f.Origin+' - '+F.Destination AS [Trip] ,lt.Type FROM Passengers AS p INNER JOIN Tickets AS t ON p.Id=t.PassengerId JOIN Flights AS f ON t.FlightId=f.Id JOIN Planes AS plane ON plane.Id=f.PlaneId JOIN Luggages AS l ON t.LuggageId=l.Id JOIN LuggageTypes AS lt ON l.LuggageTypeId=lt.Id ORDER BY [Full Name],plane.Name,F.Origin,F.Destination,LT.Type
ALTER table boyo_article add `spaceName` varchar(100) COLLATE utf8_unicode_ci NOT NULL;
/*select even ids without duplicates in city*/ select CITY from STATION where MOD(ID,2) = 0 group by CITY; -- first character having vovels Select Distinct CITY from STATION where CITY REGEXP '^[aeiou].*'; -- last character having vovels Select Distinct CITY from STATION where CITY REGEXP '[aeiou]{1}$'; select name from Employee where salary > 2000 and months < 10; -- select trangle or not SELECT CASE WHEN A + B > C AND A+C>B AND B+C>A THEN CASE WHEN A = B AND B = C THEN 'Equilateral' WHEN A = B OR B = C OR A = C THEN 'Isosceles' WHEN A != B OR B != C OR A != C THEN 'Scalene' END ELSE 'Not A Triangle' END FROM TRIANGLES; -- select Nikhil (E) select concat(Name,'(',LEFT(Occupation,1),')') from OCCUPATIONS Order by Name; -- select concat('There are a total of ',COUNT(Occupation),' ',lower(Occupation),'s.') as total from OCCUPATIONS group by Occupation order by total; ---select rows as columns set @r1=0, @r2=0, @r3=0, @r4=0; select min(Doctor), min(Professor), min(Singer), min(Actor) from( select case when Occupation='Doctor' then (@r1:=@r1+1) when Occupation='Professor' then (@r2:=@r2+1) when Occupation='Singer' then (@r3:=@r3+1) when Occupation='Actor' then (@r4:=@r4+1) end as RowNumber, case when Occupation='Doctor' then Name end as Doctor, case when Occupation='Professor' then Name end as Professor, case when Occupation='Singer' then Name end as Singer, case when Occupation='Actor' then Name end as Actor from OCCUPATIONS order by Name ) Temp group by RowNumber
-- MySQL Script generated by MySQL Workbench -- 11/13/18 11:23:14 -- Model: New Model Version: 1.0 -- 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='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema bdGranja -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema bdGranja -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `bdGranja` DEFAULT CHARACTER SET utf8 ; USE `bdGranja` ; -- ----------------------------------------------------- -- Table `bdGranja`.`domicilio` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`domicilio` ( `idDomicilio` INT(11) NOT NULL AUTO_INCREMENT, `calle` VARCHAR(45) NOT NULL, `numero` INT(11) NOT NULL, `localidad` VARCHAR(45) NOT NULL, `provincia` VARCHAR(45) NOT NULL, PRIMARY KEY (`idDomicilio`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`cabaña` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`cabaña` ( `cuit` VARCHAR(45) NOT NULL, `razonSocial` VARCHAR(45) NOT NULL, `domicilio` INT(11) NOT NULL, PRIMARY KEY (`cuit`), INDEX `fk_cabaña_Domicilio1_idx` (`domicilio` ASC), CONSTRAINT `fk_cabaña_Domicilio1` FOREIGN KEY (`domicilio`) REFERENCES `bdGranja`.`domicilio` (`idDomicilio`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`cliente` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`cliente` ( `cuit` VARCHAR(45) NOT NULL, `nombre` VARCHAR(60) NOT NULL, `domicilio` INT(11) NOT NULL, PRIMARY KEY (`cuit`), INDEX `fk_cliente_Domicilio1_idx` (`domicilio` ASC), CONSTRAINT `fk_cliente_Domicilio1` FOREIGN KEY (`domicilio`) REFERENCES `bdGranja`.`domicilio` (`idDomicilio`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`factura` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`factura` ( `idFactura` INT(11) NOT NULL AUTO_INCREMENT, `fecha` DATE NOT NULL, `cliente` VARCHAR(45) NOT NULL, PRIMARY KEY (`idFactura`), INDEX `fk_Factura_Cliente1_idx` (`cliente` ASC), CONSTRAINT `fk_Factura_Cliente1` FOREIGN KEY (`cliente`) REFERENCES `bdGranja`.`cliente` (`cuit`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`genetica` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`genetica` ( `idGenetica` INT(11) NOT NULL, `nombre` VARCHAR(45) NULL DEFAULT NULL, `cabaña` VARCHAR(45) NOT NULL, PRIMARY KEY (`idGenetica`), INDEX `fk_Genetica_Cabaña1_idx` (`cabaña` ASC), CONSTRAINT `fk_Genetica_Cabaña1` FOREIGN KEY (`cabaña`) REFERENCES `bdGranja`.`cabaña` (`cuit`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`plantel` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`plantel` ( `idPlantel` INT(11) NOT NULL, `nombre` VARCHAR(45) NOT NULL, `edadEntrada` INT(11) NULL DEFAULT NULL, `genetica` INT(11) NOT NULL, `fechaEntrada` DATE NULL DEFAULT NULL, `precio` FLOAT NULL DEFAULT NULL, PRIMARY KEY (`idPlantel`), INDEX `fk_Plantel_Genetica1_idx` (`genetica` ASC), CONSTRAINT `fk_Plantel_Genetica1` FOREIGN KEY (`genetica`) REFERENCES `bdGranja`.`genetica` (`idGenetica`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`galpon` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`galpon` ( `idGalpon` INT(11) NOT NULL, `cantidadDeGallinas` INT(11) NULL DEFAULT NULL, `plantel` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`idGalpon`), INDEX `fk_Galpon_Plantel_idx` (`plantel` ASC), CONSTRAINT `fk_Galpon_Plantel` FOREIGN KEY (`plantel`) REFERENCES `bdGranja`.`plantel` (`idPlantel`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`planilla` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`planilla` ( `idPlanilla` INT(11) NOT NULL AUTO_INCREMENT, `fecha` DATE NOT NULL, `cantidadHuevosObtenidos` INT(11) NULL DEFAULT NULL, `cantidadGallinasMuertas` INT(11) NULL DEFAULT NULL, `cantidadAlimento` FLOAT NULL DEFAULT NULL, `tipoAlimento` VARCHAR(45) NULL DEFAULT NULL, `galpon` INT(11) NOT NULL, `novedades` MEDIUMTEXT NULL, PRIMARY KEY (`idPlanilla`), INDEX `fk_Planilla_Galpon1_idx` (`galpon` ASC), CONSTRAINT `fk_Planilla_Galpon1` FOREIGN KEY (`galpon`) REFERENCES `bdGranja`.`galpon` (`idGalpon`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`producto` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`producto` ( `idProducto` INT(11) NOT NULL, `precio` FLOAT NULL DEFAULT NULL, `cantidad` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`idProducto`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`usuario` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`usuario` ( `cuil` INT NOT NULL, `nombre` VARCHAR(45) NULL, `apellido` VARCHAR(45) NULL, `legajoInterno` INT NULL, `usuario` VARCHAR(45) NULL, `password` VARCHAR(45) NULL, PRIMARY KEY (`cuil`), UNIQUE INDEX `legajoInterno_UNIQUE` (`legajoInterno` ASC), UNIQUE INDEX `usuario_UNIQUE` (`usuario` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `bdGranja`.`log` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`log` ( `idLog` INT(11) NOT NULL AUTO_INCREMENT, `fecha` DATE NOT NULL, `cantidadHuevosObtenidos` INT(11) NULL DEFAULT NULL, `cantidadGallinasMuertas` INT(11) NULL DEFAULT NULL, `cantidadAlimento` FLOAT NULL DEFAULT NULL, `tipoAlimento` VARCHAR(45) NULL DEFAULT NULL, `galpon` INT(11) NOT NULL, `novedades` MEDIUMTEXT NULL, `planilla` INT(11) NOT NULL, `fechaModificado` DATE NULL, `usuario` INT NOT NULL, PRIMARY KEY (`idLog`), INDEX `fk_Planilla_Galpon1_idx` (`galpon` ASC), INDEX `fk_log_usuario1_idx` (`usuario` ASC), CONSTRAINT `fk_Planilla_Galpon10` FOREIGN KEY (`galpon`) REFERENCES `bdGranja`.`galpon` (`idGalpon`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_log_usuario1` FOREIGN KEY (`usuario`) REFERENCES `bdGranja`.`usuario` (`cuil`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `bdGranja`.`factura_has_producto` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `bdGranja`.`factura_has_producto` ( `factura` INT(11) NOT NULL, `producto` INT(11) NOT NULL, `cantidad` INT NULL, PRIMARY KEY (`factura`, `producto`), INDEX `fk_factura_has_producto_producto1_idx` (`producto` ASC), INDEX `fk_factura_has_producto_factura1_idx` (`factura` ASC), CONSTRAINT `fk_factura_has_producto_factura1` FOREIGN KEY (`factura`) REFERENCES `bdGranja`.`factura` (`idFactura`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_factura_has_producto_producto1` FOREIGN KEY (`producto`) REFERENCES `bdGranja`.`producto` (`idProducto`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
# add url column to source table ALTER TABLE `source` ADD `url` varchar(255) NULL DEFAULT NULL AFTER `description`; # patch identifier INSERT INTO meta (species_id, meta_key, meta_value) VALUES (NULL,'patch', 'patch_57_58_d.sql|new column url in source table');
2018-10-16 22:00:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 4.590ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.540ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 553.310ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 4.420ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 6.670ms 2018-10-16 22:01:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.090ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 4.200ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 458.940ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.160ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.650ms 2018-10-16 22:02:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.570ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.990ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 405.840ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.970ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.440ms 2018-10-16 22:03:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.100ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.870ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 368.690ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.460ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.140ms 2018-10-16 22:04:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.250ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.970ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 490.160ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.170ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.770ms 2018-10-16 22:05:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.370ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.700ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 256.230ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.820ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.540ms 2018-10-16 22:06:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.010ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.660ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 174.380ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.730ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.440ms 2018-10-16 22:07:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.250ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 1.990ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 918.300ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.060ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.780ms 2018-10-16 22:08:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.370ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.780ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 520.420ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 4.770ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.680ms 2018-10-16 22:09:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.010ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 1.910ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 182.200ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.700ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.330ms 2018-10-16 22:10:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.090ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.740ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 184.910ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.820ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.310ms 2018-10-16 22:11:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.330ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.330ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 663.000ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.090ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.390ms 2018-10-16 22:12:40 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.100ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.780ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 299.310ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 12.750ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 7.010ms 2018-10-16 22:13:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 5.410ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.880ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 465.340ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.390ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.840ms 2018-10-16 22:14:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 2.980ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.600ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 399.510ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.140ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.390ms 2018-10-16 22:15:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.030ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.410ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 573.620ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 4.400ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.390ms 2018-10-16 22:16:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.200ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.760ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 496.590ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.470ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 5.930ms 2018-10-16 22:17:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.520ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.920ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 389.020ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.730ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.660ms 2018-10-16 22:18:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.410ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.730ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 505.430ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.830ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.440ms 2018-10-16 22:19:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.720ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.760ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 676.020ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.800ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.680ms 2018-10-16 22:20:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 5.770ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 3.890ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 490.480ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.290ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.930ms 2018-10-16 22:21:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 4.400ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 8.090ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 617.340ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.810ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.430ms 2018-10-16 22:22:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 10.080ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 3.000ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 308.990ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.410ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 4.150ms 2018-10-16 22:23:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 4.380ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 1.910ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 332.960ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.740ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 3.040ms 2018-10-16 22:24:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.870ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.930ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 777.520ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.320ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.950ms 2018-10-16 22:25:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 10.290ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 3.470ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 348.220ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.130ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.350ms 2018-10-16 22:26:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 4.080ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.130ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 732.120ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 11.710ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.740ms 2018-10-16 22:27:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 11.600ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.010ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 529.900ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.810ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.610ms 2018-10-16 22:28:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.070ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.830ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 177.980ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.840ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.470ms 2018-10-16 22:29:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.330ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 1.920ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 187.150ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.620ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.620ms 2018-10-16 22:30:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.290ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.640ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 292.670ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.090ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.530ms 2018-10-16 22:31:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.510ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.150ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 863.230ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.900ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.530ms 2018-10-16 22:32:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.350ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.750ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 180.010ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.900ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.530ms 2018-10-16 22:33:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 2.900ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.100ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 174.990ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.680ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.590ms 2018-10-16 22:34:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.030ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.670ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 177.300ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.660ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.570ms 2018-10-16 22:35:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.310ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.700ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 206.230ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.710ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.940ms 2018-10-16 22:36:41 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.120ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 1.980ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 222.600ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.450ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.580ms 2018-10-16 22:37:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.400ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.970ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 289.950ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.770ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.290ms 2018-10-16 22:38:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.050ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.610ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 364.220ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 6.340ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 3.310ms 2018-10-16 22:39:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 2.910ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 1.890ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 598.790ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.850ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 4.900ms 2018-10-16 22:40:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 7.330ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.940ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 656.010ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.860ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 3.690ms 2018-10-16 22:41:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 6.550ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.210ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 718.530ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 6.510ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.640ms 2018-10-16 22:42:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 8.470ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 3.070ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 518.030ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.690ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.670ms 2018-10-16 22:43:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.520ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 3.430ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 635.060ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.950ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.670ms 2018-10-16 22:44:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.830ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 4.350ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 477.870ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.220ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.610ms 2018-10-16 22:45:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 4.850ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 3.150ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 251.000ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.190ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.590ms 2018-10-16 22:46:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 2.820ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.620ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 475.430ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.980ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.400ms 2018-10-16 22:47:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.080ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 5.740ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 562.760ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.870ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.620ms 2018-10-16 22:48:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.150ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 3.120ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 294.900ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.610ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.590ms 2018-10-16 22:49:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.840ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.050ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 211.740ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.920ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.500ms 2018-10-16 22:50:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 2.760ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.750ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 217.230ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.710ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.390ms 2018-10-16 22:51:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.170ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.080ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 251.890ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.740ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.380ms 2018-10-16 22:52:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 6.180ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 5.600ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 528.300ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.040ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.610ms 2018-10-16 22:53:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 4.170ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 3.000ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 406.480ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.990ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.460ms 2018-10-16 22:54:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.250ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.660ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 181.130ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.820ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.570ms 2018-10-16 22:55:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.010ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.810ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 192.220ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.860ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 3.080ms 2018-10-16 22:56:43 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.300ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 2.040ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 563.110ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 2.980ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.380ms 2018-10-16 22:57:42 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.010ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 1.960ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 177.350ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 41.320ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 3.210ms 2018-10-16 22:58:43 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 16.560ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 3.000ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 486.040ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 6.300ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.670ms 2018-10-16 22:59:43 controller: AlarmController action: getAlarmData select * from `alarms` where `id` > 0 and `is_closed` = '0' order by `sequence` asc 3.200ms select count(*) as aggregate from `risk_projects` where `id` > 0 and `status` = 0 1.890ms select `lottery_id` from `issues` where `id` > 0 and `status` = 1 and `begin_time` > 1540224000 group by `lottery_id` 572.180ms select `id`, `name` from `lotteries` where (`status` = 3) order by `id` asc 3.710ms select * from `admin_users` where `admin_users`.`id` = 6 limit 1 2.510ms
/* Warnings: - You are about to drop the column `major` on the `Course` table. All the data in the column will be lost. - You are about to drop the column `major` on the `Student` table. All the data in the column will be lost. */ -- AlterTable ALTER TABLE "Course" DROP COLUMN "major", ADD COLUMN "majorId" INTEGER, ADD COLUMN "minorId" INTEGER; -- AlterTable ALTER TABLE "Student" DROP COLUMN "major", ADD COLUMN "avatar" TEXT, ADD COLUMN "majorId" INTEGER, ADD COLUMN "minorId" INTEGER; -- AlterTable ALTER TABLE "Supervisor" ADD COLUMN "avatar" TEXT; -- CreateTable CREATE TABLE "Major" ( "id" SERIAL NOT NULL, "code" TEXT NOT NULL, "name" TEXT, PRIMARY KEY ("id") ); -- CreateIndex CREATE UNIQUE INDEX "Major.code_unique" ON "Major"("code"); -- AddForeignKey ALTER TABLE "Course" ADD FOREIGN KEY ("majorId") REFERENCES "Major"("id") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Course" ADD FOREIGN KEY ("minorId") REFERENCES "Major"("id") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Student" ADD FOREIGN KEY ("majorId") REFERENCES "Major"("id") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Student" ADD FOREIGN KEY ("minorId") REFERENCES "Major"("id") ON DELETE SET NULL ON UPDATE CASCADE;
CREATE USER ismtest PASSWORD 'ismtest'; create table ALARMTYPE ( ALARMTYPEID smallint primary key, ALARMTYPE varchar(60) ); insert into ALARMTYPE values (0, 'com.qcominc.ms.AlarmEvent'); insert into ALARMTYPE values (1, 'ism.event.ISMAlarmEvent'); insert into ALARMTYPE values (2, 'ism.event.OSAlarmEvent'); insert into ALARMTYPE values (3, 'ism.event.DBAlarmEvent'); insert into ALARMTYPE values (4, 'ism.event.ComAlarmEvent'); insert into ALARMTYPE values (5, 'ism.event.AppAlarmEvent'); insert into ALARMTYPE values (6, 'ism.event.ProcessAlarmEvent'); insert into ALARMTYPE values (7, 'ism.event.ClusterAlarmEvent'); insert into ALARMTYPE values (8, 'ism.event.AppPmAlarmEvent'); create table ACTIVEALARM ( EVENTID int primary key , ALARMTYPEID smallint, EVENTNAME varchar (40) , EVENTDATE timestamp , EVENTDESCRIPTION varchar (640) , NODE varchar (40) , MONITORPOINT varchar (40) , PROBABLECAUSE int , SEVERITY smallint, OWNER varchar (40), ACKUSER varchar (40) null , ACKMESSAGE varchar (100) null , ACKDATE timestamp null , ESCALATION varchar (400) null ); create table HISTORYALARM ( EVENTID int primary key , ALARMTYPEID smallint, EVENTNAME varchar (40) , EVENTDATE timestamp , EVENTDESCRIPTION varchar (640) , NODE varchar (40) , MONITORPOINT varchar (40) , PROBABLECAUSE int , SEVERITY smallint, OWNER varchar(40), CLEARDATE timestamp, CLEARUSER varchar (40) , CLEARMESSAGE varchar (100) null , ACKUSER varchar (40) null , ACKMESSAGE varchar (100) null , ACKDATE timestamp null , ESCALATION varchar (400) null ); create index ctindex on HISTORYALARM ( eventdate ) ; create index cltindex on HISTORYALARM (cleardate) ; create index nodeindex on HISTORYALARM (node) ; create sequence ALARMASSIGNMENT_id_SEQ ; create table ALARMASSIGNMENT ( id bigint DEFAULT nextval('ALARMASSIGNMENT_id_SEQ') UNIQUE NOT NULL primary key , userid varchar (40) NOT NULL , starttime timestamp , endtime timestamp ); insert into ALARMASSIGNMENT(id, userid)values (0, 'ISM'); create table CORRELATION ( id int primary key, severity smallint, exceednum int, period int, OWNER varchar(40), alarmseverity smallint, messagetag varchar(200) ); create table ESCALATION ( period int, email varchar(40), messagetag varchar(200) ); create table autocleartag ( msgtag varchar(200) ) ; create table alarmforward( id int primary key, severity int, messagetag varchar(200) ); INSERT INTO alarmforward (id, severity ) VALUES (1, -1) ; create table alarmreclassify( id int primary key, severity int, messagetag varchar(200) ); create sequence SESSIONDATA_IDX_SEQ ; create table ISMUSER ( USERID varchar (40) primary key , USERALIAS varchar (40) , CREATOR varchar (40) , CREATEDATE timestamp , ENCRYPTEDPASSWORD varchar (40) , GID varchar (40) , LASTUPDATEDDATE timestamp , LOGINALLOWED boolean , LOGINSTATE boolean , IDLETIMER int , IDLETIMERSTATE boolean ); create table GROUPDATA ( GID varchar (40) primary key , ALIAS varchar (40) , READONLY boolean ); create table SESSIONDATA ( IDX bigint DEFAULT nextval('SESSIONDATA_IDX_SEQ') UNIQUE NOT NULL primary key , USERID varchar (40) , TIME timestamp , ACTION varchar (200) ); create index useridindex on SESSIONDATA (USERID, TIME); create sequence pmdatanum ; create sequence measurenum ; create table pmdata_os ( dataid bigint DEFAULT nextval('pmdatanum') UNIQUE NOT NULL, mename varchar(100) not null, monptname varchar(100) not null, starttime timestamp not null, primary key (dataid) ); create table pmmeasure_os (dataid bigint not null, measurenum bigint DEFAULT nextval('measurenum') UNIQUE NOT NULL, name varchar(100) not null, value varchar(100) not null, modifier varchar(100) , primary key (measurenum), constraint fk_pmmeasure_1 foreign key (dataid) references pmdata_os (dataid) ); create table pmdata_proc ( dataid bigint DEFAULT nextval('pmdatanum') UNIQUE NOT NULL, mename varchar(100) not null, monptname varchar(100) not null, starttime timestamp not null, primary key (dataid) ); create table pmmeasure_proc (dataid bigint not null, measurenum bigint DEFAULT nextval('measurenum') UNIQUE NOT NULL, name varchar(100) not null, value varchar(100) not null, modifier varchar(100) , primary key (measurenum), constraint fk_pmmeasure_1 foreign key (dataid) references pmdata_proc (dataid) ); create table pmdata_db ( dataid bigint DEFAULT nextval('pmdatanum') UNIQUE NOT NULL, mename varchar(100) not null, monptname varchar(100) not null, starttime timestamp not null, primary key (dataid) ); create table pmmeasure_db (dataid bigint not null, measurenum bigint DEFAULT nextval('measurenum') UNIQUE NOT NULL, name varchar(100) not null, value varchar(100) not null, modifier varchar(100) , primary key (measurenum), constraint fk_pmmeasure_1 foreign key (dataid) references pmdata_db (dataid) ); create table pmdata_dblz ( dataid bigint DEFAULT nextval('pmdatanum') UNIQUE NOT NULL, mename varchar(100) not null, monptname varchar(100) not null, starttime timestamp not null, primary key (dataid) ); create table pmmeasure_dblz (dataid bigint not null, measurenum bigint DEFAULT nextval('measurenum') UNIQUE NOT NULL, name varchar(100) not null, value varchar(100) not null, modifier varchar(100) , primary key (measurenum), constraint fk_pmmeasure_1 foreign key (dataid) references pmdata_dblz (dataid) ); create index dataindex_os on pmdata_os (dataid, mename); create index dataindex_db on pmdata_db (dataid, mename); create index dataindex_dblz on pmdata_dblz (dataid, mename); create index measureindex_os on pmmeasure_os ( dataid) ; create index measureindex_db on pmmeasure_db ( dataid) ; create index measureindex_dblz on pmmeasure_dblz ( dataid) ; CREATE TABLE nodeconfig ( nodename varchar (25) NOT NULL UNIQUE, ipaddress varchar (15) primary key, portnumber varchar (10) NOT NULL , userid varchar (25) NULL , password varchar (50) NULL , status varchar (15) NULL , osname varchar (50) NULL , osrelease varchar (50) NULL ); create table thresholdsetting( id int primary key, category varchar(20) , monptname varchar(20) , parameter varchar(40) , valuetype smallint, condition smallint, unit varchar(20) ); insert into thresholdsetting values (1, 'OS', 'Cpu', 'IdleTime', 3, 3, '(%)'); insert into thresholdsetting values (2, 'OS', 'Process', 'Memory', 3, 2, '(KB)'); insert into thresholdsetting values (3, 'OS', 'Process', 'CpuUtilization', 3, 2, '(%)'); insert into thresholdsetting values (4, 'OS', 'Process', 'MemoryRatio', 3, 2, '(%)'); insert into thresholdsetting values (6, 'OS', 'Memory', 'SwapUsed', 3, 2, '(MB)'); insert into thresholdsetting values (7, 'OS', 'Memory', 'SwapFree', 3, 3, '(MB)'); insert into thresholdsetting values (8, 'OS', 'Memory', 'PageFaults', 2, 2, '(pages/second)'); insert into thresholdsetting values (10, 'OS', 'Memory', 'PagesFreed', 2, 3,'(pages/second)' ); insert into thresholdsetting values (14, 'OS', 'Disk', 'Busy', 3, 2, '(%)'); insert into thresholdsetting values (15, 'OS', 'Disk', 'AverageQueue', 3, 2, ' '); insert into thresholdsetting values (16, 'OS', 'Disk', 'ReadWrite', 2, 2, '(blocks/second)'); insert into thresholdsetting values (17, 'DB', 'Oracle', 'BufferHitRatio', 3, 3, '(%)'); insert into thresholdsetting values (18, 'DB', 'Oracle', 'LibraryHitRatio', 3, 3, '(%)'); insert into thresholdsetting values (19, 'DB', 'Oracle', 'LatchHitRatio', 3, 3, '(%)'); insert into thresholdsetting values (20, 'DB', 'Oracle', 'BufferNowaitRatio', 3, 3, '(%)'); insert into thresholdsetting values (21, 'DB', 'Oracle', 'RedoNowaitRatio', 3, 3, '(%)'); insert into thresholdsetting values (22, 'DB', 'Oracle', 'InMemorySortRatio', 3, 3, '(%)'); insert into thresholdsetting values (23, 'DB', 'Oracle', 'SoftParseRatio', 3, 3, '(%)'); insert into thresholdsetting values (24, 'DB', 'Oracle', 'MemoryUsage', 3, 2, '(%)'); insert into thresholdsetting values (25, 'DB', 'DataBlitz', 'ArchiveDir.free', 3, 3, '(KB)'); insert into thresholdsetting values (26, 'DB', 'DataBlitz', 'ArchiveDir.used', 3, 2, '(KB)'); insert into thresholdsetting values (27, 'DB', 'DataBlitz', 'BlzSysDB.ChkptDir.free', 3, 3, '(KB)'); insert into thresholdsetting values (28, 'DB', 'DataBlitz', 'BlzSysDB.ChkptDir.used', 3, 2, '(KB)'); insert into thresholdsetting values (29, 'DB', 'DataBlitz', 'BlzSysDB.DB.free', 3, 3, '(KB)'); insert into thresholdsetting values (30, 'DB', 'DataBlitz', 'BlzSysDB.DB.used', 3, 2, '(KB)'); insert into thresholdsetting values (31, 'DB', 'DataBlitz', 'BlzSysDB.DBdir.free', 3, 3, '(KB)'); insert into thresholdsetting values (32, 'DB', 'DataBlitz', 'BlzSysDB.DBdir.used', 3, 2, '(KB)'); insert into thresholdsetting values (33, 'DB', 'DataBlitz', 'REL_DB.ChkptDir.free', 3, 3, '(KB)'); insert into thresholdsetting values (34, 'DB', 'DataBlitz', 'REL_DB.ChkptDir.used', 3, 2, '(KB)'); insert into thresholdsetting values (35, 'DB', 'DataBlitz', 'REL_DB.DB.free', 3, 3, '(KB)'); insert into thresholdsetting values (36, 'DB', 'DataBlitz', 'REL_DB.DB.used', 3, 2, '(KB)'); insert into thresholdsetting values (37, 'DB', 'DataBlitz', 'REL_DB.DBdir.free', 3, 3, '(KB)'); insert into thresholdsetting values (38, 'DB', 'DataBlitz', 'REL_DB.DBdir.used', 3, 2, '(KB)'); insert into thresholdsetting values (39, 'DB', 'DataBlitz', 'SchemaDB.ChkptDir.free', 3, 3, '(KB)'); insert into thresholdsetting values (40, 'DB', 'DataBlitz', 'SchemaDB.ChkptDir.used', 3, 2, '(KB)'); insert into thresholdsetting values (41, 'DB', 'DataBlitz', 'SchemaDB.DBdir.free', 3, 3, '(KB)'); insert into thresholdsetting values (42, 'DB', 'DataBlitz', 'SchemaDB.DBdir.used', 3, 2, '(KB)'); insert into thresholdsetting values (43, 'DB', 'Sybase', 'TotalCacheMissesPerSec', 3, 2, '(/second)'); insert into thresholdsetting values (44, 'DB', 'Sybase', 'DeadlockPercentagePerSec', 3, 2, '(/second)'); create sequence threshold_idx_seq ; create table threshold( id bigint DEFAULT nextval('threshold_idx_seq') UNIQUE NOT NULL primary key , nodename varchar(40) , category varchar(20) , monptname varchar(20) , parameter varchar(40) , value varchar(40) , condition smallint , valuetype smallint , severity smallint ); create sequence PROCESS_ID_SEQ ; create table batchprocess ( processid bigint DEFAULT nextval('PROCESS_ID_SEQ') UNIQUE NOT NULL primary key , processname varchar (40), hostname varchar(40), parameters varchar(640), schedulestarttime timestamp , interval int, schedulemode smallint, atjobid varchar(40) NULL, months varchar(40) NULL, days varchar(90) NULL, weeks varchar(20) NULL, hours varchar(70) NULL, minutes varchar(200) NULL ); GRANT ALL PRIVILEGES ON autocleartag TO ismtest; GRANT ALL PRIVILEGES ON alarmforward TO ismtest; GRANT ALL PRIVILEGES ON alarmreclassify TO ismtest; GRANT ALL PRIVILEGES ON PROCESS_ID_SEQ TO ismtest ; GRANT ALL PRIVILEGES ON batchprocess TO ismtest ; GRANT ALL PRIVILEGES ON ALARMTYPE TO ismtest ; GRANT ALL PRIVILEGES ON ACTIVEALARM TO ismtest ; GRANT ALL PRIVILEGES ON HISTORYALARM TO ismtest ; GRANT ALL PRIVILEGES ON ALARMASSIGNMENT TO ismtest ; GRANT ALL PRIVILEGES ON ISMUSER TO ismtest ; GRANT ALL PRIVILEGES ON GROUPDATA TO ismtest ; GRANT ALL PRIVILEGES ON SESSIONDATA TO ismtest ; GRANT ALL PRIVILEGES ON nodeconfig TO ismtest ; GRANT ALL PRIVILEGES ON ALARMASSIGNMENT_id_SEQ TO ismtest ; GRANT ALL PRIVILEGES ON SESSIONDATA_IDX_SEQ TO ismtest ; GRANT ALL PRIVILEGES ON pmdatanum TO ismtest ; GRANT ALL PRIVILEGES ON measurenum TO ismtest ; GRANT ALL PRIVILEGES ON thresholdsetting TO ismtest ; GRANT ALL PRIVILEGES ON threshold_idx_seq TO ismtest; GRANT ALL PRIVILEGES ON threshold TO ismtest ; GRANT ALL PRIVILEGES ON pmdata_os TO ismtest ; GRANT ALL PRIVILEGES ON pmmeasure_os TO ismtest ; GRANT ALL PRIVILEGES ON pmdata_proc TO ismtest ; GRANT ALL PRIVILEGES ON pmmeasure_proc TO ismtest ; GRANT ALL PRIVILEGES ON pmdata_db TO ismtest ; GRANT ALL PRIVILEGES ON pmmeasure_db TO ismtest ; GRANT ALL PRIVILEGES ON pmdata_dblz TO ismtest ; GRANT ALL PRIVILEGES ON pmmeasure_dblz TO ismtest ; GRANT ALL PRIVILEGES ON CORRELATION TO ismtest ; GRANT ALL PRIVILEGES ON ESCALATION TO ismtest ; DROP TABLE lib_Servers; DROP SEQUENCE lib_Servers_Server_seq; CREATE TABLE lib_Servers ( Server SERIAL NOT NULL, ServerName TEXT NOT NULL, ServerType INT2 NOT NULL, MachineID INT4 NOT NULL ); INSERT INTO "lib_servers" ("server","servername","servertype","machineid") VALUES ('1','Catalog',1,'0'); INSERT INTO "lib_servers" ("server","servername","servertype","machineid") VALUES ('2','Admin',2,'0'); INSERT INTO "lib_servers" ("server","servername","servertype","machineid") VALUES ('3','Customer-3',3,'0'); INSERT INTO "lib_servers" ("server","servername","servertype","machineid") VALUES ('4','Customer-4',3,'0'); INSERT INTO "lib_servers" ("server","servername","servertype","machineid") VALUES ('5','Customer-5',3,'0'); GRANT ALL PRIVILEGES ON lib_Servers TO ismtest ; DROP TABLE lib_Processes; CREATE TABLE lib_Processes ( Process INT4 NOT NULL, ProcessName TEXT NOT NULL ); INSERT INTO "lib_processes" ("process","processname") VALUES ('1','COM'); INSERT INTO "lib_processes" ("process","processname") VALUES ('3','CAP'); INSERT INTO "lib_processes" ("process","processname") VALUES ('4','BIP'); INSERT INTO "lib_processes" ("process","processname") VALUES ('12','MCAP'); INSERT INTO "lib_processes" ("process","processname") VALUES ('17','JNL'); INSERT INTO "lib_processes" ("process","processname") VALUES ('18','BIF'); GRANT ALL PRIVILEGES ON lib_Processes TO ismtest ; CREATE TABLE fx_threshold ( att_name varchar(30), lower numeric , upper numeric ) ; GRANT ALL PRIVILEGES ON fx_threshold TO ismtest ; CREATE TABLE Fx_Log_Data ( log_id bigint default 0, process int default 0, server_id int default 0, process_instance_name varchar(255) NOT NULL, process_instance_id bigint default 0, log_name varchar(150) NOT NULL, time_process_begin timestamp , time_process_end timestamp , successes bigint default 0, volume bigint default 0, errors bigint default 0, filter boolean , guiding_errors bigint default 0, rating_errors bigint default 0, non_consolidated bigint default 0, split_records bigint default 0, accounts_avg_sec float8 default 0, process_sql_query varchar(100) , parsing_errors bigint default 0, split_errors bigint default 0, usage_files_tot_num bigint default 0, total_seconds bigint default 0, usage_file_seconds bigint default 0, external_contact_tot_num bigint default 0, accounts_skipped bigint default 0 ) ; GRANT ALL PRIVILEGES ON Fx_Log_Data TO ismtest ; CREATE INDEX I_log_id on fx_Log_Data (log_id) ; CREATE INDEX I_process on fx_Log_Data (process) ; CREATE INDEX I_process_instance_id on fx_Log_Data (process_instance_id) ; CREATE INDEX I_volumn on fx_Log_Data (volume) ; CREATE INDEX I_usage_files_tot_num on fx_Log_Data (usage_files_tot_num) ; CREATE INDEX I_total_seconds on fx_Log_Data (total_seconds) ; CREATE INDEX I_usage_file_seconds on fx_Log_Data (usage_file_seconds) ; CREATE INDEX I_external_contact_tot_num on fx_Log_Data (external_contact_tot_num) ; DROP TABLE FX_HOST; CREATE TABLE FX_HOST ( hostid INTEGER NOT NULL, hostname TEXT NOT NULL, os_name TEXT NOT NULL, os_version TEXT NOT NULL ); GRANT ALL PRIVILEGES ON FX_HOST TO ismtest ; DROP TABLE FX_PS; CREATE TABLE FX_PS ( sampletime TIMESTAMP with time zone NOT NULL, hostid INTEGER NOT NULL, pid INTEGER, ruser VARCHAR(20), nlwp INTEGER, vsz BIGINT, pcpu NUMERIC(5,2), comm VARCHAR(80) ); GRANT ALL PRIVILEGES ON FX_PS TO ismtest ; DROP TABLE FX_VMSTAT; CREATE TABLE FX_VMSTAT ( sampletime TIMESTAMP with time zone NOT NULL, hostid INTEGER NOT NULL, run_queue FLOAT NOT NULL, block_queue FLOAT NOT NULL, swap FLOAT NOT NULL, free FLOAT NOT NULL, page_out FLOAT NOT NULL, scan_rate FLOAT NOT NULL, usr_pct FLOAT NOT NULL, sys_pct FLOAT NOT NULL, idl_pct FLOAT NOT NULL ); GRANT ALL PRIVILEGES ON FX_VMSTAT TO ismtest ; DROP TABLE FX_MPSTAT; CREATE TABLE FX_MPSTAT ( sampletime TIMESTAMP with time zone NOT NULL, hostid INTEGER NOT NULL, cpu VARCHAR(10) NOT NULL, usr FLOAT NOT NULL, sys FLOAT NOT NULL, idl FLOAT NOT NULL ); GRANT ALL PRIVILEGES ON FX_MPSTAT TO ismtest ; DROP TABLE FX_DISKSTAT; CREATE TABLE FX_DISKSTAT ( sampletime TIMESTAMP with time zone NOT NULL, hostid INTEGER NOT NULL, disk VARCHAR(40) NOT NULL, transfers FLOAT NOT NULL, kbytes FLOAT NOT NULL, pct_busy FLOAT NOT NULL, avg_svc FLOAT NOT NULL ); GRANT ALL PRIVILEGES ON FX_DISKSTAT TO ismtest ; CREATE INDEX fx_ps_sampletime_index ON fx_ps (sampletime); CREATE INDEX fx_ps_hostid_index ON fx_ps (hostid); CREATE INDEX fx_vmstat_sampletime_index ON fx_vmstat (sampletime); CREATE INDEX fx_vmstat_hostid_index ON fx_vmstat (hostid); CREATE INDEX fx_mpstat_sampletime_index ON fx_mpstat (sampletime); CREATE INDEX fx_mpstat_hostid_index ON fx_mpstat (hostid); CREATE INDEX fx_mpstat_cpu_index ON fx_mpstat (cpu); CREATE INDEX fx_diskstat_sampletime_index ON fx_diskstat (sampletime); CREATE INDEX fx_diskstat_hostid_index ON fx_diskstat (hostid); CREATE INDEX fx_diskstat_disk_index ON fx_diskstat (disk); CREATE TABLE pgroup_type_def( pgroup_type varchar(32) primary key , module_name varchar(10) not null , process_name char(8), hostname varchar(32) ); CREATE TABLE pgroup_run_def( pgroup_run_def_id int primary key , pgroup_type varchar(32) not null, init_procstarttime_span int not null, skip_next_init boolean default false not null, schedulestarttime timestamp, interval int , schedulemode smallint , atjobid varchar(40) , months varchar(40), days varchar(90), weeks varchar(20), hours varchar(70), minutes varchar(200), constraint fk_rundef_1 foreign key (pgroup_type) references pgroup_type_def (pgroup_type) ); create sequence pgroup_id_seq minvalue 1 maxvalue 2147483647 CYCLE; create sequence pgroup_status_id_seq minvalue 1 maxvalue 2147483647 CYCLE ; create sequence pgroup_success_id_seq minvalue 1 maxvalue 2147483647 CYCLE ; create sequence pgroup_run_id_seq minvalue 1 maxvalue 2147483647 CYCLE; CREATE TABLE pgroup_run( pgroup_id int primary key , pgroup_run_def_id int , pgroup_type varchar(32) not null, init_time timestamp not null, init_procstarttime_span int not null, start_time timestamp , end_time timestamp, status int ); CREATE TABLE pgroup_run_process_list( pgroup_id int, process_id int, module_name varchar(10), process_name char(8), hostname varchar(32), sched_start_time timestamp ); CREATE TABLE pgroup_success_def( pgroup_succ_id int primary key , pgroup_type varchar(32) not null, min_work_successes int, min_perc_work_succeses int, min_work_rate_successes int , min_perc_work_rate_successes int, max_exit_failuers int , max_perc_exit_failures int ); CREATE TABLE pgroup_status_def( pgroup_status_def_id int primary key, pgroup_type varchar(32) not null, pgroup_succ_id int, init_date timestamp, constraint fk_status_2 foreign key (pgroup_succ_id) references pgroup_success_def (pgroup_succ_id) ); CREATE TABLE pgroup_status ( pgroup_id int, process_members int, completed_processes int, activity_status int, work_successes int, percent_work_successes int, work_rate_successes int, percent_work_rate_successes int, exit_failures int, percent_exit_failures int, pgroup_status smallint, pgroup_status_def_id int ); GRANT ALL PRIVILEGES ON pgroup_type_def TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_run_def TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_run TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_run_process_list TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_success_def TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_status_def TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_status TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_id_seq TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_status_id_seq TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_success_id_seq TO ismtest ; GRANT ALL PRIVILEGES ON pgroup_run_id_seq TO ismtest ; create table BIC_MACHINE_CONFIG ( hostname varchar(32) primary key, /* key */ maxbips int, /* maximum nubmer of bips allowed on machine */ killthreshold numeric, /* above this workload, BIC reduces number of BIPs */ forkthreshold numeric /* below this workload, BIC spawns BIPs */ ); GRANT ALL PRIVILEGES ON BIC_MACHINE_CONFIG TO ismtest ; create table BIP_STARTTIME_STATS /* BIP's time to load static data + configuration */ ( /* Experience shows this does not depend little on task_mode */ custdb varchar(32), /* key */ hostname varchar(32), /* key */ avg_cputime numeric, avg_walltime numeric, last_cputime numeric, last_walltime numeric, max_cputime numeric, max_walltime numeric, primary key (custdb, hostname) ); GRANT ALL PRIVILEGES ON BIP_STARTTIME_STATS TO ismtest ; create table BILLRUN_INFO ( billrunid int primary key, /* Key */ name varchar(30),/* for easier conceptualization */ taskmode int, promptdate TIMESTAMP, /* when BILLRUN.exe issued command */ startdate TIMESTAMP, /* when BIC gave out its first account */ is_strict boolean, timewindow numeric, /* requested time -hours */ time_est numeric, /* predicted time -hours */ run_comment varchar ); GRANT ALL PRIVILEGES ON BILLRUN_INFO TO ismtest ; create table BILLRUN_BIP_EMITLOGS ( billrunid int, /* Foreign Key */ hostname varchar(32), /* The Machine */ pname varchar(32), /* e.g. BICBIP003 */ path varchar(1024), /* path/emitlog */ constraint fk_br_bip_emi foreign key ( billrunid) references BILLRUN_INFO (billrunid) ); GRANT ALL PRIVILEGES ON BILLRUN_BIP_EMITLOGS TO ismtest ; create table BILLRUN_RUNNING_NOTES ( billrunid int, /* Key */ noteseq int, /* Key, Order in which notes were generated */ note varchar(100), /* BIC generated notes */ elapsed_time numeric , /* in hours */ /* The idea behind this table, is that BIC will provide running commentary on BillRun which have gone awry. Such notes will be provided in this table as hints for consultants to figure out what has gone wrong, or how to tweak the system even more so. example: "Reducing number of processes due to new BillRun started." "Cannot contact BICBIPxxx" "Aborting BillRun" "Pausing, since active BillRun(s) are using all the BIPs allowed on mach" "Pausing, since active BillRun(s) are using all the cpu usage on mach" */ primary key (billrunid , noteseq) ); GRANT ALL PRIVILEGES ON BILLRUN_RUNNING_NOTES TO ismtest ; create table BILLRUN_START_CURB ( billrunid int primary key, /* Key */ constraint_id int /* non-null mean a predefined constraint */ ); GRANT ALL PRIVILEGES ON BILLRUN_START_CURB TO ismtest ; create table BILLRUN_TIME_WINDOW_CURB ( billrunid int, /* Foreign Key */ is_strict boolean, /* strict or nonstrict time window */ time numeric, /* timewindow - hours */ constraint fk_br_timewin_cons foreign key ( billrunid) references BILLRUN_INFO (billrunid) ); GRANT ALL PRIVILEGES ON BILLRUN_TIME_WINDOW_CURB TO ismtest ; create table BILLRUN_START_EXHOST_CURB ( billrunid int, /* Foreign Key */ exhost varchar(32), /* one machine */ constraint fk_br_stexhost_cons foreign key ( billrunid) references BILLRUN_INFO (billrunid) ); GRANT ALL PRIVILEGES ON BILLRUN_START_EXHOST_CURB TO ismtest ; create table BILLRUN_START_EXCUSTDB_CURB ( billrunid int, /* Foreign Key */ excustdb varchar(32), constraint fk_br_stexcust_cons foreign key ( billrunid) references BILLRUN_INFO (billrunid) ); GRANT ALL PRIVILEGES ON BILLRUN_START_EXCUSTDB_CURB TO ismtest ; create table BILLRUN_START_INHOST_CURB ( billrunid int, /* Foreign Key */ inhost varchar(32), constraint fk_br_stinhost_cons foreign key ( billrunid) references BILLRUN_INFO (billrunid) ); GRANT ALL PRIVILEGES ON BILLRUN_START_INHOST_CURB TO ismtest ; create table BILLRUN_START_INCUSTDB_CURB ( billrunid int, /* Foreign Key */ incustdb varchar(32), constraint fk_br_stincust_cons foreign key ( billrunid) references BILLRUN_INFO (billrunid) ); GRANT ALL PRIVILEGES ON BILLRUN_START_INCUSTDB_CURB TO ismtest ; create table BILLRUN_CURB_DEF_INFO ( constraint_defid integer primary key, /* Primary Key */ name varchar(32) unique, /* Unique */ description varchar(128) ); GRANT ALL PRIVILEGES ON BILLRUN_CURB_DEF_INFO TO ismtest ; create table BILLRUN_CURB_DEF_TIME_WINDOW ( constraint_defid int, /* Foreign Key */ is_strict boolean, /* strict or nonstrict time window */ time numeric, /* timewindow - hours */ constraint fk_br_consdef_tw foreign key ( constraint_defid) references BILLRUN_CURB_DEF_INFO (constraint_defid) ); GRANT ALL PRIVILEGES ON BILLRUN_CURB_DEF_TIME_WINDOW TO ismtest ; create table BILLRUN_CURB_DEF_EXHOST ( constraint_defid int, /* Foreign Key */ exhost varchar(32), /* one machine */ constraint fk_br_consdef_exh foreign key ( constraint_defid) references BILLRUN_CURB_DEF_INFO (constraint_defid) ); GRANT ALL PRIVILEGES ON BILLRUN_CURB_DEF_EXHOST TO ismtest ; create table BILLRUN_CURB_DEF_EXCUSTDB ( constraint_defid int, /* Foreign Key */ excustdb varchar(32), constraint fk_br_consdef_exc foreign key ( constraint_defid) references BILLRUN_CURB_DEF_INFO (constraint_defid) ); GRANT ALL PRIVILEGES ON BILLRUN_CURB_DEF_EXCUSTDB TO ismtest ; create table BILLRUN_CURB_DEF_INHOST ( constraint_defid int, /* Foreign Key */ inhost varchar(32), constraint fk_br_consdef_inh foreign key ( constraint_defid) references BILLRUN_CURB_DEF_INFO (constraint_defid) ); GRANT ALL PRIVILEGES ON BILLRUN_CURB_DEF_INHOST TO ismtest ; create table BILLRUN_CURB_DEF_INCUSTDB ( constraint_defid int, /* Foreign Key */ incustdb varchar(64), constraint fk_br_consdef_inc foreign key ( constraint_defid) references BILLRUN_CURB_DEF_INFO (constraint_defid) ); GRANT ALL PRIVILEGES ON BILLRUN_CURB_DEF_INCUSTDB TO ismtest ; create table BILLRUN_STATS ( billrunid int primary key, /* Primary Key */ walltime numeric, totalcputime numeric, accid_todo int, accid_done int, accid_errored int, accid_limboed int, /* yes, limboed is not a word */ compstatus int, comment varchar(128) ); GRANT ALL PRIVILEGES ON BILLRUN_STATS TO ismtest ; create table BILLRUN_WALLTIME_STATS ( billrunid int, /* Foreign key to BILLRUN_STATS */ lifespan numeric, listing numeric, estimating numeric, bipping numeric, tabulating numeric, constraint fk_br_wll_stat foreign key ( billrunid) references BILLRUN_STATS (billrunid) ); GRANT ALL PRIVILEGES ON BILLRUN_WALLTIME_STATS TO ismtest ; create table BILLRUN_MACHINE_STATS ( billrunid int, /* Foreign Key to BILLRUN_STATS */ hostname varchar(32), cputime numeric, walltime numeric, bips_started int, bips_exited int, bips_aborted int, constraint fk_br_mch_stat foreign key ( billrunid) references BILLRUN_STATS (billrunid) ); GRANT ALL PRIVILEGES ON BILLRUN_MACHINE_STATS TO ismtest ;
-- 16-may-2008 12:30:09 CDT -- Fixed Dictionary Data Planning UPDATE AD_Column SET AD_Val_Rule_ID=148,Updated=TO_TIMESTAMP('2008-05-16 12:30:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53376 ; -- 16-may-2008 12:33:02 CDT -- Fixed Dictionary Data Planning UPDATE AD_Column SET AD_Val_Rule_ID=189,Updated=TO_TIMESTAMP('2008-05-16 12:33:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53390 ; -- 16-may-2008 12:35:42 CDT -- Fixed Dictionary Data Planning UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2008-05-16 12:35:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53390 ; -- 16-may-2008 12:35:55 CDT -- Fixed Dictionary Data Planning insert into t_alter_column values('pp_product_planning','M_Warehouse_ID','NUMERIC(10)',null,'NULL') ; -- 16-may-2008 12:35:56 CDT -- Fixed Dictionary Data Planning insert into t_alter_column values('pp_product_planning','M_Warehouse_ID',null,'NULL',null) ; -- 16-may-2008 12:39:24 CDT -- Fixed Dictionary Data Planning UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2008-05-16 12:39:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53400 ; -- 16-may-2008 12:39:32 CDT -- Fixed Dictionary Data Planning insert into t_alter_column values('pp_product_planning','S_Resource_ID','NUMERIC(10)',null,'NULL') ; -- 16-may-2008 12:39:32 CDT -- Fixed Dictionary Data Planning insert into t_alter_column values('pp_product_planning','S_Resource_ID',null,'NULL',null) ; -- 16-may-2008 12:45:48 CDT -- Fixed Dictionary Data Planning UPDATE AD_Column SET AD_Val_Rule_ID=52002,Updated=TO_TIMESTAMP('2008-05-16 12:45:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=53400 ;
CREATE TABLE Users ( user_id INT AUTO_INCREMENT PRIMARY KEY, name CHAR(30) NOT NULL, vorname CHAR(30) NOT NULL, email VARCHAR(255) NOT NULL, passwort VARCHAR(255) NOT NULL ); CREATE TABLE Kriterien ( kriterien_id INT AUTO_INCREMENT PRIMARY KEY, kriterien_teil CHAR(1), kriterien_nr INT, titel VARCHAR(255), beschreibung VARCHAR(255), stufe3 VARCHAR(255), stufe2 VARCHAR(255), stufe1 VARCHAR(255), stufe0 VARCHAR(255) ); CREATE TABLE IPA ( ipa_id INT AUTO_INCREMENT PRIMARY KEY, lernender_ID INT NOT NULL, experte_ID INT NOT NULL, b_id INT NOT NULL, titel VARCHAR(255) ); CREATE TABLE Beurteilungsbogen ( beurteilungsbogen_id INT AUTO_INCREMENT PRIMARY KEY, kriterien_id INT NOT NULL, bewertung_lernender BOOLEAN, bewertung_experte INT );
--Joins -- Useful to combine tables that referece another table -- By combining both, we get information from the reference table. --Why do we use join? Why not put everything into a table? -- Because this will contradict normalization. -- By normalizing our tables, we end up with seperate tables (as a consequence) -- joins help us to combine together them together to "see" the data better select * from planets; select * from features; select * from planet_features_junction; --FULL OUTER JOIN (all the values from the left and right table) select * from planets p full outer join planet_features_junction pfj --this is an alias on p.planet_id = pfj.p_id ; select * from features full outer join planet_features_junction pfj on features.features_id = pfj.f_id; select * from planets p full outer join ( select * from features f full outer join planet_features_junction pfj on f.features_id = pfj.f_id --The nested select statement is our first join. -- We're joining to gether the juntion table and the features --We need to combine the junction table because it holds the reference to planet and features. ) foo on p.planet_id = foo.p_id; --INNER JOIN (only matching values will be shown from both tables) select * from planets p inner join planet_features_junction pfj --this is an alias on p.planet_id = pfj.p_id ; select * from features inner join planet_features_junction pfj on features.features_id = pfj.f_id; select * from planets p inner join ( select * from features f inner join planet_features_junction pfj on f.features_id = pfj.f_id --The nested select statement is our first join. -- We're joining to gether the juntion table and the features --We need to combine the junction table because it holds the reference to planet and features. ) feature_junction_join on p.planet_id = feature_junction_join.p_id; delete from features where features_name = 'Floating islands'; delete from features where features_name = 'Storms'; --we can't delete 'storms' is because our -- junction table points to that row delete from planets where planet_name = 'Earth'; -- we would end up with orphan records! -- pointing to rows that no longer exists. --First have to delete any relating rows. delete from planet_features_junction where p_id = (select planet_id from planets where planet_name = 'Earth');
CREATE TABLE post ( id INTEGER PRIMARY KEY AUTOINCREMENT, title VARCHAR(255) NOT NULL, content TEXT NOT NULL ); INSERT INTO post(title,content) VALUES('Post 1','Content 1'); INSERT INTO post(title,content) VALUES('Post 2','Content 2'); INSERT INTO post(title,content) VALUES('Post 3','Content 3'); INSERT INTO post(title,content) VALUES('Post 4','Content 4');
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 */; -- -- -------------------------------------------------------- -- -- 表的结构 `test` -- CREATE TABLE `test` ( `id` int(10) DEFAULT NULL COMMENT '排序', `stunum` int(10) DEFAULT NULL COMMENT '学号', `name` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '姓名', `sex` text COLLATE utf8_unicode_ci COMMENT '性别', `idnum` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '身份证号', `majorin` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '专业', `class` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '班级', `col` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '学院' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 转存表中的数据 `test` -- INSERT INTO `test` (`id`, `stunum`, `name`, `sex`, `idnum`, `majorin`, `class`, `col`) VALUES (NULL, 2017300001, '倪星月', '女', '340102199807082025', '地质工程', '地质17-1', '地球与环境学院'), (NULL, 2017300002, '梁萌萌', '女', '34031120000109162X', '地质工程', '地质17-1', '地球与环境学院'), 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 */;
-- mole_urls (id_user, url) -- mole_urlsgraph (user_oid_i, user_oid_j, ratio) -- mole_centralityurl (user_id, centrality) -- urls mas 'populares' create table popular_urls (url varchar(150)); insert into popular_urls (url) (select max(url) from app_urls group by url order by count(url) desc limit 5); #select max(url) from app_urls group by url order by count(url) desc limit 5; -- usuarios mas populares select screen_name, u.id, cu.centrality from mole_centralityurl cu inner join mole_user u on (u.user_id = cu.user_id) order by centrality desc limit 5 select screen_name as 'User', cu.centrality 'Centralidad' from app_centralityurl cu inner join app_user u on (u.user_id = cu.user_id) where screen_name != "" order by cu.centrality desc limit 5; select screen_name as 'User', cu.centrality 'Centralidad' from app_centralityhashtag cu inner join app_user u on (u.user_id = cu.user_id) where screen_name != "" order by cu.centrality desc limit 5; --- hashtag create table popular_hashtags (hashtag varchar(150)); insert into popular_hashtags (hashtag) (select max(hashtag) from app_hashtag group by hashtag order by count(hashtag) desc limit 5;;
insert into userdata values(101,'Tom'); insert into userdata values(102,'Andrew'); insert into userdata values(103,'Tony'); insert into userdata values(104,'Bob'); insert into userdata values(105,'Sam');
SHOW DATABASES; show variables like 'c%'; ALTER DATABASE hotelctc DEFAULT CHARACTER SET utf8; SET character_set_client = utf8; SET character_set_connection = utf8; SET character_set_server = utf8; SET character_set_filesystem = utf8; /******** ȣ�� ********/ DROP TABLE HOTEL_MEMBER; /* public */ CREATE TABLE HOTEL_MEMBER( mem_id SERIAL primary key, mem_email varchar(300), mem_pw varchar(300), mem_nm varchar(300), mem_nickname varchar(100), mem_level varchar(100), mem_icon varchar(100), mgr_id integer, first_date date, last_date date, mem_drawYn varchar(10), access_token varchar(512), refresh_token varchar(512) ); /* private */ CREATE TABLE HOTEL_MEMBER( mem_id SERIAL primary key , mem_email varchar(300), mem_pw varchar(300), mem_nm varchar(300), mem_nickname varchar(100), mem_level varchar(100), mem_icon varchar(100) ); INSERT INTO HOTEL_MEMBER(mem_email, mem_pw) VALUES ('11@11.11','11111111'); /******** ȣ�� ������ ���� ********/ DROP TABLE HOTEL; CREATE TABLE HOTEL( hotel_seq integer primary key not null, hotel_name varchar(300) not null, hotel_address varchar(500) not null, hotel_website varchar(300) not null, hotel_phone varchar(30) not null, hotel_info varchar(5000) not null, hotel_first_date date, hotel_last_date date, hotel_location_width varchar(100) not null, hotel_location_height varchar(100) not null --, -- CONSTRAINT fk_Seq FOREIGN KEY ( hotel_seq ) REFERENCES HOTEL_MEMBER ( mem_id ) ON DELETE CASCADE ); /******** ȣ�� �� ********/ DROP TABLE HRM; CREATE TABLE HRM( hotel_seq integer not null, hrm_seq SERIAL primary key, hrmN_name varchar(200), personnel_max integer, room_num varchar(100), hrm_configuration varchar(200), hrm_information varchar(4000), hrm_service varchar(2000), hrm_fee integer, hrm_fee_type varchar(10) default 'USD', hrm_kinds varchar(50) default 'Standard', hrm_use bool default true, state varchar(10), CONSTRAINT hrm_seq FOREIGN KEY ( hotel_seq ) REFERENCES HOTEL ( hotel_seq ) ON DELETE CASCADE ); /* �������� CREATE TABLE HRM( hotelSeq int(10) not null, hrmSeq int(100) primary key auto_increment, hrmName varchar(200), reservationName varchar(100), guestName varchar(100), personnel int(10), personnelMax int(10), term int(10), roomNum varchar(100), checkIn date, checkOut date, hrmConfiguration varchar(200), hrmInformation varchar(4000), hrmService varchar(2000), hrmFee int(10), hrmFeeType varchar(10) default 'USD', hrmKinds varchar(50) default 'Standard', hrmUse bool default true, state varchar(10), CONSTRAINT hrm_seq FOREIGN KEY ( hotelSeq ) REFERENCES MEMBER ( memId ) ON DELETE CASCADE ); */ /******** ȣ�� �� �̹��� ********/ DROP TABLE HRMIMG; CREATE TABLE HRMIMG( img_seq SERIAL primary key, hrm_seq integer, path varchar(500), file_Ori_name varchar(200), file_Change_name varchar(200), CONSTRAINT hrmImg_seq FOREIGN KEY ( hrm_seq ) REFERENCES HRM ( hrm_seq ) ON DELETE CASCADE ); /******** ȣ�� �� ********/ DROP TABLE customer; CREATE TABLE customer( hotel_seq integer not null, cust_seq SERIAL primary key, cust_name varchar(100) not null, cust_pw varchar(100) not null, cust_phone varchar(20) not null, cust_email varchar(100) not null, cust_rating varchar(10), signup_date date, CONSTRAINT cust_seq FOREIGN KEY ( hotel_seq ) REFERENCES HOTEL ( hotel_seq ) ON DELETE CASCADE ); /******** ���๮�� ********/ DROP TABLE reservation; CREATE TABLE reservation( reserv_seq SERIAL primary key, hotel_seq integer not null, hrm_seq integer not null, cust_seq integer not null, guest_name varchar(100), personnel integer, hrm_count integer, add_date timestamp, first_date date, last_date date, check_in timestamp, check_out timestamp, etc varchar(300), state varchar(10) --, -- CONSTRAINT re_hrm_seq FOREIGN KEY ( hrm_seq ) REFERENCES HRM ( hrm_seq ) ON UPDATE CASCADE, -- CONSTRAINT re_cust_seq FOREIGN KEY ( cust_seq ) REFERENCES customer ( cust_seq ) ON UPDATE CASCADE ); /******* ���๮�� ���̵����� ********/ DELETE FROM reservation; INSERT INTO reservation (hotelSeq, hrmSeq, custSeq, reservationName, guestName, roomNum, personnel, addDate, firstDate, lastDate, checkIn, checkOut, etc, state) SELECT 2, 1, 1, '�Ƹ���', null, '101ȣ', 2, NOW(), '2017-11-11', '2017-12-11', null, null, 'Ÿ�� 10�� �ּ���', '�����' FROM DUAL WHERE NOT EXISTS (SELECT * FROM reservation WHERE hotelSeq=2 AND hrmSeq=1 AND custSeq=1); INSERT INTO reservation (hotelSeq, hrmSeq, custSeq, reservationName, guestName, roomNum, personnel, addDate, firstDate, lastDate, checkIn, checkOut, etc, state) SELECT 2, 2, 1, '�Ƹ���', null, '1', 2, NOW(), '2017-11-11', '2017-12-11', null, null, null, '����Ϸ�' FROM DUAL WHERE NOT EXISTS (SELECT * FROM reservation WHERE hotelSeq=2 AND hrmSeq=2 AND custSeq=1); /******** ������ ��¥ ********/ DROP TABLE reservationDay; CREATE TABLE reservationDay( reservSeq int(100) not null, hotelSeq int(100) not null, registrationDate date, CONSTRAINT regist_seq FOREIGN KEY ( reservSeq ) REFERENCES reservation ( reservSeq ) ON DELETE CASCADE ); /******** �ȵ�� ********/ DROP TABLE pickdrop; CREATE TABLE pickdrop ( pd_seq SERIAL primary key, hotel_seq integer not null, reserv_seq integer not null, cust_seq integer not null, personnel integer, add_date timestamp, want_date timestamp, start_address varchar(200), start_point_width varchar(100), start_point_height varchar(100), end_address varchar(200), end_point_width varchar(100), end_point_height varchar(100), complete_check bool default false, CONSTRAINT pickdrop_hotel_seq FOREIGN KEY ( hotel_seq ) REFERENCES HOTEL ( hotel_seq ) ON UPDATE CASCADE, CONSTRAINT pickdrop_reserv_seq FOREIGN KEY ( reserv_seq ) REFERENCES reservation ( reserv_seq ) ON UPDATE CASCADE, CONSTRAINT pickdrop_cust_seq FOREIGN KEY ( cust_seq ) REFERENCES customer ( cust_seq ) ON UPDATE CASCADE );
select pl1.GamerTag as Player, pl2.GamerTag as oppopnent, count(*) as timesPlayedTogether from Participation pa1 join Players pl1 on pa1.PlayerID = pl1.PlayerID join Participation pa2 on pa2.GameUUID = pa1.GameUUID and pa1.PlayerID != pa2.PlayerID join Players pl2 on pa2.PlayerID = pl2.PlayerID join InterestingPlayers ip on pa1.PlayerID = ip.playerID where SeenIn60Days = 'Active' group by pl1.PlayerID, pl1.GamerTag, pa2.playerID, pl2.GamerTag order by timesPlayedTogether desc
-- phpMyAdmin SQL Dump -- version 4.6.4 -- https://www.phpmyadmin.net/ -- -- Máy chủ: 127.0.0.1 -- Thời gian đã tạo: Th9 01, 2017 lúc 04:29 SA -- Phiên bản máy phục vụ: 5.7.14 -- Phiên bản PHP: 5.6.25 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Cơ sở dữ liệu: `shishimai` -- -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `ssm_kpis` -- CREATE TABLE `ssm_kpis` ( `ssm_kpi_id` int(11) NOT NULL, `year` int(4) NOT NULL, `month` int(2) NOT NULL, `week` int(2) NOT NULL, `transactionRevenue` int(11) NOT NULL DEFAULT '0' COMMENT '売上', `pageviews` int(11) NOT NULL DEFAULT '0' COMMENT 'PV数', `pageviewsPerSession` decimal(4,2) DEFAULT NULL, `sessions` int(11) NOT NULL DEFAULT '0' COMMENT 'セッション数', `avgSessionDuration` int(11) NOT NULL DEFAULT '0' COMMENT '平均セッション時間', `uniqueUsers` int(11) NOT NULL DEFAULT '0' COMMENT 'UU', `transactions` int(11) NOT NULL DEFAULT '0', `transactionsPerSession` decimal(4,2) DEFAULT NULL, `revenuePerTransaction` int(11) NOT NULL DEFAULT '0' COMMENT '客単価', `bounceRate` decimal(4,2) DEFAULT NULL, `topBounceRate` decimal(4,2) DEFAULT NULL, `site_id` int(11) NOT NULL, `created_user_id` int(11) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Đang đổ dữ liệu cho bảng `ssm_kpis` -- INSERT INTO `ssm_kpis` (`ssm_kpi_id`, `year`, `month`, `week`, `transactionRevenue`, `pageviews`, `pageviewsPerSession`, `sessions`, `avgSessionDuration`, `uniqueUsers`, `transactions`, `transactionsPerSession`, `revenuePerTransaction`, `bounceRate`, `topBounceRate`, `site_id`, `created_user_id`, `created_at`, `updated_at`) VALUES (1, 2017, 8, 1, 874324, 45997, '3.00', 15332, 90, 9000, 30, '0.30', 20000, '50.00', '50.00', 1, 0, '2017-08-24 07:21:16', '2017-08-21 03:18:38'), (2, 2017, 8, 2, 874322, 45997, '3.00', 15332, 100, 9000, 50, '0.40', 20000, '50.00', '50.00', 1, 0, '2017-08-25 06:25:59', '2017-08-21 03:40:41'), (3, 2017, 8, 3, 874322, 45997, '3.00', 15332, 90, 10000, 0, '0.30', 20000, '50.00', '50.00', 1, 0, '2017-08-25 06:26:13', '2017-08-21 03:57:06'), (4, 2017, 8, 4, 874322, 45997, '3.00', 15332, 90, 10000, 0, '0.30', 20000, '50.00', '50.00', 1, 0, '2017-09-01 03:44:28', '0000-00-00 00:00:00'), (5, 2017, 8, 5, 374709, 19713, '3.00', 6571, 90, 10000, 0, '0.30', 20000, '50.00', '50.00', 1, 0, '2017-09-01 03:44:37', '0000-00-00 00:00:00'); -- -- Chỉ mục cho các bảng đã đổ -- -- -- Chỉ mục cho bảng `ssm_kpis` -- ALTER TABLE `ssm_kpis` ADD PRIMARY KEY (`ssm_kpi_id`); -- -- AUTO_INCREMENT cho các bảng đã đổ -- -- -- AUTO_INCREMENT cho bảng `ssm_kpis` -- ALTER TABLE `ssm_kpis` MODIFY `ssm_kpi_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; /*!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 */;
/*创建数据库*/ SET NAMES UTF8; DROP DATABASE IF EXISTS wj; CREATE DATABASE wj CHARSET=UTF8; USE wj; /*新闻列表*/ CREATE TABLE wj_news( id INT PRIMARY KEY AUTO_INCREMENT COMMENT '新闻编号',#效率高 title VARCHAR(50) COMMENT '新闻标题', ctime DATETIME COMMENT '发布时间', point INT COMMENT '点击量', img_url VARCHAR(255) COMMENT '图片', content VARCHAR(255) COMMENT '新闻内容' )COMMENT '新闻列表'; INSERT INTO wj_news VALUES (NULL,'五金行业如何实现新增长,直面市场变化 确保有效供给',now(),0,"http://127.0.0.1:3000/img/1.jpg","“我们代理的是家居五金用品,这一两年数据在下滑,感觉被家装、一体化家居产品包括互联网分流了很多,所以我们这次过来也是想和厂家一起想想办法,也让厂家给我们鼓鼓劲,增加一些信心。”在日前一家国内知名五金制造企业的经销商大会上,有地方经销商这样说。"), (NULL,'124',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'125',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'126',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'127',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'128',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'129',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'130',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'131',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'132',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'133',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'134',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'135',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'136',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'137',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'138',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'139',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'140',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'141',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."), (NULL,'142',now(),0,"http://127.0.0.1:3000/img/1.jpg",".."); /*评论列表*/ CREATE TABLE wj_comment( id INT PRIMARY KEY AUTO_INCREMENT COMMENT '评论编号', nid INT COMMENT '评论所属新闻编号', user_name VARCHAR(25) COMMENT '评论者', ctime BIGINT COMMENT '时间', content VARCHAR(120) COMMENT '内容' ); INSERT INTO wj_comment VALUES (NULL,1,"dd",now(),"111111"), (NULL,1,"mm",now(),"222222"), (NULL,1,"cc",now(),"333333"), (NULL,1,"xx",now(),"444444"), (NULL,1,"ww",now(),"555555"), (NULL,1,"qq",now(),"666666"), (NULL,1,"uu",now(),"777777"), (NULL,1,"uu",now(),"777777"), (NULL,1,"uu",now(),"777777"), (NULL,1,"uu",now(),"777777"), (NULL,1,"uu",now(),"777777"), (NULL,1,"uu",now(),"777777"), (NULL,1,"uu",now(),"777777"), (NULL,1,"uu",now(),"777777"), (NULL,1,"uu",now(),"777777"); CREATE TABLE wj_login( id INT PRIMARY KEY AUTO_INCREMENT, uname VARCHAR(25) NOT NULL DEFAULT '', upwd VARCHAR(32) NOT NULL DEFAULT '' ); INSERT INTO wj_login VALUES(null,'dd',md5('123')); INSERT INTO wj_login VALUES(null,'tom',md5('123')); INSERT INTO wj_login VALUES(null,'jerry',md5('123'));
drop table CRAWLER CASCADE CONSTRAINTS; --테스트 테이블 create table CRAWLER( CRAWLER_NUM NUMBER NOT NULL, --글번호 CRAWLER_IMAGE VARCHAR2(2000) NOT NULL, --이미지 CRAWLER_COVER_SUBJECT VARCHAR2(500) NOT NULL, --제목 CRAWLER_SUMMARY VARCHAR2(2000) NOT NULL, --내용 CRAWLER_DATE VARCHAR2(200) NOT NULL, --날짜 CRAWLER_LINK VARCHAR2(2000), --링크 PRIMARY KEY(CRAWLER_NUM) ); select * from CRAWLER
/****** Object: StoredProcedure [dbo].[prc_CWI_SetTaskTemplateData] Script Date: 7/10/2014 6:55:23 PM ******/ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_CWI_SetTaskTemplateData]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[prc_CWI_SetTaskTemplateData] GO /****** Object: StoredProcedure [dbo].[prc_CWI_SetTaskTemplateData] Script Date: 7/10/2014 6:55:23 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_CWI_SetTaskTemplateData]') AND type in (N'P', N'PC')) BEGIN EXEC dbo.sp_executesql @statement = N' CREATE PROC [dbo].[prc_CWI_SetTaskTemplateData] @taskid bigint, @author int, @templatevalues XML AS BEGIN declare @hasOuterTransaction bit = case when @@trancount > 0 then 1 else 0 end; if @hasOuterTransaction = 0 begin BEGIN TRANSACTION end BEGIN TRY DECLARE @dt datetime = getdate() -- temporary table to store the data from XML DECLARE @tbl TABLE ( FieldId int, FieldValue varchar(max) ) --Read the data from XML and store in the table variable INSERT INTO @tbl ( FieldId, FieldValue ) select COLX.value(''(./FieldId)[1]'',''int'') fldid, COLX.value(''(./FieldValue)[1]'',''varchar(max)'') fldval from @templatevalues.nodes(''DocumentElement/TemplateData'') AS TABX(COLX) UPDATE CWI_TaskTemplateData SET FieldValue = t.FieldValue FROM CWI_TaskTemplateData TTD INNER JOIN @tbl t ON TTD.TemplateFieldId = t.FieldId AND TTD.TaskId = @taskid INSERT CWI_TaskTemplateData ( TaskId, TemplateFieldId, FieldValue, CreatedBy, CreatedOn, ModifiedBy, ModifiedOn) SELECT @TaskId, FieldId, t.FieldValue, @Author, @dt,@Author, @dt FROM @tbl t LEFT OUTER JOIN CWI_TaskTemplateData TTD ON TTD.TemplateFieldId = t.FieldId AND TTD.TaskId = @taskid WHERE TTD.Id IS NULL END TRY BEGIN CATCH IF @@TRANCOUNT >0 BEGIN if @hasOuterTransaction = 0 begin ROLLBACK TRANSACTION ; end END EXEC prc_CWI_AppRaiseError; THROW END CATCH IF @@TRANCOUNT > 0 if @hasOuterTransaction = 0 begin COMMIT TRANSACTION ; end END ' END GO
/* Oracle's Analytic functions ============================================ A simple explenaition of MATCH_RECOGNIZE clause https://oraclepress.wordpress.com/2015/08/18/use-pattern-matching-to-recognize-patterns-across-multiple-rows-in-a-table/ ============================================ ============================================ Pattern Matching ============================================ https://oracle-base.com/articles/12c/pattern-matching-in-oracle-database-12cr1 Since Oracle 12c has been introduced the MATCH_RECOGNIZE clause to make pattern matching simple. Data must be processed correctly and in a deterministic fashion. The PARTITION BY and ORDER BY clauses of all analytic functions are used to break the data up into groups and make sure it is ordered correctly within each group, so order-sensitive analytic functions work as expected. This is explained here. If no partitions are defined, it is assumed the whole result set is one big partition. PARTITION BY product ORDER BY tstamp The MEASURES clause defines the column output that will be produced for each match. MEASURES STRT.tstamp AS start_tstamp, LAST(UP.tstamp) AS peak_tstamp, LAST(DOWN.tstamp) AS end_tstamp Along with the MEASURES, you need to decide if you want to present all the rows that represent the match, or just summary information. [ONE ROW | ALL ROWS] PER MATCH The pattern that represents a match is defined using pattern variables, so it makes sense to look at those first. Pattern variables can use any non-reserved word associated with an expression. Two examples are given below. DEFINE UP AS UP.units_sold > PREV(UP.units_sold), FLAT AS FLAT.units_sold = PREV(FLAT.units_sold), DOWN AS DOWN.units_sold < PREV(DOWN.units_sold) DEFINE TWINKIES AS TWINKIES.product='TWINKIES', DINGDONGS AS DINGDONG.product='DINGDONGS', HOHOS AS HOHOS.product='HOHOS' The pattern is then defined using regular expressions incorporating the pattern variables. Some examples are given below, but a full list of the possibilities is available from the documentation. -- 1-Many increases, followed by 1-Many decreases in a value. A "V" shaped spike. PATTERN (STRT UP+ DOWN+) -- 1-Many increases, followed by a single decrease, then 1-Many increases. A single dip, -- during the rise. PATTERN (STRT UP+ DOWN{1} UP+) -- 1-5 Twinkies, followed by 1 DingDong, followed by 2 HoHos. PATTERN(STRT TWINKIES{1,5} DINGDONGS{1} HOHOS{2}) The AFTER MATCH SKIP clause defines where the search is restarted from. Available options include the following. AFTER MATCH SKIP TO NEXT ROW : Search continues at the row following the start of the matched pattern. AFTER MATCH SKIP PAST LAST ROW : (Default) Search continues at the row following the end of the matched pattern. AFTER MATCH SKIP TO FIRST pattern_variable : Search continues from the first row relating to the pattern defined by the specified pattern variable. AFTER MATCH SKIP TO LAST pattern_variable : Search continues from the last row relating to the pattern defined by the specified pattern variable. AFTER MATCH SKIP TO pattern_variable : Equivalent of "AFTER MATCH SKIP TO LAST pattern_variable". There are a number of functions that provide additional information about the displayed output. MATCH_NUMBER() : Sequential numbering of matches 1-N, indicating which output rows relate to which match. CLASSIFIER() : The pattern variable that applies to the output row. This only makes sense when all rows are displayed. Navigation around the rows in a patterns is possible using the PREV, NEXT, FIRST and LAST functions. PREV(UP.units_sold) -- Value of units_sold from previous row. PREV(UP.units_sold, 2) -- Value of units_sold from the row before the previous row (offset of 2 rows). NEXT(UP.units_sold) -- Value of units_sold from the next row. NEXT(UP.units_sold, 2) -- Value of units_sold from the row after the following row (offset of 2 rows). FIRST(UP.units_sold) -- First row in the pattern. FIRST(UP.units_sold, 1) -- Row following the first row (offset of 1 row). LAST(UP.units_sold) -- Last row in the pattern. LAST(UP.units_sold, 1) -- Row preceding the last row (offset of 1 row). The pattern navigation, along with aggregate functions, can be qualified with the FINAL and RUNNING semantics keywords. These are effectively a windowing clause within the pattern, defining if the action relates to the whole pattern, or from the start of the pattern to the current row. */ DROP TABLE sales_audit PURGE; CREATE TABLE sales_history ( id NUMBER, product VARCHAR2(20), tstamp TIMESTAMP, units_sold NUMBER, CONSTRAINT sales_history_pk PRIMARY KEY (id) ); ALTER SESSION SET NLS_DATE_LANGUAGE='AMERICAN'; ALTER SESSION SET nls_date_format = 'DD-MON-YYYY'; INSERT INTO sales_history VALUES ( 1, 'TWINKIES', '01-OCT-2014', 17); INSERT INTO sales_history VALUES ( 2, 'TWINKIES', '02-OCT-2014', 19); INSERT INTO sales_history VALUES ( 3, 'TWINKIES', '03-OCT-2014', 23); INSERT INTO sales_history VALUES ( 4, 'TWINKIES', '04-OCT-2014', 23); INSERT INTO sales_history VALUES ( 5, 'TWINKIES', '05-OCT-2014', 16); INSERT INTO sales_history VALUES ( 6, 'TWINKIES', '06-OCT-2014', 10); INSERT INTO sales_history VALUES ( 7, 'TWINKIES', '07-OCT-2014', 14); INSERT INTO sales_history VALUES ( 8, 'TWINKIES', '08-OCT-2014', 16); INSERT INTO sales_history VALUES ( 9, 'TWINKIES', '09-OCT-2014', 15); INSERT INTO sales_history VALUES (10, 'TWINKIES', '10-OCT-2014', 17); INSERT INTO sales_history VALUES (11, 'TWINKIES', '11-OCT-2014', 23); INSERT INTO sales_history VALUES (12, 'TWINKIES', '12-OCT-2014', 30); INSERT INTO sales_history VALUES (13, 'TWINKIES', '13-OCT-2014', 31); INSERT INTO sales_history VALUES (14, 'TWINKIES', '14-OCT-2014', 29); INSERT INTO sales_history VALUES (15, 'TWINKIES', '15-OCT-2014', 25); INSERT INTO sales_history VALUES (16, 'TWINKIES', '16-OCT-2014', 21); INSERT INTO sales_history VALUES (17, 'TWINKIES', '17-OCT-2014', 35); INSERT INTO sales_history VALUES (18, 'TWINKIES', '18-OCT-2014', 46); INSERT INTO sales_history VALUES (19, 'TWINKIES', '19-OCT-2014', 45); INSERT INTO sales_history VALUES (20, 'TWINKIES', '20-OCT-2014', 30); COMMIT; ALTER SESSION SET nls_timestamp_format = 'DD-MON-YYYY'; /* The following query shows the pattern of the data, which we will refer to later. */ SET PAGESIZE 50 COLUMN product FORMAT A10 COLUMN tstamp FORMAT A11 COLUMN graph FORMAT A50 SELECT id, product, tstamp, units_sold, RPAD('#', units_sold, '#') AS graph FROM sales_history ORDER BY id; /* The following table defines an audit trail of all sales as they happen. */ DROP TABLE sales_audit PURGE; CREATE TABLE sales_audit ( id NUMBER, product VARCHAR2(20), tstamp TIMESTAMP, CONSTRAINT sales_audit_pk PRIMARY KEY (id) ); ALTER SESSION SET nls_timestamp_format = 'DD-MON-YYYY HH24:MI:SS'; INSERT INTO sales_audit VALUES ( 1, 'TWINKIES', '01-OCT-2014 12:00:01'); INSERT INTO sales_audit VALUES ( 2, 'TWINKIES', '01-OCT-2014 12:00:02'); INSERT INTO sales_audit VALUES ( 3, 'DINGDONGS', '01-OCT-2014 12:00:03'); INSERT INTO sales_audit VALUES ( 4, 'HOHOS', '01-OCT-2014 12:00:04'); INSERT INTO sales_audit VALUES ( 5, 'HOHOS', '01-OCT-2014 12:00:05'); INSERT INTO sales_audit VALUES ( 6, 'TWINKIES', '01-OCT-2014 12:00:06'); INSERT INTO sales_audit VALUES ( 7, 'TWINKIES', '01-OCT-2014 12:00:07'); INSERT INTO sales_audit VALUES ( 8, 'DINGDONGS', '01-OCT-2014 12:00:08'); INSERT INTO sales_audit VALUES ( 9, 'DINGDONGS', '01-OCT-2014 12:00:09'); INSERT INTO sales_audit VALUES (10, 'HOHOS', '01-OCT-2014 12:00:10'); INSERT INTO sales_audit VALUES (11, 'HOHOS', '01-OCT-2014 12:00:11'); INSERT INTO sales_audit VALUES (12, 'TWINKIES', '01-OCT-2014 12:00:12'); INSERT INTO sales_audit VALUES (13, 'TWINKIES', '01-OCT-2014 12:00:13'); INSERT INTO sales_audit VALUES (14, 'DINGDONGS', '01-OCT-2014 12:00:14'); INSERT INTO sales_audit VALUES (15, 'DINGDONGS', '01-OCT-2014 12:00:15'); INSERT INTO sales_audit VALUES (16, 'HOHOS', '01-OCT-2014 12:00:16'); INSERT INTO sales_audit VALUES (17, 'TWINKIES', '01-OCT-2014 12:00:17'); INSERT INTO sales_audit VALUES (18, 'TWINKIES', '01-OCT-2014 12:00:18'); INSERT INTO sales_audit VALUES (19, 'TWINKIES', '01-OCT-2014 12:00:19'); INSERT INTO sales_audit VALUES (20, 'TWINKIES', '01-OCT-2014 12:00:20'); COMMIT; /* The following query shows the order of the product sales for a specific time period, which we will refer to later. */ COLUMN tstamp FORMAT A20 SELECT * FROM sales_audit ORDER BY tstamp; /* ID PRODUCT TSTAMP ---------- ---------- -------------------- 1 TWINKIES 01-OCT-2014 12:00:01 2 TWINKIES 01-OCT-2014 12:00:02 3 DINGDONG 01-OCT-2014 12:00:03 4 HOHOS 01-OCT-2014 12:00:04 5 HOHOS 01-OCT-2014 12:00:05 6 TWINKIES 01-OCT-2014 12:00:06 7 TWINKIES 01-OCT-2014 12:00:07 8 DINGDONGS 01-OCT-2014 12:00:08 9 DINGDONGS 01-OCT-2014 12:00:09 10 HOHOS 01-OCT-2014 12:00:10 11 HOHOS 01-OCT-2014 12:00:11 12 TWINKIES 01-OCT-2014 12:00:12 13 TWINKIES 01-OCT-2014 12:00:13 14 DINDONGS 01-OCT-2014 12:00:14 15 HOHOS 01-OCT-2014 12:00:15 16 TWINKIES 01-OCT-2014 12:00:16 17 TWINKIES 01-OCT-2014 12:00:17 18 TWINKIES 01-OCT-2014 12:00:18 19 TWINKIES 01-OCT-2014 12:00:19 20 TWINKIES 01-OCT-2014 12:00:20 */ /* Examples Check for peaks/spikes in sales, where sales go up then down. Notice the pattern variables "UP", "FLAT" and "DOWN" are defined to show an increase, no change and decrease in the value respectively. The pattern we are searching for is 1-Many UPs, optionally leveling off, followed by 1-Many Downs. The measures displayed are the start of the pattern (STRT.tstamp), the top of the peak (LAST(UP.tstamp)) and the bottom of the drop (LAST(DOWN.tstamp)), with a single row for each match. We are also displaying the MATCH_NUMBER(). */ ALTER SESSION SET nls_timestamp_format = 'DD-MON-YYYY'; COLUMN start_tstamp FORMAT A11 COLUMN peak_tstamp FORMAT A11 COLUMN end_tstamp FORMAT A11 SELECT MR.* FROM sales_history MATCH_RECOGNIZE ( PARTITION BY product ORDER BY tstamp MEASURES STRT.tstamp AS start_tstamp, LAST(UP.tstamp) AS peak_tstamp, LAST(DOWN.tstamp) AS end_tstamp, MATCH_NUMBER() AS mno ONE ROW PER MATCH AFTER MATCH SKIP TO LAST DOWN PATTERN (STRT UP+ FLAT* DOWN+) DEFINE UP AS UP.units_sold > PREV(UP.units_sold), FLAT AS FLAT.units_sold = PREV(FLAT.units_sold), DOWN AS DOWN.units_sold < PREV(DOWN.units_sold) ) MR ORDER BY MR.product, MR.start_tstamp; /* PRODUCT START_TSTAM PEAK_TSTAMP END_TSTAMP MNO ---------- ----------- ----------- ----------- ---------- TWINKIES 01-OCT-2014 03-OCT-2014 06-OCT-2014 1 TWINKIES 06-OCT-2014 08-OCT-2014 09-OCT-2014 2 TWINKIES 09-OCT-2014 13-OCT-2014 16-OCT-2014 3 TWINKIES 16-OCT-2014 18-OCT-2014 20-OCT-2014 4 */ /* The output tells us there were 4 distinct peaks/spikes in the sales, giving us the location of the start, peak and end of the pattern. The following query is similar, but shows all the rows for the match and includes the CLASSIFIER() function to indicate which pattern variable is relevant for each row. */ SET LINESIZE 110 ALTER SESSION SET nls_timestamp_format = 'DD-MON-YYYY'; COLUMN start_tstamp FORMAT A11 COLUMN peak_tstamp FORMAT A11 COLUMN end_tstamp FORMAT A11 COLUMN cls FORMAT A5 SELECT * FROM sales_history MATCH_RECOGNIZE ( PARTITION BY product ORDER BY tstamp MEASURES STRT.tstamp AS start_tstamp, FINAL LAST(UP.tstamp) AS peak_tstamp, FINAL LAST(DOWN.tstamp) AS end_tstamp, MATCH_NUMBER() AS mno, CLASSIFIER() AS cls ALL ROWS PER MATCH AFTER MATCH SKIP TO LAST DOWN PATTERN (STRT UP+ FLAT* DOWN+) DEFINE UP AS UP.units_sold > PREV(UP.units_sold), DOWN AS DOWN.units_sold < PREV(DOWN.units_sold), FLAT AS FLAT.units_sold = PREV(FLAT.units_sold) ) MR ORDER BY MR.product, MR.mno, MR.tstamp; /* PRODUCT TSTAMP START_TSTAM PEAK_TSTAMP END_TSTAMP MNO CLS ID UNITS_SOLD ---------- ----------- ----------- ----------- ----------- ---------- ----- ---------- ---------- TWINKIES 01-OCT-2014 01-OCT-2014 03-OCT-2014 06-OCT-2014 1 STRT 1 17 TWINKIES 02-OCT-2014 01-OCT-2014 03-OCT-2014 06-OCT-2014 1 UP 2 19 TWINKIES 03-OCT-2014 01-OCT-2014 03-OCT-2014 06-OCT-2014 1 UP 3 23 TWINKIES 04-OCT-2014 01-OCT-2014 03-OCT-2014 06-OCT-2014 1 FLAT 4 23 TWINKIES 05-OCT-2014 01-OCT-2014 03-OCT-2014 06-OCT-2014 1 DOWN 5 16 TWINKIES 06-OCT-2014 01-OCT-2014 03-OCT-2014 06-OCT-2014 1 DOWN 6 10 TWINKIES 06-OCT-2014 06-OCT-2014 08-OCT-2014 09-OCT-2014 2 STRT 6 10 TWINKIES 07-OCT-2014 06-OCT-2014 08-OCT-2014 09-OCT-2014 2 UP 7 14 TWINKIES 08-OCT-2014 06-OCT-2014 08-OCT-2014 09-OCT-2014 2 UP 8 16 TWINKIES 09-OCT-2014 06-OCT-2014 08-OCT-2014 09-OCT-2014 2 DOWN 9 15 TWINKIES 09-OCT-2014 09-OCT-2014 13-OCT-2014 16-OCT-2014 3 STRT 9 15 TWINKIES 10-OCT-2014 09-OCT-2014 13-OCT-2014 16-OCT-2014 3 UP 10 17 TWINKIES 11-OCT-2014 09-OCT-2014 13-OCT-2014 16-OCT-2014 3 UP 11 23 TWINKIES 12-OCT-2014 09-OCT-2014 13-OCT-2014 16-OCT-2014 3 UP 12 30 TWINKIES 13-OCT-2014 09-OCT-2014 13-OCT-2014 16-OCT-2014 3 UP 13 31 TWINKIES 14-OCT-2014 09-OCT-2014 13-OCT-2014 16-OCT-2014 3 DOWN 14 29 TWINKIES 15-OCT-2014 09-OCT-2014 13-OCT-2014 16-OCT-2014 3 DOWN 15 25 TWINKIES 16-OCT-2014 09-OCT-2014 13-OCT-2014 16-OCT-2014 3 DOWN 16 21 TWINKIES 16-OCT-2014 16-OCT-2014 18-OCT-2014 20-OCT-2014 4 STRT 16 21 TWINKIES 17-OCT-2014 16-OCT-2014 18-OCT-2014 20-OCT-2014 4 UP 17 35 TWINKIES 18-OCT-2014 16-OCT-2014 18-OCT-2014 20-OCT-2014 4 UP 18 46 TWINKIES 19-OCT-2014 16-OCT-2014 18-OCT-2014 20-OCT-2014 4 DOWN 19 45 TWINKIES 20-OCT-2014 16-OCT-2014 18-OCT-2014 20-OCT-2014 4 DOWN 20 30 23 rows selected. */ /* Notice how some rows are duplicated, as they represent the end of one pattern and the start of the next. The next example identified the only occurrence of a general rise in values, containing a single dipping value. */ SELECT * FROM sales_history MATCH_RECOGNIZE ( PARTITION BY product ORDER BY tstamp MEASURES STRT.tstamp AS start_tstamp, FINAL LAST(UP.tstamp) AS peak_tstamp, MATCH_NUMBER() AS mno, CLASSIFIER() AS cls ALL ROWS PER MATCH AFTER MATCH SKIP TO LAST DOWN PATTERN (STRT UP+ DOWN{1} UP+) DEFINE UP AS UP.units_sold > PREV(UP.units_sold), DOWN AS DOWN.units_sold < PREV(DOWN.units_sold) ) MR ORDER BY MR.product, MR.tstamp; /* PRODUCT TSTAMP START_TSTAM PEAK_TSTAMP MNO CLS ID UNITS_SOLD ---------- ----------- ----------- ----------- ---------- ----- ---------- ---------- TWINKIES 06-OCT-2014 06-OCT-2014 13-OCT-2014 1 STRT 6 10 TWINKIES 07-OCT-2014 06-OCT-2014 13-OCT-2014 1 UP 7 14 TWINKIES 08-OCT-2014 06-OCT-2014 13-OCT-2014 1 UP 8 16 TWINKIES 09-OCT-2014 06-OCT-2014 13-OCT-2014 1 DOWN 9 15 TWINKIES 10-OCT-2014 06-OCT-2014 13-OCT-2014 1 UP 10 17 TWINKIES 11-OCT-2014 06-OCT-2014 13-OCT-2014 1 UP 11 23 TWINKIES 12-OCT-2014 06-OCT-2014 13-OCT-2014 1 UP 12 30 TWINKIES 13-OCT-2014 06-OCT-2014 13-OCT-2014 1 UP 13 31 8 rows selected. */ /* We can see there is only a single match for that pattern in the data. Next we check for a run of TWINKIES sales separated by exactly three sales matching any combination of DINGDONGS and/or HOHOS. */ SELECT * FROM sales_audit MATCH_RECOGNIZE ( --PARTITION BY product ORDER BY tstamp MEASURES FIRST(TWINKIES.tstamp) AS start_tstamp, FINAL LAST(TWINKIES.tstamp) AS end_tstamp, MATCH_NUMBER() AS mno, CLASSIFIER() AS cls ALL ROWS PER MATCH AFTER MATCH SKIP TO LAST TWINKIES PATTERN(TWINKIES+ (DINGDONGS | HOHOS){3} TWINKIES+) DEFINE TWINKIES AS TWINKIES.product='TWINKIES', DINGDONGS AS DINGDONGS.product='DINGDONGS', HOHOS AS HOHOS.product='HOHOS' ) MR ORDER BY MR.mno, MR.tstamp; /* TSTAMP START_TSTAMP END_TSTAMP MNO CLS ID PRODUCT -------------------- -------------------- -------------------- ---------- ---------- ---------- ---------- 01-OCT-2014 12:00:01 01-OCT-2014 12:00:01 01-OCT-2014 12:00:07 1 TWINKIES 1 TWINKIES 01-OCT-2014 12:00:02 01-OCT-2014 12:00:01 01-OCT-2014 12:00:07 1 TWINKIES 2 TWINKIES 01-OCT-2014 12:00:03 01-OCT-2014 12:00:01 01-OCT-2014 12:00:07 1 DINGDONGS 3 DINGDONGS 01-OCT-2014 12:00:04 01-OCT-2014 12:00:01 01-OCT-2014 12:00:07 1 HOHOS 4 HOHOS 01-OCT-2014 12:00:05 01-OCT-2014 12:00:01 01-OCT-2014 12:00:07 1 HOHOS 5 HOHOS 01-OCT-2014 12:00:06 01-OCT-2014 12:00:01 01-OCT-2014 12:00:07 1 TWINKIES 6 TWINKIES 01-OCT-2014 12:00:07 01-OCT-2014 12:00:01 01-OCT-2014 12:00:07 1 TWINKIES 7 TWINKIES 01-OCT-2014 12:00:12 01-OCT-2014 12:00:12 01-OCT-2014 12:00:20 2 TWINKIES 12 TWINKIES 01-OCT-2014 12:00:13 01-OCT-2014 12:00:12 01-OCT-2014 12:00:20 2 TWINKIES 13 TWINKIES 01-OCT-2014 12:00:14 01-OCT-2014 12:00:12 01-OCT-2014 12:00:20 2 DINGDONGS 14 DINGDONGS 01-OCT-2014 12:00:15 01-OCT-2014 12:00:12 01-OCT-2014 12:00:20 2 DINGDONGS 15 DINGDONGS 01-OCT-2014 12:00:16 01-OCT-2014 12:00:12 01-OCT-2014 12:00:20 2 HOHOS 16 HOHOS 01-OCT-2014 12:00:17 01-OCT-2014 12:00:12 01-OCT-2014 12:00:20 2 TWINKIES 17 TWINKIES 01-OCT-2014 12:00:18 01-OCT-2014 12:00:12 01-OCT-2014 12:00:20 2 TWINKIES 18 TWINKIES 01-OCT-2014 12:00:19 01-OCT-2014 12:00:12 01-OCT-2014 12:00:20 2 TWINKIES 19 TWINKIES 01-OCT-2014 12:00:20 01-OCT-2014 12:00:12 01-OCT-2014 12:00:20 2 TWINKIES 20 TWINKIES 16 rows selected. */ /* YET ANOTHER EXAMPLE http://docs.oracle.com/database/121/DWHSG/pattern.htm#DWHSG8959 */ /* The MATCH_RECOGNIZE clause lets you choose between showing one row per match and all rows per match. In this example, the shorter output of one row per match is used. */ CREATE TABLE Ticker (SYMBOL VARCHAR2(10), tstamp DATE, price NUMBER); INSERT INTO Ticker VALUES('ACME', '01-Apr-11', 12); INSERT INTO Ticker VALUES('ACME', '02-Apr-11', 17); INSERT INTO Ticker VALUES('ACME', '03-Apr-11', 19); INSERT INTO Ticker VALUES('ACME', '04-Apr-11', 21); INSERT INTO Ticker VALUES('ACME', '05-Apr-11', 25); INSERT INTO Ticker VALUES('ACME', '06-Apr-11', 12); INSERT INTO Ticker VALUES('ACME', '07-Apr-11', 15); INSERT INTO Ticker VALUES('ACME', '08-Apr-11', 20); INSERT INTO Ticker VALUES('ACME', '09-Apr-11', 24); INSERT INTO Ticker VALUES('ACME', '10-Apr-11', 25); INSERT INTO Ticker VALUES('ACME', '11-Apr-11', 19); INSERT INTO Ticker VALUES('ACME', '12-Apr-11', 15); INSERT INTO Ticker VALUES('ACME', '13-Apr-11', 25); INSERT INTO Ticker VALUES('ACME', '14-Apr-11', 25); INSERT INTO Ticker VALUES('ACME', '15-Apr-11', 14); INSERT INTO Ticker VALUES('ACME', '16-Apr-11', 12); INSERT INTO Ticker VALUES('ACME', '17-Apr-11', 14); INSERT INTO Ticker VALUES('ACME', '18-Apr-11', 24); INSERT INTO Ticker VALUES('ACME', '19-Apr-11', 23); INSERT INTO Ticker VALUES('ACME', '20-Apr-11', 22); commit; SELECT * FROM Ticker MATCH_RECOGNIZE ( PARTITION BY symbol ORDER BY tstamp MEASURES STRT.tstamp AS start_tstamp, LAST(DOWN.tstamp) AS bottom_tstamp, LAST(UP.tstamp) AS end_tstamp ONE ROW PER MATCH AFTER MATCH SKIP TO LAST UP PATTERN (STRT DOWN+ UP+) DEFINE DOWN AS DOWN.price < PREV(DOWN.price), UP AS UP.price > PREV(UP.price) ) MR ORDER BY MR.symbol, MR.start_tstamp; /* What does this query do? The following explains each line in the MATCH_RECOGNIZE clause: - PARTITION BY divides the data from the Ticker table into logical groups where each group contains one stock symbol. - ORDER BY orders the data within each logical group by tstamp. - MEASURES defines three measures: a. the timestamp at the beginning of a V-shape (start_tstamp) b. the timestamp at the bottom of a V-shape (bottom_tstamp) c. the timestamp at the end of the a V-shape (end_tstamp). The bottom_tstamp and end_tstamp measures use the LAST() function to ensure that the values retrieved are the final value of the timestamp within each pattern match. - ONE ROW PER MATCH means that for every pattern match found, there will be one row of output. - AFTER MATCH SKIP TO LAST UP means that whenever you find a match you restart your search at the row that is the last row of the UP pattern variable. A pattern variable is a variable used in a MATCH_RECOGNIZE statement, and is defined in the DEFINE clause. Because you specified AFTER MATCH SKIP TO LAST UP in the query, two adjacent matches can share a row. That means a single date can have two variables mapped to it. For example, 10-April has both the pattern variables UP and STRT mapped to it: April 10 is the end of Match 1 and the start of Match 2. - PATTERN (STRT DOWN+ UP+) says that the pattern you are searching for has three pattern variables: STRT, DOWN, and UP. The plus sign (+) after DOWN and UP means that at least one row must be mapped to each of them. The pattern defines a regular expression, which is a highly expressive way to search for patterns. - DEFINE gives us the conditions that must be met for a row to map to your row pattern variables STRT, DOWN, and UP. Because there is no condition for STRT, any row can be mapped to STRT. Why have a pattern variable with no condition? You use it as a starting point for testing for matches. Both DOWN and UP take advantage of the PREV() function, which lets them compare the price in the current row to the price in the prior row. DOWN is matched when a row has a lower price than the row that preceded it, so it defines the downward (left) leg of our V-shape. A row can be mapped to UP if the row has a higher price than the row that preceded it. */ SELECT * FROM Ticker MATCH_RECOGNIZE ( PARTITION BY symbol ORDER BY tstamp MEASURES STRT.tstamp AS start_tstamp, FINAL LAST(DOWN.tstamp) AS bottom_tstamp, FINAL LAST(UP.tstamp) AS end_tstamp, MATCH_NUMBER() AS match_num, CLASSIFIER() AS var_match ALL ROWS PER MATCH AFTER MATCH SKIP TO LAST UP PATTERN (STRT DOWN+ UP+) DEFINE DOWN AS DOWN.price < PREV(DOWN.price), UP AS UP.price > PREV(UP.price) ) MR ORDER BY MR.symbol, MR.match_num, MR.tstamp; /* What does this query do? It is similar to the query in Example 20-1 except for items in the MEASURES clause, the change to ALL ROWS PER MATCH, and a change to the ORDER BY at the end of the query. In the MEASURES clause, there are these additions: - MATCH_NUMBER() AS match_num Because this example gives multiple rows per match, you need to know which rows are members of which match. MATCH_NUMBER assigns the same number to each row of a specific match. For instance, all the rows in the first match found in a row pattern partition are assigned the match_num value of 1. Note that match numbering starts over again at 1 in each row pattern partition. - CLASSIFIER() AS var_match To know which rows map to which variable, use the CLASSIFIER function. In this example, some rows will map to the STRT variable, some rows the DOWN variable, and others to the UP variable. - FINAL LAST() By specifying FINAL and using the LAST() function for bottom_tstamp, every row inside each match shows the same date for the bottom of its V-shape. Likewise, applying FINAL LAST() to the end_tstamp measure makes every row in each match show the same date for the end of its V-shape. Without this syntax, the dates shown would be the running value for each row. Changes were made in two other lines: - ALL ROWS PER MATCH - While Example 20-1 gave a summary with just 1 row about each match using the line ONE ROW PER MATCH, this example asks to show every row of each match. - ORDER BY on the last line - This was changed to take advantage of the MATCH_NUM, so all rows in the same match are together and in chronological order. Note that the row for April 10 appears twice because it is in two pattern matches: it is the last day of the first match and the first day of the second match. */ -- Example 20-3 Pattern Match with an Aggregate on a Variable SELECT * FROM Ticker MATCH_RECOGNIZE ( PARTITION BY symbol ORDER BY tstamp MEASURES MATCH_NUMBER() AS match_num, CLASSIFIER() AS var_match, FINAL COUNT(UP.tstamp) AS up_days, FINAL COUNT(tstamp) AS total_days, RUNNING COUNT(tstamp) AS cnt_days, price - STRT.price AS price_dif ALL ROWS PER MATCH AFTER MATCH SKIP TO LAST UP PATTERN (STRT DOWN+ UP+) DEFINE DOWN AS DOWN.price < PREV(DOWN.price), UP AS UP.price > PREV(UP.price) ) MR ORDER BY MR.symbol, MR.match_num, MR.tstamp; /* What does this query do? It builds on Example 20-2 by adding three measures that use the aggregate function COUNT(). It also adds a measure showing how an expression can use a qualified and unqualified column. The up_days measure (with FINAL COUNT) shows the number of days mapped to the UP pattern variable within each match. You can verify this by counting the UP labels for each match in Figure 20-2. The total_days measure (also with FINAL COUNT) introduces the use of unqualified columns. Because this measure specified the FINAL count(tstamp) with no pattern variable to qualify the tstamp column, it returns the count of all rows included in a match. The cnt_days measure introduces the RUNNING keyword. This measure gives a running count that helps distinguish among the rows in a match. Note that it also has no pattern variable to qualify the tstamp column, so it applies to all rows of a match. You do not need to use the RUNNING keyword explicitly in this case because it is the default. See "Running Versus Final Semantics and Keywords" for more information. The price_dif measure shows us each day's difference in stock price from the price at the first day of a match. In the expression "price - STRT.price)," you see a case where an unqualified column, "price," is used with a qualified column, "STRT.price". */ -- Example 20-4 Pattern Match for a W-Shape SELECT * FROM Ticker MATCH_RECOGNIZE ( PARTITION BY symbol ORDER BY tstamp MEASURES MATCH_NUMBER() AS match_num, CLASSIFIER() AS var_match, STRT.tstamp AS start_tstamp, FINAL LAST(UP.tstamp) AS end_tstamp ALL ROWS PER MATCH AFTER MATCH SKIP TO LAST UP PATTERN (STRT DOWN+ UP+ DOWN+ UP+) DEFINE DOWN AS DOWN.price < PREV(DOWN.price), UP AS UP.price > PREV(UP.price) ) MR ORDER BY MR.symbol, MR.match_num, MR.tstamp; /* What does this query do? It builds on the concepts introduced in Example 20-1 and seeks W-shapes in the data rather than V-shapes. The query results show one W-shape. To find the W-shape, the line defining the PATTERN regular expression was modified to seek the pattern DOWN followed by UP two consecutive times: PATTERN (STRT DOWN+ UP+ DOWN+ UP+). This pattern specification means it can only match a W-shape where the two V-shapes have no separation between them. For instance, if there is a flat interval with the price unchanging, and that interval occurs between two V-shapes, the pattern will not match that data. To illustrate the data returned, the output is set to ALL ROWS PER MATCH. Note that FINAL LAST(UP.tstamp) in the MEASURES clause returns the timestamp value for the last row mapped to UP. */ /* tear down */ drop table Ticker purge;
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50711 Source Host : localhost:3306 Source Database : 9314 Target Server Type : MYSQL Target Server Version : 50711 File Encoding : 65001 Date: 2017-12-05 22:46:54 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `9314_category` -- ---------------------------- DROP TABLE IF EXISTS `9314_category`; CREATE TABLE `9314_category` ( `cid` int(10) NOT NULL AUTO_INCREMENT, `classname` varchar(60) NOT NULL, `parentid` int(10) NOT NULL, `replynum` int(10) NOT NULL DEFAULT '0', `postnum` int(10) NOT NULL DEFAULT '0', `compere` char(10) DEFAULT NULL COMMENT '版主', `classpic` varchar(200) NOT NULL DEFAULT 'public/images/forum.gif' COMMENT '板块的图片', `orderby` smallint(6) NOT NULL DEFAULT '0', `lastpost` varchar(600) DEFAULT NULL, `ispass` tinyint(2) NOT NULL DEFAULT '1' COMMENT '审核状态,1为通过,0为未通过', `isremove` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否被删除', PRIMARY KEY (`cid`) ) ENGINE=MyISAM AUTO_INCREMENT=43 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of 9314_category -- ---------------------------- INSERT INTO 9314_category VALUES ('3', 'PHP框架', '1', '0', '1', '0', 'public/img/forum.gif', '3', '1512385758', '1', '0'); INSERT INTO 9314_category VALUES ('4', '开源产品', '1', '0', '1', '0', 'public/img/forum.gif', '2', '0', '1', '0'); INSERT INTO 9314_category VALUES ('5', '内核源码', '1', '0', '0', '0', 'public/img/forum.gif', '5', '0', '1', '0'); INSERT INTO 9314_category VALUES ('6', '进阶讨论', '1', '0', '1', '1', 'public/img/forum.gif', '1', '1512388124', '1', '0'); INSERT INTO 9314_category VALUES ('7', '名人故事', '2', '0', '0', '0', 'public/img/forum.gif', '1', '0', '1', '0'); INSERT INTO 9314_category VALUES ('8', '经验分享', '2', '0', '0', '0', 'public/img/forum.gif', '2', '0', '1', '0'); INSERT INTO 9314_category VALUES ('9', '求职招聘', '2', '0', '0', '0', 'public/img/forum.gif', '3', '0', '1', '0'); INSERT INTO 9314_category VALUES ('1', 'PHP技术交流', '0', '0', '3', '0', 'public/img/forum.gif', '3', '1512388124', '1', '0'); INSERT INTO 9314_category VALUES ('2', '程序人生', '0', '0', '1', '0', 'public/img/forum.gif', '1', '1512214426', '1', '0'); INSERT INTO 9314_category VALUES ('13', '一季飞舞', '0', '7', '12', '0', 'public/img/forum.gif', '6', '1512454936', '1', '0'); INSERT INTO 9314_category VALUES ('14', '时光巷陌', '13', '0', '1', '0', 'public/img/forum.gif', '11', '1512388886', '1', '0'); INSERT INTO 9314_category VALUES ('15', '凭兰秋思', '13', '0', '0', '0', 'public/img/forum.gif', '12', '0', '1', '0'); INSERT INTO 9314_category VALUES ('16', ' 凤凰台上忆吹箫', '0', '0', '1', '0', 'public/img/forum.gif', '21', '1512213418', '1', '0'); INSERT INTO 9314_category VALUES ('17', '恋慕如斯', '16', '0', '0', '0', 'public/img/forum.gif', '17', '0', '1', '0'); INSERT INTO 9314_category VALUES ('18', ' 断桥素伞', '16', '0', '0', '0', 'public/img/forum.gif', '18', '0', '1', '0'); INSERT INTO 9314_category VALUES ('19', '北以晨安', '13', '7', '11', '4', 'public/img/forum.gif', '0', '1512442164', '1', '0'); INSERT INTO 9314_category VALUES ('20', '琴瑟相思引', '16', '0', '0', '0', 'public/img/forum.gif', '20', '0', '1', '0'); INSERT INTO 9314_category VALUES ('36', '77777773', '33', '0', '0', '0', 'public/images/forum.gif', '0', '0', '1', '0'); INSERT INTO 9314_category VALUES ('26', '如花美眷', '16', '0', '0', '0', 'public/img/forum.gif', '0', '0', '1', '0'); INSERT INTO 9314_category VALUES ('27', '落晚芳菲', '13', '0', '1', '0', 'public/img/tle1.png', '0', '1512454936', '1', '0'); INSERT INTO 9314_category VALUES ('25', '彼年微凉', '13', '0', '1', '0', 'public/img/forum.gif', '0', '1512391926', '1', '0'); INSERT INTO 9314_category VALUES ('28', ' 兽炉沈水烟', '0', '0', '0', '0', 'public/images/forum.gif', '10', '0', '1', '0'); INSERT INTO 9314_category VALUES ('29', '彼岸蔚蓝', '28', '0', '0', '0', 'public/images/forum.gif', '0', '0', '1', '0'); INSERT INTO 9314_category VALUES ('33', '于鱼鱼鱼鱼1', '0', '0', '0', '', 'public/images/forum.gif', '45', '0', '1', '0'); INSERT INTO 9314_category VALUES ('34', '一样2', '33', '0', '0', '0', 'public/images/forum.gif', '5', '0', '1', '0'); INSERT INTO 9314_category VALUES ('37', 'yyyyyyyyyy1', '0', '0', '0', '', 'public/images/forum.gif', '0', '0', '1', '0'); INSERT INTO 9314_category VALUES ('38', 'uuuuuuu2', '37', '0', '0', '0', 'public/images/forum.gif', '0', '0', '0', '0'); INSERT INTO 9314_category VALUES ('39', '3m', '37', '0', '0', '0', 'public/images/forum.gif', '0', '0', '0', '0'); INSERT INTO 9314_category VALUES ('40', 'hhhhh4', '33', '0', '0', '0', 'public/images/forum.gif', '0', '0', '1', '0'); INSERT INTO 9314_category VALUES ('41', 'EEEEEEEE', '37', '0', '0', null, 'public/images/forum.gif', '0', null, '0', '0'); INSERT INTO 9314_category VALUES ('42', 'FFFFFFFFFF', '0', '0', '0', null, 'public/images/forum.gif', '0', null, '0', '0') -- ---------------------------- -- Table structure for `9314_closeip` -- ---------------------------- DROP TABLE IF EXISTS `9314_closeip`; CREATE TABLE `9314_closeip` ( `pid` int(10) NOT NULL AUTO_INCREMENT, `ip` int(12) NOT NULL, `addtime` int(12) NOT NULL, `overtime` int(11) DEFAULT NULL, `forever` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否永久禁止,默认为0,不永久禁止', PRIMARY KEY (`pid`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of 9314_closeip -- ---------------------------- -- ---------------------------- -- Table structure for `9314_details` -- ---------------------------- DROP TABLE IF EXISTS `9314_details`; CREATE TABLE `9314_details` ( `tid` int(10) NOT NULL AUTO_INCREMENT, `tidtype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '判断是发帖还是回帖,0为回帖,1为发帖', `replyid` int(10) NOT NULL DEFAULT '0' COMMENT '看用户针对哪一条帖子做的回复,默认为0,即发帖', `authorid` int(10) NOT NULL, `title` varchar(600) DEFAULT NULL, `content` mediumtext NOT NULL, `postime` int(12) NOT NULL, `postip` int(12) NOT NULL, `cid` int(10) NOT NULL COMMENT '板块cid', `replycount` int(12) NOT NULL DEFAULT '0' COMMENT '回复数量', `views` int(12) NOT NULL DEFAULT '0' COMMENT '浏览数量', `ishot` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否是热门贴,默认0为非热门,1为热门', `essence` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否是精华帖,0为非精华帖,1为精华帖', `istop` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否置顶,默认0不置顶,1置顶', `toptime` int(10) DEFAULT '0' COMMENT '置顶时间', `price` smallint(3) NOT NULL DEFAULT '0' COMMENT '帖子售价', `isdel` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否放入回收站,默认为0不放入,1加入回收站', `ishighlight` char(10) DEFAULT NULL COMMENT '是否高亮', `isdisplay` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否屏蔽回复的内容,默认0不屏蔽,1屏蔽', PRIMARY KEY (`tid`) ) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of 9314_details -- ---------------------------- INSERT INTO 9314_details VALUES ('1', '1', '0', '4', 'efref', 'ergrg', '1512206843', '2130706433', '19', '0', '0', '0', '1', '0', '0', '4', '0', null, '0'); INSERT INTO 9314_details VALUES ('2', '1', '0', '4', 'free', '个人', '1512208396', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '1', null, '0'); INSERT INTO 9314_details VALUES ('3', '1', '0', '4', 'grt', 'rtg', '1512208451', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '1', null, '0'); INSERT INTO 9314_details VALUES ('4', '1', '0', '4', 'fffff', 'dfser', '1512208571', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('5', '1', '0', '4', 'sdfsc', 'sdcde', '1512209241', '2130706433', '19', '7', '0', '0', '0', '0', '0', '3', '0', null, '0'); INSERT INTO 9314_details VALUES ('6', '1', '0', '1', '如图', '功夫功夫', '1512213418', '2130706433', '18', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('7', '1', '0', '1', 'ffff飞凤飞飞', '啊水滴石穿', '1512214426', '2130706433', '9', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('8', '1', '0', '1', 'tyt', 'dvcdv', '1512215266', '2130706433', '15', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('9', '1', '0', '1', '规范化菲', 'sea发热菲', '1512224746', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('10', '1', '0', '1', 'rgftrg ', 'erf e', '1512224816', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('11', '1', '0', '4', '发反反复复', '<p>\r\n 房东v</p>\r\n', '1512348128', '2130706433', '4', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('12', '1', '0', '1', 'ffffffff ', '<p>\r\n ffffffffffffff&nbsp;</p>\r\n', '1512385758', '2130706433', '3', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('13', '1', '0', '1', '发DVD', '<p>\r\n 成都市场是</p>\r\n', '1512388124', '2130706433', '6', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('14', '1', '0', '1', 'fgfgf', '<p>\r\n rtgr4tgfe</p>\r\n', '1512388886', '2130706433', '14', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('15', '1', '0', '5', '修改头像成功啦', '<p>\r\n 哈哈哈哈哈哈哈哈哈哈哈或或或或</p>\r\n', '1512391926', '2130706433', '25', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('16', '1', '0', '5', '法国分别', '<p>\r\n 松岛枫侧</p>\r\n', '1512392607', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('17', '0', '5', '4', null, '<p>\r\n hey ! i saw you !!</p>\r\n', '1512439835', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('18', '0', '5', '4', null, '<p>\r\n 发现回复的时候大板块的replynum没有加1</p>\r\n', '1512440040', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('19', '0', '5', '4', null, '<p>\r\n 这次看有没有加一啊???</p>\r\n', '1512440650', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('20', '0', '5', '4', null, '<p>\r\n 那这一次呢???</p>\r\n', '1512440714', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('21', '0', '5', '4', null, '<p>\r\n 最后一次???</p>\r\n', '1512440765', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '0', null, '0'); INSERT INTO 9314_details VALUES ('22', '0', '5', '4', null, '<p>\r\n 对啦</p>\r\n', '1512441936', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '1', null, '0'); INSERT INTO 9314_details VALUES ('23', '0', '5', '4', null, '<p>\r\n 黑</p>\r\n', '1512441985', '2130706433', '19', '0', '0', '0', '0', '0', '0', '0', '1', null, '0'); INSERT INTO 9314_details VALUES ('24', '1', '0', '4', 'erewe', '<p>\r\n dfwe</p>\r\n', '1512442164', '2130706433', '19', '0', '0', '0', '0', '0', '0', '2', '0', null, '0'); INSERT INTO 9314_details VALUES ('25', '1', '0', '1', '吞吞吐吐', '<p>\r\n 你妈妈木木木木木木木</p>\r\n', '1512454936', '2130706433', '27', '0', '0', '0', '0', '0', '0', '9', '0', null, '0') -- ---------------------------- -- Table structure for `9314_link` -- ---------------------------- DROP TABLE IF EXISTS `9314_link`; CREATE TABLE `9314_link` ( `lid` smallint(6) NOT NULL AUTO_INCREMENT, `showorder` tinyint(2) NOT NULL DEFAULT '0', `name` varchar(30) NOT NULL, `url` varchar(255) NOT NULL, `description` mediumtext, `logo` varchar(255) DEFAULT NULL, `addtime` int(12) NOT NULL, `ishow` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否被显示', PRIMARY KEY (`lid`) ) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of 9314_link -- ---------------------------- INSERT INTO 9314_link VALUES ('1', '1', '官方论坛', 'http://www.discuz.net', '提供最新 Discuz! 产品新闻、软件下载与技术交流', 'public/img/link.gif', '1508649238', '0'); INSERT INTO 9314_link VALUES ('2', '3', '漫游平台', 'http://www.manyou.com/', '', '', '2147483647', '0'); INSERT INTO 9314_link VALUES ('3', '2', 'Yeswan', 'http://www.yeswan.com/', '', '', '1508649284', '0'); INSERT INTO 9314_link VALUES ('4', '1', '我的领地', 'http://www.5d6d.com/', '', '', '2147483647', '1'); INSERT INTO 9314_link VALUES ('5', '4', '百度', 'http://www.baidu.com', '', '', '1508999422', '0'); INSERT INTO 9314_link VALUES ('6', '5', '亡与栀枯', 'http://www.skxto9314.com', '个人网站,bbs论坛', 'hi chuan', '1512395837', '0'); INSERT INTO 9314_link VALUES ('7', '6', '风花雪月话阳光', 'http://www.skxto9314.com', '若有风来 便随风来 等风走 若有思念来袭 便随思念来 等思念走 如此 定然会有痛苦吧 或许会留下来就此生活吧 或许在生活中会就此离去吧', '没关系,是爱情', '1512395837', '0'); INSERT INTO 9314_link VALUES ('8', '56', 'rrrrrrrrrrr', 'tttttttttt', 'hhhhhhhhh', 'hhhhhhhh', '1508999488', '1'); INSERT INTO 9314_link VALUES ('9', '8', 'EWR', '', '', '', '1512395861', '0'); -- ---------------------------- -- Table structure for `9314_order` -- ---------------------------- DROP TABLE IF EXISTS `9314_order`; CREATE TABLE `9314_order` ( `oid` int(10) NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL, `tid` int(11) NOT NULL, `rate` int(11) NOT NULL, `addtime` int(11) NOT NULL, `ispay` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否已付款', PRIMARY KEY (`oid`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of 9314_order -- ---------------------------- INSERT INTO 9314_order VALUES ('1', '5', '5', '3', '1512377025', '1'); INSERT INTO 9314_order VALUES ('2', '1', '5', '3', '1512379501', '1'); INSERT INTO 9314_order VALUES ('3', '1', '24', '2', '1512442222', '1'); INSERT INTO 9314_order VALUES ('4', '3', '25', '9', '1512455091', '1'); -- ---------------------------- -- Table structure for `9314_user` -- ---------------------------- DROP TABLE IF EXISTS `9314_user`; CREATE TABLE `9314_user` ( `uid` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(60) NOT NULL, `password` char(32) NOT NULL, `email` char(30) NOT NULL, `undertype` tinyint(2) NOT NULL DEFAULT '0' COMMENT '0为普通用户,1为管理员', `regtime` int(10) NOT NULL, `checkdel` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否被删除,默认为0不删除,1为删除', `lastime` int(10) NOT NULL, `regip` int(10) NOT NULL, `pic` varchar(60) NOT NULL DEFAULT 'public/img/avatar.gif' COMMENT '用户头像', `grade` int(10) DEFAULT '0' COMMENT '积分', `realname` varchar(50) DEFAULT NULL, `sex` tinyint(2) DEFAULT NULL, `birthday` varchar(50) DEFAULT NULL, `address` varchar(50) DEFAULT NULL, `autograph` varchar(50) DEFAULT NULL, `qq` bigint(10) DEFAULT NULL, `allowlogin` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否运行登录,0为允许,1为不允许登录', `problem` varchar(255) DEFAULT NULL COMMENT '是否设置安全提问,默认为空', `anser` varchar(255) DEFAULT NULL COMMENT '安全提问的答案', `trynum` int(10) NOT NULL DEFAULT '0' COMMENT '用户登录失败的次数', `everlogin` tinyint(2) DEFAULT '0' COMMENT '判断是否登陆过,默认为0,没有登陆过', PRIMARY KEY (`uid`) ) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of 9314_user -- ---------------------------- INSERT INTO 9314_user VALUES ('1', '奚梦瑶-Miss', 'eced110fa1737081f2ea67d875118c62', '2608153909@qq.com', '0', '1512182400', '0', '1512182400', '2130706433', '../upload/2017/12/05/5a25f798b61fc.gif', '65', 'WHY', '3', '1990-11-15', '江西省', '<p> ffffffffffff</p>', '2608153909', '0', '', null, '1', '1'); INSERT INTO 9314_user VALUES ('2', '大幂幂-Miss', '8ce303623c33ebf2063ba5822f5b1c52', '2608153909@qq.com', '0', '1512183257', '0', '1512183257', '2130706433', '../upload/2017/12/04/5a254452a423b.jpg', '57', '', '2', '年-月-日', null, '', null, '0', '', null, '0', '0'); INSERT INTO 9314_user VALUES ('3', '唐嫣-Miss', '8ce303623c33ebf2063ba5822f5b1c52', '2608153909@qq.com', '0', '1512183336', '0', '1512183336', '2130706433', '../upload/2017/12/05/5a2612177cd53.jpg', '15', '', '2', '年-月-日', null, '<p> gggggggggggggggggggg</p>', null, '1', '', null, '0', '1'); INSERT INTO 9314_user VALUES ('4', '郑智薰-Mr', '8ce303623c33ebf2063ba5822f5b1c52', '2608153909@qq.com', '0', '1512183434', '0', '1512183434', '2130706433', '../upload/2017/12/05/5a25fa64819e8.jpg', '18', null, null, null, null, null, null, '0', null, null, '0', '0'); INSERT INTO 9314_user VALUES ('5', '言承旭-Jerry', '8ce303623c33ebf2063ba5822f5b1c52', '2608153909@qq.com', '1', '1512182400', '0', '1512182400', '2130706433', '../upload/2017/12/04/5a2544c98a74c.jpg', '38', 'WHY', '3', '', '江西省', '<p> ffffffffffff</p>', null, '0', '', null, '1', '1'); INSERT INTO 9314_user VALUES ('6', '周杰伦-Mr', '8ce303623c33ebf2063ba5822f5b1c52', '2608153909@qq.com', '0', '1512470836', '0', '1512470836', '2130706433', 'public/img/avatar.gif', '5', '', '2', '年-月-日', null, '', null, '0', '', null, '0', '0') -- ---------------------------- -- Table structure for `9314_user_copy` -- ---------------------------- DROP TABLE IF EXISTS `9314_user_copy`; CREATE TABLE `9314_user_copy` ( `uid` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(60) NOT NULL, `password` char(32) NOT NULL, `email` char(30) NOT NULL, `undertype` tinyint(2) NOT NULL DEFAULT '0' COMMENT '0为普通用户,1为管理员', `regtime` int(10) NOT NULL, `checkdel` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否被删除,默认为0不删除,1为删除', `lastime` int(10) NOT NULL, `regip` int(10) NOT NULL, `pic` varchar(60) NOT NULL DEFAULT 'public/img/avatar.gif' COMMENT '用户头像', `grade` int(10) DEFAULT '0' COMMENT '积分', `realname` varchar(50) DEFAULT NULL, `sex` tinyint(2) DEFAULT NULL, `birthday` varchar(50) DEFAULT NULL, `address` varchar(50) DEFAULT NULL, `autograph` varchar(50) DEFAULT NULL, `qq` bigint(10) DEFAULT NULL, `allowlogin` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否运行登录,0为允许,1为不允许登录', `problem` varchar(255) DEFAULT NULL COMMENT '是否设置安全提问,默认为空', `anser` varchar(255) DEFAULT NULL COMMENT '安全提问的答案', `trynum` int(10) NOT NULL DEFAULT '0' COMMENT '用户登录失败的次数', `everlogin` tinyint(2) DEFAULT '0' COMMENT '判断是否登陆过,默认为0,没有登陆过', PRIMARY KEY (`uid`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of 9314_user_copy -- ---------------------------- INSERT INTO 9314_user_copy VALUES ('1', '奚梦瑶-Miss', 'eced110fa1737081f2ea67d875118c62', '2608153909@qq.com', '0', '1512182400', '0', '1512182400', '2130706433', '../upload/2017/12/05/5a25f798b61fc.gif', '65', 'WHY', '3', '1990-11-15', '江西省', '<p> ffffffffffff</p>', '2608153909', '0', '', null, '1', '1'); INSERT INTO 9314_user_copy VALUES ('2', '大幂幂-Miss', '8ce303623c33ebf2063ba5822f5b1c52', '2608153909@qq.com', '0', '1512183257', '0', '1512183257', '2130706433', '../upload/2017/12/04/5a254452a423b.jpg', '57', '', '2', '年-月-日', null, '', null, '0', '', null, '0', '0'); INSERT INTO 9314_user_copy VALUES ('3', '唐嫣-Miss', '8ce303623c33ebf2063ba5822f5b1c52', '2608153909@qq.com', '0', '1512183336', '0', '1512183336', '2130706433', '../upload/2017/12/05/5a2612177cd53.jpg', '15', '', '2', '年-月-日', null, '<p> gggggggggggggggggggg</p>', null, '1', '', null, '0', '1'); INSERT INTO 9314_user_copy VALUES ('4', '郑智薰-Mr', '8ce303623c33ebf2063ba5822f5b1c52', '2608153909@qq.com', '0', '1512183434', '0', '1512183434', '2130706433', '../upload/2017/12/05/5a25fa64819e8.jpg', '18', null, null, null, null, null, null, '0', null, null, '0', '0'); INSERT INTO 9314_user_copy VALUES ('5', '言承旭-Jerry', '8ce303623c33ebf2063ba5822f5b1c52', '2608153909@qq.com', '1', '1512182400', '0', '1512182400', '2130706433', '../upload/2017/12/04/5a2544c98a74c.jpg', '38', 'WHY', '3', '', '江西省', '<p> ffffffffffff</p>', null, '0', '', null, '1', '1')
CREATE TABLE PUBLIC.IDENTITY( OBJECTKEY UUID NOT NULL, NICK VARCHAR(200) NOT NULL, PUBLICKEY VARCHAR(1000) NOT NULL, PRIMARY KEY (OBJECTKEY) ); CREATE TABLE PUBLIC.LOGIN( OBJECTKEY UUID NOT NULL, IDENTITYKEY UUID NOT NULL, LOGINNAME VARCHAR(200) NOT NULL, PASSWORD VARCHAR(200) NOT NULL, PRIMARY KEY (OBJECTKEY) ); CREATE TABLE PUBLIC.CIRCLE( OBJECTKEY UUID NOT NULL, IDENTITYKEY UUID NOT NULL, NAME VARCHAR(200), PRIMARY KEY (OBJECTKEY) ); CREATE TABLE PUBLIC.OBJECTHISTORY ( OBJECTKEY UUID NOT NULL, OBJECTTYPE VARCHAR(25) NOT NULL, CREATED TIMESTAMP NOT NULL, LASTMODIFIED TIMESTAMP, LASTSHOWN TIMESTAMP, DESCRIPTION VARCHAR(2000), HTMLSRC CLOB, TEXTCONTENT VARCHAR(64000), VERSION INT NOT NULL, PRIMARY KEY (OBJECTKEY,VERSION) ); ALTER TABLE PUBLIC.OBJECTLIST ADD VERSION INT NOT NULL DEFAULT 0; ALTER TABLE PUBLIC.FILEDATA ALTER COLUMN MIMETYPE VARCHAR(400); --inserts por defecto y sus relaciones insert into objectlist values (00000000-0000-0000-0000-000000000001,'tag',TODAY,TODAY,TODAY,'system',null,'system',0); insert into objectlist values (00000000-0000-0000-0000-000000000002,'tag',TODAY,TODAY,TODAY,'PUBLIC',null,'PUBLIC',0); insert into link values(00000000-0000-0000-0001-000000000000,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002,'tag',TODAY,0); insert into objectlist values (00000000-0000-0000-0000-000000000003,'tag',TODAY,TODAY,TODAY,'BOOKMARK',null,'BOOKMARK',0); insert into link values(00000000-0000-0000-0002-000000000000,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000003,'tag',TODAY,0); insert into objectlist values (00000000-0000-0000-0000-000000000004,'tag',TODAY,TODAY,TODAY,'PUBLIC_EDITABLE',null,'PUBLIC_EDITABLE',0); insert into link values(00000000-0000-0000-0003-000000000000,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000004,'tag',TODAY,0);
 CREATE View [DW].[Date] as SELECT [DateSID] ,[Date] ,[Year] ,[Month] ,[Day] ,[YearMonth] ,[MonthName] ,[MonthNamePre] ,[MonthNameShort] ,[WeekNumber1] ,[WeekNumber2] ,[DayofWeek] ,[DayName] ,[DayNameShort] ,[Trimester] ,[Quarter] ,[WorkDay] ,[WorkDaySum] ,[WorkDayName] ,[YearTrimester] ,[YearQuarter] ,[YearWeekNumber1] ,[YearWeekNumber2] ,[WeekNumber1DayOfWeek] ,[WeekNumber2DayOfWeek] ,[YearWeekNumber1DayOfWeek] ,[YearWeekNumber2DayOfWeek] ,[PrevYearCompareDate] ,[PrevYearCompareWeek] ,[HalfOfYear] ,[YearHalfOfYear] FROM [DW].[DimDate] where datesid between (select min(datesid) from DW.Wasteless) and (select max(datesid) from DW.Wasteless)
ALTER TABLE customer_ssn ADD COLUMN owner_type varchar(25) NOT NULL default 'customer';
create table HangSanXuat( MaHangSanXuat nvarchar(15) primary key not null, TenHangSanXuat nvarchar(50)) create table KieuDang( MaKieu nvarchar(15) primary key not null, TenKieu nvarchar(50)) create table MauSac( MaMau nvarchar(15) primary key not null, TenMau nvarchar(50)) create table ManHinh( MaManHinh nvarchar(15) primary key not null, TenManHinh nvarchar(50)) create table CoManHinh( MaCo nvarchar(15) primary key not null, KichCo nvarchar(15)) create table NuocSanXuat( MaNuocSX nvarchar(15) primary key not null, TenNuocSX nvarchar(50)) create table DMTV( MaTV nvarchar(15)primary key not null, TenTV nvarchar(50)not null, MaHangSanXuat nvarchar(15) not null, foreign key(MaHangSanXuat) references HangSanXuat(MaHangSanXuat), MaKieu nvarchar(15) not null, foreign key(MaKieu) references KieuDang(MaKieu), MaMau nvarchar(15) not null, foreign key(MaMau) references MauSac(MaMau), MaManHinh nvarchar(15) not null, foreign key(MaManHinh) references ManHinh(MaManHinh), MaCo nvarchar(15) not null, foreign key(MaCo) references CoManHinh(MaCo), MaNuocSX nvarchar(15) not null, foreign key(MaNuocSX) references NuocSanXuat(MaNuocSX), SoLuong int, DonGiaNhap float, DonGiaBan float, Anh nvarchar, ThoiGianBanHanh nvarchar(20)) ---------------- create table CongViec( MaCV nvarchar(15) primary key not null, TenCV nvarchar(50)) create table CaLam( MaCa nvarchar(15) primary key not null, TenCa nvarchar(50)) create table NhanVien( MaNV nvarchar(15) primary key not null, TenNhanVien nvarchar(50), GioiTinh nvarchar(3), NgaySinh datetime, DienThoai nvarchar(15), DiaChi nvarchar(50), MaCa nvarchar(15), foreign key(MaCa) references CaLam(MaCa), MaCV nvarchar(15) foreign key(MaCV) references CongViec(MaCV)) create table KhachHang( MaKhach nvarchar(15) primary key not null, TenKhach nvarchar(50), DiaChi nvarchar(50), DienThoai nvarchar(15)) create table HoaDonBan( SoHDB nvarchar(30) primary key not null, MaNV nvarchar(15), foreign key (MaNV) references NhanVien(MaNV), MaKhach nvarchar(15), foreign key(MaKhach) references KhachHang(MaKhach), NgayBan date, Thue float, TongTien float) create table NhaCungCap( MaNCC nvarchar(15) primary key not null, TenNCC nvarchar(50), DiaChi nvarchar(50), DienThoai nvarchar(15)) create table HoaDonNhap( SoHDN nvarchar(30) primary key not null, MaNV nvarchar(15), foreign key (MaNV) references NhanVien(MaNV), NgayNhap datetime, MaNCC nvarchar(15), foreign key (MaNCC) references NhaCungCap(MaNCC), TongTien float) create table ChiTietHDB( SoHDB nvarchar(30) foreign key references HoaDonBan(SoHDB) on update cascade, MaTV nvarchar(15), foreign key(MaTV) references DMTV(MaTV)on update cascade, primary key(SoHDB,MaTV), SoLuong int, DonGia float, GiamGia float, ThanhTien float) create table ChiTietHDN( SoHDN nvarchar(30) foreign key references HoaDonNhap(SoHDN) on update cascade, MaTV nvarchar(15), foreign key(MaTV) references DMTV(MaTV)on update cascade, primary key(SoHDN,MaTV), SoLuong int, DonGia float, GiamGia float, ThanhTien float)
-- phpMyAdmin SQL Dump -- version 4.8.0 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: 2018 年 4 月 17 日 09:00 -- サーバのバージョン: 5.7.21-log -- PHP Version: 5.6.34 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: `oniyoshi` -- -- -------------------------------------------------------- -- -- テーブルの構造 `datas` -- CREATE TABLE `datas` ( `tweetid` int(11) NOT NULL, `username` char(20) NOT NULL, `message` text NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- テーブルのデータのダンプ `datas` -- INSERT INTO `datas` (`tweetid`, `username`, `message`, `created`) VALUES (1, 'ohnishi', 'sdf', '2018-04-16 23:01:42'), (2, 'ohnishi', 'ert', '2018-04-16 23:05:05'), (3, 'ohnishi', 'ert', '2018-04-16 23:05:21'), (4, '12345', 'aaaaa', '2018-04-16 23:12:34'); -- -------------------------------------------------------- -- -- テーブルの構造 `follows` -- CREATE TABLE `follows` ( `id` int(11) NOT NULL, `username` char(20) NOT NULL, `followuser` char(20) NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- テーブルの構造 `users` -- CREATE TABLE `users` ( `username` char(20) NOT NULL, `password` char(100) NOT NULL, `name` char(20) NOT NULL, `mail` char(100) NOT NULL, `secret` tinyint(1) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- テーブルのデータのダンプ `users` -- INSERT INTO `users` (`username`, `password`, `name`, `mail`, `secret`) VALUES ('assss', '$2y$10$rcjT/V.HromQ9BGaImSRA.EjgkK7nJZ.n2SDxqH1oE6ApzA45eDnq', 'hhhhh', 'hhhhh', 1), ('hhhhh', '$2y$10$DdP5ustencYgridm6fynyu8jr/V4gaNuEqWUPYQ6TuoENZl3tU1eC', 'hhhhh', 'hhhhh', 1), ('hiroaki', '$2y$10$ooWH/PO4n/IcQCDuHj8BQuj6SxS/xrTcJn1EQomkih0Wr3kgNxz4.', 'hiroaki', 'hiroaki', 0), ('kazusi', '$2y$10$VALzQCbemXnRM2GwPvOO0.tOkh25wre1qqf/GH4ETKrTGJiV7F562', 'kazusi', 'kazusi', 0), ('masaaki', '$2y$10$mI6nqPbkejcyZKNiuw7S7OQ3Jn17vdYmM3CYW4v2V1zVk6.SULrM.', 'masaaki', 'masaaki', 0), ('ohnishi', '$2y$10$tIbRvOGcZNSlmAGrs9G1hOJu1gH/IjAeHe1rNJqb1nIDVryX.Bfhq', 'ohnishi', 'ohnsihi', 0), ('onioni', '$2y$10$qHZr6jqivkRwMaVX5R.g6uB3uLnSK7WoBo3zsnoUxkCXj0BGek8t.', 'onioni', 'onioni', 0), ('oniyoshi', '$2y$10$F2ES60mXQmjWp15bmpjT4eH5CmAdPb8T3DAKJDoI5pJ1t48porJNC', 'oniyoshi', 'oniyoshi', 0), ('ooooo', '$2y$10$XP0LdqkVfVjGid5aapczLOQ2ETgIfCfMGoH9do1Ur4QAP3gIVEi22', 'ooooo', 'ooooo', 0), ('sssss', '$2y$10$1vk57NPehYqMX2wcjjW6COBbGhP7ZszQ7lM4wgazDPOOlPciJKvna', 'sssss', 'sssss', 0), ('wwwww', '$2y$10$vBmW9X3X1x9oGZq6p0HbAeBk4zew96WSznbVnEGmndMVK3qmKplPe', 'wwwww', 'wwwww', 0), ('yoshiaki', '$2y$10$A9rhhWqg5G931rOcbkC.EebcrI2okSTVlc0tPaTtGSVNx135jCfQa', 'yoshiaki', 'yoshiaki', 0), ('zzzzz', '$2y$10$rvIzWcMyfzrmcjL5K63.Hep1TaxoLrrMMUWPsecHm2y///Wom5ypy', 'zzzzz', 'zzzzzz', 0), ('qwer', '$2y$10$Lh7CSxjdHzZHuvx7T9BRZeF2Vl2bq3pP26JCkZv5p/QeANXM0zvra', 'qwer', 'qwer', 0), ('12345', '$2y$10$yjOAvfV2YXe3uee5aQyoMOzH4bO0Xh9sliMdaYdIbfaawx0d8dAYO', '12345', '12345', 0); -- -- Indexes for dumped tables -- -- -- Indexes for table `datas` -- ALTER TABLE `datas` ADD PRIMARY KEY (`tweetid`); -- -- Indexes for table `follows` -- ALTER TABLE `follows` ADD PRIMARY KEY (`id`), ADD KEY `username` (`username`), ADD KEY `followuser` (`followuser`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `datas` -- ALTER TABLE `datas` MODIFY `tweetid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `follows` -- ALTER TABLE `follows` 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 */;
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Oct 05, 2020 at 12:13 PM -- Server version: 10.4.14-MariaDB -- PHP Version: 7.2.33 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: `test_crud_2020` -- -- -------------------------------------------------------- -- -- Table structure for table `test` -- CREATE TABLE `test` ( `idKaryawan` int(11) NOT NULL, `Nik` varchar(9) NOT NULL, `Nama` varchar(100) NOT NULL, `NamaTim` varchar(128) NOT NULL, `Pemimpin` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `test` -- INSERT INTO `test` (`idKaryawan`, `Nik`, `Nama`, `NamaTim`, `Pemimpin`) VALUES (12162971, '1234567', 'abdul mugni', 'tim 1', 'tim 1'); -- -- Indexes for dumped tables -- -- -- Indexes for table `test` -- ALTER TABLE `test` ADD PRIMARY KEY (`idKaryawan`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `test` -- ALTER TABLE `test` MODIFY `idKaryawan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12162972; 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 */;
-- -- Update sql for MailWizz EMA from version 1.3.6.8 to 1.3.6.9 -- -- -- Table structure for table `email_blacklist_monitor` -- CREATE TABLE IF NOT EXISTS `email_blacklist_monitor` ( `monitor_id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `email_condition` CHAR(15) NULL, `email` VARCHAR(255) NULL, `reason_condition` CHAR(15) NULL, `reason` VARCHAR(255) NULL, `condition_operator` ENUM('and', 'or') NOT NULL DEFAULT 'and', `notifications_to` VARCHAR(255) NULL, `status` CHAR(15) NOT NULL DEFAULT 'active', `date_added` DATETIME NOT NULL, `last_updated` DATETIME NOT NULL, PRIMARY KEY (`monitor_id`)) ENGINE = InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- dpimp.sql /* The MIT License (MIT) Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ set escape off set verify off whenever sqlerror exit prompt dpimp starting ... set cloudconfig &dm_cloud_config connect &dm_target; set serveroutput on prompt Importing schema &dm_schema_imp ... DECLARE s varchar2(1000); h1 number; errorvarchar varchar2(100):= 'ERROR'; tryGetStatus number := 0; jobname varchar2(500); job_status VARCHAR2(500); -- new vars schemaexp VARCHAR2(500) := '&dm_schema_exp'; schemaimp VARCHAR2(500) := '&dm_schema_imp'; dpdir VARCHAR2(512) := '&dm_data_pump_dir'; dbver VARCHAR2(32) := 'COMPATIBLE'; -- not sure if we need to specify downgrade version here or in import - Turloch says same version for both storageUrl VARCHAR2(500) := '&dm_oci_bucket/o/&dm_data_pump_file'; credential VARCHAR2(200) := '&dm_credential'; BEGIN dbms_output.put_line('credential = '||credential); jobname:=DBMS_SCHEDULER.GENERATE_JOB_NAME('IMP_SD_'); dbms_output.put_line('JOB_NAME: '||jobname); -- dbms_output.put_line('/* STATUS */ select state from dba_datapump_jobs where job_name='''||jobname||''';'); h1 := dbms_datapump.open (operation => 'IMPORT', job_mode => 'SCHEMA', job_name => jobname , version => dbver); tryGetStatus := 1; dbms_datapump.set_parallel(handle => h1, degree => 1); --dbms_datapump.add_file(handle => h1, filename => 'IMPORT.LOG', directory => 'DATA_PUMP_DIR', filetype=>DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE); dbms_datapump.add_file(handle => h1, filename => schemaimp || '-IMP.LOG', directory => dpdir, filetype => 3); dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 1); dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN('''||schemaexp||''')'); DBMS_DATAPUMP.METADATA_REMAP(h1,'REMAP_SCHEMA',schemaexp,schemaimp); -- dbms_datapump.add_file(handle => h1, filename => schemaexp || '.DMP', directory => dpdir, filetype => 1); dbms_datapump.add_file(handle => h1, filename => storageUrl, directory => credential, filetype => dbms_datapump.ku$_file_type_uridump_file ); -- was ftype 5 -- /* for import from url replace the line above with */ dbms_datapump.add_file(handle => h1, filename => /*the url*/'https://theurl', directory => /*credential*/'THECREDENTIAL', filetype => 5); dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1); dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC'); dbms_datapump.set_parameter(handle => h1, name => 'SKIP_UNUSABLE_INDEXES', value => 0); dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0); dbms_datapump.wait_for_job(handle => h1, job_state => job_status); errorvarchar := 'DataPump Import Status: ''' || job_status || ''''; dbms_output.put_line(errorvarchar); EXCEPTION When Others then dbms_output.put_line(SQLERRM); dbms_output.put_line( dbms_utility.format_error_backtrace ); IF ((S IS NOT NULL) AND (S!='COMPLETED')) THEN DBMS_OUTPUT.PUT_LINE('WAIT_FOR_JOB JOB_STATE STATE='||s); END IF; DECLARE ind NUMBER; percent_done NUMBER; job_state VARCHAR2(30); le ku$_LogEntry; js ku$_JobStatus; jd ku$_JobDesc; sts ku$_Status; BEGIN /* on error try getstatus */ if ((errorvarchar = 'ERROR')AND(tryGetStatus=1)) then dbms_datapump.get_status(h1, dbms_datapump.ku$_status_job_error + dbms_datapump.ku$_status_job_status + dbms_datapump.ku$_status_wip,-1,job_state,sts); js := sts.job_status; /* If any work-in-progress (WIP) or Error messages were received for the job, display them.*/ if (bitand(sts.mask,dbms_datapump.ku$_status_wip) != 0) then le := sts.wip; else if (bitand(sts.mask,dbms_datapump.ku$_status_job_error) != 0) then le := sts.error; else le := null; end if; end if; if le is not null then ind := le.FIRST; if ind is not null then dbms_output.put_line('dbms_datapump.get_status('||h1||'...)'); end if; while ind is not null loop dbms_output.put_line(le(ind).LogText); ind := le.NEXT(ind); end loop; end if; END IF; EXCEPTION when others then null; END; BEGIN IF ((errorvarchar = 'ERROR')AND(tryGetStatus=1)) THEN DBMS_DATAPUMP.DETACH(h1); END IF; EXCEPTION WHEN OTHERS THEN NULL; END; --Raise; END; / disconnect; prompt dpimp exiting
/* Navicat MySQL Data Transfer Source Server : 333 Source Server Version : 50551 Source Host : localhost:3306 Source Database : 1 Target Server Type : MYSQL Target Server Version : 50551 File Encoding : 65001 Date: 2017-11-19 18:55:07 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for account -- ---------------------------- DROP TABLE IF EXISTS `account`; CREATE TABLE `account` ( `id` int(11) NOT NULL AUTO_INCREMENT, `number` int(11) NOT NULL, `money` double(10,2) NOT NULL, `type` int(11) NOT NULL, `createtime` datetime NOT NULL, `description` varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE if not exists PLANTS(commonName text, plantStatus text, dateAdded date);
SELECT table_catalog, table_schema, table_name, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_precision_radix, numeric_scale, datetime_precision, interval_type, interval_precision, character_set_catalog, character_set_schema, character_set_name, collation_catalog, collation_schema, collation_name, domain_catalog, domain_schema, udt_catalog, udt_schema, udt_name, scope_catalog, scope_schema, maximum_cardinality, dtd_identifier, is_self_referencing, is_identity, identity_generation, identity_start, identity_increment, identity_maximum, identity_minimum, identity_cycle, is_generated, generation_expression, is_updatable FROM information_schema.columns
CREATE TABLE category ( id BIGINT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(50) NOT NULL ) ENGINE=InnoDB; INSERT INTO category (name) values ('Lazer'); INSERT INTO category (name) values ('Alimentação'); INSERT INTO category (name) values ('Supermercado'); INSERT INTO category (name) values ('Farmácia'); INSERT INTO category (name) values ('Outros');
-- 2 series INSERT INTO series (title, author_id, subgenre_id) VALUES ("Romance", 5, 2); INSERT INTO series (title, author_id, subgenre_id) VALUES ("Romance", 6, 3); -- 6 books INSERT INTO books (title, year, series_id) VALUES ("Lover's Quarrel", 1870, 2); INSERT INTO books (title, year, series_id) VALUES ("Frankenstein", 1999, 4); INSERT INTO books (title, year, series_id) VALUES ("The Shinning", 2001, 4); INSERT INTO books (title, year, series_id) VALUES ("Jane Eyre", 2020, 1); INSERT INTO books (title, year, series_id) VALUES ("Cat in the Hat", 1875, 8); INSERT INTO books (title, year, series_id) VALUES ("Into the Wild", 2011, 2); -- 8 characters INSERT INTO characters (name, species, motto, author_id) VALUES ("Ariel", "mermaid", "Part of your World", 88); INSERT INTO characters (name, species, motto, author_id) VALUES ("Dracula", "monster", "Blood!", 99); INSERT INTO characters (name, species, motto, author_id) VALUES ("Jane", "human", "No Husband needed", 1); INSERT INTO characters (name, species, motto, author_id) VALUES ("Rocky", "dog", "Woof", 5); INSERT INTO characters (name, species, motto, author_id) VALUES ("Flounder", "fish", "Ahh!", 6); INSERT INTO characters (name, species, motto, author_id) VALUES ("Jack", "human", "Here comes Jonny!", 33); INSERT INTO characters (name, species, motto, author_id) VALUES ("Vivienne", "human", "Who even am I?", 8); INSERT INTO characters (name, species, motto, author_id) VALUES ("Frankie", "monster", "No fire please", 7); -- 2 subgenres INSERT INTO subgenres (name) VALUES ("horror"); INSERT INTO subgenres (name) VALUES ("children"); -- 2 authors INSERT INTO authors (name) VALUES ("Stephen King"); INSERT INTO authors (name) VALUES ("Dr. Suess"); -- 16 joins in character_books INSERT INTO character_books (book_id, character_id) VALUES (1,26); INSERT INTO character_books (book_id, character_id) VALUES (5,2); INSERT INTO character_books (book_id, character_id) VALUES (3,66); INSERT INTO character_books (book_id, character_id) VALUES (6,2); INSERT INTO character_books (book_id, character_id) VALUES (8,2); INSERT INTO character_books (book_id, character_id) VALUES (6,85); INSERT INTO character_books (book_id, character_id) VALUES (16,8); INSERT INTO character_books (book_id, character_id) VALUES (6,3); INSERT INTO character_books (book_id, character_id) VALUES (18,3); INSERT INTO character_books (book_id, character_id) VALUES (18,2); INSERT INTO character_books (book_id, character_id) VALUES (15,2); INSERT INTO character_books (book_id, character_id) VALUES (122,88); INSERT INTO character_books (book_id, character_id) VALUES (158,5); INSERT INTO character_books (book_id, character_id) VALUES (16,2); INSERT INTO character_books (book_id, character_id) VALUES (15,25); INSERT INTO character_books (book_id, character_id) VALUES (12,2);
INSERT INTO inventory VALUES(11110, '2019-11-01T00:00:00Z', 100) INSERT INTO inventory VALUES(16665, '2019-11-01T00:00:00Z', 100) INSERT INTO inventory VALUES(17776, '2019-11-01T00:00:00Z', 100) INSERT INTO inventory VALUES(18887, '2019-11-01T00:00:00Z', 100) INSERT INTO inventory VALUES(11110, '2019-11-02T00:00:00Z', 100) INSERT INTO inventory VALUES(16665, '2019-11-02T00:00:00Z', 100) INSERT INTO inventory VALUES(17776, '2019-11-02T00:00:00Z', 100) INSERT INTO inventory VALUES(18887, '2019-11-02T00:00:00Z', 100) INSERT INTO inventory VALUES(11110, '2019-11-03T00:00:00Z', 100) INSERT INTO inventory VALUES(16665, '2019-11-03T00:00:00Z', 100) INSERT INTO inventory VALUES(17776, '2019-11-03T00:00:00Z', 100) INSERT INTO inventory VALUES(18887, '2019-11-03T00:00:00Z', 100) INSERT INTO inventory VALUES(11110, '2019-11-04T00:00:00Z', 100) INSERT INTO inventory VALUES(16665, '2019-11-04T00:00:00Z', 100) INSERT INTO inventory VALUES(17776, '2019-11-04T00:00:00Z', 100) INSERT INTO inventory VALUES(18887, '2019-11-04T00:00:00Z', 100) INSERT INTO inventory VALUES(11110, '2019-11-05T00:00:00Z', 100) INSERT INTO inventory VALUES(16665, '2019-11-05T00:00:00Z', 100) INSERT INTO inventory VALUES(17776, '2019-11-05T00:00:00Z', 100) INSERT INTO inventory VALUES(18887, '2019-11-05T00:00:00Z', 100) INSERT INTO inventory VALUES(11110, '2019-11-06T00:00:00Z', 100) INSERT INTO inventory VALUES(16665, '2019-11-06T00:00:00Z', 100) INSERT INTO inventory VALUES(17776, '2019-11-06T00:00:00Z', 100) INSERT INTO inventory VALUES(18887, '2019-11-06T00:00:00Z', 100) INSERT INTO inventory VALUES(11110, '2019-11-07T00:00:00Z', 100) INSERT INTO inventory VALUES(16665, '2019-11-07T00:00:00Z', 100) INSERT INTO inventory VALUES(17776, '2019-11-07T00:00:00Z', 100) INSERT INTO inventory VALUES(18887, '2019-11-07T00:00:00Z', 100) INSERT INTO inventory VALUES(11110, '2019-11-08T00:00:00Z', 100) INSERT INTO inventory VALUES(16665, '2019-11-08T00:00:00Z', 100) INSERT INTO inventory VALUES(17776, '2019-11-08T00:00:00Z', 100) INSERT INTO inventory VALUES(18887, '2019-11-08T00:00:00Z', 100)
select * from train.Attendance where BookedBy is not null select * from train.Attendance where ISNULL(Outcome, 0) = 0 --and Creator = 289 select Staff.Sname + ', ' +Staff.Fname as StaffName, Courses.Course, Locations.Location, Sess.Strt, booker.Fname + ' ' + booker.Sname as BookedBy, Attendance.Created as BookedOn, Attendance.Comments from train.Attendance join train.Staff on Attendance.Staff = Staff.ID join train.Sess on Attendance.Sess = Sess.ID left join train.Courses on Sess.Course = Courses.ID left join train.Locations on Sess.Location = Locations.ID left join sys.server_principals on Attendance.Creator = principal_id left join train.Staff booker on Attendance.BookedBy = booker.ID or server_principals.name = booker.ADAccount where ISNULL(Attendance.Outcome, 0) = 0 and Courses.[External] = 0--and Attendance.Modifier = 289 order by Attendance.Created desc, Strt desc, Staff.Sname, Staff.Fname select Staff.Sname + ', ' +Staff.Fname as StaffName, Courses.Course, Sess.Strt, booker.Fname + ' ' + booker.Sname as CancelledBy, Attendance.Modified, Attendance.Comments from train.Attendance join train.Staff on Attendance.Staff = Staff.ID join train.Sess on Attendance.Sess = Sess.ID left join train.Courses on Sess.Course = Courses.ID left join sys.server_principals on Attendance.Modifier = principal_id left join train.Staff booker on Attendance.CancelledBy = booker.ID or (server_principals.name = booker.ADAccount and Attendance.CancelledBy is null) where ISNULL(Attendance.Outcome, 0) = 6 --and CancelledBy is not null--and Attendance.Modifier = 289 order by Attendance.Modified desc, Strt desc create view train.bookings as select top 100000 Staff.Sname + ', ' +Staff.Fname as StaffName, Courses.Course, Locations.Location, Sess.Strt, booker.Fname + ' ' + booker.Sname as BookedBy, Attendance.Created as BookedOn, Attendance.Comments from train.Attendance join train.Staff on Attendance.Staff = Staff.ID join train.Sess on Attendance.Sess = Sess.ID left join train.Courses on Sess.Course = Courses.ID left join train.Locations on Sess.Location = Locations.ID left join sys.server_principals on Attendance.Creator = principal_id left join train.Staff booker on Attendance.BookedBy = booker.ID or server_principals.name = booker.ADAccount where ISNULL(Attendance.Outcome, 0) = 0 and Courses.[External] = 0--and Attendance.Modifier = 289 order by Attendance.Created desc, Strt desc, Staff.Sname, Staff.Fname create view train.cancelations as select top 1000000 Staff.Sname + ', ' +Staff.Fname as StaffName, Courses.Course, Sess.Strt, booker.Fname + ' ' + booker.Sname as CancelledBy, Attendance.Modified, Attendance.Comments from train.Attendance join train.Staff on Attendance.Staff = Staff.ID join train.Sess on Attendance.Sess = Sess.ID left join train.Courses on Sess.Course = Courses.ID left join sys.server_principals on Attendance.Modifier = principal_id left join train.Staff booker on Attendance.CancelledBy = booker.ID or (server_principals.name = booker.ADAccount and Attendance.CancelledBy is null) where ISNULL(Attendance.Outcome, 0) = 6 --and CancelledBy is not null--and Attendance.Modifier = 289 order by Attendance.Modified desc, Strt desc, Staff.Sname, Staff.Fname select StaffName, Course, Location, Strt, BookedBy, BookedOn, Comments from train.bookings select StaffName, Course, Strt, CancelledBy, Modified, Comments from train.cancelations
-- -- Title: Upgrade to V3.2 - Remove AVM Issuer -- Database: Generic -- Since: V3.2 schema 2008 -- Author: janv -- -- remove AVM node issuer -- -- Please contact support@alfresco.com if you need assistance with the upgrade. -- -- drop issuer table drop table avm_issuer_ids; -- -- Record script finish -- DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.2-Remove-AVM-Issuer'; INSERT INTO alf_applied_patch (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report) VALUES ( 'patch.db-V3.2-Remove-AVM-Issuer', 'Manually executed script upgrade V3.2 to remove AVM Issuer', 0, 2007, -1, 2008, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed' );
-- Subquery SELECT DATE_TRUNC('day', occurred_at) AS day, channel, count(*) AS event_count FROM web_events GROUP BY 1,2 ORDER BY 1; SELECT * FROM (SELECT DATE_TRUNC('day', occurred_at) AS day, channel, count(*) AS event_count FROM web_events GROUP BY 1,2 ORDER BY 3 DESC) sub; SELECT channel, AVG(event_count) AS avg_event_count FROM (SELECT DATE_TRUNC('day', occurred_at) AS day, channel, count(*) AS event_count FROM web_events GROUP BY 1,2 ORDER BY 3 DESC) sub GROUP BY 1; /* Note that you should not include an alias when you write a subquery in a conditional statement. This is because the subquery is treated as an individual value (or set of values in the IN case) rather than as a table. Also, notice the query here compared a single value. If we returned an entire column IN would need to be used to perform a logical argument. If we are returning an entire table, then we must use an ALIAS for the table, and perform additional logic on the entire table. */ SELECT DATE_TRUNC('month',occurred_at), AVG(standard_qty) AS std_qty_avg, AVG(gloss_qty) AS gls_qty_avg, AVG(poster_qty) AS pos_qty_avg FROM orders WHERE DATE_TRUNC('month',occurred_at) = (SELECT DATE_TRUNC('month',MIN(occurred_at)) AS first_order_month FROM orders) GROUP BY 1; --Provide the name of the sales_rep in each region with the largest amount of total_amt_usd sales. SELECT name, t1.region_id, sale FROM (SELECT s.name, s.region_id, SUM(o.total_amt_usd) as sale FROM sales_reps s JOIN accounts a ON s.id = a.sales_rep_id JOIN orders o ON a.id = o.account_id GROUP BY 1,2 ORDER BY 2) t1 JOIN (SELECT region_id, MAX(sale) as max_sale FROM (SELECT s.name, s.region_id, SUM(o.total_amt_usd) as sale FROM sales_reps s JOIN accounts a ON s.id = a.sales_rep_id JOIN orders o ON a.id = o.account_id GROUP BY 1,2 ORDER BY 2) t3 GROUP BY 1) t2 ON t1.region_id = t2.region_id AND t1.sale = t2.max_sale; --For the region with the largest (sum) of sales total_amt_usd, how many total (count) orders were placed? SELECT r.name, SUM(o.total_amt_usd) AS total_amt_usd_sum, COUNT(o.*) AS order_count FROM orders o JOIN accounts a ON o.account_id = a.id JOIN sales_reps s ON s.id = a.sales_rep_id JOIN region r ON r.id = s.region_id GROUP BY 1 HAVING SUM(o.total_amt_usd) = (SELECT MAX(total_amt_usd_sum) FROM (SELECT s.region_id, SUM(o.total_amt_usd) AS total_amt_usd_sum, COUNT(o.*) AS order_count FROM orders o JOIN accounts a ON o.account_id = a.id JOIN sales_reps s ON s.id = a.sales_rep_id GROUP BY 1) t1); --WITH (CTE) --Provide the name of the sales_rep in each region with the largest amount of total_amt_usd sales. WITH t1 AS (SELECT s.name, s.region_id, SUM(o.total_amt_usd) as sale FROM sales_reps s JOIN accounts a ON s.id = a.sales_rep_id JOIN orders o ON a.id = o.account_id GROUP BY 1,2 ORDER BY 2), t2 AS (SELECT region_id, MAX(sale) as max_sale FROM t1 GROUP BY 1) SELECT * FROM t1 JOIN t2 ON t1.region_id = t2.region_id AND t1.sale = t2.max_sale; --For the region with the largest (sum) of sales total_amt_usd, how many total (count) orders were placed? WITH t1 AS ( SELECT r.name region_name, SUM(o.total_amt_usd) total_amt FROM sales_reps s JOIN accounts a ON a.sales_rep_id = s.id JOIN orders o ON o.account_id = a.id JOIN region r ON r.id = s.region_id GROUP BY r.name), t2 AS ( SELECT MAX(total_amt) FROM t1) SELECT r.name, COUNT(o.total) total_orders FROM sales_reps s JOIN accounts a ON a.sales_rep_id = s.id JOIN orders o ON o.account_id = a.id JOIN region r ON r.id = s.region_id GROUP BY r.name HAVING SUM(o.total_amt_usd) = (SELECT * FROM t2);
CREATE TABLE MYSITE.USER ( USERNAME VARCHAR(30) NOT NULL, PASSWORD VARCHAR(30) NOT NULL, NAME VARCHAR(50), PHONE VARCHAR(30), ADDRESS VARCHAR(60), BANKNAME VARCHAR(50), BANKACCOUNT VARCHAR(30), PRIMARY KEY (USERNAME) ) CREATE TABLE MYSITE.TRANSACTION ( ID INTEGER not null GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1), S_NAME VARCHAR(50), S_ADDRESS VARCHAR(60), S_PHONE VARCHAR(30), S_BANK_NAME VARCHAR(50), S_BANK_ACCOUNT VARCHAR(30), CURRENCY VARCHAR(5), AMOUNT NUMERIC(15,2), R_NAME VARCHAR(50), R_ADDRESS VARCHAR(60), R_BANK_NAME VARCHAR(50), R_BANK_ACCOUNT VARCHAR(30), TIME TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP, PRIMARY KEY (ID) )
--修改日期:2012.11.09 --修改人:刘之三 --修改内容:最大付款日期维护 --修改原因:最大付款日期维护 DECLARE VC_STR VARCHAR2(2000); VN_COUNT NUMBER; BEGIN SELECT COUNT(*) INTO VN_COUNT FROM USER_TABLES WHERE TABLE_NAME = 'BT_MAX_PAY_DATE'; IF VN_COUNT < 1 THEN VC_STR := 'CREATE TABLE BT_MAX_PAY_DATE(ID NUMBER(10) PRIMARY KEY ,ENTER_DATE DATE,BUSINESS_TYPE_NAME VARCHAR2(40),CORP_CODE VARCHAR2(40),PAY_MONTH VARCHAR2(200),MAX_PAY_DAY NUMBER(2),RMK VARCHAR2(400),VALID_SIGN VARCHAR2(2))'; EXECUTE IMMEDIATE VC_STR; END IF; END; / --修改人:费滔 --修改日期:2012-11-07 --修改内容: 新增erp_pay_info 和fbs_item的中间表 --修改原因:易才天预算新增需求 create or replace view V_BUSINESS_INFO as select e.bytter_id as item_code ,e.erp_id as business_Type ,e.erp_name as business_Name from erp_basic_data e where e.data_type='FBS_ITEM' and e.erp_sys_name='budget' ; comment on column V_BUSINESS_INFO.item_code is '科目代码'; comment on column V_BUSINESS_INFO.business_Name is '业务名称'; comment on column V_BUSINESS_INFO.business_type is '业务代码'; declare exist_num number(2) ; begin select count(*) into exist_num from bt_sys_res where res_name = '最大付款日期维护' and sys_code = 'adm' ; if(exist_num < 1) then insert into bt_sys_res (RES_CODE, RES_NAME, SYS_CODE, FATHER_CODE, RES_URL, FUNC_FLAG, RES_TYPE, LINK_TARGET, STATUS, RES_ORDER, RMK, REVERSE1, REVERSE2, REVERSE3, REVERSE4, REVERSE5, REVERSE6, REVERSE7, REVERSE8, REVERSE9, REVERSE10, RES_LEVEL, RES_ROLE) values ((select max(res_code) + 1 from bt_sys_res ), '最大付款日期维护', 'adm', (select res_code from bt_sys_res where res_name = '基础数据维护' and sys_code = 'adm' ), '/admin/createBtMaxPayDate.jsp', '0', '1', '0', '0', 11, '最大付款日期维护', '', '', '', '', '', null, null, null, null, null, 2, ''); commit; end if; end ; / --修改人:费滔 --修改日期:2012-11-07 --修改内容: 易才节假日付款执行系统参数增加 --修改原因:易才节假日付款执行系统参数增加 DECLARE VN_COUNT NUMBER; BEGIN SELECT COUNT(*) INTO VN_COUNT FROM BT_PARAM WHERE CODE='festivalPay' AND SYS_CODE='nis'; IF VN_COUNT < 1 THEN INSERT INTO BT_PARAM (CODE,SYS_CODE,NAME,PARAM_VALUE1,PARAM_VALUE2,PARAM_VALUE3,PARAM_TYPE,RMK,REVERSE1,REVERSE2,REVERSE3,REVERSE4,REVERSE5,REVERSE6,REVERSE7,REVERSE8,REVERSE9,REVERSE10) VALUES ('festivalPay','nis','节假日付款执行','0',null,null,'','节假日付款执行,默认节假日执行','0,节假日执行;1,节前最后一个工作日;2,节后第一个工作日','','','','',1.00,36.00,null,null,null); COMMIT; END IF; END; /
INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(2227808233, 'Shawn', 'Fritter', '(639) 5554414', 'sfritter0@symantec.com', 'Pharmacist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(2727180632, 'Emmye', 'Bumpas', '(461) 7417851', 'ebumpas1@cbsnews.com', 'Radiologic Technologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1295158795, 'Berkie', 'Giamitti', '(812) 7080555', 'bgiamitti2@webnode.com', 'Pharmacist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1290990204, 'Rhianna', 'Wrinch', '(346) 8202834', 'rwrinch3@craigslist.org', 'Oncologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(6785756863, 'Bink', 'McCollum', '(219) 1849420', 'bmccollum4@symantec.com', 'Anesthesiologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1124812865, 'Reggie', 'Olechnowicz', '(358) 1755129', 'rolechnowicz5@arstechnica.com', 'Oncologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(4862876412, 'Jerome', 'Fidock', '(151) 2924833', 'jfidock6@dedecms.com', 'Anesthesiologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(3417899370, 'My', 'Linklater', '(773) 1658597', 'mlinklater7@blinklist.com', 'Oncologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(3316947663, 'Drake', 'Sutcliff', '(275) 9775486', 'dsutcliff8@mashable.com', 'Psychologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(5068758108, 'Madalyn', 'Honnan', '(185) 5073885', 'mhonnan9@samsung.com', 'Radiologic Technologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8760419121, 'Reinwald', 'Kench', '(428) 7237210', 'rkencha@time.com', 'Surgeon'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7508610318, 'Alix', 'Klehn', '(514) 3666956', 'aklehnb@devhub.com', 'Pharmacist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(4863731094, 'Randy', 'Cristofor', '(290) 7219196', 'rcristoforc@kickstarter.com', 'Oncologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(3748836015, 'Phil', 'Nestor', '(186) 7469922', 'pnestord@dagondesign.com', 'Anesthesiologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8430956557, 'Tymothy', 'Deveraux', '(247) 2930009', 'tdeverauxe@wikispaces.com', 'Cardiologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(2915392706, 'Etti', 'Glisenan', '(207) 3697128', 'eglisenanf@army.mil', 'Cardiologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(2781389013, 'Aile', 'Carbert', '(201) 3361716', 'acarbertg@google.it', ' Family Practitioner'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9768800240, 'Mariette', 'Dilks', '(397) 4323559', 'mdilksh@yahoo.co.jp', 'Operator'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9949378850, 'Benoit', 'Baum', '(114) 6718575', 'bbaumi@yandex.ru', ' Family Practitioner'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7672173863, 'Bliss', 'Glader', '(262) 6643183', 'bgladerj@sogou.com', 'Neonatalologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8966243762, 'Delcina', 'Latchford', '(616) 5755852', 'dlatchfordk@youku.com', 'Occupational Therapist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(2972971752, 'Lianna', 'Elliston', '(617) 4898260', 'lellistonl@thetimes.co.uk', 'Psychologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9603775266, 'Goldarina', 'Turmell', '(820) 2121345', 'gturmellm@mit.edu', 'Neonatalologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(3134577453, 'Charis', 'Caney', '(846) 3379228', 'ccaneyn@imageshack.us', 'Anesthesiologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(908544782, 'Conrade', 'Veneur', '(941) 3020433', 'cveneuro@telegraph.co.uk', 'Mammographer'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8214374464, 'Dinnie', 'Geertje', '(829) 9955814', 'dgeertjep@t-online.de', 'Optometrist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(319617300, 'Hurleigh', 'Gommery', '(904) 6903512', 'hgommeryq@ftc.gov', 'Family Practitioner'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(3920481682, 'Karina', 'Sommerland', '(563) 3795703', 'ksommerlandr@wikipedia.org', 'Surgeon'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1392485614, 'Arty', 'Baake', '(480) 9482108', 'abaakes@jalbum.net', 'Paralegal'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7750872361, 'Marielle', 'Vevers', '(380) 3308258', 'mveverst@purevolume.com', ' Family Practitioner'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(4926502992, 'Dina', 'Hudleston', '(918) 1233050', 'dhudlestonu@netscape.com', 'Nurse Practicioner'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(3758609089, 'Wood', 'Trunchion', '(292) 6905765', 'wtrunchionv@qq.com', 'Pharmacist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(624291030, 'Chane', 'Matzeitis', '(230) 5578936', 'cmatzeitisw@linkedin.com', 'Speech Pathologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9852896253, 'Abner', 'Armfield', '(308) 4208174', 'aarmfieldx@yandex.ru', 'Mammographer'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8055078793, 'Nara', 'Mounfield', '(877) 3759707', 'nmounfieldy@theatlantic.com', 'Optometrist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(3845558997, 'Bunnie', 'Tedder', '(767) 4631338', 'btedderz@ehow.com', 'Gynaecologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(846286076, 'La verne', 'Davidsohn', '(688) 3791207', 'ldavidsohn10@ovh.net', 'Neonatalologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(5584405892, 'Wilek', 'Tollet', '(702) 8571392', 'wtollet11@nifty.com', 'Physical Therapy Assistant'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(6230450941, 'Elysia', 'McKeevers', '(212) 2021424', 'emckeevers12@cargocollective.com', 'Optometrist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7520902862, 'Lee', 'Woehler', '(255) 8701412', 'lwoehler13@msu.edu', 'Gynaecologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1994018380, 'Nicko', 'Hubber', '(886) 5617666', 'nhubber14@nifty.com', 'Surgeon'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9615714763, 'Tonnie', 'Scarlon', '(527) 2540694', 'tscarlon15@exblog.jp', 'Psychiatric Aide'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(6872018364, 'Cynthy', 'Casaroli', '(312) 4628384', 'ccasaroli16@digg.com', 'Neurosurgeon'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(352275855, 'Jimmie', 'Elbourne', '(911) 1143081', 'jelbourne17@privacy.gov.au', 'Surgeon'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8625437729, 'Katalin', 'Fliege', '(656) 9973705', 'kfliege18@google.com.au', 'Gynaecologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(6013915601, 'Austen', 'Airds', '(142) 3875830', 'aairds19@fc2.com', 'Cardiovascular Technologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(4941020170, 'Micki', 'Roser', '(826) 8967204', 'mroser1a@newsvine.com', 'Environmental Tech'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8340920723, 'Mercy', 'Heffer', '(495) 1243826', 'mheffer1b@hao123.com', 'Pharmacist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(3456321945, 'Esme', 'Pirouet', '(505) 8523075', 'epirouet1c@unesco.org', 'Paralegal'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8226404509, 'Chrystel', 'Phillins', '(609) 6463921', 'cphillins1d@barnesandnoble.com', 'Research Nurse'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7413366096, 'Ashli', 'Sawl', '(101) 4809645', 'asawl1e@sourceforge.net', 'Occupational Health and Safety Specialist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(6904773936, 'Zeke', 'Kirtley', '(100) 8752122', 'zkirtley1f@163.com', 'Cardiovascular Technologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9951436315, 'Donelle', 'Quartly', '(761) 7499745', 'dquartly1g@alibaba.com', 'Neurosurgeon'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7153436324, 'Arleyne', 'Pattullo', '(711) 7881526', 'apattullo1h@constantcontact.com', 'Cardiovascular Technologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(5167073146, 'Maiga', 'Bogey', '(838) 2538420', 'mbogey1i@blog.com', 'Occupational Therapist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(2208112245, 'Dionne', 'Kinsley', '(353) 8046104', 'dkinsley1j@wikipedia.org', 'Occupational Health and Safety Specialist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1518849954, 'Lind', 'Northbridge', '(879) 4873485', 'lnorthbridge1k@businessinsider.com', 'Environmental Specialist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(4443488936, 'Lynsey', 'McLaggan', '(339) 1311082', 'lmclaggan1l@wufoo.com', 'Pharmacist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9453345822, 'Garold', 'Rogliero', '(425) 1643999', 'grogliero1m@huffingtonpost.com', 'Psychiatric Aide'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7326356092, 'Irita', 'Joul', '(363) 3812573', 'ijoul1n@sourceforge.net', 'Dispensing Optician'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9714094976, 'Welch', 'Buey', '(546) 1052080', 'wbuey1o@bizjournals.com', 'Physical Therapy Assistant'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(4420028653, 'Gerri', 'Manns', '(109) 5860179', 'gmanns1p@last.fm', 'Psychiatrist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9031942952, 'Leesa', 'Ronchetti', '(215) 7442499', 'lronchetti1q@foxnews.com', 'Psychiatrist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9240666508, 'Alyosha', 'Calwell', '(405) 2404459', 'acalwell1r@usda.gov', 'GIS Technical Architect'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(2532821515, 'Regan', 'Gertray', '(126) 2658600', 'rgertray1s@feedburner.com', 'Physical Therapy Assistant'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8715220508, 'Rycca', 'Maine', '(411) 3246465', 'rmaine1t@digg.com', 'Neurosurgeon'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(5605220519, 'Chryste', 'Iorizzi', '(215) 2051680', 'ciorizzi1u@deviantart.com', 'Dispensing Optician'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9837012927, 'Roosevelt', 'Lohan', '(556) 7212464', 'rlohan1v@vk.com', 'Operator'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(4275022483, 'Yoshi', 'Haslewood', '(828) 1894477', 'yhaslewood1w@blogspot.com', 'Psychiatric Aide'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7209625569, 'Wye', 'Everard', '(387) 4676019', 'weverard1x@gravatar.com', 'Physical Therapy Assistant'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(6670056842, 'Gae', 'Woolston', '(621) 9318583', 'gwoolston1y@list-manage.com', 'Physical Therapy Assistant'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1746685425, 'Zaria', 'Mallia', '(154) 4007917', 'zmallia1z@nationalgeographic.com', 'Research Nurse'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8911712167, 'Modestine', 'LLelweln', '(723) 8028117', 'mllelweln20@ihg.com', 'Pharmacist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1921953497, 'Herman', 'Hutchins', '(271) 7384656', 'hhutchins21@nbcnews.com', 'Pharmacist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1518163777, 'Gerrie', 'Jenkison', '(724) 8415995', 'gjenkison22@moonfruit.com', 'Psychiatrist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(2100276131, 'Suzi', 'Guille', '(709) 2512864', 'sguille23@t.co', 'Dispensing Optician'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(2822961662, 'Charlene', 'Findlater', '(327) 9423095', 'cfindlater24@a8.net', 'Operator'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(6447859981, 'Becky', 'Cobbled', '(482) 4818731', 'bcobbled25@drupal.org', 'Paralegal'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(5984960303, 'Sheffie', 'Strevens', '(104) 4437328', 'sstrevens26@prweb.com', 'Physical Therapy Assistant'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1441353283, 'Brandyn', 'Lenney', '(832) 9339497', 'blenney27@nydailynews.com', ' Family Practitioner'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(487096061, 'Perkin', 'Reide', '(804) 6291109', 'preide28@army.mil', 'Environmental Specialist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9715205674, 'Alysa', 'Weatherby', '(784) 5221859', 'aweatherby29@simplemachines.org', 'Psychiatric Aide'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1615262695, 'Cal', 'Tomaszewski', '(677) 7595966', 'ctomaszewski2a@slashdot.org', 'Professor'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(5458497961, 'Henrie', 'Cuniffe', '(787) 6088785', 'hcuniffe2b@tinyurl.com', 'Head nurse'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(5407136651, 'Zilvia', 'Deely', '(891) 9517216', 'zdeely2c@boston.com', 'Nurse Anesthetis'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(4720369529, 'Livia', 'Feron', '(401) 8421701', 'lferon2d@i2i.jp', 'Medical Associate'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7868254173, 'Kaitlyn', 'Dubarry', '(690) 9291819', 'kdubarry2e@studiopress.com', 'Health Educator'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1712717189, 'Meredith', 'Baldazzi', '(139) 2017376', 'mbaldazzi2f@woothemes.com', 'Emergency Nurse'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(5386438115, 'Freddie', 'Cracoe', '(441) 5398403', 'fcracoe2g@cbsnews.com', 'Dermatologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(1759312290, 'Donal', 'Euesden', '(600) 7589752', 'deuesden2h@behance.net', 'Dentist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8387535885, 'Gertrudis', 'Thorne', '(915) 1975220', 'gthorne2i@cornell.edu', 'Chiropractor'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(5843098060, 'Hurlee', 'Dawson', '(848) 2846461', 'hdawson2j@unesco.org', 'Speech Pathologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(3649403366, 'Romola', 'Deeney', '(222) 2871831', 'rdeeney2k@google.es', 'Audiologist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(6619620728, 'Troy', 'Lumber', '(180) 7202175', 'tlumber2l@usatoday.com', 'Pysician'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9628332635, 'Lincoln', 'Greenwell', '(192) 8706412', 'lgreenwell2m@symantec.com', 'Pharmacist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(8561964022, 'Kelcy', 'Kemmett', '(256) 8325350', 'kkemmett2n@nytimes.com', 'Occupational Therapist'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(4843909130, 'Pete', 'Winscom', '(995) 9253784', 'pwinscom2o@163.com', 'Research Associate'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(9001778518, 'Frank', 'Sottell', '(346) 6877921', 'fsottell2p@trellian.com', 'Legal Assistant'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(6930131520, 'Barbaraanne', 'Landrick', '(118) 6441790', 'blandrick2q@surveymonkey.com', 'Research Associate'); INSERT INTO cs421g24.healthpractitioners (did, fname, lname, phone, email, specialization) VALUES(7454447333, 'Ambur', 'Karolewski', '(774) 3642417', 'akarolewski2r@delicious.com', 'Doctor');
CREATE TABLE `Version` ( `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, `Version` varchar(45) NOT NULL, `isForce` tinyint(1) NOT NULL DEFAULT '0', `Comments` varchar(255) NOT NULL, `Linkurl` varchar(255) NOT NULL, PRIMARY KEY (`ID`), UNIQUE KEY `ID_UNIQUE` (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
CREATE PROCEDURE sp_get_count_STK_REQ AS Exec sp_update_RequestQty SELECT COUNT(Distinct (Preferred_Vendor)) FROM Items, Warehouse WHERE PendingRequest > ISNULL(MinOrderQty,0) AND ISNULL(SupplyingBranch,N'') <> N'' AND Warehouse.Active = 1 AND Items.Active = 1 AND Items.SupplyingBranch = Warehouse.WarehouseID
CREATE TABLE IF NOT EXISTS contacts ( id BIGINT (11) NOT NULL AUTO_INCREMENT, firstName VARCHAR(30) NOT NULL, lastName VARCHAR(50) NOT NULL , phoneNumber VARCHAR(13), emailAddress VARCHAR(30) PRIMARY KEY (id) ) ENGINE = INNODB AUTO_INCREMENT=17621402 DEFAULT CHARSET = utf8;
DROP TRIGGER IF EXISTS `dictionary_after_insert`; SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'; DELIMITER // CREATE TRIGGER `dictionary_after_insert` AFTER INSERT ON `dictionary` FOR EACH ROW BEGIN INSERT INTO dictionary_history(NR_SEQ_OBJECT, DS_CONTENT, DT_INSERTION, CD_USER) VALUES(NEW.NR_SEQUENCE, NEW.DS_CONTENT, SYSDATE(), NEW.CD_USER); END// DELIMITER ; SET SQL_MODE=@OLDTMP_SQL_MODE; DROP TRIGGER IF EXISTS `dictionary_after_update`; SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'; DELIMITER // CREATE TRIGGER `dictionary_after_update` AFTER UPDATE ON `dictionary` FOR EACH ROW BEGIN INSERT INTO DICTIONARY_HISTORY(NR_SEQ_OBJECT, DS_CONTENT, DT_INSERTION, CD_USER) VALUES(NEW.NR_SEQUENCE, NEW.DS_CONTENT, SYSDATE(), NEW.CD_USER); END// DELIMITER ;
CREATE TABLE IF NOT EXISTS `charity_class_refs` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `classno` int(11) NOT NULL DEFAULT '0', `classtext` varchar(255) CHARACTER SET latin1 DEFAULT NULL, `created_at` timestamp DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) );
-------------------------------------------------------- -- DDL for View VWAP_GATEWAY_KPI_ZTE_DAY -------------------------------------------------------- CREATE OR REPLACE VIEW VWAP_GATEWAY_KPI_ZTE_DAY (FECHA, GATEWAY, GATEWAY_REQUEST_NUMBER, TOTAL_NUMBER, GATEWAY_REQUEST_SUCCESS_NUMBER, GATEWAY_REQUEST_VIRTUAL_NUMBER, GATEWAY_TOP_REQUEST_NUMBER, GATEWAY_SUCCESS_RATE, GATEWAY_VIRTUAL_RATE, GATEWAY_TOP_AVERAGE_CPU_RATE, GATEWAY_AVERAGE_DELAY) AS SELECT FECHA , GATEWAY , GATEWAY_REQUEST_NUMBER , TOTAL_NUMBER , GATEWAY_REQUEST_SUCCESS_NUMBER , GATEWAY_REQUEST_VIRTUAL_NUMBER , GATEWAY_TOP_REQUEST_NUMBER , GATEWAY_SUCCESS_RATE , GATEWAY_VIRTUAL_RATE , GATEWAY_TOP_AVERAGE_CPU_RATE , GATEWAY_AVERAGE_DELAY FROM WAP_GATEWAY_KPI_ZTE_RAW;