Sunday, July 29, 2018

MySql manage user and privilege

In MySql we can create deferent users and add user privilege to it. Managing user is add security to databases in MySql server. for do that you must login mysql to as root user.

visit MySQL quary part 1
visit MySQL quary part 2
visit MySQL quary part 3
visit MySQL quary part 4


Create user
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; 
  • user-user name of the user that we creating
  • password-password of the user that we creating
Grant privilege to user (you can set grant that you wont using one of this query)
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost';

GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost';

GRANT ALL PRIVILEGES ON database.table TO 'user'@'localhost';

GRANT SELECT, INSERT, DELETE ON database.* TO 'user'@'localhost';
  • database-database name which we grant access
  • table-table name which we grant access


  • ALL PRIVILEGES – grants all privileges to the MySQL user
  • CREATE – allows the user to create databases and tables
  • DROP - allows the user to drop databases and tables
  • DELETE - allows the user to delete rows from specific MySQL table
  • INSERT - allows the user to insert rows into specific MySQL table
  • SELECT – allows the user to read the database
  • UPDATE - allows the user to update table rows
View privileges
 
SHOW GRANTS FOR 'user'@'localhost';
Save privileges
 
FLUSH PRIVILEGES;
Remove user
 
DROP USER 'user'@'localhost'



Now you have create user named as user with password equal to password.then youcan login to mysql using
 
mysql -u user -p

Wednesday, July 25, 2018

MySQL quary part 4(ORDER BY, ARITHMETIC, NESTING OF QUERIES, EXISTS, UNION)

visit MySQL quary part 1
visit MySQL quary part 2
visit MySQL quary part 3

  • ORDER BY
  • AGGREGATE FUNCTIONS
  • ARITHMETIC OPERATIONS
  • SUBSTRING COMPARISON
  • NESTING OF QUERIES
  • THE EXISTS FUNCTION
  • SET OPERATION (UNION)
ORDER BY

SELECT * FROM powerplant.turbine ORDER BY weight;

+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 5 | man2 | yes | 1 | NULL | | 1 | man1 | yes | 1 | 10 | | 2 | man2 | no | 1 | 20 | | 4 | man2 | no | 2 | 20 | | 3 | man3 | no | 2 | 50 | +----+--------------+---------+-----------+--------+
AGGREGATE FUNCTIONS

/*********** COUNT, SUM, MAX, MIN, and AVG ***************/

SELECT COUNT(outputpower),SUM(outputpower),MAX(outputpower),MIN(outputpower), AVG(outputpower) FROM genarator;

+--------------------+------------------+------------------+------------------+------------------+ | COUNT(outputpower) | SUM(outputpower) | MAX(outputpower) | MIN(outputpower) | AVG(outputpower) | +--------------------+------------------+------------------+------------------+------------------+ | 2 | 30 | 20 | 10 | 15 | +--------------------+------------------+------------------+------------------+------------------+
ARITHMETIC OPERATIONS

/* The standard arithmetic operators '+', '-'. '*', and '/' (for addition,subtraction, multiplication, and division, respectively) can be applied to numeric values in an SQL query result*/

SELECT weight,weight+1,weight*2,weight-5,weight/2 FROM powerplant.turbine;

+--------+----------+----------+----------+----------+ | weight | weight+1 | weight*2 | weight-5 | weight/2 | +--------+----------+----------+----------+----------+ | 10 | 11 | 20 | 5 | 5 | | 20 | 21 | 40 | 15 | 10 | | 50 | 51 | 100 | 45 | 25 | | 20 | 21 | 40 | 15 | 10 | | NULL | NULL | NULL | NULL | NULL | +--------+----------+----------+----------+----------+
SUBSTRING COMPARISON

/* Two reserved characters are used: '%' (or '*' in some implementations) replaces an arbitrary number of characters, and '_' replaces a single arbitrary character*/

SELECT * FROM powerplant.turbine WHERE details LIKE '_e%';

+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 1 | man1 | yes | 1 | 10 | | 5 | man2 | yes | 1 | NULL | +----+--------------+---------+-----------+--------+
NESTING OF QUERIES

