Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Creating Databases

Here's some questions, you'll have to forgive me if what I'm asking sounds obvious.

I've followed a lot of courses in the last year with databases that have been prepared behind the scenes by the teacher. Which makes sense as the courses are about how to manage data based projects but not create them.

How does one actually go about creating one though? And what is the difference between a .db file and a .sql file?

Obviously you need to know mySQL or SQLite but when I study the files in projects, I find the data is scrambled and I can't read the files properly. Why is this? Should I be concerned or put off by it? Thanks :)

3 Answers

jason chan
jason chan
31,009 Points

The database is it's own server. It's actually invisible. You would have to type commands to see it. Xampp a lamp stack php mysql stack has built phpmyadmin which is visual software of database.

you could try playing with this one

https://www.apachefriends.org/index.html

It's the easiest to install. For the mysql by oracle i would recommend installing one on mac.

You can also create one with ubuntu but that's dev ops and little more set up. You can also spin a free one with heroku.

it's called jaws https://elements.heroku.com/addons/jawsdb

https://www.mysql.com/products/workbench/ you can connect to the database with this client the jaws db. Well goodluck.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Thanks Jason,

I use Xampp on Windows for my local server development needs so I'll probably start looking from there :-) So I can create databases directly from there?

Christof Baumgartner
Christof Baumgartner
20,864 Points

Regarding your question regarding the difference between .sql and .db:

.sql is basically just a normal txt-file but it indicates, that a sql-statement is saved there. Many clients and workbenches support and use this format to import and export queries (The content would look smth like "SELECT * FROM test;"). You can open it with many different programs including normal text-editors.

.db is not so simple. It is used by different database engines to store actual data (not just a query). But in most cases, these .db-files are not interchangeable between different database type, so would need the original program to open it.

jason chan
jason chan
31,009 Points

Yup. You can use it practice and persist your data.