Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




How Many Records Can A Single MySql Table Hold.


I have a mysql database running on Mysql version 3.23.53 on a Red Hat
Linux 7.2. In the database there is a single table with over 150,000
records. Unfortunately, the performance of that table is very poor,
comparing to other tables in the same database.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Many Records Can A Single MySql Table Hold.
I have a mysql database running on Mysql version 3.23.53 on a Red Hat
Linux 7.2. In the database there is a single table with over 150,000
records. Unfortunately, the performance of that table is very poor,
comparing to other tables in the same database.

Displaying Records In Single Row.
I've written the following sql,but it is displaying the results in multiple rows,Could any body advise me on how to display the returned records in only one row.....

Multiple Records Single Value
I have been developing a realtor intranet system. I am currently writing a php script that deals with 2 tables "property" and "photos"

property table:
id | address | etc..
----------------------------
1 56 My Road
2 389 Your Street

photo table:
id | file_id | default | property_id
---------------------------------------
1 3434... 0 1
2 343c... 1 1
3 3udu... 0 1

I have added a field "default" in the "photos" table. The purpose of this is to set the default photo for the property listing. My problem is: I want to perform a single update query as I currently only know how to perform this operation with two. eg:

$sql1 = "UPDATE `photos` SET `default` = 0 WHERE `property_id` LIKE {$var}";
$sql2 = "UPDATE `photos` SET `default` = 1 WHERE `file_id` LIKE {$var}";

Any way of doing the above 2 queries in a single query?

How Many Rows Can Mysql Database Realistically Hold
i have a program that deals with 1000 entries a day...if i add 1000 entries each day into the database, at what point will it fill up and i have to create a new database?

Update A Set Of Records In One Single Query
My records contain a position, from 1 to n. This position is not the primary key.
In normal conditions, the position of this records should be as follows:
1, 2, 3, 4, 5, 6, 7, 8, 9 . etc...

One of my utitities is meant to check the consistency of the table -
one of the things it has to do is scan the table as follows:

SELECT position FROM employe_records WHERE employe_id = ? ORDER BY position

From the result of this query I verify each entry (JDBC) one by one, looking for inconsistancies. In a for() loop I look at the value of position and check that they start from 1 and are incremented by one for each record.

At the first inconsistency I come accross I want to run a query to update the records so it is consistant again - it is something like this:

UPDATE employe_records SET position = updatedValue FROM
employe_records WHERE employe_id = ? ORDER BY position

This is not valid query of course - my question is what should my query look like?! How can I make 'updatedValue' incremented by one automatically so each of the records are updated from 1 to n.

How Can I Update A Set Of Records In One Single Query
My records contain a position, from 1 to n. This position is not the primary key.
In normal conditions, the position of this records should be as follows:

1, 2, 3, 4, 5, 6, 7, 8, 9 .etc...

One of my utitities is meant to check the consistency of the table - one of the things it has to do is scan the table as follows:

SELECT position FROM employe_records WHERE employe_id = ? ORDER BY position

From the result of this query I verify each entry (JDBC) one by one, looking for inconsistancies. In a for() loop I look at the value of position and check that they start from 1 and are incremented by one for each record.

At the first inconsistency I come accross I want to run a query to update the records so it is consistant again - it is something like this:

UPDATE employe_records SET position = updatedValue FROM
employe_records WHERE employe_id = ? ORDER BY position

This is not valid query of course - my question is what should my query look like?! How can I make 'updatedValue' incremented by one automatically so each of the records are updated from 1 to n.

Single Table In MySQL
I am trying to build a table named 'health' in a medical database. I need a 'pid' int(6) NOT NULL AUTO_INCREMENT PRIMARY KEY a 'first_name' VARCHAR(40) a 'last_name' VARCHAR(40) and the I need 346 health related fields, each is type BOOL with a default value of 0. Trying to build the table using phpMyAdmin locally it exceeds the time limit and the query fails, so I am adding the fields 30 at a time. But when I finish building this table what should I expect to happen when actually inserting data in to the columns?

