database

Is there any SQL designer (for linux or web-based) for mysql/sqlite/postgresql?

I don't know if the term SQL designer is correct, I'm looking for a graphic tool where you can do something like: then it can generate the SQL code for the creation of the tables. Any hint? ...

Best way for many classes to reference a database connection class

I'm soon going to be starting the development stage of my coursework and the current design is to have a single class that handles database connections and many classes that call it; the database class is supposed to open the connection and pass queries along blindly, other classes are responsible for the contents of those queries. Wha...

What is the best way to create a simple revision system using MySQL?

I am currently working on a simple revision system that enables me to store multiple versions of a single file, which works fine so far. Table structure is as follows (obsolete columns removed for the sake of brevity): file_id file_revision file_parent file_name -------------------------------------------------------- 1 ...

best practices for database applications

I asked myself, what the community considers "best practices" when it comes to building a frontend for a database. e.g.: should every form has its own connection? should all the database related stuff go into a separate layer? That is: creating a class, that handles all things database, which I then instantiate from my forms and so on...

clustered index versus index seek

Hi, what are the main differences between a clustered index and an index seek? ...

When should you map a column to Enum type in code

Hi all: Maybe this is a dumb question, but when should you map a column into a enum type. For instance, we all know that the column "Gender" which is represents as "M" or "F" in the database can be map to a enum called Gender. Since there are generally 2 gender :), we can be pretty sure that this enum will not need updating. However,...

Is LinqToSQL powerful enough? Isn't a more powerful but equally fluent interface easy to construct?

In a previous question, I asked whether ORM libraries were suboptimal solutions and received a lot of great feedback. As I've thought about the issue further, I've concluded that the primary benefit of LinqToSQL (now) and the promise of LinqToEntities (down the road) lies in their ability to reduce the "mismatch" between procedural code...

MySQL query question

If I have a table with the hypothetical columns foo and bar. bar might have 50-60 distinct values in it. My goal here is to pick say, up to 5 rows for say 6 unique bars. So if the 6 unique bars that get selected out of the 50-60 each happen to has at least 5 rows of data, we'll have 30 rows in total. ...

Display vs. Search vs. Sort strings in a database

Let's say I've got a database full of music artists. Consider the following artists: The Beatles - "The" is officially part of the name, but we don't want to sort it with the "T"s if we are alphabetizing. We can't easily store it as "Beatles, The" because then we can't search for it properly. Beyoncé - We need to allow the user to be...

Change column type from ntext to varbinary(max)

I have a table that has ntext field. MSDN says that ntext is deprecated and they suggest other data types: ntext, text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), var...

Create a MySQL table from a list of terms in a text file

Hi, I have a text file with a long list of terms (approx 800) sorted alphabetically in the format: aword bword cword ... I would like to use this file to create a new MySQL table where each term is a field, all with the property VARCHAR(5). Would be best if the fields were inserted in the order in which they appear in the file as I ...

How to prevent outliers to be inserted in database?

I have a MS SQL DB contains set of tables each table represents a collection of variables calculated based on our formulas. All the variables are numeric with predefined percision (we are using numeric data type with n.m as n number of digits for integral part and m number of digits for fractional part). My question is how to prevent ou...

What's the best way to deprecate a column in a database schema?

After reading through many of the questions here about DB schema migration and versions, I've come up with a scheme to safely update DB schema during our update process. The basic idea is that during an update, we export the database to file, drop and re-create all tables, and then re-import everything. Nothing too fancy or risky there...

Best Practice: How to check for a specific java.util.Calendar/Date in SQL.DATE by JDBC?

This is something I struggle with since yesterday. I have appointments to save in a database. They consist of a date and a time, like: 01.02.1970 14:00 (german format, in american I think it would be something like 02/01/1970 2:00pm). First idea: Save it as a SQL.DATE! So i created a table: CREATE TABLE appointments (id NUMBER(10...

Data Type of a field

Hey guys and gals, I have a field in a table that I will be storing different kinds of data in it, Like: X-Large, Medium, Small....or I might store: 22-March-2009, 1 Year, 2 Years, 3 Years...or 06Months, 12 Months, 1 Year, or I might store: "33-36", "37-40"...and that data is not fixed, i might need in the future to add new categories......

Can I remove sa login from SQL server?

I am a beginner in database field and this question might sound too stupid but I want to know why there is a login called sa and can I delete it? I want to delete it because it seems to have pretty serious privileges on database server! If it matters, I am using SQL Server Express 2008. ...

How can I do a BEFORE UPDATED trigger with sql server?

I'm using Sqlserver express and I can't do before updated trigger. There's a other way to do that? ...

What is happening to such distributed in-memory cloud databases as Hazelcast and Scalris if there is more Data to store than RAM in the cluster?

What is happening to such distributed in-memory cloud databases as Hazelcast Scalaris if there is more Data to store than RAM in the cluster? Are they going to Swap? What if the Swap space is full? I can't see a disaster recovery strategy at both databases! Maybe all data is lost if the memory is full? Is there a availability ...

Searching for a string 'somewhere' in a database

Here's my problem: I'm looking at someone's Postgresql based database application for the first time and trying to find what is causing certain warnings/errors in the system's logfile. I don't know anything about the database schema. I don't know anything about the source code. But I need to track down the problem. I can easily search f...

Maximum MIMEType Length when storing type in DB

What are people using as the length of a MIMEType field in their databases? The longest one we've seen so far is 72 bytes: application/vnd.openxmlformats-officedocument.wordprocessingml.document but I'm just waiting for a longer one. We're using 250 now, but has anyone seen a longer MIMEType than that? Edit: From the accepted answer,...