On Thu, Nov 20, 2008 at 4:10 PM, listgroups08 wrote: > ----- Original Message ----- > From: "HELLBOY" > > > Hello all, > > I want to know how to get information about field types. I am using > MyISAM. > > > > I can see some MySQL instructions that can do this for one field at a > time > > but I want to get the > > stats for a whole table at once. > > > > For example - > > > > How do I get information on each field of a table as to weather or not > that > > field can be null? > > > > And how do I get each data type for each of the fields in a table? > > > > I need the 'NOT NULL' / 'NULL' to force the administrator to allow access > > to this field for users > > who are permitted to add data items. > > > > I also need the data type so that I can associate validation REGEX with a > > field type as the data > > base is too broad to script individual field validations in php. > > > > Any pointers for REGEX for various MySQL data types would be greatly > > appreciated as I have no real > > experience with REGEX. > > > > Thanks all, Robert. > > > > > > > -------------------------------------- > Hi, > I think I have an answer. > query for ur question is - 'DESCRIBE *tablename'*; > just execute this query, It will return a resultset of field details for > given table in the format-- > *Field | Type | Null | Key | Default | Extra* > It means u will have required information in resultset. > > REgards, > Rider. > ------------------------------------- > Hello HELLBOY, > > Thank you, absolutely perfect! > > Just one other thing would be helpful. > > Can anyone give me a link to information that describes the information > returned in the fields 'KEY' > and 'EXTRA'? > > Thanks all, Robert. ---------------------------------------- hi, Just check out following queries in ur query browser.
CREATE TABLE `candidate` ( `field1` int(11) NOT NULL auto_increment, `field2` int(11) NOT NULL default '0', `field3` varchar(10) collate utf8_unicode_ci NOT NULL default '', `field4` varchar(64) collate utf8_unicode_ci NOT NULL default '', `field5` varchar(64) collate utf8_unicode_ci NOT NULL default '', `date_created` datetime NOT NULL default '0000-00-00 00:00:00', `created_from_country` smallint(6) NOT NULL default '-1', `date_modified` datetime NOT NULL default '0000-00-00 00:00:00', `modified_from_country` smallint(6) NOT NULL default '-1', `notice_period` smallint(5) unsigned NOT NULL default '0', PRIMARY KEY (`field1`), KEY `IDX_field2` (`field2`), KEY `IDX_field3` (`field3`), KEY `IDX_field4` (`field4`) ) ENGINE=MyISAM; describe candidate; Field indicates the column name, Type is the data type for the column, NULLindicates whether the column can contain NULL values, Key indicates whether the column is indexed, and Defaultspecifies the column's default value. Extra displays special information about columns; for example, if a column was created with the AUTO_INCREMENT option. REgards, Rider.