Setting up a database:
- Create a database
- Create a user
- Create a table
- Create a column
- Create indexes
- Add foreign keys
Using the database:
- INSERT
- SELECT
- UPDATE
- DELETE
Learn how to build and use a common MariaDB (or MySQL) database with examples for phpMyAdmin as well.
Setting up a database:
Using the database:
CREATE DATABASE IF NOT EXISTS db_name COLLATE utf8mb4_unicode_520_ci;
Where db_name is the desired name of the database.
We use collation utf8mb4_unicode_ci to set the default character set (UTF8) and the collation (unicode - case insensitive), i.e. the set of rules that regulates how our string types will be sorted. It is probably the most demanding set, speed and memory wise, but with today's hardware and internalization needs, there are no excuses for using anything else unless there is a very specific need.
The latest unicode version should be used.
utf8mb4_unicode_ci is based on unicode version 4.0.0. As other versions appear, the version number is specified in the collation, if changes are meaningful relating to collation. At the time of this writing, only utf8mb4_unicode_520_ci exists, for version 5.2.0.
There are no reasons to use NOPAD version for a collation unless there is a very specific need for it.
You may encounter collations such as utf8mb4_unicode_520_nopad_ci. There are 2 ways of comparing strings which are padded with unequal length of trailing spaces: