database

To improve SQL-queries in DDL

Improvements done nvarchar(5000) -> nvarchar(4000) BUT no nvarchar in PostgreSQL => TEXT memory limits to some variables the syntax slightly changed to more readable dashes to underscores Magnus' improvements I am following my plan for my first database project. I would like to know any weaknesses in the queries and in the relationa...

Howto merge into a database

I am having trouble figuring out the best way to approach this problem, I have two different list of items, one in the DB, one not. Both list have item ids and quantity, I need to merge the two list into the DB. My first inclination is to just pull all of the items out of the DB then merge the two list in the application logi...

What is the appropriate limit for a question in a database?

I am doing my first database project. I would like to know what is an appropriate limit for questions in length. My plan has varchar(5000) for the length of a question at the moment. What is the appropriate limit for a question in a database? [edit] A question in the database is like a question here in SO, with code formatting. ...

Is there any ISO standard of how to write SQL queries in DDL?

I am doing my first database project. I would like to know which of the following ways should I use to make SQL queries in DDL. #1 CREATE TABLE employees ( id INTEGER PRIMARY KEY, first_name CHAR(50) NULL, last_name CHAR(75) NOT NULL, dateofbirth DATE NULL ); #2 CREATE TABLE employee...

How can I migrate my database with rails to the first revision without dropping the database first?

I have a database set up for my Rails installation and some migrations set up. I would like to be able to reset my database back down to having no tables/constraints/etc., but can't find a reasonable way to do this without knowing the number of migrations or the timestamp of the first migration. Here are my options as I see them: rake ...

What is the difference between String and nvarchar(5000) in SQL?

I am doing my first database project in PostgreSQL or Oracle. I would like to get an answer for my question. ...

What datatype to use when storing latitude and longitude data in SQL databases?

When storing latitude or longitude data in an ANSI SQL compliant database, what datatype would be most appropriate? Should float be used, or decimal, or ...? I'm aware that Oracle, MySql, and SQL Server have added some special datatypes specifically for handling geo data, but I'm interested in how you would store the information in a "p...

Is this a Efficient way to query relational tables on MySQL?

I'm dealing with a relational table and I've been wondering if there's a way to lower the number of queries I need to make when inserting data to the tables.. Here are the queries I currently use: I insert the "main" values. INSERT INTO products (title, description, status, url) VALUES ('some title', 'description o...

To prevent the use of duplicate Tags in a database

I would like to know how you can prevent to use of two same tags in a database table. One said me that use two private keys in a table. However, W3Schools -website says that it is impossible. My relational table My logical table The context of tables How can you prevent the use of duplicate tags in a question? ...

What RAD environment or tool would you use for a small database-driven app?

I need to code a small record-keeping application for a small business in Windows and I'm considering programming it from scratch using .NET. However, I think that it might be overkill for such a common kind of program. It is mostly a CRUD application with simple arithmetic. I'm tempted to go the MS Access way, but I find it a bit limit...

To separate answers in a database

This question is based on this thread. CREATE TABLE Answers ( QUESTION_ID integer FOREIGN KEY REFERENCES Questions(USER_ID) PRIMARY KEY CHECK (USER_ID>0), ANSWER nvarchar(4000) NOT NULL AUTO_INCREMENT ...

BULK INSERT from one table to another all on the server

I have to copy a bunch of data from one database table into another. I can't use SELECT ... INTO because one of the columns is an identity column. Also, I have some changes to make to the schema. I was able to use the export data wizard to create an SSIS package, which I then edited in Visual Studio 2005 to make the changes desired and w...

How should an empty title be checked in a database?

I am doing my first database project. I would like to know why you should use NOT NULL in the following query ... TITLE nvarchar(60) NOT NULL .. Context CREATE TABLE Questions ( USER_ID integer FOREIGN KEY REFERENCES User_info(USER_ID) PRIMARY KEY ...

Database naming of columns with PII and sensitive information

I am working with database tables that contains PII and sensitive information. Some of the data is PII and company sensitive information. The design document may not always be available to the developer especially when the data is being exposed by a view outside of the database (Oracle database link) to another program. Is there good n...

What is causing the scaleX method of Imager class to fail?

This is a cross post from Perl Monks and Mahalo answers, where I have not received a satisfactory response yet. Thanks for your time and spirit: Why do I get this error message from perl: Can't call method "scaleY" on an undefined value at C:/strawberry/perl +/site/lib/ Image/Seek.pm line 137? I am getting the error in the title wh...

In an ORM, does "lazy loading" mean you may not get the results you expect from larger columns?

I was reading about a feature of an ORM called lazy loading, which, it said, means that larger columns are only loaded when the application actually needs them. How would an ORM decide what a "large column" is - would this be, for example, a blob column that can contain a lot of data compared to, say, an unsigned integer column? And when...

SQLite dropping a column using temporary table, can I retain primary key?

I am wanting to drop a column from a table in my SQLite database, and it seems there is no support for dropping columns with ALTER TABLE. Currently, I am using CREATE TABLE AS to create a new temporary table (minus the column I don't want) from one of my existing tables. I planned on dropping the original table and renaming the temporary...

Detecting for Pessimistic lock in VB6

I have a database system developed in VB6, and we have a scenario where more than one user may register at the same time triggering an insert in the database. I have used normal sqlconnection and recordset to make the insert and i initialize it with a pessimistic lock. Now how can i check in my application before inserting a record, if t...

How to refer dynamically to another database user?

I've a case in which I need to refer to another database user. I've to hard code database user name in view while referring to it. SELECT * FROM eg001t3.DUAL; // example. Is there a way to refer to that db user (eg001t3) from view dynamically or based on a database setup? ...

MS access table as centralised location for storing data

Is it possible to make my MS access tables as a centralised location for storing data I have an mdb access file to store data into a table using a form. Is it possible to enter data to a centralised location? this mdb file copies are used by five user at same time Please help ! ...