473,785 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Looking for minimal SQL


Hi

I would like to develop an app that is (more or less) database independet.
Python DB API helps when masking "parameters " of sql statements. The db
driver cares for the correct conversion of a date, text, etc. This already
is a big step into the right direction.

The next step would be to use the least common denominator of all sql
dialects and do without all the sql goodies that the dialects offer... and
for this part I am wondering if anyone has a link / hint / book that
assembled this minimum sql. I am looking for something that says for
example:

Table/DB Design: always use lowercase letters, ...

Allowed sql functions: min, max, count

WHERE / HAVING hints:
- Don't use subselects

The focus is actually limited to SELECT / INSERT / UPDATE / DELETE (I
don't think that GRANT / CREATE XXX / ... statements are very portable).

I am aware, that a solution created this way is not as fast and as elegant
as an app that uses all features of a dialect, but I am really looking for
something database independent...

Thanks for any hints,
Marco

Jul 18 '05 #1
14 1723

I am aware, that a solution created this way is not as fast and as
elegant as an app that uses all features of a dialect, but I am really
looking for something database independent...


What kind of application are you developing ?
Jul 18 '05 #2
> What kind of application are you developing ?

I am developing nothing right now. I still am evaluating... eventually a
simple CRM (Customer Relationship Management). I might start doing
something next year, but my brain started to create a framework.

There are several reasons why I would like to stay "db" independent: For
one I would like to run the "same" application over some rpc-server (which
would have a powerful db) or as a standalone application with a "simple"
db behind (which will synchronized from time to time *plan*plan*). I have
already implemented a "simple" framework that allows me to reuse the same
code be it as a multi-tier app be it as a standalone app. A database
switch in the future is possible... hence... etc. etc.

-> Python offers openess when it comes to os platforms
-> db api offers a certain openness when it comes to dealing and
parameterizing sql-stmts ... I want to stick to a minimal sql-language set
to achieve real db openness

I am aware that programming "sql-neutral" is not the most efficient, the
easiest way to go. For example: If Sub-Selects are not portable than I
would split up the queries and glue them together with Python. If for
example one looks for the oldest customer:

With sub-selects you may write:

SELECT * FROM customer WHERE age = (SELECT max(age) FROM customer)

Without sub-selects I would have to write two seperate statements:

SELECT max(age) FROM customer --> take the "age" out of this query
"SELECT * FROM customer WHERE age = ?", (age)

This might not be the fastest solution but I would like to try!

Hope this answers your question,

Marco


Jul 18 '05 #3
Marco Aschwanden <PP**********@s pammotel.com> wrote:
The next step would be to use the least common denominator of all sql
dialects and do without all the sql goodies that the dialects offer... and
for this part I am wondering if anyone has a link / hint / book that
assembled this minimum sql.
Then you will have a _very_ limited subset of SQL, especially
when you take mysql into account, which is not very standard-
ANSI-SQL compatible, as far as I know. For example, the
operator "||" is string-concatenation in standard SQL, while
it means logical OR in mysql. Double-quotes are used for
quoted identifiers in standard SQL, while they're used to
enclose strings in mysql. etc. etc.
example:

Table/DB Design: always use lowercase letters, ...
You will also have to be careful to avoid the reserved words
of _all_ SQL dialects. Not easy. Also, don't make your
identifiers longer than 20 characters.
The focus is actually limited to SELECT / INSERT / UPDATE / DELETE (I
don't think that GRANT / CREATE XXX / ... statements are very portable).


Both GRANT and CREATE are specified in standard SQL, and I
believe all the major databases conform to it (I don't know
if mysql does, though).

Maybe the PostgreSQL documentation is helpful for you:
For each SQL command, it contains a description of its
standard SQL conformance. Here's the URL:

http://www.postgresql.org/docs/7.4/s...-commands.html

If you stick to that, your SQL code will most probably also
work with Oracle, Sybase and other "serious" databases.

Best regards
Oliver

PS: When I say "standard SQL", I mean ANSI SQL92 and SQL99.

--
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

``All that we see or seem is just a dream within a dream.''
(E. A. Poe)
Jul 18 '05 #4
Oliver Fromme schrieb:
Marco Aschwanden <PP**********@s pammotel.com> wrote:
> The next step would be to use the least common denominator of all sql
> dialects and do without all the sql goodies that the dialects offer... and
> for this part I am wondering if anyone has a link / hint / book that
> assembled this minimum sql.


Then you will have a _very_ limited subset of SQL, especially
when you take mysql into account, which is not very standard-
ANSI-SQL compatible, as far as I know. For example, the
operator "||" is string-concatenation in standard SQL, while
it means logical OR in mysql. Double-quotes are used for
quoted identifiers in standard SQL, while they're used to
enclose strings in mysql. etc. etc.


Maybe you don't have to be restricted like that. In my former company we
used the product SourcePro DB from RougeWave-Software. It's a kind
of abstraction layer. You never write an SQL-statement its more
a composition of class-objects. Of course, internal the SourcePro DB
makes an SQL-statement, but for the programmer its an C++ API.

So you don't care about how the SQL-Statement looks exactly like (if
an OR is written by 'OR' or '||'
==> Problem: Each database you want to access needs an own interface inside.

The real restrictions come from the features of an DBMS
a) does it support locks?
b) what about transactions
etc. etc.

