Deleting every nth row SQL
Say I have a table (id int, Name varchar) of 1000 rows. Now I wish to delete every nth record (every 2nd, 3rd or 5th) . What is the most efficient way to do this ? ...
Say I have a table (id int, Name varchar) of 1000 rows. Now I wish to delete every nth record (every 2nd, 3rd or 5th) . What is the most efficient way to do this ? ...
I need to implement a custom-developed web analytics service for large number of websites. The key entities here are: Website Visitor Each unique visitor will have have a single row in the database with information like landing page, time of day, OS, Browser, referrer, IP, etc. I will need to do aggregated queries on this database s...
I have a Java application. I created a OSGi bundle and in Activator.start i added MyMain Class.main() .Application started but it have a problem with DB connection. 'java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.' If i start my application as an application it works fine. What is wrong? Thanks a l...
Hi, I have written a simple procedure: CREATE PROCEDURE [dbo].[sp_GetPublishedDocs2] @FromDate as Datetime AS BEGIN DECLARE @strSQL VARCHAR(5000) SET @strSQL='SELECT * From Task WHERE 1=1 ' IF @FromDate <>'1/1/1900' SET @strSQL = @strSQL + ' AND Task.CreatedDate >= '+Cast(@FromDate as Datetime) EXEC(@strSQL) END It run succe...
I read a lot of questions, but they doesn't working in my case. My situation is: my ajax query to database to insert infromation. But in my web-application user can click on buttons very quick so previous ajax query is not finished, and there is where bugs are appear. All i need to do is a delay between queries, so future queries will do...
Hi all, I just joined a web dev project that uses Symfony 1.4 on CentOS 5.4 with MySQL. The server is down. My first task in the project is to get it back up. I don't know a lot about Symfony. The Apache server log says Access denied for user 'root'@'localhost' (using password: NO) From all I can tell, the database access configuratio...
Hi guys, I have an application which manages 3 databases. I use hibernate with JPA on seam framework. So I have a persitence.xml file with three persitence-unit like this (I remove properties for db2 and db3): <persistence-unit name="db1" transaction-type="JTA" > <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta...
Hi, I'm trying to test some code in different situations (for different result sets). I've got the first test running well, but the next one is trying to reuse the first "table". My result sets: my $usernames_many = [ { username => '1234567' }, { username => '2345678' }, ]; my $usernames_empty = [ ]; but now when I ...
In my web application I will have three types of accounts. User: for using the web application for free Customer: for advertising and getting a Company Logo Admin: for editing and deleting stuff Should all these three be in separate tables or in one with a column named "account_type" where i can mark it as User, Customer or Admin? W...
I am working on a database that is relatively small. It has a total of 67 tables, with a little over a million records. It is about 254 MB. The application that works with it has been running for about 5 years and the amount of usage has doubled each year. This year we are projected to triple which will just almost double the database in...
Our SQL Server databases (SQL Server 2008 Standard edition, so to be R2) are getting bigger and bigger from years of data gets stored. So we are thinking of moving the old data (possibly older than a year) into an archive database. There are many reasons why we would benefit from having our production databases smaller. This is how I pl...
Hi, I have a Firebird .fdb file and can open it fine. But some tables are empty, and I can open the .db files of these tables using 3rd part programs. This was not developed by me. Now I need to open a .db from a table from firebird using c#.net Some knows how to do that? I dont want to open the database, connect to it, etc, just open ...
I am not a database guy, but am trying to clean up another database. So my question is would normalizing the gender table be going too far? User table: userid int pk, genderid char(1) fk etc... gender table: genderid char(1) pk, gender varchar(20) Now at first it seemed silly to me, but then I considered it because i can then have a ...
Hi, I'm interested in using Heroku for my project. I'm not interested in paying for it at the moment but the free plan only offers a 5MB database. Is there any measure I can use to know how many columns/rows of simple text data can be stored in a 5MB database? Thanks ...
Hi everyone, I am developing a C# application and want to be sure I choose the best choice for data storage that fits these specs. The program can have a infinite amount of data, but that data will only be used by a single user that is using the application. Each time the application is closed, I need to save the data, and it needs to ...
I have a C# application that allows one user to enter information about customers and job sites. The information is very basic. Customer: Name, number, address, email, associated job site. Job Site: Name, location. Here are my specs I need for this program. No limit on amount of data entered. Single user per application. No concur...
I am scraping data from I want to scrape three search engines. In My queries_controller I will have a function search that calls $this->Query->find('$query'). My Model will hand this onto my own Database whose read() funcion will call three functions, searchGoogle($query), searchYahoo($query) and searchBing($query). The return values wil...
This not a go/no go question. I've used all kinds of 4GLs (PL/SQL, T-SQL, PGSQL etc.) for database back-end coding and find very useful to establish data layer "closest" to database engine. Now MySQL stored procedures got my attention and very interested in coding in this brand new 4GL platform. I would like to start using it in one o...
Can we furthur Normalize this Sql Table Structue is Primary key is ID,Date,NAme,Type ID Date Name Type Value ----------------------------------------------------- 1 08/15/2010 Rating A+ 10 1 08/15/2010 Rating A- 10 1 08/15/2010 ...
I have a really big table with dozens of columns and lots of rows. Lets call this table FT. Everyday I run a script that reads data from the FT table, perform some calculations, and update a smaller table (table FA) that I use to generate reports. The query that update FA is something like: INSERT INTO FA (A, B, C) (SELECT sum(X),...