我试图创建一个数据库使用mysql工作台,我不断得到这个错误,我的代码看起来很好。不知道我如何可以解决这个问题。这是我得到的错误:错误代码:1049.未知的数据库'dbo'。我尝试了很多方法,但只有创建和使用数据库的前两行有效。[随附屏幕截图]
use employeedb;
create table dbo.Department(
DeprartmentId int AUTO_INCREMENT,
DepartmentName nvarchar(500),
PRIMARY KEY(DepartmentId)
);
insert into dbo.Department(DepartmentName) values ('IT');
insert into dbo.Department(DepartmentName) values ('Support');
create table dbo.Employee(
EmployeeId int AUTO_INCREMENT,
EmployeeName nvarchar(500),
Department nvarchar(500),
DateOfJoining datetime,
PhotoFileName nvarchar(500),
PRIMARY KEY(EmployeeId)
);
insert into dbo.Employee(EmployeeName,Department,DateOfJoining,PhotoFileName)
values ('John','IT','2022-11-27','anonymous.png');
select * from dbo.Employee;
2条答案
按热度按时间tp5buhyn1#
您似乎使用了SQL Server语法,但这在MySQL上不起作用。以下是针对MySQL更新的脚本:
vdgimpew2#
似乎您正在从MSSQL更改为MySQL,因为MySQl不需要“dbo”,只需:
使用雇员b;
创建表部门(部门ID int AUTO_INCREMENT,部门名称nvarchar(500),主键(部门ID));....