Home
XHTML
CSS
PHP
MySQL
SEO
JavaScript
Computer Basics
Number Systems
LINUX


MySQL Queries

MySQL | Data Types | Conditions | Queries | Relationships | Scripts

Queries are blocks of code sent by a user to access data in a database . SQL keywords and operators are defined on the Conditions page. Tutorials for coding SQL in PHP scripts are on the Scripts page. Initial database setup may vary depending on the application and hosting server...



This creates a database called database1...

CREATE DATABASE database1;

This drops a database called database1...

DROP DATABASE database1;

This shows all active databases...

SHOW DATABASES;





This creates a table called table1...

CREATE TABLE table1;

This drops a table called table1...

DROP TABLE table1;

This shows all tables in the database...

SHOW TABLES;





Values can be inserted into one or more columns...

INSERT INTO table1 (column1, column2) VALUES ('value1', 'value2');





Values can be selected from one or more columns...

SELECT column1,column2 FROM table1;





Values can be deleted from one or more columns...

DELETE FROM table1 WHERE column1 = 'value1'

Values can be deleted...

DELETE * FROM table1;





Values can be updated and modified...

UPDATE table1 SET column1 = 'value1' WHERE column2 = 'value2'





Values can be set with built-in functions...

SELECT COUNT(column1) FROM table1





Values can be selected in ascending order...

SELECT column1 FROM table1 ORDER BY column2 ASC;

Values can be selected in descending order...

SELECT column1 FROM table1 ORDER BY column2 DESC;

Values can be selected with defined conditions...

SELECT column1 FROM table1 WHERE column1 = 'value1';




SEO Vancouver, Washington
SEO Portland, Oregon
Website Design Vancouver, Washington