MySQL
MySQL
9/10
Rate it
What is MySQL?
MySQL is an open-source relational database management system.
Tags

Tips

Conditions
field1 = value1
field1 <> value1
field1 LIKE 'value _ %'
field1 IS NULL
field1 IS NOT NULL
field1 IS IN (value1, value2)
field1 IS NOT IN (value1, value2)
condition1 AND condition2
condition1 OR condition2
RAND()
// Select 5 random rows from table "blog"
SELECT * FROM blog ORDER BY RAND() DESC LIMIT 0,5
Insert
INSERT INTO table1 (field1, field2) VALUES (value1, value2);
IN() and sort in needed order
// Select blogs from included IN ('12','5','3','17')
SELECT * FROM blog
WHERE blog.id IN ('12','5','3','17')
ORDER BY FIELD(blog.id,'12','5','3','17')

// Result:
id|..
12|..
5|..
3|..
17|..