My SQLData
My SQLData
-> id INT,
-> );
-> values('1','Raheman','JavaDev','MNC',7.0);
--------------------------------------------------------------------------------------
+------+---------+---------+---------+--------+
+------+---------+---------+---------+--------+
+------+---------+---------+---------+--------+
-----------------------------------------------------------
------------------------------------------------------------------------------
+------+--------------+-----------------+------------------------+----------+
+------+--------------+-----------------+------------------------+----------+
+------+--------------+-----------------+------------------------+----------+
----------------------------------------------------------------------------------------------
mysql> select name, company, salary from rahemanhyd.aaa where salary>=30000.0 AND work
='Manager';
+-------------+---------+----------+
+-------------+---------+----------+
-----------------------------------------------------
select * from rahemanhyd.aaa where work = 'Manager' AND (company = 'SalesPro' OR name = 'Bob
Johnson');
+------+-------------+---------+---------+----------+
+------+-------------+---------+---------+----------+
+------+-------------+---------+---------+----------+
-----------------------------------------------------------------
mysql> select * from rahemanhyd.aaa where name = 'Bob Johnson' OR (work = 'Manager' AND
Salary>30000);
+------+-------------+---------+---------+----------+
+------+-------------+---------+---------+----------+
+------+-------------+---------+---------+----------+
----------------------------------------------------------------------------
mysql> select * from rahemanhyd.aaa where name = 'Bob Johnson' OR (work = 'Managers' AND
Salary>30000);
+------+-------------+---------+---------+----------+
| id | name | work | company | salary |
+------+-------------+---------+---------+----------+
+------+-------------+---------+---------+----------+
----------------------------------------------------------------------------
+------+----------------+----------------------+------------------------+----------+
+------+----------------+----------------------+------------------------+----------+
+------+-------------+---------+---------+----------+------+-------------+---------+
---------------------------------------------------------------------------------------------------
mysql> select * from rahemanhyd.aaa where salary BETWEEN 70000.0 AND 90000.0;
+------+----------------+------------+-----------------+----------+
+------+----------------+------------+-----------------+----------+
---------------------------------------------------------------------------------
mysql> select * from rahemanhyd.aaa ORDER BY salary ASC;
+------+----------------+----------------------+------------------------+----------+
+------+----------------+----------------------+------------------------+----------+
------------------------------------------------------------------------------------------------
+------+----------------+----------------------+------------------------+----------+
+------+----------------+----------------------+------------------------+----------+
--------------------------------------------------------------------------------------------------
select * from rahemanhyd.aaa where (salary BETWEEN 70000.0 AND 90000.0) AND company IN
('MNC', 'SalesPro');
-----------------------------------------------------------------------------------------------------------------
+----------------+
| std_name |
+----------------+
| Raheman |
| John Doe |
| Jane Smith |
| Bob Johnson |
| Alice Brown |
| Charlie Wilson |
--------------------------------------------------------------------------------------
+------+----------+------+----------+
+------+----------+------+----------+
| 1 | Aarav | 76 | 176 |
---------------------------------------------------------------------------
+------+----------+------+---------+
+------+----------+------+---------+
-----------------------------------------------------------------------------
+------+----------+------+--------+
+------+----------+------+--------+
-------------------------------------------------------------------------------
+------+----------+------+--------+
+------+----------+------+--------+
---------------------------------------------------------------------
* create multiple column use AFTER TABLE
-> ADD COLUMN price INT FIRST; //it will take first field to add column
-> ADD COLUMN price INT LAST; //it will take Last field to add column
+------+----------+------+----------+--------+----------+--------+-------+
+------+----------+------+----------+--------+----------+--------+-------+
--------------------------------------------------------------------------------------------
+------+--------+----------+------+----------+--------+----------+--------+-------+
+------+--------+----------+------+----------+--------+----------+--------+-------+
------------------------------------------------------------------------------------------------------
+------+--------+----------+------+----------+------------+----------+--------+-------+
+------+--------+----------+------+----------+------------+----------+--------+-------+
----------------------------------------------------------------------------------------------
+------+----------+------+----------+------------+----------+--------+-------+
+------+----------+------+----------+------------+----------+--------+-------+
----------------------------------------------------------------------------------------------
** Drop Table
--------------------------------------
** UPDATE data into table
-> WHERE id = 1;
** if u use this Then it will add lastdata 1000 and location hyderaad for all record
-> SET lastdata = 1000,location = 'Hyderabad'; // use this for update all record
+------+----------+------+----------+------------+-----------+--------+-------+
+------+----------+------+----------+------------+-----------+--------+-------+
-----------------------------------------------------------------------------------------
-> CASE
-> END;
+----+-------+----------+------+--------+
+----+-------+----------+------+--------+
+----+-------+----------+------+--------+
-----------------------------------------------------------------
-------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
** MIN / MAX -->
+-------+
| marks |
+-------+
| 76 |
+-------+
--------------------------------------------------------------
** Total Marks
+-----------+
| totalMark |
+-----------+
| 1925 |
+-----------+
** mysql> select UPPER(name) from rahemanhyd.ddd; // ur all name will represent UPPERCASE
** mysql> select LOWER(name) from rahemanhyd.ddd; // ur all name will represent LOWER
---------------------------------------------------------------------------------------------------
//Concat
+------+-------------------+
| id | CONCAT(name,mark) |
+------+-------------------+
| 1 | Shah150 |
| 2 | Kapoor100 |
| 3 | Ghongade200 |
| 4 | Patil400 |
//USING SPACE
+------+-----------------------+
| id | CONCAT(name,' ',mark) |
+------+-----------------------+
| 1 | Shah 150 |
| 2 | Kapoor 100 |
| 3 | Ghongade 200 |
| 4 | Patil 400 |
-------------------------------------------------------------------------------------------
//REVERSE()
+---------------+
| REVERSE(name) |
+---------------+
| hahS |
| roopaK |
| edagnohG |
| litaP |
| varaA |
| ahsiA |
------------------------------------------------------------------------------------------