<< < 1 2 3 4 5 6 7 8 9 10 11 > >>   ∑:311  Sort:Rank

Using Column Default Values in MySQL
How To Specify Default Values in INSERT Statement in MySQL? 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 exercise gives a good example: mysql&gt; INSERT INTO fyi_...
2018-01-16, 1533🔥, 0💬

Violation of Unique Value Constraint in MySQL
What Happens If Unique Value Constraints Are Violated in MySQL? If you are inserting a new record that has values violating a unique constraint, you will get an error. Note that primary key column has a unique value constraint by default. The following tutorial exercise gives you some good examples:...
2018-01-16, 1449🔥, 0💬

Inserting a New Row into a Table in MySQL
How To Insert a New Row into a Table in MySQL? 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&gt; INSERT INTO fyi_links VALUES (101, 'dev.fyicenter.com', NULL, 0, '2006-04-30'); Query OK, 1...
2018-01-16, 1432🔥, 0💬

Insert Multiple Rows with 1 INSERT Statement in MySQL
How To Insert Multiple Rows with One INSERT Statement in MySQL? If you want to insert multiple rows with a single INSERT statement, you can use a subquery instead of the VALUES clause. Rows returned from the subquery will be inserted the target table. The following tutorial exercise gives a good exa...
2018-01-16, 1385🔥, 0💬

UPDATE Using Data from Other Tables in MySQL
How To Use Values from Other Tables in UPDATE Statements in MySQL? If you want to update values in one table with values from another table, you can use a subquery as an expression in the SET clause. The subquery should return only one row for each row in the update table that matches the WHERE clau...
2018-01-13, 1998🔥, 0💬

Order of Columns in the SET Clause in MySQL
Is the Order of Columns in the SET Clause Important in MySQL? Yes. The order of columns in the SET clause of the UPDATE statement is important. There is a BIG DIFFERENCE between MySQL and Oracle on update columns with previous values: Oracle provides you the existing values from the database on colu...
2018-01-13, 1476🔥, 0💬

Use Existing Column Values in the SET Clause in MySQL
How To Use Existing Column Values in the SET Clause in MySQL? If a row matches the WHERE clause in a UPDATE statement, existing values in this row can be used in expressions to provide new values in the SET clause. Existing values are represented by column names in the expressions. The tutorial exer...
2018-01-13, 1458🔥, 0💬

Update Column Values on Multiple Rows in MySQL
How To Update Column Values on Multiple Rows in MySQL? If the WHERE clause in an UPDATE matches multiple rows, the SET clause will be applied to all matched rows. This rule allows you to update values on multiple rows in a single UPDATE statement. Here is a good example: mysql&gt; UPDATE fyi_lin...
2018-01-13, 1443🔥, 0💬

Updating Values in a Table in MySQL
How To Update Values in a Table in MySQL? If you want to update some values in one row or multiple rows in a table, you can use the UPDATE statement. The tutorial script below shows a good example: mysql&gt; UPDATE fyi_links SET counts = 999, notes = 'Good.' WHERE id = 101; Query OK, 1 row affec...
2018-01-13, 1318🔥, 0💬

Error: Subquery Returns More than 1 Row in MySQL
What Happens If the UPDATE Subquery Returns Multiple Rows in MySQL? If a subquery is used in a UPDATE statement, it must return exactly one row for each row in the update table that matches the WHERE clause. If it returns multiple rows, MySQL server will give you an error message. To test this out, ...
2018-01-08, 6906🔥, 0💬

UPDATE with Subquery Returning No Rows in MySQL
What Happens If the UPDATE Subquery Returns No Rows in MySQL? If you use a subquery to assign new values in the SET clause in an UPDATE statement, and the subquery returns no rows for an outer row, MySQL will provide a NULL value to the SET clause. The tutorial exercise below shows you a good exampl...
2018-01-08, 2081🔥, 0💬

Deleting Multiple Rows from a Table in MySQL
How To Delete Multiple Rows from a Table in MySQL? You can delete multiple rows from a table in the same way as deleting a single row, except that the WHERE clause will match multiple rows. The tutorial exercise below deletes 3 rows from the fyi_links table: mysql&gt; SELECT id, url, notes, coun...
2018-01-08, 1493🔥, 0💬

Deleting an Existing Row from a Table in MySQL
How To Delete an Existing Row from a Table in MySQL? If you want to delete an existing row from a table, you can use the DELETE statement with a WHERE clause to identify that row. Here is good sample of DELETE statements: mysql&gt; INSERT INTO fyi_links (url, id) VALUES ('www.myspace.com', 301);...
2018-01-08, 1459🔥, 0💬

Deleting All Rows in a Table in MySQL
How To Delete All Rows in a Table in MySQL? If you want to delete all rows from a table, you have two options: Use the DELETE statement with no WHERE clause. Use the TRUNCATE TABLE statement. The TRUNCATE statement is more efficient the DELETE statement. The tutorial exercise shows you a good exampl...
2018-01-08, 1377🔥, 0💬

Using Group Functions in the SELECT Clause in MySQL
How To Use Group Functions in the SELECT Clause in MySQL? If group functions are used in the SELECT clause, they will be used on the rows that meet the query selection criteria, the output of group functions will be returned as output of the query. The following select statement returns 3 values cal...
2018-01-06, 1415🔥, 0💬

Using SELECT Statements in Views in MySQL
Can SELECT Statements Be Used on Views in MySQL? Select (query) statements can be used on views in the same way as tables. The following tutorial exercise helps you creating a view and running a query statement on the view: mysql&gt; CREATE VIEW myLinks AS SELECT * FROM fyi_links WHERE url LIKE ...
2018-01-06, 1385🔥, 0💬

Count Number of Rows with SELECT Statements in MySQL
How To Use SELECT Statement to Count Number of Rows in MySQL? If you want to count the number of rows, you can use the COUNT(*) function in the SELECT clause. The following tutorial exercise shows you some good example: mysql&gt; SELECT COUNT(*) FROM fyi_links; +----------+ | COUNT(*) | +-------...
2018-01-06, 1383🔥, 0💬

What Are Group Functions in MySQL
What Are Group Functions in MySQL? 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 row of the group. MAX(exp) - Returns the maximum ...
2018-01-06, 1363🔥, 0💬

Filerting out Duplications in Returning Rows in MySQL
How To Filter Out Duplications in Returning Rows in MySQL? If there are duplications in the returning rows, and you want to remove the duplications, you can use the keyword DISTINCT in the SELECT clause. The DISTINCT applies to the combination of all data fields specified in the SELECT clause. The t...
2018-01-06, 1319🔥, 0💬

Using Table Alias Names in MySQL
How To Define and Use Table Alias Names in MySQL? When column names need to be prefixed with table names, you can define table alias name and use them to prefix column names as shown in the following select statement: mysql&gt; SELECT l.id, l.url, r.comment FROM fyi_links l INNER JOIN fyi_rates ...
2017-12-31, 1468🔥, 0💬

SELECT Statements with JOIN and Subqueries in MySQL
Where to find answers to frequently asked questions on SELECT Statements with JOIN and Subqueries in MySQL? Here is a list of frequently asked questions and their answers compiled by FYIcenter.com DBA team on SELECT Statements with JOIN and Subqueries in MySQL. Clear answers are provided with tutori...
2017-12-31, 1428🔥, 0💬

Query with an Inner Join in MySQL
How To Write a Query with an Inner Join in MySQL? If you want to query from two tables with an inner join, you can use the INNER JOIN ... ON clause in the FROM clause. The tutorial exercise below creates another testing table and returns output with an inner join from two tables: fyi_links and fyi.r...
2017-12-31, 1419🔥, 0💬

Types of Table Joins in MySQL
How To Join Two Tables in a Single Query in MySQL? Two tables can be joined together in a query in 4 ways: Inner Join: Returns only rows from both tables that satisfy the join condition. Left Outer Join: Returns rows from both tables that satisfy the join condition, and the rest of rows from the fir...
2017-12-31, 1289🔥, 0💬

Using Group Functions in the ORDER BY Clause in MySQL
Can Group Functions Be Used in the ORDER BY Clause in MySQL? If the query output is aggregated as groups, you can sort the groups by using group functions in the ORDER BY clause. The following statement returns how many links were created in each year in each tag. The group output is sorted by the c...
2017-12-31, 1285🔥, 0💬

<< < 1 2 3 4 5 6 7 8 9 10 11 > >>   ∑:311  Sort:Rank