Skip to main content

Posts

World Nomads Logo

How to create VIEW in MySQL?

MySQL Create VIEW A VIEW is created by SELECT statements. SELECT statements are used to take data from the source table to make a VIEW. Syntax: CREATE [OR REPLACE] VIEW view_name AS  SELECT columns  FROM tables  [WHERE conditions];  Parameters: OR REPLACE: It is optional. It is used when a VIEW already exist. If you do not specify this clause and the VIEW already exists, the CREATE VIEW statement will return an error. view_name: It specifies the name of the VIEW that you want to create in MySQL. WHERE conditions: It is also optional. It specifies the conditions that must be met for the records to be included in the VIEW. The following example will create a VIEW name "trainer". This is a virtual table made by taking data from the table "courses". CREATE VIEW trainer AS  SELECT course_name, course_trainer   FROM courses;  To see the created VIEW: Syntax: SELECT * FROM view_name;  Let's see how it looks the created VIEW: S...

What are the basic phone features and types of phone?

Types of Phones:- CDMA (Code Division Multiple Access) — A network that digitizes communication using a specific frequency; it behaves much like GSM, but the two are not compatible. Before traveling internationally, be sure to find out which is used to make sure your phone will work when you reach your destination. GSM (Global System for Mobile Communications) — A digital cellular network which behaves much like CDMA, but the two are not compatible. GSM is commonly used in Europe. 3G phones — "Third-generation" devices. Third generation technology makes it possible for cell phones to accommodate broadband wireless data in addition to traditional cell phone functionality (e.g. e-mail download and Internet access). There are other Internet technologies that perform similarly but are not called "3G" specifically. Features Accessories — Manufacturers offer a number of accessories that can make phones even more convenient to use, such as hands-free options (hea...

How to TRUNCATE table in MySQL?

MYSQL TRUNCATE statement removes the complete data without removing its structure. The TRUNCATE TABLE statement is used when you want to delete the complete data from a table without removing the table structure. Syntax: TRUNCATE TABLE  table_name; Example: This example specifies how to truncate a table. In this example, we truncate the table "cus_tbl". TRUNCATE TABLE  cus_tbl; See the table: SELECT* FROM cus_tbl; MySQL DROP Table MYSQL DROP table statement removes the complete data with structure. Syntax: DROP TABLE  table_name; Example: This example specifies how to drop a table. In this example, we are dropping the table "cus_tbl". DROP TABLE  cus_tbl; MySQL TRUNCATE Table vs DROP Table:- You can also use DROP TABLE command to delete complete table but it will remove complete table data and structure both. You need to re-create the table again if you have to store some data. But in the case of TRUNCATE TABLE, it removes only table data not st...

How to RENAME column and table itself in MySQL?

5) RENAME column in table Syntax: ALTER TABLE table_name CHANGE COLUMN old_name new_name  column_definition [ FIRST | AFTER column_name ] Example: In this example, we will change the column name "cus_surname" to "cus_title". Use the following query to do this:  ALTER TABLE  cus_tbl CHANGE COLUMN cus_surname cus_title varchar(20) NOT NULL; 6) RENAME table Syntax: ALTER TABLE table_name RENAME TO new_table_name; Example: In this example, the table name cus_tbl is renamed as cus_table. ALTER TABLE cus_tbl RENAME TO cus_table; Subscribe channel on  YouTube Read this post on  Blogger Like page on  Facebook Tweet about video on  twitter Let's chat on  whatsapp See you at  Instagram Google +

How to Modify column definition in MySQL?

3) MODIFY column in the table The MODIFY command is used to change the column definition of the table. Syntax: ALTER TABLE table_name  MODIFY column_name column_definition  [ FIRST | AFTER column_name ];  Example: In this example, we modify the column cus_surname to be a data type of varchar(50) and force the column to allow NULL values. Use the following query to do this: ALTER TABLE cus_tbl  MODIFY cus_surname varchar(50) NULL;  4) DROP column in table Syntax: ALTER TABLE table_name  DROP COLUMN column_name;  Let's take an example to drop the column name "cus_address" from the table "cus_tbl". Use the following query to do this: ALTER TABLE cus_tbl  DROP COLUMN cus_address; Continue... Subscribe channel on  YouTube Read this post on  Blogger Like page on  Facebook Tweet about video on  twitter Let's chat on  whatsapp See you at  Instagram Google +

Contact Us

Name

Email *

Message *