django has this complex ORM built in to it, but after spending much time on it, it is still hard for me to make queries that are remarkably simple in SQL. There are even some simple things that I can't find a way to do through the django ORM (e.g. 'select distinct column1 from tablename').
Is there any documentation that shows "For com...
I am building a website that remembers the users choices from a navigation menu and then shows content the next time they visit the webiste there last view content is available, to this I am running this query
SELECT * FROM (`categoryTable`)
LEFT JOIN `userMenuTable`
ON `userMenuTable`.`categoryId` = `categoryTable`.`categ...
I am making a classifieds website...
I have these 6 tables:
Every category has sub-categories (or options) which you can see below.
Lets say the user wants to post a classified, and has entered all info into the forms necessary, and I am at the stage where I have to create the PHP code to actually INSERT the data into the database.
I a...
Summary
How do I make it easy for non-programmers to write a query such as the following?
select
table_name.*
, foreign_table_1.name
, foreign_table_2.name
from
table_name
left outer join foreign_table foreign_table_1 on foreign_table_1.id = foreign_1_id
left outer join foreign_table foreign_table_2 on foreign_table_2.id = fo...
Hi Friends,
we have subscription to Bloomberg data,
we use excel to load data from bloomberg using bdp function.
but its pain,so we decided to find easy way to do this .
Is there any way to program and calculate Fixed Income Chars from a list of securities using VBA ,access,sql or anything.?
Thanks
...
I'm looking for a more efficient way to run many columns updates on the same table like this:
UPDATE TABLE table
SET col = regexp_replace( col, 'foo', 'bar' )
WHERE regexp_match( col, 'foo' );
Such that foo, and bar, will be a combination of 40 different regex-replaces. I doubt even 25% of the dataset needs to be updated at all, but w...
What is the order of evaluation in the following query:
UPDATE tbl SET q = q + 1, p = q;
That is, will "tbl"."p" be set to q or q + 1? Is order of evaluation here governed by SQL standard?
Thanks.
UPDATE
After considering Migs' answer, I ran some tests on all DBs I could find. While I don't know what the standard says, implementa...
The answer to this may be a link to a good tutorial, but I've been unable to find one and it's getting rather frustrating.
I'd like to dive into the source code of DotNetNuke 5.2 which I have downloaded to a folder. I've opened up the solution that ships with it and it opens & compiles just fine.
What are the recommended steps for:
S...
I wrote a little script to get info out if MSI files. It works fine for simple SELECT statements. However when I use the following one it doesn't
SELECT Dialog_, Control, Text FROM Control
UNION SELECT 'UIText',Key,Text from UIText
I get the error msg
Microsoft VBScript runtime error 1A8: Object required
I open the Database like th...
I have three database tables: users, user_profiles and friends:
users
id
username
password
user_profiles
id
user_id
full_name
friends
id
usera_id
userb_id
What would be a query which finds the friends list of any user and also joins the table users and user_profiles to get the profile and user information of that friend?
...
I am working in a project which needs top performance in SQL results, and was looking to optimize a query, but after some trial and error I am having some trouble with IN.
-- THIS RETURNS NO RESULTS AT ALL.
SELECT sysdba.HISTORY.TICKETID FROM sysdba.HISTORY
where TICKETID = 't6UJ9A002MJC'
...
I would like to get the columns that an index is on in PostgreSQL.
In MySQL you can use SHOW INDEXES FOR table and look at the Column_name column.
mysql> show indexes from foos;
+-------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Tabl...
We have the following test model in the dbml file:
For the test case there are 4 records in the table, 1 parent, 3 children. We are looking for the siblings of a specific record, including the specific record.
using (var db = new TestDataContext())
{
var query =
from f in db.Foos
where f.Name == "Two"
...
I am planning to create a mysql 5 (myISAM) table that will contain x thousand rows of data. Each row will have a count field, & the rows with the 20 highest count values will be retrieved quite a lot, probably on a one-for-one ratio to every row update. The x thousand rows not in this 20 will not typically be retrieved.
What are the c...
I would like to see an example of:
When this is appropriate
When this is not appropriate
Is there a time when the choice of database would make a difference to the above examples?
...
Is anyone aware of a tool which can convert from SQL to an XPath query? Thanks.
This is a data-warehousing project. We like the idea of storing the data in XML because it's a common data format and lends itself to a search optimization strategy built on DB2. We have found a nice front-end tool for visualization and data mining that gene...
The lead developer on a project I'm involved in says it's bad practice to rely on cascades to delete related rows.
I don't see how this is bad, but I would like to know your thoughts on if/why it is.
...
I am storing price data events for financial instruments in a table. Since there can be more than one event for the same timestamp, the primary key to my table consists of the symbol, the timestamp, and an "order" field. When inserting a row, the order field should be zero if there are no other rows with the same timestamp and symbol. ...
Good Morning Stack Overflow,
I'm new to asp.net and have a problem I'm trying to sort out, maybe you can help?
The result im looking for is that the data goes into CANRADcontacts and CANRADcollreg which share a common ID.
I am populating the database via a web form, and can't quite get the SQL correct, please see this example;
Protec...
I got a table Assignments which contains the logs if a user is assigned with a quiz.What I want is to select the latest user_id's. How do I do this? Thanks in advance!
P.S. I want the unique id's with the latest created fields
...