Skip to main content

MySQL

MySQL


INTRODUCTION
today we are living in the 20th century and every day tons of data are generated. for storing these tons of data new and advanced computers are introduced like cloud computing etc. these generations of data are genuine because every day in banks new transactions are processed, there are a huge variety of online stores which keeps tracking of there users for example name, address email etc, the schools and colleges keep all confidential information of the student from the beginning till now and there are many organisation which are generating huge data.

So, consider if someone(named boss) tells you to handle all this and present this in a well-defined manner then what will you do. (one question arises here, why someone wants to handle and present it in a well-defined data? The answer is that the boss wants to do some predictions that in the next three or four years where the position of the company, the company will be in the profit or in loss )so, today I will teach you to how to handle and sort these data one place without any problem.

Today I am going to talk about the best software which will come in use for handling data. the name of the software is MySQL.it is developed by Oracle Corporation, the stable release is 8.0.16  we are going to use version 8.0.in MySQL, there are many inbuilt packages which help to handle data like








 how to install MySQL?


  1. Download the software from the MySQL website .link is given you can directly approach to it.https://dev.mysql.com/downloads/mysql/. download and install the software, I hope you can do it.scroll the page down, you will see this kind of interface.

  1. while installing it will take permission, which packages you want to install. I prescribe install all the applications.it takes some time because the applications are downloaded and executed.it's interface is like this.

how to run MySQL?

  • go to start, and open MySQL command line prompt.its interface is like this. 
  • for creating Database type CREATE DATABASE XYZ;  create database is a command for SQL which instruct SQL to build a database whose name is XYZ.remember to use a semicolon(;).
  • for creating tables type CREATE TABLE COMPANY; create a table is the code given to construct a table whose name is a company.
  • for deleting a database DROP DATABASE XYZ; 
  • for deleting a table DROP TABLE COMPANY;
  • for listing all databases SHOW DATABASES;
  • for listing all tables in a database SHOW TABLES XYZ; show tables is a command used to list all the tables of the database named XYZ.
  • for selecting the particular database from the list of database type USE NAME_OF_DB;
  • for seeing the database's field formats type  DESCRIBE NAME_OF_DB; this command is used to describe the table's format that how many characters or an integer variable is used.
  • Shows all data in table type SELECT * FROM TABLE_NAME;
  • to build a table (example-1) 
CREATE TABLE COMPANY(
employee_name VARCHAR(20),
employee_id INT PRIMARY KEY,
address int,
branch (20) VARCHAR) FOREIGN KEY;

CREATE TABLE whose name is COMPANY, in this, we have used four attributes employee_name,employee_id, address and branch of the employee.infront of every attribute datatype have been declared, in character type data in SQL we have to declare a total number of length while in integer type this is not important. for example in front of employee_name since it is a character so it is declared(VARCHAR means variable character whose values can differ in different situation.)that the employee name must contain only 20 letters,it will not accept that name whose length of name exceeds 20,for acceptance you have to increase the total number of length  which will be declared in front of the attributes.

like this, you can create as many tables as per your requirement.

PRIMARY KEY => is the command which declares that the attribute will not take a duplicate entry, and we can easily point out or can easily pick the information of a particular individual by their employee_id.
FOREIGN KEY => is the command which declares that this attribute has some relation from another table(imagine you created a database for your company which has many tables like a table of total employee_information, table of branch, table of client etc and suppose there is an employee who has some relation in table of client and in table of employee information.so for solving this problem we use a command FOREIGN KEY .  )
  • to insert the values type 
INSERT INTO COMPANY VALUES( VALUES OF THE ATTRIBUTES );

  • insert (example-1)
INSERT INTO COMPANY VALUES ("Varun",1,"Ranchi","scraping");

remember to use semicolon at the end of the code. always write the values in proper alignment for example if we interchange the values from Ranchi to 1, it will not except. because while making the table we have declared that the third position is character and second position is an integer, so in character position, it will never except integer and vice versa.

  •  To delete a column ALTER TABLE [table_name]DROP COLUMN [column_name];
  •  To add a new column to db 
[table_name] ADD COLUMMN [new_column_name] VARCHAR (20);
  • To delete any element of a table
DELETE FROM table_name
WHERE condition = (as per your want);
  • Change column name 
ALTER TABLE  [table_name] CHANGE NAME [old_column_name] [new_column _name]VARCHAR(40)
to see the all contents ,type SELECT * FROM TABLE_NAME;
to see more quries go to github link .https://github.com/rajroshansharma/MySQL_sample/blob/master/sample.txt


So, this was the basis of MySQL in brief, which will help you to get started with MySQL .hope you liked this, please comment, like and share this to your friends.if you have any dought than please comment.i will make blogs on projects on MySQL.


















Comments

Post a Comment

Popular posts from this blog

web scraping

want to get started with web_scraping  ! in this blog we will learn how to do web scarping,why to do web scraping,what are the advantages and disadvantages of web scraping and we will answer all the question related to web scraping very deeply in this blog.So let's get started. First you should know some basic things that what is a browser and what are websites.browsers are the machines that read and present the code on the screen which is written in HTML.browsers converts the HTML codes into an interface. for example ,suppose i am writing a code < html > < head > < title > WELCOME < /title > < /head > < body > < h1 > YOU CAN WRITE HERE < /h1 > < /body > < /html > the browser will read the code and will present in front of you like and websites are the pages which are written in many components like HTML,java,python,MySQL and etc. theses pages are readed by the b...

commanding on coding

     COMPETITIVE PROGRAMMING  "Practise makes a man perfect " In today's new era, the one who is in the field of coding and programming (Both are almost the same) wants to get command on coding. every day new things and packages are introduced for the betterment of the software and its user experiences.so, today MAX is here to give you all possible ways to get command on coding. Today we will talk about the five steps that will increase your coding skills from zero levels to advanced level. STEP-1 Consider a code source like books, websites,  online courses and any other stuff from which you are comfortable( I prescribe to use books for better understanding and clear-cut overview of contents .)and then makes another notebook and extract all the syntax of each and every topic. the main moto of doing this is that you will learn the syntax of the programming language, which is ignored by many students, and for writing programmes, they seek for the syntax a...

Performing Analysis of Meteorological Data

 import numpy as np import pandas as pd import matplot.pyplot as plt file_path = "C:/Users/user/Downloads/wetherHistory.csv" file = pd.read_csv(file_path) titles_req = ["Formatted Date","Apparent Temerature(c)","Humidity"] df = files[titles_req] df['Formatted Date'] = pd.to_datetime(df['Formatted Date'],utc=True) df_1 = df.set_index('Formatted Dates') df_1 = df_1.resample('MS').mean() df_1.head() plt.figure(figsize(14,6)) plt.title("Variation in apperent temperature and Humidity with time") plt.plot(df_1) df_april = df_1[df_1.index.month==4] plt.figure(figsize=(14,6)) plt.plot(df_april)