database

What is wrong with this MySQL Query?

It's 12:30am and I have been coding for 9 hours straight. I really need to get this project done, but MySQL is messing with my deadline. Could you examine this snippet for me and see if you can find out what is wrong? PHP/MySQL Query $q = $this->db->query("SELECT * FROM bans WHERE ip='".$ip."'"); Keeps returning the following error.....

Improve the speed of locating a row (integer columns)

I have a 15 integer column with 5,000,000 rows in a table. Given a input record containing 15 integers I need to compare the input record with the 5,000,000 record table and obtain all matching rows. Note1: All integers within a row are unique Note2: the order of columns matching and the input record is not important. for example: 1, 1...

Node.JS and MySQL drivers

Is there a Node.JS Driver for MySQL that is commonly used other than http://github.com/masuidrive/node-mysql ? This driver is unstable (says the creator). It seems like there is not much activity with node.js database drivers. Is there a reason for this or is it just because Node.JS is so young? ...

Dependency of procedure in Oracle:

Hi all I am new to DATABASE. I am trying to figure out the way to find the procedure dependent on another procedure. Below query is giving me the dependecy of PROC1. ie Procedure called by PROC1 select REFERENCED_NAME from user_dependencies where name = 'PROC1' ; Below things I want to know: 1) Is this query even work same for Funct...

query a mysql table for rows that have the same month value and store as a php array for later use displaying them on a calendar

the subject basically sums it up, but i am working on a calendar in php for a client that should pull events from a table and display them in the appropriate cells. the calendar table is working no prob, but what i am trying to avoid is making a separate DB call for each day of the month. i am trying to figure out a way to store the re...

Database structure for efficient storage and retrieval

Ive got a database that receives links and content related to a specific football club,and the way im storing the content at the moment is in 2 seperate tables,1 that stores the links and the details,fm_sources, and another that stores club specific information,fm_club, that will be used to run queries against the fm_sources content to f...

SQL Server - what is the size of my database if this is the output from sp_spaceused

I ran the command: EXEC sp_spaceused The output was: So what is the size of my database? Is it - 4768.25 - 4076.57 = 691.68 MB (1st table) OR 19896 KB (2nd table)? EDIT I'm using SQL Server 2005 Express which has a "database size" limit of 4 GB. So in this context of "database size", if I were to calculate how far up to the spa...

How to insert Indian Rupees Symbol in Database (Oracle 10g, MySql 5.0 and Sql Server 2008)?

How to insert Indian Rupees Symbol in Database (Oracle 10g, MySql 5.0 and Sql Server 2008)? Actually i had one Table "Currency" , in which 2 field is like "currencyName" and "currencysymbol", so how would i insert new rupees symbol in databse. ...

Rails ActiveSupport Issue with state gems for notifications

Hello, I have installed multiple state_machine gems to my app to use them for a notification system but every time I run into an ActiveSupport issue. It usually looks something almost identical to this: >> m = Message.new TypeError: wrong argument type nil (expected Module) from /home/Ryan/appname/app/models/message.rb:2:in `i...

Data modeling question

My clients use one of the following when they sign up for my application: Foo API (requires a "auth_key", "password", "email") Acme API (requires a "secure_code", "username", "password") Bar API (requires a "xyz_code", "pass_key") (fake names, and about 15 more omitted for simplicity) I would prefer not to have 10-15 tables in my da...

How to handle NULL values in mysql/php?

In MSSQL Server, we make queries for null values like below: SELECT name, ISNULL(about, ''), contact FROM `user_profile` WHERE userid=1 But when I am trying to do the same with MYSQL then it gives error. What is the logical and easy way to handle NULL values in php/mysql scenario. Thanks ...

Command to get identity of newly inserted record in Interbase 2007

In Interbase (I'm using 2007, I don't know if it matters) is there a command to get the identity of a newly-inserted record, similar to SCOPE_IDENTITY() in SQL Server? ...

Confusion about varchar datatype.

Hi there, My server has my SQL version of 5.0.91-community, now i have to store a long string of approx about 500 character more or less, i thought of going with text data type but then someone told me it slows the performance, i wanted to know more about varchar and it's limit. i used to think that varchar is only limited to 255 char...

String concatenation issue in CTE SQL

I have the following CTE SQL WITH Tasks AS ( SELECT TaskID, ParentTaskID, CAST(SortKey AS nChar) AS sort_key /*,cast(SortKey as char) as sort_key */ FROM oaTasks AS s WHERE (TaskID = 1) UNION ALL SELECT s2.TaskID, s2.ParentTaskID ,Cast( '0.'+ cast(Tasks_2.sort_key as...

Right way to close WPF GUI application: GetCurrentProcess().Kill(), Environment.Exit(0) or this.Shutdown()

My GUI desktop-based WPF 4.0 (C# .Net 4.0) program works with SQL Server database. Each time when I run my application it creates connection to SQL Server via ADO.NET Entity Framework and if SQL Server is not reachable it throws exception and shows MessageBox with notification. Now I want that after user read this message application wi...

ASP MVC Delete only the relation between 2 tables (many-to-many relation)

Using ASP MVC with active record. Ive got 2 tables with records that sometimes are related and sometimes aren't. The relation is defined by the user. 1 table has projects, the other has devices. Projects can be created and deleted, devices cannot. When a user deletes a project, all relations between that project and the devices should b...

mySQL CPU Usage 99%

We have a java based SaaS application running on mySQL database on a 2 GB Linux VPS. Recently we added RAM to the server and since couple of days, mySQL is taking up 99% of CPU usage. We are quite clueless as to why this is happening. We have made some changes in the my.cnf file as we have read in certain forums. We have enhanced the res...

why are multiple DBs actually needed?

Hi, I was looking at godaddy.com which says they offer up to 10 MySQL DBs, but I don't know why you would need more than 1 ever since a DB can have mutliple tables. Can't multiple DBs be integrated into a single DB? Is there an example case where its better or unfeasible to not have multiple ones? And how do you differentiate between th...

"if, then, else" in SQLite

Without using custom functions, is it possible in SQLite to do the following. I have two tables, which are linked via common id numbers. In the second table, there are two variables. What I would like to do is be able to return a list of results, consisting of: the row id, and NULL if all instances of those two variables (and there may b...

The benefits of using an object relational database such as Oracle/PostrgreSQL vs a regular Relational database?

I'm curious as to what the major pros/cons are of using an object relational database over a regular relational database are? In what circumstances is it more practical, and are object relational databases the future? ...