Transcript for:
Managing Databases: Creation to Deletion

hey everybody in this topic I'm going to show you how we can create alter and drop a database what is a database exactly think of it as a folder it acts as a container tables on the other hand would be the files found within the folder in this topic I'm going to show you how we can create the database itself but we won't be working with any tables until the next topic we'll need to begin by heading to our query window which is this large window right here we're going to write a statement to create a database we will type create there is no case sensitivity in MySQL these keywords such as create they can be all uppercase just the first letter could be capital or you could do all lowercase with the keywords I like to make them all uppercase but that's just me create database and then we'll need a unique database name what about my DB then it's important with all SQL statements to end each statement with a semicolon it's like the period at the end of a sentence that's how we know that the statement is complete so you'll need these three words create database then a database name we just named our database my DB hit this lightning bolt button to execute this statement and in my output window unfortunately I can't increase the font size but I can zoom in this action was successful we have created database my DB if you head to your schemas tab then hit the refresh button you should see a database in here named my DB there's also a database for CIS CIS is the internal database that MySQL uses we'll want to be sure that we're using the database that we just created to use a database we can either right click on the database then click on set as default schema or you could use a statement use then the name of the database my DB semicolon execute the statement we are now using my database to drop a database type drop database then the name of the database and our database is gone uh unfortunately we do need a database for this series so let's go ahead and recreate our database create database my DB refresh then just to be sure we're using this database you can either use that keyword use or you can rightclick on the database and set as default schema all right so we can create use and drop a database how about alter there's two features for beginners I'll mention setting a database to read only the other is enabling encryption let's set our database to be readon type alter database the name of the database read only equals 1 this statement would make our database readon if a database is in readon mode we can't make any modifications to it but we can still access the data within let's attempt to drop our database drop database my DB uh then we have a red X right here that means we could not complete this action drop database my DB schema my DB is in read only mode to disable readon mode you would set read only equal to zero now we would be able to drop this database if all right everybody that is how to create use drop and alter a database think of a database as just a folder a folder can hold files the files will be the tables that we'll create which will store within the database and in the next topic I'll show you how we can create some tables