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

9
votes
4answers
1k views

Will working in IT limit your career prospects as a programmer? [duplicate]

I took a job working as an IT guy (SQL programming, helpdesk, etc.) because I had need of a job (to pay back student loans accumulated from school). I'm very happy to have a job, but I eventually ...
8
votes
4answers
10k views

why are noSQL databases more scalable than SQL? [duplicate]

Recently I read a lot about noSQL DBMSs. I understand CAP theorem, ACID rules, BASE rules and the basic theory. But didn't find any resources on why is noSQL scalable more easily than RDBMS (e.g. in ...
0
votes
3answers
180 views

How to maintain user relationship when user unfollows another user

I have a table of user relationship which stores who follows whom, the table structure is as follows -id -follower -following when someone follows any other user, I add a record with follower user ...
5
votes
1answer
628 views

OpenID implementation - PHP, Javascript, MySQL

I've started doing some research on the technologies that I will need for my website. I'm trying to implement a really simple website with OpenID user registration. The website will store a block of ...
9
votes
4answers
1k views

Why do relational databases only accept SQL queries?

As far as I know, most relational databases do not offer any driver-level API for queries, except a query function which takes an SQL string as an argument. I'm thinking how easier it would be if one ...
3
votes
1answer
984 views

Calling MSSQL stored procedure from Zend Controller ? Any other approaches?

MSSQL and DB, Zend as PHP Framework, I am using this way to call SP with I/P Parameters and to get O/p Parameters. It seems I am writing SQL code in PHP. Any other good approaches? $str1 = ...
1
vote
2answers
460 views

Why OTServs have an item cloning problem if the server crashes? [closed]

OTServs are open source MMORPGs with a huge community. Mostly all of them have a serious problem: if the server crashes, people can clone items. This is a dirty trick that can be executed because the ...
12
votes
6answers
2k views

Do You Still Need Indexing After Database Normalization

After you have done a good normalization, do you still need to index the table? How is this going to affect the performance? Will it even affect the performance in some way after a good normalization? ...
16
votes
6answers
32k views

SQL Triggers and when or when not to use them.

