Sie sind auf Seite 1von 2

CORPORATE TRAINING BOOK – MYSQL

TABLE OF CONTENTS
1. Objective...................................................................................................................................... 1
2. Introduction................................................................................................................................. 1
2.1 What is MySQL?............................................................................................................ 1
2.2 Features of MySQL........................................................................................................ 2
3. Creating and using database.................................................................................................... 3
3.1 Creating and selecting database................................................................................. 3
3.2 Creating a table............................................................................................................. 4
3.3 Retrieving information from table............................................................................... 4
4. Common Queries....................................................................................................................... 5
4.1 Maximum value for a column........................................................................................ 5
4.2 Row holding the maximum of a certain column......................................................... 5
4.3 Maximum of column per group.................................................................................... 5
4.4 Rows holding the group-wise maximum of a certain column... ................................ 6
4.5 User-defined variables.................................................................................................... 7
4.6 Using auto increment..................................................................................................... 7
5. Optimizing SQL statements........................................................................................................ 9
5.1 Optimizing select statement........................................................................................... 9
5.2 Optimizing DML statements........................................................................................... 10
6. Optimization and indexes............................................................................................................ 12
6.1 Primary keys..................................................................................................................... 12
6.2 Foreign keys..................................................................................................................... 12
7. Optimizing database structure.................................................................................................... 13
7.1 Optimizing data size........................................................................................................ 13
7.2 Optimizing MySQL data types.......................................................................................... 13
7.3 Optimizing database structure....................................................................................... 14
8. Data types....................................................................................................... ............................ 15
8.1 Data type overview........................................................................................................ 15
8.2 Numeric type overview................................................................................................ 15
8.3 Integer, int, smallint, tinyint, mediumint, bigint.......................................................... 16
8.4 Date and time type overview......................................................................................... 17
8.5 The date, datetime, and timestamp types........................................................... ........ 18
8.6 Time type, year type...................................................................................................... 18
8.7 String type overview..................................................................................................... 19
8.8 The char and varchar types......................................................................................... 20
8.9 The enum type............................................................................................................... 20
8.10 The set type.................................................................................................................. 20
9. Data type storage requirements.............................................................................................. 22
10. Functions and operators.......................................................................................................... 25
10.1 Function and operator reference................................................................................ 25
CORPORATE TRAINING BOOK – MYSQL

10.3 Type conversion in expression evaluation................................................................ 26


10.3 Operators......................................................................... ............................................. 26
11. String function........................................................................................................................... 30
11.1 Numeric functions and operators............................................................................... 30
11.2 Date and time functions.............................................................................................. 32
11.3 Encryption and compression functions.................................................................... 33
12. Group by (aggregate) functions.............................................................................................. 34
12.1 Group by (aggregate) function descriptions............................................................. 34
12.2 Group by modifiers..................................................................................................... 37
12.3 MySQL handling of group by........................................................................................ 37
13. SQL statement syntax................................................................................................................ 39
13.1 Data definition statements........................................................................................... 39
13.2 Data manipulation statements.................................................................................... 40
13.3 MySQL transactional and locking statements......................................................... 41
14. Stored programs and views..................................................................................................... 43
14.1 Defining stored programs.......................................................................................... 43
14.2 Using stored routines (procedures and functions)................................................... 43
14.3 Using triggers............................................................................................................... 44
14.4 Using views................................................................................................................... 45
15. Real time example-polling......................................................................................................... 47

Das könnte Ihnen auch gefallen