Archive for the ‘MySQL’ Category
  • MySQL Order By

    Posted by on June 4th, 2011 at 1:53 pm
    The way to order your result in MySQL is to use the ORDER BY statement. The ORDER BY keyword is used to sort the result-set by a specified column. You can sort the results by any field in an ascending or descending order by just adding 'ORDER BY' at the end of your query. You would use ORDER BY field_name ASC for an ascending sort, or ORDER BY field_name DESC for a descending sort. The ORDER BY keyword sort the records in ascending order by default. Syntax: SELECT field_name FROM t...
    Read More
  • MySQL DISTINCT

    Posted by on June 4th, 2011 at 1:16 pm
    Assume in a table, some of the columns may contain duplicate values. This is not a problem; however, sometimes you will want to list only the different (distinct) values in a table. DISTINCT helps to eliminate duplicates. If a query returns a result that contains duplicate rows, you can remove duplicates to produce a result set in which every row is unique. To do this, include the keyword DISTINCT after SELECT and before the output column list. Syntax : SELECT DISTINCT field_name FROM...
    Read More
  • MySQL Delete

    Posted by on June 4th, 2011 at 12:22 pm
    The DELETE statement is used to delete records in a table. If you want to delete a record from any MySQL table then you can use SQL command DELETE. Syntax: DELETE FROM table_name WHERE Clause condition If WHERE clause is not specified then all the records will be deleted from the given MySQL table. Ok, in the below example we will delete the row of id as 1. <?php // Make a MySQL Connection // Delete first row from the "employee" table $delete_q = "DELE...
    Read More
  • MySQL Update

    Posted by on June 4th, 2011 at 11:28 am
    The UPDATE statement is used to update records in a table. There may be a requirement where existing data in a MySQL table need to be modified. You can do so by using SQL UPDATE command. This will modify any field value of any MySQL table. Syntax: UPDATE table_name SET field1=new-value1, field2=new-value2 WHERE condition; You have to be very careful when updating records this way and double check your syntax, as it is very easy to inadvertently overwrite several records. Let’...
    Read More
  • MySQL AND & OR

    Posted by on June 4th, 2011 at 11:12 am
    The AND operator displays a record if both the first condition and the second condition is true. The OR operator displays a record if either the first condition or the second condition is true. Example for AND : Now we want to select only the record with the name equal to "learnwebdevelopment" AND the id equal to 1: We use the following SELECT statement: <?php $select_q = "SELECT * FROM employee WHERE name='learnwebdevelopment' AND id=1"; $select_r = mysql...
    Read More
  • MySQL Where

    Posted by on June 4th, 2011 at 10:46 am
    We have seen MySQL SELECT command to fetch data from MySQL table. We can use a conditional clause called WHERE clause to filter out results. Using WHERE clause we can specify a selection criteria to select required records from a table. If we wanted to select only certain entries of our table, then we would use the keyword WHERE. Syntax: SELECT * FROM table_name WHERE condition; *You can use one or more tables separated by comma to include various condition using a WHERE clause. B...
    Read More
  • MySQL Insert

    Posted by on June 4th, 2011 at 10:11 am
    The INSERT statement is used to insert new records in a table. Syntax: It is possible to write the INSERT statement in two forms. The first form doesn't specify the column names where the data will be inserted, only their values: INSERT INTO table_name VALUES (value1, value2, value3,...valueN) The second form specifies both the field names and the values to be inserted: INSERT INTO table_name ( field1, field2,...fieldN )VALUES( value1, value2,...valueN ); In below exampl...
    Read More
  • MySQL Select

    Posted by on June 4th, 2011 at 9:46 am
    SELECT, which is used to get information from the database, so that its data can be used in our PHP script. Syntax: SELECT * FROM table_name; and SELECT column_name(s) FROM table_name Note: SQL is not case sensitive. SELECT is the same as select. In this example we will select everything in our table "employee" and put it into a nicely formatted HTML table. Assume the ‘employee’ table has three fields id, name and age. Remember, if you don't understand the HTML or PHP ...
    Read More
  • MySQL Tutorial

    Posted by on June 4th, 2011 at 8:21 am
      MySQL is currently the most popular open source database server in existence. On top of that, it is very commonly used in conjunction with PHP scripts to create powerful and dynamic server-side applications. As the world's most popular open source database, MySQL is used by a wide range of organizations to manage their data. In this section, you'll be getting started with MySQL.You will learn how to use MySQL effectively to get your work done more ...
    Read More
Page 2 of 212
Categories
Archives
Recent Posts
Meta
rss facebook linkedin subscribe

Developed by QualityPoint Technologies