Top menu

Thursday, 19 January 2017

Create View in MySql

Today we will learn how to create view ( with pictures)
Now we learning in this example creating table, create view and inserting values into view and linking to table that view

CREATE VIEW Syntax 

CREATE [OR REPLACE] 
 [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] 
 [DEFINER = { user | CURRENT_USER }]
 [SQL SECURITY { DEFINER | INVOKER }]
 VIEW view_name [(column_list)] 
 AS select_statement [WITH
[CASCADED | LOCAL] CHECK OPTION]

Here with an example exaplained(pictures)
1. create table t in the database/schema satya
2. insert values into that table
3. create view with the name v to that table t 


now created table and inserting data values.


now inserted data to the table









created view to the required table as above






here we learnt creating view. Thank you for viewing.

Other related topics:

cloud computing






Friday, 6 January 2017

Alter Table in MySqlWorkbench


Today we will learn how to alter table in MySqlWorkbench

ALTER TABLE STATEMENT

The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.

SQL ALTER TABLE Syntax

To delete a column in a table, use the following syntax (notice that some database systems don't allow deleting a column):

ALTER TABLE table_name
DROP COLUMN column_name

Here in example, we delete the "empsal" column with the following statement:


 Alter table satya.emp drop column emp.empsal;


Then execute it by clicking on second button.  then it green tick mark available.

We have to refresh it. Then it affects to the table we can see as in the columns list of the table.

 To add a column in a table, use the following syntax:
ALTER TABLE table_name
ADD column_name datatype

In my example, we are going to modify the table "emp" we are going to add a new column "salary"

Alter table emp add column designation varchar(40);

Then Press on execute button



Then if execution with no syntax errors, green tick marks appears.




Then added column name in the column list of the table.







Related Topics:





Monday, 2 January 2017

How to create Database Table in MySql(with pictures)

Today we will learn how to create Database Table in MySql workbench:

First we need to create Schema then to that schema we can add tables and insert data into that tables

    1.       Open Mysql Workbench





2. Open Database menu click on Connect to Database







3.       Change Stored Connection: First default with local some server but we have to make it blank




4.       Click Button Store in Value and enter password in the above screen and press OK button





5.       Click on Ok Button




6.       Click on + Database icon for create a new schema  




 


7.       Enter new schema in this example I am using yearly and click and apply button.

8.       Then this screen appears



9.       And again click on apply button






10.   Click finish button




11.   Again click on Apply button


12.   Now schema created next we have to create Tables to that schema





13.   Enter table name And double click
14.    
 



1   5.   Enter column name and Data type

1   6.   Enter double click for Create other columns as per requirement

1   7.    


1   8.    



1    9.   Click on Apply button

      10.   Then this screen appears
      11.    

     12.   Check the syntax and fields and click on Apply Button

     13.   Then click Finish Button. Now table created

 








      14.   In two ways you can add data to table first by using Insert statement and second by Gui grid base






Click on Apply Button








     15.   Click on Finish Button.

     16.   Second method to by Insert Statement for that create new Sql Editor

     17.   Then enter script like this

 





 
    18.   press this execute icon as shown below


    19.   Then to view in grid

    
3 
3  



That’s it we have learnt about creation of table and inserting data values into tables with 2 ways.

Related Topics:

Ubuntu         Cloud Computing        Ecommerce