SELECT * FROM turbine WHERE turbine.genarator IN (SELECT id from genarator WHERE outputpower=20 );

+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 3 | man3 | no | 2 | 50 | | 4 | man2 | no | 2 | 20 | +----+--------------+---------+-----------+--------+
THE EXISTS FUNCTION

/* EXISTS is used to check whether the result of a correlated nested query is empty*/

SELECT * FROM turbine WHERE EXISTS (SELECT id from genarator WHERE id=turbine.genarator AND outputpower=20 );

+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 3 | man3 | no | 2 | 50 | | 4 | man2 | no | 2 | 20 | +----+--------------+---------+-----------+--------+
SET OPERATION (UNION)

SELECT * from turbine,genarator 
WHERE turbine.genarator=genarator.id AND turbine.id=1
 UNION SELECT * from turbine,genarator 
 WHERE turbine.genarator=genarator.id AND genarator.id=2;

+----+--------------+---------+-----------+--------+----+-------------+ | id | manufacturer | details | genarator | weight | id | outputpower | +----+--------------+---------+-----------+--------+----+-------------+ | 1 | man1 | yes | 1 | 10 | 1 | 10 | | 3 | man3 | no | 2 | 50 | 2 | 20 | | 4 | man2 | no | 2 | 20 | 2 | 20 | +----+--------------+---------+-----------+--------+----+-------------+

MySQL quary part 3(ALIASES, NULLS, EXPLICIT SETS, GROUP BY, HAVING)

visit MySQL quary part 1
visit MySQL quary part 2
visit MySQL quary part 4

  • ALIASES
  • USE of DISTINCT
  • NULLS IN SQL QUERIES
  • EXPLICIT SETS
  • GROUP BY
  • HAVING
ALIASES

SELECT `manufacturer` AS 'MAN', `details` AS 'Det' FROM `powerplant`.`turbine`;

+------+-----+ | MAN | Det | +------+-----+ | man1 | yes | | man2 | no | | man3 | no | | man2 | no | | man2 | yes | +------+-----+
SELECT G.id, T.details, T.weight FROM genarator AS G, turbine AS T WHERE G.id=T.genarator AND T.details='no';
+----+---------+--------+ | id | details | weight | +----+---------+--------+ | 1 | no | 20 | | 2 | no | 50 | | 2 | no | 20 | +----+---------+--------+
SELECT genarator.id, turbine.details, turbine.weight FROM genarator, turbine WHERE genarator.id=turbine.genarator AND turbine.details='no';
+----+---------+--------+ | id | details | weight | +----+---------+--------+ | 1 | no | 20 | | 2 | no | 50 | | 2 | no | 20 | +----+---------+--------+
USE of DISTINCT
/* The SELECT DISTINCT statement is used to return only distinct (different) values.*/

SELECT manufacturer FROM turbine;

+--------------+ | manufacturer | +--------------+ | man1 | | man2 | | man3 | | man2 | | man2 | +--------------+
SELECT DISTINCT manufacturer FROM turbine;
+--------------+ | manufacturer | +--------------+ | man1 | | man2 | | man3 | +--------------+
NULLS IN SQL QUERIES

SELECT * FROM turbine WHERE weight IS NOT NULL;

+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 1 | man1 | yes | 1 | 10 | | 2 | man2 | no | 1 | 20 | | 3 | man3 | no | 2 | 50 | | 4 | man2 | no | 2 | 20 | +----+--------------+---------+-----------+--------+
SELECT * FROM turbine WHERE weight IS NULL;
+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 5 | man2 | yes | 1 | NULL | +----+--------------+---------+-----------+--------+
EXPLICIT SETS
/*It is also possible to use an explicit (enumerated) set of values in the WHERE-clause rather than a nested query*/

SELECT * FROM powerplant.turbine WHERE manufacturer in('man1','man2');

+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 1 | man1 | yes | 1 | 10 | | 2 | man2 | no | 1 | 20 | | 4 | man2 | no | 2 | 20 | | 5 | man2 | yes | 1 | NULL | +----+--------------+---------+-----------+--------+
GROUP BY

/* SQL has a GROUP BY-clause for specifying the grouping attributes, which must also appear in the SELECT-clause*/

