Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SQL Error Code: 1049. Unknown database 'dbo'

I am trying to create a database use mysql workbench and I keep getting this error and my code looks fine. Not sure how I can resolve this. This is the error I am getting: Error Code: 1049. Unknown database ‘dbo’.
I have tried so many things but only the first two lines of creating and using the database works. [screenshot attached]

enter image description here


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;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Seems you are changing from MSSQL to MySQL, for MySQl do not need "dbo", just:

use employeedb;

create table Department(
DeprartmentId int AUTO_INCREMENT,
DepartmentName nvarchar(500),
PRIMARY KEY(DepartmentId)
);
….

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading