table-structure

MySQL - Best method to handle this hierarchical data?

故事扮演 提交于 2019-11-30 09:57:15
This is a followup to: MySQL - Is it possible to get all sub-items in a hierarchy? I have an arbitrary-depth adjacency list model table (I am at the point that I can convert it into a nested set model . I read the MySQL data on how to use a nested set model, though it seemed to get increasingly complex and very complex to do basic functions such as inserting, updating and deleting. Another blog showing how to use a trigger system with the adjacency list model to keep a table of ancestors that relates each object to its ancestors. Right now I need to be able to return a list of all children of

how to get table structre of a database in java? [closed]

旧城冷巷雨未停 提交于 2019-11-29 07:19:07
how to get table structre of a database in java? Use DatabaseMetaData to get the table information. You can use the getTablexxx() and getColumnxx() methods to get the table information. Connection conn = DriverManager.getConnection(.....); DatabaseMetaData dbmd = conn.getMetaData(); dbmd.getxxxx(); If you just care about being able to recreate the table on a different server, you can use SHOW TABLES to get a list of tables, then SHOW CREATE TABLE foo to get the CREATE TABLE command. You might also look at the mysqldump program to see if it better suits your needs. Joshua One way is to use

MySQL Row Format: Difference between fixed and dynamic?

折月煮酒 提交于 2019-11-27 11:46:22
MySQL specifies the row format of a table as either fixed or dynamic, depending on the column data types. If a table has a variable-length column data type, such as TEXT or VARCHAR, the row format is dynamic; otherwise, it's fixed. My question is, what's the difference between the two row formats? Is one more efficient than the other? Harrison Fisk The difference really only matters for MyISAM, other storage engines do not care about the difference. EDIT : Many users commented that InnoDB does care: link 1 by steampowered , link 2 by Kaan . With MyISAM with fixed width rows, there are a few

MySQL Row Format: Difference between fixed and dynamic?

别说谁变了你拦得住时间么 提交于 2019-11-26 15:44:50
问题 MySQL specifies the row format of a table as either fixed or dynamic, depending on the column data types. If a table has a variable-length column data type, such as TEXT or VARCHAR, the row format is dynamic; otherwise, it's fixed. My question is, what's the difference between the two row formats? Is one more efficient than the other? 回答1: The difference really only matters for MyISAM, other storage engines do not care about the difference. EDIT : Many users commented that InnoDB does care:

PostgreSQL “DESCRIBE TABLE”

心不动则不痛 提交于 2019-11-26 01:48:18
问题 How do you perform the equivalent of Oracle\'s DESCRIBE TABLE in PostgreSQL (using the psql command)? 回答1: Try this (in the psql command-line tool): \d+ tablename See the manual for more info. 回答2: In addition to the PostgreSQL way (\d 'something' or \dt 'table' or \ds 'sequence' and so on) The SQL standard way, as shown here: select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS where table_name = '<name of table>'; It's supported by many db engines. 回答3: If