common language for any RDBMS technology [closed] - sql

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
We are looking for a common language for any RDBMS technology. I mean if I write a query in SQL Server that query will also have to work on any RDBMS like oracle, mysql etc.
Can anyone help get me started?

There is an ANSI standard for SQL that's (mostly) supported by most database servers. As long as you stick to that subset of the SQL language functionality offered by your database server your queries will be portable.
However, many of the more sophisticated features of your dbms won't be usable as they are not part of the ANSI standard, and thus implemented in a proprietary way by each dbms vendor - crosstabs are an example of this problem.

Two things, You could use ANSI standard but not all the RDBMS support all the ANSI standard. Also, ANSI standard are only for SQL and not fo,r say their programming language like Tsql for sql server and pl/sql for oracle etc.
2nd and most important point why would you want to use the same code in different RDBMS. Database systems are totally differnet.Some RDBMS are good in doing some things and not good in other things. Thus if you implement one code then it might not be the best optimized code for some of RDBMS's. Thus I would suggest that write the code based on the strengths and weakness of a RDBMS.If it is going to be different then so be it.
Most important thing, are you trying to do some benchmark before deciding the RDBMS. Also, what purpose it will solve to have same data and code on different RDMBS. You will be wasting lots of moeny on license. server etc as code will do the same work on all the RDBMS.

Related

Why not both ORM and SQL? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
In the seemingly eternal struggle between ORM and SQL-programming, there comes a question:
Why not use both? Using ORM for most of the programming, and program my own SQL-queries for the more complex JOIN-queries and other complex queries the chosen ORM cannot do. Are there any good reasons not to?
Most ORM solutions support native SQL - e.g. Hibernate.
The reason NOT to combine the two is one of consistency - if you have to understand two ways of retrieving data from the database and converting them to objects in your application, you have twice as much to remember, twice as many opportunities for bugs, and twice as much testing to do (for the "connect to database and retrieve data" code).
What happens in practice is that developers who are not comfortable with ORM will tend to use native SQL, and developers who like the ORM tool will do nearly everything using the ORM layer - this will make your codebase hard to maintain and extend.
If you're going to do this, I'd at least enforce the "do SQL through the ORM tool, not directly through JDBC (or whatever)" rule - that gives you at least some consistency, and you can re-use a lot of the object mapping functionality.
Ideally, though, pick a solution and stick with it - hedging your bets is rarely free.
Most of the cases ORM generated SQL are non-optimized.
It is suggested where performance matters that, Use ORM for binding only and use user-defined SQL for all the queries.

Oracle SQL vs Oracle PL/SQL [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have to learn Oracle SQL for work and am very tempted by the O'Reilly book 'Oracle PL/SQL Programming' as it has been so highly reviewed. However, I am unclear as to whether or not PL/SQL is a different language to SQL or if it is just a superset or if it something else. Can someone please help me here? Thanks.
SQL is a data query and manipulation langauge. PL/SQL is a procedural programming language.
PL/SQL is Turing complete language, with syntax for building complicated programmes. It also has a large number of libraries which give it a great range of capabilties. However, undoubtedly its main use is building stored procedures which embed SQL statements for retrieving and working with data. So to that extent PL/SQL is a superset of SQL.
Although in earlier versions of the database the PL/SQL SQL engine lagged behind the database engine so some SQL functionality was not available in PL/SQL. Since 9i Oracle has mad a concerted effort to keep the two in step, and its pretty hard to find anything we can do in pure SQL which we cannot also do in PL/SQL.
it is a superset.
all of SQL plus some PROCEDURAL extensions - so you can have variables, loops, conditional logic etc.

User friendly SQL query program? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I doubt this could exist, but crazier things do. Is there a program or place where I could enter in just the tables/columns, and some criteria options and it will generate a working SQL query code for me?
I know there are programs that will make the code look all nice, but I mean truly generate the code/joins/FROMS/etc.
Actually with Microsoft SQL Server Management Studio you have tools for everything.
You just need to learn the basics, but almost everything can be done with pre-made code for you.
You can create a table by just Right-Clicking on a database and select Create Table. From there you just have to fill the column names and the rows.
You can fill you rows with something similar without using the T-SQL language directly.
There are too many tools for me to list them all here but it is really User-Friendly.
I do recommend you go and learn SQL. It is really easy to learn the basics and so useful.
If you really want a software that generates the code for you you can google SQL Genetator.
I found this. Although I don't recommend using a code generator.
As everyone already commented, SQL Server Management Studio (SSMS) is your tool to go. But I guess you are asking for something that maybe requires a little bit less knowledge of the underlying tSQL language.
A sample could be MS SQL Code Factory I once recommended to some advanced user of a system I used to work and for him it was enough to do simple and some mid-adavanced queries.
But definitely you should aim to learn tSQL and then apply your knowledge together with a tool like SSMS to create all the queries you need, there is "almost" no limit on what you can achieve, and it is fun too as #Polynomial stated

SQL abstractions [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Why do some frameworks (like CakePHP, Kohana, Zend, Django, less - Rails) create some kind of SQL abstractions instead of a raw SQL database access? E.g. why do we need to make some perversions instead of a usual queries?
UPD: are there any SQL-injection reasons of this purpose?
Basically a good abstraction layer makes it easier for the developer to use a database, and not care what what and which kind of database he is connecting to, thus speeding up the development process.
Check out http://en.wikipedia.org/wiki/Database_abstraction_layer, the most common pros and cons are listed here.
Thats called abstraction. Usually its done to be db specific indipendent.
Sql will be built based on the db type of the connection..
There are two main reasons.
Database Indepence
The code can be applied to different databases. MySQL, MS SQL-SERVER, ORACLE. And with a little wrangling to other DBs using OBDC like MSAccess, or CSV files.
Separation of Database Code with Business Logic
Most frameworks follow this model: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
It's primarily an attempt to reduce what's known as the impedance mismatch between the relational storage of the database and the domain model within your application. Without the ORM you often find yourself writing "left hand right hand" code modelobject.property = reader["field] where you're mapping values from the storage format you've received from the database into your model.
In summary, hopefully the ORM allows you to concentrate on solving the business problems without having to worry about all of the plumbing. We're not there yet but we're getting close.

What the best resource to learn ANSI SQL? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I don't mean "Basic SQL", but strongly the specs and the difference between the specs and the implementations between great databases (like SQL Server, Oracle, etc).
(source: amazon.com)
SQL In a Nutshell by O'Reilly and Associates. It covers all 5 major SQL Dialects, the differences between them, and does that for each function/feature listed. (ANSI SQL99, Oracle, MySql, Postgres, and SQL Server).
The number one way of learning the differences is to work in the various databases.
SQL Server, Oracle, and MySql all offer free (express) editions. Also, if you want to step up a bit you can get the developer version of SQL Server for about $50.
Oracle:
http://www.oracle.com/technology/products/database/xe/index.html
SQL Server
http://www.microsoft.com/express/sql/default.aspx
MySQL
http://dev.mysql.com/downloads/
Simple things to do:
create a database
create a table
do simple insert/update/delete (CRUD) operations
do inner / outer joins.
http://sqlzoo.net/
PostgreSQL the world's more advanced opensource and more ANSI SQL-compliant database
Various RDBMS ANSI SQL-conformance: http://troels.arvin.dk/db/rdbms/