Access and Adapt a Database with MySQL Queries

Part of the PHP & MySQL For Dummies Cheat Sheet

PHP communicates with MySQL databases by sending SQL queries. Here’s a list of SQL queries, with their syntax, that you can use to access, view, and alter the database:

ALTER TABLE table change
CREATE DATABASE database
CREATE TABLE (col def,…,PRIMARY KEY(col))
DELETE FROM tablename WHERE clause
DROP database|table
INSERT INTO table (col,col,…) VALUES (col,col,…)
LOAD DATA INFILE ″filename″ INTO TABLE table
SELECT col,col,… FROM table WHERE clause
SELECT statement UNION SELECT statement
SHOW DATABASES|TABLES
SHOW COLUMNS FROM table
UPDATE table SET col=value,… WHERE clause
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

SERIES
PHP & MySQL For Dummies Cheat Sheet

Advertisement

Inside Dummies.com