All Records From Table A - All Records From Table B - Join Alike Records
I am by no means a SQl Jedi as will be apparent by my question, but I
can usually figure out a select statement on my own. I have one today
though that really has me stumped. I am working in MySQlL 5.

In My first select statement I get all my records from Table B
SELECT
`table_A`.`ITEM`,
`table_A`.`DECSCRIPTION`,
`table_A`.`UM`,
`table_A`.`PHASE`,
`table_B`.`Qty`,
`table_B`.`Calc` as calculated
FROM
`table_A`
Inner Join `table_B` ON `req_itemlist`.`ITEM` = `table_B`.`ItemID`

In my second statement I get my records that match in this case phase
401 in Table B and all my Table A records for phase 401.

SELECT
`table_A`.`ITEM`,
`table_A`.`DECSCRIPTION`,
`table_A`.`UM`,
`table_A`.`PHASE`,
`table_B`.`Qty`,
`table_B`.`Calc` as calculated
FROM
`table_A`

Left Outer Join `table_B` ON `req_itemlist`.`ITEM` = `table_B`.`ItemID`
Where
table_A.PHASE In ('401' )

Now I need to combine the Data of both recordsets. I need EVERYTHING in
Table B, but I also need All Table A records that match the phase
selection....

Can I write this one query or do I need to use a Temp table?

Multi Table Query, Grab More Than Single Row From Secondary Table
I have a query like so:

PHP Code:

