Questions tagged [sql]
Structured Query Language is a language for interacting with relational databases. Read the tag wiki's guidelines for requesting SQL reviews: 1) Provide context, 2) Include the schema, 3) If asking about performance, include indexes and the output of EXPLAIN SELECT.
1,461
questions
6
votes
2
answers
9k
views
Database access class
I'm looking for any comments or feedback on my database access class. Security and speed are two things I'm most concerned about.
One thing to note is this class has to work in a C# .NET 2 ...
3
votes
1
answer
217
views
Maintaining a column for each datatype
I have a function that is suppose to store variables based on their datatype, and this is table I have come up with to store those variables into.
Is it smarter to have everything broken down like ...
4
votes
2
answers
212
views
Inner cursor performance issues [closed]
Before I tried to avoid using cursor because of performance issues. But now I have to do some calculations to reach some goals. I have a stored procedure that has a code like this:
...
10
votes
4
answers
11k
views
SQL: Search for a keyword in several columns of a table
I want to perform a search in several columns of a table. I use the following query:
...
5
votes
1
answer
1k
views
C++ template meta sql
I wrote a wrapper around boost-mpl and transformed it to an sql engine. It is a compile time sql thing, not related to normal databases. I have not finished it completely. I have some problem with the ...
8
votes
1
answer
2k
views
Idiomatic haskell database connectivity
In this post I asked about what would be idiomatic haskell database abstraction. I had been thinking for it a while, and the first answer was similar to what I had in mind, and I wrote a proof-of-...
6
votes
1
answer
530
views
Retrieving the most recent communication from a user
Could someone review an accepted answered I gave on Stack Overflow?
The use-case is as follows:
Given a messaging system where a user
can receive a message from a single
user and send messages ...
7
votes
5
answers
3k
views
Accessing the only element of Java ResultSet
Does this code look OK?
...
5
votes
3
answers
1k
views
Get distinct of two columns
I want to get distinct of two columns from an SQL table. Can I optimize this query?
...
7
votes
5
answers
6k
views
Database schema for a school
Here is the database query needed to create the database:
...
4
votes
2
answers
374
views
SQL paged search results
I'm trying to figure out a way to simplify implementing paged searching in sql server.
My restrictions are:
has to be in a proc.
can't use dynamic sql.
Here's my sample query:
...
3
votes
2
answers
617
views
Database design for an online learning application
It is an online learning application with different types of learnable items, that different users learn.
The users learn by spaced repetition (once right, wait a couple days, ask again), success is ...
8
votes
1
answer
861
views
Avoiding sub-queries in named scopes
I use named scopes all over the place.
When I have a named scope that deals with two different tables, I tend to query the second table in a sub-query. That way, if I mix and match with other tables ...
6
votes
2
answers
305
views
Extract a joined result set into a parent-child hierarchy
I'm writing a quiz application in PHP and am querying the DB for questions and their associated answers. I then wrangle the result set into a usable array for my front end. However, it always seems ...
8
votes
1
answer
528
views
Tame this Beast: TSQL Unpivot
Okay... here's the beast:
...