I have data that looks like this:
entities
id name
1 Apple
2 Orange
3 Banana
Periodically, a process will run and give a score to each entity. The process generates the data and adds it to a scores table like so:
scores
id entity_id score date_added
1 1 10 1/2/09
2 2 ...
I have to run few SQL queries and put the results into a spreadsheet. Since I am on a Spring/Java environment, I was about to run the queries using JDBC, iterate through the ResultSet, and use Jakarta POI to create a simple XLS.
This looks like a very common requirement, so I was wondering if there is something already available - a pac...
I'm useing MySQL and I have three tables, a table of tasks, a table of products and a table that describes the relation between the two: Each product is composed of several tasks, and each task may be found in multiple products.
The table that describes the relationship between the two has two primary keys, ProductID and TaskID that are...
Where can I find a list of the US States in a form for importing into my database?
SQL would be ideal, otherwise CSV or some other flat file format is fine.
Edit: Complete with the two letter state codes
...
Hello
Consider this example schema:
Customer ( int CustomerId pk, .... )
Employee ( int EmployeeId pk,
int CustomerId references Customer.CustomerId, .... )
WorkItem ( int WorkItemId pk,
int CustomerId references Customer.CustomerId,
null int EmployeeId references Employee.EmployeeId, .... )
Basical...
I have a table that contains some blob fields that I don't want to load by default.
In a dbml file it is possible to set the delay loaded property for such fields.
Is there a similar option for external mapping files?
...
Should I use decimal or float to store a ratio in a database? Particularly in SQL2005.
...
Hi everyone,
I would really appreciate help with this, I am seriously stuck. Basically I have a table that
looks like this:
SSS_DOWID Name Mon Tue Wed Thu Fri Sat Sun Description
2 M Y N N N N N N Monday
3 MF Y N N N Y N N Monday, Friday
.......
18 ...
Hi,
I don't know much about database optimization, but I'm trying to understand this case.
Say I have the following table:
cities
===========
state_id integer
name varchar(32)
slug varchar(32)
Now, say I want to perform queries like this:
SELECT * FROM cities WHERE state_id = 123 AND slug = 'some_city'
SELECT * FROM cities WHERE st...
I have a foreign key constraint between tables Sessions and Users. Specifically, Sessions.UID = Users.ID. Sometimes, I want Sessions.UID to be null. Can this be allowed? Any time I try to do this, I get an FK Constraint Violation.
Specifically, I'm inserting a row into Sessions via LINQ. I set the Session.User = null; and I get this err...
Hi,
I'm performing a UrlRewrite for my main category pages.
Converting:
www.mysite.com/Category.aspx?id=2
to
www.mysite.com/Dogs
In order to do so I'm using Global.asax's Application_BeginRequest where I perform the following code(psuedocode):
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (IsCategoryU...
Hi,
I want to store a row in an SQLite 3 table for each booking in my diary.
Each row will have a 'start time' and a 'end time'.
Does any one know how I can query the table for an event at a given time?
E.g. Return any rows that happen at say 10:30am
Thanks
...
A common (i assume?) type of query:
I have two tables ('products', 'productsales'). Each record in 'productsales' represents a sale (so it has 'date', 'quantity', 'product_id'). How do i efficiently make a query like the following:
Retrieve the product names of all products that were sold more than X times between date Y and date Z.
(...
I am adding SQL Replication (Transactional, single-publisher/distributor with many subscribers, using SQL 2005) to a website and have searched everywhere in the manual and on Google for this.
I am curious -- do I have to actually create a snapshot for new objects to get propagated, or is adding that new object (e.g., table, stored pro...
Is it always good to use stored procedures , is it good for database performance and what kind of queries that you better use stored procedures?
Exact Duplicate: When should you use stored procedures?
...
I am working on a web API for the insurance industry and trying to work out a suitable data structure for the quoting of insurance.
The database already contains a "ratings" table which is basically:
sysID (PK, INT IDENTITY)
goods_type (VARCHAR(16))
suminsured_min (DECIMAL(9,2))
suminsured_max (DECIMAL(9,2))
percent_premium (DECIMAL(9,...
The problem I'm trying to solve is that I have a table like this:
a and b refer to point on a different table. distance is the distance between the points.
| id | a_id | b_id | distance | delete |
| 1 | 1 | 1 | 1 | 0 |
| 2 | 1 | 2 | 0.2345 | 0 |
| 3 | 1 | 3 | 100 | 0 |
| 4 | 2 | 1...
So I have ~12600 subnets:
eg. 123.123.208.0/20
and an IP.
I can use a SQLite Database or an array or whatever
There was a similar question asked about a month ago, however I am not looking for checking one IP against one subnet but a bunch of subnets (obviously the most efficient way, hopefully not O(total subnets)) :)
How can I ch...
I need to create a stored procedure which pulls data from multiple tables that are not linked what do i do .Basically i got a few tables that are not linked and all i need to do is pull all the data from all those tables.
PLEASE HELP MY LIFE DEPENDS ON THIS
...
Hello.
I have an application that runs on a terminal.
The terminal is registered on a database table.
During all session that application is running on a terminal, I need to ensure that the line of the table corresponding to the terminal is locked and nobody can update that.
What is the best way to do this?
I use C#.NET as programm...