MySQL
Software de código abierto desarrollado por Oracle, para la administración de bases de datos relacionales.
Ejemplos
Ejemplos de MySQL Statements.
1. SELECT
SELECT id,title
FROM table1
LIMIT 0,10;
SELECT id,COUNT(id),SUM(id)
FROM table1
GROUP BY title
HAVING title LIKE 'a%';
SELECT COUNT(id) count FROM users;
SELECT id,title
FROM table1
WHERE id=1;
SELECT t1.id, t1.title, t2.title, t3.title, t4.title
FROM table1 t1
LEFT JOIN table2 USING(id)
RIGHT JOIN table3 USING(id)
INNER JOIN table4 ON t1.id=t4.id
WHERE id=1;
2. INSERT
INSERT INTO table1 (id,title)
VALUES (1,'title 1');
INSERT INTO table1 (id,title)
VALUES (1,'title 1'),(2,'title 2');
INSERT INTO table2 (id,title)
SELECT id,title
FROM table1
WHERE id<100;
3. UPDATE
UPDATE table1
SET title='new title 1'
WHERE id=1;
UPDATE table1 t1
INNER JOIN table2 t2 ON t1.id = t2.id
SET t1.title = t2.title;
Visitar Fuente