SELECT details,COUNT(details) FROM powerplant.turbine GROUP BY details;

+---------+----------------+ | details | COUNT(details) | +---------+----------------+ | no | 3 | | yes | 2 | +---------+----------------+
HAVING

/* The HAVING-clause is used for specifying a selection condition on groups (rather than on individual tuples)*/

SELECT details,COUNT(details) FROM powerplant.turbine GROUP BY details HAVING COUNT(details)>2;

+---------+----------------+ | details | COUNT(details) | +---------+----------------+ | no | 3 | +---------+----------------+

Tuesday, July 24, 2018

How to use loops (for and while) in Arduino

In this lesson you can learned more about how to use output in arduino using arduino digital pin and the main purpose of this lesson is understanding about the loops in lesson_02_1 shows how to blink more led without using loops then lesson_02-2 and lesson_02-3 shown that optimize the code using for loop and while loop




Lesson_02-1 arduino code





Lesson_02-2 arduino code

Lesson_02-3 arduino code

Friday, July 20, 2018

MySQL quary part 2(select data in data base my sql quary)

Read privies post about the mysql basic command (crud-operation) before follow this and This post is about how to get data from MySQL database using query and This post has the examples of
    part 2(this post)
  • Get data from table and WHERE-clause
  • JOIN TABLE
  • part 3
  • ALIASES
  • USE of DISTINCT
  • NULLS IN SQL QUERIES
  • EXPLICIT SETS
  • GROUP BY
  • HAVING
  • part 4
  • ORDER BY
  • AGGREGATE FUNCTIONS
  • ARITHMETIC OPERATIONS
  • SUBSTRING COMPARISON
  • NESTING OF QUERIES
  • THE EXISTS FUNCTION
  • SET OPERATION (UNION)

I have shown the query and the table which is result of the query
Get data from table and WHERE-clause

SELECT * FROM powerplant.turbine;#UNSPECIFIED WHERE-clause

+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 1 | man1 | yes | 1 | 10 | | 2 | man2 | no | 1 | 20 | | 3 | man3 | no | 2 | 50 | | 4 | man2 | no | 2 | 20 | | 5 | man2 | yes | 1 | NULL | +----+--------------+---------+-----------+--------+
SELECT * FROM `powerplant`.`turbine` WHERE `id` = 1;
+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 1 | man1 | yes | 1 | 10 | +----+--------------+---------+-----------+--------+
SELECT * FROM `powerplant`.`turbine` WHERE NOT `id` = 1;
+----+--------------+---------+-----------+--------+ | id | manufacturer | details | genarator | weight | +----+--------------+---------+-----------+--------+ | 1 | man1 | yes | 1 | 10 | +----+--------------+---------+-----------+--------+
SELECT `manufacturer`,`details` FROM `powerplant`.`turbine` WHERE `details` = 'yes' AND `manufacturer`='man1';
+--------------+---------+ | manufacturer | details | +--------------+---------+ | man1 | yes | +--------------+---------+
SELECT `manufacturer`,`details` FROM `powerplant`.`turbine` WHERE `details` = 'no' OR `manufacturer`='man1';
+--------------+---------+ | manufacturer | details | +--------------+---------+ | man1 | yes | | man2 | no | | man3 | no | | man2 | no | +--------------+---------+
JOIN TABLE

SELECT * FROM genarator,turbine;

