Posts

MYSQL - “LIKE operator”

Image
  MYSQL - “LIKE operator” The LIKE operator is used in a WHERE clause to search for a pattern in a column. Two wildcards are often used while using the LIKE operator: Percentage sign( % ) — it represents multiple characters ,zero ,one. Underscore sign( _ ) — it represents single character. Create database before creating a table. commands : CREATE DATABASE pannts_db, USE pants_db creating pants_db table and inserting values LIKE ‘J%’ — finds any value that starts with “J” In the below syntax it shows the values from “ Article column ” where the value starts with “J” .  LIKE ‘J%’.  It shows only those values as per the condition described. LIKE ’J%’ LIKE ‘%e’ — finds any values that ends with “e” In the below syntax it shows the values from “ color column ” where the value ends with the letter ”e”.  LIKE ‘%e’.  It shows only those rows as per the condition described. LIKE ‘%e’ LIKE ‘%a%’ — finds any values that have or in any position. In the below syntax it shows values from “ Article

MYSQL Basics to Know…..PART-3

Image
  MYSQL Basics to Know…..PART-3 AGGREGATE FUNCTIONS — collects a set of values to return a single value. I have used my favorite comic data in creating a database and a table. The Vision, Volume 1: Little Worse Than A Man Batman: The killing Joke Venom, Volume 1: Homecoming Venom, Volume 2: The Abyss The Flash: A Celebration of 75 Years COUNT() : counts the number of rows in a database. COUNT() syntax COUNT() syntax MIN() : It shows the lowest number of values in a table. MIN() syntax MAX() : It shows the highest number of values in a table. MAX() syntax For MIN Title and pages . In this below syntax, it shows only Title and pages which is in ascending order and has a LIMIT -1 (which gives only 1 row of data). For MIN Title and pages The below syntax is based on descending order which can be also used for  MAX() syntax . ORDER BY() SUM() : It calculates the sum of a selected set of columns. SUM() syntax AVG() : It calculates the average of a selected set of columns. AVG() syntax

MYSQL Basics to know ….PART -2

Image
  MYSQL Basics to know ….PART -2 LoL…I used my YouTube channel name for syntax. YOUTUBE CHANNEL REVERSE() : This command reverses a string. REVERSE( ) syntax SUBSTRING( ) : It works with parts of strings. SUBSTRING( ) syntax UPPER() : Converts a string into upper-case. UPPER( ) syntax LOWER( )  : Converts a string into lower-case. LOWER( ) syntax CONCAT ()  : This command adds two or more strings together. CONCAT( ) syntax CONCAT_WS () : Concat two or more strings into one string with a separator. CONCAT_WS ( ) syntax REPLACE( ) : Replaces parts(characters)of a string with another set of characters. REPLACE( )syntax DISTINCT( ) : It collects unique values and it won’t show any duplicate values in the table. DISTINCT( ) syntax ORDER BY( ) : This command is used to sort the values in Ascending or Descending order.  ASC -Ascending order, DESC-Descending order . In the below syntax the output shows in ascending order. Ascending by default. ORDER BY( ) syntax in Ascending order DESC -Descen

MYSQL Basics to know….PART -1

Image
  MYSQL Basics to know….PART -1 MYSQL -It is a Cross-Platform, Open-Source, Relational Database management system and free Application. The data in a row is called “ Record ” The data in a column is called “ Field ” CREATE DATABASE  -Creates a database in the server. USE  command -Switch to the database with specified name. CREATE TABLE  -Creates a entire database objects table. Syntax: CREATE TABLE shirts1(shirts_id INT NOT NULL AUTO_INCREMENT,Article VARCHAR(100),color VARCHAR(100), shirt_size VARCHAR(100),last_worn INT, PRIMARY KEY (shirts_id)); DESC(DESCRIBE)  command-To see Database Field formats. SELECT  command -Extracts Data from a Database. Over here Asterisk “ * “ it selects all the columns from the table. INSERT INTO  command-Inserts data into the tables. WHERE  command -Is used for Filtering the records(rows). UPDATE  command- If you want to change any new Value/data to be added up in the table can use the UPDATE command. Updates the data in a database. DELETE  command — Us