- SELECT
- Order By Rand
- Concat Fields
- Between
- Regexp
- If Null
- Union
- Replace
- Using Syntax
-
Substring
- DATE
- Get Date
- Date Format
- Today
- Month Day
- Date Parts
- ADMINISTRATION
- Foreign Key
- Foreign Key Disable
- Innodb
- Create Database
- Create Table
- Add Column
- Add Index
- Data Type
- Primary Key
- Errors
- Indexes
- Mysqldump
- Table Definition
MYSQL PAGES - LEVEL 3
Left
Return a part from a string (php substr echivalent function)
SELECT LEFT('foobarbar', 5);
-> fooba
Repeat
Returns a string repeated n times.
SELECT REPEAT('a', 3);
-> aaa
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_left
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_repeat
Questions and answers:
Clink on Option to Answer
1. Get substring ...
- a) SELECT LEFT('abcdef', 5);
- b) SELECT SUBSTR('abcdef', 5);
2. Get a string repeated 3 times
- a) SELECT REPEAT('a', 3);
- b) SELECT STRPAD('a', 3, 'a');