Hi,
I have two tables - 'business' and 'business_contacts'.
The business_contact table has a many-to-one relationship with the business table. Furthermore, each business has a 'primary contact' field - which I'd assume is a one-to-many relationship with the business_contacts table.
The problem, of course, is that this creates a catch-...
Hi all,
I am creating a very simple, very large Postgresql database. The database will have around 10 billion rows, which means I am looking at partitioning it into several tables. However, I can't find any information on how many partitions we should break it into.
I don't know what type of queries to expect as of yet, so it won't be ...
I'm experimenting with using a string for storing different kind of data types in a database. When I do queries I need to cast the strings to the right type in the query itself. I'm using .Net with NHibernate, and was glad to learn that there exists functionality for this.
For the example I'm using this simple class:
public class Foo...
I would like to take a database of say, 1000 users and select 20 random ones (ORDER BY rand(),LIMIT 20) then order the resulting set by the names. I came up with the following query which is not working like I hoped.
SELECT * FROM users WHERE 1 ORDER BY rand(), name ASC LIMIT 20
...
Hi,
I have a database of items. They are for cars and similar parts (eg cam/pistons) work better than others in different combinations (eg one product will work well with another, while another combination of 2 parts may not).
There are so many possible permutations, what solutions apply to this problem?
So far, I feel that these are ...
I currently have a SQL Server 2008 database in which I am planning to separate out some tables to other databases. I want to be able to replace all references to the separated tables from the original database using views. Is there a better way (other than manually changing all FK and SProc references) to switch all the dependencies to...
How can I call a stored procedure using Doctrine?
...
Somebody must have come up with a solution for this by now. We are using PHP 5.2. (Don't ask me why.) I wrote a PHP class to display a recordset as an HTML table/datagrid, and I wish to expand it so that we can sort the datagrid by whichever column the user selects. In the below example data, we may need to sort the recordset array by Na...
Hi. I'm developing a simple database architecture in VisualParadigm and lately ran over next code excerpt.
IF EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'getType') AND type in (N'P', N'PC'))
DROP PROCEDURE getType;
Next goes my stored procedure:
CREATE PROCEDURE getType @typeId int
AS
SELECT * FROM type t WHERE ...
I want to create a query result page for a simple search, and i don't know , should i use views in my db, would it be better if i would write a query into my code with the same syntax like i would create my view.
What is the better solution for merging 7 tables, when i want to build a search module for my site witch has lots of users an...
i have the model:
class OpenCv(models.Model):
created_by = models.ForeignKey(User, blank=True)
first_name = models.CharField(('first name'), max_length=30, blank=True)
last_name = models.CharField(('last name'), max_length=30, blank=True)
url = models.URLField(verify_exists=True)
picture = models.ImageField(help_text...
Hi. Can anyone point out how to check if a select query returns non empty result set?
For example I have next query:
SELECT * FROM service s WHERE s.service_id = ?;
Should I do something like next:
ISNULL(SELECT * FROM service s WHERE s.service_id = ?)
to test if result set is not empty?
...
I have two beans (POJOs) - a Customer and an address class defined like this:
public class Customer {
private String name = null;
private Address address = null;
public Customer() {
address = new Address();
}
public String getName() {
return name;
}
public void setName(name) {
this.name = name;
}
//addit...
This is slightly embarrassing. I'm a professional developer working at one of the big tech companies and I've never used a database. I've got an idea for a website I want to build as a learning experience and possibly as a business, but I don't have the faintest idea what database to use, let alone how to fix/debug the database when I ru...
I've always been interested in how you can throw some SQL at at database, and it nearly instantaneously returns your results in an orderly manner without thinking about it as anything other than a black box.
What is really going on?
I'm pretty sure it has something to do with how values are laid out regularly in memory, similar to an a...
We have several applications that are installed in several departments that interact with database via Intranet. Users tend to use weak passwords or store login/password written on a sheets of paper where everybody can see them. I'm worried about login/password leakage & want to minimize consequences. Minimizing database-server attack s...
Is it possible to take a csv file stored in the res/raw resource directory and use it to populate a table in the sqlite3 database?
My thought was that, if there was a way to do a bulk import for the entire file into the table then that would be cleaner and faster than iterating over each line in the file and executing individual insert ...
I make a application, which has to interfaces. one is desktop and other is web application.
both have their own databases (which are same is structure).
I want to sync the database from desktop to remote server and also from remote server to desktop but i have no idea that how it does.
I use the MYSql database. and my desktop applicati...
I make a application, which has to interfaces. one is desktop and other is web application. both have their own databases (which are same is structure).
I want to sync the database from desktop to remote server and also from remote server to desktop but i have no idea that how it does.
I use the MYSql database. and my desktop applicati...
Hi, which structure returns faster result and/or less taxing on the host server, flat file or database (mysql)?
Assume many users (100 users) are simultaneously query the file/db.
Searches involve pattern matching against a static file/db.
File has 50,000 unique lines (same data type).
There could be many matches.
There is no writing to...