# SQL about database

**URL:** <https://forum.codewithmosh.com/t/sql-about-database/13268>\
**Category:** SQL\
**Created:** [June 24, 2022, 7:42am UTC](https://forum.codewithmosh.com/t/sql-about-database/13268 "2022-06-24T07:42:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lana](https://avatars.discourse-cdn.com/v4/letter/l/d2c977/32.png) [@Lana](https://forum.codewithmosh.com/u/Lana)\
**Post date:** [June 24, 2022, 7:42am UTC](https://forum.codewithmosh.com/t/sql-about-database/13268/1 "2022-06-24T07:42:37Z")

</div>

The database is orders , why can not just put orders in database here but it did work in Mosh’s class ? What is the difference ?

 ![下载](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/8/87f540591076b964f725a2b28f0619597960a5c6.jpeg)

---

<div class="post-metadata">

**Author:** ![keelo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/keelo/32/4592_2.png) [@keelo](https://forum.codewithmosh.com/u/keelo)\
**Post date:** [June 24, 2022, 8:07am UTC](https://forum.codewithmosh.com/t/sql-about-database/13268/2 "2022-06-24T08:07:20Z")

</div>

orders is the table  
you need to sepcify the database…sql\_store ??

You can try

USE sql\_store;  
SELECT \*  
FROM orders

or prefix the table name

SELECT \*  
FROM sql\_store.orders

---

<div class="post-metadata">

**Author:** ![Lana](https://avatars.discourse-cdn.com/v4/letter/l/d2c977/32.png) [@Lana](https://forum.codewithmosh.com/u/Lana)\
**Post date:** [June 24, 2022, 8:16am UTC](https://forum.codewithmosh.com/t/sql-about-database/13268/4 "2022-06-24T08:16:53Z")

</div>

Thanks a lot ! I prefix the table name " sql\_store.orders" and it works ！ I wonder why “FROM orders” does not work in my side but I watched Mosh’s tutorial he uses “FROM orders”

---

<div class="post-metadata">

**Author:** ![keelo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/keelo/32/4592_2.png) [@keelo](https://forum.codewithmosh.com/u/keelo)\
**Post date:** [June 24, 2022, 9:30am UTC](https://forum.codewithmosh.com/t/sql-about-database/13268/5 "2022-06-24T09:30:26Z")

</div>

Not too sure as I am a beginner  
but i think if you select the sql\_store database in mysql workbench  
you can run the query without the prefix

---

<div class="post-metadata">

**Author:** ![UniqueNospaceShort](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/uniquenospaceshort/32/1814_2.png) [@UniqueNospaceShort](https://forum.codewithmosh.com/u/UniqueNospaceShort)\
**Post date:** [June 24, 2022, 11:29am UTC](https://forum.codewithmosh.com/t/sql-about-database/13268/6 "2022-06-24T11:29:28Z")

</div>

I actually [answered a similar question](https://forum.codewithmosh.com/t/question-about-mysql-join-on/13266) earlier this morning.  
Both of you got the same message and it is fairly clear about why it happens.

The only missing part is how is simply that you need to specify with what table you’re working on.

`USE myDatabase;` where `myDatabase` is of course your database name.

Now @keelo also answered there and I notice you put a `sql_` prefix in front of the database name. I did not use MySQL for over a decade but AFAIK the raw name is enough. Is there any new rule / feature / convention related to referring databases in MySQL ?

Could you please tell me what would `SHOW DATABASES;` output as name to your orders DB?

---

<div class="post-metadata">

**Author:** ![keelo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/keelo/32/4592_2.png) [@keelo](https://forum.codewithmosh.com/u/keelo)\
**Post date:** [June 24, 2022, 11:57am UTC](https://forum.codewithmosh.com/t/sql-about-database/13268/7 "2022-06-24T11:57:59Z")

</div>

I presume sql\_store is the raw name for the database  
If its the same database from Mosh’s MYSQL course the  
SHOW DATABASES; output shows

‘information\_schema’  
‘mysql’  
‘performance\_schema’  
‘sql\_hr’  
‘sql\_inventory’  
‘sql\_invoicing’  
‘sql\_store’  
‘sys’

orders is a table on the the sql\_store database

---

<div class="post-metadata">

**Author:** ![UniqueNospaceShort](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/uniquenospaceshort/32/1814_2.png) [@UniqueNospaceShort](https://forum.codewithmosh.com/u/UniqueNospaceShort)\
**Post date:** [June 24, 2022, 12:11pm UTC](https://forum.codewithmosh.com/t/sql-about-database/13268/8 "2022-06-24T12:11:38Z")

</div>

Thanks.  
This is probably just a convention used by Mosh but I’ll take a look if this is not a thing. I always named my DB simply. Sometimes you use such prefix to specify the facet in the model especially when you have a lot of table. But then it is not specifically `sql_` but `acc_` for accounting, `fin_` for finance, you name it.
