database

mysql query for transposing data

I need to transform the values in my column into different columns. Example data with me currently: id dtime std_time ifInOctets ----------------------------------------------------- 4 1279027201 13:20:01 1.34E+08 1 1279027201 13:20:01 34562 2 1279027201 13:20:01 9.72E+07 4 1279027201 13...

Advanced SQL books - tutorials

Hi My situation is i know the basics of SQL and am a little rusty on stuff to do with joins etc. Id like a book which covers relational databases(info about them etc), understanding normalisation, set theory and then more advanced concepts such as stored procedures, cursors and so on. Tutorials, books, anything is good! Obviously if t...

Is this query possible?

Sorry in advance for the massive queries. I've been trying and cannot for the life of me get this query to work. It's adding wins and losses to both users when two logged in users are playing against each other. (It's rock paper scissors). I can make it work for a single user, but when I try to gather a 'stats-table' summing over use...

Can you upgrade sqlite3 version on your android?

Hi I'm writing an app which uses the Foreign Key Constraints which support was only just brought in for on version 2.2, and my phone is 2.1 Is there any way to upgrade the version of sqlite3 on the htc desire or any other android phone when your application installs? ...

Need help for one to many relationship design

I have an application form and a library of questions, one application form may contain one or more questions. When user selects a question from the library and adds the question to the application form, he can add some new attributes to the question or override existing attributes of the question if he wants to. When the user finishes q...

How to store assignment of resources to one or more jobs in MySQL

I have different types of resources that can be assigned to a job. My resources, for now, are technicians and equipment. I would like to be able to store old assignments (aka, no static column in the resource tables referencing the job table). I've been considering using a table for each resource that tracks assignments, but I would lik...

Rails: get a list of random items from MySQL database

I have a number of tags for each post. (Very similar to SO). I want 20 random items, non-repeating. I know that I could use Tags.all.rand (And repeat 10 times) however, this won't guarantee uniqueness. And I know I could use a SQL Query but since my development environment use sqlite as the db and MySQL in production, ORDER by RAND w...

How to store TimeZoneInfo objects in a database?

Somewhat misleading title, I know. Never actually wanted to store TimeZoneInfo object themselves: rather, I want to store some culture-neutral identifier, which can then be later used to reconstruct an instance of TimeZoneInfo. Currently, I'm storing the value of TimeZoneInfo.Id property and it seems to be OK both on English and Russian...

Should we start with multiple small-grained databases for an app that may scale massively

We're developing a new eCommerce website and are using NHibernate for the first time. At present we are splitting our data into multiple SQL Server databases, divided per area of functionality. So we have one for UserInfo, one for Orders, one for ProductCatalogue and so on... Our justification for this decision is twofold really: th...

How can I improve my database design and query skill?

I have been doing web development using python for a year. And all the projects I took part in are small-scale intranet applications, which didn't require much design skill and performance of queries just didn't matter in most cases. That means I can use an ORM like django.db and SQLAlchemy and forget about the database details. But r...

Which database to use locally in a desktop application?

I have two different options using database in a desktop application. I prefer the Service-based database even locally. But should I use the Local database instead? ...

sp_tables call taking more time which causes blocking

Hi, We could see that during our perl program runs which basically connects to SQLserver to insert/delete/update data, the below is called very frequently sp_tables @table_name='NOXXTABLE'. We see that for many SPID's the call happens a lot of times. On running sp_tables @table_name='NOXXTABLE' in SQLserver we can see that it returns n...

MySQL joins? What are they? When to use them?

I am probably going to get slaughtered for this, and told to read the manual (which I have, but it has not helped my understanding). I working with MySQL more and more at the moment, but I cannot get my head around joins, I know there are multiple types of join, i.e Inner, Outer, Left, Right but I do not what the differences are between...

AppEngine Primary Keys

Hi, by default, GAE adds a unique key to your db entries. Is it possible to have a numeric unique key in addition? Elias ...

Silverlight saving to Wordpress Database

I have a wordpress database for accounts and settings (or for this example, joomla accounts and settings database). I also have a working silverlight application that works all by itself without problems. How can I have the two communicate? For example, the user should be able to log on to my silverlight application using my wordpress/...

What is the optimal DB design for this type of data

I have a table of Users, Each USR_ID can have multiple Roles,Views,Brands and Units. So the optimal design I thought of is this: Users USR_ID USR_Username USR_Password Matrix M_ID M_USR_ID M_ROLE_ID M_VIEW_ID M_BRAND_ID M_UNIT_ID _ROLES ROLE_ID ROLE_Name ROLE_Active _VIEWS VIEW_ID VIEW_Name VIEW_Act...

Inner workings of a database

Could anyone recommend me a clear introductory article on the inner workings of each element composing a database system: file versus server (sqlite vs mysql) how the database engine integrates to the system (MyISAM, InnoDB) and how can MySql make it possible to choose between the 2 indexation how a request is processed how SQL is impl...

Is there a SQL ANSI way of starting a search at the end of table?

In a certain app I must constantly query data that are likely to be amongst the last inserted rows. Since this table is going to grow a lot, I wonder if theres a standard way of optimizing the queries by making them start the lookup at the table's end. I think I would get the same optmization if the database stored data for the table in...

What does it mean to be working on an ODBC software interface?

If I have my own DBMS and am developing to ODBC software interface, what would I be working on? making sure that one can access data from any database through my DBMS, OR making sure that every database can access data from my database I did not exactly understand this from the Wikipedia page. ...

How to check if a database exists with ODBC

Hello fellow programmers I have been searching the internet for a few days now and can't find a generic method to solve this with only ODBC and SQL. Is there a way to see if a database already exist, only using ODBC. It has to be standard SQL because the user can chose a DSN of his choice (meaning his own SQL Server). This means I can...