Category Archives: MYSQL

MYSQL Crosstab Query

CREATE MYSQL TABLE CREATE TABLE `tblProductToy` ( `ID` int(11) NOT NULL auto_increment, `Toy` varchar(32) default NULL, `DateShipped` varchar(10) default NULL, `NumberShipped` int(11) default NULL, PRIMARY KEY (`ID`) ) INSERT THESE DATA insert into tblProductToy (Toy, DateShipped, NumberShipped) values (‘Water Pistol’, … Continue reading

Posted in CODE IGNITER, MYSQL | Leave a comment

MYSQL TUTORIALS FOR BEGINNERS!!

yet another insignificant programming notes…   |   HOME TABLE OF CONTENTS (HIDE) 1.  Summary of MySQL Commands Used in this Tutorial 2.  An Example for the Beginners (But NOT for the dummies) 2.1  Creating and Deleting a Database – CREATE DATABASE and DROP DATABASE … Continue reading

Posted in MYSQL | Leave a comment

COPY THE CONTENT OF ONE TABLE TO ANOTHER WITHIN THE SAME DATABASE

******** IF YOU HAVE CREATED THE TARGET TABLE ******** mysql>INSERT INTO TARGET_TABLE SELECT * FROM SOURCE_TABLE; ******** IF THE TABLES HAVE DIFFERENT STRUCTURES USE THIS: ******** mysql>INSERT INTO TARGET_TABLE (`col1`,`col2`) SELECT `col1`,`col2` FROM SOURCE_TABLE; mysql>INSERT INTO TARGET_TABLE (`col1_`,`col2_`) SELECT `col1`,`col2` FROM SOURCE_TABLE … Continue reading

Posted in MYSQL | Leave a comment

CLONE RECORDS ON THE SAME TABLE AND THE AUTO_INCREMENT NEED TO UPDATE AT THE SAME TIME

Assuming the AUTO ID field is the first one in the table (a usual case), we can make use of implicit transactions. CREATE TEMPORARY TABLE tmp SELECT * from invoices WHERE …; ALTER TABLE tmp drop ID; # drop autoincrement … Continue reading

Posted in MYSQL | Leave a comment

CROSS TAB QUERY IN MYSQL

MySQL Multi-Aggregated Rows in Crosstab Queries MySQL’s crosstabs contain aggregate functions on two or more fields, presented in a tabular format. In a multi-aggregate crosstab query, two different functions can be applied to the same field or the same function … Continue reading

Posted in MYSQL | Leave a comment

MYSQL COMMAND LINE HELP IS YOUR TEACHER IN MYSQL!! (YOUR COMPUTER IS YOUR TEACHER)

REMEMBER THIS WHILE READING THE COMMANDS OR SYNTAX DOS, LINUX IN MYSQL AND SOME PROGRAMMING LANGUAGES. REMEMBER THESE: [ ], …, |, < >, { }, (), / letter(s) *WHAT IS BRACKET [ ] meaning OPTIONAL Ex. SELECT [table] so … Continue reading

Posted in MYSQL | Leave a comment

INTRODUCTION TO DATABASE DESIGN

Introduction to database design This article/tutorial will teach the basis of relational database design and explains how to make a good database design. It is a rather long text, but we advise to read all of it. Designing a database … Continue reading

Posted in MYSQL | Leave a comment