Archive: Basic MySQL Tutorial
-
Jul 26, 2011
1 CommentHow to Use MySQL REPLACE to Insert or Update Data
Summary: In this tutorial, you will learn how to use MySQL REPLACE statement to insert or update data in database tables. MySQL REPLACE statement is a MySQL extension to SQL standard. MySQL REPLACE works like INSERT statements with the following rules: If the record being inserting does not exist, MySQL REPLACE will insert a new...
-
Jul 26, 2011
No CommentsDeleting Records from Tables Using MySQL DELETE
Summary: The MySQL DELETE statement not only allows you to delete record from one table but also multiple tables. In this tutorial, you will learn how to use MySQL DELETE statement with examples. To remove all rows or records from a database table you use MySQL DELETE statement. The following illustrates MySQL DELETE statement: 1...
-
Jul 26, 2011
No CommentsUpdating Data in Database Tables
Summary: Updating existing data is one of the most important task when you work with database. In this tutorial, you will learn how to use MySQL UPDATE statement to update data in database tables. SQL UPDATE statement is used to update existing data in database tables. It can be used to change values of single...
-
Jul 26, 2011
No CommentsInserting Data into Database Tables
Summary: In the previous tutorials you learn different ways to query data from database table by using SQL SELECT statement. Are you wonder that how data is added into those table? In this tutorial, you will learn do it by using SQL INSERT statement. INSERT Statement INSERT statement allows you to insert one or more...
-
Jul 26, 2011
No CommentsMySQL HAVING
Summary: In this tutorial, you will learn how to use MySQL HAVING clause to specify a filter condition for a group of records or an aggregate. Introducing MySQL HAVING clause The MySQL HAVING clause is an optional part of and used only with the SQL SELECT statement. The MySQL HAVING clause specifies a filter condition...
-
Jul 26, 2011
No CommentsMySQL GROUP BY
Summary: In this tutorial, you will learn how to use MySQL GROUP BY to group selected records into a set of summary records by the one or more column’s value or expression. Introducing to MySQL GROUP BY clause The MySQL GROUP BY clause is used with SQL SELECT statement to to group selected records into a set...
-
Jul 26, 2011
No CommentsMySQL LEFT JOIN
Summary: In this tutorial, you will learn how to use MySQL LEFT JOIN clause to retrieve data from more than one table. Introducing to MySQL LEFT JOIN The MySQL LEFT JOIN clause is an optional element of the SQL SELECT statement to allow you to retrieve data from additional tables. The MySQL LEFT JOIN clause...
-
Jul 26, 2011
No CommentsMySQL INNER JOIN
Summary: In this tutorial, you will learn how to use MySQL INNER JOIN clause to select data from multiple tables based on join conditions. Introducing MySQL INNER JOIN clause The MySQL INNER JOIN clause is an optional part of SQL SELECT statement. The MySQL INNER JOIN clause appears immediately after the FROM clause. Before using...
-
Jul 26, 2011
No CommentsCombining Result Sets with MySQL UNION
Summary: In this tutorial, you will learn how to use MySQL UNION statement to combine two or more result sets from multiple SQL SELECT statements into a single result set. Like SQL standard, MySQL UNION allows you to combine two or more result sets from multiple tables together. The syntax of using MySQL UNION is...
-
Jul 26, 2011
No CommentsHow to Use MySQL LIKE to Select Data Based on Patterns Matching
Summary: MySQL provides LIKE operator in SQL standard. The MySQL LIKE operator is commonly used to select data based on patterns matching. Using MySQL LIKE in appropriate way is essential to increase application’s performance. In this tutorial, you will learn how to use MySQL LIKE and when to avoid using it to increase the speed...
-
Jul 26, 2011
No CommentsWorking with Tables – Part II
Summary: following with the previous tutorial on how to create database tables in MySQL, in this tutorial, you will learn how to modify and remove existing database tables. Altering Table Structures Beside creating table, MySQL allows you to alter existing table structures with a lot of options.To modify existing database table structure you use the...
-
Jul 26, 2011
No CommentsRetrieving Data in a Range Using SQL BETWEEN
Summary: In this tutorial, you will learn how to retrieve data from database tables which its value are in a range by using SQL BETWEEN operator. SQL BETWEEN Operator Syntax The SQL BETWEEN operator allows you to retrieve values within a specific range. the SQL between must be used in the WHERE clause of the SQL SELECT statement. The following illustrates...
-
Jul 26, 2011
No CommentsSelecting Data with SQL IN
Summary: In this tutorial, you will learn how to select a result set which their values match any one of a list of values by using SQL IN operator. SQL IN Operator Syntax The SQL IN operator allows you to select values that match any one of a list of values. The usage of the...
-
Jul 26, 2011
No CommentsHow to Use MySQL Limit to Constrain Number of Returned Records
Summary: In this tutorial, you will learn how to use MySQL LIMIT clause to constrain number of returned records in SQL SELECT statement. Most of the times, when you work with master data tables which contain thousand to millions of records and you don’t want to write a query to get all the data from...
-
Jul 26, 2011
No CommentsHow to Use MySQL Distinct to Eliminate Duplicate Rows
Summary: In this tutorial, you will learn how to use MySQL DISTINCT with SELECT statement to eliminate duplicate records in the selected result set. Sometimes when retrieving data from database table, you get duplicate records which are not expected. In order to remove those duplicate records, you need to use DISTINCT keyword along with SELECT...
-
Jul 26, 2011
No CommentsUsing MySQL SELECT Statement to Query Data
Summary:In this tutorial, you will learn how to MySQL SELECT statement to query data from database tables. MySQL SELECT Statement Syntax In order to retrieve data from MySQL database table you need to use MySQL SELECT statement. The following illustrates MySQL SELECT statment syntax: 1 SELECT column_name1,column_name2... 2 FROM tables 3 [WHERE conditions] 4 [GROUP BY group...
-
Jul 26, 2011
No CommentsManaging Database Index in MySQL
Summary: In this tutorial, you will learn how to work with database index in MySQL. You will learn how to use database index properly to speed up the data retrieval and what SQL statements to use to create or drop database index. Database indexes help to speed up the retrieval of data from MySQL database server. When retrieving...
-
Jul 26, 2011
No CommentsChanging Table Structure Using MySQL ALTER TABLE
Summary:In this tutorial you will learn how to use MySQL ALTER TABLE statement to change the structure of existing tables. MySQL ALTER TABLE syntax MySQL ALTER TABLE statement is used to change the structure of existing tables. You can use MySQL ALTER TABLE to add or drop column, change column data type, add primary key,...
-
Jul 26, 2011
No CommentsWorking with Database Table – Part I
Summary: In this tutorial you will learn how to create, show and describe tables in MySQL. Database table or table in short is one of the most important objects of relational database. How to create databases tables correctly is crucial when you work with any database system especially MySQL. In this tutorial, you will learn...
-
Jul 26, 2011
No CommentsUnderstanding MySQL TIMESTAMP
Summary: The MySQL TIMESTAMP is a temporal data type that store combination of date and time values. In this tutorial you will learn how MySQL TIMESTAMP values are stored in the database and how to use automatic initialization and automatic update to create created on and last changed on column in a table. How MySQL...