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, nor does it refer to specific dialects of SQL on its own.
2
votes
1answer
74 views
Optimise this mysql query
This query is serving me a home page for users where a user can see all posts by him/her and his/her friends. This is an excellent query without any errors but i only wish to make it shorter if ...
4
votes
0answers
43 views
Code Reiview for an PHP PDO Queries? is there a better way to do it?
so this is my code for a equipping an item in my game dev't:
try {
$db = getConnection();
$db->beginTransaction();
$sql_chara_gold = $db->query("SELECT chara_gold ...
1
vote
0answers
9 views
VB.NET | SQL Code Cleanup
I don't know how else to form this question. I am trying to teach myself a new language in three weeks. Can you please give me some advice on how to clean my code and make it faster or more reliable? ...
2
votes
2answers
48 views
Building Session-Variables from a sql stored procedure
I have been advised to submit my code here by a fellow Stack contributer as it was suggested the code could be further improved;
Calling Code and attempt at building session variables:
DataTable ...
2
votes
1answer
40 views
Is there a more optimized way for this MySql Query
with below query i'm getting the results that i want but it's quite slow taking nearly 0.2 seconds (on an i5 machine). Is there a more optimized way to get the same results.
Basically this query ...
1
vote
2answers
75 views
How to optimize this code?
So I have this piece of code in Java(Android) to add a list of brokers to a local SQLite database as one single sql instruction.
public void Add(List<Broker> brokers)
{
if(brokers == null ...
5
votes
2answers
162 views
Strategy to create audit trails for a SQL database
I wish to create audit trails for specific tables and columns in my database, and document who made the change, when it was made, and what the change was.
To do so, I will create the following ...
0
votes
0answers
34 views
Looking to optimize SQL Server merge statement
I have a merge statement that takes around 10 minutes to process 5 million or more records.
The merge statement is part of a stored procedure that takes my newly bulk loaded staging table then runs ...
-1
votes
2answers
58 views
Insert to datagridview when SELECT query has WHERE condition [closed]
I use this code to Load and Insert data to a table using a DataGridView in a C# windows application.
SqlCommand sCommand;
SqlDataAdapter sAdapter;
SqlCommandBuilder sBuilder;
...
1
vote
2answers
64 views
Is there a simpler way to write a row from one table to another?
I have the following code:
const String sqlSelect = "SELECT * FROM UserPasswords WHERE username='System Administrator';";
const String sqlInsert = "INSERT INTO UserPasswords VALUES ...
2
votes
1answer
73 views
How can I improve the following stored procedure?
I have created the following stored procedure which duplicates a record in a table and also all its related records in other tables however since I am a newbie to SQL I would appreciate it if someone ...
0
votes
1answer
30 views
SQL Query based on results of preceding query
I am bashing my head against how to solve this puzzle. Is there any super SQL expert out there who can lend some help
I have a database with the following structure.
adjlevel | scheme | holder | ...
-1
votes
2answers
110 views
Is my PHP code free of SQL injection vulnerabilities?
Could you have a quick look over my code to see if its safe from SQL injection etc.. and suggest any amendments?
<html>
<head><title>Retrieve Your Login Code</title>
...
1
vote
2answers
93 views
Database calls with Python Flask and SQLAlchemy
I am creating a Python Flask webservice and this is basically how I am doing all of my database calls if a webservice needs to interact with the database:
@event.route("/somepath/<value>", ...
4
votes
3answers
146 views
Handling optimistic concurrency violations
I'm trying to establish a concurrency violation verification in my SQL updates using C# and raw SQL.
What I'm doing now is storing the TimeStamp value in a byte[] upon selection and before updating ...