![]() ![]() #Psequel query update#This ‘where’ keyword is especially important when we want to update or delete items from the database. But what if you only wanted to see players from the Golden State Warriors? Next, run the following lines: Head back into query and run the following line:įrom here, you can see everyone. Selecting Your All Starsįrom the image provided, now we can select and manipulate the players. #Psequel query how to#It’s also important that strings (or varchars) are put into quotes.Įasy enough? Alright, let’s add some more data and see how to manipulate it. You can put the columns in whatever order you want here, as long as it corresponds to the second parenthesis group.įor example, PSequel would not allow it if I tried to put an integer into the first name field. The first set of parenthesis, while not mandatory, tells the database which columns the data will go into. Here, I am inserting records into my ‘players’ table. INSERT INTO players (id, first_name, last_name, team) VALUES (1, 'Steph', 'Curry', 'GSW') With your brand new empty table, head back over to query and insert the following: The table, although empty, can now be found in the ‘content’ tab. Once this is done, run the query and refresh the page (bottom left). So the team listed will only be able to hold three characters. For more on what kind of datatypes you can use in PostgreSQL, check out this nifty list. The number following this in parenthesis is the maximum number of characters. Varchar stands for a ‘variable-length character’ string. You’ll notice there is a datatype listed after these, which lets the database know what kind of data to expect. With ‘query’ selected, we can create a table like this:įrom above, we can see that I am creating a table called ‘players.’ Inside this table, there will be four rows: an ID (mostly to keep track of how many people I am adding), a first name, a last name, and a team. #Psequel query free#Once you’ve connected, you’re free to create tables that will organize all of your data. ![]() Now let’s connect and create some tables. PSequel is a GUI that makes viewing your data a little easier. To quit from the command line, you can use \q. Once it’s created, you could see a list of all of your databases with the \l command. Now that you’re logged in, creating a database is as easy as: ![]() First things first, make sure you’re server is running on the command line by running: While there are other good ones such as MySQL and SQLite, I have found PostgreSQL to be most favorable since it’s open-sourced and has a pretty great online community.Ī little database dancing to start things off Create a DatabaseĬreating a database is simple. PostgreSQL is one of the top programs for relational databases. And what better way to prepare for the upcoming basketball season than to prepare some databases based on player attributes. Russell Westbrook might as well be a statistician with his triple-double prowess. ![]() Basketball, like many sports, is filled with data that makes it more interesting.Ī stat line is essential a chunk of data. And stats are data!Īs for what you’re about to read, I’d strongly recommend following along with PSequel, a GUI on Mac that allows you to see the data you are working with. For more on the differences between the two main types of databases, here is a primer that may be of assistance. It’s often considered large and complicated, but they can work wonders for keeping your application neat and in order. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |