Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MySQL Programming Interview Question:
How To See the CREATE TABLE Statement of an Existing Table?
Submitted by: AdministratorIf you want to know how an existing table was created, you can use the "SHOW CREATE TABLE" command to get a copy of the "CREATE TABLE" statement back on an existing table. The following tutorial script shows you a good example:
mysql> SHOW CREATE TABLE tip;
<pre>+-------+-------------------------------
| Table | Create Table
+-------+-------------------------------
| tip | CREATE TABLE `tip` (
`id` int(11) NOT NULL,
`subject` varchar(80) NOT NULL,
`description` varchar(256) NOT NULL,
`create_date` date default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+-------------------------------</pre>
1 row in set (0.38 sec)
Comparing with the original "CREATE TABLE" statement used in the previous tutorial, the output tells you that:
► INTEGER data type was replaced by "int(11)".
► Default database engine "MyISAM" was used for the table.
► Default character set "latin1" was used for the table.
Submitted by: Administrator
mysql> SHOW CREATE TABLE tip;
<pre>+-------+-------------------------------
| Table | Create Table
+-------+-------------------------------
| tip | CREATE TABLE `tip` (
`id` int(11) NOT NULL,
`subject` varchar(80) NOT NULL,
`description` varchar(256) NOT NULL,
`create_date` date default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+-------------------------------</pre>
1 row in set (0.38 sec)
Comparing with the original "CREATE TABLE" statement used in the previous tutorial, the output tells you that:
► INTEGER data type was replaced by "int(11)".
► Default database engine "MyISAM" was used for the table.
► Default character set "latin1" was used for the table.
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.