tailieunhanh - Mysql your visual blueprint for creating open source databases- P8

Mysql your visual blueprint for creating open source databases- P8:The show tables command displays a list of tables available in the currently selected database. You can use this command when you are unsure of the exact name of a table within the database. | USING SELECT QUERIES 6 When you use GROUP BY you can select any number of columns as well as functions such as COUNT and AVG that aggregate the data from the grouped rows. When you are not using GROUP BY and you use a function like COUNT or AVG you cannot select any normal column values in the same query. The following table describes the available functions in MySQL for use with GROUP BY clauses. FUNCTION DESCRIPTION COUNT Number of rows AVG Average value SUM Total value MIN Minimum value MAX Maximum value STD Standard deviation BIT_OR Bitwise OR BIT_AND Bitwise AND Type SELECT name COUNT FROM scores and press Enter. Type GROUP BY name and press Enter. The number of scores for each student is displayed. This example uses a simple new table scores. The CREATE TABLE command for this table only needs to specify two columns. Example CREATE TABLE scores name VARCHAR 50 score INT UNSIGNED Although this is a very basic table you can achieve impressive results by storing multiple scores for each name and using the various MySQL grouping functions. Type SELECT name AVG score and press Enter. Type FROM scores GROUP BY name and press Enter. Type MIN score MAX score and press Enter. The name average nimum score and maximum score are displayed for each student. 127 MySQL DISPLAY DATA FROM MULTIPLE TABLES MySQL is known as a relational database system and one of the most important features of a relational database is the ability to work with relationships between different tables. You can use SELECT to retrieve related data from multiple tables. For example the quotes table stores quotations and their corresponding authors. If you had a separate table named authors that stored birth and death dates for a list of authors you could combine the two in a single SELECT query SELECT FROM quotes authors WHERE This query combines or joins data from the two tables. Each row in the result includes a combination of the columns from the quotes table and the .