Get the Number of Columns in a MySQL Table

Anvi Jain
Updated on 29-Jun-2020 07:25:22

612 Views

To get the number of columns, use the aggregate function count(*) with information_schema table from MySQL. The syntax is as follows to find the number of columns −SELECT COUNT(*) as anyVariableName from INFORMATION_SCHEMA.COLUMNS where table_schema = ’yourDatabaseName’ and table_name = ’yourTableName’;To understand the above syntax, let us create a table with some columns. The following is the query to create a table −mysql> create table CountColumns −> (    −> Bookid int,    −> BookName varchar(200),    −> BookAuthorName varchar(200),    −> BookPublishedDate datetime −> ); Query OK, 0 rows affected (0.69 sec)Now, we have total 4 columns in my ... Read More

Set Existing Column as Primary Key in MySQL

Jennifer Nicholas
Updated on 29-Jun-2020 07:24:28

12K+ Views

You can set primary key on an existing column in MySQL with the help of alter command.The syntax is as follows to add primary key to an existing column.ALTER TABLE yourTableName ADD PRIMARY KEY(yourColumnName);To set existing column as primary key, let us first create a table. The query to create a table −mysql> create table AddingPrimaryKeyDemo    −> (       −> UniversityId int,       −> UniversityName varchar(200)    −> ); Query OK, 0 rows affected (1.16 sec)Look at the above query, I haven’t added primary key. Let us check the same with the help of DESC ... Read More

Move Rows from One Table to Another in MySQL

Anvi Jain
Updated on 29-Jun-2020 07:23:06

4K+ Views

You can move rows from one table to another with the help of INSERT INTO SELECT statement.The syntax is as follows −insert into yourDestinationTableName select *from yourOriginalTable where someConditionTo understand the above syntax. let us create a table. The following is the query to create a table −mysql> create table StudentTable    −> (       −> Id int,       −> Name varchar(100)    −> ); Query OK, 0 rows affected (0.65 sec)Now, I will create second table. The query is as follows −mysql> create table Employee    −> (       −> EmployeeId int   ... Read More

Create New Table with Properties of Old Table Without Duplicates Using MySQL LIKE Operator

Jennifer Nicholas
Updated on 29-Jun-2020 07:22:13

105 Views

To achieve this with LIKE operator, the following is the syntax −CREATE TABLE yourTableName2 LIKE yourTableName1;To understand the syntax, let us create a table and insert some records into it. The following is the query to create a table −mysql> create table Employee −> (    −> EmployeeId int    −> ,    −> EmployeeName varchar(100) −> ); Query OK, 0 rows affected (0.54 sec)Inserting records into the table with the help of insert command. The query is as follows −mysql> insert into Employee values(1, 'Carol'); Query OK, 1 row affected (0.18 sec) mysql> insert into Employee values(2, 'John'); ... Read More

CSS Before Pseudo Element

Arjun Thakur
Updated on 29-Jun-2020 07:21:33

177 Views

Use this element to insert some content before an element. The following example demonstrates how to use the :before element to add some content to any element.ExampleLive Demo                    p:before          {             content: url(/images/bullet.gif)          }                     This line will be preceded by a bullet.       This line will be preceded by a bullet.       This line will be preceded by a bullet.    

Shake Animation Effect with CSS

Lakshmi Srinivas
Updated on 29-Jun-2020 07:21:16

826 Views

The shake animation effect move (an object) up and down or from side to side for an element.ExampleLive Demo                    .animated {             background-image: url(/css/images/logo.png);             background-repeat: no-repeat;             background-position: left top;             padding-top:95px;             margin-bottom:60px;             -webkit-animation-duration: 10s;             animation-duration: 10s;             -webkit-animation-fill-mode: both;             animation-fill-mode: both;          }          @-webkit-keyframes shake {             0%, 100% {-webkit-transform: translateX(0);}             10%, 30%, 50%, 70%, 90% {-webkit-transform: translateX(-10px);}             20%, 40%, 60%, 80% {-webkit-transform: translateX(10px);}          }          @keyframes shake {             0%, 100% {transform: translateX(0);}             10%, 30%, 50%, 70%, 90% {transform: translateX(-10px);}             20%, 40%, 60%, 80% {transform: translateX(10px);}          }          .shake {             -webkit-animation-name: shake;             animation-name: shake;          }                           Reload page                function myFunction() {             location.reload();          }          

Delete All Records from a Table in MySQL

Rishi Rathor
Updated on 29-Jun-2020 07:20:56

15K+ Views

To delete all the records from a table in MySQL, use the TRUNCATE command. Let us fir see the syntax −TRUNCATE TABLE yourTableName.The above syntax will delete all the records from a table. Let us create a table to understand the above syntax −mysql> create table TruncateTableDemo −> (    −> BookId int    −> ,    −> BookName varchar(200) −> ); Query OK, 0 rows affected (0.54 sec)Inserting records in the table with the help of insert command. The query to insert records in the table are as follows −mysql> insert into TruncateTableDemo values(1001, 'C in Dept'); Query OK, ... Read More

Rotate Out Down Left Animation Effect with CSS

Nitya Raut
Updated on 29-Jun-2020 07:20:42

71 Views

To create rotate out down left animation effect with CSS, you can try to run the following code −ExampleLive Demo                    .animated {             background-image: url(/css/images/logo.png);             background-repeat: no-repeat;             background-position: left top;             padding-top:95px;             margin-bottom:60px;             -webkit-animation-duration: 10s;             animation-duration: 10s;             -webkit-animation-fill-mode: both;             animation-fill-mode: both;          }          @-webkit-keyframes rotateOutDownLeft {             0% {                -webkit-transform-origin: left bottom;                -webkit-transform: rotate(0);                opacity: 1;             }             100% {                -webkit-transform-origin: left bottom;                -webkit-transform: rotate(90deg);                opacity: 0;             }          }          @keyframes rotateOutDownLeft {             0% {                transform-origin: left bottom;                transform: rotate(0);                opacity: 1;             }             100% {                transform-origin: left bottom;                transform: rotate(90deg);                opacity: 0;             }          }          .rotateOutDownLeft {             -webkit-animation-name: rotateOutDownLeft;             animation-name: rotateOutDownLeft;          }                           Reload page                function myFunction() {             location.reload();          }          

Rotate Out Animation Effect with CSS

karthikeya Boyini
Updated on 29-Jun-2020 07:20:06

104 Views

To create rotate out animation effect with CSS, you can try to run the following code −ExampleLive Demo                    .animated {             background-image: url(/css/images/logo.png);             background-repeat: no-repeat;             background-position: left top;             padding-top:95px;             margin-bottom:60px;             -webkit-animation-duration: 10s;             animation-duration: 10s;             -webkit-animation-fill-mode: both;             animation-fill-mode: both;          }          @-webkit-keyframes rotateOut {             0% {                -webkit-transform-origin: center center;                -webkit-transform: rotate(0);                opacity: 1;             }             100% {                -webkit-transform-origin: center center;                -webkit-transform: rotate(200deg);                opacity: 0;             }          }          @keyframes rotateOut {             0% {                transform-origin: center center;                transform: rotate(0);                opacity: 1;             }             100% {                transform-origin: center center;                transform: rotate(200deg);                opacity: 0;             }          }          .rotateOut {             -webkit-animation-name: rotateOut;             animation-name: rotateOut;          }                           Reload page                function myFunction() {             location.reload();          }          

Rotate In Up Right Animation Effect with CSS

George John
Updated on 29-Jun-2020 07:19:39

128 Views

To create a rotate in upright animation effect with CSS, you can try to run the following code −ExampleLive Demo                    .animated {             background-image: url(/css/images/logo.png);             background-repeat: no-repeat;             background-position: left top;             padding-top:95px;             margin-bottom:60px;             -webkit-animation-duration: 10s;             animation-duration: 10s;             -webkit-animation-fill-mode: both;             animation-fill-mode: both;          }          @-webkit-keyframes rotateInUpRight {             0% {                -webkit-transform-origin: right bottom;                -webkit-transform: rotate(-90deg);                opacity: 0;             }             100% {                -webkit-transform-origin: right bottom;                -webkit-transform: rotate(0);                opacity: 1;             }          }          @keyframes rotateInUpRight {             0% {                transform-origin: right bottom;                transform: rotate(-90deg);                opacity: 0;             }             100% {                transform-origin: right bottom;                transform: rotate(0);                opacity: 1;             }          }          .rotateInUpRight {             -webkit-animation-name: rotateInUpRight;             animation-name: rotateInUpRight;          }                           Reload page                function myFunction() {             location.reload();          }          

Advertisements