Structured Query Language (SQL) is a language for managing data in relational database management systems. This tag is for general SQL programming questions; it is not for Microsoft SQL Server (for this, use the sql-server tag), nor does it refer to specific dialects of SQL on its own.

learn more… | top users | synonyms

13
votes
6answers
3k views

Interacting With Data Using Multiple Databases/Servers

All of the projects that I've had to deal with so far have only required a single database on a single server. I'm interested in learning more about how projects that need to scale move to multiple ...
0
votes
3answers
696 views

What is likely to be the bottleneck between the SQL Server, IIS and .net when receiving json as text from the DB?

I have spent the best part of a month working on the jQuery Calendar plugin. The setup is such that all the calendar entries are stored in a table inside SQL Server and im using a single "Select As" ...
6
votes
2answers
389 views

What are some useful resources for learning tuple calculus?

I've been trying to go over my tuple calculus over and over again. What's worse is that my professor and tutors are not much help during their hours. Does anyone know a good place to learn about ...
2
votes
2answers
206 views

Are there standard strategies for defining job flow and dependencies?

I'm working on a project that involves the chaining of separate jobs into a single master job, though there may be parallel paths in the chain leading up to the final output. Job and chain details ...
137
votes
19answers
42k views

Why is naming a table's Primary Key column “Id” considered bad practice? [closed]

My t-sql teacher told us that naming our PK column "Id" is considered bad practice without any further explanations. Why is naming a table PK column "Id" is considered bad practice?
7
votes
2answers
2k views

Algorithm for formating SQL code

I need a tool (for in house usage) that will format SQL code (SQL Server/MySQL). There are various 3rd party tools and online web sites that do it but no exactly how I need it. So I want to write my ...
4
votes
2answers
182 views

When and how much should we validate input when working with (C)AP storage?

Herein, we consider a server-client architecture. Suppose we keep the details flexible, but there's more than one layer of servers supporting our hypothetical service. The general question is "When ...
17
votes
9answers
5k views

Whether to put the business logic in Stored Procedure or Not?

There is always a debate over the topic - "Whether to put the business logic in Stored Procedure or Not?". If we decide not to use the ORM Tool and not to put the Business Logic in Stored Procedure ...
4
votes
2answers
155 views

What is the equivalent of functions and methods in SQL?

In language like C or Java, there are things like functions/methods to modularize and abstract stuff. What is there in SQL, specifically for Oracle? I've seen people talking about using views to ...
5
votes
2answers
207 views

Storing stop/start points in a database

