1 2 3 4 5 6 > >>   Sort: Rank

Failed to Create a Database in MySQL
What Happens If You Do Not Have Privileges to Create Database in MySQL? If your MySQL server is provided by your Internet service company, your user account will most likely have no privilege to create new databases on the server. In that case, your CREATE DATABASE statement will fail. Here is an ex...
2017-11-11, 232👍, 0💬

List All Existing Databases in MySQL
How To Get a List of Databases from MySQL Servers in MySQL? Once you got a MySQL server connection object successfully, you need to know what databases are available on the server and which database you should use to manage your tables and data. To get a list of all available databases on your MySQL...
2017-11-11, 227👍, 0💬

Close MySQL Connection Objects in MySQL
How To Close MySQL Connection Objects in MySQL? MySQL connection objects created with mysql_connect() calls should be closed as soon as you have finished all of your database access needs by calling mysql_close($con) function. This will reduce the consumption of connection resources on your MySQL se...
2017-11-11, 222👍, 0💬

Retrieving MySQL Server information in MySQL
How To Get Some Basic Information Back from MySQL Servers in MySQL? Once you got a MySQL server connection object successfully, you can use mysql_get_server() and mysql_get_host_info() to get some basic information from your MySQL server. The tutorial exercise below is a good example: <?php $...
2017-11-11, 221👍, 0💬

Creating a New Database in MySQL
How To Create a New Database in MySQL? A database in a MySQL server is a logical container used to group tables and other data objects together as a unit. If you are the administrator of the server, you can create a new databases using the CREATE DATABASE statements with MySQL client interface progr...
2017-11-11, 218👍, 0💬

SELECT Query Statements with GROUP BY in MySQL
Where to find answers to frequently asked questions on SELECT Query Statements with GROUP BY in MySQL? Here is a list of frequently asked questions and their answers compiled by FYIcenter.com DBA team SELECT Query Statements with GROUP BY in MySQL. Clear answers are provided with tutorial exercises ...
2017-11-05, 261👍, 0💬

What Is a SELECT Query Statement in MySQL
What Is a SELECT Query Statement in MySQL? The SELECT statement is also called the query statement. It is the most frequently used SQL statement in any database application. A SELECT statement allows you to retrieve data from one or more tables or views, with different selection criteria, grouping c...
2017-11-05, 237👍, 0💬

Selecting All Columns of All Rows in MySQL
How To Select All Columns of All Rows from a Table in MySQL? The simplest query statement is the one that selects all columns of all rows from a single table: "SELECT * FROM tableName;". The (*) in the SELECT clause tells the query to return all columns. The missing WHERE clause tells the query to r...
2017-11-05, 235👍, 0💬

Selecting Columns in a Query in MySQL
How To Select Some Columns from a Table in MySQL? If you want explicitly tell the query to return some columns, you can specify the column names in the SELECT clause. The following select statement returns only two columns, "id" and "url" from the table "fyi_links": mysql> SELECT id, url FROM...
2017-11-05, 199👍, 0💬

