Jump to content

Standard SQL?


Liquid Fire

Recommended Posts

well i am build a data with pdo and want to make sure my sql statements are correct not matter the sql database the person is using.  for instance in mysql is i do:

 

SHOW TABLES LIKE 'statuses'

 

that will return statuses if the table exists and nothing if not, will that work in DB2, postgre, mssql, etc???  is there a way to test sql statement without having to install the software, something like a emulation program?

Link to comment
https://forums.phpfreaks.com/topic/95944-standard-sql/#findComment-491172
Share on other sites

Most popular databases don't conform to ANSI/ISO SQL by default, so it can be tricky, if not impossible, to write SQL that will work in multiple DBMSs. However, a database abstraction library like ADOdb might help you write code for database-independent systems.

Link to comment
https://forums.phpfreaks.com/topic/95944-standard-sql/#findComment-491194
Share on other sites

I don't think using ADOdb is that different to using PDO, they both abstract your database layer from implimentation.

 

I think its more the queries themselves the op is concerend with.

Agreed.  I really don't think you can write standard SQL statements that will span all DBMSs.  It's unfortunate but true.

Link to comment
https://forums.phpfreaks.com/topic/95944-standard-sql/#findComment-491223
Share on other sites

yea, i mean as far is i know all of the follow should work in all databases supported by PDO:

 

SELECT [field(s)] FROM [table][tr][td] [join_type] JOIN [table(s)] ON [field(s)] = [value(s)] WHERE [field(s)] = [value(s)] GROUP BY [feild(s)] ORDER BY [field(s)] HAVING [feild(s)]

 

INSERT INTO [table][tr][td]([fields]) (VALUE[values])

 

UPDATE [table][tr][td] SET [feild] = [value] WHERE [field] = [value]

 

DELETE FROM [table][tr][td] WHERE [fields] = [value]

 

I am just not sure about the other ones like creating/editing/deleting table and fields or adding indexs, etc...  I just want to try to find a site that lets me know how to do this kind of stuff for all major sql databases.

Link to comment
https://forums.phpfreaks.com/topic/95944-standard-sql/#findComment-491466
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.