Category: MySQL

  • MySQL Database

    What is a MySQL database? MySQL Database is a client/server system that consists of a multithreaded SQL server that supports different back ends, several different client programs and libraries, administrative tools, and a wide range of application-programming interfaces (APIs). Okay then How do we create a Database ? The MySQL…

  • MySQL AND, OR and NOT Operators

    The MySQL AND, OR and NOT Operators The WHERE clause can be combined with AND, OR, and NOT operators. The AND and OR operators are used to filter records based on more than one condition: The NOT operator displays a record if the condition(s) is NOT TRUE. AND Syntax OR Syntax NOT Syntax Examples: AND Example: OR Example: Not Example: Combining AND,…

  • MySQL Data Types – I

    MySQL supports SQL data types in several categories: numeric types, date and time types, string (character and byte) types, spatial types, and the JSON data type. This provides an overview and more detailed description of the properties of the types in each category, and a summary of the data type storage requirements. In SQL…

  • MySQL – Data Type Default Values

    Data type specifications can have explicit or implicit default values. A DEFAULT value clause in a data type specification explicitly indicates a default value for a column. Examples: SERIAL DEFAULT VALUE is a special case. In the definition of an integer column, it is an alias for NOT NULL AUTO_INCREMENT UNIQUE. Some aspects of explicit DEFAULT clause…

  • MySQL Flow Control Functions

    MySQL Flow Control Functions

    The control flow function evaluates the condition specified in it. The output generated by them can be a true, false, static value or column expression. We can use the control flow functions in the SELECT, WHERE, ORDER BY, and GROUP BY clause. Flow Control Operators: Name Description CASE Case Operator IF()…

  • MySQL String Functions-2

    1. FIELD(str, str1, str2, . . .) Returns the index (position) of str in the str1, str2, str3, … list. Returns 0 if str is not found. If all arguments to FIELD() are strings, all arguments are compared as strings. If all arguments are numbers, they are compared as numbers. Otherwise, the arguments are compared as double. If str is NULL, the return value is 0 because NULL fails equality…

  • MySQL String Functions

    For functions that operate on string positions, the first position is numbered 1. ASCII(str) Returns the numeric value of the leftmost character of the string str. Returns 0 if str is the empty string. Returns NULL if str is NULL.  ASCII( ) works for 8-bit characters. Code: BIT_LENGTH(str) Returns the length of the string str in bits. Returns NULL if str is NULL. Code: INSERT(str, pos, len,…

  • SQL Operations

    SET OPERATIONS Set operations are used to combine the results of two or more queries into a single result. The combined queries must return the same number of columns and compatible data types. The names of the corresponding columns can be different. CONSIDER THE FOLLOWING TABLE id name country 1…

  • Basic SQL

    What is SQL ? SQL stands for Structured Query Language. It is used for storing and managing data in relational database management system (RDBMS). What Can SQL do? RDBMS RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and for all modern database systems such as…