+----+-------------+----+--------------+---------+-----------+--------+ | id | outputpower | id | manufacturer | details | genarator | weight | +----+-------------+----+--------------+---------+-----------+--------+ | 1 | 10 | 1 | man1 | yes | 1 | 10 | | 2 | 20 | 1 | man1 | yes | 1 | 10 | | 1 | 10 | 2 | man2 | no | 1 | 20 | | 2 | 20 | 2 | man2 | no | 1 | 20 | | 1 | 10 | 3 | man3 | no | 2 | 50 | | 2 | 20 | 3 | man3 | no | 2 | 50 | | 1 | 10 | 4 | man2 | no | 2 | 20 | | 2 | 20 | 4 | man2 | no | 2 | 20 | | 1 | 10 | 5 | man2 | yes | 1 | NULL | | 2 | 20 | 5 | man2 | yes | 1 | NULL | +----+-------------+----+--------------+---------+-----------+--------+
SELECT * FROM genarator INNER JOIN turbine;
+----+-------------+----+--------------+---------+-----------+--------+ | id | outputpower | id | manufacturer | details | genarator | weight | +----+-------------+----+--------------+---------+-----------+--------+ | 1 | 10 | 1 | man1 | yes | 1 | 10 | | 2 | 20 | 1 | man1 | yes | 1 | 10 | | 1 | 10 | 2 | man2 | no | 1 | 20 | | 2 | 20 | 2 | man2 | no | 1 | 20 | | 1 | 10 | 3 | man3 | no | 2 | 50 | | 2 | 20 | 3 | man3 | no | 2 | 50 | | 1 | 10 | 4 | man2 | no | 2 | 20 | | 2 | 20 | 4 | man2 | no | 2 | 20 | | 1 | 10 | 5 | man2 | yes | 1 | NULL | | 2 | 20 | 5 | man2 | yes | 1 | NULL | +----+-------------+----+--------------+---------+-----------+--------+
SELECT * FROM genarator,turbine WHERE genarator.id=turbine.genarator;
+----+-------------+----+--------------+---------+-----------+--------+ | id | outputpower | id | manufacturer | details | genarator | weight | +----+-------------+----+--------------+---------+-----------+--------+ | 1 | 10 | 1 | man1 | yes | 1 | 10 | | 1 | 10 | 2 | man2 | no | 1 | 20 | | 2 | 20 | 3 | man3 | no | 2 | 50 | | 2 | 20 | 4 | man2 | no | 2 | 20 | | 1 | 10 | 5 | man2 | yes | 1 | NULL | +----+-------------+----+--------------+---------+-----------+--------+
SELECT * FROM genarator INNER JOIN turbine ON genarator.id=turbine.genarator;
+----+-------------+----+--------------+---------+-----------+--------+ | id | outputpower | id | manufacturer | details | genarator | weight | +----+-------------+----+--------------+---------+-----------+--------+ | 1 | 10 | 1 | man1 | yes | 1 | 10 | | 1 | 10 | 2 | man2 | no | 1 | 20 | | 2 | 20 | 3 | man3 | no | 2 | 50 | | 2 | 20 | 4 | man2 | no | 2 | 20 | | 1 | 10 | 5 | man2 | yes | 1 | NULL | +----+-------------+----+--------------+---------+-----------+--------+

Saturday, July 14, 2018

MySQl basic command ( CRUD operation )

open terminal and type below command and it ask your password and type mysql root password to login

mysql -u root -p

in this example i use database as 'powerplant' with two tables 'genarator' and 'turbine' and crated database shown in this post.I think that it will help you to understand how to SQL queries work.

Show and Create databases and use database
show databases; #to view all databases

CREATE DATABASE powerplant; #create database named it as 'powerplant'

use powerplant;#to use powerplant database for other works 


Show and Create table
CREATE TABLE `genarator` (
 `id` INT(11) NOT NULL,
 `outputpower` DOUBLE NOT NULL,
 PRIMARY KEY (`id`)
);


CREATE TABLE `turbine` (
 `id` INT(11) NOT NULL,
 `manufacturer` VARCHAR(50) NOT NULL,
 `details` VARCHAR(50) NOT NULL,
 `genarator` INT(11) NOT NULL,
 PRIMARY KEY (`id`),
 INDEX `FK__genarator` (`genarator`),
 CONSTRAINT `FK__genarator` FOREIGN KEY (`genarator`) REFERENCES `genarator` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
);

ALTER TABLE `turbine`
 ADD COLUMN `weight` DOUBLE NULL AFTER `genarator`;

ALTER TABLE `turbine`
 ADD COLUMN `weight` DOUBLE NULL AFTER `genarator`;

 ALTER TABLE `turbine`
  ADD COLUMN `test` DOUBLE NULL ;

 ALTER TABLE `turbine`
 DROP COLUMN `test`;

 ALTER TABLE `turbine`
 ADD CONSTRAINT `FK__genarator`
 FOREIGN KEY (`genarator`) REFERENCES `genarator` (`id`);

