<< < 1 2 3 4 5 6 7 8 9 > >>   Sort: Rank

What Are Group Functions
What Are Group Functions? - MySQL FAQs - SQL SELECT Query Statements with GROUP BY Group functions are functions applied to a group of rows. Examples of group functions are: COUNT(*) - Returns the number of rows in the group. MIN(exp) - Returns the minimum value of the expression evaluated on each r...
2007-05-11, 4729👍, 0💬

How To Sort the Query Output
How To Sort the Query Output? - MySQL FAQs - SQL SELECT Query Statements with GROUP BY 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 ...
2007-05-11, 5149👍, 0💬

How To Return Top 5 Rows
How To Return Top 5 Rows? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqueries If you want the query to return only the first 5 rows, you can use the LIMIT clause, which takes one parameter as the maximum number of rows to return. The following statement returns the first 5 rows from the fy...
2007-05-11, 7218👍, 0💬

How To Specify Default Values in INSERT Statement
How To Specify Default Values in INSERT Statement? - MySQL FAQs - Understanding SQL INSERT, UPDATE and DELETE Statements If a column is defined with a default value in a table, you can use the key word DEFAULT in the INSERT statement to take the default value for that column. The following tutorial ...
2007-05-11, 4746👍, 0💬

How To Insert a New Row into a Table
How To Insert a New Row into a Table? - MySQL FAQs - Understanding SQL INSERT, UPDATE and DELETE Statements To insert a new row into a table, you should use the INSERT INTO statement with values specified for all columns as shown in the following example: mysql> INSERT INTO fyi_links VALUES (101, 'd...
2007-05-11, 4768👍, 0💬

How To Convert Character Strings to Numeric Values
How To Convert Character Strings to Numeric Values? - MySQL FAQs - Introduction to SQL Basics You can convert character strings to numeric values by using the CAST(string AS DECIMAL) or CAST(string AS SIGNED INTEGER) function as shown in the following examples: SELECT CAST('4123.45700' AS DECIMAL) F...
2007-05-11, 4732👍, 0💬

How To Convert Numeric Values to Character Strings
How To Convert Numeric Values to Character Strings? - MySQL FAQs - Introduction to SQL Basics You can convert numeric values to character strings by using the CAST(value AS CHAR) function as shown in the following examples: SELECT CAST(4123.45700 AS CHAR) FROM DUAL; 4123.45700 -- How to get rid of t...
2007-05-11, 5281👍, 0💬

How To Calculate the Difference between Two Dates
How To Calculate the Difference between Two Dates? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have two dates, and you want to know how many days between them, you can use the DATEDIFF(date1, date2) function as shown below: SELECT DATEDIFF(DATE('1997-02-28'), DATE('1997-03-01'))...
2007-05-11, 5141👍, 0💬

What Happens If You No CREATE Privilege in a Database
What Happens If You No CREATE Privilege in a Database? - MySQL FAQs - Understanding SQL CREATE, ALTER and DROP Statements In order to create tables in a database, your user account must have the CREATE privilege for that database. Otherwise you will get an error as shown in the following tutorial ex...
2007-05-11, 4725👍, 0💬

How To Get a List of Indexes of an Existing Table
How To Get a List of Indexes of an Existing Table? - MySQL FAQs - Understanding SQL CREATE, ALTER and DROP Statements If you want to see the index you have just created for an existing table, you can use the "SHOW INDEX FROM tableName" command to get a list of all indexes in a given table. The tutor...
2007-05-11, 4719👍, 0💬

How To Include Character Strings in SQL statements
How To Include Character Strings in SQL statements? - MySQL FAQs - Introduction to SQL Basics If you want to include character strings in your SQL statements, you need to quote them in one of the following formats: Using single quotes. For example 'FYIcenter.com'. Using double quotes. For example "F...
2007-05-11, 5052👍, 0💬

How To Enter Microseconds in SQL Statements
How To Enter Microseconds in SQL Statements? - MySQL FAQs - Introduction to SQL Date and Time Handling If you want to enter microseconds in a SQL statements, you can enter them right after the time string as a 6-digit number delimited with '.'. '0' will be padded to right if not enough digits. Here ...
2007-05-11, 8454👍, 0💬

How To See the CREATE TABLE Statement of an Existing Table
How To See the CREATE TABLE Statement of an Existing Table? - MySQL FAQs - Understanding SQL CREATE, ALTER and DROP Statements If you want to know how an existing table was created, you can use the "SHOW CREATE TABLE" command to get a copy of the "CREATE TABLE" statement back on an existing table. T...
2007-05-11, 4758👍, 0💬

How To Create a New Table by Selecting Rows from Another Table
How To Create a New Table by Selecting Rows from Another Table? - MySQL FAQs - Understanding SQL CREATE, ALTER and DROP Statements Let's say you have a table with many data rows, now you want to create a backup copy of this table of all rows or a subset of them, you can use the "CREATE TABLE ... SEL...
2007-05-11, 4717👍, 0💬

How To Escape Special Characters in SQL statements
How To Escape Special Characters in SQL statements? - MySQL FAQs - Introduction to SQL Basics There are a number of special characters that needs to be escaped (protected), if you want to include them in a character string. Here are some basic character escaping rules: The escape character (\) needs...
2007-05-11, 7222👍, 0💬

How To Present a Past Time in Hours, Minutes and Seconds
How To Present a Past Time in Hours, Minutes and Seconds? - MySQL FAQs - Introduction to SQL Date and Time Handling If you want show an article was posted "n hours n minutes and n seconds ago", you can use the TIMEDIFF(NOW(), pastTime) function as shown in the following tutorial exercise: SELECT TIM...
2007-05-11, 4810👍, 0💬

How To Include Numeric Values in SQL statements
How To Include Numeric Values in SQL statements? - MySQL FAQs - Introduction to SQL Basics If you want to include a numeric value in your SQL statement, you can enter it directly as shown in the following examples: SELECT 255 FROM DUAL; -- An integer 255 SELECT -6.34 FROM DUAL; -- A regular number -...
2007-05-11, 5542👍, 0💬

How To Convert Character Strings to Dates
How To Convert Character Strings to Dates? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a character string that represents a date, and you want to convert it into a date value, you can use the STR_TO_DATE(string, format) function. STR_TO_DATE() shares the same formatting cod...
2007-05-11, 5593👍, 0💬

How To Get a List of Columns in an Existing Table
How To Get a List of Columns in an Existing Table? - MySQL FAQs - Understanding SQL CREATE, ALTER and DROP Statements If you have an existing table, but you don't remember what are the columns used in the table, you can use the "SHOW COLUMNS FROM tableName" command to get a list of all columns of th...
2007-05-11, 4674👍, 0💬

How To Calculate the Difference between Two Time Values
How To Calculate the Difference between Two Time Values? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have two time values, and you want to know the time difference between them, you can use the TIMEDIFF(time1, time2) function as shown below: SELECT TIMEDIFF(TIME('19:26:50'), TIM...
2007-05-11, 5074👍, 0💬

How To Use Regular Expression in Pattern Match Conditions
How To Use Regular Expression in Pattern Match Conditions? - MySQL FAQs - Introduction to SQL Basics If you have a pattern that is too complex for LIKE to handle, you can use the regular expression pattern condition: REGEXP. The following tutorial exercise provides you some good examples: SELECT 'FY...
2007-05-11, 4934👍, 0💬

How To Extract a Unit Value from a Date and Time
How To Extract a Unit Value from a Date and Time? - MySQL FAQs - Introduction to SQL Date and Time Handling If you want to extract a specific date or time unit value out of a date or a time, you can use the EXTRACT(unit FROM expression) function. The tutorial exercise below gives you some good examp...
2007-05-11, 4770👍, 0💬

How To Convert Dates to Character Strings
How To Convert Dates to Character Strings? - MySQL FAQs - Introduction to SQL Date and Time Handling You can convert dates to character strings using the DATE_FORMAT(date, format) function. MySQL supports the following basic formatting codes: %a Abbreviated weekday name (Sun..Sat) %b Abbreviated mon...
2007-05-11, 5370👍, 0💬

What Happens If NULL Values Are Involved in Expressions
What Happens If NULL Values Are Involved in Expressions? - MySQL FAQs - Introduction to SQL Basics If NULL values are used in expressions, the resulting values will be NULL values. In other words: Arithmetic expressions with NULL values result NULL values. Comparison expressions with NULL values res...
2007-05-11, 4946👍, 0💬

<< < 1 2 3 4 5 6 7 8 9 > >>   Sort: Rank