Insert Data into a MySQL Table

Swarali Sree
Updated on 20-Jun-2020 07:34:22

494 Views

For inserting data into a MySQL table we need to use INSERT INTO command. We must have to specify values for all the columns of the table in INSERT INTO command.SyntaxINSERT INTO table_name values(value1, value2, …)ExampleSuppose we have a table named ‘Student’ with three columns ‘RollNo’, ‘Name’ and ‘Class’ then with the help of following query we can add new rows to the table −mysql> INSERT INTO Student values(50, 'Harshit', ’B.tech’); Query OK, 1 row affected (0.07 sec) mysql> INSERT INTO Student values(56, 'Amit', ’M.tech’); Query OK, 1 row affected (0.05 sec) mysql> Select * from Student; +---------+-------------+-----------+ ... Read More

Check Character Set of All Tables in MySQL Database

Rishi Rathor
Updated on 20-Jun-2020 07:33:43

181 Views

With the help of the following MySQL query we can check the character sets of all the tables in a particular database −mysql> Select Column_name, TABLE_NAME, CHARACTER_SET_NAME FROM        INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'db_name';ExampleFor example, the query below returns the character sets of all the tables along with the column names in a database named ‘Alpha’.mysql> Select Column_name 'Column', TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'Alpha'; +---------+------------+--------------------+ | Column  | TABLE_NAME | CHARACTER_SET_NAME | +---------+------------+--------------------+ | Name    | employee   | latin1             | | email   | employee   ... Read More

Check Character Set of All Tables in MySQL Database

V Jyothi
Updated on 20-Jun-2020 07:33:19

2K+ Views

With the help of the following MySQL query we can check the character sets of all the tables in a particular database −mysql> Select TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'db_name';ExampleFor example, the query below returns the character sets of all the tables in a database named ‘Alpha’.mysql> Select TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'Alpha'; +------------+--------------------+ | TABLE_NAME | CHARACTER_SET_NAME | +------------+--------------------+ | employee   | latin1             | | employee   | latin1             | | student    | latin1             ... Read More

Check Character Set of MySQL Table Columns

Daniol Thomas
Updated on 20-Jun-2020 07:32:48

499 Views

Following is the query to check character set of the columns of MySQL table −mysql> Select Column_name 'Column', Character_set_name 'Charset' FROM        information_schema.columns where table_schema = 'db_name' and        table_name ='table_name';ExampleFor example, the query below returns the name of the columns of ‘test_char_set’ table in a database named ‘sample’ along with the character sets of those columns.mysql> Select Column_name 'Column', Character_set_name 'Charset' FROM        information_schema.columns where table_schema = 'Sample' and        table_name ='test_char_set'; +--------+---------+ | Column | Charset | +--------+---------+ | Name   | latin1  | | Field  | latin1  | ... Read More

Check Default Character Sets of a MySQL Database

Priya Pallavi
Updated on 20-Jun-2020 07:32:16

182 Views

Following is the query to check default character set of the particular MySQL database −mysql> SELECT SCHEMA_NAME 'DatabaseName', default_character_set_name 'Charset' FROM information_schema.SCHEMATA where schema_name = 'db_name';ExampleFor example, the query below will return the default character set of a database named ‘Sample’ −mysql> SELECT SCHEMA_NAME 'DatabaseName', default_character_set_name 'Charset' FROM information_schema.SCHEMATA where schema_name = 'Sample'; +----------------+---------+ | DatabaseName   | Charset | +----------------+---------+ | Sample         | latin1  | +----------------+---------+ 1 row in set (0.00 sec)

Use JSON.stringify Method in jQuery

Kristi Castro
Updated on 20-Jun-2020 07:32:07

564 Views

JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. Use the JSON.stringify() method to convert a JavaScript object into a string.You can try to run the following code to learn how to work with JSON.stringify() method −ExampleLive Demo JSON string is created above   var v = { "name":"Amit", "Rank":1, "city":"India"};   var newJSON = JSON.stringify(v);   document.getElementById("test").innerHTML = newJSON;

Delete a Single Row from a MySQL Table

Akshaya Akki
Updated on 20-Jun-2020 07:31:48

406 Views

We can use DELETE statement along with a WHERE clause, which identifies that particular row, to delete a row from MySQL table.Examplemysql> Select * from names; +------+-----------+ | id   | name      | +------+-----------+ | 1    | Rahul     | | 2    | Gaurav    | | 3    | Raman     | | 4    | Aarav     | | 5    | Ram       | +------+-----------+ 5 rows in set (0.00 sec) mysql> DELETE from names where id = 4; Query OK, 1 row affected (0.07 sec)The query above will delete a single row having id = 4 from table ‘names’.mysql> Select * from names; +------+-----------+ | id   | name      | +------+-----------+ | 1    | Rahul     | | 2    | Gaurav    | | 3    | Raman     | | 5    | Ram       | +------+-----------+ 4 rows in set (0.00 sec)

Delete Multiple Rows from a MySQL Table

Lakshmi Srinivas
Updated on 20-Jun-2020 07:31:13

7K+ Views

We can use DELETE statement along with a WHERE clause, which identifies those multiple rows, to delete multiple rows from MySQL table.Examplemysql> Select * from names; +------+-----------+ | id   | name      | +------+-----------+ | 1    | Rahul     | | 2    | Gaurav    | | 3    | Raman     | | 5    | Ram       | +------+-----------+ 4 rows in set (0.00 sec) mysql> DELETE from names WHERE id > 2; Query OK, 2 rows affected (0.04 sec)The query above will delete multiple rows because WHERE clause identify two rows having id > 2 from table ‘names’.mysql> Select * from names; +------+-----------+ | id   | name      | +------+-----------+ | 1    | Rahul     | | 2    | Gaurav    | +------+-----------+ 2 rows in set (0.00 sec)

Increase Duration of jQuery Effects

Kristi Castro
Updated on 20-Jun-2020 07:31:03

334 Views

To increase the duration of jQuery effects, set the optional speed parameter. The values include, slow, fast, milliseconds, etc. The fast value is used to increase the duration.Let us see an example with fadeIn() jQuery method. The fadeIn( ) method fades in all matched elements by adjusting their opacity and firing an optional callback after completion. Here is the description of all the parameters used by this method −speed − A string representing one of the three predefined speeds ("slow", "def", or "fast") or the number of milliseconds to run the animation (e.g. 1000).callback − This is optional parameter representing ... Read More

Adjust Height of iFrame Based on Loaded Content using jQuery

Kristi Castro
Updated on 20-Jun-2020 07:25:20

2K+ Views

To adjust the height of iframe, use the jQuery height() method. You can try to run the following code to adjust height of iframe dynamically on button click:ExampleLive Demo                 $(document).ready(function(){         $("button").click(function(){           $("iframe").height(300);         });       });             Change Height

Advertisements