$selectt = mysql_query("SELECT trailers.trailer_id,
trailers.trailer_title,
trailers.description, trailers.file_url,
trailers.runtime, trailers.views,
trailers.rating, trailers.tt, trailers.keyw, trailers.date,
tags.snub,
films.film_title, films.studio, films.keyw, films.image
FROM films,tags,trailers
WHERE trailers.trailer_id=tags.trailer_id
AND trailers.film_id=films.film_id
ORDER BY trailers.trailer_id DESC LIMIT 8",$dbh);


I know this is pretty sloppy, I have multiple 'tags' per trailer ID, and I was hoping to grab all of them in a single query; maybe into an array? So that it shows the row, and then all the tags that belong to it.

Possible?

Can A Column Hold Two Of The Same Value?
I have a column called "loginName." Is it possible to hold the same values, if two rows had the same loginName of "John?"

Thanks. I was wondering because I'm building a photo album service with PHP and MySQL and needed to know because each row is going to hold a username and an image, even if it has the same loginName.

If it cannot, how would I make it so that when a user uploads a picture, how would a I store an id # in the database with the picture, and retrieve the data in a login session?

What MYSQL Data Type Can Hold Multiline Text Data?
say a file:

name#1 (start)
line2
line3
...
line14 (end)
name#2
....
name299
....
<eof>

It's really too messy to split into fields, file process and put it in tabular format. Every 14 lines there's a new "record" - I use the term record very loosely because by record I mean one data item eg. The new "records are separated by name# - so when I see a new name# I know it's a new "record". So in mysql I might have one primary key and just one other filed per a record that would be multiline text.

What I an specifically asking is:

What MYSQL data type can hold multiline text data?

Using A Query To Determine The Maximum Value A Number Col Can Hold?
I'm trying to find out how can you determine the largest value you can enter into a column of type smallint,mediumint,int, etc using a query. I know what the values are by looking at the documentation, but I would like to get this number using a query at runtime. So when I insert values into different tables/columns I can use an appropiate restriction befor trying to insert.

Single Table
I have a database dump using mysqldump. Now I want to import a table from the dump file. How would one do this?
I've used mysqlimport < table.sql, but what if I have databasedump.sql which includes all the tables, but I only want to import ONE table?

Lock Wait Timeout Exceeded; Try Restarting Transaction Even In Single Db Single User
I am updating few databases all which I keep as one transaction using .net connector. The best part is that I can still run into this error of "Lock wait timeout exceeded; try restarting transaction" even though I am the only single soul using my database at that time. Any idea how to over come this problem.

Two Joins To Single Table
I am working on a small PHP project and I am wondering what the easiest way to join one table to another table "twice."

There are two tables involved, one is a list of users with a primary key userid and the user's full name. The other is a list of messages between users, with a column for the sender's userid, the recipient's userid, the message, a reply, and a few other metadata fields.

I am using the query "SELECT name, message, reply FROM comments, users WHERE sender = userid" which returns the full name of the sender, along with the message and reply. However, I would like to also display the recipient's full name. Should I perform a sepertate query from within the PHP on recipient, or is there a way I can perform the second join with the user table from the single MySQL query?

Table With Single Column
I'm dealing with an online store in which the "catalog" table is already filled with data and I don't want to mess with it.
But I need to allow items to be marked as "tax exempt".
I'm thinking the easiest way to do this is to just create another table called "taxExempt" with a single column called "sku", which is the unique ID for any given item.For some reason it strikes me as silly to create a table with just one column. Is this generally an ok thing to do, or is there a better way to approach this?

93 Fields In A Single Table
I'm putting a database together for a client, he has a questionaire that comprises of 93 questions that range between yes or no's to if no why not (text and varchar fields)
I think his questionaire is ridiculous but he is the client at the end of the day.
I have been trying to decide how to put this monstrosity together and it looks as though a table with 90+ fields is going to be the result because there are no field repeats. I could design a generic "yes and no" table then populate it with the "yes no" questions linking it with a relationship but then the coding to ensure order is going to be a lot of extra work...Dwane

Cleaning Up MySQL Records In A Table
I transfered a mysql database to a new mysql server using a little software... Thing is, it put some garbage characters at the end of every record and it messes up when I try to echo the result in PhP.I'm looking for a way to remove the unwanted characters (or non-alphanumeric characters) in each record.Is there an easy way to do this ? I'm also using phpmyadmin, if it can be usefull.

Myisamchk Single Index On Table
I have a large myisam table (670 million rows) that has 6 indexes on it. I was had replaced all the data in it, and was running myisamchk when my server ran out of space on the 6th index (after 48 hours of processing).

Is there a way I can run the index fix just for the 6th index, not the other 5?

Delete Single Record From Table
how to delete just one record even if the criteria matches more than once.

For example say you have the table member_items:

uid | iid
 1  |  2
 1  |  2

Where uid is the members uid and iid is the items id.  I want to be able to do "DELETE FROM member_items WHERE uid='1' and iid='2'" but I only want to delete one of them.

Multiple COUNTs Against A Single Table
I want to get some counts from a single database table and I can't figure out how (or if) I can do it in one statement. I have a table of private messages and would like to get counts on new, read and trashed messages for a user. The table:

pms
----
msgID (int) (idx)
toUserID (int)
fromUserID (int)
msgSubject (varchar)
msgBody (text)
msgRead (enum 'y','n')
msgTrashed (enum 'y','n')

I would love to do know if it can be done without using multiple separate COUNT queries. Any way you can do this with one query? Right now I'm using 3 SELECT queries which all check against the toUserID...

new: SELECT COUNT(*) FROM pms WHERE toUserID=1 AND msgRead='N' AND msgTrashed='N'

read: SELECT COUNT(*) FROM pms WHERE toUserID=1 AND msgRead='Y' AND msgTrashed='N'

trashed: SELECT COUNT(*) FROM pms WHERE toUserID=1 AND msgTrashed='Y'

What Is The Use Of Two Primary Keys In A Single Table?
I saw some examples on the web, that they have two primary keys in one table, what is the advantages of using two primary keys compare to only one primar key on a single table?

Single Table Or Multimple Tables?
Would it be better to setup a system using multiple tables to handle daily entry, or set up individual tables based on daily, weekly or monthly schemes. On average each days entry will be 50 insertions tops, and thats a busy day. Would it be better performance wise to setup a cascading table, that will grow up to 250 entries weekly?

Duplicating A Single Record In A Table.
I need to duplicate a pretty wordy entry. I know how to write the PHP to do this but it seemed to me after reading that If I wanted to duplicate record with key 22 in field id and get a new record with key 23 that the following command would work.

INSERT INTO widgets SELECT * FROM widgets WHERE id = 22 ON DUPLICATE KEY UPDATE id=id+1;

However when I do this (from phpmyadmin) I get:

Error

SQL query: Documentation

INSERT INTO auctions
SELECT *
X FROM auctions
WHERE id =22 ON DUPLICATE
KEY UPDATE id = id +1;

MySQL said: Documentation
#1052 - Column 'id' in field list is ambiguous

Can anyone suggest a SQL command to do what I want or should I just write a little PHP program?

Mutli Joins To A Single Table
I have a table that has two different ID's that link to another table.  I want to be able in a single query pull back all the information I need.  My we host is running a fair old version of MySQL so I can't do sub quieries.  Here is what I came up with and everytime it runs it throws away one of the team columns.

SELECT S.ScheduleTime, H.Team , S.HomeGoals, V.Team, S.VisitingGoals, L.Location, S.Result  
FROM schedule S,  teams V, Location L,  teams H
Where  S.VisitingTeamID = V.TeamID
AND S.HomeTeamID = H.TeamID
AND S.LocationID = L.LocationID

GROUP BY On Single Field Table
I've decided to start logging the searches performed on my site so I can provide better search results, to do this I have put a simple insert query into my search processing script that writes the search into a single field table in my database.
I'm currently viewing this as a long list- not particularly useful - and have caught wind of the GROUP BY function which i'm hoping to use to give myself a useable summary of the searches performed.
Is it possible to use this on a single field table and get meaningful data? The actual function is working fine (basically eliminating duplicate searches) but I need to display the number of searches that each group represents as well.

Extracting Data From Large SINGLE-table Database To MULT-table Relational Database
I have a very large single-table database of articles that I want to convert to a multi-table, relational database.

The existing single-table database contains fields for article author, article source, and article category, where several 'author', 'source', and 'category' IDs repeat dozens of times for hundreds of different articles.

I want to create seperate tables for author, source, and category and populate the new tables by extracting data from the original single-table database by unique ID field.

I figured out how to use INSERT and SELECT to pull data in new tables, but can't figure out how to pull only a single instance of a unique author, source, and category to create master reference tables for author/source/category.

Selecting Data From Single Table... Subqueries
I have a table with a list of books, their genres (type), and price. I have attached it as an image.

I would like to select all books whose price is higher than all books of type HOR. Basically, I think that this means: find the book of type HOR that is the most expensive. Then, select all other books whose price is greater than that.

In this example, the most expensive HOR book is 19.60. Therefore, I need to select all books with price > 19.60 and not of type HOR.

I tried using a subquery like this:


SELECT * FROM BOOK WHERE PRICE > (SELECT MAX(PRICE) FROM BOOK WHERE TYPE='HOR' GROUP BY TYPE)
However, I get an error that says:

Quote:

#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT MAX( PRICE ) WHERE TYPE = 'HOR' GROUP BY TYPE )
LIMIT

I looked up that error in the mysql doc but it didn't have much info in there:

Quote:

Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR)
Message: %s near '%s' at line %d

Mysqldump Does Not Dump Single Table Contents
I just started learning to use mysqldump, which I found very useful in dumping database contents in xml format. However I was unable to dump contents of a single table. I tried following command:

mysqldump <database_name>.<table_name> --password --force --xml

Intrestingly, I am able to dump contents of the entire database via this command:

mysqldump <database_name> --password --force --xml

Joining Multiple Fields To A Single Table?
I have 1 table with 2 columns, 'id' and 'name':

tbl_names:
idname
------
1Bob
2Jeff
3Fred
4Joe
5Bill


I then have another table which contains several fields which hold id's
from the above table:

tbl_output:
idperson1person2person3
-----------------------
1231
2543


I need a query that will return the names for the specified id from
tbl_output.
If I have just one 'person' field in tbl_output I would do it with an
inner join like this:

SELECT name from tbl_names
INNER JOIN tbl_names on tbl_names.id = tbl_output.person
WHERE tbl_output.id = ?

but I can't figure it out when theres multiple fields to be joined from
the same table...e.g I want to specify tbl_output.id = 1, and it give me:

person1person2person3
---------------------
JeffFredBob

Mysql, Simple Table Join - How To Loop Through Records
I've been gradually learning and using PHP for about a year and I've now decided to start learning MySQL

I've got my first database up and running, and I can display records, edit/delete/search and sort records from that database. But I want to make things a bit more complicated and start making related tables.