show tables; # to view all tables

describe genarator; # to view genarator table with column details



Show data in a table
SELECT * FROM genarator;

Update data in a table
INSERT INTO `powerplant`.`genarator` (`id`, `outputpower`) VALUES ('1', '10');
INSERT INTO `powerplant`.`turbine` (`id`, `manufacturer`, `details`, `genarator`, `weight`) VALUES ('1', 'asitha', 'no', '1', '10');

UPDATE `powerplant`.`turbine` SET `manufacturer`='man1', `details`='yes' WHERE  `id`=1;



#delete one row in a table
DELETE FROM `powerplant`.`turbine` WHERE  `id`=2;

#delete whole table ('test' is table name)
DROP TABLE `test`;


All terminal command that i have typed and executed is shown below for your understanding. You can install any mysql server and execute this queries an what are the output

Terminal
mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.18-1 (Debian)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| JDBC               |
| chatuser           |
| demo               |
| hib                |
| hiblayer           |
| inventory          |
| login              |
| mysql              |
| onetomany          |
| onetoone           |
| performance_schema |
| personal           |
| php                |
| php-pos            |
| phplogin           |
| phpmyadmin         |
| pos                |
| posf               |
| school             |
| sys                |
| test               |
| welcome_2k18       |
| wordpress          |
+--------------------+
24 rows in set (0.00 sec)

mysql> CREATE DATABASE powerplant;
Query OK, 1 row affected (0.00 sec)

mysql> use powerplant;
Database changed
mysql> CREATE TABLE `genarator` (
    -> `id` INT(11) NOT NULL,
    -> `outputpower` DOUBLE NOT NULL,
    -> PRIMARY KEY (`id`)
    -> );
Query OK, 0 rows affected (0.48 sec)

mysql> CREATE TABLE `turbine` (
    -> `id` INT(11) NOT NULL,
    -> `manufacturer` VARCHAR(50) NOT NULL,
    -> `details` VARCHAR(50) NOT NULL,
    -> `genarator` INT(11) NOT NULL,
    -> PRIMARY KEY (`id`),
    -> INDEX `FK__genarator` (`genarator`),
    -> CONSTRAINT `FK__genarator` FOREIGN KEY (`genarator`) REFERENCES `genarator` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
    -> );
Query OK, 0 rows affected (0.33 sec)

mysql> CREATE TABLE `test` (
    -> `Column 1` INT(11) NULL DEFAULT NULL
    -> );
Query OK, 0 rows affected (0.56 sec)

mysql> DROP TABLE `test`;
Query OK, 0 rows affected (0.20 sec)

mysql> show tables;
+----------------------+
| Tables_in_powerplant |
+----------------------+
| genarator            |
| turbine              |
+----------------------+
2 rows in set (0.00 sec)

mysql> describe genarator;
+-------------+---------+------+-----+---------+-------+
| Field       | Type    | Null | Key | Default | Extra |
+-------------+---------+------+-----+---------+-------+
| id          | int(11) | NO   | PRI | NULL    |       |
| outputpower | double  | NO   |     | NULL    |       |
+-------------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> INSERT INTO `powerplant`.`genarator` (`id`, `outputpower`) VALUES ('1', '10');
Query OK, 1 row affected (0.32 sec)

mysql> INSERT INTO `powerplant`.`turbine` (`id`, `manufacturer`, `details`, `genarator`, `weight`) VALUES ('1', 'asitha', 'no', '1', '10');
ERROR 1054 (42S22): Unknown column 'weight' in 'field list'
mysql> 
mysql> ALTER TABLE `turbine`
    -> ADD COLUMN `weight` DOUBLE NULL AFTER `genarator`;
