Comparison of database access
From EverybodyWiki Bios & Wiki
Database input commands[edit]
Database and table management[edit]
Database | Create database | Delete database | List databases | Use a db | Create table | Delete table | List tables | List table fields |
---|---|---|---|---|---|---|---|---|
MySQL | create database dbname; | drop database dbname; | show databases; | use dbname; | create table tbname; | drop table tbname; | show tables; | describe tbname; |
PostgreSQL | create database dbname; | drop database dbname; | \l (in psql) | \c dbname (in psql) For schemas (a similar feature): set search_path = schema_name; |
create table tbname (field1 value_type1, field2 value_type2, ... ); | drop table tbname; | \d (in psql) | \d tbname (in psql) |
Sqlite ver 3 | ? | ? | ? | $ sqlite3 filename | create table tbname (field1 value_type1, field2 value_type2, ... ) | drop table tbname | .tables | .schema |
MySQL databases[edit]
Prog Language | Access server | Use database | List databases | List tables |
---|---|---|---|---|
raw MySQL access | use db;
|
show databases;
|
show tables;
| |
PHP | $link = mysql_connect(host, user, password);
or
or
|
mysql_select_db(''name'', $link);
or
or
|
||
Python | db = MySQLdb.connect(
host="hostname",
user="username",
passwd="password",
db="dbname",
connect_timeout=5)
|
import MySQLdb
|
c = db.cursor()
c.execute("show databases")
c.fetchall()
|
c = db.cursor()
c.execute("show tables")
c.fetchall()
|
See also[edit]
This article "Comparison of database access" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Comparison of database access. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.