database

Why we should perfer to store the serialized data not the raw code to DB?

Hi: If we have some code(a data structure) which should be stored in DB, someone always suggests us to store the serialized data not the raw code string. So I'm not so sure why we should prefer the serialized data. Give a simple instance(in python): we've got a field which will store a dict of python, like { "name" : "BMW", "catego...

how to delete index on mysql table ?

Hi, I have a table generated by GORM (Grails Domain). It has foreign key / index that generated random characters like FKAC7AAF67162A158F. I need to remove that field that not needed anymore. The problems, I have some servers that need to be updated. So I need to create a migration using Liquibase. But I have no idea how to remove that...

how to get filter the data table

hi. i have datatable with which contains all theses columns columns as ID, NAME,PATH i am binding the datatable to ID, Name in dropdown control. once the user selects a value of "name" in the dropdown . i'll get the ID of it . basesd on that then i need to get the corresponding path value in a string ...

Oracle same table name on different schema?

Is it possible to have same table name on different schema with different data on the tables within the one database? I think rather than create multiple database (that hold same table name) i should create multiple schema instead. Something like: Schema 1: table A, table B Schema 2: table B, table X PS: table B hold different da...

Free Tool for Validating 2 Databases

I want a free tool for verification all table data between 2 mysql databases ? is there any free tool available on Linux ...

How to get data from remote database using TSQL?

Is it possible to get data from remote server using JUST TSQL? I mean to do it just with script and without any actions (setting up linked servers and etc) on local server. Need to query something Like this: SELECT * FROM dbo.Users WHERE UserID NOT IN (SELECT UserID FROM [192.168.1.100].dbo.Users) ...

SQL Server Database Roles via SMO

I am trying to add new roles to a SQL 2005 database via the SMO assemblies. The Roles.Add method just does not seem to add the new role. I have my user account set as securityadmin and sysadmin. Below is the code extract that I am trying to use to set the new role: [assuming d has been set to a database object] Dim dr As New Da...

Cakephp console (bake) on Mac OS with Mamp : database connection error

Hi I am trying to do the Simple Acl controlled Application tutorial in the cakephp cookbook. The idea is : Making Databases CREATE TABLE users ( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL UNIQUE, password CHAR(40) NOT NULL, group_id INT(11) NOT NULL, created DATETIME, modified DATETIME ); ...

Using a schema other than 'dbo' in LinqToSql Designer

Is there a way to specify in a data connection or the LinqToSql Designer a schema? Whenever I go to setup a data connection for LinqToSql there doesn't seem to be anyway to specify a schema and I get 'dbo' by default. I figure that I can't be the first person to use a schema other than 'dbo' with LinqToSql, so I must be missing somet...

MySQL command to search CSV (or similar array)

I'm trying to write an SQL query that would search within a CSV (or similar) array in a column. Here's an example: insert into properties set bedrooms = 1,2,3 (or 1-3) title = nice property price = 500 I'd like to then search where bedrooms = 2+. Is this even possible? ...

reducing mysql statements that differ only in ORDER BY field name

I'm trying to sort data by different fields ascending and descending. But I have different mysql pdo statements for the 4 fields I have (8 queries total): $stmt1 = $po->prepare("SELECT * FROM tabname WHERE categ=:categ ORDER BY field1 DESC"); $stmt2 = $po->prepare("SELECT * FROM tabname WHERE categ=:categ ORDER BY field1 ASC"); $stmt3 =...

What does 'relational' in 'relational database' mean for us?

I know, relational database is a database where fields in one table are linking to rows in the others, something like this. But I can't understand what does it mean for me as a web developer! As I know, a query with joins and nested select can reduce perfomance (especially drupal-style queries with dozens of joins). Even more, any quer...

Database Design for Betting Community

I'm creating a online community for a soccer betting game available in my country. I've a pretty good idea how the whole system should work but I'm having some trouble figuring out the ideal database design and I need some help with it. The usual work flow should be something like this: Everyone is welcome to register as a member; eac...

Database design question (conditional mandatory fields)

Hi, Just looking for some opinions/ideas on how best to do this. I'm building an extranet system where users are added by the administrators manually (there's no ability for someone to "register" themselves). When they're added only a small amount of mandatory data is entered (name, email, password), they are then emailed their login, a...

pdo binding asc/desc order dynamically

Let's say I have 2 pdo statements that differ only in order (asc vs. desc) $stmt1 = $po->prepare("SELECT * FROM tabname WHERE categ=:categ ORDER BY field1 DESC"); $stmt2 = $po->prepare("SELECT * FROM tabname WHERE categ=:categ ORDER BY field1 ASC"); Is there a way I can bind ASC/DESC dynamically so I can have only 1 stmt $order = "AS...

Reliable and efficient key--value database for Linux?

I need a fast, reliable and memory-efficient key--value database for Linux. My keys are about 128 bytes, and the maximum value size can be 128K or 256K. The database subsystem shouldn't use more than about 1 MB of RAM. The total database size is 20G (!), but only a small random fraction of the data is accessed at a time. If necessary, I ...

Do database cursors pick up changes to the underlying data?

Quick question about cursors (in particular Oracle cursors). Let's say I have a table called "my_table" which has two columns, an ID and a name. There are millions of rows, but the name column is always the string 'test'. I then run this PL/SQL script: declare cursor cur is select t.id, t.name from my_table t order by 1; ...

Which is the best way to check if timestamp/datetime belongs to a specified date

Sometimes I have a datetime or timestamp columns in the database and, for example, I need to select all records with timestamp updated today. I usually do it like this: SELECT * FROM mytable WHERE CAST(TS AS DATE) = CURDATE(); SELECT * FROM mytable WHERE CAST(TS AS DATE) = '2009-11-01'; Also, it's possible to use DATE() function ...

What is an exciting area of database research?

I'm in graduate school and about to start a project related to databases. The professor has provided a list of topics for us to choose from, but we are also free to suggest something else we're personally interested in. The basic format of the project is quite simple: I'll study 2-3 research papers related to the area I end up choosing...

ECommerce, product and stock how to page those

Hi, I am building a EC system for a client, this client is selling second hand products. My DB scheme is roughly like this +-------------+ +-------------+ +-------------+ | Category | | Product | | Stock | +-------------+ +-------------+ +-------------+ | category_id | | category_id | | stock_id | | path | | prod...