I've decided to re-invent the wheel and make a very simple content management system for myself, just to see if I can.

I have a table called posts, which is what I enter my table content into, consisting of headline, creation date, post text and an id field.

I've also set up a table called comments which will allow users to add comments to my posts. In the comments table there's a field called id_post - which is the id of the post that the comment relates to in the posts table

I've already got my loop set up to loop through my posts records, but I'm confused about how I go through looping to get the comments records.

How do I do the loop?

I thought about doing an SQL query to the comments table nested inside my loop through my posts results

SELECT * FROM comments WHERE id_post='$id' ORDER BY stampcreate


But I assume this isn't the most efficient way of doing things....

Mysql Insert Records In The Middle Of Database Table
I have a table with field serial number(slno double).

I have data like this:
slno
-----
1
2
3
4

Now I want to insert a record between 3 and 4, so that the new record should have the number 5 . How to implement this? Same case with deleting a record also.

Multiple Tables Of Data, Single Category Table
I've searched and can't find what I'm after, so apologies if this has been covered before. I'm working on a small and simple CMS for a site I'm doing, and just as I was going to start the database I realised something...

(I'm using PHP and MySQL)

When it's finished, there will be articles, weblogs and content/features. Previously I've done a seperate categories table for each table I have, for example articles and articles_cats. Then a field in the articles table for the category. Now I'd like to use the same categories table for everything on the site.

However, I'd really like to have a link table, so each article can have multiple categories. Would I have a table to link articles and cats, then a table to link weblog posts and cats?

Fetch Data From Two Table Of Same Field With Single Query
Can I fetch data from two table of same field with single query?

Storing Text Articles By Network... Use Of Single Table?
I have a website where each network has their own unique ID. Right now, there are about 100,000 individual networks. I want users to be able to submit a story based upon which network they belong to. The submitted story will only be shown in that network as well. The submitted text story will only be about 1000 words long, so not too long. The user will be often performing full text searches on stories in their network.

Should I create a table called stories for each network?

Or should I create a unique story id and link it to each network?

Grant Lock Tables On Single Table Gives ERROR 1144
I can't understand why mysql allows me to grant lock tables to all
tables in a particular database, while it fails to accept the same
command applied to a single table only. I've tested on MySQL versions
4.1.20 and 5.0.33 (both running CentOS 4.4 linux on Intel-32) with
exact same results.

Whats wrong with grant lock tables on a single table?

mysqlSELECT VERSION()G
*************************** 1. row ***************************
VERSION(): 4.1.20
1 row in set (0.00 sec)

mysqlSELECT CURRENT_USER()G
*************************** 1. row ***************************
CURRENT_USER(): root@localhost
1 row in set (0.00 sec)

mysqlCREATE DATABASE grant_test;
Query OK, 1 row affected (0.00 sec)

mysqlUSE grant_test;
Database changed
mysqlCREATE TABLE t (i INTEGER PRIMARY KEY NOT NULL);
Query OK, 0 rows affected (0.01 sec)

mysqlGRANT SELECT ON grant_test.t TO grant_test_user IDENTIFIED BY
'Ahelluwapassw0rd';
Query OK, 0 rows affected (0.00 sec)

mysqlGRANT LOCK TABLES ON grant_test.t TO grant_test_user IDENTIFIED
BY 'Ahelluwapassw0rd';
ERROR 1144 (42000): Illegal GRANT/REVOKE command; please consult the
manual to see which privileges can be used
mysqlGRANT LOCK TABLES ON grant_test.* TO grant_test_user IDENTIFIED
BY 'Ahelluwapassw0rd';
Query OK, 0 rows affected (0.00 sec)

Grant Lock Tables On Single Table Gives ERROR 1144
Tested on MySQL 4.1.20 and 5.0.33 with similar results. I don't
understand why I cannot grant LOCK TABLES on a single table, while
granting LOCK TABLES on all tables work fine.

mysqlSELECT VERSION()G
*************************** 1. row ***************************
VERSION(): 4.1.20
1 row in set (0.00 sec)

mysqlSELECT CURRENT_USER()G
*************************** 1. row ***************************
CURRENT_USER(): root@localhost
1 row in set (0.02 sec)

mysqlCREATE DATABASE grant_test;
Query OK, 1 row affected (0.04 sec)

mysqlUSE grant_test;
Database changed
mysqlCREATE TABLE t (i INTEGER PRIMARY KEY NOT NULL);
Query OK, 0 rows affected (0.02 sec)

mysqlGRANT SELECT ON grant_test.t TO grant_test_user IDENTIFIED BY
'foobar';
Query OK, 0 rows affected (0.12 sec)

mysqlGRANT LOCK TABLES ON grant_test.t TO grant_test_user IDENTIFIED
BY 'foobar';

ERROR 1144 (42000): Illegal GRANT/REVOKE command; please consult the
manual to see which privileges can be used

mysqlGRANT LOCK TABLES ON grant_test.* TO grant_test_user IDENTIFIED
BY 'foobar';

Query OK, 0 rows affected (0.03 sec)

Update A Record Out Of 2 Duplicate Records Which Dont Have Primary Key In Mysql Table
how to update a record out of 2 duplicate records which dont have primary key in mysql table?

Query Table A And Return Records Not Found In Table B.
Given table A and table B.  Table A is a master table and table B is a list of authority or reference which is fed by selecting records from table A (via an UI I wrote in PHP).

The interface is working fine but I am left with one problem.    If I need to edit my table of authority, the source table (table A) should return ONLY entries not previously selected.

That said, if the A.key is in B.key, records from table A matching B.key should be omitted.

I could do this by looping through the query results from table A and querying table B, if no match, show A.key.  This I think is a bit antiquated and possibly too involved.

Is there a joint query command I can use?

Finding All Records In One Table That Don't Have A Corresponding Record In Another Table
I have photo information stored in a table called pictures. One column is keyword.

Visitors to my site can search for photos by keyword.

I record search terms in another table called searches. Each search term is recorded, meaning there are duplicate search rows. This allows me to see easily the popularity of a search term.

Step 1. What query can I run to find all search terms that return no matching picture in the picture table.

I tried the following, but no luck:Quote:select term from searches left join pictures on term like keyword where picture_id is NULL

Alternate Solution To "intersect" In A Single Table...
I am having a problem getting my desired outcome with my table.

Table: orders

+-------+-------+------+------+------+------+---------+
| ordno | month | cid | aid | pid | qty | dollars |
+-------+-------+------+------+------+------+---------+
| 1011 | jan | c001 | a01 | p01 | 1000 | 450 |
| 1012 | jan | c001 | a01 | p01 | 1000 | 450 |
| 1019 | feb | c001 | a02 | p02 | 400 | 180 |
| 1017 | feb | c001 | a06 | p03 | 600 | 540 |
| 1018 | feb | c001 | a03 | p04 | 600 | 540 |
| 1023 | mar | c001 | a04 | p05 | 500 | 450 |
| 1022 | mar | c001 | a05 | p06 | 400 | 720 |
| 1025 | apr | c001 | a05 | p07 | 800 | 720 |
| 1013 | jan | c002 | a03 | p03 | 1000 | 880 |
| 1026 | may | c002 | a05 | p03 | 800 | 704 |
| 1015 | jan | c003 | a03 | p05 | 1200 | 1104 |
| 1014 | jan | c003 | a03 | p05 | 1200 | 1104 |
| 1021 | feb | c004 | a06 | p01 | 1000 | 460 |
| 1016 | jan | c006 | a01 | p01 | 1000 | 500 |
| 1020 | feb | c006 | a03 | p07 | 600 | 600 |
| 1024 | mar | c006 | a06 | p01 | 800 | 400 |
+-------+-------+------+------+------+------+---------+

What I am trying to do is list only the entries from cid that have both 'p01' and 'p02' in the pid column.

In oracle(sqlplus) I did it like this:

select cid from orders where pid='p01'
intersect select cid from orders where pid='p02';

SELECT INNER JOIN Performance VS Single Table SELECT
I have designed my database using a somewhat oriented approach. Rows are objects, and different type of objects are in different tables, but since my objects share a common set of fields like ExpireDate, Archived, Draft, CreateDate, CreatorID, etc; I have an 'objects' table with these columns, and I have set up a foreign key in other tables where there is a need for a row-to-row integrity.

Now my question is, since I have to SELECT using INNER JOIN with object and the corresponding table, merely to filter out archived rows, I am wondering if I would be better off actually putting the common fields into each respective table and get rid of the 'objects' table altogether. I mean, is it more job for the server to actually JOIN the tables for each SELECT versus having a clean design with object oriented approach ?

How bad is my design, and what are the recommendations of experts who obviously were tempted to create an object oriented database design?

Copy Records From One Table To Another Table
What is the sql query in mysql which copies all records from one table to another table within a database...? and query that copies records from one table to another that belongs to a different database...

Select All Records From One Table That Does Not Appear In Another Table
I need to select all records from tableA that does not appear in tableB. I am using the following query that does work but is very very slow. Is there anything i can do to speed up the query?

select tableA.ID, tableA.Name, tableA.Surname
from tableA where tableA.ID != ALL (select tableB.ID FROM tableB where tableB.status = 'inserted' or tableB.status= 'edited' or tableB.status = 'deleted' );

I have as example 6000 records in tableA and 2000 records in tableB. tableB is used to track which records have been inserted, edited or deleted from another system so the query should return all records that do not exist in the other system yet.

This query runs for about 3mins and just gets slower the more data there is.
Can anyone suggest anything that could make this a sub second response?

Single Quotes In MySql 3
Im using MySQL 3.23.53 (upgrading is out of my hands) and every time a user enters a single quote ie: ' into field that gets stored in a text column, my .Net program crashes (ASP.net 2 to be specific)

Is there any solution, other then not allowing this character to be ented or having to check if it was entered and escape it ?

Single MySql Installation
I have a novell 6.0 server running MySql v 4.1. We installed mysql to support a program called Orchard per the vendor's instruction.

We have received another piece of software that requires mySQl. This vendor knows very little about mySql. Can I use the same installation of mySql to support both database programs?

Select Single From Multi - Multi Table
I have 2 tables a community table and a subuser table. The community table has information on the community, for my purposes here just name and cmlsnumber. The cmlsnumber has a foreign key link to the subuser table. The subusertable has 3 columns cmlsnumber, userid, and admin.

cmlsnumber is a unique identifier for my communities' userid is a unique identifier for my users admin shows whether there is an owner for the community.

There can be only 1 admin for a community.

What I am trying to do is to select all the names, cmlsnumbers where there is no admin.

My query right now looks like this ....

Single Quotes Error In Mysql 4.1.12
My host recently upgraded from 3.23.53 to 4.1.12 of Mysql. Ever since then, any text fields that have an apostrophe or single quote causes this error. If we remove it, the sql processes correctly.

Example: Typing didn't will give the foll. error but typing didnt will not.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
't show much interest for this idea.

I post the text into the script like this .

$discussions = $_POST["discussions"];
$disc1=stripslashes($discussions); //strip /
$disc2 = nl2br ($disc1); //convert CR to BR

and the relevant sql is

UPDATE `Report` SET `Discussions` = '$disc2' and the rest of the fields.

I even changed the above to

UPDATE `Report` SET `Discussions` = '$discussions'
but the syntax error persists.

Mysql Log Single Database Or User
I'm using mysql(4.0.13) on linux. I want to create logs only for one
database or for one user. Is this posible :S


Copyright © 2005-08 www.BigResource.com, All rights reserved