Articles on Trending Technologies

Technical articles with clear explanations and examples

Create MySQL column with Key=MUL?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 6K+ Views

You need to use ADD KEY to make a column with Key=MUL. The syntax is as follows −ALTER TABLE yourTableName MODIFY COLUMN yourColumnName data type, ADD KEY(yourColumnName);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table Instructor    -> (    -> Instructor_Id int,    -> Instructor_Name varchar(30),    -> Instructor_CourseName varchar(100)    -> ); Query OK, 0 rows affected (0.63 sec)Now you can look the table description of the table, the column KEY does not have any MUL key. The query is as follows to check the ...

Read More

How do I pass a variable to a MySQL script?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 4K+ Views

You can pass a variable to a MySQL script using session variable. First you need to set a session variable using SET command. After that you need to pass that variable to a MySQL script.The syntax is as follows −First Step: Use of Set command.SET @anyVariableName − = ’yourValue’;Second Step: Pass a variable to a MySQL script.UPDATE yourTableName SET yourColumnName1 = yourColumnName1+integerValue WHERE yourColumnName2 = @anyVariableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table Employee_Information    -> (    -> EmployeeId int NOT NULL AUTO_INCREMENT,    -> ...

Read More

What is the significance of dandy in Oscar Wilde's plays?

Ridhi Arora
Ridhi Arora
Updated on 30-Jul-2019 590 Views

By the last decade of the nineteenth century, Drama as an occupation and the theatre as a profession had undergone huge changes. In the last three decades of the century with the famous playwrights Oscar Wilde (1865-1900), George Bernard Shaw (1856-1950), Sydney Grundy (1848-1914) the theatre began to gain a refined literary tone.Wilde’s Writing StyleWilde managed to collaborate the attributes, from a wide range of styles, practices, and genres, from drama, fiction and lyric, into finely patterned theatre events. He used satire, a scintillating wit, symbolism, literariness and farcical situations in his plays. His plays are aristocratic in its outlook, ...

Read More

MySQL CREATE USER with a variable?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 1K+ Views

You can use a dynamic query for this. First set the variable name for username and variable name for a password. The syntax is as follows −SET @anyVariableName=’yourUserName’; SET @anyVariableName1=’yourpassword’;Now you can use the CONCAT() function from MySQL. The syntax is as follows −SET @yourQueryName = CONCAT ('    CREATE USER "', @anyVariableName, '"@"localhost" IDENTIFIED BY "', @anyVariableName1, '" ' );Let us use the prepared statement PREPARE. The syntax is as follows −PREPARE yourStatementVariableName FROM @yourQueryName;Now you can execute the statement. The syntax is as follows −EXECUTE yourStatementVariableName;Deallocate the above using the DEALLOCATE PREPARE. The syntax is as follows −DEALLOCATE ...

Read More

How to quote values using MySQL group_concat?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 1K+ Views

You can quote values using concat() and grop_concat() function from MySQL. The syntax is as follows −SELECT GROUP_CONCAT(CONCAT(' '' ', yourColumnName, ' '' ' )) as anyVariableName from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table Group_ConcatDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,      -> Value int,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (1.56 sec)Now you can insert some records in the table using insert command. The query is as follows −mysql> insert into Group_ConcatDemo(Value) ...

Read More

Who was Robert Browning and what was special regarding his writing style?

Ridhi Arora
Ridhi Arora
Updated on 30-Jul-2019 5K+ Views

Born in 1812 in London, Robert Browning enjoys the pinnacle of popularity only because of his prowess to portray his thoughts. You can understand it with this fact that his grave is now adjacent to that of Lord Alfred Tennyson.His Famous Works"Pauline, a Fragment of a Confession" , which is a long poem composed in homage to P.B. Shelley, “My Last Duchess”, “Porphyria’s lover”, “Andrea del Sarto”, “ A grammarian’s funeral”, Men and Women are some of his popular works for which he is remembered even now.Browning’s Unique Writing StyleDramatic Monologue: His critical reputation rests mainly due to his dramatic ...

Read More

MySQL's now() +1 day?

George John
George John
Updated on 30-Jul-2019 6K+ Views

The statement now()+1 day itself states that we need to add a day to the current datetime. You can write the above logic like this −now()+interval 1 day;Or you can write same logic with date_add() function from MySQL like this −date_add(now(), interval 1 day);Let us use the above concept with MySQL select statement. The query is as follows −mysql> select now()+ interval 1 day;Here is the sample output that increments a day by 1 −+-----------------------+ | now()+ interval 1 day | +-----------------------+ | 2018-11-23 15:43:10 | +-----------------------+ 1 row in set (0.05 sec)Now, let us see another example ...

Read More

Sort by date & time in descending order in MySQL?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 3K+ Views

Let us create a table to sort date and time in ascending order. The query to create a table is as follows −mysql> create table SortByDateAndTime    -> (    -> UserId int,    -> UserName varchar(100),    -> IssueDate date,    -> IssueTime time    -> ); Query OK, 0 rows affected (0.60 sec)Insert the records in the table using insert command. The query is as follows −mysql> insert into SortByDateAndTime values(1, 'John', '2018-12-16', '10:30'); Query OK, 1 row affected (0.14 sec) mysql> insert into SortByDateAndTime values(2, 'Bob', '2018-12-16', '10:10'); Query OK, 1 row affected (0.14 sec) ...

Read More

Easy way to re-order columns in MySQL?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 10K+ Views

To re-order columns in MySQL, use the ALTER TABLE MODIFY COLUMN. The syntax is as follows -ALTER TABLE yourTableName MODIFY COLUMN yourColumnName data type after yourColumnName.To understand the above syntax, let us first create a table. The query to create a table is as follows.mysql> create table reOrderColumn -> ( -> ProductId int, -> DeliveryDate datetime, -> ProductName varchar(100) -> ); Query OK, 0 rows affected (0.76 sec)Now check the description of the table. The query is as follows.mysql> desc reOrderColumn;The following is the output.+--------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+-------+ | ...

Read More

List of non-empty tables in all your MySQL databases?

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 1K+ Views

To list non-empty tables in MySQL database, use “information_schema.tables”. The following is the query for all database tables −mysql> select table_type, table_name from information_schema.tables    −> where table_rows >= 1;Above, we have considered only the table that have 1 or more than 1 rows i.e. non-empty table.The following is the output −+------------+------------------------------------------------------+ | TABLE_TYPE | TABLE_NAME                                           | +------------+------------------------------------------------------+ | BASE TABLE | innodb_table_stats                                 ...

Read More
Showing 60371–60380 of 61,297 articles
Advertisements