database

Efficient retrieval of overlapping IP range records via a single point.

I have a table with millions of IP range records (start_num, end_num respectively) which I need to query via a single IP address in order to return all ranges which overlap that point. The query is essentially: SELECT start_num , end_num , other_data_col FROM ip_ranges WHERE :query_ip BETWEEN start_num and end_num; Th...

Does PHPMyAdmin pose security Risk on production

The VPS I was using used to have PHPMyAdmin pre-installation option but removed it stating it poses security risk. Does it? If so do you recommend an alternative for browsing DB on production (other than running SQL commands in console) ...

How to model a database where one page can have different content types?

I have the database table page with the fields contenttype_id and content_id. I want to link a page to a contenttype via contenttype_id and refer to an actual content via content_id. The problem is contents depend on the contenttype_id and are modelled differently, therefore the content_id refers to different tables depending on the cont...

Pattern for searching entire DB record, not specific field

More and more, I'm seeing searches that not only find a substring in a specific column, but they appear to search in all columns. An example is in Amazon, where you can search for "Arnold" and it finds both the movie Running Man starring Arnold Schwarzeneggar, and the Gund toy Arnold the Snoring Pig. I don't know what the term is for t...

query results can't be enumerated more than once - problem with retrieving data from database

Hi I have a strange problem with retrieving data from database. In my form I have a combobox. The combobox contains couple of items - department's name. Everytime I choose an item from combobox I connect to database and fire this public List<User> SelectAllSecurityUsersByDepartment(string departmentId) { var result = DBConne...

MySQL Self-Join

Hi All, I have a table (this cannot be changed) like the following: POST_ID | PARENT_ID | POST_NAME 1 | 0 | Services 4 | 1 | Development 5 | 4 | Magento 2 | 0 | Contact The field, 'parent_id' references post_id to form a self-referential foreign key. Is it possible to write a s...

The best database class or functions for PHP?

I going to start to write a new software with PHP, and I need to know the best way to use database. Should I choose a database class such as Adodb, ezSql etc. What do you think which class is the best one? ...

Array or Database Table?

I could really use some good feedback on best practices / insight on whether it is better to put things in the database, or build an array. Take for example you have the suits of cards: $suits = array('clubs', 'spades', 'hearts', 'diamonds'); The array could change in the future, but not very frequently if at all. Now these suits are ...

Building a suffix tree for a string matching algorithm in large database.

Hi friends, I had an internship interview last week and I was given a question regarding searching for a particular string in a large database. I was totally clueless about it during the interview though I just gave a reply the"multi-level hashing" as that was the only hin I knew which had the best time efficiency, After a bit googling I...

Smart way to evaluate what is the right NoSQL database for me?

There appears to be a myriad of NoSQL databases available these days: CouchDB MongoDB Cassandra Hadoop There's also a boundary between these tools and tools such as Redis that work as a memcached replacement. Without hand waving and throwing too many buzz words - my question is the following: How does one intelligently decide which...

Is there a concept of triggers in Cash database system?

Trying ti understand if the Cash database system can have a trigger. It seems to be way different from Sybase/Oracle etc... ...

PHP: fastest hash for non-cryptographic uses?

I'm essentially preparing phrases to be put into the database, they may be malformed so I want to store a short hash of them instead (I will be simply comparing if they exist or not, so hash is ideal). I assume MD5 is fairly slow on 100,000+ requests so I wanted to know what would be the best method to hash the phrases, maybe rolling ou...

Querying multiple mySQL tables simultaneously

Hi guys, as the title states, I am trying to query multiple mySQL tables in the same DB simultaneously, here is my query, SELECT * FROM `database_db`.`one, two, three, four, five, six, seven` WHERE uid='1234567' I am using mySQL workbench to do the query, but when I run it I get this error Error Code: 1103 Incorrect table name 'one,...

Groovy sql dataset causes java.lang.OutOfMemory

I have a table with 252759 tuples. I would like to use DataSet object to make my life easier, however when I try to create a DataSet for my table, after 3 seconds, I get java.lang.OutOfMemory. I have no experience with Datasets, are there any guidelines how to use DataSet object for big tables? ...

How reliable are modern databases in the presence of disk errors?

InterBase had an architecture that caused disk-writes to leave the database in an always-consistent state -- 97 things every software architect should know, p87 Is this property finally common in 2010 ? Is there a study about database stability/reliability in presence of disk errors ? ...

Can't return row id 17 by getGeneratedKeys()

I'm using sqlite JDBC 0.56 and the table is created using fts3 MY table is created by stat.executeUpdate("CREATE virtual TABLE doc using fts3 (doc_name , doc_path);"); seems the problem is caused by this virtual table. I tried to insert a set of record into a database and return the generated key. But I find that when the key is bec...

search and result in asp.net mvc c#

i have a textbox with button search. i would like to search my database of input text from textbox and give result out in one view. Could you please give me link or help me how its possible to implement? I have no idea what i shoul to do that. ...

Should I calculate percentages in MySQL or in the application?

I'm writing a Rails app that does a lot of calculations on imported pay-per-click advertising data. The imported logs, which contain records about impressions, clicks, conversions, etc. are all stored in one massive log table, which then needs to be joined with a conversions table to calculate cost per conversion, conversion rate for eac...

PHP/PDO: style of write many queries on one page?

An example of my scenario is a large setup page for an application, the method I use is for example: //query 1 $stmt = $dbh->prepare("..."); $stmt->execute(); //query 2 $stmt = $dbh->prepare("..."); $stmt->execute(); Would this be an accepted method to write more queries? I have no clue how it's supposed to be done (or who does what,...

delete oldest records from database

I have a database with 1000 records. I am trying to create a sql statement so if the number of records will grow, then the oldest records to be deleted. I am using sqlite, but I assume the usual sql syntax will fit here. Thanks ...