Translate

Showing posts with label sql 17. Show all posts
Showing posts with label sql 17. Show all posts

Friday, 17 September 2021

What are CRUD Operations in sql videos in Telugu 17

 https://youtu.be/y6K-Proi1RA

------------------------------------

Setting environment for using XAMPP for Windows.
Mounika@MOUNIKA-PC c:\xampp
# mysql -h localhost -u root;
ERROR 1045 (28000): Access denied for user 'root;'@'localhost' (using password: NO)

Mounika@MOUNIKA-PC c:\xampp
# USE vlrinst;
'USE' is not recognized as an internal or external command,
operable program or batch file.

Mounika@MOUNIKA-PC c:\xampp
# mysql -h localhost -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.4.18-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> USE vlrinst;
Database changed
MariaDB [vlrinst]> show tables;
+-------------------+
| Tables_in_vlrinst |
+-------------------+
| emp               |
+-------------------+
1 row in set (0.098 sec)

MariaDB [vlrinst]> select * from emp;
+----+---------+-----------+------+-------+
| id | name    | loc       | age  | sal   |
+----+---------+-----------+------+-------+
|  1 | venkat  | kphb      |   35 | 30000 |
|  2 | praveen | pune      |   28 | 35000 |
|  3 | mounika | hyderabad |   22 | 39000 |
|  4 | revathi | jntu      |   26 | 20000 |
|  5 | anji    | gutta     |   28 | 20000 |
|  6 | harika  | lb nagar  |   26 | 30100 |
|  7 | praveen | jntu      |   33 |   100 |
|  8 | pandu   | munipeda  |   35 | 30300 |
|  9 | pandu   | pune      |   23 | 39300 |
+----+---------+-----------+------+-------+
9 rows in set (0.154 sec)

MariaDB [vlrinst]> select * from emp;
+----+---------+-----------+------+-------+
| id | name    | loc       | age  | sal   |
+----+---------+-----------+------+-------+
|  1 | venkat  | kphb      |   35 | 30000 |
|  2 | praveen | pune      |   28 | 35000 |
|  3 | mounika | hyderabad |   22 | 39000 |
|  4 | revathi | jntu      |   26 | 20000 |
|  5 | anji    | gutta     |   28 | 20000 |
|  6 | harika  | lb nagar  |   26 | 30100 |
|  7 | praveen | jntu      |   33 |   100 |
|  8 | pandu   | munipeda  |   35 | 30300 |
|  9 | pandu   | pune      |   23 | 39300 |
+----+---------+-----------+------+-------+
9 rows in set (0.002 sec)

MariaDB [vlrinst]> select name,loc from emp;
+---------+-----------+
| name    | loc       |
+---------+-----------+
| venkat  | kphb      |
| praveen | pune      |
| mounika | hyderabad |
| revathi | jntu      |
| anji    | gutta     |
| harika  | lb nagar  |
| praveen | jntu      |
| pandu   | munipeda  |
| pandu   | pune      |
+---------+-----------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select age from emp;
+------+
| age  |
+------+
|   35 |
|   28 |
|   22 |
|   26 |
|   28 |
|   26 |
|   33 |
|   35 |
|   23 |
+------+
9 rows in set (0.000 sec)

MariaDB [vlrinst]> select * from emp;
+----+---------+-----------+------+-------+
| id | name    | loc       | age  | sal   |
+----+---------+-----------+------+-------+
|  1 | venkat  | kphb      |   35 | 30000 |
|  2 | praveen | pune      |   28 | 35000 |
|  3 | mounika | hyderabad |   22 | 39000 |
|  4 | revathi | jntu      |   26 | 20000 |
|  5 | anji    | gutta     |   28 | 20000 |
|  6 | harika  | lb nagar  |   26 | 30100 |
|  7 | praveen | jntu      |   33 |   100 |
|  8 | pandu   | munipeda  |   35 | 30300 |
|  9 | pandu   | pune      |   23 | 39300 |
+----+---------+-----------+------+-------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select id,name,age,sal from emp;
+----+---------+------+-------+
| id | name    | age  | sal   |
+----+---------+------+-------+
|  1 | venkat  |   35 | 30000 |
|  2 | praveen |   28 | 35000 |
|  3 | mounika |   22 | 39000 |
|  4 | revathi |   26 | 20000 |
|  5 | anji    |   28 | 20000 |
|  6 | harika  |   26 | 30100 |
|  7 | praveen |   33 |   100 |
|  8 | pandu   |   35 | 30300 |
|  9 | pandu   |   23 | 39300 |
+----+---------+------+-------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select name,sal,id,name from emp;
+---------+-------+----+---------+
| name    | sal   | id | name    |
+---------+-------+----+---------+
| venkat  | 30000 |  1 | venkat  |
| praveen | 35000 |  2 | praveen |
| mounika | 39000 |  3 | mounika |
| revathi | 20000 |  4 | revathi |
| anji    | 20000 |  5 | anji    |
| harika  | 30100 |  6 | harika  |
| praveen |   100 |  7 | praveen |
| pandu   | 30300 |  8 | pandu   |
| pandu   | 39300 |  9 | pandu   |
+---------+-------+----+---------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select * from emp;
+----+---------+-----------+------+-------+
| id | name    | loc       | age  | sal   |
+----+---------+-----------+------+-------+
|  1 | venkat  | kphb      |   35 | 30000 |
|  2 | praveen | pune      |   28 | 35000 |
|  3 | mounika | hyderabad |   22 | 39000 |
|  4 | revathi | jntu      |   26 | 20000 |
|  5 | anji    | gutta     |   28 | 20000 |
|  6 | harika  | lb nagar  |   26 | 30100 |
|  7 | praveen | jntu      |   33 |   100 |
|  8 | pandu   | munipeda  |   35 | 30300 |
|  9 | pandu   | pune      |   23 | 39300 |
+----+---------+-----------+------+-------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select distinct loc form emp;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'emp' at line 1
MariaDB [vlrinst]> select distinct loc from emp;
+-----------+
| loc       |
+-----------+
| kphb      |
| pune      |
| hyderabad |
| jntu      |
| gutta     |
| lb nagar  |
| munipeda  |
+-----------+
7 rows in set (0.016 sec)

