database

[MYSQL Query] How to select all the entries from the last month?

I have a table with entries which has a DATE field. Each entry has a distinct date. I'd like to select all the entries from the last month registred in the database. How? I tried: SELECT * FROM registries WHERE reg_date = DATE_FORMAT(MAX(reg_date), "%m")` ...without success ...

sqlite : Fatal error: Call to undefined function sqlite_escape_string()

Hello, I use a script who recquires SQLITE, on my previous hoster, it works, on local it works, on my new dedicaced server, it doesn't, i use PHP5 of course, on this link, you have a phpinfo() of the server. http://bit.ly/bXlLT1 Could you tell me what/how (apt get?) to install correctly sqlite to avoid this fatal error? Thanks ...

How to constrain a table linking two tables in many-to-many relationship

Say I have the following tables and columns: comp: id, model dvd: id, model comp2dvd: id, id_comp, id_dvd A computer can have multiple dvd drives, even of the same model, and a dvd drive can appear in multiple computers. How do I make it so that comp2dvd table can have only existing comp and dvd id...

How do I query SQLite Database in Android?

I successfully created the Database and inserted a row however I cannot Query it for some reason. My Droid crashes everytime. // Create a new row of values to insert. ContentValues newValues = new ContentValues(); // Assign values for each row. newValues.put("value", "kunjan"); // Insert...

Can Microsoft store three-valued fields in a single bit?

I'm completely ignorant of SQL/databases, but I was chatting with a friend who does a lot of database work about how some databases use a "boolean" field that can take a value of NULL in addition to true and false. Regarding this, he made a comment along these lines: "To Microsoft's credit, they have never referred to that kind of field...

Database indexing - how does it work?

how does indexing increases the performance of data retrieval? How indexing works? ...

Should Databases be used just for persistence

A lot of web applications having a 3 tier architecture are doing all the processing in the app server and use the database for persistence just to have database independence. After paying a huge amount for a database, doing all the processing including batch at the app server and not using the power of the database seems to be a waste. I...

Why would someone need an in-memory database?

I read that a few databases can be used in-memory but can't think of reason why someone would want to use this feature. I always use a database to persist data and memory caches for fast access. ...

Need help with SQL Query

Say I have 2 tables: Person - Id - Name PersonAttribute - Id - PersonId - Name - Value Further, let's say that each person had 2 attributes (say, gender and age). A sample record would be like this: Person->Id = 1 Person->Name = 'John Doe' PersonAttribute->Id = 1 PersonAttribute->PersonId = 1 PersonAttribute->Name = 'Gender...

Enum datatype versus table of data in MySQL?

I have one MySQL table, users, with the following columns: user_id (PK) email name password To manage a roles system, would there be a downside to either of the following options? Option 1: Create a second table called roles with three columns: role_id (Primary key), name, and description, then associate users.user_id with roles.ro...

Data not displayed first time in android after copying the file from assets to data folder

Description I have used the code tip from http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ to copy a pre-filled data file to the target and handled this in a asynch task Problem : On starting the application it gives error and shuts down first time, starting again without any change it works perf...

Data Modeling Help - Do I add another table, change existing table's usage, or something else?

Assume I have the following tables and relationships: Person - Id (PK) - Name A Person can have 0 or more pets: Pet - Id (PK) - PersonId (FK) - Name A person can have 0 or more attributes (e.g. age, height, weight): PersonAttribute _ Id (PK) - PersonId (FK) - Name - Value PROBLEM: I need to represent pet attributes, too. As it t...

Fast search in XMl files in .NET (or How to index XML files)

I have to implement a search feature which is able to quickly perform arbitrary complex queries to XML-data. If the user makes a query, all XML files must be searched to find possible matches. The users will have lots of XML-Files (a few 10000 or more) which are typically a few kilobytes in size. All the XML-files have almost the same st...

Excel Spreadsheet - Best way to perform an Oracle Query on a cell

Hi there, I have an Excel Spreadsheeet. There is a cell containing a concatenated name and surname (don't ask why), for example: Cell A2 BLOGGSJOE On this cell, I would like to run the following SQL and output it to cell A3, A4 and A5 SELECT i.id, i.forename, i.surname FROM individual i WHERE UPPER(REPLACE('" & A2 & "', ' ', '')) =...

What are provenly scalable data persistence solutions for consumer profiles?

Consumer profiles with analytical scores [ConsumerID, 1..n demographical variables, 1...n analytical scores e.g. "likely to churn" "likely to buy an item > 100$ in worth" etc.] have to be possible to query fast if they are to be used in customizing web-sites, consumer communications etc. Well. If you have: Large number of consumers La...

Insert problem using ADO with classic ASP

' Setting variables Dim con, sql_insert, data_source data_source = "project_db" sql_insert = "insert into cart ( UserID,Count,ProductName,ProductDescription,ProductPrice) values ('"&user_id&"','"&count&"','"&product_name&"','"&product_description&"','"&product_price&"')" ' Creating the Connection Object and opening the database Se...

Database back using your application

i have a windows application, the database is sql express how can i backup and restore the database using my application ...

Converting nvarchar(4000) to nvarchar(max)

Hi! We have a few tables in our SQL Server (2005 & 2008) database with columns defined as nvarchar(4000). We sometimes need to be able to store more data than that and consider to use nvarchar(max) instead. Now to the questions. Are there any performance implications we should know of? Is it safe to use "alter table" to do the actual...

prevent multiple login with same login credentials in php

My website has premium videos, for which users have to pay to watch it. I am sending a random user name and password to the user's email id when the payment is completed. Then I want to assure no more than one user use that login credentials simultaneously. For that I use a login_status column in database table with login credentials and...

How does one retrieve and display posts on a forum?

I'm struggling with a conceptual question. When you have a forum with thousands of posts and/or threads, how do you retrieve all those posts to be displayed on your site? Do you connect to your database every time someone visits your page then capture every post in an array and display it? Surely this seems like it would be very taxing o...