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

0
votes
2answers
100 views

When do you use subquery in SQL? [on hold]

When do you use subquery in SQL, and what type of request is subquery useful for? I am practicing SQL and need to know how to spot a subquery problem immediately
0
votes
0answers
36 views

SQL Permissions differ in SSMS and ASP.NET? [migrated]

I have created a schema and user called "WebAPI" which is used by ASP.NET project to get stock levels. So, I have simple stored procedure: SELECT p.ProductCode, SUM( sl.Qty ) AS 'Qty' FROM ...
2
votes
6answers
205 views
+100

Using a relational database vs JSON objects for event/activity data

I am working on a project where I am trying to decide between using a standard SQL relational database or JSON objects to store data about an event or activity. The project will store data on ...
-2
votes
0answers
57 views

Python application development frameworks and tools [closed]

I am writing an application in Python. This application has a fairly complex GUI and a complex database backend (several database files used during runtime). What I think I should use so far: ...
0
votes
2answers
60 views

Return multiple columns with SQL where GroupBy is on one column [closed]

I have noticed that all the columns in a SQL Select Query should be in a aggregate function, because otherwise the output value for group would be arbitrary. This makes sense. But when the other ...
2
votes
1answer
163 views

Is there a purely SQL alternate to looping?

Historically, I probably would have written a script (php or something) to loop through all spreadsheet rows and perform some calculations. I'm looking for a pure SQL solution on the presumption ...
0
votes
3answers
58 views

Maintaining indices for location in a sorted list in database rows

