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.
4
votes
2answers
167 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 ...
3
votes
1answer
319 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
160 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 ...
29
votes
11answers
11k views
SQL: empty string vs NULL value
I know this subject is a bit controversial and there are a lot of various articles/opinions floating around the internet. Unfortunatelly, most of them assume the person doesn't know what the ...
1
vote
1answer
101 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 ...
7
votes
4answers
391 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 ...
17
votes
7answers
14k views
How do I make complex SQL queries easier to write?
I'm finding it very difficult to write complex SQL queries involving joins across many (at least 3-4) tables and involving several nested conditions. The queries I'm being asked to write are easily ...
0
votes
1answer
194 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 ...
1
vote
3answers
884 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
149 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 ...
5
votes
2answers
287 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
357 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 ...
110
votes
19answers
14k 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
260 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
783 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
360 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
113 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 ...
6
votes
1answer
703 views
self referencing tables, good or bad?
Representing geographical locations within an application, the design of the underlying data model suggests two clear options (or maybe more?).
One table with a self referencing parent_id column
uk - ...
-1
votes
1answer
137 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
votes
1answer
702 views
How to create computed column in SQL Server 2008 R2 [closed]
I have a SQL Server 2008 R2 database. This database has two tables called Pictures and PictureUse.
Picture table has the following columns:
Id (int)
PictureName (nvarchar(max))
CreateDate ...
2
votes
3answers
5k views
Best Resources for learning SQL? [duplicate]
Possible Duplicate:
Good Books and videos for absolute beginner to SQL
I have landed a role as a product engineer for a web based product.
A big part of the product is allowing its users ...
0
votes
0answers
42 views
Moving sql database [closed]
I need to move the sql database to a new server without changing the app that uses that database, how can i do this easily without affecting the users ?
9
votes
3answers
5k views
Why do we need to put N before strings in Microsoft SQL Server?
I'm learning T-SQL. From the examples I've seen, to insert text in a varchar() cell, I can write just the string to insert, but for nvarchar() cells, every example prefix the strings with the letter ...
1
vote
1answer
179 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
361 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 ...
85
votes
16answers
5k views
“Never do in code what you can get the SQL server to do well for you” - Is this a recipe for a bad design?
It's an idea I've heard repeated in a handful of places. Some more or less acknowledging that once trying to solve a problem purely in SQL exceeds a certain level of complexity you should indeed be ...
5
votes
2answers
296 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
467 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
99 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
231 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
203 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
126 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
531 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 ...
0
votes
2answers
204 views
Do I need to know databases like Oracle or SQL Server for a data analyst role? [closed]
I know only MySQL and do web application programming and Linux system administration. I have also started learning AI and machine learning.
I want to go into data analysis.
Do I need to know MS SQL ...
2
votes
3answers
773 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 ...
1
vote
8answers
2k 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
390 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 ...
4
votes
4answers
251 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 ...
41
votes
13answers
2k views
Is SQL important if I know ORM frameworks well?
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 ...
2
votes
2answers
331 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 ...
5
votes
4answers
9k 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
651 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 ...
10
votes
11answers
5k 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 ...
0
votes
1answer
425 views
How to check for null in most sql's - “column is null” or “column = null” [closed]
I'm not sure of the right syntax to use.
Is it
select * from tlb
where flag is NULL
or
select * from tlb
where flag = NULL
Is the answer the same for oracle, sqlserver and Postgres?
1
vote
1answer
334 views
How can I implement a database TableView like thing in C++?
How can I implement a TableView like thing in C++?
I want to emulating a tiny relation database like thing in C++. I have data tables, and I want to transform it somehow, so I need a TableView like ...
11
votes
4answers
378 views
TDD with SQL and data manipulation functions
While I'm a professional programmer, I've never been formally trained in software engineering. As I'm frequently visiting here and SO, I've noticed a trend for writing unit tests whenever possible ...
1
vote
5answers
1k views
Externalising SQL Queries in Java
What are the advantages and disadvantages of externalising SQL queries in Java (or similar general-purpose object-oriented programming language. Externalizing means storing all SQL in a separate ...
4
votes
2answers
250 views
Proper Data Structure for Commentable Comments
Been struggling with this on an architectural level.
I have an object which can be commented on, let's call it a Post. Every post has a unique ID.
Now I want to comment on that Post, and I can use ...
-2
votes
2answers
107 views
Proper Method name for XML builder [closed]
I think this is the right stack for this.
I have a helper class which builds CAML queries (SharePoint XML for getting list items from SQL)
There is one method that is flexibly used to build the ...
9
votes
6answers
539 views
Software solution from the 2000's, should I attempt to patch or remake the whole thing?
I was sent out to discuss a system that a certain company is currently using and what should be done with it.
The company manufactures various carton displays. This system was developed to keep track ...