{"id":174,"date":"2009-12-27T09:24:36","date_gmt":"2009-12-27T09:24:36","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=174"},"modified":"2024-01-12T07:10:14","modified_gmt":"2024-01-12T14:10:14","slug":"mysql-basics","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-basics\/","title":{"rendered":"MySQL Basics"},"content":{"rendered":"\n<p>This MySQL basics section teaches you how to use SQL statements to manage data in MySQL. It&#8217;ll provide you with everything you need to know to work with MySQL effectively.<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 1. Querying data<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-select-from\/\">SELECT FROM <\/a>&#8211; show you how to use a simple <code>SELECT FROM<\/code> statement to query the data from a single table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-select\/\">SELECT<\/a> &#8211; learn how to use the SELECT statement without referencing a table.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 2. Sorting data<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-order-by\/\">ORDER BY <\/a>&#8211; show you how to sort the result set using the ORDER BY clause. You will also learn how to use custom sort order with the FIELD function.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 3. Filtering data<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-where\/\">WHERE <\/a>&#8211; learn how to use the WHERE clause to filter rows based on specified conditions.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-distinct\/\">SELECT DISTINCT<\/a> &#8211; show you how to use the DISTINCT operator in the SELECT statement to eliminate duplicate rows in a result set.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-and\/\">AND<\/a>&nbsp;&#8211; introduce you to the AND operator to combine Boolean expressions to form a complex condition for filtering data.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-or\/\">OR<\/a>&#8211; introduce you to the OR operator and show you how to combine the OR operator with the AND operator to filter data.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-in\/\">IN&nbsp;<\/a>&#8211; show you how to use the IN operator in the WHERE clause to determine if a value matches any value in a set.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-not-in\/\">NOT IN<\/a> &#8211; negate the IN operator using the NOT operator to check if a value doesn&#8217;t match any value in a set.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-between\/\">BETWEEN<\/a> &#8211; show you how to query data based on a range using the BETWEEN operator.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-like\/\">LIKE \u00a0<\/a>&#8211; query database on pattern matching using wildcards such as <code>%<\/code> and <code>_<\/code>.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-limit\/\">LIMIT<\/a> &#8211; use\u00a0LIMIT to limit the number of rows returned by the SELECT statement<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-is-null\/\">IS NULL<\/a> &#8211; test whether a value is NULL or not by using the IS NULL operator.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 4. Joining tables<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-alias\/\">Table &amp; Column Aliases <\/a>&#8211; introduce you to table and column aliases.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-join\/\">Joins<\/a> &nbsp;&#8211; give you an overview of joins supported in MySQL including inner join, left join, and right join.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-inner-join\/\">INNER JOIN <\/a>&#8211; query rows from a table that has matching rows in another table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-left-join\/\">LEFT JOIN <\/a>&#8211; return all rows from the left table and matching rows from the right table or null if no matching rows are found in the right table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-right-join\/\">RIGHT JOIN<\/a> &#8211; return all rows from the right table and matching rows from the left table or null if no matching rows are found in the left table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-self-join\/\">Self-join <\/a>&#8211; join a table to itself using a table alias and connect rows within the same table using inner join and left join.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-cross-join\/\">CROSS JOIN<\/a>&nbsp;&#8211; make a Cartesian product of rows from multiple tables.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 5. Grouping data<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-group-by\/\">GROUP BY<\/a> &#8211; show you how to group rows into groups based on columns or expressions.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-having\/\">HAVING <\/a>&#8211; filter the groups by a specific condition.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-having-count\/\">HAVING COUNT<\/a> &#8211; show you how to use the HAVING clause with the COUNT function to filter groups by the number of items.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-rollup\/\">ROLLUP<\/a> &#8211;\u00a0generate multiple grouping sets considering a hierarchy between columns specified in the GROUP BY clause.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">&nbsp;Section 6. Subqueries<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-subquery\/\">Subquery <\/a>&#8211; show you how to nest a query (inner query) within another query (outer query) and use the result of the inner query for the outer query.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-derived-table\/\">Derived table<\/a> &#8211; introduce you to the derived table concept and show you how to use it to simplify complex queries.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basicshttps:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-exists\/\">EXISTS<\/a> &#8211; test for the existence of rows.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 7. Set operators<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-union\/\">UNION <\/a>&#8211; combine two or more result sets of multiple queries into a single result set.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-except\/\">EXCEPT<\/a> &#8211; show you how to use the EXCEPT operator to find the set difference between two sets of data.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-intersect\/\">INTERSECT<\/a> &#8211; show you how to use the INTERSECT operator to find common rows of two or more queries.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 8. Managing databases<\/h2>\n\n\n\n<p>This section shows you how to manage MySQL databases.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/selecting-a-mysql-database-using-use-statement\/\">Selecting a database<\/a> &#8211; show you how to use the USE statement to set the current database.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-database\/\">CREATE DATABASE<\/a>&nbsp;&#8211; show you step by step how to create a new database in MySQL Server.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-drop-database\/\">DROP DATABASE<\/a>&nbsp;&#8211; walk you through the steps of deleting a database from the database server.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 9. Working with tables<\/h2>\n\n\n\n<p>This section shows you how to manage the most important database objects in MySQL, including databases and tables.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a title=\"Understanding MySQL Table Types, or Storage Engines\" href=\"https:\/\/www.mysqltutorial.org\/mysql-administration\/mysql-storage-engines\/\">MySQL storage engines<\/a>&#8211; it is essential to understand the features of each storage engine so that you can use them effectively to maximize the performance of your databases.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-table\/\">CREATE TABLE <\/a>&#8211; show you how to create new tables in a database using the CREATE TABLE statement.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-data-types\/\">MySQL data types <\/a> &#8211; show you various data types in MySQL so that you can apply them effectively in designing database tables.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-auto_increment\/\">AUTO_INCREMENT <\/a>&#8211; show you how to use an AUTO_INCREMENT column to generate unique numbers automatically for the primary key.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-alter-table\/\">ALTER TABLE&nbsp;<\/a>&#8211; learn how to change the structure of a table using the ALTER TABLE statement.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-rename-table\/\">Renaming tables<\/a>&nbsp;&#8211; &nbsp;show you how to rename a table using the RENAME TABLE statement.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-drop-column\/\">Removing a&nbsp;column from a table<\/a> &#8211; show you how to use the ALTER TABLE&nbsp;DROP COLUMN statement to remove one or more columns from a table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-add-column\/\">Adding a new column to a table<\/a> &#8211; show you how to add one or more columns to an existing table using the ALTER TABLE ADD COLUMN statement.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-drop-table\/\">DROP TABLE<\/a> &#8211; show you how to remove existing tables using the DROP TABLE statement.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-temporary-table\/\">Temporary tables <\/a>&#8211; discuss MySQL temporary tables and show you how to manage temporary tables effectively.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-truncate-table\/\">TRUNCATE TABLE <\/a>&#8211; show you how to delete all data from a table quickly and more efficiently using the TRUNCATE TABLE statement.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-generated-columns\/\">Generated columns<\/a> &#8211; guide you on how to use the generated columns to store data computed from an expression or other columns.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 10. MySQL constraints<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-primary-key\/\">Primary key<\/a> &#8211; guide you on how to use the primary key constraint to create the primary key for a table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-foreign-key\/\">Foreign key<\/a> &#8211; introduce you to the foreign key and show you step by step how to create and drop foreign keys.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-disable-foreign-key-checks\/\">Disable foreign key checks<\/a> &#8211; learn how to disable foreign key checks.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-not-null-constraint\/\">NOT NULL<\/a>&#8211; introduce you to the NOT NULL constraint and show you how to declare a&nbsp;NOT NULL column or add a&nbsp;NOT NULL constraint to an existing column.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-unique-constraint\/\">UNIQUE constraint<\/a> &#8211;&nbsp;show you how to use the UNIQUE constraint to enforce the uniqueness of values in a column or a group of columns in a table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-check-constraint\/\">CHECK constraint<\/a> &#8211; learn how to create CHECK constraints to ensure data integrity.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-default\/\">DEFAULT<\/a> &#8211; show you how to set a default value for a column using the DEFAULT constraint.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 11. MySQL data types<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-bit\/\">BIT<\/a> &#8211; introduce&nbsp;you to BIT datatype and how to store bit values in MySQL.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-int\/\">INT<\/a> &#8211; show you how to use integer data type.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-boolean\/\">BOOLEAN<\/a> &#8211; explain to you how MySQL handles Boolean values by using TINYINT(1) internally.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-decimal\/\">DECIMAL<\/a> &#8211;&nbsp;show you how to use DECIMAL datatype to store exact values in decimal format.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-char-data-type\/\">CHAR<\/a> &#8211; a guide to CHAR data type for storing the fixed-length string.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-varchar\/\">VARCHAR<\/a> &#8211; give you the essential guide to VARCHAR datatype.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-text\/\">TEXT<\/a> &#8211; show you how to store text data using TEXT datatype.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-datetime\/\">DATETIME<\/a> &#8211; introduce you to the DATETIME datatype and some useful functions to manipulate DATETIME values.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/understanding-mysql-timestamp\/\">TIMESTAMP <\/a>&#8211; introduce you to TIMESTAMP and its features called automatic initialization and automatic update, which allow you to define auto-initialized and auto-updated columns for a table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-date\/\">DATE<\/a> &#8211;&nbsp;introduce you to the DATE datatype and show you some date functions to handle the date data effectively.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-time\/\">TIME <\/a>&#8211; walk you through the features of TIME datatype and show you how to use some useful temporal functions to handle time data.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-binary\/\">BINARY<\/a> &#8211; show you how to store fixed-length byte data.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-varbinary\/\">VARBINARY<\/a> &#8211; learn how to store variable-length byte data.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-blob\/\">BLOB<\/a> &#8211; guide you on how to use the BLOB data type to store large binary data such as images, videos, and so on.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-enum\/\">ENUM<\/a> &#8211; learn how to use ENUM datatype correctly to store enumeration values.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-json\/mysql-json-data-type\/\">JSON<\/a> &#8211; show you how to use JSON data type to store JSON documents.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-uuid\/\">MySQL UUID Smackdown: UUID vs. INT for Primary Key<\/a> &#8211; introduce you to MySQL UUID, shows you how to use it as the primary key (PK) for a table, and discusses the pros and cons of using it as the PK.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 12. Modifying data in MySQL<\/h2>\n\n\n\n<p>In this section, you will learn how to insert, update, and delete data from tables using various MySQL statements.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert\/\">INSERT&nbsp;<\/a>&#8211; use various forms of the INSERT statement to insert data into a table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-multiple-rows\/\">INSERT Multiple Rows<\/a> &#8211; insert multiple rows into a table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-into-select\/\">INSERT INTO SELECT<\/a> &#8211; insert data into a table from the result set of a query.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-ingore\/\">INSERT IGNORE<\/a> &nbsp;&#8211; explain the INSERT IGNORE statement that inserts rows into a table and ignores rows that cause errors.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-datetime\/\">Insert datetime values<\/a> &#8211; show you how to insert datetime values into a DATETIME column.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert-date\/\">Insert date values<\/a> &#8211; learn how to insert date values into a DATE column.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-update\/\">UPDATE&nbsp;<\/a>&#8211; learn how to use the UPDATE statement to update data in database tables.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-update-join\/\">UPDATE JOIN <\/a>&#8211; show you how to perform cross-table updates using the UPDATE JOIN statement with INNER JOIN and LEFT JOIN.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-delete\/\">DELETE <\/a>&#8211; show you how to use the DELETE statement to delete rows from one or more tables.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-on-delete-cascade\/\">ON DELETE CASCADE <\/a> &#8211; learn how to use ON DELETE CASCADE referential action for a foreign key to delete data from a child table automatically when you delete data from a parent table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-delete-join\/\">DELETE JOIN <\/a>&#8211; show you how to delete data from multiple tables.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-replace\/\">REPLACE&nbsp;<\/a>&#8211; learn how to insert or update data depending on whether data exists in the table or not.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 13. Common Table Expressions<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-cte\/\">Common Table Expression<\/a> &#8211; explain to you the common table expression concept and show you how to use CTE for querying data from tables.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-recursive-cte\/\">Recursive CTE<\/a> &#8211;&nbsp; use the recursive CTE to traverse the hierarchical data.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 14. MySQL Locking<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-table-locking\/\">Table locking<\/a> &#8211; learn how to use MySQL locking for cooperating table access between sessions.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 15. MySQL globalization<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-character-set\/\">Character Set <\/a>&#8211; discuss character set and show you step by step how to perform various operations on character sets.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-collation\/\">Collation <\/a>&#8211; discuss collation and show you how to set character sets and collations for the MySQL server, database, tables, and columns.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 16. User-defined variables<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/import-csv-file-mysql-table\/\">Import CSV File Into MySQL Table<\/a>&nbsp;&#8211; show you how to use LOAD DATA INFILE statement to import CSV files into a MySQL table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-export-table-to-csv\/\">Export MySQL Table to CSV<\/a>&nbsp;&#8211; &nbsp;learn various techniques of how to export MySQL table to a CSV file format.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 17. MySQL import &amp; export CSV<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-variables\/\">User-defined Variables<\/a> &#8211; learn how to use MySQL user-defined variables in SQL statements.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-select-into-variable\/\">SELECT INTO Variable<\/a> &#8211; show you how to use the MySQL SELECT INTO variable&nbsp;to store query results in one or more variables.<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Section 18. Advanced techniques<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-natural-sorting\/\">Natural sorting<\/a> &#8211; walk you through various natural sorting techniques in MySQL using the ORDER BY clause.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-row-count\/\">Get Row Count in MySQL<\/a> &#8211; show you various ways to get MySQL row count in the MySQL database.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-compare-two-tables\/\">Compare Two Tables<\/a> &#8211; show you how to compare two tables to find the unmatched records in MySQL<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-find-duplicate-values\/\">Find Duplicate Values<\/a> &#8211; show you step by step how to find duplicate values in one or more columns in MySQL.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-delete-duplicate-rows\/\">Delete Duplicate Rows<\/a> &#8211; learn how to delete duplicate rows in MySQL by using the DELETE JOIN statement or an immediate table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-copy-table\/\">Copy Tables<\/a> &#8211; copy tables within the same database or from one database to another using CREATE TABLE LIKE and SELECT statements in MySQL.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-compare-rows-within-the-same-table\/\">Compare Successive Rows within the same table<\/a> &#8211; how to compare successive rows within the same table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-select-random\/\">Select Random Records<\/a> &#8211; Show you various techniques to select random records from a database table.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/select-the-nth-highest-record-in-a-database-table\/\">Select The nth Highest Record<\/a> &#8211; learn how to the nth highest record in a database table using various techniques.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-reset-auto-increment-value\/\">Reset Auto Increment Values<\/a> &#8211; reset auto-increment values of AUTO_INCREMENT columns.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-comment\/\">MySQL Comments<\/a> &#8211; show you how to use MySQL comments to document an SQL statement or a block of code.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-null\/\">MySQL NULL<\/a> &#8211; learn how to work with MySQL NULL values. In addition, you\u2019ll learn some useful functions to deal with the NULL values effectively.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/avoid-displaying-null-values-by-mapping-to-other-values\/\">Map NULL to Meaningful Values<\/a> &#8211;  map NULL to other values for a better data representation.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-adjacency-list-tree\/\">Managing Hierarchical Data in MySQL Using the Adjacency List Model<\/a> &#8211; learn how to use the adjacency list model for managing hierarchical data in MySQL.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-interval\/\">MySQL Interval<\/a> &#8211; show you how to use the MySQL interval for date and time arithmetic with many practical examples.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-commands\/\">MySQL commands<\/a> &#8211; learn how to use the most commonly used mysql commands for mysql client.<\/li>\n<\/ul>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This MySQL basics section provides you with everything you need to know to manage data in MySQL effectively<\/p>\n","protected":false},"author":2,"featured_media":10043,"parent":0,"menu_order":2,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-174","page","type-page","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL Basics<\/title>\n<meta name=\"description\" content=\"This MySQL basics section provides you with everything you need to know to manage data in MySQL effectively\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL Basics\" \/>\n<meta property=\"og:description\" content=\"This MySQL basics section provides you with everything you need to know to manage data in MySQL effectively\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-12T14:10:14+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/\",\"name\":\"MySQL Basics\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/mysql-basics.svg\",\"datePublished\":\"2009-12-27T09:24:36+00:00\",\"dateModified\":\"2024-01-12T14:10:14+00:00\",\"description\":\"This MySQL basics section provides you with everything you need to know to manage data in MySQL effectively\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/mysql-basics.svg\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/mysql-basics.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL Basics","description":"This MySQL basics section provides you with everything you need to know to manage data in MySQL effectively","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-basics\/","og_locale":"en_US","og_type":"article","og_title":"MySQL Basics","og_description":"This MySQL basics section provides you with everything you need to know to manage data in MySQL effectively","og_url":"https:\/\/www.mysqltutorial.org\/mysql-basics\/","og_site_name":"MySQL Tutorial","article_modified_time":"2024-01-12T14:10:14+00:00","twitter_misc":{"Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-basics\/","url":"https:\/\/www.mysqltutorial.org\/mysql-basics\/","name":"MySQL Basics","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-basics\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2021\/04\/mysql-basics.svg","datePublished":"2009-12-27T09:24:36+00:00","dateModified":"2024-01-12T14:10:14+00:00","description":"This MySQL basics section provides you with everything you need to know to manage data in MySQL effectively","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-basics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-basics\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-basics\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2021\/04\/mysql-basics.svg","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2021\/04\/mysql-basics.svg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Basics"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=174"}],"version-history":[{"count":5,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/174\/revisions"}],"predecessor-version":[{"id":14538,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/174\/revisions\/14538"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media\/10043"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}