Posts Tagged ‘Table’
Tuesday, September 30th, 2008
Databases are most useful when it comes to storing information that fits into logical categories. For example, say that you wanted to store information of all the employees in a company. With a database you can group different parts of your business into separate tables to help store your information logically. Example tables might be: Employees, Supervisors, and Customers. Each table would then contain columns specific to these three areas. To help store information related to each employee, the Employees table might have the following columns: Hire, Date, Position, Age, and Salary.
Tags: areas, contain, Employees, hosting, Table, Web
Posted in MySQL | No Comments »
Thursday, July 24th, 2008
Often you have a table in which only a few columns are accessed frequently. On a blog, for example, one might display entry titles in many places (e.g., a list of recent posts) but only ever display teasers or the full post bodies once on a given page. Horizontal vertical partitioning helps:
CREATE TABLE posts (
id int UNSIGNED NOT NULL AUTO_INCREMENT,
author_id int UNSIGNED NOT NULL,
title varchar(128),
created timestamp NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE posts_data (
post_id int UNSIGNED NOT NULL,
teaser text,
body text,
PRIMARY KEY(post_id)
);
The above represents a situation where one is optimizing for reading. Frequently accessed data is kept in one table while infrequently accessed data is kept in another. Since the data is now partitioned the infrequently access data takes up less memory. You can also optimize for writing: frequently changed data can be kept in one table, while infrequently changed data can be kept in another. This allows more efficient caching since MySQL no longer needs to expire the cache for data which probably hasn’t changed.
Tags: accessed, blog, changed, Create, Data, Frequently, infrequently, MySQL, needs, Optimizing, Partition, probably, reading, Table, Tables, your
Posted in MySQL, tricks | No Comments »
Thursday, July 24th, 2008
his command defragments a table after you have deleted a lot of rows from it.
Tags: defragments, deleted, MySQL, optimize, Run, Table
Posted in MySQL, tricks | No Comments »
Thursday, July 24th, 2008
Use multiple-row INSERT statements to store many rows with one SQL statement.
The explain command can tell you which indexes are used with the specified query and many other pieces of useful information that can help you choose a better index or query.
Example of usage: explain select * from table
explanation of row output:
* table—The name of the table.
* type—The join type, of which there are several.
* possible_keys—This column indicates which indexes MySQL could use to find the rows in this table. If the result is NULL, no indexes would help with this query. You should then take a look at your table structure and see whether there are any indexes that you could create that would increase the performance of this query.
* key—The key actually used in this query, or NULL if no index was used.
* key_len—The length of the key used, if any.
* ref—Any columns used with the key to retrieve a result.
* rows—The number of rows MySQL must examine to execute the query.
* extra—Additional information regarding how MySQL will execute the query. There are several options, such as Using index (an index was used) and Where (a WHERE clause was used).
Tags: Any columns, clause, command, explain, key, MySQL, possible_keys, rows, SQL, statement, Table, type, where
Posted in MySQL, tricks | No Comments »
Saturday, June 28th, 2008
dbConnect()
$alltables = mysql_query(”SHOW TABLES”);
while ($table = mysql_fetch_assoc($alltables))
{
foreach ($table as $db => $tablename)
{
C(”OPTIMIZE TABLE ‘”.$tablename.”‘”)
or die(mysql_error());
}
}
Tags: database, die, easy, foreach, mysql_error, mysql_fetch_assoc, mysql_query, optimize, Table, Way
Posted in PHP | No Comments »
Wednesday, June 18th, 2008
To create a table in Ms Word you can use this shortcut !
>> Just type : +======+=====+====+===+==+=+
>> And simply hit ‘Enter’ !
>> You will see that the text changes to a table. Here, the number ‘=’ represent the number of characters in each cell !
>> Just it makes your work easy and fast !
Tags: Create, easy and fast, hit, number of characters, Table, text changes, Trick, type, Word
Posted in tricks | No Comments »