If I had a site where a user can flag another user post and it cannot be undone or changed, do I need to have a primary key? All my selects would be on the post_id and with a where clause to see if the user already flagged it.
...
I wrote a Program that backup SQL Databases using SMO Library on .net , and everything is just going smoothly, I just have one last point, I'm changing my way to save the .bak file on the hard disk, from DeviceType.File to DeviceType.Pipe, I have used pipes before, I just didn't know how to implement it here .
...
I wonder why these statements are not the same (the first one worked for me)
AND user_thread_map.user_id = $user_id
AND user_thread_map.thread_id = threads.id
AND user_thread_map.user_id = users.id
AND user_thread_map.thread_id = threads.id
AND users.id = $user_id
Shouldn't they be the same? In the 2nd one I linked all the tables in ...
Hi,
I do not understand what exactly happen behind the scenes when using static class with static members in multithread environment.
I have a server application where clients very often read-write to SQL db. For that, I have created static class with static members SQLConnection,SLQDataReader etc. But as I understood, static class is ju...
I'm working with SQL Server 2005 and have a single table:
int Code1,
int Code2,
real Val1,
real Val2,
real Val3,
Code1 & Code2 serve as a primary key and are part of the clustered index (only one index).
Each parameter occupies 4 bytes (each row occupies 20 bytes).
There are 24.5 million records in the table, fill factor is 100%, th...
Can anyone confirm whether or not the SQL:1999 Array type Constructor provides any operations for searching the Array in a WHERE clause?.
As an Example If a table EMPLOYEES had a column
QUALIFICATION VARCHAR(20) ARRAY[10]
containing values such as ARRAY['BSC','MBA']
Does the standard support some way of querying EMPLOYEES to find al...
How can I use two cursors in the same routine? If I remove the second cursor declaration and fetch loop everthing works fine. The routine is used for adding a friend in my webapp. It takes the id of the current user and the email of the friend we want to add as a friend, then it checks if the email has a corresponding user id and if no f...
Hi,
I have gone through some articles regarding Bigtable and NOSQL. It is very interesting that they avoid JOIN operations.
As a basic example, let's take Employee and Department table and assume the data is spread across multiple tables / servers.
Just want to know, if data is spread across multiple servers, how do we do JOIN or UNI...
Hi,
I would like to ask you for help, since my approach was not good. On the server side, there are clients connected (each client is represented by my Client class). Each client needs to comunicate with DB behind the server, also there is a need of multiple connections at the same time.
I am considering to have SQLConnection and SQLRea...
Hi, I have two tables: players and cards2
In each cards2 row, there is at least one player id (pid, pid2, pid3, pid4). I'm trying to come up with a select statement to get all fname's and lname's if there is more than one player id (pid's that are not 0). There is always a pid, but not always a pid2, pid3, etc. Does this make sense?
He...
Hi,
I don't understand why this piece of code miserably fails.
The first pass of the for() loop works fine but in the second pass mssql_query() fails, no errors are reported and the program just die.
for($i=0; $i <2; $i++){
$query = "SELECT * FROM Viaggio ";
$result = mssql_query($query, $link) or die("query fallita:".msql...
I have three tables, with these fields:
classes: class_id | name | grade
classes_students: class_id | student_id
students: student_id | name
Classes has a 1:n relationship with Students, so one class can have many students. I want to select all students of a particular class, where class_id is 5.
Could I just do something like thi...
Is there way to return a two dimensional array from a SQL query? Like..
"SELECT id, x, y, z FROM test"
..and have it return as id => x, y, z? I could do a loop and create a second array but I imagine that's extra work that I might not have to do. Just not familiar with SQL right now.
...
First, I know that's a terribly vague title -- my knowledge of SQL is so weak that I don't really know the particulars of what I'm asking, so please bear with me.
I have a table that looks like this:
+--------+-----------+----------+--------+--------+
| gameid | team1 | team2 | score1 | score2 |
+--------+-----------+----------+...
SELECT
SHA1(CONCAT(users.salt, '$password')) = users.password
FROM users
WHERE
users.username = '$username'
If $username exist this will return true, doesn't matter what password you put in =/
iI only want it to return true if username AND password is correct
What i want is, I want it to take the salt and password, rehash i...
I have 2 columns in my table, called TaskSet and SkillsSelected.
The sample data as follow:
TaskSet | SkillsSelected
--------------------------------------------------
SK000001, SK000004, SK000002 | SK000001, SK000002, SK000003
SK000002 | SK000002, SK000003, SK000004
As you can see it's ...
I have a table containing two columns in SQL that I want to extract values from. The problem though is I do not know how to retrieve column 2's values in C# code. I am using SQL Server 2008 and VS. Do I have to use an OUTPUT parameter in the SP? If so, how would I specify this SP? I have experimented with OUTPUT parameters, but I am...
I'm working on a .Net WinForms appliation that is connecting to a legacy RDB database...
Some of the fields for dates are stored as integers (imagine 2010-01-04 was the integer 20100104)
In the .Net world, I'd much rather work with datetime objects and I've been able to convert the integer into a date, just that it looks so ugly, takes...
We are having a rather long discussion in our company about whether or not to put an autoincrement key on EVERY table in our database.
I can understand putting one on tables that would have a FK reference to, but I kind-of dislike putting such keys on each and every one of our tables, even though the keys would never be used.
Please he...
I'm working on a small app which will help browse the data generated by vim-logging, and I'd like to allow people to run arbitrary SQL queries against the datasets.
How can I do that safely?
For example, I'd like to let someone enter, say, SELECT file_type, count(*) FROM commands GROUP BY file_type, then send the result back to their w...