hello everyone ,from this we gone see about SQL and mastering SQL basics for MySQL
on this blog i gone cover whatever i leaned MySQL , i like to share on this blog.
first of all we need to know about "what is SQL ?"and "how to use MySQL ?"
Introducation :
SQL (Structured Query Language) is a standard programming language designed for managing and manipulating relational databases. It is the language used to communicate with
and manipulate databases such as MySQL, PostgreSQL, SQL Server, Oracle, and others.
SQL is used for various tasks related to databases, including:
1)Data Definition Language:(DDL)
Database Server —> Databases —> Tables (defined by columns) —> Rows Databases and tables are referred to as database objects. Any operation, such as creating, modifying, or deleting database objects, is called Data Definition Language (DDL).
The typical commands available in DDL are:
1. CREATE: Used to create new database objects like tables, indexes, views, or schemas. For example, `CREATE TABLE`, `CREATE INDEX`, `CREATE VIEW`, etc.
2. ALTER: Used to modify the structure of existing database objects. For example, `ALTER TABLE` to add, modify, or drop columns in a table.
3. DROP: Used to delete database objects. For example, `DROP TABLE`, `DROP INDEX`, `DROP VIEW`, etc.
4. TRUNCATE: Used to remove all records from a table, but the table structure and its attributes remain intact.
2)Data Manipulation Language: (DML)
DML stands for Data Manipulation Language. It is a subset of SQL (Structured Query Language) used to manipulate data stored in a database. DML commands enable users to perform various operations on the data, such as inserting new records, updating existing records, deleting records, and retrieving data from the database.
Common DML commands include:
1. INSERT: Used to add new records (rows) into a table.
2. UPDATE: Used to modify existing records in a table.
3. DELETE: Used to remove records from a table.
4. SELECT: Although primarily associated with data retrieval (a DQL command), SELECT can also be considered a part of DML as it retrieves data from tables.
3)Data Query Language:(DQL)
DQL stands for Data Query Language. It's a subset of SQL (Structured Query Language) specifically designed for querying or retrieving data from a database. DQL includes commands for fetching and selecting data from one or more tables in a database. The primary command in DQL is the SELECT statement, which allows users to specify which columns and rows of data they want to retrieve from the database. DQL is essential for extracting information from databases for analysis, reporting, and decision-making purposes.
from above paragraph contain the meaning of what is SQL and what are the command the we gone to use in MySQL
creating a customerdatabase:
fist step to open a MySQL APP and open a local instance and enter a password , what the password that you given in MySQL.
create a database dummy;
create table customer(
customer_id int,
customer_name varchar(100),
customer_addressvarchar(100),
city varchar(100),
state varchar(100),
zip_code int)
after enter the code and excute .then enter select * from customer; the table will be show like this
after create table we need to insert the record , to insert record again the this code :
insert into customer values(1,"jhon doe","392 sunset blvd","new york","NT"," 10059");
insert into customer values(2,"mary smith","6900 main st","san francisco","CA"," 94032");
insert into customer values(3,"richard newman","2040 riverside rd","san diego","CA"," 92010");
insert into customer values(4,"cathy cook","4010 speedway ","tucson","AZ"," 85719");
insert the values into the table again use the excute button , wearher its save or not to identfy again use select* from customer table is show like this
now we gone use change commend , hoe to change like if change customer_address into address.
alter table customer change column customer_address address varchar(100);
enter this command use excute then weather its excute or not to find out use select * from customer the table showen like this
how to add a new column : for exmaple add mobile_number
alter table customer add column mobile_number int;
run this command use excute ,then find out use select * from customer
see the mobile_number column is null , then how to we enter the value the column use the commad
insert into customer values(1,"jhon doe","392 sunset blvd","new york","NT"," 10059",555-123-4567);
insert into customer values(2,"mary smith","6900 main st","san francisco","CA"," 94032",555-987-6543);
insert into customer values(3,"richard newman","2040 riverside rd","san diego","CA"," 92010",555-555-5555 );
insert into customer values(4,"cathy cook","4010 speedway ","tucson","AZ"," 85719",555-321-7890);
after enter this all command and use excute button. to find its excute or not use theselect* from customer the table will been shown like this:
so this are basic of SQL that we are seen today in using in MySQL app and this are use for real time database collecting of data. Case studies of MySQL implementation in various industries (e.g., e-commerce, healthcare, finance).Practical examples and solutions to common challenges.Using MySQL with different programming languages (e.g., PHP, Python, Java).RESTful API development with MySQL. Best practices for interacting with MySQL in web applications.
Comments