MariaDB [vlrinst]> select distinct loc,name from emp;
+-----------+---------+
| loc       | name    |
+-----------+---------+
| kphb      | venkat  |
| pune      | praveen |
| hyderabad | mounika |
| jntu      | revathi |
| gutta     | anji    |
| lb nagar  | harika  |
| jntu      | praveen |
| munipeda  | pandu   |
| pune      | pandu   |
+-----------+---------+
9 rows in set (0.011 sec)

MariaDB [vlrinst]> INSERT INTO emp(name, loc, age,sal)
    -> VALUES ('venkat', 'kphb', 35,30000),
    ->        ('praveen', 'pune', 28,35000),
    ->        ('mounika', 'hyderabad', 22,39000),
    ->        ('revathi', 'jntu', 26,20000),
    ->        ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 5
MariaDB [vlrinst]> INSERT INTO emp(name, loc, age,sal)
    -> VALUES ('venkat', 'kphb', 35,30000),
    ->        ('praveen', 'pune', 28,35000),
    ->        ('mounika', 'hyderabad', 22,39000),
    ->        ('revathi', 'jntu', 26,20000),
    -> INSERT INTO emp(name, loc, age,sal)
    -> VALUES ('venkat', 'kphb', 35,30000),
    ->        ('praveen', 'pune', 28,35000),
    ->        ('mounika', 'hyderabad', 22,39000),
    ->        ('revathi', 'jntu', 26,20000)
    ->        ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT INTO emp(name, loc, age,sa
l)
VALUES ('venkat', 'kphb', 35,30000),
   ...' at line 6
MariaDB [vlrinst]> INSERT INTO emp(name, loc, age,sal)
    -> VALUES ('venkat', 'kphb', 35,30000),
    ->        ('praveen', 'pune', 28,35000),
    ->        ('mounika', 'hyderabad', 22,39000),
    ->        ('revathi', 'jntu', 26,20000)
    ->        ;
Query OK, 4 rows affected (0.105 sec)
Records: 4  Duplicates: 0  Warnings: 0

MariaDB [vlrinst]> select * from emp
    -> ;
+----+---------+-----------+------+-------+
| id | name    | loc       | age  | sal   |
+----+---------+-----------+------+-------+
|  1 | venkat  | kphb      |   35 | 30000 |
|  2 | praveen | pune      |   28 | 35000 |
|  3 | mounika | hyderabad |   22 | 39000 |
|  4 | revathi | jntu      |   26 | 20000 |
|  5 | anji    | gutta     |   28 | 20000 |
|  6 | harika  | lb nagar  |   26 | 30100 |
|  7 | praveen | jntu      |   33 |   100 |
|  8 | pandu   | munipeda  |   35 | 30300 |
|  9 | pandu   | pune      |   23 | 39300 |
| 10 | venkat  | kphb      |   35 | 30000 |
| 11 | praveen | pune      |   28 | 35000 |
| 12 | mounika | hyderabad |   22 | 39000 |
| 13 | revathi | jntu      |   26 | 20000 |
+----+---------+-----------+------+-------+
13 rows in set (0.001 sec)

MariaDB [vlrinst]> select distinct loc,name form emp;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'emp' at line 1
MariaDB [vlrinst]> select distinct loc,name from emp;
+-----------+---------+
| loc       | name    |
+-----------+---------+
| kphb      | venkat  |
| pune      | praveen |
| hyderabad | mounika |
| jntu      | revathi |
| gutta     | anji    |
| lb nagar  | harika  |
| jntu      | praveen |
| munipeda  | pandu   |
| pune      | pandu   |
+-----------+---------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select distinct loc,name,id from emp;
+-----------+---------+----+
| loc       | name    | id |
+-----------+---------+----+
| kphb      | venkat  |  1 |
| pune      | praveen |  2 |
| hyderabad | mounika |  3 |
| jntu      | revathi |  4 |
| gutta     | anji    |  5 |
| lb nagar  | harika  |  6 |
| jntu      | praveen |  7 |
| munipeda  | pandu   |  8 |
| pune      | pandu   |  9 |
| kphb      | venkat  | 10 |
| pune      | praveen | 11 |
| hyderabad | mounika | 12 |
| jntu      | revathi | 13 |
+-----------+---------+----+
13 rows in set (0.001 sec)

MariaDB [vlrinst]>