What are the maximum columns in an Access 2003 query? - ms-access

What are the maximum allowed number of columns in a query in access 2003?

255 I believe. You can check by going to Help > Specifications > Query within Access.

As a general rule, if you ever find yourself asking a question about the maximum hardcoded limit of a technology, it's time to step back and verify that you're taking the right approach. Perhaps a query against access that's pulling in hundreds or thousands of columns isn't the right approach.

From Access Help File
Thank you Ben
Number of enforced relationships: 32 per table minus the number of indexes that are on the table for fields or combinations of fields that are not involved in relationships
Number of tables in a query: 32
Number of fields in a recordset: 255
Recordset size: 1 gigabyte
Sort limit: 255 characters in one or more fields
Number of levels of nested queries: 50
Number of characters in a cell in the query design grid: 1,024
Number of characters for a parameter in a parameter query: 255
Number of ANDs in a WHERE or HAVING clause: 99
Number of characters in an SQL statement: approximately 64,000

Maximum numnber of column that you can add in ms access query is 255 but Let me tell me one thing :
In access you can make query in two ways
Create query in design view
Create query by using wizard.
For the first option you will have only a max of 16 columns to add in a query
but using the second option you can add upto 255 columns in your query.
:)

Related

Database table size and mysql query execution time

I have a database table which has about 500000 rows. When I use mysql select query the execution time is quite long, about 0.4 seconds. Same query from a smaller table takes about 0.0004 seconds.
Is there any solutions to make this query faster?
Most important thing: Use an index, suitable for your where-clause.
0.1) Use an index, that covers not only the where clause, but also all selected columns. This way the result can be returned by only using the index and not loading the data from the actual rows indentifed by the index.
If that is not enough you can even use an index that contains all rows that need to be returned by your query. So the query can look up everything from the index and does not have to load the actual rows.
Reduce the number of returned columns to the columns you really need. Don't select all columns if you are not using every one of them.
Use data types appropriate to the stored data, and choose the smalles data types possible. E.g. when you have to store a number that will never exceed 100 you can use a TINYINT that only consumes 1 byte instead of a BIGINT that will use 8 byte in every row (integer types).

MySQL table with 85 columns - Is multiple tables with joins better?

I am working on finalising a site that will go live soon. It will process up to 1 million files per week and store all the information from these files in multiple tables in a database.
The main table will have 10 records per file so will gain about 10million records per week. Currently that table has 85 columns storing about 1.6KiB of data per row.
I'm obviously worried about having 85 columns, it seems crazy but I'm more worried about the joins if I split the data into multiple tables... If I end up with 4 tables of 20 odd columns and over 500,000,000 records in each of them them, won't those joins take massive amounts of time?
The joins would all take place on 1 column (traceid) which will be present in all tables and indexed.
The hardware this will run on is an i7 6700, 32GB RAM. The table type is innodb.
Any advice would be greatly appreciated!
Thanks!
The answer to this depends on the structure of your data. 85 columns is a lot. It will be inconvenient to add an 86th column. Your queries will be verbose. SELECT *, when you use it for troubleshooting, will splat a lot of stuff across your screen and you'll have trouble interpreting it. (Don't ask how I know this. :-)
If every item of data you process has exactly one instance of all 85 values, and they're all standalone values, then you've designed your table appropriately.
If most rows have a subset of your 85 values, then you should figure out the subsets and create a table for each one.
For example, if you're describing apartments and your columns have meanings like these:
livingroom yes/no
livingroom_sq_m decimal (7,1)
diningroom yes/no
diningroom_sq_m decimal (7,1)
You may want an apartments table and a separate rooms table with columns like this.
room_id pk
apt_id fk
room_name text
room_sq_m decimal (7,1)
In another example, if some of your columns are
cost_this_week
cost_week_1
cost_week_2
cost_week_3
etc.
you should consider normalizing that information in to a separate table.

Same MySQL database import showing different numbers of records

Same database imported 3 three times after empty the entire database and surprisingly every time it shows different number of records. Why?
1st time import:
2nd time import:
3rd time import:
It is not right to trust on Rows count as shown in picture it show approxmiate value as error suggested. So the question is how can we ensure that database is right and no record missing? note: short-cut require can't use count with each table it will lots of time.
MySQL is, surprisingly, really bad at numbers. For InnoDB tables those are often estimates of how many rows it contains and they can be wildly wrong.
The way it computes the numbers you're seeing is by taking the total size of the table data and dividing by the average row size in bytes. This is usually a good enough approximation of your data, but it can be very misleading, off by a factor of up to 100.
The only way to know for sure is to do COUNT(*), something that can take some time to compute on a very active table.
Tools like phpmyadmin/adminer always picks the row count from INFORMATION_SCHEMA. In case of InnoDb storage engine the row count is a rough estimate, it is never the exact value. The table_rows which phpmyadmin picks which is never accurate for Innodb
SELECT SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'table_name';
For exact value we need
SELECT count(*) FROM 'table_name';
For reference: http://dev.mysql.com/doc/refman/5.7/en/tables-table.html
You'll notice that all of the "negative mysql records" This isn't a negative sign its ~, which means approximately.
if you want actual count use
SELECT count(*) FROM 'table_name';
I wouldn't rely on comparison of numbers with a tilde (~) as prefix.~ means approximation.
Based on bencoder response to this
phpMyAdmin - What a tilde (~) means in rows column?
the approximation can vary a lot.
To check the real number of rows imported use:
select count(*) from TABLE_NAME
The number you are seeing is approximation. To get the actual number JUST CLICK ON THE NUMBER. You will see the actual number. You do not need to run any query to view actual row number.

How many rows can MySQL store?

So I am a beginner and have just learned MySQL by myself for a few months. I always use phpMyAdmin in my work. My past work only involved tables with about 100k rows so there is no major issue.
However my client now wants to store about 8 million rows in a table. Is it too much for MySQL/phpMyAdmin to store and handle?
Thanks very much.
Just Google it:
In InnoDB, with a limit on table size of 64 terabytes and a MySQL row-size limit of 65,535 there can be 1,073,741,824 rows. That would be minimum number of records utilizing maximum row-size limit. However, more records can be added if the row size is smaller
This is what it says.
So as the answer there can be 1,073,741,824 rows.
We don't know how big or small of your record. Short records can few integer fields or our records might be really big with hundreds of text or varchar fields. So measure of file size is the best way . This Officilal Information may help you

Change number of decimal digits in all tables in MySQL

I'm not much experienced in SQL and I need to modify my tables as follows but cannot work out how to do so.
I have a MySQL database with multiple tables where some of the columns have type e.g. DECIMAL(17, 2) and I need to change the type to have at least 4 decimal places as effectively as possible.
Can someone help me with this please?
Thank you in advance.
You can only do it via the ALTER that #Barranka suggests. However, there are two enhancements:
MODIFY all the COLUMNs in a single table in a single ALTER; this will run faster.
You could write a Stored Procedure to read information_schema.COLUMNS to discover which tables have DECIMAL(xx,2) and create the ALTERs for you.
But, why do you want 4 decimal places? If you are that loosy-goosy about the precision of the numbers, perhaps FLOAT or DOUBLE would suffice?
You can change the column definitions with ALTER TABLE. Example:
alter table your_table
modify column a_number decimal(19,4);
In this example, I'm enhancing the column a_number so it holds now a number of length 19 with 4 decimal places. You need to increase the length of the column, not just the decimal places, because if you have numbers with 17 digits (including 2 decimals), you may loose some values if you don't increase the length.
Check the reference manual for ALTER TABLE.