 In the next few videos I want to introduce you to JuliaDB, the database structure inside of Julia. You might have been using DataFrames before, but you have an alternative here in JuliaDB. Here we have the website, it is JuliaDB.org, and you can read a little bit about this new data structure inside of Julia. As it says here on the website, batteries included, you can really import CSV files, create your own data, work with that data, very easily join databases, many of the things that you would really expect of a database structure. So I've created a new Julia notebook here, it's a Jupyter notebook, and you see I'm using Julia 0.6.2, I'm going to click on title, let's call this JuliaDB, and rename, and it is now saved. Using that I am saving this notebook in the very same folder as which I have my CSV files, and in later videos we're going to get to that. First of all, let's change this first cell into this markdown, it's very easy to do escape, enter, or return, and now suddenly it's a markdown cell. I'm going to use markdown one hashtag or pound sign for H1 HTML type heading, and let's just type JuliaDB, and I'm going to hold down shift and enter, shift return depending on whether you're on a PC or Linux machine or on a Mac. Now let's import some packages that we are going to use in this video series, I'm going to say using, and of course the first one is JuliaDB. Now I'm trusting the fact that the three packages that I'm going to use that you have installed them with a PKG.AD inside of, just a REPL inside of Julia, so I'm assuming that you have added these packages. So it's JuliaDB distributions, and the last one we're going to use is online stats. So if you haven't added these, please go into your REPL and do PKG.AD, don't do it inside of a notebook, I'm going to hold down shift and enter or shift and return, and there we go, all three of my packages have been imported, ready to go. Now the first function inside of JuliaDB that I want to show you is the table function, we can create tables as you would expect in a normal database. I'm going to hit escape, enter or return again, now it is a markdown cell, let's do a size two heading, and I'm just going to say the table, and I'm going to just put this little, it's on the top left hand side of my keyboard, a little apostrophe there, and I'm going to say that table, open and close parentheses, hit that little apostrophe again, the table function, and when I hit shift, enter, shift, return, you can see by doing that inside of your markdown, it looks like code that you've actually written. So if you do these markdown cells, you can make it appear like code if you use those little marks. So the table function, there's a few ways in which you can create a table, I'm just going to do it manually before eventually we just import a CSV file. So let's make some computer variables to hold the list objects, I'm going to call my first one ID, and I'm just going to use the collect function, collect function, close parentheses, and what I want to do is collect values one through ten. So that's just going to be one, two, three, four, five, six, seven, eight, nine, ten in a list. Semicolon to suppress the output to the screen, and I'm going to do an age, and let's just round these off, and the way to do that, I'm going to use the round function, and do I really need to because I'm going to use integers. So I've got to put the dot, that means every single element in a list that function is applied to each of them. Let's make them integers, eight, eight bit integers at least, and I want a random set of normal values, and I'm going to do 50 comma 20, so that's a normal distribution with a mean of 50, a standard deviation of 20, I want that taken at random from a normal distribution, and I want ten, ten of those please. Again I'll hit the semicolon to suppress output to the screen. So what have I done here with this round dot function? So the random normal 50 comma 20, the mean of 50, and the standard deviation of 20, that's going to give me a set of real values, ten of them as I specified here. But I want to round them, those off to eight bit integers, and I'm going to specify the integer eight here as my type, and the round dot as I said, the dot notation means I'm going to round them off each one of the elements. So I've got to put that dot there, shift enter, shift return, and I've got my two, I have my two lists there. Let's just make sure perhaps what their length are, just to show you that indeed they are, you know they are ten of them, so let's look at id, the length of id, let's look at the length of age, my age variable there, and I see ten and ten, ten and each. Let me just show you what the type, the data type of these are. So I'm going to say type, type of, and we're going to look at id, and comma, let's do type of age, let's have a look at that. We see as we expect with the collect function, it's a 64 bit integers in an array, one dimensional, and an array of eight bit integers for the age variable. Now here comes the magic, I'm going to create a table, let's call our table table underscore one, so our first table, and I'm going to use the table function. Table function, open, close parentheses. Now the first method of doing this is just to list, just to create arguments. So this is just arguments of all these lists that I want to add to my table. So I'm going to do id and age, and then I'm going to use the names keyword. The names keyword argument and names, and that goes inside of square brackets, and we're going to use symbol notation, and that will give us column names, column headers. So I'm going to use symbol notation, which means this colon id, comma, and colon age, let's do that age, and there we go. We've created table one, and look at this, it says a table with ten rows and two columns. I have as age, the ten integers I have there, and the id, at least in the age, the ten random integers that I have. And we've created these column headers called id and age. Those are the names that I passed with the names keyword argument here. And we'll just see these list of arguments to start off with those which just be these random lists that I'm importing, or at least those random values that I'm importing. So that would be one way to create an easy way to create a table. Now let's just extract one of the rows, and the indexing works exactly as you would expect in Julia. Julia db was created with Julia, so there's going to be nothing different there. So let's say we take subject number three. I'm going to call that subject underscore three. And with that, we're just going to use table one, table one. We've spelled table in a very weird way there. Let's correct that, that looks just a bit awkward. Let's do that, table one, going to recreate table one, there we go. So that when we have table one here, at least doesn't look too bad. Table one, and we are just going to use the square brackets for indexing, and now I have subject three, and we can see the subject three had two variables ID and age, and the ID was three, and the age was 39 in my instance, at least. This means I can extract some information. So I could say subject three dot, and with a dot notation, I can refer to one of the column headers. So just look at the age, so subject three dot age, and it'll give me back 39. So imagine I had multiple, multiple columns. It's easy to get back the value of any one specific subject in that table, or row at least in that table. As far as indexing is concerned, I can be easily just say table one, let's do three, two, five. And remember, those are going to be the rows. So I see row three, four, and five inclusive of three and five. So what if we don't want three to five, but we just want three specific rows back? So let's do table one, table underscore one, and a list of the rows that I want back. So I've got to use another set of square brackets, and I want rows three, five, and eight, and now I see I'm going to see ID three, five, and eight there, because that was row three, five, and eight. I'm just going to copy and paste from my second screen here, table two that I've created, let's have a look at that. Table two, and table two was generated slightly differently in a number of ways. So instead of creating the lists first, I'm just creating them one after the other as arguments separated by comma. So collect one to ten again, so there'll be one, two, three, four, five, ten. The second is a list of characters here, which is the Roman numerals, strings then if you want inside of quotation marks, so you see them there. Then I'm going to take again, I'm going to take ten random variables from a normal distribution with a mean of 16 standard deviation of four. And I'm doing round dot again because I want to round each of these. And this time I'm specifying that I wanted to have one decimal place. Second set of normal distribution data point values with a mean of 12 and a standard deviation of three. And for my names argument here, I'm going to list the column headers in symbol notation as ID, group, HB, and WCC. And this time I'm introducing something new, a primary key. And I'm just identifying a single primary key because remember I can create tables. And if I have normalization, there could be another key with another table with another set of variables, but with the same ID. So later on when we join these, we can join them or do searches according to the primary key across multiple tables. And that's what we want. So there we go, we have table two here. We see the ID one through ten. We see Roman numerals there for group, HP. We see, note that there's just one decimal place and one decimal place. So we see columns three and four, there's HP and WCC. So that's a nice table. Let me show you another way just to create a table. So the first and the second was basically the same, but instead of just importing already created list, I can create the list inside of that, but the second example at least showed you how to specify one of the columns as a primary key and you can specify more than one. So here we have, let's create table three and again a table. And I'm going to use the columns function. The columns function in this instance. And with the columns function, I'm just going to use the names of the columns. And that is not symbol notation. So I'm going to say ID equals the ID list that we created before. Let's create the second one called CRP. And the CRP, I'm going to do the round function again. So I've got to do the dot notation because I wanted to be rounded. Each one of these I wanted rounded. And I'm going to round to 16 bit integers, 16 bit integers. And I want random values from a normal distribution, from a normal distribution with a mean of 100 and a standard deviation of 20, and I want 10 of these. I'm going to move along because I also want to specify a primary key. And this time I have to use the ID symbol. And there we go, a new table. And this time I've used the columns function as one of the arguments for the table function. And when I do these, I use the name of the column not in symbol notation. Just purely the names that you want the column to be specified and then equal to the list that you want it to be outside of the columns function. That's where the closing parentheses are. Outside of that, I'd specify a primary key. So in short, that's some ways to create tables inside of JuliaDB. In the next video, we're going to start looking at proper ways of selecting some of the rows inside of our table.