database

free sql script to get a list of countries, provinces/states and their cities.

I am working on a registration page for a php website as mysql as the backend database. I need a sql script to insert the list of countries with their associated provinces and the provinces with their associated cities. I need all the countries, provinces and cities all over the world which are related to each other. I can get the indi...

Proper way of setting up database for ease of use?

So i'm trying to figure out the smartest way to do this. I have a list of businesses that can have photos and videos. i've created tables for: business, photos, videos. I also created a table for specials. I want to have featured businesses on the front page. Should I create a table called featured and have the businesses id stored in th...

Bulletproof way to DROP and CREATE a database under Continuous Integration.

I am attempting to drop and recreate a database from my CI setup. But I'm finding it difficult to automate the dropping and creation of the database, which is to be expected given the complexities of the db being in use. Sometimes the process hangs, errors out with "db is currently in use" or just takes too long. I don't care if the db i...

Database sharing/versioning

Hi everyone, I have a question but I'm not sure of the word to use. My problem: I have an application using a database to stock information. The database can ben in access (local) or in a server (SQL Server or Oracle). We support these 3 kind of database. We want to give the possibility to the user to do what I think we can call versio...

How to execute T-SQL for several databases whose names are stored in a table

Hey guys, so here's the deal. I have several databases (SqlServer 2005) on the same server with the same schema but different data. I have one extra database which has one table storing the names of the mentioned databases. So what I need to do is to iterate over those databases name and actually "switch" to each one (use [dbname]) an...

How do I update the members of a MySQL SET Type?

I have a table of values, with one of the columns being of type SET. If it currently has the members ('a', 'b', 'c', 'd'), how do I add 'e' to the possible values? I realize that using a SET type is a little strange, and I'm unclear why one would use it instead of a foreign key to another table with the values of the set, but I didn't ...

Offline Database Write Cache in C#

I have a windows service that receives a large amount of data that needs to be transformed and persisted to a database. To ensure that we do not lose data, I want to create a "Write cache" for the data that will continue regardless if the database is online. Once the database becomes available again, I would want it to flush the content ...

Can you get Tableau to work with sparse columns?

We are evaluating Tableau and noticed that it doesn't appear to recognize sparse columns in our SQL Server 2008 tables. Is this possible or are there any common workarounds? ...

Delphi 2010 Professional and remote database access

When looking for which version of Delphi 2010 to buy, we found the following limitation on the professional one: Delphi 2010 Professional is designed for developers building high-performance desktop GUI and touch-screen applications with (or without) embedded and local database persistence. What does this really mean? Doe...

How I can change prefixes in all tables in my MySQL DB?

My provider installed to my site Drupal CMS. Now I need copy all my data from old site. I have tables without prefixes in my old DB, but in new DB all tables have "dp_[table_name]" prefix. ...

Database design in blogging systems

As a learning exercise I'm trying to put myself a blogging system. The goal is to code something that will let me create multiple blogs, like blogger.com or wordpress.com, but much simplified. I would like to ask you, what do you think is best database design for this type of script. Is it better to have one big table, containing po...

Left Join 3 Tables and Show True or False on Empty Cells

Ok, this may be confusing so I hope I explain it correctly. I have 4 tables: business photos video category I want to display "featured" businesses on the home page (or elsewhere) and I want to show a Yes or No in the table row based upon whether or not there are photos or videos for that business. Example: Joes Crab Shack has no vid...

How do you find out which database links are used in queries for the Oracle RDBMS?

I would like to find out if any and which database links are being used, for a schema, and in which tables. Is it possible via the data dictionary somehow? Is this possible with the Oracle RDBMS? ...

Do any parsers exist for the Oracle DML table_reference?

Or are there any oracle data dictionary to tell me which tables are being referenced in (materalised) views? I wish to find out what tables references are used in a DML. I prefer to use an oracle package as it can be self contained in the database. But other suggestions welcome. Open source very welcome. Here is the link to the synt...

How to control the memory size of continuously running windows service?

I have created a windows service which is continuously polling a database. For this purpose i have a timer in place. Ever time i am querying a database table i open a connection and close it immediately after my work is done. Right now i am doing this every 20 seconds for testing purpose, but later this time might increase to 5 - 10 minu...

how to print data in a table from mysql

hello, i want to extract the last eight entries from my database and print them into a 2 columns table!like this: |1|2| |3|4| |5|6| |7|8| is that possible? this is my code: $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); $db->connect(); $sql = "SELECT ID, movieno FROM movies ORDER BY ID D...

Native SQL - How to set the schema and database names

Im using Native SQL from ABAP language. The query to get data is something like this SELECT COUNT(ROWID) FROM <SCHEMANAME>.<TABLENAME>;@<DATABASENAME> INTO :localvariable I want to somehow set the schemaname and database name as default so that i do not need to use them in the SELECTs later. Then i can only use the table name in the...

How to convert the time difference to hours(with 2 decimal place) in derby?

Hi, I am using timestampdiff in derby db to retrieve the time difference between 2 time: startdate, and enddate. e.g. startdate = 2010-02-23 02:59:52.045 enddate = 2010-02-23 03:45:39.898 select {fn timestampdiff(SQL_TSI_HOUR, startdate, enddate)} as diff I would like to know how can I get the time diff in hours, e.g. 0.25, etc? ...

Articles about replication schemes/algorithms?

I'm designing a distributed system with a certain flow of data in it. I'd like to guarantee that at least N nodes have almost-current data at any given time. I do not need complete consistency, only eventual consistency (t.i. for any time instant, the current snapshot of data should eventually appear on at least N nodes. It is tricky to ...

Studying MySQL, SQLite source code to learn about RDBMS implementation

I know implementing database is a huge topic, but I want to have a basic understanding of how database systems work (e.g. memory management, binary tree, transaction, sql parsing, multi-threading, partitions, etc) by investigating the source code of the database. Since there are a few already proven very robust open source databases li...