When I was originally learning about SQL I was always told, only use triggers if you really need to and opt to use stored procedures instead if possible. Now unfortunately at the time (a good few ...
1
vote
2answers
162 views

Is NoSQL a good fit for a graphing app, and how can I compare different NoSql Servers?

I am traditionally a MsSQL or MySQL developer - I have been prototyping a new application that involves storing data from many targets. I have seen that the app appears to get slow after scaling to ...
1
vote
1answer
287 views

Database data structures for RESTful api

I am creating a RESTful API. I am struggling to decide on the best way to design my database tables around my resources. Initially, I though a table per resource would be a good way to go, but I'm ...
1
vote
1answer
450 views

Established coding standards for pl/pgsql code

I need to standardize coding practices for project that compromises, among others, of pl/pgsql database, that has some amount of nontrivial code. I look for: Code formatting guidelines, ...
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 ...
3
votes
2answers
2k views

Why is NoSQL better for this scenario?

Hypothetical scenario: Let's say we are downloading JSON from Facebook with details of a user's friend's checkins, posts, etc... These come in as one document per friend per activity, so with 8 ...
2
votes
1answer
597 views

Internationalization through SQL Database and performance issues

I'm using .Net technologies and because ASP.Net "instant translation" is not really easy to do with ResX, since it has to be compiled after every change, there are a few hacks available ...
4
votes
2answers
652 views

Formatting SQL Based on an AST

I am working on my .NET open source project for generating SQL... Initially, I wrote the project so it spit out exactly one SQL format... ugly. I started using this project in the real world and ...
6
votes
4answers
512 views

Good idea to move logic out of SQL statements?

I'll preface this question by saying that I am very new to professional software dev. I work on a team that takes data in from other groups in my company and turns this data into reports usable by ...
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 ...
4
votes
2answers
187 views

How would I make a suggestion for a change to the SQL standard

If I wanted to make a suggestion to a change to how the UPDATE statement works in SQL, how would I go about it? Is there a website for the next standard? I googled, but just kept getting the ...
2
votes
1answer
619 views

Is Clojure a 3GL or a 4GL?

A bit of background (in case I'm mistaken)... I think I understand that (it's an oversimplification): manually entering codes into memory (or on a punchcard) is "first generation language" using ...
4
votes
1answer
361 views

Algorithm to denormalize database

I have built a QlikView script generator (QVS), that can be used to generate large script files for data imports from SQL Server to QlikView. QlikView does not like 'fully' normalised database ...
1
vote
1answer
221 views

Is Neo4j graph database sufficient to itself for all query types?

Neo4j eases relationship traversals => especially useful for a social network for instance. But are there any scenarios when it's advised to associate an additional relational database (or other ...
8
votes
4answers
5k views

Database History Table / Tracking Table

Currently I want to structure a tracking/history table like this: PrimaryKey - ID OtherTableId - fk fieldName - name of the field its tracking OldValue NewValue UserName CreateDateTime So ...
0
votes
1answer
334 views

For PL/SQL, do large companies prefer ANSI SQL joins or old Oracle joins? [closed]

I am interviewing for a PL/SQL position with a large corporation. I will have to write a multiple choice exam. I am wondering whether the exam will likely use old-style joins (joining happens in the ...
2
votes
2answers
2k views

SQL Auto Formatting and Auto Capatilize in Vim

I'd like to use vim for writing SQL queries, but I haven't figured out yet how to get two key features that I use all the time in programs like SQL Yog. I usually just start up an instance of Yog in ...
1
vote
1answer
639 views

Static Tables vs Dynamic Entity Attributes Storage Configurations

I am trying to figure out a better way to decide table storage configurations whether it will use static configurations using tables or dynamic configurations using EAV (entity-attribute-value) When ...
4
votes
2answers
528 views

Best practice to represent SQL in program source code

Where SQL statements are executed from a program, what is the best practice to store the statement text? Most often it is in a read only string, in the source file it is executed in. I think a ...
8
votes
4answers
712 views

Should database queries be abstracted out of the page itself?

When writing page generation in PHP, I often find myself writing a set of files littered with database queries. For example, I might have a query to fetch some data about a post directly from the ...
129
votes
19answers
35k 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
4answers
405 views

Storing Dynamic SQL in text files vs inline code

Our Architecture team is proposing a framework that would see our SQL queries moved from coded strings within our applications, into a file based system where we would invoke them with function calls. ...
22
votes
5answers
930 views

Multiple database accesses or one massive access?

What is a better approach when it comes to performance and optimal resource utilization: accessing a database multiple times through AJAX to only get the exact information needed when it is needed, or ...
4
votes
3answers
938 views

SQL RDBMS : one query or multiple calls

After looking around the internet, I decided to create DAOs that returned objects (POJOs) to the calling business logic function/method. For example: a Customer object with a Address reference would ...
0
votes
1answer
280 views

Concurrency checking with Last Change Time

I have an app with the following three tables Email (emailNumber, Address) Recipients (reportNumber, emailNumber, lastChangeTime, status) Report (reportNumber, reportName) I have a C# application ...
-1
votes
1answer
297 views

Address search from large text file

Basically I want to develop a Address lookup(part of my project) using C# (and I can use SQL if necessary). I have a very large text file which have all the UK address and postcodes. Addresses needs ...
1
vote
1answer
295 views

Structure of a correctly implemented JTable with TableModel and Listeners?

I am pretty new to Java and its JTables and this is where I am struggling at the moment. I need to create a GUI which shows me results of a sql query like SELECT * FROM tblPeople WHERE name='Doe'. My ...
1
vote
5answers
1k views

Is it Considered Good SQL practice to use GUID to link multiple tables to same Id field?

I want to link several tables to a many-to-many(m2m) table. One table would be called location and this table would always be on one side of the m2m table. But I will have a list of several tables ...
7
votes
2answers
2k views

Best method to implement a filtered search

I would like to ask you, your opinion when it comes to implement a filtered search form. Let's imagine the following case: 1 Big table with lots of columns It might be important to say that this SQL ...
-1
votes
1answer
1k views

How to use PostgreSQL on AWS - Ubuntu 11.10 [closed]

I'm extremely new to cloud-computing, Linux, and PostgreSQL, so if this is a stupid question, I apologize. I've managed to create an m1.large instance running Ubuntu 11.10, connect via Putty SSH, and ...
0
votes
0answers
112 views

Benchmarking ORM associations

I am trying to benchmark two cases of self referential many to many as described in datamapper associations. Both cases consist of an Item clss, which may require many other items. In both cases, I ...
0
votes
5answers
337 views

Is comparing an OO compiler to a SQL compiler/optimizer valid?

I'm now doing a lot of SQL development at my new job where as before I was doing Object Oriented desktop app stuff. I keep running across very large scripts (thousands of lines) and wanting to ...
-1
votes
1answer
523 views

keeping connection open all time in sql

I have developed a Windows application in c# in which multiple users can add some numbers and their name and can view the data entered. The problem that I have is that the sever is on my laptop and ...
0
votes
2answers
217 views

Visual C++, CMap object save to blob column

I have a MFC CMap object, each object stores 160K~ entries of long data. I need to store it on Oracle SQL. We decided to save it as a blob. Since we do not want to make additional table, we also ...
2
votes
3answers
614 views

How To Start Programming [closed]

I have taken a programming course 2 years ago but I haven't worked in programming since then. I recently found a programmer job, but there is no programming team so for me to gain valuable experience ...
1
vote
3answers
3k views

Storing Attendance Data in database

So i have to store daily attendance of employees of my organisation from my application . The part where I need some help is, the efficient way to store attendance data. After some research and brain ...
2
votes
8answers
6k views

Is executing SQL through a WebService a really bad idea?

Typically when creating a simple tool or something that has to use a database, I go through the fairly long process of first creating a webservice that connects to a database then creating methods on ...
5
votes
3answers
623 views

Should we have a database independent SQL like query language in Django?

Note : I know we have Django ORM already that keeps things database independent and converts to the database specific SQL queries. Once things starts getting complicated it is preferred to write raw ...
5
votes
4answers
566 views

Designing a Database Application with OOP

I often develop SQL database applications using Linq, and my methodology is to build model classes to represent each table, and each table that needs inserting or updating gets a Save() method (which ...
3
votes
2answers
490 views

Forced to write Stored Procedures

Can you think of some reasons that the management force the developers to write and call Stored Procedures instead of inline SQL statements directly? Even a very simple CRUD statement, writing a ...
7
votes
4answers
22k views

Best practice to query data from MS SQL Server in C Sharp?

What is the best way to query data from a MS SQL Server in C Sharp? I know that it is not good practice to have an SQL query in the code. Is the best way to create a stored procedure and call it ...
7
votes
4answers
2k views

Best C# database communication technique

A few days ago, I read an answer stating that writing queries within your c# code are long gone. I'm not sure what the specific person meant with the comment but, it got me thinking. At the company ...