Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL syntax: What is this?

Tags:

sql

mysql

My exported SQL file contains the lines below:

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; 

What do these lines mean, unlike CREATE TABLE and INSERT INTO?

like image 872
miqbal Avatar asked Jun 07 '11 13:06

miqbal


People also ask

What this symbol <> means in MySQL?

The symbol <> in MySQL is same as not equal to operator (!=). Both gives the result in boolean or tinyint(1). If the condition becomes true, then the result will be 1 otherwise 0. Case 1 − Using !=

What is SQL syntax?

What is Syntax? The term syntax refers to strict structural patterns used when creating a query. As soon as you enter the search criteria using the correct syntax, the query should execute, and the requested records retrieved from the target database.

Is MySQL syntax the same as SQL?

No, MySQL is not the same as SQL Server. Although both are relational database management systems, they differ in use cases, pricing, licensing, features, advantages, and more. While MySQL is offered through Oracle, SQL Server is through Microsoft corporation.

What is key syntax in MySQL?

In MySQL, a key is a data item that identifies a record exclusively. In other terms, the key is a group of columns used to uniquely define a record in a table. It is used to retrieve or extract rows from a table as needed.


2 Answers

They are variable assignments. The assignments are wrapped in executable comments in such a way that they are executed when MySQL is used and left alone if some other RDBMS is used. Furthermore, the 40101 indicates that the comments are not to be retained in the database i.e. if the lines are executed, they are only executed when the sql file is executed.

like image 109
Aleksi Yrttiaho Avatar answered Sep 24 '22 17:09

Aleksi Yrttiaho


This is variable assignments wrapped within conditional comments. The code is executed depending on the version of MySQL in question, see comments

like image 43
marto Avatar answered Sep 22 '22 17:09

marto