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
3
votes
1
answer
272
views
Song database query
I am relatively inexperienced with MySQL and have a query, which to my eyes appears relatively complex:
...
2
votes
1
answer
111
views
MySQL query: blog entry has comments or not
How expensive is this query?
Lets say for example if I don't have a field called total_comments in my blog table. All I want to ...
4
votes
1
answer
128
views
Keeping track of voting
There is HTML that triggers the code below I want to disallow executing the script more than once per 24 hours. I wanted this script to store the last visit time in a table against the user ID in a ...
3
votes
2
answers
1k
views
Oracle PL/SQL decryption function breaking index?
I have a package called pkg_crypto.
My select looks like this:
...
5
votes
2
answers
132
views
Validating a user
This works well, but can anybody see any faults in this code? If so, could you suggest ways in which I can fix it?
...
2
votes
1
answer
834
views
Comparing products sold by several merchants
My application is for the use of comparing a product sold by several merchants on a daily basis. A process runs to load the current values of data for each store and enters it into a database along ...
5
votes
1
answer
110
views
Adding a new record to the beginning of the approval chain from the delegation chain
Table Structure
ApprovalOrder int
EntityCode varchar
CostCentre varchar
DelegationCode varchar
ProjectCode varchar
RoleGroup varchar
Position varchar
...
3
votes
1
answer
855
views
PHP Database class
Below is the code for a database class that wraps around a small set of the features that the mysqli extension provides. I'm looking for ways to improve its ...
4
votes
2
answers
3k
views
PHP SQLQuery class
I created a PHP class to handle building SQL query strings. I need advice on how to make the code more efficient.
...
3
votes
4
answers
2k
views
Shifting records in SQL Database while sorting with algorithm
I have a table in a SQL Server database, which holds information of some images, and the relevant gallery of them. The columns are like:
ImageId, ...
0
votes
2
answers
217
views
Query to compare execution performance metrics for the three most recent months
I've been working on a semi-awkward query in that it uses a very high number of functions given its relatively small size and scope. I was hoping to get some feedback on any ways I could format or re-...
2
votes
1
answer
316
views
Newsletter SQL query optimization
I want to build a small newsletter like tool which sends mails in pre-defined timespans. First after registration, second 14 days later, third 7 days later etc.
I came across for two database designs ...
1
vote
2
answers
9k
views
SQL query for adding column value to compare with other column
I have two tables
...
5
votes
1
answer
284
views
SQL - How's my formatting?
I'm somewhat new to SQL (using it in the past but only being exposed to it heavily in my current role). Unfortunately nobody at my current company has really given me any advice on formatting. How can ...
2
votes
3
answers
149
views
Query for combining results of same query running across multiple databases
I wrote a query to run the same query across multiple databases and combine the results. While it seems plenty quick I was wondering if there is a better way to do this.
...