I have a fairly simple data structure like this: create table project (id int auto increment primary key, name text); create table item (id int auto increment primary key, name text, project_id ...
77
votes
10answers
10k views

Why is “Select * from table” considered bad practice

Yesterday I was discussing with a "hobby" programmer (I myself am a professional programmer). We came across some of his work, and he said he always queries all columns in his database (even on/in ...
0
votes
4answers
206 views

How to handle or prevent all Admins and users being removed

I have a website that stores all users in a database. A user can log on to the website and if they have sufficient privileges can add/delete users, as well as change their privileges. How do I ensure ...
0
votes
1answer
85 views

Why doesn't MySQL have an explicit “No Limit” option for queries?

I use SQLyog Community edition and like many other SQL applications out there it puts a 1000 result limit on queries that do not have a limit provided. I am wondering why MySQL doesn't have an ...
-2
votes
2answers
148 views

Should an expert in SQL have the same skills as a DBA? [closed]

A new employee in my company recently jioned as a DBA. He's on a different team than me. I told him my boss is "pretty-much a DBA", this because I know he's expert in SQL. But I think i slightly ...
-3
votes
1answer
55 views

Is there any site like http://asp.net to learn sql basics and advanced concepts online [closed]

I am looking for online SQL Tutorial sites that will teach me about advanced SQL as well as the basics. I have already come through w3schools.com and sqlzoo.net, but I was looking for a site that is ...
2
votes
5answers
155 views

Is it bad software design to mix JDBC SQL calls and use an ORM in an application? [closed]

Is it bad software design to have JDBC/raw SQL and also use an ORM? I don't mind using an ORM for boilerplate CRUD, but some queries are better in SQL (for me). I'm not arguing for or against ORMs. ...
5
votes
2answers
261 views

Slight extension for SQL prepared statements syntax. Need advice

In my database abstraction library I am extending SQL prepared statements syntax to hint a parser with expected literal type. I take it as a very essential improvement, my reasoning you can read here. ...
0
votes
0answers
6 views

Access VBA/SQL “Run-Time error '424': Object required” [migrated]

I keep on getting getting a "Run-Time error '424': Object required" and I am not sure why, when I press debug it takes me to the line qdf.SQL = strSQL and highlights it yellow. I was wondering if ...
4
votes
2answers
321 views

How deeply programmer should know about internals of database engine? [closed]

I am learning SQL Server 2012 along with C#. In the past, I took database class in college, and have good grasp on SQL language and can write queries. However, looking at SQL Server documentation (or ...
2
votes
1answer
163 views

How to translate SQL query into REST API requests?

Let's say I have a machine-readable description (such as in WADL, Swagger or RAML) of a REST API that provides interface to a database. My users submit queries about underlying database in form of ...
0
votes
0answers
12 views

TSQL FileTable - Point at existing share [migrated]

I'm currently looking into indexing and searching documents using MSSQL's FileTable / Full Text Search functionality. In a labs environment it works flawlessly however in terms of rolling out to our ...
0
votes
3answers
83 views

SQL string field lengths in a db having about 6 different types of addresses, with about 20 markets and environments

I have been advocating lately that all string fields should be ntext / nvarchar(max) - we're using MS SQL Server. The objections seem to be either "it's not a good idea" (without any reason) or "that ...
0
votes
1answer
149 views

What happens if computer crashes after giving commit command

If we are updating a field in SQL and ALTER the row also. After giving the COMMIT command, the system is crashed. What will happen to the commands given, whether it will UPDATE and ALTER the table ...
2
votes
3answers
58 views

Select custom output formats from database with SQL

I am planning to make a simple rest service application, and I am currently deciding the architecture. I have decided that I want to write the middle layer in multiple languages, so that it is easy to ...
0
votes
0answers
24 views

Using a single table for identity and metadata

I'm in the early design phase of a project to provide an e-commerce platform that will require several entities to be modelled, products, customers, orders, CMS pages, etc. They will all have a few ...
1
vote
1answer
335 views

Do software developers write SQL? [closed]

Do software developers write SQL or database developers provide the SQL and the software developers use it? I am a novice to software development. I am just trying to understand the software ...
2
votes
2answers
118 views

Use Of Exists clause in SQL

Just finished Stanford lecture on SQL (by Prof. Jennifer Widom). However I have developed a confusion regarding the use of EXISTS clause. I thought it is just like a condition and an expression so ...
0
votes
0answers
56 views

what should I save in local android DB to be more efficient and to last more than one session (and shouldn't be stored in the server only)?

I write an android app. The user sends the server its location and get places relevant to him. He then can up-vote or down-vote any offer. I wonder if I should write to local DB and when? I ...
0
votes
0answers
19 views

database design for Media company in SQL 2008

I have to make the report for one of the client. There are three sources from I will get all raw data, so eventually I will have to marry those all data from different sources and make one report. ...
3
votes
3answers
372 views

Is it better to use a switch statement or database to look through 5,000 to 10,000 instances?

I have some JSON data in this format (5,000 instances for now): {"id":"123456","icon":"icon.png","caseName":"name of case"} I am allowing the user to search for the name of the case and then return ...
4
votes
4answers
307 views

Choosing value in SQL query vs (Java) code

I need to choose one of three values of an integer using the value of a column on a nullable column of a table. There are at least two approaches: 1) use SQL to do all the work: test null values, and ...
0
votes
3answers
122 views

High-Level SQL Interoperability

In a server -> client scenario, wouldn't it be simpler and faster to grant a public user access to a Stored Procedure rather than using web services (XML, REST, SOAP, etc) and other interoperable ...
0
votes
1answer
66 views

How to combine Google Analytics with Relational Database

I have a website with quite a lot of registered users, they are stored in a PostgreSQL database. I also running Google Analytics on the website to track the users. Is there a way to individually ...
1
vote
1answer
288 views

Creating a online database creator

I've been thinking of creating an online database creator (think DabbleDB, Zoho Creator, Intuit Quickbase, etc.). I've been thinking of a couple solutions: Have 4 database tables: Tables, Rows, ...
0
votes
4answers
123 views

When to store Date/DateTime?

I'm working on a social network website and I'm not quite sure when I should store the date/datetime. The service includes some of the following events: Register/Login Follow "Like" (images & ...
2
votes
1answer
96 views

Mental schema for SQL queries

While preparing SQL introductory material, I've ended asking myself about the line of thought followed by a developer when writing a query. I believe it could be too valuable from a beginner's point ...
-2
votes
1answer
81 views

Finding next free IP in a network

I have an IP network and want to automatically find a free IP address to provision a new server. Due to frequent server additions/removals the used IPs might be quite fragmented over the whole address ...
2
votes
0answers
126 views

Match buyers and sellers based on date ranges and quantity of shares

NOTE: This is in reference to the question I asked on Stack Overflow but was told to post this here I'm building a trading application that matches buyers/sellers that own subscription. Subscriptions ...
3
votes
5answers
237 views

Violating SQL principles

I have to write a decent size database, 1GB more or less. I have only taken an introductory semester regarding SQL databases. During the course we learned that the relational model under SQL has no ...
0
votes
2answers
452 views

Lead developer unable to do INNER JOIN [closed]

I had worked in the past for a small company developing web applications. Back then the current lead developer, who is also one of the bosses, told me that he is incapable of making a JOIN inside a ...
0
votes
1answer
264 views

Database Context and Singleton injection with IoC

All of the below relates to a ASP.NET c# app. I have a Singleton Settings MemoryCache that reads values from database on first access and caches these, then invalidates them using SQL Service Broker ...
1
vote
0answers
118 views

What database structure is suitable for tracking File audits?

I need to track permissions and access requests to a file server in a database. I'm given the full path of the folder and am considering parsing the path (splitting on the "/" character) and creating ...
2
votes
2answers
101 views

SQL Query syntax - formatting?

I'm looking at a very large (5-6 digit LOC), very complex, code-base, full of interacting bulky, interdependent, views and stored procedures (multiple 4-5 digit count silos). The source SQL has been ...
4
votes
3answers
206 views

How to avoid unmaintainable code when using SQL in an MVC setting?

I want to present a list of products to the user. This list is paginated and can be sorted by the user by product ID or product name in ascending or descending order. I am using an MVC setting, where ...
0
votes
1answer
147 views

How exactly can I check for new rows in sql with ajax? [closed]

How do certain services, just like google plus and facebook, check for new content without reloading the page? Whenever you are on any of those websites a new notification of a post related content ...
0
votes
1answer
90 views

How to store Status for Reservation table

I have a reservation table (a user fills out a form to request a reservation). It has two parts that need to be confirmed. isReservationAccepted (decline,accept,waiting) and hasReservationBeenSent ...
0
votes
1answer
105 views

Queries in three tier architecture

I am wondering where should the DB queries need to be in the three tier architecture. The first association that think is in the DAL. But then if the BL want to search for an object, the DAL need to ...
21
votes
2answers
945 views

Internal-use websites: Is there a compelling case against SQLite?

Many web frameworks, such as Flask or Django use SQLite as their default database. SQLite is compelling because it's included in python, and administrative overhead is pretty low. However, most high ...
0
votes
1answer
106 views

Search for object in loop or query? Who has better performance?

I have a DB that stores some complex objects of my app. When my app starts I load the objects into list and store them on the RAM. But sometimes I would like to search for an objects that fulfills ...
5
votes
3answers
448 views

Consequences of “naïve” vs “naive”?

While using IE autocorrect "naive" got transformed to "naïve"! My regional settings are Au English, from a Unicode search point of view the two are nothing alike. I am not even sure whether there are ...
0
votes
1answer
78 views

Multiple schemas vs aditional column per customer

If you have different database per customer as there is no need to share any data between them does the same apply if a customer has multiple stores ? I believe that it is easier to do queries for ...
0
votes
1answer
287 views

Notify client about changes in database in java

I've been searching around for the answer to this question, but haven't been able to find a solution. I am working on a distributed client-server system that uses TCP. The program's functions is to ...
0
votes
1answer
65 views

SQL-99 specification, is it specified to first order the result and limit it afterwards?

If I wrote this in MySQL SELECT * FROM foo ORDER BY bar LIMIT 1 it would first order the result and limit it afterwards. I always get the lowest bar. I wonder if this is specified like this in ...