Create a Test Table with Test Data in MySQL
How To Create a Testing Table with Test Data in MySQL? If you want to follow the tutorial exercises presented in this collection, you need to create a testing table and insert some test data, as shown in the following sample script: mysql> CREATE TABLE fyi_links (id INTEGER PRIMARY KEY, url V...
2017-11-05, 195👍, 0💬

Adding More Data to the Test Table in MySQL
How To Add More Data to the Testing Table in MySQL? If you want to continue with other tutorial exercises in this FAQ collection, you need to add more data to the testing table. Follow the script below to add a new column and: mysql> ALTER TABLE fyi_links ADD COLUMN tag VARCHAR(8); mysql&...
2017-11-02, 252👍, 0💬

Sort by Multiple Columns in MySQL
Can the Query Output Be Sorted by Multiple Columns in MySQL? You can specifying multiple columns in the ORDER BY clause as shown in the following example statement, which returns employees' salaries sorted by department and salary value: mysql> SELECT tag, counts, url, DATE(created) FROM fyi_...
2017-11-02, 252👍, 0💬

Sorting Query Output in MySQL
How To Sort the Query Output in MySQL? If you want the returning rows to be sorted, you can specify a sorting expression in the ORDER BY clause. The simplest sort expression is column name who's values will be sorted by. The following select statement returns rows sorted by the values in the "counts...
2017-11-02, 246👍, 0💬

Sorting Output in Descending Order in MySQL
How To Sort Output in Descending Order in MySQL? If you want to sort a column in descending order, you can specify the DESC keyword in the ORDER BY clause. The following SELECT statement first sorts the "tag" in descending order, then sorts the "counts" in ascending order: mysql> SELECT tag, ...
2017-11-02, 236👍, 0💬

Select Rows with WHERE Clause in MySQL
How To Select Some Rows from a Table in MySQL? If you don't want select all rows from a table, you can specify a WHERE clause to tell the query to return only the rows that meets the condition defined in the WHERE clause. The WHERE clause condition is a normal Boolean expression. If any data from ta...
2017-11-02, 226👍, 0💬

Execute SQL Statements in MySQL
How To Execute a SQL Statement in MySQL? You can run any types of SQL statements through the mysql_query() function. It takes the SQL statement as a string and returns different types of data depending on the SQL statement type and execution status: Returning FALSE, if the execution failed. Returnin...
2017-10-23, 276👍, 0💬

Retrieving Execution Error Message in MySQL
How To Get MySQL Statement Execution Errors in MySQL? When you execute a MySQL statement with mysql_query(), and the statement failed, mysql_query() will return the Boolean value FALSE. This is good enough to tell that there is something wrong with that statement. But if you want to know more about ...
2017-10-23, 270👍, 0💬

Selecting an Existing Database in MySQL
How To Select an Exiting Database in MySQL? The first thing after you have created a connection object to the MySQL server is to select the database where your tables are located, by using the mysql_select_db() function. If your MySQL server is offered by your Web hosting company, they will assign a...
2017-10-23, 262👍, 0💬

Selecting Other User's Database in MySQL
Can You Select Someone Else Database in MySQL? If your MySQL server is provided by an Internet service company, they will provide you one database for your use only. There are many other databases on the server for other users. But your user account will have no privilege to select other databases. ...
2017-10-23, 255👍, 0💬

Deleting an Existing Database in MySQL
How To Drop an Existing Database in MySQL? If want to drop an existing database from the MySQL server, you can use the DROP DATABASE statement. Here is a good example of dropping an existing database: $con = mysql_connect('localhost:8888' ,'dev', 'iyf'); $sql = 'DROP DATABASE fyi'; if (mysql_query($...
2017-10-23, 254👍, 0💬

Counting Duplicated Values in a Column in MySQL
How To Count Duplicated Values in a Column in MySQL? If you have a column with duplicated values, and you want to know what are those duplicated values are and how many duplicates are there for each of those values, you can use the GROUP BY ... HAVING clause as shown in the following example. It ret...
2017-10-16, 286👍, 0💬

Apply Filtering Criteria at Group Level in MySQL
How To Apply Filtering Criteria at Group Level in MySQL? If you want to return only specific groups from the query, you can apply filtering criteria at the group level by using the HAVING clause inside the GROUP BY clause. Note group functions can also be used in HAVING conditions. The following tut...
2017-10-16, 278👍, 0💬

Dividing Query Output into Groups in MySQL
How To Divide Query Output into Groups in MySQL? You can divide query output into multiple groups with the GROUP BY clause. It allows you specify a column as the grouping criteria, so that rows with the same value in that column will be considered as a single group. When the GROUP BY clause is speci...
2017-10-16, 272👍, 0💬

Using Multiple Columns in GROUP BY in MySQL
Can Multiple Columns Be Used in GROUP BY in MySQL? If you want to break your output into smaller groups, if you specify multiple column names or expressions in the GROUP BY clause. Output in each group must satisfy a specific combination of the expressions listed in the GROUP BY clause. The more col...
2017-10-16, 270👍, 0💬

1 2 3 4 5 6 > >>   Sort: Rank