Query OK, 0 rows affected (0.60 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> INSERT INTO `powerplant`.`turbine` (`id`, `manufacturer`, `details`, `genarator`, `weight`) VALUES ('1', 'asitha', 'no', '1', '10');
Query OK, 1 row affected (0.06 sec)

mysql> SELECT * FROM 'genarator';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''genarator'' at line 1
mysql> SELECT * FROM genarator;
+----+-------------+
| id | outputpower |
+----+-------------+
|  1 |          10 |
+----+-------------+
1 row in set (0.01 sec)

mysql> SELECT * FROM turbine;
+----+--------------+---------+-----------+--------+
| id | manufacturer | details | genarator | weight |
+----+--------------+---------+-----------+--------+
|  1 | asitha       | no      |         1 |     10 |
+----+--------------+---------+-----------+--------+
1 row in set (0.00 sec)

mysql> UPDATE `powerplant`.`turbine` SET `manufacturer`='man1', `details`='yes' WHERE  `id`=1;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM turbine;
+----+--------------+---------+-----------+--------+
| id | manufacturer | details | genarator | weight |
+----+--------------+---------+-----------+--------+
|  1 | man1         | yes     |         1 |     10 |
+----+--------------+---------+-----------+--------+
1 row in set (0.00 sec)

mysql> INSERT INTO `powerplant`.`turbine` (`id`, `manufacturer`, `details`, `genarator`, `weight`) VALUES ('2', 'man2', 'no', '1', '20');
Query OK, 1 row affected (0.30 sec)

mysql> SELECT * FROM turbine;
+----+--------------+---------+-----------+--------+
| id | manufacturer | details | genarator | weight |
+----+--------------+---------+-----------+--------+
|  1 | man1         | yes     |         1 |     10 |
|  2 | man2         | no      |         1 |     20 |
+----+--------------+---------+-----------+--------+
2 rows in set (0.00 sec)

mysql> DELETE FROM `powerplant`.`turbine` WHERE  `id`=2;
Query OK, 1 row affected (0.31 sec)

mysql> SELECT * FROM turbine;
+----+--------------+---------+-----------+--------+
| id | manufacturer | details | genarator | weight |
+----+--------------+---------+-----------+--------+
|  1 | man1         | yes     |         1 |     10 |
+----+--------------+---------+-----------+--------+
1 row in set (0.00 sec)

mysql> SELECT details from turbine;
+---------+
| details |
+---------+
| yes     |
+---------+
1 row in set (0.00 sec)

mysql> INSERT INTO `powerplant`.`turbine` (`id`, `manufacturer`, `details`, `genarator`, `weight`) VALUES ('2', 'man2', 'no', '1', '20');
Query OK, 1 row affected (0.06 sec)

mysql> SELECT * FROM turbine;
+----+--------------+---------+-----------+--------+
| id | manufacturer | details | genarator | weight |
+----+--------------+---------+-----------+--------+
|  1 | man1         | yes     |         1 |     10 |
|  2 | man2         | no      |         1 |     20 |
+----+--------------+---------+-----------+--------+
2 rows in set (0.00 sec)

mysql> SELECT * FROM turbine WHERE id='1';
+----+--------------+---------+-----------+--------+
| id | manufacturer | details | genarator | weight |
+----+--------------+---------+-----------+--------+
|  1 | man1         | yes     |         1 |     10 |
+----+--------------+---------+-----------+--------+
1 row in set (0.00 sec)

mysql> exit
Bye



continued of mysql quary is in my other post next post

visit MySQL quary part 2
visit MySQL quary part 3
visit MySQL quary part 4

We can use HeidiSQL or PHPmyadmin like software for easily done mysql database manage.

















Saturday, July 7, 2018

How to Create PCB at home

First You Have to create PCB layout using any PCB designing software
  • Cad eagle
  • Proteus
  • Diptrace

Then get the printout of it bottom layer(Without Mirroring) using Laser Printer


Polish The Coper Clad board using sand paper


Place the printout in the copper clad board and iron it until the paint copied to the copper board




After that remove the paper by washing smoothly



Repair the damage printed part using permanent marker pen


Place printed Board in Ferric Chloride until unwanted copper part removed




Wash and remove the paint




then drill the holes using correct drill bit (commonly drill bit = 0.8 mm)



Mount the component and solder


If You want top side of the board also can printed using same method if there is no top copper you can print components layout in the top site of board.(if you print the top side it must have get printout with mirroring)

Thank you Prabash @ greek-programer.com for help to create this post