简体   繁体   English

创建新数据库和表时未显示PhpMyAdmin SQL代码

[英]PhpMyAdmin SQL code not showing up when creating new database and table

I'm using WampServer with phpmyadmin, but have also tried Xamp and same results. 我将WampServer与phpmyadmin一起使用,但也尝试过Xamp和相同的结果。

I have 6 entries in the table called employees: 我在表中有6个条目称为雇员:
I have a table called employee with entries: 我有一个名为employee的表,其中包含条目:

empId, lastName, firstName, department, position, and salary. empId,lastName,firstName,部门,职位和薪水。


empId is primary key w/ auto increment. empId是带有自动增量的主键。 I'm following a tutorial online where they are using a mac computer, I'm on windows, in case that has something to do with the issue. 我正在网上学习教程,他们使用的是Mac电脑,我在Windows上,以防与问题有关。

When I look at the SQL this produces it shows this: 当我查看SQL时,产生的结果如下所示:

SELECT * FROM `employee` WHERE 1


I don't see any CreateTable or other SQL. 我没有看到任何CreateTable或其他SQL。
Can anyone shed some light as to what is going on here? 任何人都可以对这里发生的事情有所了解吗? Thank you. 谢谢。

UPDATE: 更新:
So if I go to > Export to SQL: 因此,如果我转到>导出到SQL:

And this is what I get: 这就是我得到的:

CREATE TABLE IF NOT EXISTS employee (
empId int(11) NOT NULL,
  lastName varchar(40) NOT NULL,
  firstName varchar(20) NOT NULL,
  department int(2) NOT NULL,
  position varchar(20) NOT NULL,
  salary int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


ALTER TABLE employee
 ADD PRIMARY KEY (empI);


Which looks like the correct SQL. 看起来像正确的SQL。
So at least I know it is creating the correct SQL even though its not showing on the phpmyadmin web gui page. 所以至少我知道它正在创建正确的SQL,即使它没有显示在phpmyadmin Web gui页面上。

A CREATE TABLE statement is just a command to create a table. CREATE TABLE语句只是创建表的命令。 You can also create a table using the GUI of PHPMyAdmin, in which case it performs the necessary actions for you. 您还可以使用PHPMyAdmin的GUI创建一个表,在这种情况下,它会为您执行必要的操作。

But those are just commands, blue-prints if you like. 但是,这些只是命令,如果您愿意,可以提供蓝图。 In the database itself the 'Create table' statement doesn't exist. 在数据库本身中,“创建表”语句不存在。 The database contains an actual table which was created using such a statement. 该数据库包含使用此语句创建的实际表。 When you export the database (like you did) or ask for the create table statement, it just reverse-engineers the actual table structure into a statement, like drawing a blue-print based on an actual object you have. 当您导出数据库(如您所做的那样)或要求创建表语句时,它只是将实际的表结构反向工程为一条语句,就像根据您拥有的实际对象绘制蓝图一样。

PHPMyAdmin will often show the statement that it generated to build -for instance- a table, but in some cases you may not see it. PHPMyAdmin通常会显示它生成的语句来构建(例如)一个表,但是在某些情况下,您可能看不到它。 It might be that the guy of the tutorial has a slightly different version of PHPMyAdmin, or he activated a feature that shows the statement. 可能是本教程的人使用了一个稍有不同的PHPMyAdmin版本,或者他激活了一个显示该语句的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM