educative.io

Educative

Does the following query creates a new database called COMPANY and then uses it? CREATE DATABASE COMPANY USE COMPANY

this MCQ is giving me wrong if I select True, dont know why. But according to me, the below statement is creating a db and then using it.
You can see this picture as it said a semicolon is missed but I have executed the same Query in above given terminal and it executes it without any error

Please correct me if I am wrong

Does the following query creates a new database called COMPANY and then uses it?

CREATE DATABASE COMPANY
USE COMPANY

Course: https://www.educative.io/collection/10370001/5119687241236480
Lesson: https://www.educative.io/collection/page/10370001/5119687241236480/6388567808933888

Hi @ahmed_anwar,

Thank you for reaching out to us. We will be unable to create a new database COMPANY and then use it using the following query because of a syntactical issue.

CREATE DATABASE COMPANY
USE COMPANY

The database requires a semicolon after the end of each statement. You will see the following error on running the provided query.

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘USE COMPANY’ at line 2

Here is the screenshot for reference:

Please feel free to contact us if you still have any questions. Happy learning!