greetings Leo

Jul 18 '05 #5
Thanks for your hints.

Jul 18 '05 #6
Marco Aschwanden wrote:

Hi

I would like to develop an app that is (more or less) database
independet. Python DB API helps when masking "parameters " of sql
statements. The db driver cares for the correct conversion of a date,
text, etc. This already is a big step into the right direction.

The next step would be to use the least common denominator of all sql
dialects and do without all the sql goodies that the dialects offer...
and for this part I am wondering if anyone has a link / hint / book that
assembled this minimum sql. I am looking for something that says for
example:

Table/DB Design: always use lowercase letters, ...

Allowed sql functions: min, max, count

WHERE / HAVING hints:
- Don't use subselects

The focus is actually limited to SELECT / INSERT / UPDATE / DELETE (I
don't think that GRANT / CREATE XXX / ... statements are very portable).

I am aware, that a solution created this way is not as fast and as
elegant as an app that uses all features of a dialect, but I am really
looking for something database independent...

Thanks for any hints,
Marco


What we have found the best approach is to start development with two
databases in mind. In that case, you have to build in a basic layer of
database-independence. Then later, adding other databases tends to be an
easy refactor.

If you like you could check out the data/dbwrapper module in jToolkit
which is an example of this approach. See jtoolkit.source forge.net

Regards
David
Jul 18 '05 #7
Then you will have a _very_ limited subset of SQL, especially
when you take mysql into account, which is not very standard-


Um, also consider the fact you can't do much with Mysql...
Jul 18 '05 #8
Marco Aschwanden <PP**********@s pammotel.com> wrote in message news:<ma******* *************** *************** *@python.org>.. .
Hi

I would like to develop an app that is (more or less) database independet.
Python DB API helps when masking "parameters " of sql statements. The db
driver cares for the correct conversion of a date, text, etc. This already
is a big step into the right direction.

The next step would be to use the least common denominator of all sql
dialects and do without all the sql goodies that the dialects offer... and
for this part I am wondering if anyone has a link / hint / book that
assembled this minimum sql. I am looking for something that says for
example:


I think what you are looking for is the ANSI SQL standard, probably
the SQL-92 version. However, I think something like PDO (recommended
in another message on this thread) might serve your needs better.
That is, if I understand what PDO does; it seems to me like it does
for database access what wxPython does for GUIs. If so, then there is
your consistent, multiple-DB compatible syntax, without needing to
cripple performance by dropping to SQL-92 or something.
Jul 18 '05 #9
On Thu, 01 Jul 2004 12:42:28 +0200, Marco Aschwanden
<PP**********@s pammotel.com> declaimed the following in
comp.lang.pytho n:
easiest way to go. For example: If Sub-Selects are not portable than I
"If"??? I think they are still on the TBD list for MySQL, so at
the moment it is not an "if", it is an "as". <G>

I suppose you could start with the O'Reilly SQL book -- as I
recall, that covered MySQL, SQL Server, Oracle (and/or Sybase -- though
didn't SQL Server start life as a rebadged Sybase?).

Of course, MySQL also doesn't (yet) support triggers, stored
procedures, and only begins to touch foreign key/referential integrity.

-- =============== =============== =============== =============== == <
wl*****@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
=============== =============== =============== =============== == <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.ne tcom.com/> <

Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1849
by: Sean | last post by:
I have two sites that i use for personal stuff (family, friends, photos). They are PHP sites butim not a programmer. They were setup by a friend who no longer helps with them. There are some things with the Gallery upload and topics that just don't work anymore. I suspect it would be trivial for someone who knows PHP to fix. I am willing to pay $100 a year for someone to keep the sites up and running...minimal time is needed. ...
1
2081
by: Tom | last post by:
I need a very, very minimal LaTeX system on Windows. I only need to have the possibility to get DVI files out of my tex files (with minimal fonts). An I need it without any installer (no settings in registry and no or less enviroment variables). I know this was asked a few time here but I haven't found any suitable information yet. I posted some time ago under "minimal latex for windows"...
3
3183
by: vato | last post by:
I was hoping to get an example of a C++ program I am working on with my son need to calculate the average of a series of game scores where we can drop the lowest score. ie five games get the best 4 out of 5. He is in c++ and thinks I know about this stuff. I study the book to try to keep ahead of him, but he is a sponge I am wax. I would need something with 3 functions if possible getscore find lowest and average.
1
2429
by: Epetruk | last post by:
Hello all, I'm sorry for the long post, but I think it's better if I'm as detailed as I can be so that I don't make a mistake in my choice and so that there's a clear understanding of to what I'm looking for. I'm looking for a content management system to use on a site (http://www.nigeriavillagesquare.com) that I help to moderate. Unfortunately (as I have discovered), there are literally hundreds of CMS's to choose from, so I am...
3
7733
by: Serious_Practitioner | last post by:
Happy New Year! I am looking around for an MS-Access based database that will help me manage the collections of 20-30 small loans. I need to be able to create amortization schedules when the loan is first made, and then I need to be able to apply payments to principal and interest as the payments come in. Don't need multi-user capability or Web access. Just want to install the thing, maybe do some minimal customization to suit my...
11
308
by: Ron Vecchi | last post by:
I've used System.Web.Mail before but have never had the need to send attchemnets through it...until now. A client of mine would like a form on the website to allow a user to type up a message and upload a file. I'm staying away from mailto links. So the file and message will be uploaded to the server when the user clicks send. The new file and message will be processed and emailed from the server to my client. I'm tring to get any...
20
6054
by: ram.rachum | last post by:
Hey, I'm looking for a good Python environment. That is, at least an editor and a debugger, and it should run on Windows. Does anyone have any idea?
3
1579
by: itisthiyagu | last post by:
Hi, Im looking for ListBox which works like Windows-XP's Add/Remove programs listbox. where can i get this kind of listbox ? I want to show a text in ListItem & it should expand with its description when user selects a particular item. Also i want to add a button into to ListItem. it is same like Add/Remove programs ListBox. anybody help me. -Thiyagu
2
1059
by: cowznofsky | last post by:
My needs are relatively simple. I'm putting together a web site prototype that has some very minimal e-commerce type stuff. I've been away from asp.net for a little while. It's not a store, so I'm not looking for that specific functionality. It will include to facility to maintain a product list. I'm looking for a starter kit that will hande users in different roles, and allow them self-service to maintain their contact information...
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.