Let's say I am storing start and stop points per user into a database table. For example... let's say in a chat system, a user only needs to see lines 24-293, and 500-512. (Let's say he logged off ...
4
votes
3answers
3k views

How to reach to the advanced level in SQL? [closed]

I think I have a good grasp of SQL and the most features it has, but sometimes when I've done some more advanced Reporting Services a fellow developer has helped me with some stuff and when I open ...
3
votes
3answers
997 views

Why put SQL statement in a variable before using mysql_query()?

I'm been working with PHP on and off for a bit now, and I've seen plenty of code both ways: $sql = "SELECT …"; mysql_query($sql); vs mysql_query("SELECT…"); Is there a reason for separating the ...
56
votes
6answers
3k views

Is this a ridiculous way to structure a DB schema, or am I completely missing something?

I have done a fair bit of work with relational databases, and think I understand the basic concepts of good schema design pretty well. I recently was tasked with taking over a project where the DB was ...
2
votes
5answers
263 views

For user defined data, is it better to use a table of tables or dynamically created tables?

In an application that allows users to define their own tables and columns (details of that are not the focus of this question, but imagine a tool that lets users create their own forms and ...
4
votes
8answers
2k views

Are Bools/Bits Faster Than Integers

As the title suggests I'm wondering whether bools or bits are faster than using integers (1 and 0)? Specifically I thinking about their speed in CASE statements, even more specifically in T-SQL ...
6
votes
4answers
577 views

What are the options when Sql generated by ORM needs tuning?

I am starting working on a web project using django. While researching whether to use Sqlalchemy or raw sql when django orm is not sufficient which is also a question I asked here Raw Sql vs ...
7
votes
1answer
2k views

Raw Sql vs SqlAlchemy when Django ORM is not enough

In a django project, if a situation comes that Django ORM is not able to execute some complex queries then there are 2 options: Use Raw Sql queries Use SqlAlchemy I want to know if there are ...
15
votes
7answers
718 views

To Domain or not to Domain

The SQL92 and SQL99 standards define CREATE DOMAIN DDL constructs. Not all databases support this, or have a different name for it (SQL Server has User Defined Types, for example). These allow one to ...
16
votes
2answers
2k views

Does F# offer anything particularly useful for database-driven web development?

My organization finally upgraded to MS Visual Studio 2010 this year. One of the big new features that Visual Studio 2010 offers is the F# programming language. I understand that F# offers a ...
3
votes
5answers
4k views

Best practices for generating new identifiers for persistent objects?

In a typical scenario, an object that needs to be persisted in the database will be created in application code without an identifier, and later saved to a table in the database. Some database ...
7
votes
2answers
6k views

Why NoSQL over SQL? [duplicate]

Possible Duplicate: When would someone use MongoDB (or similar) over traditional RDMS? How well the SQL and NoSQL go head-to-head. I read somewhere that SQL databases are not well for data ...
3
votes
4answers
990 views

Other things to learn for becoming a Database Admin/Developer?

Obviously i'll have to make some sort of choice at what DB i choose to go with (MS-SQL/MYSQL/etc) but this question isn't about that. The question mainly is what other languages/tools would be ...
0
votes
5answers
4k views

Developing a simple web-application?

I decided to do a mini-project by myself to help me understand a bit more about developing web applications before starting the new university semester. Using the Java SE and JEE/J2EE platforms. I ...
6
votes
3answers
2k views

Managing SQL Stored Procedures' Version

I am working with a team of 5 persons. We are using SQL Server as our database. Since long time I want to store the Stored Procedures in SVN so that the versions can be maintained. Is there any tool ...
4
votes
4answers
852 views

Multiple Joins or Simple Readable Database Calls

Curious how other developers feel about this. I come across some pretty nasty sql joins, as we all do I'm sure. I would prefer making more database calls for the sake of readability and simplicity ...
3
votes
4answers
1k views

What has been your experience with SQL CLR for complex business logic?

So I thought I had a perfect use-case for a CLR SQL Procedure. I've search the Net for perhaps a similar example where data is retrieved, records added and updated. I have not looked at a SQL CLR ...
9
votes
3answers
2k views

XML vs SQL for small projects?

I'm working on a small project which will only have one user at a time since it's a local application (developed in WPF and C#). To store data I was thinking of using an XML file but I'm wondering if ...
0
votes
1answer
2k views

Size of database a factor for Hibernate vs JDBC?

Do you know if the size of the database (number of tables used) is a factor when choosing between Hibernate and JDBC? Why or why not? In my particular case, I am evaluating Hibernate and JDBC for ...
18
votes
5answers
1k views

What good reasons are there to capitalise SQL keywords?

There seem to be a lot of developers who write their SQL by capitalising the keywords: SELECT column FROM table INNER JOIN table ON condition WHERE condition GROUP BY clause HAVING ...
4
votes
2answers
874 views

SQL Query helper/builder? [closed]

We have a flex based front end, that talks via JDBC to some databases. Part of the GUI has some forms that let the users construct Queries in SQL to pull back records from the database. However, we ...
47
votes
14answers
3k views

Is SQL important if I know ORM frameworks well? [closed]

I don't have any serious experience in SQL and I even hate to write SQL instead of LINQ. I am happy enough with ORMs. From the employers and sector view point, is it important to know SQL? Do I have ...
-1
votes
1answer
1k views

How to begin writing a relational SQL database [closed]

I was wondering about how databases like MySQL and SQLite are developed to run as quickly and as well as they do. I'm looking for answers to questions like: How is SQL token-ized? Do you build an ...
4
votes
6answers
1k views

How can I improve upon this “pattern”?

I have a series of method calls that all share similar qualities. The basic layout is public void CallDataBase() { Utility sqlHelper = new Utility(); StringBuilder query = new ...
4
votes
5answers
3k views

SSIS: How long does it usually take to bring a new hire up to speed? [closed]

I’m a self-taught SQL developer that has worked for small to mid-sized companies. Most of my experience has been writing SQL statements for reporting, data scrubs, and never in a formalized IT ...
2
votes
2answers
1k views

Database for storing books by grouping, their pages, and the table of contents

I'm looking for a better way to deal with the design I have here, I'm not confident it's really suitable. To give this some context, lets say we have a bunch of groups, one group could be "SQL", and ...
12
votes
3answers
745 views

Is reliance on parametrized queries the only way to protect against SQL injection?

All I have seen on SQL injection attacks seems to suggest that parametrized queries, particularly ones in stored procedures, are the only way to protect against such attacks. While I was working (back ...
1
vote
2answers
809 views

SQL injection attacks, how do I test and secure coldfusion queries?

I'm running Coldfusion 8 and SQL server 2008. I've been building serveral forms that insert data into the database from external users, we have a custom built security module built by the guy who ...
7
votes
1answer
916 views

How to document an algorithm properly with sample data?

I am wondering what should an algorithm documentation contain? Can't locate a proper guideline to follow. I have in mind to include summary of the algorithm description of the algorithm flowcharts ...
14
votes
5answers
2k views

Why is filesystem preferred for logs instead of RDBMS?

Question should be clear from its title. For example Apache saves its access and error logs in files instead of RDBMS no matter on how large or small scale it is being utilized. For RDMS we just have ...
3
votes
1answer
306 views

Equality between arity and degree concepts in relational theory

I've been reading the book "SQL and Relational Theory: How to Write Accurate SQL Code" by C. J. Date. I have no formal background in CS, much less relational theory. Combined with the fact English is ...
62
votes
16answers
5k views

Co-worker renamed all of my queries [closed]

I don't know if I should be very irritated or what. I single handedly built over 300 queries for a large database, and developed a naming convention so I could find them later. No one else in my ...
2
votes
2answers
702 views

UML to portray SQL objects

I am delving into the science of UML. The tool I am using is ArgoUML. I feel very confident portraying OO designs through this tool. But what still vexes me is the incorporation of the database. ...
37
votes
11answers
2k views

Why don't relational databases support returning information in a nested format?

Suppose I'm building a blog that I want to have posts and comments. So I create two tables, a 'posts' table with an autoincrementing integer 'id' column, and a 'comments' table that has a foreign key ...
4
votes
8answers
9k views

Learning Java in a couple of days and preparing interview presentation [closed]

I know its not possible to 'know' or 'learn' Java fully in a couple of days but I really need some help on this guys. I have just graduated from university with a degree in computer science. The ...
12
votes
11answers
15k views

Why is prefixing column names considered bad practice?

According to a popular SO post is it considered a bad practice to prefix table names. At my company every column is prefixed by a table name. This is difficult for me to read. I'm not sure the ...
2
votes
1answer
475 views

Active Record library with support for both SQL and NoSQL?

I'm looking for a PHP Active Record library that supports both SQL and NoSQL drivers (mongodb in particular). It doesn't matter if it actually has the NoSQL driver, I can write it myself, as long as ...
1
vote
2answers
752 views

If you're a .NET developer, does getting the Microsoft Certified Master SQL Server 2008 cert make sense? [duplicate]

So I've been working at a job for the past year as a .NET developer/DBA. The job is my first DBA job. Traditionally, I'm a .NET developer and have about 5 years experience in it. Does it make sense ...
5
votes
4answers
6k views

Why SQL numeric precision is specified as the number of digits?

I understand that this might be a loaded question. For example, in Sql Server 2008, doing DECLARE @someNum NUMERIC(10); means that the range of the variable will be limited by 10 digits. In other ...
4
votes
6answers
131 views

Arguments for storing binary asociations in a single field vs. in a mapping table?

When do you draw the line between relational tables, and fields holding multiple values of a particular type. Let me illustrate in an example below where a PokeMaster can be associated to multiple ...
6
votes
3answers
502 views

Types of databases

I read that there exists three main types of databases * Transactional (Client-Server database// OLTP database) * Decision support system (DSS) (Data warehouse database // Data mart // Reporting ...