Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of common SQL queries for Open Source databases?

I'm trying to find information about the correct RDBMS SQL queries for open source databases like MySQL, PostgreSQL, SQLite, and others. Are their any pre-assembled lists out there or do I just need to comb the documentation for each database engine (and in some cases guess as to the correct implementation? ALTER TABLE vs CREATE INDEX)

For example, so far I have this (partial) list for MySQL:

CREATE TABLE `%s` (...);
DROP TABLE IF EXISTS `%s` %s;
ALTER TABLE `%s` RENAME TO `%s`;

ALTER TABLE `%s` ADD COLUMN %s;
ALTER TABLE `%s` DROP COLUMN `%s` %s;
ALTER TABLE `%s` RENAME COLUMN `%s` to `%s`;

ALTER TABLE `%s` ADD CONSTRAINT `%s` FOREIGN KEY (`%s`) REFERENCES `%s` (`%s`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `%s` ADD CONSTRAINT `%s` UNIQUE (`%s`);
ALTER TABLE `%s` DROP CONSTRAINT `%s` %s;

CREATE INDEX `%s` USING BTREE ON `%s` (`%s`);
DROP INDEX IF EXISTS `%s` %s;
like image 832
Xeoncross Avatar asked Oct 06 '22 14:10

Xeoncross


1 Answers

I never see some similar, but you can get EBNF for ANSI SQL

http://savage.net.au/SQL/

like image 76
Pavel Stehule Avatar answered Oct 10 '22 04:10

Pavel Stehule